diff --git a/app.json b/app.json index 79628b1..10e7a0c 100644 --- a/app.json +++ b/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", diff --git a/pages/OnlineCarHailing/OnlineCarHailing.js b/pages/OnlineCarHailing/OnlineCarHailing.js new file mode 100644 index 0000000..4ecc828 --- /dev/null +++ b/pages/OnlineCarHailing/OnlineCarHailing.js @@ -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() { + + } +}) \ No newline at end of file diff --git a/pages/OnlineCarHailing/OnlineCarHailing.json b/pages/OnlineCarHailing/OnlineCarHailing.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/OnlineCarHailing/OnlineCarHailing.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/OnlineCarHailing/OnlineCarHailing.wxml b/pages/OnlineCarHailing/OnlineCarHailing.wxml new file mode 100644 index 0000000..1ed4301 --- /dev/null +++ b/pages/OnlineCarHailing/OnlineCarHailing.wxml @@ -0,0 +1,9 @@ + + + 设置网约车用户 +
+ + +
+
+
\ No newline at end of file diff --git a/pages/OnlineCarHailing/OnlineCarHailing.wxss b/pages/OnlineCarHailing/OnlineCarHailing.wxss new file mode 100644 index 0000000..e597b4c --- /dev/null +++ b/pages/OnlineCarHailing/OnlineCarHailing.wxss @@ -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); +} \ No newline at end of file diff --git a/pages/duiquan/duiquan.js b/pages/duiquan/duiquan.js index a31e33a..f303ea3 100644 --- a/pages/duiquan/duiquan.js +++ b/pages/duiquan/duiquan.js @@ -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 || '兑换失败', diff --git a/pages/refund/refund.js b/pages/refund/refund.js new file mode 100644 index 0000000..fa6dc94 --- /dev/null +++ b/pages/refund/refund.js @@ -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' + }) + } +}) \ No newline at end of file diff --git a/pages/refund/refund.json b/pages/refund/refund.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/refund/refund.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/refund/refund.wxml b/pages/refund/refund.wxml new file mode 100644 index 0000000..f93ca5d --- /dev/null +++ b/pages/refund/refund.wxml @@ -0,0 +1,55 @@ + + + 退款 +
+ + +
+ + + + + 手机号:{{userInfo.mobile}} + 用户ID:{{userInfo.uid}} + + + 总余额 + {{userInfo.money}} + + + 洗车金 + {{userInfo.principal}} + + + 赠送金额 + {{userInfo.givenamount}} + + + + + + +
+ + 本金:{{userInfo.recharge.money || ''}} + 赠送:{{userInfo.recharge.bonusamount || ''}} + 订单号:{{userInfo.recharge.orderid || ''}} + 充值时间:{{userInfo.recharge.date || ''}} + 网点:{{userInfo.recharge.agent || ''}} + + +
+ +
+ + 本金:{{userInfo.recharge.money || ''}} + 赠送:{{userInfo.recharge.bonusamount || ''}} + 订单号:{{userInfo.recharge.orderid || ''}} + 充值时间:{{userInfo.recharge.date || ''}} + 网点:{{userInfo.recharge.agent || ''}} + + +
+
+
+
\ No newline at end of file diff --git a/pages/refund/refund.wxss b/pages/refund/refund.wxss new file mode 100644 index 0000000..2dc178b --- /dev/null +++ b/pages/refund/refund.wxss @@ -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; +} \ No newline at end of file diff --git a/pages/washCodeList/washCodeList.js b/pages/washCodeList/washCodeList.js index 970977a..a6568cf 100644 --- a/pages/washCodeList/washCodeList.js +++ b/pages/washCodeList/washCodeList.js @@ -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: "该洗车券不可用~", diff --git a/project.private.config.json b/project.private.config.json index d3d7639..7a1064b 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -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",