feat: 新增退款和网约车用户管理页面
添加了退款和网约车用户管理相关页面,包括页面配置、样式、逻辑处理等。同时更新了应用配置文件和私有配置文件以支持新页面。
This commit is contained in:
parent
47d847e138
commit
7c8536272c
4
app.json
4
app.json
@ -23,7 +23,9 @@
|
||||
"pages/user/user",
|
||||
"pages/webview/webview",
|
||||
"pages/wangdian/wangdian",
|
||||
"pages/duiquan/duiquan"
|
||||
"pages/duiquan/duiquan",
|
||||
"pages/refund/refund",
|
||||
"pages/OnlineCarHailing/OnlineCarHailing"
|
||||
],
|
||||
"window": {
|
||||
"backgroundTextStyle": "light",
|
||||
|
118
pages/OnlineCarHailing/OnlineCarHailing.js
Normal file
118
pages/OnlineCarHailing/OnlineCarHailing.js
Normal file
@ -0,0 +1,118 @@
|
||||
// pages/OnlineCarHailing/OnlineCarHailing.js
|
||||
var t = require("../../utils/login.js");
|
||||
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
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.showModal({
|
||||
title: '确认提示',
|
||||
content: '确定要将此手机号设置为网约车用户吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
wx.showLoading({
|
||||
title: '提交中...'
|
||||
})
|
||||
|
||||
t.request('/miniprogram/user/onlineCarHailing', { mobile }, !0).then((res) => {
|
||||
wx.hideLoading()
|
||||
if (res.code == 200) {
|
||||
wx.showToast({
|
||||
title: '设置成功',
|
||||
icon: 'success'
|
||||
})
|
||||
setTimeout(() => {
|
||||
wx.navigateBack()
|
||||
}, 1500)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.message || '设置失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
3
pages/OnlineCarHailing/OnlineCarHailing.json
Normal file
3
pages/OnlineCarHailing/OnlineCarHailing.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
9
pages/OnlineCarHailing/OnlineCarHailing.wxml
Normal file
9
pages/OnlineCarHailing/OnlineCarHailing.wxml
Normal file
@ -0,0 +1,9 @@
|
||||
<view class="contain">
|
||||
<view class="content">
|
||||
<view class="title">设置网约车用户</view>
|
||||
<form bindsubmit="onSubmitToGroup">
|
||||
<input class="input" name="code" auto-focus placeholder="请填写用户手机号码"/>
|
||||
<button class="button" form-type="submit" type="primary">设置网约车用户</button>
|
||||
</form>
|
||||
</view>
|
||||
</view>
|
25
pages/OnlineCarHailing/OnlineCarHailing.wxss
Normal file
25
pages/OnlineCarHailing/OnlineCarHailing.wxss
Normal file
@ -0,0 +1,25 @@
|
||||
.contain {
|
||||
box-sizing: border-box;
|
||||
min-height: 100vh;
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 60rpx 40rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
line-height: 1;
|
||||
font-weight: 700;
|
||||
color: #0056A3;
|
||||
}
|
||||
|
||||
.input {
|
||||
margin: 40rpx 0;
|
||||
padding: 22rpx;
|
||||
border-radius: 10rpx;
|
||||
background-color: #fff;
|
||||
border: 2rpx solid #eee;
|
||||
box-shadow: 0 6rpx 10rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
@ -32,15 +32,31 @@ Page({
|
||||
t.request('/miniprogram/coupons/importDouyin', { code: code }, !0).then((res) => {
|
||||
wx.hideLoading()
|
||||
if (res.code == 200) {
|
||||
wx.showToast({
|
||||
wx.showModal({
|
||||
title: '兑换成功',
|
||||
icon: 'success'
|
||||
content: '是否立即使用?',
|
||||
success: (result) => {
|
||||
if (result.confirm) {
|
||||
// 判断是否已扫码
|
||||
if (getApp().globalData.devicecode) {
|
||||
// 已扫码,启动机器
|
||||
t.request('/miniprogram/device/start', { devicecode: getApp().globalData.devicecode }, !0).then((startRes) => {
|
||||
if (startRes.code == 200) {
|
||||
wx.showToast({ title: '启动成功', icon: 'success' });
|
||||
} else {
|
||||
wx.showToast({ title: startRes.message || '启动失败', icon: 'none' });
|
||||
wx.navigateTo({ url: '/pages/washCodeList/washCodeList' });
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 未扫码,跳转到washCodeList页面进行扫码
|
||||
wx.navigateTo({ url: '/pages/washCodeList/washCodeList' });
|
||||
}
|
||||
} else {
|
||||
wx.navigateTo({ url: '/pages/washCodeList/washCodeList' });
|
||||
}
|
||||
}
|
||||
});
|
||||
setTimeout(() => {
|
||||
wx.navigateTo({
|
||||
url: '/pages/washCodeList/washCodeList'
|
||||
})
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.message || '兑换失败',
|
||||
|
110
pages/refund/refund.js
Normal file
110
pages/refund/refund.js
Normal file
@ -0,0 +1,110 @@
|
||||
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'
|
||||
})
|
||||
}
|
||||
})
|
3
pages/refund/refund.json
Normal file
3
pages/refund/refund.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
55
pages/refund/refund.wxml
Normal file
55
pages/refund/refund.wxml
Normal file
@ -0,0 +1,55 @@
|
||||
<view class="contain">
|
||||
<view class="content">
|
||||
<view class="title">退款</view>
|
||||
<form bindsubmit="onSubmitToGroup"> <!-- 查询前 -->
|
||||
<input class="input" name="code" auto-focus placeholder="请填写用户手机号码"/>
|
||||
<button class="button" form-type="submit" type="primary">查询用户订单</button>
|
||||
</form>
|
||||
|
||||
<!-- 显示用户信息 .userInfo -->
|
||||
<view class="userInfo" wx:if="{{showResult && userInfo}}">
|
||||
<view class="info">
|
||||
<view>手机号:<text>{{userInfo.mobile}}</text></view>
|
||||
<view>用户ID:<text>{{userInfo.uid}}</text></view>
|
||||
<view class="balance-info">
|
||||
<view class="balance-item">
|
||||
<view class="label">总余额</view>
|
||||
<view class="value r">{{userInfo.money}}</view>
|
||||
</view>
|
||||
<view class="balance-item">
|
||||
<view class="label">洗车金</view>
|
||||
<view class="value g">{{userInfo.principal}}</view>
|
||||
</view>
|
||||
<view class="balance-item">
|
||||
<view class="label">赠送金额</view>
|
||||
<view class="value b">{{userInfo.givenamount}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<block wx:if="{{showResult && userInfo}}">
|
||||
<form bindsubmit="onSubmitToGroup1" wx:if="{{userInfo.refundType === 'online'}}"> <!-- 查询后 线上退款 -->
|
||||
<view class="info">
|
||||
<view>本金:<text class="r">{{userInfo.recharge.money || ''}}</text></view>
|
||||
<view>赠送:{{userInfo.recharge.bonusamount || ''}}</view>
|
||||
<view class="mt">订单号:{{userInfo.recharge.orderid || ''}}</view>
|
||||
<view>充值时间:<text class="r">{{userInfo.recharge.date || ''}}</text></view>
|
||||
<view>网点:<text class="r">{{userInfo.recharge.agent || ''}}</text></view>
|
||||
</view>
|
||||
<button class="button" form-type="submit" type="primary">线上退款</button>
|
||||
</form>
|
||||
|
||||
<form bindsubmit="onSubmitToGroup2" wx:if="{{userInfo.refundType === 'offline'}}"> <!-- 查询后 线下退款 -->
|
||||
<view class="info">
|
||||
<view>本金:<text class="r">{{userInfo.recharge.money || ''}}</text></view>
|
||||
<view>赠送:{{userInfo.recharge.bonusamount || ''}}</view>
|
||||
<view class="mt">订单号:{{userInfo.recharge.orderid || ''}}</view>
|
||||
<view>充值时间:<text class="r">{{userInfo.recharge.date || ''}}</text></view>
|
||||
<view>网点:<text class="r">{{userInfo.recharge.agent || ''}}</text></view>
|
||||
</view>
|
||||
<button class="button" form-type="submit" type="warn">线下退款</button>
|
||||
</form>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
82
pages/refund/refund.wxss
Normal file
82
pages/refund/refund.wxss
Normal file
@ -0,0 +1,82 @@
|
||||
.contain {
|
||||
box-sizing: border-box;
|
||||
min-height: 100vh;
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 60rpx 40rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
line-height: 1;
|
||||
font-weight: 700;
|
||||
color: #0056A3;
|
||||
}
|
||||
|
||||
.input {
|
||||
margin: 40rpx 0;
|
||||
padding: 22rpx;
|
||||
border-radius: 10rpx;
|
||||
background-color: #fff;
|
||||
border: 2rpx solid #eee;
|
||||
box-shadow: 0 6rpx 10rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.userInfo {
|
||||
padding-top: 22rpx;
|
||||
border-top: 2rpx solid #eee;
|
||||
}
|
||||
|
||||
.info {
|
||||
padding: 22rpx 32rpx;
|
||||
border-radius: 10rpx;
|
||||
background-color: #fff;
|
||||
border: 2rpx solid #eee;
|
||||
box-shadow: 0 6rpx 10rpx rgba(0, 0, 0, 0.1);
|
||||
margin-bottom: 30rpx;
|
||||
line-height: 2;
|
||||
}
|
||||
|
||||
.info .mt {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.info .r {
|
||||
color: #C13700;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.info .g {
|
||||
color: #60BB46;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.balance-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 20rpx;
|
||||
padding: 20rpx 0;
|
||||
border-top: 2rpx solid #eee;
|
||||
}
|
||||
|
||||
.balance-item {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.balance-item .label {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.balance-item .value {
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.balance-item .b {
|
||||
color: #0056A3;
|
||||
}
|
@ -35,6 +35,15 @@ Page({
|
||||
});
|
||||
},
|
||||
selectItem: function (t) {
|
||||
|
||||
|
||||
// 1. 提示用户先绑定设备, isScan
|
||||
if (!this.data.isScan) return wx.showModal({
|
||||
title: "提示",
|
||||
content: "请先扫码设备~"
|
||||
}),!1;
|
||||
|
||||
|
||||
var e = t.currentTarget.dataset, a = (e.index, e.code);
|
||||
if (1 != e.available) return wx.showToast({
|
||||
title: "该洗车券不可用~",
|
||||
|
@ -8,6 +8,20 @@
|
||||
"condition": {
|
||||
"miniprogram": {
|
||||
"list": [
|
||||
{
|
||||
"name": "pages/refund/refund",
|
||||
"pathName": "pages/refund/refund",
|
||||
"query": "",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "pages/OnlineCarHailing/OnlineCarHailing",
|
||||
"pathName": "pages/OnlineCarHailing/OnlineCarHailing",
|
||||
"query": "",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "pages/wangdian/wangdian",
|
||||
"pathName": "pages/wangdian/wangdian",
|
||||
|
Loading…
x
Reference in New Issue
Block a user