| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 | 
							- import { api_userPaymentOrderRefundPayment } from "../../api/login";
 
- // components/apply-refound/apply-refound.ts
 
- Component({
 
-   /**
 
-    * 组件的属性列表
 
-    */
 
-   properties: {
 
-     refoundStatus: {
 
-       type: Boolean,
 
-       default: false,
 
-     },
 
-     goodsInfo: {
 
-       type: Object,
 
-       default: {}
 
-     }
 
-   },
 
-   /**
 
-    * 组件的初始数据
 
-    */
 
-   data: {
 
-     refoundValue: "", // 退款内容
 
-     refoundPhone: ''
 
-   },
 
-   /**
 
-    * 组件的方法列表
 
-    */
 
-   methods: {
 
-     textareaInput(e: { detail: any }) {
 
-       this.setData({
 
-         refoundValue: e.detail.value
 
-       })
 
-     },
 
-     phoneInput(e: { detail: any }) {
 
-       this.setData({
 
-         refoundPhone: e.detail.value
 
-       })
 
-     },
 
-     onRefoundClose() {
 
-       this.triggerEvent("changeRefoundStatus", false)
 
-     },
 
-     checkPhone(phone: string) {
 
-       const phoneRule =
 
-         /^((13[0-9])|(14(0|[5-7]|9))|(15([0-3]|[5-9]))|(16(2|[5-9]))|(17[0-8])|(18[0-9])|(19([0-3]|[5-9])))\d{8}$/;
 
-       return phoneRule.test(phone);
 
-     },
 
-     async onRefound() {
 
-       const refoundValue = this.data.refoundValue
 
-       const refoundPhone = this.data.refoundPhone
 
-       if (!refoundValue) {
 
-         wx.showToast({ title: '请输入退款原因', icon: 'none' })
 
-         return
 
-       }
 
-       if (!this.checkPhone(refoundPhone)) {
 
-         wx.showToast({ title: '请输入正确的手机号码', icon: 'none' })
 
-         return
 
-       }
 
-       try {
 
-         const { goods, orderNo } = this.data.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,
 
-           phone: refoundPhone, // 手机号
 
-           serviceChargeFee: 0,
 
-           userRefundOrderDetails: details
 
-         }
 
-         const { data } = await api_userPaymentOrderRefundPayment(params)
 
-         if (data.code == 200) {
 
-           wx.showToast({ title: '申请成功', icon: 'none' })
 
-           this.triggerEvent('onConfirm')
 
-         } else {
 
-           wx.showToast({ title: data.message, icon: 'none' })
 
-         }
 
-       } catch { }
 
-     },
 
-   }
 
- })
 
 
  |