上传代码
This commit is contained in:
95
uniapp04/unpackage/dist/dev/mp-weixin/pages/refund/refund.js
vendored
Normal file
95
uniapp04/unpackage/dist/dev/mp-weixin/pages/refund/refund.js
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const API_api = require("../../API/api.js");
|
||||
const _sfc_main = {
|
||||
__name: "refund",
|
||||
setup(__props) {
|
||||
const reason = common_vendor.ref("");
|
||||
const amount = common_vendor.ref(0);
|
||||
const orderId = common_vendor.ref("");
|
||||
common_vendor.ref(0);
|
||||
const getOrder = () => {
|
||||
const refundId = common_vendor.index.getStorageSync("refundId");
|
||||
common_vendor.index.request({
|
||||
url: API_api.apiImageUrl + "/api/orders/get/my",
|
||||
method: "GET",
|
||||
data: { id: refundId },
|
||||
header: {
|
||||
"Content-Type": "application/json",
|
||||
"cookie": common_vendor.index.getStorageSync("cookie") || ""
|
||||
},
|
||||
success(res) {
|
||||
var _a;
|
||||
if (res.data.code === 0) {
|
||||
console.log(res);
|
||||
const orderData = res.data.data;
|
||||
amount.value = orderData.totalPrice || 0;
|
||||
orderId.value = refundId;
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: ((_a = res.data) == null ? void 0 : _a.msg) || "获取订单信息失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
common_vendor.index.showToast({
|
||||
title: "网络错误,请重试",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
const submitRemark = async () => {
|
||||
if (!reason.value.trim()) {
|
||||
return common_vendor.index.showToast({
|
||||
title: "请填写退款原因",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
const requestData = {
|
||||
amount: amount.value,
|
||||
orderId: orderId.value,
|
||||
reason: reason.value,
|
||||
status: 0
|
||||
};
|
||||
common_vendor.index.request({
|
||||
url: API_api.apiImageUrl + "/api/refund/add",
|
||||
method: "POST",
|
||||
data: requestData,
|
||||
header: {
|
||||
"Content-Type": "application/json",
|
||||
"cookie": common_vendor.index.getStorageSync("cookie") || ""
|
||||
},
|
||||
success(res) {
|
||||
console.log(res);
|
||||
if (res.data.code === 5e4) {
|
||||
common_vendor.index.showToast({
|
||||
title: "此订单已存在退款记录,请勿重复提交",
|
||||
icon: "none"
|
||||
});
|
||||
} else {
|
||||
console.log(res);
|
||||
}
|
||||
},
|
||||
fail(err) {
|
||||
console.log(err);
|
||||
common_vendor.index.showToast({
|
||||
title: "网络错误,请重试",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
common_vendor.onMounted(getOrder);
|
||||
return (_ctx, _cache) => {
|
||||
return {
|
||||
a: reason.value,
|
||||
b: common_vendor.o(($event) => reason.value = $event.detail.value),
|
||||
c: common_vendor.o(submitRemark)
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-522d03b0"]]);
|
||||
wx.createPage(MiniProgramPage);
|
Reference in New Issue
Block a user