From a3fcf0eac16980a151e67ce523cd287c7035a528 Mon Sep 17 00:00:00 2001 From: XiaoMo Date: Tue, 24 Jun 2025 16:56:02 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=B8=AE=E6=B4=97=E6=9C=8D=E5=8A=A1):=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B8=AE=E6=B4=97=E6=9C=8D=E5=8A=A1=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=8F=8A=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增帮洗服务相关页面和功能,包括页面配置、路由添加、API接口调整和样式实现 更新小程序基础库版本至3.8.8 调整API接口路径统一使用v2版本前缀 --- app.js | 2 +- app.json | 1 + pages/index/index.js | 8 +- pages/substituteWash/substituteWash.js | 199 +++++++++++++++ pages/substituteWash/substituteWash.json | 8 + pages/substituteWash/substituteWash.wxml | 109 +++++++++ pages/substituteWash/substituteWash.wxss | 292 +++++++++++++++++++++++ pages/wangdian/wangdian.js | 4 +- project.private.config.json | 16 +- utils/login.js | 2 +- 10 files changed, 632 insertions(+), 9 deletions(-) create mode 100644 pages/substituteWash/substituteWash.js create mode 100644 pages/substituteWash/substituteWash.json create mode 100644 pages/substituteWash/substituteWash.wxml create mode 100644 pages/substituteWash/substituteWash.wxss diff --git a/app.js b/app.js index b311b4a..2081a69 100644 --- a/app.js +++ b/app.js @@ -9,7 +9,7 @@ App({ appKey: wx.getAccountInfoSync().miniProgram.appId, // 自动获取 小程序appid debug: true, //是否打开调试模式 // 上报地址 - LOG_URL: 'https://t-jm.v0750.com/send', + LOG_URL: 'https://t-jm.v0750.com/v2/stat/send', }, onLaunch: function(e) { console.log("options", e), this.globalData.options = e, t.getLogin(this, !0); diff --git a/app.json b/app.json index d3d179c..fb4c15d 100644 --- a/app.json +++ b/app.json @@ -26,6 +26,7 @@ "pages/duiquan/duiquan", "pages/refund/refund", "pages/washing/washing", + "pages/substituteWash/substituteWash", "pages/OnlineCarHailing/OnlineCarHailing" ], "window": { diff --git a/pages/index/index.js b/pages/index/index.js index 1f6c7b2..a5b45ff 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -38,7 +38,7 @@ Page({ e.globalData.latitude = res.latitude; e.globalData.longitude = res.longitude; // 获取网点列表 - t.request('/miniprogram/branch/lists', { + t.request('/v2/miniprogram/branch/lists', { latitude: res.latitude || '', longitude: res.longitude || '' }, !0).then(function (res) { @@ -49,7 +49,7 @@ Page({ }, fail: function () { // 即使获取位置失败也加载网点列表,只是不传入经纬度参数 - t.request('/miniprogram/branch/lists', {}, !0).then(function (res) { + t.request('/v2/miniprogram/branch/lists', {}, !0).then(function (res) { a.setData({ wangdianList: res.data || [] }); @@ -67,7 +67,7 @@ Page({ }); // 获取首页数据 - t.request('/miniprogram/index/home', { method: 'GET' }, !0).then(function (e) { + t.request('/v2/miniprogram/index/home', { method: 'GET' }, !0).then(function (e) { a.setData({ banner: e.data.banner, tmplIds: e.data.tmplIds, @@ -90,7 +90,7 @@ Page({ getData: function () { var a = this; // 获取首页数据 - t.request('/miniprogram/index/balance', {}, !0).then(function (e) { + t.request('/v2/miniprogram/index/balance', {}, !0).then(function (e) { a.setData({ user: e.data || [], }); diff --git a/pages/substituteWash/substituteWash.js b/pages/substituteWash/substituteWash.js new file mode 100644 index 0000000..33c944a --- /dev/null +++ b/pages/substituteWash/substituteWash.js @@ -0,0 +1,199 @@ +var t = getApp(), e = require("../../utils/login.js"); + +Page({ + + /** + * 页面的初始数据 + */ + data: { + userInfo: {}, + balance: 0, + loading: true, + paySuccess: false, + orderInfo: {}, + token: '', + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + var a = this; + // 等待全局接口执行完成后再初始化页面 + e.pageStart(t).then(function() { + a.initPage(); + }); + }, + + /** + * 初始化页面数据 + */ + initPage() { + var a = this; + a.setData({ + loading: true + }); + + e.request('/miniprogram/substituteWash/index', {}, true).then(function (res) { + a.setData({ + loading: false + }); + + if (res.code === 200 && res.data) { + a.setData({ + orderInfo: res.data.orderInfo || {}, + balance: res.data.balance || 0, + token: res.data.token || '', + }); + } else { + wx.showToast({ + title: res.message || '获取数据失败', + icon: 'none', + duration: 2000 + }); + } + }).catch(function (err) { + a.setData({ + loading: false + }); + + wx.showToast({ + title: '获取数据失败', + icon: 'none', + duration: 2000 + }); + }); + }, + + /** + * 确认洗车 + */ + confirmWash() { + var a = this; + + wx.showModal({ + title: '确认洗车', + content: '确定要进行帮洗服务吗?', + success: (res) => { + if (res.confirm) { + a.payForWash(); + } + } + }); + }, + + /** + * 支付洗车费用 + */ + payForWash() { + var a = this; + + wx.showLoading({ + title: '处理中', + mask: true + }); + + e.request('/miniprogram/substituteWash/pay', {token: a.data.token}, true).then(function (res) { + wx.hideLoading(); + + if (res.code === 200) { + wx.showToast({ + title: '支付成功', + icon: 'success', + duration: 2000 + }); + + // 更新余额信息和支付状态 + let updateData = { + paySuccess: true + }; + + if (res.data && res.data.balance !== undefined) { + updateData.balance = res.data.balance; + } + + if (res.data && res.data.orderInfo) { + updateData.orderInfo = res.data.orderInfo; + } + + a.setData(updateData); + + // 可以在这里添加支付成功后的其他操作 + } else { + wx.showModal({ + title: '支付失败', + content: res.message || '请稍后再试', + showCancel: false + }); + } + }).catch(function (err) { + wx.hideLoading(); + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + // 如果不是支付成功状态,则重新初始化页面 + if (!this.data.paySuccess) { + var a = this; + e.pageStart(t).then(function() { + a.initPage(); + }); + } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + var a = this; + e.pageStart(t).then(function() { + a.initPage(); + wx.stopPullDownRefresh(); + }); + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 禁止页面分享 + */ + onShareAppMessage: null, + + /** + * 返回首页 + */ + backToIndex() { + wx.redirectTo({ + url: '/pages/index/index' + }); + } +}) \ No newline at end of file diff --git a/pages/substituteWash/substituteWash.json b/pages/substituteWash/substituteWash.json new file mode 100644 index 0000000..30272a9 --- /dev/null +++ b/pages/substituteWash/substituteWash.json @@ -0,0 +1,8 @@ +{ + "navigationBarTitleText": "帮洗服务", + "enablePullDownRefresh": true, + "backgroundColor": "#f8f8f8", + "usingComponents": { + "service-tel": "/template/serviceTel/serviceTel" + } +} \ No newline at end of file diff --git a/pages/substituteWash/substituteWash.wxml b/pages/substituteWash/substituteWash.wxml new file mode 100644 index 0000000..6fe5127 --- /dev/null +++ b/pages/substituteWash/substituteWash.wxml @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + 加载中... + + + + + + + + + + + 支付成功 + + + + 洗车网点 + {{orderInfo.agentname || userInfo.nickname || '---'}} + + + 订单编号 + {{orderInfo.orderNo || '---'}} + + + 支付金额 + {{orderInfo.amount || '0'}} 元 + + + 账户余额 + {{balance}} 元 + + + + + 温馨提示 + + 1. 请向工作人员出示此页面 + 2. 确认支付成功后即可开始洗车服务 + 3. 如有疑问请联系客服 + + + + + + + + + + + + 帮洗服务 + 让洗车更便捷 + + + + + + 服务说明 + + 1. 帮洗服务由专业人员提供 + 2. 确认后将从您的账户余额中扣除相应费用 + 3. 服务完成后可在订单中查看详情 + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/substituteWash/substituteWash.wxss b/pages/substituteWash/substituteWash.wxss new file mode 100644 index 0000000..2f31cb0 --- /dev/null +++ b/pages/substituteWash/substituteWash.wxss @@ -0,0 +1,292 @@ +.container { + padding: 0; + font-size: 28rpx; + background-color: #f8f8f8; + min-height: 100vh; + border: none; +} + +/* 加载动画 */ +.loading-container { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100vh; +} + +.spinner { + margin: 0 auto; + width: 120rpx; + height: 120rpx; + position: relative; +} + +.spinner .spinner-container { + position: absolute; + width: 100%; + height: 100%; +} + +.container1 > view, .container2 > view, .container3 > view { + width: 20rpx; + height: 20rpx; + background-color: #1aad19; + border-radius: 100%; + position: absolute; + -webkit-animation: bouncedelay 1.2s infinite ease-in-out; + animation: bouncedelay 1.2s infinite ease-in-out; + -webkit-animation-fill-mode: both; + animation-fill-mode: both; +} + +.container2 { + -webkit-transform: rotateZ(45deg); + transform: rotateZ(45deg); +} + +.container3 { + -webkit-transform: rotateZ(90deg); + transform: rotateZ(90deg); +} + +.circle1 { top: 0; left: 0; } +.circle2 { top: 0; right: 0; } +.circle3 { right: 0; bottom: 0; } +.circle4 { left: 0; bottom: 0; } + +.container1 .circle1 { + -webkit-animation-delay: -1.1s; + animation-delay: -1.1s; +} +.container2 .circle1 { + -webkit-animation-delay: -1.0s; + animation-delay: -1.0s; +} +.container3 .circle1 { + -webkit-animation-delay: -0.9s; + animation-delay: -0.9s; +} + +.container1 .circle2 { + -webkit-animation-delay: -0.8s; + animation-delay: -0.8s; +} +.container2 .circle2 { + -webkit-animation-delay: -0.7s; + animation-delay: -0.7s; +} +.container3 .circle2 { + -webkit-animation-delay: -0.6s; + animation-delay: -0.6s; +} + +.container1 .circle3 { + -webkit-animation-delay: -0.5s; + animation-delay: -0.5s; +} +.container2 .circle3 { + -webkit-animation-delay: -0.4s; + animation-delay: -0.4s; +} +.container3 .circle3 { + -webkit-animation-delay: -0.3s; + animation-delay: -0.3s; +} + +.container1 .circle4 { + -webkit-animation-delay: -0.2s; + animation-delay: -0.2s; +} +.container2 .circle4 { + -webkit-animation-delay: -0.1s; + animation-delay: -0.1s; +} +.container3 .circle4 { + -webkit-animation-delay: 0s; + animation-delay: 0s; +} + +@-webkit-keyframes bouncedelay { + 0%, 80%, 100% { -webkit-transform: scale(0.0) } + 40% { -webkit-transform: scale(1.0) } +} + +@keyframes bouncedelay { + 0%, 80%, 100% { + transform: scale(0.0); + -webkit-transform: scale(0.0); + } 40% { + transform: scale(1.0); + -webkit-transform: scale(1.0); + } +} + +.loading-text { + margin-top: 30rpx; + color: #999; +} + +/* 内容区域 */ +.content { + padding: 30rpx; +} + +.header { + text-align: center; + margin-bottom: 60rpx; + padding-top: 40rpx; +} + +.title { + font-size: 48rpx; + font-weight: bold; + color: #333; +} + +.subtitle { + font-size: 28rpx; + color: #666; + margin-top: 10rpx; +} + +.user-info { + background-color: #fff; + border-radius: 12rpx; + padding: 0 30rpx; + margin-bottom: 30rpx; + box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05); +} + +.info-item { + display: flex; + justify-content: space-between; + padding: 20rpx 0; + border-bottom: 1rpx solid #f0f0f0; +} + +.info-item:last-child { + border-bottom: none; +} + +.label { + color: #666; +} + +.value { + color: #333; + font-weight: 500; +} + +.balance { + color: #1aad19; + font-weight: bold; + font-size: 32rpx; +} + +.wash-info { + background-color: #fff; + border-radius: 12rpx; + padding: 30rpx; + margin-bottom: 60rpx; + box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05); +} + +.wash-title { + font-size: 32rpx; + font-weight: bold; + color: #333; + margin-bottom: 20rpx; +} + +.wash-desc { + color: #666; +} + +.desc-item { + line-height: 1.8; + margin-bottom: 10rpx; +} + +.btn-area { + padding: 40rpx 60rpx; +} + +.confirm-btn { + width: 100%; + height: 88rpx; + line-height: 88rpx; + font-size: 32rpx; + border-radius: 44rpx; + background-color: #1aad19; +} + +/* 支付成功样式 */ +.success-content { + display: flex; + flex-direction: column; + align-items: center; + padding: 30rpx; +} + +.success-icon { + margin: 40rpx 0; +} + +.success-title { + font-size: 48rpx; + font-weight: bold; + color: #1aad19; + margin-bottom: 60rpx; +} + +.success-info { + width: 100%; + background-color: #fff; + border-radius: 12rpx; + padding: 0 30rpx; + margin-bottom: 30rpx; + box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05); +} + +.highlight { + color: #ff6600; + font-weight: bold; + font-size: 32rpx; +} + +.success-tips { + width: 100%; + background-color: #fff; + border-radius: 12rpx; + padding: 30rpx; + margin-bottom: 30rpx; + box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05); +} + +.tips-title { + font-size: 32rpx; + font-weight: bold; + color: #333; + margin-bottom: 20rpx; +} + +.tips-content { + color: #666; +} + +.tips-item { + line-height: 1.8; + margin-bottom: 10rpx; +} + +.back-btn { + width: 100%; + height: 88rpx; + line-height: 88rpx; + font-size: 32rpx; + border-radius: 44rpx; + background-color: #f8f8f8; + color: #333; + border: 1rpx solid #ddd; +} \ No newline at end of file diff --git a/pages/wangdian/wangdian.js b/pages/wangdian/wangdian.js index 34f74fe..3979f7d 100644 --- a/pages/wangdian/wangdian.js +++ b/pages/wangdian/wangdian.js @@ -100,7 +100,7 @@ Page({ }, // 获取网点详情信息 getBranchDetail() { - t.request('/miniprogram/branch/detail', { + t.request('/v2/miniprogram/branch/detail', { number: this.data.number, latitude: wx.getStorageSync('latitude'), longitude: wx.getStorageSync('longitude'), @@ -118,7 +118,7 @@ Page({ // 获取机器列表 getMachineList() { - t.request('/miniprogram/branch/machine', { + t.request('/v2/miniprogram/branch/machine', { number: this.data.number, }).then((res) => { if (res.code == 200) { diff --git a/project.private.config.json b/project.private.config.json index 16cd4f5..59e28f6 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -8,6 +8,20 @@ "condition": { "miniprogram": { "list": [ + { + "name": "pages/substituteWash/substituteWash", + "pathName": "pages/substituteWash/substituteWash", + "query": "scene=T1000098", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/substituteWash/substituteWash", + "pathName": "pages/substituteWash/substituteWash", + "query": "", + "launchMode": "default", + "scene": null + }, { "name": "pages/washing/washing", "pathName": "pages/washing/washing", @@ -53,5 +67,5 @@ ] } }, - "libVersion": "3.3.4" + "libVersion": "3.8.8" } \ No newline at end of file diff --git a/utils/login.js b/utils/login.js index 6fd6ada..08dd806 100644 --- a/utils/login.js +++ b/utils/login.js @@ -91,7 +91,7 @@ function n(a) { } function c(e, a) { - console.log("appstart", e), o = a, n("https://t-jm.v0750.com/miniprogram", { + console.log("appstart", e), o = a, n("https://t-jm.v0750.com/v2/miniprogram/index", { code: e }, !0).then(function (e) { var o = e.data;