orderDetail.js
6.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
"use strict";
var common_vendor = require("../../common/vendor.js");
var api_index = require("../../api/index.js");
require("../../utils/request.js");
if (!Array) {
const _easycom_u_navbar2 = common_vendor.resolveComponent("u-navbar");
_easycom_u_navbar2();
}
const _easycom_u_navbar = () => "../../uni_modules/uview-plus/components/u-navbar/u-navbar.js";
if (!Math) {
(_easycom_u_navbar + shopAddres + orderShops + PayMode + tipPops)();
}
const shopAddres = () => "../../componets/address.js";
const orderShops = () => "../../componets/orderShop.js";
const tipPops = () => "../../componets/tipPop.js";
const PayMode = () => "../../componets/checkPayMode.js";
const _sfc_main = {
setup(__props) {
common_vendor.onLoad((e) => {
console.log(e.id);
orderId.value = e.id;
getOrderdetails(e.id);
});
let tipShow = common_vendor.ref(false);
let orderList = common_vendor.ref({});
let modeShow = common_vendor.ref(false);
let orderId = common_vendor.ref("");
let btnType = common_vendor.ref(1);
let integral = common_vendor.ref(0);
let tipType = common_vendor.ref(1);
let placeOrder = common_vendor.ref([
{ id: 1, name: "\u8BA2\u5355\u7F16\u53F7", text: "1212" },
{ id: 2, name: "\u652F\u4ED8\u65B9\u5F0F", text: "1212" },
{ id: 3, name: "\u4E0B\u5355\u65F6\u95F4", text: "1212" },
{ id: 4, name: "\u5FEB\u9012\u7F16\u53F7", text: "1212" }
]);
const leftClickHandler = () => {
common_vendor.index.navigateBack({ delta: 1 });
};
const copy = () => {
common_vendor.index.setClipboardData({
data: orderList.value.order_no,
success: () => {
common_vendor.index.showToast({ title: "\u590D\u5236\u6210\u529F", icon: "none" });
}
});
};
const btns = (type) => {
if (type == 0) {
tipType.value = btnType.value == 1 ? 1 : 2;
tipShow.value = true;
} else {
btnType.value == 1 ? modeShow.value = true : getReceipts();
}
};
const pointsBtns = (type) => {
console.log(type);
tipShow.value = false;
if (type == 1) {
tipType.value == 1 ? getCancleOrders() : getRefunds();
}
};
const { proxy } = common_vendor.getCurrentInstance();
const getOrderdetails = async (id) => {
try {
const res = await api_index.getOrderdetail(id);
orderList.value = res;
btnType.value = res.order_status;
placeOrder.value[0].text = res.order_no;
placeOrder.value[1].text = res.zhifu == 1 ? "\u5FAE\u4FE1" : "\u4F59\u989D";
placeOrder.value[2].text = res.createtime;
placeOrder.value[3].text = res.pay_order_no;
console.log("getOrderdetail", res);
} catch (err) {
common_vendor.index.showToast({ title: err, icon: "none" });
console.log("getOrderdetail", err);
}
};
const getCancleOrders = async () => {
try {
const res = await api_index.getCancleOrder(orderId.value);
proxy.$methods.showTN("\u8BA2\u5355\u5DF2\u53D6\u6D88~");
console.log("getCancleOrder", res);
} catch (err) {
common_vendor.index.showToast({ title: err, icon: "none" });
console.log("getCancleOrder", err);
}
};
const getRefunds = async () => {
try {
const res = await api_index.getRefund(orderId.value);
proxy.$methods.showTN("\u5DF2\u7533\u8BF7,\u7B49\u5F85\u5BA2\u670D\u5BA1\u6838");
console.log("getRefund", res);
} catch (err) {
common_vendor.index.showToast({ title: err, icon: "none" });
console.log("getRefund", err);
}
};
const getReceipts = async () => {
try {
const res = await api_index.getReceipt(orderId.value);
proxy.$methods.showTN("\u5DF2\u6536\u8D27,\u671F\u5F85\u4E0B\u6B21\u4E0B\u5355~");
console.log("getReceipt", res);
} catch (err) {
common_vendor.index.showToast({ title: err, icon: "none" });
console.log("getReceipt", err);
}
};
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.o(leftClickHandler),
b: common_vendor.p({
bgColor: "transparent",
placeholder: true
}),
c: common_vendor.p({
isOrder: true,
adress: common_vendor.unref(orderList)
}),
d: common_vendor.p({
shop: common_vendor.unref(orderList)
}),
e: common_vendor.t(common_vendor.unref(orderList).total_price),
f: common_vendor.f(common_vendor.unref(placeOrder), (item, index, i0) => {
return common_vendor.e({
a: common_vendor.t(item.name),
b: common_vendor.t(item.text),
c: index == 0
}, index == 0 ? {
d: common_vendor.o(copy)
} : {}, {
e: item.id
});
}),
g: common_vendor.unref(btnType) == 3
}, common_vendor.unref(btnType) == 3 ? {} : {}, {
h: common_vendor.unref(btnType) <= 2
}, common_vendor.unref(btnType) <= 2 ? {
i: common_vendor.t(common_vendor.unref(btnType) == 1 ? "\u53D6\u6D88\u4ED8\u6B3E" : common_vendor.unref(btnType) == 2 ? "\u7533\u8BF7\u9000\u6B3E" : "\u8054\u7CFB\u5BA2\u670D"),
j: common_vendor.o(($event) => btns(0))
} : {}, {
k: common_vendor.unref(btnType) == 1 || common_vendor.unref(btnType) == 3
}, common_vendor.unref(btnType) == 1 || common_vendor.unref(btnType) == 3 ? {
l: common_vendor.t(common_vendor.unref(btnType) == 1 ? "\u7ACB\u5373\u652F\u4ED8" : "\u786E\u8BA4\u6536\u8D27"),
m: common_vendor.o(($event) => btns(1))
} : {}, {
n: common_vendor.o(($event) => common_vendor.isRef(modeShow) ? modeShow.value = false : modeShow = false),
o: common_vendor.p({
orderId: common_vendor.unref(orderId),
isOrderPay: true,
totalPrice: common_vendor.unref(orderList).total_price,
modeShow: common_vendor.unref(modeShow)
}),
p: common_vendor.o(pointsBtns),
q: common_vendor.p({
integral: common_vendor.unref(integral),
tipType: common_vendor.unref(tipType),
tipShow: common_vendor.unref(tipShow)
})
});
};
}
};
var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/vue/\u5927\u5065\u5EB7\u5546\u57CE/healthMall/pages/mine/orderDetail.vue"]]);
wx.createPage(MiniProgramPage);