"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 {
|
|
statusBarHeight: 0,
|
|
order: {},
|
|
// 固定4步流程
|
|
steps: [],
|
|
currentStep: 0,
|
|
baseInfo: [],
|
|
qcInfo: [],
|
|
showUserStatModal: false,
|
|
userStatData: { name: "", unit_num: "", sum: "", order_money: "" }
|
|
};
|
|
},
|
|
onLoad(options) {
|
|
this.statusBarHeight = common_vendor.index.getSystemInfoSync().statusBarHeight;
|
|
this.getAreaList();
|
|
if (options && options.id) {
|
|
this.fetchOrderDetail(options.id);
|
|
}
|
|
},
|
|
onShow() {
|
|
this.getAreaList();
|
|
},
|
|
methods: {
|
|
async fetchOrderDetail(orderId) {
|
|
this.$api("getOrderDetail", { orderId }, (res) => {
|
|
if (res && res.code === 200 && res.result) {
|
|
const data = res.result;
|
|
this.order = data;
|
|
this.currentStep = this.getCurrentStep(data.status, data.state);
|
|
this.baseInfo = [
|
|
{ label: "订单编号", value: data.ordeNo, copy: true },
|
|
...data.status === 2 ? [{ label: "快递单号", value: data.wliuNo, copy: true }] : [],
|
|
{ label: "用户名", value: data.name, arrow: true },
|
|
{ label: "取件地址", value: data.address + (data.addressDetail || "") },
|
|
{ label: "预约时间", value: data.goTime }
|
|
];
|
|
this.qcInfo = [
|
|
{ label: "质检数量", value: data.qcNum ? data.qcNum + " 件" : "" },
|
|
{ label: "质检合格", value: data.qcOkNum ? data.qcOkNum + " 件" : "" },
|
|
{ label: "质量问题", value: data.qcBadNum ? data.qcBadNum + " 件" : "" },
|
|
{ label: "不可回收", value: data.qcUnNum ? data.qcUnNum + " 件" : "" },
|
|
{ label: "订单重量", value: data.weight ? data.weight + " kg" : "" }
|
|
];
|
|
}
|
|
});
|
|
},
|
|
getCurrentStep(status, state) {
|
|
if (state == 3)
|
|
return -1;
|
|
if (status == 0)
|
|
return 0;
|
|
if (status == 1)
|
|
return 1;
|
|
if (status == 2)
|
|
return 2;
|
|
if (status == 3)
|
|
return 3;
|
|
return 0;
|
|
},
|
|
async onRefresh() {
|
|
if (this.order.id)
|
|
await this.fetchOrderDetail(this.order.id);
|
|
},
|
|
goBack() {
|
|
common_vendor.index.navigateBack();
|
|
},
|
|
copyText(text) {
|
|
common_vendor.index.setClipboardData({ data: text });
|
|
},
|
|
maskPhone(phone) {
|
|
if (!phone)
|
|
return "";
|
|
return phone.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
|
|
},
|
|
goToInspect() {
|
|
common_vendor.index.navigateTo({ url: "/pages/manager/inspect" });
|
|
},
|
|
async onUserStatClick() {
|
|
if (!this.order || !this.order.userId)
|
|
return;
|
|
this.$api("getUserOrderNum", { userId: this.order.userId }, (res) => {
|
|
if (res && res.code === 200 && res.result) {
|
|
this.userStatData = {
|
|
name: this.order.name,
|
|
unit_num: res.result.unit_num,
|
|
sum: res.result.sum,
|
|
order_money: res.result.order_money
|
|
};
|
|
this.showUserStatModal = true;
|
|
}
|
|
});
|
|
},
|
|
getAreaList() {
|
|
this.$api("getAreaList", {}, (res) => {
|
|
common_vendor.index.__f__("log", "at pages/manager/order-detail.vue:283", res, "getAreaList");
|
|
if (res.code == 200 && Array.isArray(res.result)) {
|
|
const sorted = res.result.slice().sort((a, b) => a.sort - b.sort);
|
|
this.steps = sorted.map((item) => ({
|
|
// id: item.id,
|
|
icon: item.image,
|
|
text: item.title
|
|
}));
|
|
}
|
|
});
|
|
},
|
|
passOrderAction() {
|
|
if (!this.order.id)
|
|
return;
|
|
this.$api("passOrder", { orderId: this.order.id }, (res) => {
|
|
if (res && res.code === 200) {
|
|
common_vendor.index.showToast({ title: "操作成功", icon: "success" });
|
|
this.fetchOrderDetail(this.order.id);
|
|
} else {
|
|
common_vendor.index.showToast({ title: res.msg || "操作失败", icon: "none" });
|
|
}
|
|
});
|
|
},
|
|
rejectOrderAction() {
|
|
if (!this.order.id)
|
|
return;
|
|
this.$api("rejectOrder", { orderId: this.order.id }, (res) => {
|
|
if (res && res.code === 200) {
|
|
common_vendor.index.showToast({ title: "操作成功", icon: "success" });
|
|
this.fetchOrderDetail(this.order.id);
|
|
} else {
|
|
common_vendor.index.showToast({ title: res.msg || "操作失败", icon: "none" });
|
|
}
|
|
});
|
|
}
|
|
}
|
|
};
|
|
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",
|
|
color: "#222"
|
|
}),
|
|
b: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
|
|
c: $data.order.cancelReason
|
|
}, $data.order.cancelReason ? {
|
|
d: common_vendor.t($data.order.cancelReason)
|
|
} : {}, {
|
|
e: $data.order.statusText === "不包邮"
|
|
}, $data.order.statusText === "不包邮" ? {} : {}, {
|
|
f: common_vendor.t($data.order.statusLabel),
|
|
g: common_vendor.n($data.order.statusClass),
|
|
h: common_vendor.f($data.steps, (step, idx, i0) => {
|
|
return {
|
|
a: step.icon,
|
|
b: common_vendor.t(step.text),
|
|
c: idx === $data.currentStep ? 1 : "",
|
|
d: step.text,
|
|
e: common_vendor.n({
|
|
active: idx === $data.currentStep
|
|
})
|
|
};
|
|
}),
|
|
i: common_vendor.f($data.baseInfo, (item, i, i0) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.t(item.label),
|
|
b: common_vendor.t(item.value),
|
|
c: item.copy
|
|
}, item.copy ? {
|
|
d: common_vendor.o(($event) => $options.copyText(item.value), item.label)
|
|
} : {}, {
|
|
e: item.arrow
|
|
}, item.arrow ? {
|
|
f: "9bb1abc0-1-" + i0,
|
|
g: common_vendor.p({
|
|
type: "right",
|
|
size: "18",
|
|
color: "#bbb"
|
|
})
|
|
} : {}, {
|
|
h: i < $data.baseInfo.length - 1
|
|
}, i < $data.baseInfo.length - 1 ? {} : {}, {
|
|
i: item.label,
|
|
j: item.label === "用户名" ? 1 : "",
|
|
k: common_vendor.o(($event) => item.label === "用户名" ? $options.onUserStatClick() : null, item.label)
|
|
});
|
|
}),
|
|
j: $data.showUserStatModal
|
|
}, $data.showUserStatModal ? {
|
|
k: common_vendor.t($data.userStatData.name),
|
|
l: common_vendor.t($data.userStatData.unit_num),
|
|
m: common_vendor.t($data.userStatData.sum),
|
|
n: common_vendor.t($data.userStatData.order_money),
|
|
o: common_vendor.o(($event) => $data.showUserStatModal = false)
|
|
} : {}, {
|
|
p: $data.order.status === 2 && $data.order.state === 1
|
|
}, $data.order.status === 2 && $data.order.state === 1 ? {
|
|
q: common_vendor.f($data.order.commonOrderList, (item, k0, i0) => {
|
|
return {
|
|
a: item.image,
|
|
b: common_vendor.t(item.title),
|
|
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: item.id
|
|
};
|
|
})
|
|
} : $data.order.status === 3 ? {
|
|
s: common_vendor.t($data.order.ordeNo),
|
|
t: common_vendor.t($data.order.price || $data.order.estimate),
|
|
v: common_vendor.t($data.order.price || $data.order.estimate),
|
|
w: common_vendor.f($data.order.commonOrderList, (item, k0, i0) => {
|
|
return {
|
|
a: item.image,
|
|
b: common_vendor.t(item.title),
|
|
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: item.id
|
|
};
|
|
})
|
|
} : {}, {
|
|
r: $data.order.status === 3,
|
|
x: $data.order.status === 3
|
|
}, $data.order.status === 3 ? {
|
|
y: common_vendor.f($data.qcInfo, (item, i, i0) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.t(item.label),
|
|
b: common_vendor.t(item.value),
|
|
c: i < $data.qcInfo.length - 1
|
|
}, i < $data.qcInfo.length - 1 ? {} : {}, {
|
|
d: item.label
|
|
});
|
|
}),
|
|
z: common_vendor.o((...args) => _ctx.goToInspection && _ctx.goToInspection(...args))
|
|
} : $data.order.status === 1 || $data.order.status === 0 ? {
|
|
B: common_vendor.t($data.order.price || $data.order.estimate),
|
|
C: common_vendor.f($data.order.commonOrderList, (item, k0, i0) => {
|
|
return {
|
|
a: item.image,
|
|
b: common_vendor.t(item.title),
|
|
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: item.id
|
|
};
|
|
})
|
|
} : {}, {
|
|
A: $data.order.status === 1 || $data.order.status === 0,
|
|
D: $data.order.status === 1 || $data.order.status === 0
|
|
}, $data.order.status === 1 || $data.order.status === 0 ? {
|
|
E: common_vendor.o((...args) => $options.rejectOrderAction && $options.rejectOrderAction(...args)),
|
|
F: common_vendor.o((...args) => $options.passOrderAction && $options.passOrderAction(...args))
|
|
} : $data.order.status === 2 && $data.order.state === 1 ? {
|
|
H: common_vendor.o((...args) => $options.goToInspect && $options.goToInspect(...args))
|
|
} : {}, {
|
|
G: $data.order.status === 2 && $data.order.state === 1
|
|
});
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-9bb1abc0"]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/manager/order-detail.js.map
|