153 lines
5.4 KiB
JavaScript
153 lines
5.4 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const API_api = require("../../API/api.js");
|
|
if (!Array) {
|
|
const _easycom_uni_steps2 = common_vendor.resolveComponent("uni-steps");
|
|
_easycom_uni_steps2();
|
|
}
|
|
const _easycom_uni_steps = () => "../../uni_modules/uni-steps/components/uni-steps/uni-steps.js";
|
|
if (!Math) {
|
|
_easycom_uni_steps();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "testFive",
|
|
setup(__props) {
|
|
common_vendor.onUnload(() => {
|
|
common_vendor.index.reLaunch({
|
|
url: "/pages/index/index"
|
|
});
|
|
});
|
|
const LookImage = () => {
|
|
var _a;
|
|
if ((_a = orderItem.value) == null ? void 0 : _a.imageAddress) {
|
|
common_vendor.index.previewImage({
|
|
urls: ["http://" + orderItem.value.imageAddress],
|
|
current: 0
|
|
});
|
|
}
|
|
};
|
|
const active = common_vendor.ref(1);
|
|
const list1 = common_vendor.reactive([]);
|
|
const orderItem = common_vendor.ref(null);
|
|
const getOrder = () => {
|
|
const 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/x-www-form-urlencoded",
|
|
// 确保设置正确的 Content-Type
|
|
"cookie": common_vendor.index.getStorageSync("cookie") || ""
|
|
},
|
|
success(res) {
|
|
console.log(res.data.data);
|
|
if (res.data && res.data.data) {
|
|
orderItem.value = res.data.data;
|
|
if ([0, 1].includes(orderItem.value.pickupMethod)) {
|
|
list1.splice(
|
|
0,
|
|
list1.length,
|
|
{ title: "备餐中" },
|
|
{ title: "已出餐" },
|
|
{ title: "已完成" }
|
|
);
|
|
} else if (orderItem.value.pickupMethod === 2) {
|
|
list1.splice(
|
|
0,
|
|
list1.length,
|
|
{ title: "备餐中" },
|
|
{ title: "已出餐" },
|
|
{ title: "送餐中" },
|
|
{ title: "已完成" }
|
|
);
|
|
}
|
|
}
|
|
},
|
|
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 ? {} : common_vendor.e({
|
|
b: [0, 1].includes(orderItem.value.pickupMethod)
|
|
}, [0, 1].includes(orderItem.value.pickupMethod) ? {
|
|
c: common_vendor.t(orderItem.value.id)
|
|
} : orderItem.value.pickupMethod === 2 && orderItem.value.imageAddress ? {
|
|
e: "http://" + orderItem.value.imageAddress
|
|
} : {}, {
|
|
d: orderItem.value.pickupMethod === 2 && orderItem.value.imageAddress,
|
|
f: common_vendor.p({
|
|
options: list1,
|
|
active: active.value
|
|
}),
|
|
g: orderItem.value.pickupMethod === 2 && orderItem.value.imageAddress
|
|
}, orderItem.value.pickupMethod === 2 && orderItem.value.imageAddress ? {
|
|
h: common_vendor.o(LookImage)
|
|
} : {}, {
|
|
i: common_vendor.f(orderItem.value.orderDetailsVOList, (item, k0, i0) => {
|
|
return {
|
|
a: item.dishesVO.dishesImage,
|
|
b: common_vendor.t(item.dishesVO.dishesName),
|
|
c: common_vendor.t(item.quantity),
|
|
d: common_vendor.t(item.dishesVO.dishesName),
|
|
e: common_vendor.t(item.dishesVO.dishesPrice)
|
|
};
|
|
}),
|
|
j: common_vendor.t(orderItem.value.totalPrice),
|
|
k: common_vendor.t(orderItem.value.notes),
|
|
l: common_vendor.t(orderItem.value.phone.slice(-4)),
|
|
m: common_vendor.t(orderItem.value.pickupMethod === 0 ? "堂食" : orderItem.value.pickupMethod === 1 ? "自取" : "跑腿"),
|
|
n: common_vendor.t(orderItem.value.pickupCode),
|
|
o: common_vendor.o(copyText),
|
|
p: common_vendor.t(orderItem.value.payMethod === 0 ? "支付宝支付" : "线下支付")
|
|
}));
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-2e2c92b9"]]);
|
|
wx.createPage(MiniProgramPage);
|