115 lines
4.0 KiB
JavaScript
115 lines
4.0 KiB
JavaScript
|
"use strict";
|
||
|
const common_vendor = require("../../common/vendor.js");
|
||
|
const API_api = require("../../API/api.js");
|
||
|
if (!Array) {
|
||
|
const _easycom_uni_list_chat2 = common_vendor.resolveComponent("uni-list-chat");
|
||
|
const _easycom_uni_list2 = common_vendor.resolveComponent("uni-list");
|
||
|
(_easycom_uni_list_chat2 + _easycom_uni_list2)();
|
||
|
}
|
||
|
const _easycom_uni_list_chat = () => "../../uni_modules/uni-list/components/uni-list-chat/uni-list-chat.js";
|
||
|
const _easycom_uni_list = () => "../../uni_modules/uni-list/components/uni-list/uni-list.js";
|
||
|
if (!Math) {
|
||
|
(_easycom_uni_list_chat + _easycom_uni_list)();
|
||
|
}
|
||
|
const _sfc_main = {
|
||
|
__name: "testfour",
|
||
|
setup(__props) {
|
||
|
const orderItem = common_vendor.ref(null);
|
||
|
const getOrder = () => {
|
||
|
let orderId = common_vendor.index.getStorageSync("orderId");
|
||
|
common_vendor.index.request({
|
||
|
url: API_api.apiImageUrl + "/api/orders/get/my",
|
||
|
method: "GET",
|
||
|
data: {
|
||
|
id: orderId
|
||
|
},
|
||
|
header: {
|
||
|
"Content-Type": "application/json",
|
||
|
// 确保设置正确的 Content-Type
|
||
|
"cookie": common_vendor.index.getStorageSync("cookie") || ""
|
||
|
},
|
||
|
success(res) {
|
||
|
console.log("成功");
|
||
|
console.log(res.data.data);
|
||
|
if (res.data && res.data.data) {
|
||
|
orderItem.value = res.data.data;
|
||
|
}
|
||
|
},
|
||
|
fail() {
|
||
|
console.log("失败");
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
common_vendor.onMounted(getOrder());
|
||
|
const copyText = async () => {
|
||
|
try {
|
||
|
await common_vendor.index.setClipboardData({
|
||
|
data: orderItem.value,
|
||
|
success: () => {
|
||
|
common_vendor.index.showToast({
|
||
|
title: "复制成功",
|
||
|
icon: "success",
|
||
|
duration: 2e3
|
||
|
});
|
||
|
},
|
||
|
fail: (err) => {
|
||
|
common_vendor.index.showToast({
|
||
|
title: "复制失败",
|
||
|
icon: "none",
|
||
|
duration: 2e3
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
} catch (error) {
|
||
|
console.error("复制失败:", error);
|
||
|
common_vendor.index.showToast({
|
||
|
title: "复制失败",
|
||
|
icon: "none",
|
||
|
duration: 2e3
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
common_vendor.ref([
|
||
|
{
|
||
|
imgUrl: "https://img95.699pic.com/photo/50093/6813.jpg_wh860.jpg",
|
||
|
title: "鸡腿饭",
|
||
|
unread: "1",
|
||
|
time: "单价25元",
|
||
|
message: "这次点的外卖真是超乎预期的好吃!【香辣鸡腿堡】外皮酥脆,鸡肉鲜嫩多汁,辣度适中,每一口都是满满的幸福感。【薯条】也是惊喜,又脆又香,完全没有油腻感。最棒的是配送员【小张】,准时送达,态度亲切,还特意提醒我餐品有点烫,小心食用。整体体验满分,下次还会再点!"
|
||
|
}
|
||
|
]);
|
||
|
return (_ctx, _cache) => {
|
||
|
return common_vendor.e({
|
||
|
a: orderItem.value
|
||
|
}, orderItem.value ? {
|
||
|
b: common_vendor.t(orderItem.value.id),
|
||
|
c: common_vendor.t(orderItem.value.totalPrice),
|
||
|
d: common_vendor.t(orderItem.value.userName),
|
||
|
e: common_vendor.t(orderItem.value.phone.slice(-4)),
|
||
|
f: common_vendor.f(orderItem.value.orderDetailsVOList, (item, k0, i0) => {
|
||
|
return {
|
||
|
a: item.id,
|
||
|
b: "68f2f90e-2-" + i0 + ",68f2f90e-1",
|
||
|
c: common_vendor.p({
|
||
|
title: item.dishesVO.dishesName,
|
||
|
avatar: item.dishesVO.dishesImage,
|
||
|
note: item.dishesVO.dishesPrice,
|
||
|
["badge-text"]: item.quantity,
|
||
|
clickable: "true"
|
||
|
})
|
||
|
};
|
||
|
}),
|
||
|
g: common_vendor.p({
|
||
|
border: true
|
||
|
}),
|
||
|
h: common_vendor.t(orderItem.value.pickupCode),
|
||
|
i: common_vendor.o(copyText),
|
||
|
j: common_vendor.t(orderItem.value.notes),
|
||
|
k: common_vendor.t(orderItem.value.pickupMethod === 0 ? "线上支付" : "线下支付"),
|
||
|
l: common_vendor.t(orderItem.value.updateTime)
|
||
|
} : {});
|
||
|
};
|
||
|
}
|
||
|
};
|
||
|
wx.createPage(_sfc_main);
|