105 lines
3.3 KiB
JavaScript
105 lines
3.3 KiB
JavaScript
|
"use strict";
|
||
|
const common_vendor = require("../../common/vendor.js");
|
||
|
const API_api = require("../../API/api.js");
|
||
|
const _sfc_main = {
|
||
|
__name: "goToRemark",
|
||
|
setup(__props) {
|
||
|
const remark = common_vendor.ref("");
|
||
|
const orderItem = common_vendor.ref(null);
|
||
|
const getOrder = () => {
|
||
|
const notPay = common_vendor.index.getStorageSync("notPay");
|
||
|
common_vendor.index.request({
|
||
|
url: API_api.apiImageUrl + "/api/orders/get/my",
|
||
|
method: "GET",
|
||
|
data: {
|
||
|
id: notPay
|
||
|
},
|
||
|
header: {
|
||
|
"Content-Type": "application/json",
|
||
|
// 保设置正确的 Content-Type
|
||
|
"cookie": common_vendor.index.getStorageSync("cookie") || ""
|
||
|
},
|
||
|
success(res) {
|
||
|
console.log("成功");
|
||
|
if (res.data && res.data.data) {
|
||
|
orderItem.value = res.data.data;
|
||
|
console.log(orderItem.value);
|
||
|
}
|
||
|
},
|
||
|
fail() {
|
||
|
console.log("失败");
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
common_vendor.onMounted(getOrder);
|
||
|
const submitRemark = () => {
|
||
|
var _a, _b, _c, _d;
|
||
|
const notPay = common_vendor.index.getStorageSync("notPay");
|
||
|
if (!notPay) {
|
||
|
common_vendor.index.showToast({
|
||
|
title: "订单ID未找到",
|
||
|
icon: "none"
|
||
|
});
|
||
|
return;
|
||
|
}
|
||
|
common_vendor.index.showLoading({
|
||
|
title: "正在提交备注..."
|
||
|
});
|
||
|
let currentTime = /* @__PURE__ */ new Date();
|
||
|
let futureTime = new Date(currentTime.getTime() + 3600 * 1e3);
|
||
|
futureTime.toISOString();
|
||
|
common_vendor.index.request({
|
||
|
url: API_api.apiImageUrl + "/api/orders/updateOrder",
|
||
|
method: "POST",
|
||
|
data: {
|
||
|
orderId: notPay,
|
||
|
notes: remark.value,
|
||
|
location: ((_a = orderItem.value) == null ? void 0 : _a.location) || "",
|
||
|
pickupMethod: ((_b = orderItem.value) == null ? void 0 : _b.pickupMethod) || 0,
|
||
|
pickupEndTime: ((_c = orderItem.value) == null ? void 0 : _c.pickupEndTime) || "",
|
||
|
pickupStartTime: ((_d = orderItem.value) == null ? void 0 : _d.pickupStartTime) || ""
|
||
|
},
|
||
|
header: {
|
||
|
"Content-Type": "application/json",
|
||
|
// 确保设置正确的 Content-Type
|
||
|
"cookie": common_vendor.index.getStorageSync("cookie") || ""
|
||
|
},
|
||
|
success(res) {
|
||
|
console.log(res);
|
||
|
if (res.data.code === 0) {
|
||
|
common_vendor.index.showToast({
|
||
|
title: "备注提交成功",
|
||
|
duration: 2e3
|
||
|
});
|
||
|
common_vendor.index.navigateBack({
|
||
|
delta: 1,
|
||
|
// 返回上一页
|
||
|
success() {
|
||
|
common_vendor.index.$emit("updateRemark", remark.value);
|
||
|
}
|
||
|
});
|
||
|
} else {
|
||
|
common_vendor.index.showToast({
|
||
|
title: "备注提交失败",
|
||
|
icon: "none",
|
||
|
duration: 2e3
|
||
|
});
|
||
|
}
|
||
|
},
|
||
|
fail(err) {
|
||
|
console.log(err);
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
return (_ctx, _cache) => {
|
||
|
return {
|
||
|
a: remark.value,
|
||
|
b: common_vendor.o(($event) => remark.value = $event.detail.value),
|
||
|
c: common_vendor.o(submitRemark)
|
||
|
};
|
||
|
};
|
||
|
}
|
||
|
};
|
||
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-8072c105"]]);
|
||
|
wx.createPage(MiniProgramPage);
|