| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295 |
- export default {
- data() {
- return {
- taskList: [],
- currentFilter: 'default', // default, distance, time
- filterCondition: '筛选条件',
- sortDistance: 'asc', // asc, desc
- sortTime: 'asc',
- scrollTop: 0, // Track scroll position
- isFilterShow: false,
- tempFilter: {
- service: '全部',
- distance: '全部',
- amount: '全部'
- },
- activeFilter: {
- service: '全部',
- distance: '全部',
- amount: '全部'
- },
- workStatus: 'working', // working | resting
- showConfirmModal: false,
- showPetModal: false,
- currentPetInfo: {},
- showRejectModal: false,
- rejectReason: '',
- currentOrder: null,
- showAcceptConfirmModal: false,
- showNavModal: false,
- navTargetItem: null,
- navTargetPointType: ''
- }
- },
- onPageScroll(e) {
- this.scrollTop = e.scrollTop;
- },
- onLoad() {
- // Initial load
- this.checkWorkStatus();
- this.loadTaskList();
- },
- onShow() {
- // Update status when returning from other pages
- this.checkWorkStatus();
- },
- methods: {
- checkWorkStatus() {
- const status = uni.getStorageSync('workStatus');
- if (status) {
- this.workStatus = status;
- } else {
- // Default to working if not set
- this.workStatus = 'working';
- uni.setStorageSync('workStatus', 'working');
- }
- },
- toggleFilter() {
- if (this.workStatus === 'resting') return; // Disable filter when resting? Or keep it? User didn't specify, but usually disabled. Let's keep it enabled for now as they might look at filters before working.
- this.isFilterShow = !this.isFilterShow;
- },
- goToWorkStatus() {
- uni.navigateTo({
- url: '/pages/home/work-status'
- });
- },
- startWork() {
- this.showConfirmModal = true;
- },
- confirmStartWork() {
- this.workStatus = 'working';
- uni.setStorageSync('workStatus', 'working');
- this.loadTaskList();
- this.showConfirmModal = false;
- uni.showToast({ title: '已开始接单', icon: 'success' });
- },
- closeConfirmModal() {
- this.showConfirmModal = false;
- },
- showPetProfile(item) {
- this.currentPetInfo = item;
- this.showPetModal = true;
- },
- closePetProfile() {
- this.showPetModal = false;
- },
- openRejectModal(item) {
- this.currentOrder = item;
- this.rejectReason = '';
- this.showRejectModal = true;
- },
- closeRejectModal() {
- this.showRejectModal = false;
- this.currentOrder = null;
- },
- confirmReject() {
- if (!this.rejectReason.trim()) {
- uni.showToast({ title: '请输入拒绝理由', icon: 'none' });
- return;
- }
- // Add actual API call here
- uni.showToast({ title: '已拒绝接单', icon: 'success' });
- this.showRejectModal = false;
- },
- openAcceptModal(item) {
- this.currentOrder = item;
- this.showAcceptConfirmModal = true;
- },
- closeAcceptModal() {
- this.showAcceptConfirmModal = false;
- this.currentOrder = null;
- },
- confirmAccept() {
- // Add actual API call here
- uni.showToast({ title: '接单成功', icon: 'success' });
- this.showAcceptConfirmModal = false;
- },
- openNavigation(item, pointType) {
- this.navTargetItem = item;
- this.navTargetPointType = pointType;
- this.showNavModal = true;
- },
- closeNavModal() {
- this.showNavModal = false;
- },
- chooseMap(mapType) {
- let item = this.navTargetItem;
- let pointType = this.navTargetPointType;
- let name = pointType === 'start' ? item.startLocation : item.endLocation;
- let address = pointType === 'start' ? item.startAddress : item.endAddress;
- this.showNavModal = false;
- uni.openLocation({
- latitude: 30.52, // Mock lat
- longitude: 114.31, // Mock lng
- name: name || '目的地',
- address: address || '默认地址',
- success: function () {
- console.log('打开导航成功: ' + mapType);
- }
- });
- },
- selectService(type) {
- this.tempFilter.service = type;
- },
- selectDistance(type) {
- this.tempFilter.distance = type;
- },
- selectAmount(type) {
- this.tempFilter.amount = type;
- },
- resetFilter() {
- this.tempFilter = {
- service: '全部',
- distance: '全部',
- amount: '全部'
- };
- },
- confirmFilter() {
- this.activeFilter = { ...this.tempFilter };
- this.isFilterShow = false;
- uni.showToast({ title: '筛选已生效', icon: 'none' });
- // Add filtering logic here if needed
- },
- closeFilter() {
- this.isFilterShow = false;
- },
- goToDetail(item) {
- console.log('Go to detail', item);
- },
- loadTaskList() {
- this.taskList = [
- {
- type: 1, // 接送
- typeText: '接送',
- typeIcon: '/static/icons/car.svg', // Ensure this is the yellow car icon
- price: '20.00',
- timeLabel: '取货时间',
- time: '2026/02/10 10:00',
- petAvatar: '/static/dog.png',
- petName: '哈士奇宝宝',
- petBreed: '哈士奇',
- petGender: 'M',
- petAge: '2岁',
- petWeight: '12kg',
- petPersonality: '活泼好动,亲人',
- petHobby: '喜欢追球,爱吃鸡胸肉',
- petRemark: '无特殊过敏史',
- petTags: ['已免疫', '已绝育', '性格温顺'],
- petLogs: [
- { date: '2026/01/15', content: '左后腿有点敏感,剪指甲时要注意。', recorder: '李海' },
- { date: '2025/12/28', content: '今天便便正常,精神很好。', recorder: '张三' },
- { date: '2025/10/11', content: '模拟更多备注数据,测试吸顶滚动效果 1...', recorder: '系统记录' },
- { date: '2025/10/12', content: '模拟更多备注数据,测试吸顶滚动效果 2...', recorder: '系统记录' }
- ],
- startLocation: '武汉大学宠物店',
- startAddress: '武汉市洪山区珞喻路458号',
- startDistance: '0.5km',
- endLocation: '张** 189****8451',
- endAddress: '武汉市武昌区新区大道凤凰广场A座一楼25号',
- endDistance: '2.5km',
- remark: '这里是订单备注信息。'
- },
- {
- type: 2, // 喂遛
- typeText: '喂遛',
- typeIcon: '/static/icons/walk.svg', // Ensure this is the orange walk icon
- price: '35.00',
- timeLabel: '服务时间',
- time: '2026/02/11 14:00',
- petAvatar: '/static/dog.png',
- petName: '金毛',
- petBreed: '金毛寻回犬',
- petGender: 'F',
- petAge: '3岁',
- petWeight: '25kg',
- petPersonality: '温顺,听话',
- petHobby: '喜欢玩飞盘',
- petRemark: '暂无',
- petTags: ['已免疫', '未绝育'],
- petLogs: [],
- // Walking order typically has a service address (destination)
- endLocation: '王女士 138****1234',
- endAddress: '武汉市江汉区泛海国际居住区',
- endDistance: '1.2km',
- serviceContent: '需自带牵引绳,遛弯30分钟。',
- remark: '狗狗比较活泼,请注意安全。'
- },
- {
- type: 3, // 洗护
- typeText: '洗护',
- typeIcon: '/static/icons/wash.svg',
- price: '50.00',
- timeLabel: '服务时间',
- time: '2026/02/12 09:30',
- petAvatar: '/static/dog.png', // Or cat avatar if available
- petName: 'Mimi',
- petBreed: '布偶猫',
- petGender: 'F',
- petAge: '1.5岁',
- petWeight: '5kg',
- petPersonality: '胆小,怕生',
- petHobby: '喜欢梳毛',
- petRemark: '对水敏感',
- petTags: ['已免疫'],
- petLogs: [],
- endLocation: '赵先生 159****9876',
- endAddress: '武汉市汉阳区钟家村',
- endDistance: '3.0km',
- serviceContent: '上门洗澡,剪指甲。',
- remark: '猫咪有点怕生。'
- },
- {
- type: 1, // 接送 (Repeat for demo)
- typeText: '接送',
- typeIcon: '/static/icons/car.svg',
- price: '25.00',
- timeLabel: '取货时间',
- time: '2026/02/13 11:00',
- petAvatar: '/static/dog.png',
- petName: '柯基',
- petBreed: '柯基犬',
- petGender: 'M',
- petAge: '2岁',
- petWeight: '10kg',
- petPersonality: '活泼',
- petHobby: '散步',
- petRemark: '',
- petTags: [],
- petLogs: [],
- startLocation: '宠物医院',
- startAddress: '武汉市武昌区中南路',
- startDistance: '1.0km',
- endLocation: '李小姐 136****5678',
- endAddress: '武汉市武昌区积玉桥',
- endDistance: '4.5km',
- remark: '请带上笼子。'
- }
- ]
- },
- setFilter(type) {
- this.currentFilter = type;
- if (type === 'distance') {
- this.sortDistance = this.sortDistance === 'asc' ? 'desc' : 'asc';
- uni.showToast({ title: `按距离${this.sortDistance === 'asc' ? '升序' : '降序'}`, icon: 'none' });
- } else if (type === 'time') {
- this.sortTime = this.sortTime === 'asc' ? 'desc' : 'asc';
- uni.showToast({ title: `按时间${this.sortTime === 'asc' ? '升序' : '降序'}`, icon: 'none' });
- }
- },
- showFilterDropdown() {
- this.toggleFilter();
- }
- }
- }
|