110 lines
2.5 KiB
JavaScript
110 lines
2.5 KiB
JavaScript
var t = require("../../utils/login.js");
|
|
|
|
Page({
|
|
data: {
|
|
userInfo: {
|
|
mobile: '',
|
|
uid: '',
|
|
givenamount: "0.00",
|
|
money: "0.00",
|
|
principal: "0.00",
|
|
}, // 用户查询结果
|
|
list: [], // 退款记录列表
|
|
showResult: false // 控制查询结果显示
|
|
},
|
|
|
|
onSubmitToGroup(e) {
|
|
const mobile = e.detail.value.code
|
|
if (!mobile) {
|
|
wx.showToast({
|
|
title: '请输入手机号码',
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}
|
|
|
|
// 手机号格式验证
|
|
if (!/^1[3-9]\d{9}$/.test(mobile)) {
|
|
wx.showToast({
|
|
title: '请输入正确的手机号码',
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}
|
|
|
|
wx.showLoading({
|
|
title: '查询中...'
|
|
})
|
|
|
|
t.request('/miniprogram/Refund/query', { mobile }, !0).then((res) => {
|
|
wx.hideLoading()
|
|
if (res.code == 200) {
|
|
this.setData({
|
|
userInfo: res.data.user,
|
|
list: res.data.list,
|
|
showResult: true
|
|
})
|
|
} else {
|
|
wx.showToast({
|
|
title: res.message || '查询失败',
|
|
icon: 'none'
|
|
})
|
|
}
|
|
})
|
|
},
|
|
|
|
// 线上退款
|
|
onSubmitToGroup1() {
|
|
wx.showModal({
|
|
title: '确认退款',
|
|
content: '确定退款,将清零用户赠送金额,退还本金',
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
wx.showLoading({
|
|
title: '退款中...'
|
|
})
|
|
if (!this.data.userInfo.recharge || !this.data.userInfo.token) {
|
|
wx.showToast({
|
|
title: '退款信息不完整',
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}
|
|
t.request('/miniprogram/pay/refund', {token: this.data.userInfo.token}, !0).then((res) => {
|
|
wx.hideLoading()
|
|
if (res.code == 200) {
|
|
wx.showToast({
|
|
title: '退款成功',
|
|
icon: 'success'
|
|
})
|
|
// 刷新页面数据
|
|
this.setData({
|
|
showResult: false,
|
|
userInfo: {
|
|
mobile: '',
|
|
uid: '',
|
|
givenamount: "0.00",
|
|
money: "0.00",
|
|
principal: "0.00"
|
|
}
|
|
})
|
|
} else {
|
|
wx.showToast({
|
|
title: res.message || '退款失败',
|
|
icon: 'none'
|
|
})
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})
|
|
},
|
|
|
|
// 线下退款
|
|
onSubmitToGroup2() {
|
|
wx.showToast({
|
|
title: '请联系客服, 线下退款',
|
|
icon: 'none'
|
|
})
|
|
}
|
|
}) |