336 lines
15 KiB
JavaScript
336 lines
15 KiB
JavaScript
|
"use strict";
|
||
|
var __async = (__this, __arguments, generator) => {
|
||
|
return new Promise((resolve, reject) => {
|
||
|
var fulfilled = (value) => {
|
||
|
try {
|
||
|
step(generator.next(value));
|
||
|
} catch (e) {
|
||
|
reject(e);
|
||
|
}
|
||
|
};
|
||
|
var rejected = (value) => {
|
||
|
try {
|
||
|
step(generator.throw(value));
|
||
|
} catch (e) {
|
||
|
reject(e);
|
||
|
}
|
||
|
};
|
||
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
||
|
step((generator = generator.apply(__this, __arguments)).next());
|
||
|
});
|
||
|
};
|
||
|
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_api_trade_delivery = require("../../../sheep/api/trade/delivery.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");
|
||
|
const _component_layout_default_uni = common_vendor.resolveComponent("layout-default-uni");
|
||
|
(_easycom_s_goods_item2 + _easycom_su_fixed2 + _easycom_s_layout2 + _component_layout_default_uni)();
|
||
|
}
|
||
|
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 + PickUpVerify + _easycom_su_fixed + _easycom_s_layout)();
|
||
|
}
|
||
|
const PickUpVerify = () => "./pickUpVerify.js";
|
||
|
const _sfc_main = {
|
||
|
__name: "detail",
|
||
|
setup(__props) {
|
||
|
common_vendor.useCssVars((_ctx) => ({
|
||
|
"4bc9b4ba": common_vendor.unref(headerBg)
|
||
|
}));
|
||
|
const statusBarHeight = sheep_index.sheep.$platform.device.statusBarHeight * 2;
|
||
|
const headerBg = sheep_index.sheep.$url.css("/static/img/shop/order/order_bg.png");
|
||
|
const state = common_vendor.reactive({
|
||
|
orderInfo: {},
|
||
|
merchantTradeNo: "",
|
||
|
// 商户订单号
|
||
|
comeinType: ""
|
||
|
// 进入订单详情的来源类型
|
||
|
});
|
||
|
const systemStore = common_vendor.ref({});
|
||
|
const onCopy = () => {
|
||
|
sheep_index.sheep.$helper.copyText(state.orderInfo.no);
|
||
|
};
|
||
|
function onPay(payOrderId) {
|
||
|
sheep_index.sheep.$router.go("/modules/mall/pay/index", {
|
||
|
id: payOrderId
|
||
|
});
|
||
|
}
|
||
|
function onGoodsDetail(id) {
|
||
|
sheep_index.sheep.$router.go("/modules/mall/goods/index", {
|
||
|
id
|
||
|
});
|
||
|
}
|
||
|
function onCancel(orderId) {
|
||
|
return __async(this, null, function* () {
|
||
|
common_vendor.index.showModal({
|
||
|
title: "提示",
|
||
|
content: "确定要取消订单吗?",
|
||
|
success: function(res) {
|
||
|
return __async(this, null, function* () {
|
||
|
if (!res.confirm) {
|
||
|
return;
|
||
|
}
|
||
|
const { code } = yield sheep_api_trade_order.OrderApi.cancelOrder(orderId);
|
||
|
if (code === 0) {
|
||
|
yield getOrderDetail(orderId);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
function onExpress(id) {
|
||
|
return __async(this, null, function* () {
|
||
|
sheep_index.sheep.$router.go("/modules/mall/order/express/log", {
|
||
|
id
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
function onConfirm(orderId, ignore = false) {
|
||
|
return __async(this, null, function* () {
|
||
|
const isOpenBusinessView = true;
|
||
|
if (sheep_index.sheep.$platform.name === "WechatMiniProgram" && !common_vendor.isEmpty(state.orderInfo.wechat_extra_data) && isOpenBusinessView && !ignore) {
|
||
|
mpConfirm(orderId);
|
||
|
return;
|
||
|
}
|
||
|
const { code } = yield sheep_api_trade_order.OrderApi.receiveOrder(orderId);
|
||
|
if (code === 0) {
|
||
|
yield 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("/modules/mall/goods/comment/add", {
|
||
|
id
|
||
|
});
|
||
|
}
|
||
|
const pickUpVerifyRef = common_vendor.ref();
|
||
|
function getOrderDetail(id) {
|
||
|
return __async(this, null, function* () {
|
||
|
let res;
|
||
|
if (state.comeinType === "wechat") {
|
||
|
res = yield sheep_api_trade_order.OrderApi.getOrder(id, {
|
||
|
merchant_trade_no: state.merchantTradeNo
|
||
|
});
|
||
|
} else {
|
||
|
res = yield sheep_api_trade_order.OrderApi.getOrder(id);
|
||
|
}
|
||
|
if (res.code === 0) {
|
||
|
state.orderInfo = res.data;
|
||
|
sheep_hooks_useGoods.handleOrderButtons(state.orderInfo);
|
||
|
if (res.data.pickUpStoreId) {
|
||
|
const { data } = yield sheep_api_trade_delivery.DeliveryApi.getDeliveryPickUpStore(res.data.pickUpStoreId);
|
||
|
systemStore.value = data || {};
|
||
|
}
|
||
|
if (state.orderInfo.deliveryType === 2 && state.orderInfo.payStatus) {
|
||
|
pickUpVerifyRef.value && pickUpVerifyRef.value.markCode(res.data.pickUpVerifyCode);
|
||
|
}
|
||
|
} else {
|
||
|
sheep_index.sheep.$router.back();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
common_vendor.onLoad((options) => __async(this, null, function* () {
|
||
|
let id = 0;
|
||
|
if (options.id) {
|
||
|
id = options.id;
|
||
|
}
|
||
|
state.comeinType = options.comein_type;
|
||
|
if (state.comeinType === "wechat") {
|
||
|
state.merchantTradeNo = options.merchant_trade_no;
|
||
|
}
|
||
|
yield 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/img/shop/order/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/img/shop/order/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/img/shop/order/order_close.png")
|
||
|
} : {}, {
|
||
|
g: state.orderInfo.status_code == "noget"
|
||
|
}, state.orderInfo.status_code == "noget" ? {
|
||
|
h: common_vendor.unref(sheep_index.sheep).$url.static("/static/img/shop/order/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("/modules/mall/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("/modules/mall/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("/modules/mall/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: "2cd5eaa5-2-" + i0 + ",2cd5eaa5-1",
|
||
|
k: common_vendor.p({
|
||
|
img: item.picUrl,
|
||
|
title: item.spuName,
|
||
|
skuText: item.properties.map((property) => property.valueName).join(" "),
|
||
|
price: item.price,
|
||
|
num: item.count
|
||
|
}),
|
||
|
l: item.goods_id
|
||
|
});
|
||
|
}),
|
||
|
r: common_vendor.s({
|
||
|
marginTop: state.orderInfo.receiverAreaId > 0 ? "0" : "-40rpx"
|
||
|
}),
|
||
|
s: common_vendor.sr(pickUpVerifyRef, "2cd5eaa5-3,2cd5eaa5-1", {
|
||
|
"k": "pickUpVerifyRef"
|
||
|
}),
|
||
|
t: common_vendor.p({
|
||
|
["order-info"]: state.orderInfo,
|
||
|
systemStore: systemStore.value
|
||
|
}),
|
||
|
v: common_vendor.t(state.orderInfo.no),
|
||
|
w: common_vendor.o(onCopy),
|
||
|
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.couponPrice > 0
|
||
|
}, state.orderInfo.couponPrice > 0 ? {
|
||
|
E: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.orderInfo.couponPrice))
|
||
|
} : {}, {
|
||
|
F: state.orderInfo.pointPrice > 0
|
||
|
}, state.orderInfo.pointPrice > 0 ? {
|
||
|
G: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.orderInfo.pointPrice))
|
||
|
} : {}, {
|
||
|
H: state.orderInfo.discountPrice > 0
|
||
|
}, state.orderInfo.discountPrice > 0 ? {
|
||
|
I: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.orderInfo.discountPrice))
|
||
|
} : {}, {
|
||
|
J: state.orderInfo.vipPrice > 0
|
||
|
}, state.orderInfo.vipPrice > 0 ? {
|
||
|
K: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.orderInfo.vipPrice))
|
||
|
} : {}, {
|
||
|
L: common_vendor.t(state.orderInfo.payStatus ? "已付款" : "需付款"),
|
||
|
M: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.orderInfo.payPrice)),
|
||
|
N: state.orderInfo.refundPrice > 0
|
||
|
}, state.orderInfo.refundPrice > 0 ? {
|
||
|
O: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.orderInfo.refundPrice))
|
||
|
} : {}, {
|
||
|
P: (_a = state.orderInfo.buttons) == null ? void 0 : _a.length
|
||
|
}, ((_b = state.orderInfo.buttons) == null ? void 0 : _b.length) ? common_vendor.e({
|
||
|
Q: (_c = state.orderInfo.buttons) == null ? void 0 : _c.includes("cancel")
|
||
|
}, ((_d = state.orderInfo.buttons) == null ? void 0 : _d.includes("cancel")) ? {
|
||
|
R: common_vendor.o(($event) => onCancel(state.orderInfo.id))
|
||
|
} : {}, {
|
||
|
S: (_e = state.orderInfo.buttons) == null ? void 0 : _e.includes("pay")
|
||
|
}, ((_f = state.orderInfo.buttons) == null ? void 0 : _f.includes("pay")) ? {
|
||
|
T: common_vendor.o(($event) => onPay(state.orderInfo.payOrderId))
|
||
|
} : {}, {
|
||
|
U: (_g = state.orderInfo.buttons) == null ? void 0 : _g.includes("combination")
|
||
|
}, ((_h = state.orderInfo.buttons) == null ? void 0 : _h.includes("combination")) ? {
|
||
|
V: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/modules/mall/activity/groupon/detail", {
|
||
|
id: state.orderInfo.combinationRecordId
|
||
|
}))
|
||
|
} : {}, {
|
||
|
W: (_i = state.orderInfo.buttons) == null ? void 0 : _i.includes("express")
|
||
|
}, ((_j = state.orderInfo.buttons) == null ? void 0 : _j.includes("express")) ? {
|
||
|
X: common_vendor.o(($event) => onExpress(state.orderInfo.id))
|
||
|
} : {}, {
|
||
|
Y: (_k = state.orderInfo.buttons) == null ? void 0 : _k.includes("confirm")
|
||
|
}, ((_l = state.orderInfo.buttons) == null ? void 0 : _l.includes("confirm")) ? {
|
||
|
Z: common_vendor.o(($event) => onConfirm(state.orderInfo.id))
|
||
|
} : {}, {
|
||
|
aa: (_m = state.orderInfo.buttons) == null ? void 0 : _m.includes("comment")
|
||
|
}, ((_n = state.orderInfo.buttons) == null ? void 0 : _n.includes("comment")) ? {
|
||
|
ab: common_vendor.o(($event) => onComment(state.orderInfo.id))
|
||
|
} : {}, {
|
||
|
ac: common_vendor.p({
|
||
|
bottom: true,
|
||
|
placeholder: true,
|
||
|
bg: "bg-white"
|
||
|
})
|
||
|
}) : {}, {
|
||
|
ad: common_vendor.p({
|
||
|
title: "订单详情",
|
||
|
navbar: "inner"
|
||
|
}),
|
||
|
ae: common_vendor.s(_ctx.__cssVars())
|
||
|
});
|
||
|
};
|
||
|
}
|
||
|
};
|
||
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-2cd5eaa5"]]);
|
||
|
wx.createPage(MiniProgramPage);
|
||
|
//# sourceMappingURL=detail.js.map
|