|
@@ -1,6 +1,6 @@
|
|
|
// pages/orders/order-detail.ts
|
|
|
import drawQrcode from "../../utils/weapp.qrcode.esm";
|
|
|
-import { api_userPaymentOrderDetail } from "../../api/login";
|
|
|
+import { api_userPaymentCancelRefund, api_userPaymentOrderDetail, api_userPaymentOrderRefundPayment } from "../../api/login";
|
|
|
|
|
|
// 获取应用实例
|
|
|
Page({
|
|
@@ -30,8 +30,13 @@ Page({
|
|
|
title: '等待使用',
|
|
|
content: '请尽快扫描下方二维码进行激活'
|
|
|
},
|
|
|
+ REFUNDING: {
|
|
|
+ logo: './images/refounding.png',
|
|
|
+ title: '退款中',
|
|
|
+ content: '您的退款申请正在处理,预计7个工作日内完成审核'
|
|
|
+ },
|
|
|
REFUNDED: {
|
|
|
- logo: './images/wait.png',
|
|
|
+ logo: './images/refounded.png',
|
|
|
title: '退款成功',
|
|
|
content: '您的退款已成功处理,感谢您的理解和支持'
|
|
|
}
|
|
@@ -41,7 +46,10 @@ Page({
|
|
|
goodsInfo: {} as any,
|
|
|
orderNo: "" as string,
|
|
|
showCanvas: false, // 是否显示二维码
|
|
|
- canvasImg: "" as string
|
|
|
+ canvasImg: "" as string,
|
|
|
+ showService: false,
|
|
|
+ refoundStatus: false,
|
|
|
+ refoundValue: "" // 退款内容
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -82,6 +90,7 @@ Page({
|
|
|
createTime: result.createTime,
|
|
|
wechatStatus: result.wechatStatus,
|
|
|
goods: tempGoods,
|
|
|
+ refundOrderId: result.refundOrderId,
|
|
|
refundTime: result.refundTime,
|
|
|
refundAmount: this.formatPrice(result.refundAmount || 0, 'ALL'),
|
|
|
refundStyleStr
|
|
@@ -102,7 +111,6 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.log(error, "error");
|
|
@@ -179,7 +187,9 @@ Page({
|
|
|
},
|
|
|
onTimeout() {
|
|
|
// 轮询10次查询订单状态
|
|
|
- const { goodsInfo, timerCount, timer } = this.data
|
|
|
+ const goodsInfo = this.data.goodsInfo
|
|
|
+ const timerCount = this.data.timerCount
|
|
|
+ const timer = this.data.timer
|
|
|
if(goodsInfo.wechatStatus === 'WAIT_PAY' && timerCount <= 10) {
|
|
|
let count = timerCount
|
|
|
const tempT = setTimeout(async () => {
|
|
@@ -195,5 +205,88 @@ Page({
|
|
|
} else {
|
|
|
clearTimeout(timer)
|
|
|
}
|
|
|
+ },
|
|
|
+ /** 客服 */
|
|
|
+ onService() {
|
|
|
+ this.setData({
|
|
|
+ showService: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ changePop(event: { detail: any }) {
|
|
|
+ this.setData({
|
|
|
+ showService: event.detail
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 申请退款 */
|
|
|
+ async cancelRefound() {
|
|
|
+ try {
|
|
|
+ const {data} = await api_userPaymentCancelRefund(this.data.goodsInfo.refundOrderId)
|
|
|
+ console.log(data, 'data')
|
|
|
+ if(data.code == 200) {
|
|
|
+ wx.showToast({ title: '取消退款成功', icon: 'none' })
|
|
|
+ wx.navigateBack({
|
|
|
+ delta: 1
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.showToast({ title: data.message, icon: 'none' })
|
|
|
+ }
|
|
|
+ } catch {}
|
|
|
+ },
|
|
|
+ /** 申请退款 */
|
|
|
+ useRefound() {
|
|
|
+ this.setData({
|
|
|
+ refoundStatus: true,
|
|
|
+ refoundValue: ""
|
|
|
+ })
|
|
|
+ },
|
|
|
+ textareaInput(e: { detail: any }) {
|
|
|
+ this.setData({
|
|
|
+ refoundValue: e.detail.value
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onRefoundClose() {
|
|
|
+ this.setData({
|
|
|
+ refoundStatus: false,
|
|
|
+ refoundValue: ''
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async onRefound() {
|
|
|
+ console.log(this.data.refoundValue, 'value')
|
|
|
+ const refoundValue = this.data.refoundValue
|
|
|
+ if(!refoundValue) {
|
|
|
+ wx.showToast({ title: '请输入退款原因', icon: 'none' })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ const { goods, orderNo } = this.data.goodsInfo
|
|
|
+ console.log(this.data.goodsInfo, 'goodsInfo')
|
|
|
+ const details: any = []
|
|
|
+ goods.forEach((item: any) => {
|
|
|
+ details.push({
|
|
|
+ num: item.goodsNum,
|
|
|
+ onlyRefund: false,
|
|
|
+ userPaymentOrderDetailId: item.id,
|
|
|
+ refundAmount: item.currentPrice
|
|
|
+ })
|
|
|
+ })
|
|
|
+ const params = {
|
|
|
+ merOrderNo: orderNo,
|
|
|
+ serviceCharge: false,
|
|
|
+ refundReason: refoundValue,
|
|
|
+ serviceChargeFee: 0,
|
|
|
+ userRefundOrderDetails: details
|
|
|
+ }
|
|
|
+ const {data} = await api_userPaymentOrderRefundPayment(params)
|
|
|
+ if(data.code == 200) {
|
|
|
+ wx.showToast({ title: '申请成功', icon: 'none' })
|
|
|
+ setTimeout(() => {
|
|
|
+ wx.navigateBack({
|
|
|
+ delta: 1
|
|
|
+ })
|
|
|
+ }, 2000);
|
|
|
+ } else {
|
|
|
+ wx.showToast({ title: data.message, icon: 'none' })
|
|
|
+ }
|
|
|
+ } catch {}
|
|
|
}
|
|
|
})
|