1 line
9.3 KiB
Plaintext
1 line
9.3 KiB
Plaintext
{"version":3,"file":"OrderItem.js","sources":["../../../../../../src/pages/order/components/OrderItem.vue","../../../../../../uniComponent:/RDovQXBwL1dvcmsvYWRkci9hY2RyLXVpL3NyYy9wYWdlcy9vcmRlci9jb21wb25lbnRzL09yZGVySXRlbS52dWU"],"sourcesContent":["<template>\n <view class=\"order-item p-4 mb-4 bg-white shadow rounded-lg\">\n <!-- 订单头部,包含标题和状态 -->\n <view class=\"order-header flex justify-between items-center mb-2\">\n <text v-if=\"serviceInfo && serviceInfo.serviceName\" class=\"order-title font-bold text-lg\">\n {{ serviceInfo.serviceName }}\n </text>\n <text class=\"order-status text-sm text-gray-500\">{{ state }}</text>\n </view>\n\n <!-- 服务信息 -->\n <view class=\"order-info text-sm text-gray-700 mb-4\">\n <view>\n <text>服务类型:</text>\n <text v-if=\"serviceInfo && serviceInfo.type\">{{ serviceInfo.type }}</text>\n </view>\n <view>\n <text>服务地址:</text>\n <text v-if=\"serviceInfo && serviceInfo.address\">{{ serviceInfo.address }}</text>\n </view>\n <view>\n <text>预约时间:</text>\n {{ reservationTime }}\n </view>\n <view>\n <text>服务时长:</text>\n {{ serviceHours }} 小时\n </view>\n </view>\n\n <!-- 宠物信息 -->\n <view class=\"pet-info flex items-center mb-4\">\n <image\n :src=\"imgUrl(pet.profileUrl)\"\n mode=\"aspectFill\"\n class=\"w-16 h-16 rounded-full mr-4\"\n ></image>\n <view>\n <view>\n <text>宠物名称:</text>\n {{ pet.name }}\n </view>\n <view>\n <text>宠物品种:</text>\n {{ pet.breed }}\n </view>\n </view>\n </view>\n\n <!-- 用户信息 -->\n <view class=\"user-info text-sm text-gray-700 mb-4\">\n <view>\n <text>下单用户:</text>\n {{ user.nickname }} ({{ user.phone }})\n </view>\n <view v-if=\"address\">\n <text>用户地址:</text>\n {{ address.province }} {{ address.city }} {{ address.district }}\n {{ address.detailAddress }}\n </view>\n </view>\n\n <!-- 支付信息 -->\n <view class=\"payment-info text-sm text-gray-700 mb-4\">\n <view>\n <text>支付方式:</text>\n {{ paymentMethod }}\n </view>\n <view>\n <text>支付状态:</text>\n {{ isPay ? '已支付' : '未支付' }}\n </view>\n <view>\n <text>总价:</text>\n ¥{{ price }}\n </view>\n </view>\n\n <!-- 操作按钮 -->\n <view class=\"flex justify-between items-center\">\n <text class=\"text-lg text-red-500\">¥{{ price }} 共{{ serviceHours }}小时</text>\n <view class=\"flex\">\n <button v-if=\"!isTake\" class=\"btn\" @click=\"toOrderDetail\">查看详情</button>\n <button v-if=\"!isTake\" class=\"btn ml-2\" @click=\"cancel\">取消订单</button>\n <button v-if=\"!isTake\" class=\"btn-primary ml-2\" @click=\"orderPay\">支付</button>\n <button v-if=\"isTake\" @click=\"bookingCancel\">取消订单</button>\n <button v-if=\"isTake\" @click=\"confirm\">确认订单</button>\n <button\n v-if=\"state && state.includes('已预约') && user.userInfo.isPetNursery\"\n @click=\"scan\"\n >\n 扫描二维码\n </button>\n </view>\n </view>\n </view>\n</template>\n\n<script setup>\nimport { payOrder } from '@/logic/pay'\nimport { imgUrl, scanCodeAsync, showModalAsync, toast } from '@/utils/commUtils'\nimport { httpPost } from '@/utils/http'\nimport { defineProps } from 'vue'\n\nconst props = defineProps({\n id: String,\n userId: String,\n reservationTime: String,\n serviceHours: String,\n personalServiceId: String,\n personalServiceUserId: String,\n price: Number,\n isPay: Boolean,\n feedback: String,\n star: Number,\n state: String,\n paymentMethod: String,\n qrcode: String,\n createTime: String,\n updateTime: String,\n address: Object,\n pet: Object,\n user: Object,\n psUser: Object,\n serviceInfo: Object,\n isTake: false,\n})\n\nconst shopRemark = ref('')\n\nconst scan = async () => {\n // 扫描二维码,获取扫描信息发送给后端\n const scan = await scanCodeAsync()\n if (scan.result) {\n try {\n // 发送请求给后端\n const res = await httpPost('/order/scan/' + props.id, {}, { qrcode: scan.result })\n if (res.code == 200) {\n toast('支付成功')\n // 刷新数据\n uni.$emit('refresh')\n } else {\n toast(res.message)\n }\n } catch (e) {\n toast(e.data.codeStr)\n }\n } else {\n toast('扫码失败')\n }\n}\n\nconst orderPay = async () => {\n try {\n const res = await payOrder(props.id)\n if (res.code == 200) {\n toast('支付成功')\n } else {\n toast(res.message)\n }\n } catch (e) {\n console.log(e)\n toast(e.data.codeStr)\n }\n}\n\nconst cancel = async () => {\n const res = await httpPost('/order/cancel/' + props.id)\n if (res.code == 200) {\n toast('取消成功')\n // 刷新数据\n uni.$emit('refresh')\n } else {\n toast(res.message)\n }\n}\n\nconst toOrderDetail = () => {\n uni.navigateTo({\n url: `/pages/order/order-detail?id=${props.id}`,\n })\n}\n\nconst bookingCancel = async () => {\n try {\n // 弹出对话框让用户输入取消原因\n const res = await showModalAsync({\n title: '取消订单',\n content: '',\n editable: true,\n placeholderText: '请输入取消原因!',\n })\n\n if (res.confirm) {\n // 用户点击确定\n shopRemark.value = res.content\n\n // 进行订单取消操作\n const response = await httpPost(\n '/order/bookingCancel/' + props.id,\n {},\n { shopRemark: shopRemark.value },\n )\n if (response.code == 200) {\n toast('取消订单成功!')\n // 刷新数据\n uni.$emit('refresh')\n } else {\n toast(response.message)\n }\n } else if (res.cancel) {\n // 用户点击取消\n toast('取消操作已取消')\n }\n } catch (e) {\n toast('请求失败,请稍后再试')\n console.error(e)\n }\n}\n\nconst confirm = async () => {\n try {\n const res = await httpPost('/order/confirm/' + props.id)\n if (res.code == 200) {\n toast('确认订单成功!')\n // 刷新数据\n uni.$emit('refresh')\n } else {\n toast(res.message)\n }\n } catch (e) {\n toast(e.data.message)\n }\n}\n</script>\n\n<style scoped>\n.order-item {\n @apply p-4 mb-4 bg-white shadow rounded-lg;\n}\n\n.order-header {\n @apply flex justify-between items-center mb-2;\n}\n\n.order-title {\n @apply font-bold text-lg;\n}\n\n.order-status {\n @apply text-sm text-gray-500;\n}\n\n.order-info {\n @apply text-sm text-gray-700 mb-4;\n}\n\n.pet-info {\n @apply flex items-center mb-4;\n}\n\n.user-info {\n @apply text-sm text-gray-700 mb-4;\n}\n\n.payment-info {\n @apply text-sm text-gray-700 mb-4;\n}\n\n.btn {\n @apply px-2 py-1 bg-gray-100 rounded text-xs;\n}\n\n.btn-primary {\n @apply px-2 py-1 bg-[#ffc107] text-white rounded text-xs;\n}\n\n.text-red-500 {\n @apply text-red-500;\n}\n</style>\n","import Component from 'D:/App/Work/addr/acdr-ui/src/pages/order/components/OrderItem.vue'\nwx.createComponent(Component)"],"names":["ref","scan","scanCodeAsync","httpPost","toast","uni","payOrder","showModalAsync"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,UAAA,QAAA;AAAA,UAAA,aAAAA,cAAA,IAAA,EAAA;AAAA,UAAA,OAAA,MAAA;AAAA,YAAAC,QAAA,MAAAC,8BAAA;AAAA,UAAAD,MAAA,QAAA;AAAA,YAAA;AAAA,gBAAA,MAAA,MAAAE,oBAAA,iBAAA,MAAA,IAAA,CAAA,GAAA,EAAA,QAAAF,MAAA,OAAA,CAAA;AAAA,cAAA,IAAA,QAAA,KAAA;AAAAG,4BAAAA,MAAA,MAAA;AAAAC,0BAAA,MAAA,MAAA,SAAA;AAAA,UAAA,OAAA;AAAAD,4BAAA,MAAA,IAAA,OAAA;AAAA,UAAA;AAAA,QAAA,SAAA,GAAA;AAAAA,gCAAA,EAAA,KAAA,OAAA;AAAA,QAAA;AAAA,MAAA,OAAA;AAAAA,wBAAAA,MAAA,MAAA;AAAA,MAAA;AAAA,IAAA;AAAA,UAAA,WAAA,MAAA;AAAA,UAAA;AAAA,cAAA,MAAA,MAAAE,mBAAA,MAAA,EAAA;AAAA,YAAA,IAAA,QAAA,KAAA;AAAAF,0BAAAA,MAAA,MAAA;AAAA,QAAA,OAAA;AAAAA,0BAAA,MAAA,IAAA,OAAA;AAAA,QAAA;AAAA,MAAA,SAAA,GAAA;AAAA,gBAAA,IAAA,CAAA;AAAAA,8BAAA,EAAA,KAAA,OAAA;AAAA,MAAA;AAAA,IAAA;AAAA,UAAA,SAAA,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