"use strict"; const common_vendor = require("../../common/vendor.js"); const sheep_index = require("../../sheep/index.js"); const sheep_hooks_useGoods = require("../../sheep/hooks/useGoods.js"); const sheep_api_trade_order = require("../../sheep/api/trade/order.js"); const sheep_hooks_useModal = require("../../sheep/hooks/useModal.js"); require("../../sheep/api/index.js"); require("../../sheep/api/distri/score.js"); require("../../sheep/request/index.js"); require("../../sheep/config/index.js"); require("../../sheep/store/index.js"); require("../../sheep/store/app.js"); require("../../sheep/api/promotion/diy.js"); require("../../sheep/platform/index.js"); require("../../sheep/platform/provider/wechat/index.js"); require("../../sheep/platform/provider/wechat/miniProgram.js"); require("../../sheep/api/member/auth.js"); require("../../sheep/api/member/social.js"); require("../../sheep/api/member/user.js"); require("../../sheep/platform/provider/apple/index.js"); require("../../sheep/platform/share.js"); require("../../sheep/router/index.js"); require("../../sheep/helper/throttle.js"); require("../../sheep/url/index.js"); require("../../sheep/platform/pay.js"); require("../../sheep/helper/index.js"); require("../../sheep/helper/test.js"); require("../../sheep/helper/digit.js"); require("../../sheep/api/pay/order.js"); require("../../sheep/store/user.js"); require("../../sheep/store/cart.js"); require("../../sheep/api/trade/cart.js"); require("../../sheep/api/pay/wallet.js"); require("../../sheep/api/promotion/coupon.js"); require("../../sheep/store/sys.js"); require("../../sheep/store/modal.js"); require("../../sheep/api/distri/share.js"); require("../../sheep/api/distri/team.js"); require("../../sheep/api/infra/file.js"); require("../../sheep/api/member/address.js"); require("../../sheep/api/member/point.js"); require("../../sheep/api/member/signin.js"); require("../../sheep/api/migration/app.js"); require("../../sheep/api/migration/chat.js"); require("../../sheep/api/migration/index.js"); require("../../sheep/api/migration/third.js"); require("../../sheep/api/pay/channel.js"); require("../../sheep/api/product/category.js"); require("../../sheep/api/product/comment.js"); require("../../sheep/api/product/favorite.js"); require("../../sheep/api/product/history.js"); require("../../sheep/api/product/spu.js"); require("../../sheep/api/promotion/activity.js"); require("../../sheep/api/promotion/article.js"); require("../../sheep/api/promotion/bargain.js"); require("../../sheep/api/promotion/combination.js"); require("../../sheep/api/promotion/rewardActivity.js"); require("../../sheep/api/promotion/seckill.js"); require("../../sheep/api/system/area.js"); require("../../sheep/api/system/voice.js"); require("../../sheep/api/trade/afterSale.js"); require("../../sheep/api/trade/brokerage.js"); require("../../sheep/api/trade/config.js"); require("../../sheep/api/trade/delivery.js"); require("../../sheep/config/zIndex.js"); require("../../sheep/util/index.js"); if (!Array) { const _easycom_s_goods_item2 = common_vendor.resolveComponent("s-goods-item"); const _easycom_su_fixed2 = common_vendor.resolveComponent("su-fixed"); const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout"); (_easycom_s_goods_item2 + _easycom_su_fixed2 + _easycom_s_layout2)(); } const _easycom_s_goods_item = () => "../../sheep/components/s-goods-item/s-goods-item.js"; const _easycom_su_fixed = () => "../../sheep/ui/su-fixed/su-fixed.js"; const _easycom_s_layout = () => "../../sheep/components/s-layout/s-layout.js"; if (!Math) { (_easycom_s_goods_item + _easycom_su_fixed + _easycom_s_layout)(); } const _sfc_main = { __name: "detail", setup(__props) { common_vendor.useCssVars((_ctx) => ({ "7295e610": common_vendor.unref(headerBg) })); sheep_index.sheep.$store("user").userInfo; const statusBarHeight = sheep_index.sheep.$platform.device.statusBarHeight * 2; const headerBg = sheep_index.sheep.$url.css("/static/images/order_bg.png"); const state = common_vendor.reactive({ orderInfo: {}, merchantTradeNo: "", // 商户订单号 comeinType: "" // 进入订单详情的来源类型 }); const onCopy = () => { sheep_index.sheep.$helper.copyText(state.orderInfo.no); }; function onPay(id) { sheep_index.sheep.$router.go("/pages/pay/index", { id, openType: 2 }); } function onGoodsDetail(id) { sheep_index.sheep.$router.go("/pages/goods/index", { id }); } async function onCancel(orderId) { common_vendor.index.showModal({ title: "提示", content: "确定要取消订单吗?", success: async function(res) { if (!res.confirm) { return; } const { code } = await sheep_api_trade_order.OrderApi.cancelOrder(orderId); if (code === 0) { await getOrderDetail(orderId); } } }); } async function onExpress(id) { sheep_index.sheep.$router.go("/pages/order/express/log", { id }); } async function onConfirm(orderId, ignore = false) { let isOpenBusinessView = true; common_vendor.index.showModal({ title: "提示", content: "确认收货?", success: async function(res) { if (res.confirm) { if (sheep_index.sheep.$platform.name === "WechatMiniProgram" && !common_vendor.lodashExports.isEmpty(state.orderInfo.wechat_extra_data) && isOpenBusinessView && !ignore) { mpConfirm(orderId); return; } const { code } = await sheep_api_trade_order.OrderApi.receiveOrder(orderId); if (code === 0) { await getOrderDetail(orderId); } } } }); } function mpConfirm(orderId) { if (!common_vendor.wx$1.openBusinessView) { sheep_index.sheep.$helper.toast(`请升级微信版本`); return; } common_vendor.wx$1.openBusinessView({ businessType: "weappOrderConfirm", extraData: { merchant_trade_no: state.orderInfo.wechat_extra_data.merchant_trade_no, transaction_id: state.orderInfo.wechat_extra_data.transaction_id }, success(response) { console.log("success:", response); if (response.errMsg === "openBusinessView:ok") { if (response.extraData.status === "success") { onConfirm(orderId, true); } } }, fail(error) { console.log("error:", error); }, complete(result) { console.log("result:", result); } }); } function onComment(id) { sheep_index.sheep.$router.go("/pages/goods/comment/add", { id }); } async function getOrderDetail(id) { let res; if (state.comeinType === "wechat") { res = await sheep_api_trade_order.OrderApi.getOrder(id, { merchant_trade_no: state.merchantTradeNo }); } else { res = await sheep_api_trade_order.OrderApi.getOrder(id); } if (res.code === 0) { state.orderInfo = res.data; sheep_hooks_useGoods.handleOrderButtons(state.orderInfo); } else { sheep_index.sheep.$router.back(); } } const isLogin = common_vendor.computed(() => sheep_index.sheep.$store("user").isLogin); common_vendor.watch( () => isLogin.value, (newVal) => { if (newVal) { window.location.reload(); } }, { deep: true // 深度监听 } ); common_vendor.onLoad(async (options) => { if (!isLogin.value) { sheep_hooks_useModal.showAuthModal(); sheep_index.sheep.$helper.toast("您尚未登录,请登录:" + options.username + "后再试", 3e3); } else { if (options.username) { console.log(JSON.parse(common_vendor.index.getStorageSync("user-store")).userInfo.username); if (options.username != JSON.parse(common_vendor.index.getStorageSync("user-store")).userInfo.username) { sheep_index.sheep.$helper.toast( "您当前登录的账号是" + JSON.parse(common_vendor.index.getStorageSync("user-store")).userInfo.username + ",请切换到" + options.username + "后再试", 3e3 ); } } } let id = 0; if (options.id) { id = options.id; } state.comeinType = options.comein_type; if (state.comeinType === "wechat") { state.merchantTradeNo = options.merchant_trade_no; } await getOrderDetail(id); }); return (_ctx, _cache) => { var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n; return common_vendor.e({ a: state.orderInfo.status_code == "unpaid" || state.orderInfo.status === 10 || // 待发货 state.orderInfo.status_code == "nocomment" }, state.orderInfo.status_code == "unpaid" || state.orderInfo.status === 10 || state.orderInfo.status_code == "nocomment" ? { b: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/order_loading.png") } : {}, { c: state.orderInfo.status_code == "completed" || state.orderInfo.status_code == "refund_agree" }, state.orderInfo.status_code == "completed" || state.orderInfo.status_code == "refund_agree" ? { d: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/order_success.png") } : {}, { e: state.orderInfo.status_code == "cancel" || state.orderInfo.status_code == "closed" }, state.orderInfo.status_code == "cancel" || state.orderInfo.status_code == "closed" ? { f: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/order_close.png") } : {}, { g: state.orderInfo.status_code == "noget" }, state.orderInfo.status_code == "noget" ? { h: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/order_express.png") } : {}, { i: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.formatOrderStatus)(state.orderInfo)), j: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.formatOrderStatusDescription)(state.orderInfo)), k: common_vendor.s({ marginTop: "-" + Number(statusBarHeight + 88) + "rpx", paddingTop: Number(statusBarHeight + 88) + "rpx" }), l: state.orderInfo.receiverAreaId > 0 }, state.orderInfo.receiverAreaId > 0 ? { m: common_vendor.t(state.orderInfo.receiverName), n: common_vendor.t(state.orderInfo.receiverMobile), o: common_vendor.t(state.orderInfo.receiverAreaName), p: common_vendor.t(state.orderInfo.receiverDetailAddress) } : {}, { q: common_vendor.f(state.orderInfo.items, (item, k0, i0) => { return common_vendor.e({ a: [10, 20, 30].includes(state.orderInfo.status) && item.afterSaleStatus === 0 }, [10, 20, 30].includes(state.orderInfo.status) && item.afterSaleStatus === 0 ? { b: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/order/aftersale/apply", { orderId: state.orderInfo.id, itemId: item.id }), item.goods_id) } : {}, { c: item.afterSaleStatus === 10 }, item.afterSaleStatus === 10 ? { d: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/order/aftersale/detail", { id: item.afterSaleId }), item.goods_id) } : {}, { e: item.afterSaleStatus === 20 }, item.afterSaleStatus === 20 ? { f: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/order/aftersale/detail", { id: item.afterSaleId }), item.goods_id) } : {}, { g: item.status_text }, item.status_text ? { h: common_vendor.t(item.status_text) } : {}, { i: common_vendor.o(($event) => onGoodsDetail(item.spuId), item.goods_id), j: "6b23c96c-1-" + i0 + ",6b23c96c-0", k: common_vendor.p({ img: item.picUrl, title: item.spuName, skuText: item.properties.map((property) => property.valueName).join(" "), price: item.spuPayType === 2 ? item.highPrecisionPrice : item.price, num: item.count, virtualPirce: item.spuPayType === 2 }), l: item.goods_id }); }), r: common_vendor.s({ marginTop: state.orderInfo.receiverAreaId > 0 ? "0" : "-40rpx" }), s: common_vendor.t(state.orderInfo.no), t: common_vendor.o(onCopy), v: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.points2point)(state.orderInfo.payIntegral)), w: common_vendor.t(state.orderInfo.userRemark || "无"), x: common_vendor.t(common_vendor.unref(sheep_index.sheep).$helper.timeFormat(state.orderInfo.createTime, "yyyy-mm-dd hh:MM:ss")), y: state.orderInfo.payTime }, state.orderInfo.payTime ? { z: common_vendor.t(common_vendor.unref(sheep_index.sheep).$helper.timeFormat(state.orderInfo.payTime, "yyyy-mm-dd hh:MM:ss")) } : {}, { A: common_vendor.t(state.orderInfo.payChannelName || "-"), B: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.orderInfo.totalPrice)), C: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.orderInfo.deliveryPrice)), D: state.orderInfo.discountPrice > 0 }, state.orderInfo.discountPrice > 0 ? { E: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.orderInfo.discountPrice)) } : {}, { F: common_vendor.t(state.orderInfo.payStatus ? "已付款" : "需付款"), G: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.orderInfo.payPrice)), H: state.orderInfo.refundPrice > 0 }, state.orderInfo.refundPrice > 0 ? { I: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.orderInfo.refundPrice)) } : {}, { J: (_a = state.orderInfo.buttons) == null ? void 0 : _a.length }, ((_b = state.orderInfo.buttons) == null ? void 0 : _b.length) ? common_vendor.e({ K: (_c = state.orderInfo.buttons) == null ? void 0 : _c.includes("cancel") }, ((_d = state.orderInfo.buttons) == null ? void 0 : _d.includes("cancel")) ? { L: common_vendor.o(($event) => onCancel(state.orderInfo.id)) } : {}, { M: (_e = state.orderInfo.buttons) == null ? void 0 : _e.includes("pay") }, ((_f = state.orderInfo.buttons) == null ? void 0 : _f.includes("pay")) ? { N: common_vendor.o(($event) => onPay(state.orderInfo.id)) } : {}, { O: (_g = state.orderInfo.buttons) == null ? void 0 : _g.includes("combination") }, ((_h = state.orderInfo.buttons) == null ? void 0 : _h.includes("combination")) ? { P: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/activity/groupon/detail", { id: state.orderInfo.ext.groupon_id })) } : {}, { Q: (_i = state.orderInfo.buttons) == null ? void 0 : _i.includes("express") }, ((_j = state.orderInfo.buttons) == null ? void 0 : _j.includes("express")) ? { R: common_vendor.o(($event) => onExpress(state.orderInfo.id)) } : {}, { S: (_k = state.orderInfo.buttons) == null ? void 0 : _k.includes("confirm") }, ((_l = state.orderInfo.buttons) == null ? void 0 : _l.includes("confirm")) ? { T: common_vendor.o(($event) => onConfirm(state.orderInfo.id)) } : {}, { U: (_m = state.orderInfo.buttons) == null ? void 0 : _m.includes("comment") }, ((_n = state.orderInfo.buttons) == null ? void 0 : _n.includes("comment")) ? { V: common_vendor.o(($event) => onComment(state.orderInfo.id)) } : {}, { W: common_vendor.p({ bottom: true, placeholder: true, bg: "bg-white" }) }) : {}, { X: common_vendor.s(_ctx.__cssVars()), Y: common_vendor.p({ title: "订单详情", navbar: "inner" }) }); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6b23c96c"], ["__file", "D:/zx/mall-front-app/pages/order/detail.vue"]]); wx.createPage(MiniProgramPage);