"use strict"; const common_vendor = require("../../common/vendor.js"); const pages_mixins_pullRefreshMixin = require("../mixins/pullRefreshMixin.js"); const _sfc_main = { mixins: [pages_mixins_pullRefreshMixin.pullRefreshMixin], data() { return { orderId: "", currentStep: 1, // 当前进行到第几步 processSteps: [], address: "", appointmentTime: "", estimatePrice: "", finalPrice: "", clothesList: [], currentStatus: { text: "", time: "", icon: "" }, phone: "", hasReport: false, reportTime: "", showEditButton: true, expressCompany: "", expressNo: "", showCancelModal: false, statusBarHeight: 0, orderDetail: null }; }, computed: { timeLabel() { if (this.currentStep === 4) { return "回收到账时间"; } else if (this.currentStep === 3) { return "质检完成时间"; } else { return "上门时间"; } }, showEstimate() { return this.currentStep < 3; } }, methods: { async onRefresh() { await new Promise((resolve) => setTimeout(resolve, 1e3)); common_vendor.index.stopPullRefresh(); }, goBack() { getApp().globalData.shouldClearRecycle = true; common_vendor.index.navigateBack(); }, showMore() { }, onShare() { }, viewAddress() { }, viewReport() { if (this.currentStatus.text.includes("已结款")) { common_vendor.index.navigateTo({ url: "/pages/component/inspection?status=qualified" }); } else { common_vendor.index.navigateTo({ url: "/pages/component/inspection?status=unqualified" }); } }, editOrder() { }, // 更新订单状态 updateOrderStatus(status) { switch (status) { case "cancelled": this.currentStep = 0; this.currentStatus = { text: "已取消", time: "", icon: "/static/my/【待取件】快递员正在赶来.png" }; this.showEditButton = false; break; case "processing": this.currentStep = 2; this.currentStatus = { text: "【待取件】快递员正在赶来", time: "2025-04-20 11:00~13:00", icon: "/static/my/【待取件】快递员正在赶来.png" }; break; case "collected": this.currentStep = 2; this.currentStatus = { text: "【已取件】快递员正在送至质检", time: "2025-04-30 11:42", icon: "/static/my/【上门中】快递员正在赶来.png" }; this.showEditButton = false; break; case "inspecting": this.currentStep = 3; this.currentStatus = { text: "【质检中】质检员正在质检", time: "2025-04-20 11:00", icon: "/static/my/逐件验-配图.png" }; this.showEditButton = false; break; case "pending_payment": this.currentStep = 4; this.currentStatus = { text: "【待结款】待平台确认结款项", time: "2025-04-20 12:00", icon: "/static/my/【已结款】平台已结款至账户.png" }; this.hasReport = true; this.reportTime = "2025-03-20 11:40"; this.showEditButton = false; break; case "completed": this.currentStep = 4; this.currentStatus = { text: "【已结款】平台已结款至账户", time: "2025-04-20 12:01", icon: "/static/my/【已结款】平台已结款至账户.png" }; this.hasReport = true; this.reportTime = "2025-03-20 11:40"; this.showEditButton = false; break; } }, copyExpressNo() { common_vendor.index.setClipboardData({ data: this.expressCompany + this.expressNo, success: () => { common_vendor.index.showToast({ title: "已复制", icon: "none" }); } }); }, confirmCancelOrder() { this.showCancelModal = false; this.currentStep = 0; this.currentStatus = { text: "已取消", time: this.getNowTime(), icon: "/static/【待取件】快递员正在赶来.png" }; }, getNowTime() { const now = /* @__PURE__ */ new Date(); const y = now.getFullYear(); const m = (now.getMonth() + 1).toString().padStart(2, "0"); const d = now.getDate().toString().padStart(2, "0"); const h = now.getHours().toString().padStart(2, "0"); const min = now.getMinutes().toString().padStart(2, "0"); return `${y}-${m}-${d} ${h}:${min}`; }, contactCourier() { if (this.phone) { common_vendor.index.makePhoneCall({ phoneNumber: this.phone //仅为示例 }); } else { common_vendor.index.showToast({ title: "暂无快递员电话", icon: "none" }); } }, fetchOrderDetail(orderId) { this.$api && this.$api("getOrderDetail", { orderId }, (res) => { if (res && res.code === 200 && res.result) { this.orderDetail = res.result; this.address = res.result.address + (res.result.addressDetail || ""); this.appointmentTime = res.result.goTime || ""; this.estimatePrice = res.result.price || ""; this.finalPrice = res.result.price || ""; this.clothesList = res.result.commonOrderList || []; this.expressCompany = res.result.wliu || ""; this.expressNo = res.result.expressNo || ""; this.phone = res.result.phone || ""; this.setOrderStatus(res.result.status, res.result.state, res.result); } }); }, setOrderStatus(status, state, data) { if (state == 3) { this.currentStep = 0; this.currentStatus = { text: "已取消", time: "", icon: "/static/【待取件】快递员正在赶来.png" }; this.showEditButton = false; return; } if (status == 0) { this.currentStep = 1; this.currentStatus = { text: "【在线预约】", time: data.goTime || "", icon: "/static/home/① 在线预约.png" }; } else if (status == 1 && state == 0) { this.currentStep = 2; this.currentStatus = { text: "【待取件】快递员正在赶来", time: data.goTime || "", icon: "/static/my/【待取件】快递员正在赶来.png" }; } else if (status == 1 && state == 1) { this.currentStep = 2; this.currentStatus = { text: "【已取件】快递员正在送至质检", time: data.goTime || "", icon: "/static/my/【上门中】快递员正在赶来.png" }; } else if (status == 2 && state == 1) { this.currentStep = 3; this.currentStatus = { text: "【质检中】质检员正在质检", time: data.goTime || "", icon: "/static/my/逐件验-配图.png" }; } else if (status == 3 && state == 1) { this.currentStep = 4; this.currentStatus = { text: "【待结款】待平台确认结款项", time: data.goTime || "", icon: "/static/my/【已结款】平台已结款至账户.png" }; this.hasReport = true; this.reportTime = data.updateTime || ""; } else if (status == 3 && state == 2) { this.currentStep = 4; this.currentStatus = { text: "【已结款】平台已结款至账户", time: data.goTime || "", icon: "/static/my/【已结款】平台已结款至账户.png" }; this.hasReport = true; this.reportTime = data.updateTime || ""; } }, getAreaList() { this.$api("getAreaList", {}, (res) => { common_vendor.index.__f__("log", "at pages/subcomponent/detail.vue:435", res, "getAreaList"); if (res.code == 200 && Array.isArray(res.result)) { const sorted = res.result.slice().sort((a, b) => a.sort - b.sort); this.processSteps = sorted.map((item) => ({ // id: item.id, icon: item.image, text: item.title })); } }); } }, onLoad(options) { if (options.id) { this.orderId = options.id; this.fetchOrderDetail(options.id); } this.statusBarHeight = common_vendor.index.getSystemInfoSync().statusBarHeight; this.getAreaList(); }, onShow() { this.getAreaList(); } }; if (!Array) { const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons"); _easycom_uni_icons2(); } const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js"; if (!Math) { _easycom_uni_icons(); } function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return common_vendor.e({ a: common_vendor.p({ type: "left", size: "20" }), b: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)), c: common_vendor.t($data.orderDetail && $data.orderDetail.ordeNo ? $data.orderDetail.ordeNo : $data.orderId), d: common_vendor.f($data.processSteps, (step, index, i0) => { return { a: step.icon, b: common_vendor.t(step.text), c: $data.currentStep === index + 1 ? 1 : "", d: $data.currentStep === 0 && index === 1 ? 1 : "", e: index, f: $data.currentStep === 0 && index === 1 ? 1 : "" }; }), e: $data.currentStatus }, $data.currentStatus ? common_vendor.e({ f: $data.currentStatus.icon, g: $data.currentStep === 0 }, $data.currentStep === 0 ? {} : { h: common_vendor.t($data.currentStatus.text) }, { i: common_vendor.t($data.currentStatus.time) }) : {}, { j: $data.currentStep === 0 }, $data.currentStep === 0 ? {} : {}, { k: $data.currentStep !== 0 && $data.currentStep < 3 }, $data.currentStep !== 0 && $data.currentStep < 3 ? { l: common_vendor.t($data.expressCompany), m: common_vendor.t($data.expressNo), n: common_vendor.o((...args) => $options.copyExpressNo && $options.copyExpressNo(...args)) } : {}, { o: $data.currentStep !== 0 && $data.currentStep < 4 }, $data.currentStep !== 0 && $data.currentStep < 4 ? {} : {}, { p: $data.currentStep !== 0 && $data.currentStep < 4 }, $data.currentStep !== 0 && $data.currentStep < 4 ? { q: common_vendor.t($data.address), r: common_vendor.o((...args) => $options.viewAddress && $options.viewAddress(...args)), s: common_vendor.t($options.timeLabel), t: common_vendor.t($data.appointmentTime) } : {}, { v: common_vendor.t($data.orderDetail && $data.orderDetail.ordeNo ? $data.orderDetail.ordeNo : $data.orderId), w: $data.currentStep < 3 }, $data.currentStep < 3 ? { x: common_vendor.t($data.estimatePrice) } : $data.currentStep === 4 ? { z: common_vendor.t($data.finalPrice), A: common_vendor.t($data.finalPrice) } : {}, { y: $data.currentStep === 4, B: common_vendor.f($data.clothesList, (item, index, i0) => { return { a: item.image, b: common_vendor.t(item.name), c: common_vendor.t(item.details), d: common_vendor.t(item.onePrice), e: common_vendor.t(item.num), f: common_vendor.t(item.price), g: index }; }), C: $data.currentStep === 4 }, $data.currentStep === 4 ? { D: common_vendor.o((...args) => $options.viewReport && $options.viewReport(...args)) } : {}, { E: $data.currentStep === 4 }, $data.currentStep === 4 ? { F: common_vendor.t($data.address) } : {}, { G: $data.currentStatus.text === "【待取件】快递员正在赶来" }, $data.currentStatus.text === "【待取件】快递员正在赶来" ? { H: common_vendor.o(($event) => $data.showCancelModal = true), I: common_vendor.o((...args) => $options.contactCourier && $options.contactCourier(...args)) } : {}, { J: $data.showCancelModal }, $data.showCancelModal ? { K: common_vendor.o(($event) => $data.showCancelModal = false), L: common_vendor.o((...args) => $options.confirmCancelOrder && $options.confirmCancelOrder(...args)) } : {}); } const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-3c6ff866"]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/subcomponent/detail.js.map