| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
- export default {
- data() {
- return {
- orderType: 1, // 1:接送, 2:喂遛, 3:洗护
- // Define steps dynamically based on type
- stepsPickup: ['接单', '到达', '出发', '送达', '完成'],
- stepsWalkWash: ['接单', '到达', '开始', '结束', '完成'],
- currentStep: 1, // 0-indexed (1 means 到达)
- // Mock Data
- orderDetail: {
- type: 1,
- price: '20.00',
- timeLabel: '取货时间',
- time: '2026/02/10 10:00',
- petAvatar: '/static/dog.png',
- petName: '哈士奇宝宝',
- petBreed: '哈士奇',
- serviceTag: '宠物接送',
- startLocation: '武汉大学宠物店',
- startAddress: '武汉市洪山区珞喻路458号',
- endLocation: '张** 189****8451',
- endAddress: '武汉市武昌区新区大道凤凰广场A座一楼25号',
- serviceContent: '这里是订单服务内容。',
- remark: '这里是订单备注信息。',
- orderNo: 'T1001',
- createTime: '2026/02/10 09:30',
- progressLogs: [
- { status: '您已接单', time: '2026-02-10 10:00' }
- ]
- },
- // Modal states
- showPetModal: false,
- currentPetInfo: {},
- showNavModal: false,
- navTargetPointType: '',
- // Upload Modal State
- showUploadModal: false,
- modalMediaList: [],
- modalRemark: '',
- // 宠护小结弹窗状态
- showSumModal: false,
- sumContent: '',
- sumDate: '',
- sumSigner: '张*哥',
- // 宠物备注弹窗状态
- showPetRemarkInput: false,
- petRemarkText: ''
- }
- },
- computed: {
- steps() {
- return this.orderType === 1 ? this.stepsPickup : this.stepsWalkWash;
- },
- displayStatusText() {
- let status = this.steps[this.currentStep];
- if (status === '已完成' || status === '完成') return '已完成';
- if (status === '已拒绝') return '已拒绝';
- if (status === '接单') {
- return this.orderType === 1 ? '待接送' : '待服务';
- }
- // For other active states (出发, 到达, 送达, 开始, 结束)
- return this.orderType === 1 ? '配送中' : '服务中';
- },
- currentStatusText() {
- return this.steps[this.currentStep];
- },
- currentTaskTitle() {
- let action = this.steps[this.currentStep];
- if (action === '到达') return '到达打卡';
- if (action === '开始') return '开始服务';
- if (action === '出发') return '确认出发';
- if (action === '送达' || action === '结束') return '服务完成';
- return action;
- },
- currentTaskDesc() {
- let action = this.steps[this.currentStep];
- if (action === '到达') {
- return '打卡穿着工装消毒站门口的照片或视频';
- }
- if (this.orderType === 1) { // 送货
- if (action === '出发') return '拍摄宠物上车/出发时的状态照片或视频';
- if (action === '送达') return '打卡确认送达的照片或视频';
- } else if (this.orderType === 2) { // 喂遛
- if (action === '开始') return '开始服务并拍摄照片或视频';
- if (action === '结束') return '服务完成拍摄照片或视频';
- } else if (this.orderType === 3) { // 洗护
- if (action === '开始') return '开始服务并拍摄照片或视频';
- if (action === '结束') return '服务完成拍摄照片或视频';
- }
- return '请按要求提交照片或视频及备注';
- }
- },
- onLoad(options) {
- if (options.type) {
- this.orderType = parseInt(options.type);
- this.orderDetail.type = this.orderType;
- if (this.orderType === 2 || this.orderType === 3) {
- this.orderDetail.serviceTag = this.orderType === 2 ? '上门喂遛' : '上门洗护';
- this.orderDetail.orderNo = this.orderType === 2 ? 'W1002' : 'X1003';
- this.currentStep = 1;
- }
- }
- },
- methods: {
- showPetProfile() {
- // Use orderDetail basic info and mock the rest
- this.currentPetInfo = {
- ...this.orderDetail,
- petGender: 'M',
- petAge: '2岁',
- petWeight: '15kg',
- petPersonality: '活泼亲人,精力旺盛',
- petHobby: '喜欢追飞盘,爱吃肉干',
- petRemark: '肠胃较弱,不能乱喂零食;出门易爆冲,请拉紧牵引绳。',
- petTags: ['拉响警报', '不能吃鸡肉', '精力旺盛'],
- petLogs: [
- { date: '2026-02-09 14:00', content: '今天遛弯拉了两次粑粑,精神状态很好。', recorder: '王阿姨' },
- { date: '2026-02-08 10:30', content: '有些挑食,剩了小半碗狗粮。', recorder: '李师傅' },
- { date: '2026-02-05 09:00', content: '建档。', recorder: '系统记录' }
- ]
- };
- this.showPetModal = true;
- },
- closePetProfile() {
- this.showPetModal = false;
- },
- openPetRemarkInput() {
- this.petRemarkText = '';
- this.showPetRemarkInput = true;
- },
- closePetRemarkInput() {
- this.showPetRemarkInput = false;
- },
- submitPetRemark() {
- if (!this.petRemarkText.trim()) {
- uni.showToast({ title: '备注内容不能为空', icon: 'none' });
- return;
- }
- const now = new Date();
- const date = `${now.getFullYear()}/${String(now.getMonth() + 1).padStart(2, '0')}/${String(now.getDate()).padStart(2, '0')}`;
- if (!this.currentPetInfo.petLogs) {
- this.currentPetInfo.petLogs = [];
- }
- this.currentPetInfo.petLogs.unshift({
- date: date,
- content: this.petRemarkText,
- recorder: '张*哥'
- });
- this.closePetRemarkInput();
- uni.showToast({ title: '备注已添加', icon: 'success' });
- },
- goToAnomaly() {
- uni.navigateTo({
- url: '/pages/orders/anomaly?orderId=' + (this.orderDetail.orderNo || '')
- });
- },
- callPhone() {
- uni.makePhoneCall({ phoneNumber: '18900008451' });
- },
- openNavigation(type) {
- this.navTargetPointType = type;
- this.showNavModal = true;
- },
- closeNavModal() {
- this.showNavModal = false;
- },
- chooseMap(mapType) {
- let pointType = this.navTargetPointType;
- let name = pointType === 'start' ? this.orderDetail.startLocation : this.orderDetail.endLocation;
- let address = pointType === 'start' ? this.orderDetail.startAddress : this.orderDetail.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);
- }
- });
- },
- openUploadModal() {
- this.modalMediaList = [];
- this.modalRemark = '';
- this.showUploadModal = true;
- },
- closeUploadModal() {
- this.showUploadModal = false;
- },
- chooseModalMedia() {
- uni.chooseImage({
- count: 5 - this.modalMediaList.length,
- success: (res) => {
- this.modalMediaList = this.modalMediaList.concat(res.tempFilePaths);
- uni.showToast({ title: '添加成功', icon: 'none' });
- }
- });
- },
- removeModalMedia(index) {
- this.modalMediaList.splice(index, 1);
- },
- getCurrentTime() {
- const now = new Date();
- const y = now.getFullYear();
- const m = String(now.getMonth() + 1).padStart(2, '0');
- const d = String(now.getDate()).padStart(2, '0');
- const h = String(now.getHours()).padStart(2, '0');
- const min = String(now.getMinutes()).padStart(2, '0');
- return `${y}/${m}/${d} ${h}:${min}`;
- },
- confirmUploadModal() {
- if (this.modalMediaList.length === 0) {
- uni.showToast({ title: '请上传至少一张图片或视频', icon: 'none' });
- return;
- }
- // Append to timeline
- this.orderDetail.progressLogs.unshift({
- status: this.currentTaskTitle,
- time: this.getCurrentTime(),
- medias: [...this.modalMediaList],
- remark: this.modalRemark
- });
- // Advance step
- if (this.currentStep < this.steps.length - 1) {
- this.currentStep++;
- }
- this.closeUploadModal();
- uni.showToast({ title: '打卡成功', icon: 'success' });
- // Check if it's finished now
- if (this.currentStep === this.steps.length - 1) {
- setTimeout(() => {
- uni.showToast({ title: '订单已完成', icon: 'none' });
- }, 1500);
- }
- },
- copyOrderNo() {
- uni.setClipboardData({
- data: this.orderDetail.orderNo,
- success: () => {
- uni.showToast({ title: '复制成功', icon: 'none' });
- }
- });
- },
- openSumModal() {
- // 初始化日期
- const now = new Date();
- const y = now.getFullYear();
- const m = String(now.getMonth() + 1).padStart(2, '0');
- const d = String(now.getDate()).padStart(2, '0');
- this.sumDate = `${y}/${m}/${d}`;
- // 预设服务内容模板
- if (!this.sumContent) {
- this.sumContent =
- '1. 精神/身体状态:\n' +
- '2. 进食/饮水:\n' +
- '3. 排泤情况:\n' +
- '4. 卫生情况:\n' +
- '5. 互动情况:\n' +
- '6. 特殊情况/备注:';
- }
- this.showSumModal = true;
- },
- closeSumModal() {
- this.showSumModal = false;
- },
- submitSumModal() {
- if (!this.sumContent.trim()) {
- uni.showToast({ title: '请填写服务内容', icon: 'none' });
- return;
- }
- this.closeSumModal();
- uni.showToast({ title: '小结已提交', icon: 'success' });
- }
- }
- }
|