|
|
@@ -37,6 +37,25 @@ Page({
|
|
|
showDetail: false,
|
|
|
isPaymentLoading: false,
|
|
|
orderStatus: "", // 订单状态:pending, paid, closed, completed
|
|
|
+ // 售后半屏弹窗(组件 after-sale-type-popup)
|
|
|
+ afterSalePopupVisible: false,
|
|
|
+ refundReasonPopupVisible: false,
|
|
|
+ refundConfirmPopupVisible: false,
|
|
|
+ refundProofPopupVisible: false,
|
|
|
+ refundSubmitSuccessPopupVisible: false,
|
|
|
+ selectedAfterSaleType: "",
|
|
|
+ selectedRefundReason: "",
|
|
|
+ refundStatus: "received", // received | not-received
|
|
|
+ refundMaxAmount: 240,
|
|
|
+ refundAmount: 240,
|
|
|
+ refundDesc: "",
|
|
|
+ refundProofImages: [] as string[],
|
|
|
+ afterSaleSiteOption: {
|
|
|
+ name: "肝血虚穴位站点",
|
|
|
+ price: 80,
|
|
|
+ meta1: "10贴",
|
|
|
+ meta2: "x3",
|
|
|
+ },
|
|
|
},
|
|
|
onLoad(options: any) {
|
|
|
const remark = (this.data.orderDetail as any)?.remark || '';
|
|
|
@@ -125,7 +144,7 @@ Page({
|
|
|
if (!items || !Array.isArray(items)) {
|
|
|
return [];
|
|
|
}
|
|
|
- return items.map((item: any) => {
|
|
|
+ return items.map((item: any, index: number) => {
|
|
|
// 0是一口价 1按穴位/经络次数计费
|
|
|
const pricingType = item?.conditioningProgramDetail?.pricingType;
|
|
|
return {
|
|
|
@@ -156,6 +175,9 @@ Page({
|
|
|
statusText: this.getGoodsStatusText(item?.sellType, item?.progress, item?.receiptStatus),
|
|
|
isCanEvaluate: item?.isCanEvaluate, //是否可以评价 false-否 true-是
|
|
|
evaluateTime: item?.evaluateTime, //有评价时间就是已评价,是空就是未评价
|
|
|
+ // [测试数据] 为了演示“申请售后”和“退款申请中”的不同状态
|
|
|
+ // 如果是第一个商品或者偶数商品,模拟状态为1(退款申请中),否则为0(可申请售后)
|
|
|
+ afterSaleStatus: index === 0 ? 1 : 0,
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
@@ -213,7 +235,7 @@ Page({
|
|
|
const payResult = await orderPayMethod(this.data.id, (this.data.orderDetail as any)?.remark);
|
|
|
if (payResult && payResult.data) {
|
|
|
const paymentParams = payResult.data;
|
|
|
- handleWeChatPayment(paymentParams, (res: any) => {
|
|
|
+ handleWeChatPayment(paymentParams, (_res: any) => {
|
|
|
// 支付成功,跳转到成功页面
|
|
|
wx.redirectTo({
|
|
|
url: "/module/article/pages/success-page/success-page?title=订单支付成功",
|
|
|
@@ -264,8 +286,101 @@ Page({
|
|
|
preventTap() {
|
|
|
// 仅用于 catchtap 阻止冒泡,避免触发父级 goAppointment
|
|
|
},
|
|
|
- onApplyAfterSale(_e: any) {
|
|
|
- wx.showToast({ title: "申请售后", icon: "none" });
|
|
|
+ onApplyAfterSale(e: any) {
|
|
|
+ const status = e.currentTarget.dataset.status;
|
|
|
+ if (status === 1) {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: "/module/order/pages/refund-processing/refund-processing"
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.setData({ afterSalePopupVisible: true });
|
|
|
+ },
|
|
|
+
|
|
|
+ onAfterSalePopupClose() {
|
|
|
+ this.setData({ afterSalePopupVisible: false });
|
|
|
+ },
|
|
|
+
|
|
|
+ onAfterSaleNext(e: WechatMiniprogram.CustomEvent<{ selectedKey: string }>) {
|
|
|
+ const key = e.detail?.selectedKey;
|
|
|
+ if (!key) {
|
|
|
+ wx.showToast({ title: "请选择售后类型", icon: "none" });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ selectedAfterSaleType: key,
|
|
|
+ afterSalePopupVisible: false,
|
|
|
+ refundReasonPopupVisible: true,
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ onRefundReasonPopupClose() {
|
|
|
+ this.setData({ refundReasonPopupVisible: false });
|
|
|
+ },
|
|
|
+
|
|
|
+ onRefundReasonNext(e: WechatMiniprogram.CustomEvent<{ reason: string }>) {
|
|
|
+ const reason = e.detail?.reason;
|
|
|
+ if (!reason) {
|
|
|
+ wx.showToast({ title: "请选择退款原因", icon: "none" });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ selectedRefundReason: reason,
|
|
|
+ refundReasonPopupVisible: false,
|
|
|
+ refundConfirmPopupVisible: true,
|
|
|
+ refundStatus: "received",
|
|
|
+ refundAmount: this.data.refundMaxAmount,
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ onRefundConfirmClose() {
|
|
|
+ this.setData({ refundConfirmPopupVisible: false });
|
|
|
+ },
|
|
|
+
|
|
|
+ onChangeRefundStatus(e: WechatMiniprogram.CustomEvent<{ status: "received" | "not-received" }>) {
|
|
|
+ this.setData({ refundStatus: e.detail?.status || "received" });
|
|
|
+ },
|
|
|
+
|
|
|
+ onOpenRefundReasonAgain() {
|
|
|
+ this.setData({ refundReasonPopupVisible: true });
|
|
|
+ },
|
|
|
+
|
|
|
+ onRefundAmountConfirm(e: WechatMiniprogram.CustomEvent<{ amount: number }>) {
|
|
|
+ const amount = Number(e.detail?.amount || 0);
|
|
|
+ this.setData({ refundAmount: amount });
|
|
|
+ },
|
|
|
+
|
|
|
+ onOpenRefundProofEditor() {
|
|
|
+ this.setData({ refundProofPopupVisible: true });
|
|
|
+ },
|
|
|
+
|
|
|
+ onRefundProofPopupClose() {
|
|
|
+ this.setData({ refundProofPopupVisible: false });
|
|
|
+ },
|
|
|
+
|
|
|
+ onRefundProofConfirm(e: WechatMiniprogram.CustomEvent<{ desc: string; images: string[] }>) {
|
|
|
+ this.setData({
|
|
|
+ refundDesc: e.detail?.desc || "",
|
|
|
+ refundProofImages: e.detail?.images || [],
|
|
|
+ refundProofPopupVisible: false,
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ onSubmitRefundApply() {
|
|
|
+ if (!this.data.selectedRefundReason) {
|
|
|
+ wx.showToast({ title: "请选择退款原因", icon: "none" });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!this.data.refundProofImages.length) {
|
|
|
+ wx.showToast({ title: "请上传凭证图片", icon: "none" });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ refundConfirmPopupVisible: false,
|
|
|
+ });
|
|
|
+ wx.navigateTo({
|
|
|
+ url: "/module/order/pages/refund-success/refund-success",
|
|
|
+ });
|
|
|
},
|
|
|
onReview(e: WechatMiniprogram.TouchEvent) {
|
|
|
// const orderId = this.data.id || "";
|