feat(帮洗服务): 新增帮洗服务页面及功能

新增帮洗服务相关页面和功能,包括页面配置、路由添加、API接口调整和样式实现
更新小程序基础库版本至3.8.8
调整API接口路径统一使用v2版本前缀
This commit is contained in:
XiaoMo 2025-06-24 16:56:02 +08:00
parent 336227c4dc
commit a3fcf0eac1
10 changed files with 632 additions and 9 deletions

2
app.js
View File

@ -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);

View File

@ -26,6 +26,7 @@
"pages/duiquan/duiquan",
"pages/refund/refund",
"pages/washing/washing",
"pages/substituteWash/substituteWash",
"pages/OnlineCarHailing/OnlineCarHailing"
],
"window": {

View File

@ -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 || [],
});

View File

@ -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'
});
}
})

View File

@ -0,0 +1,8 @@
{
"navigationBarTitleText": "帮洗服务",
"enablePullDownRefresh": true,
"backgroundColor": "#f8f8f8",
"usingComponents": {
"service-tel": "/template/serviceTel/serviceTel"
}
}

View File

@ -0,0 +1,109 @@
<view class="container">
<!-- 加载中 -->
<view class="loading-container" wx:if="{{loading}}">
<view class="spinner">
<view class="spinner-container container1">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
<view class="spinner-container container2">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
<view class="spinner-container container3">
<view class="circle1"></view>
<view class="circle2"></view>
<view class="circle3"></view>
<view class="circle4"></view>
</view>
</view>
<view class="loading-text">加载中...</view>
</view>
<!-- 内容区域 -->
<view class="content" wx:else>
<!-- 支付成功界面 -->
<view class="success-content" wx:if="{{paySuccess}}">
<view class="success-icon">
<icon type="success" size="80"></icon>
</view>
<view class="success-title">支付成功</view>
<view class="success-info">
<view class="info-item">
<text class="label">洗车网点</text>
<text class="value">{{orderInfo.agentname || userInfo.nickname || '---'}}</text>
</view>
<view class="info-item">
<text class="label">订单编号</text>
<text class="value">{{orderInfo.orderNo || '---'}}</text>
</view>
<view class="info-item">
<text class="label">支付金额</text>
<text class="value highlight">{{orderInfo.amount || '0'}} 元</text>
</view>
<view class="info-item">
<text class="label">账户余额</text>
<text class="value balance">{{balance}} 元</text>
</view>
</view>
<view class="success-tips">
<view class="tips-title">温馨提示</view>
<view class="tips-content">
<view class="tips-item">1. 请向工作人员出示此页面</view>
<view class="tips-item">2. 确认支付成功后即可开始洗车服务</view>
<view class="tips-item">3. 如有疑问请联系客服</view>
</view>
</view>
<view class="btn-area">
<button class="back-btn" type="default" bindtap="backToIndex">返回首页</button>
</view>
</view>
<!-- 确认洗车界面 -->
<view class="confirm-content" wx:else>
<view class="header">
<view class="title">帮洗服务</view>
<view class="subtitle">让洗车更便捷</view>
</view>
<view class="user-info">
<view class="info-item">
<text class="label">洗车网点</text>
<text class="value">{{orderInfo.agentname || userInfo.nickname || '---'}}</text>
</view>
<view class="info-item">
<text class="label">洗车费用</text>
<text class="value">{{orderInfo.amount || '0'}} 元</text>
</view>
<view class="info-item">
<text class="label">账户余额</text>
<text class="value balance">{{balance}} 元</text>
</view>
</view>
<view class="wash-info">
<view class="wash-title">服务说明</view>
<view class="wash-desc">
<view class="desc-item">1. 帮洗服务由专业人员提供</view>
<view class="desc-item">2. 确认后将从您的账户余额中扣除相应费用</view>
<view class="desc-item">3. 服务完成后可在订单中查看详情</view>
</view>
</view>
<view class="btn-area">
<button class="confirm-btn" type="primary" bindtap="confirmWash">确认洗车</button>
</view>
</view>
</view>
<!-- 客服电话组件 -->
<service-tel></service-tel>
</view>

View File

@ -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;
}

View File

@ -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) {

View File

@ -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"
}

View File

@ -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;