From b0a9c05166a6fd509e561fc1f046b86a2b72e9a5 Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Tue, 15 Apr 2025 23:09:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=89=93=E5=8D=A1?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=8F=8A=E6=9C=8D=E5=8A=A1=E6=A1=A3=E6=A1=88?= =?UTF-8?q?=E6=AD=A5=E9=AA=A4=E6=9D=A1=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增打卡功能,支持保存草稿和提交打卡记录 - 添加服务档案步骤条样式,支持分步查看喂养、清洁和附加服务 - 优化图片上传和回显逻辑,支持多张图片上传和预览 - 修复部分样式问题,提升用户体验 --- api/order/order.js | 15 +- .../clock/AppletOrderItemDateLog.java | 94 ++++++++++ otherPages/myOrdersManage/clock/index.scss | 4 + otherPages/myOrdersManage/clock/index.vue | 197 +++++++++++++++++---- otherPages/myOrdersManage/service/detail.scss | 6 +- otherPages/myOrdersManage/service/detail.vue | 178 ++++++++++++++++--- otherPages/myOrdersManage/service/steps-custom.css | 35 ++++ .../myOrdersManage/service/steps-custom.min.css | 1 + .../myOrdersManage/service/steps-custom.scss | 36 ++++ pages/myOrdersManage/components/systemOrder.vue | 8 +- 10 files changed, 512 insertions(+), 62 deletions(-) create mode 100644 otherPages/myOrdersManage/clock/AppletOrderItemDateLog.java create mode 100644 otherPages/myOrdersManage/service/steps-custom.css create mode 100644 otherPages/myOrdersManage/service/steps-custom.min.css create mode 100644 otherPages/myOrdersManage/service/steps-custom.scss diff --git a/api/order/order.js b/api/order/order.js index d6abe86..8210e24 100644 --- a/api/order/order.js +++ b/api/order/order.js @@ -12,7 +12,7 @@ export function getAppOrderList() { }) } -// 获取订单列表 +// 根据订单id获取打卡详情 export function orderItemLogGetByOrderId(orderId) { return request({ headers: { @@ -22,6 +22,18 @@ export function orderItemLogGetByOrderId(orderId) { method: 'get' }) } +// 根据订单id进行打卡 +export function orderItemLogAddOrUpdate(data) { + return request({ + headers: { + "isToken": true + }, + url: "/applet/orderItemLog/addOrUpdate", + method: 'post', + data + }) +} + // 获取订单中的宠物列表 export function getOrderPetById(orderId) { @@ -58,6 +70,7 @@ export function getPetCareByPetId(petId) { export default { getAppOrderList, orderItemLogGetByOrderId, + orderItemLogAddOrUpdate, getOrderPetById, getPetById, getPetCareByPetId, diff --git a/otherPages/myOrdersManage/clock/AppletOrderItemDateLog.java b/otherPages/myOrdersManage/clock/AppletOrderItemDateLog.java new file mode 100644 index 0000000..0b400b7 --- /dev/null +++ b/otherPages/myOrdersManage/clock/AppletOrderItemDateLog.java @@ -0,0 +1,94 @@ +package com.ruoyi.model.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import lombok.Data; +/** + * 订单信息表对象 applet_order_item_date_log + * + * @author daixiande + */ +@Data +public class AppletOrderItemDateLog { + private static final long serialVersionUID = 1L; + + /** 唯一标识 */ + private Long id; + + /** 创建时间 */ + private String createTime; + + /** 创建者 */ + private Integer createBy; + + /** 修改时间 */ + private String updateTime; + + /** 修改者 */ + private Integer updateBy; + + /** 手套照片 */ + @Excel(name = "手套照片") + private String glovePhoto; + + /** 鞋套照片 */ + @Excel(name = "鞋套照片") + private String shoeCoverPhoto; + + /** 宠物照片 */ + @Excel(name = "宠物照片") + private String petPhoto; + + /** 伴宠师照片 */ + @Excel(name = "伴宠师照片") + private String teacherPhoto; + + /** 粮碗前后对比-前 */ + @Excel(name = "粮碗前后对比-前") + private String grainBowlFront; + + /** 粮碗前后对比-后 */ + @Excel(name = "粮碗前后对比-后") + private String grainBowlAfter; + + /** 水碗前后对比-前 */ + @Excel(name = "水碗前后对比-前") + private String waterBowlFront; + + /** 水碗前后对比-后 */ + @Excel(name = "水碗前后对比-后") + private String waterBowlAfter; + + /** 盆/尿垫前后对比-前 */ + @Excel(name = "盆/尿垫前后对比-前") + private String basinFront; + + /** 盆/尿垫前后对比-后 */ + @Excel(name = "盆/尿垫前后对比-后") + private String basinAfter; + + /** 溜狗 */ + @Excel(name = "溜狗") + private String workDogImage; + + /** 陪玩 */ + @Excel(name = "陪玩") + private String workPalyImage; + + /** 备注 */ + @Excel(name = "备注") + private String notes; + + /** 日订单标识 */ + @Excel(name = "日订单标识") + private Long itemDateId; + + /** 总订单标识 */ + @Excel(name = "总订单标识") + private Long itemOrderId; + + /** 订单标识 */ + @Excel(name = "订单标识") + private Long orderId; + +} diff --git a/otherPages/myOrdersManage/clock/index.scss b/otherPages/myOrdersManage/clock/index.scss index 88e3d33..5e88de5 100644 --- a/otherPages/myOrdersManage/clock/index.scss +++ b/otherPages/myOrdersManage/clock/index.scss @@ -34,6 +34,10 @@ align-items: center; justify-content: center; } + .buttom-item-2{ + border: 2rpx solid #ff842c; + background-color: #FFBF6022; + } } } diff --git a/otherPages/myOrdersManage/clock/index.vue b/otherPages/myOrdersManage/clock/index.vue index d239c32..2f9de7a 100644 --- a/otherPages/myOrdersManage/clock/index.vue +++ b/otherPages/myOrdersManage/clock/index.vue @@ -13,7 +13,7 @@ + multiple :maxCount="2" width="131rpx" height="131rpx" :disabled="isRead"> @@ -30,7 +30,7 @@ + name="ShoeCover" multiple :maxCount="2" width="131rpx" height="131rpx" :disabled="isRead"> @@ -51,7 +51,7 @@ + :name="'pet' + index" multiple :maxCount="2" width="131rpx" height="131rpx" :disabled="isRead"> @@ -70,7 +70,7 @@ + multiple :maxCount="1" width="131rpx" height="131rpx" :disabled="isRead"> @@ -80,7 +80,7 @@ + multiple :maxCount="1" width="131rpx" height="131rpx" :disabled="isRead"> @@ -93,7 +93,7 @@ + multiple :maxCount="1" width="131rpx" height="131rpx" :disabled="isRead"> @@ -103,7 +103,7 @@ + multiple :maxCount="1" width="131rpx" height="131rpx" :disabled="isRead"> @@ -116,7 +116,7 @@ + multiple :maxCount="1" width="131rpx" height="131rpx" :disabled="isRead"> @@ -126,7 +126,7 @@ + multiple :maxCount="1" width="131rpx" height="131rpx" :disabled="isRead"> @@ -147,7 +147,7 @@ + multiple :maxCount="3" width="131rpx" height="131rpx" :disabled="isRead"> @@ -162,7 +162,7 @@ + multiple :maxCount="3" width="131rpx" height="131rpx" :disabled="isRead"> @@ -181,13 +181,24 @@ + class="pd20 box-size" :disabled="isRead"> - - + + + 保存草稿 + + + 确定提交 + @@ -206,13 +217,19 @@ } from '@/utils/oss-upload/oss/index.js' import { orderItemLogGetByOrderId } from '@/api/order/order.js' + import { + getOrderPetById, + orderItemLogAddOrUpdate, + } from "@/api/order/order.js"; onLoad((options) => { orderId.value = options.id || null; + isRead.value = options.isRead || false; GetByOrderId() }); const orderId = ref(0) + const isRead = ref(false) const fileList = reactive({ @@ -225,17 +242,16 @@ const form = ref({}) - const petList = ref([{ - title: '小汪' - }, - { - title: '大黄' - }, + const petList = ref([ + // { + // title: '小汪' + // }, + // { + // title: '大黄' + // }, ]) - petList.value.forEach((n, i) => { - fileList['pet' + i] = [] - }) + // 删除图片 const deletePic = (event) => { @@ -274,36 +290,151 @@ } } - if (!fileList.foodA || fileList.foodA.length < 2 || - !fileList.foodB || fileList.foodB.length < 2) { + if (!fileList.foodA || fileList.foodA.length < 1 || + !fileList.foodB || fileList.foodB.length < 1) { return msg('请上传粮碗前后照片') } - if (!fileList.waterA || fileList.waterA.length < 2 || - !fileList.waterB || fileList.waterB.length < 2) { + if (!fileList.waterA || fileList.waterA.length < 1 || + !fileList.waterB || fileList.waterB.length < 1) { return msg('请上传水碗前后照片') } - if (!fileList.urinalA || fileList.urinalA.length < 2 || - !fileList.urinalB || fileList.urinalB.length < 2) { + if (!fileList.urinalA || fileList.urinalA.length < 1 || + !fileList.urinalB || fileList.urinalB.length < 1) { return msg('请上传猫砂盆、尿盆照片') } - + saveDraft(true) } function GetByOrderId(){ orderItemLogGetByOrderId(orderId.value) + .then(res => { + if(res.code == 200 && res.data) { + const data = res.data; + form.value = data + // 回显手套照片 + if(data.glovePhoto) { + fileList.glove = data.glovePhoto.split(',').map(url => ({ url })); + } + // 回显鞋套照片 + if(data.shoeCoverPhoto) { + fileList.ShoeCover = data.shoeCoverPhoto.split(',').map(url => ({ url })); + } + // 回显宠物照片 + if(data.petPhoto) { + const pets = JSON.parse(data.petPhoto); + petList.value = pets; + pets.forEach((pet, index) => { + if(pet.fileList) { + fileList['pet' + index] = pet.fileList.split(',').map(url => ({ url })); + } + }); + } + // 回显粮碗照片 + if(data.grainBowlFront) fileList.foodA = data.grainBowlFront.split(',').map(url => ({ url })); + if(data.grainBowlAfter) fileList.foodB = data.grainBowlAfter.split(',').map(url => ({ url })); + // 回显水碗照片 + if(data.waterBowlFront) fileList.waterA = data.waterBowlFront.split(',').map(url => ({ url })); + if(data.waterBowlAfter) fileList.waterB = data.waterBowlAfter.split(',').map(url => ({ url })); + // 回显猫砂盆/尿垫照片 + if(data.basinFront) fileList.urinalA = data.basinFront.split(',').map(url => ({ url })); + if(data.basinAfter) fileList.urinalB = data.basinAfter.split(',').map(url => ({ url })); + // 回显定制服务照片 + if(data.workDogImage) fileList.testa = data.workDogImage.split(',').map(url => ({ url })); + if(data.workPalyImage) fileList.testb = data.workPalyImage.split(',').map(url => ({ url })); + }else{ + getOrderPetByIdFN() + } + }) + } + + function getOrderPetByIdFN(){ + getOrderPetById(orderId.value) .then(res => { if(res.code == 200){ - + res.data.forEach((n, i) => { + fileList['pet' + i] = [] + }) + res.data.forEach((n, i) => { + petList.value.push({ + title : n.name, + id : n.id, + }) + }) } }) } - function saveDraft() { - + function saveDraft(flag) { + // 将所有图片数组转换为逗号分隔的字符串 + const params = { + orderId: orderId.value, + glovePhoto: fileList.glove?.map(item => item.url).join(',') || '', + shoeCoverPhoto: fileList.ShoeCover?.map(item => item.url).join(',') || '', + // 合并所有宠物照片 + petPhoto: JSON.stringify( + petList.value.map((pet, index) => { + return { + id : pet.id, + title : pet.title, + fileList: fileList['pet' + index]?.map(item => item.url).join(',') || '' + }; + }) + ), + // 粮碗照片 + grainBowlFront: fileList.foodA?.map(item => item.url).join(',') || '', + grainBowlAfter: fileList.foodB?.map(item => item.url).join(',') || '', + // 水碗照片 + waterBowlFront: fileList.waterA?.map(item => item.url).join(',') || '', + waterBowlAfter: fileList.waterB?.map(item => item.url).join(',') || '', + // 猫砂盆/尿垫照片 + basinFront: fileList.urinalA?.map(item => item.url).join(',') || '', + basinAfter: fileList.urinalB?.map(item => item.url).join(',') || '', + // 定制服务照片 + workDogImage: fileList.testa?.map(item => item.url).join(',') || '', + workPalyImage: fileList.testb?.map(item => item.url).join(',') || '', + // 备注信息 + notes: form.value.notes || '', + submitFlag : 1, + } + + if(form.value.id) { + params.id = form.value.id + } + + if(flag) { + params.submitFlag = 2 + } + + orderItemLogAddOrUpdate(params) + .then(res => { + if(res.code === 200) { + uni.showToast({ + title: '提交成功', + icon: 'success' + }) + // 如果是确认提交(非草稿),则返回上一页 + if(flag) { + setTimeout(() => { + uni.navigateBack() + }, 1500) + } + } else { + uni.showToast({ + title: res.msg || '提交失败', + icon: 'none' + }) + } + }) + .catch(err => { + uni.showToast({ + title: '提交失败', + icon: 'none' + }) + }) } function msg(content) { diff --git a/otherPages/myOrdersManage/service/detail.scss b/otherPages/myOrdersManage/service/detail.scss index 59ff0ce..f7df20b 100644 --- a/otherPages/myOrdersManage/service/detail.scss +++ b/otherPages/myOrdersManage/service/detail.scss @@ -12,9 +12,11 @@ } .img { + width: 173rpx; + height: 230rpx; image, .u-image, .img{ - width: 173rpx; - height: 230rpx; + width: 173rpx !important; + height: 230rpx !important; } } diff --git a/otherPages/myOrdersManage/service/detail.vue b/otherPages/myOrdersManage/service/detail.vue index 84346ec..1b609b8 100644 --- a/otherPages/myOrdersManage/service/detail.vue +++ b/otherPages/myOrdersManage/service/detail.vue @@ -1,12 +1,25 @@