fix: 更新API端点路径和单次洗车支付流程

- 将多个API端点从相对路径更新为完整URL
- 修改单次洗车配置和支付流程接口路径
- 更新listDetail页面时间字段显示为created_at
- 调整index页面单次洗车选项的显示和支付逻辑
- 添加单次洗车弹窗的样式定义
This commit is contained in:
2025-12-19 19:02:28 +08:00
parent d098203c87
commit b80b33c81f
13 changed files with 106 additions and 30 deletions

View File

@@ -236,9 +236,11 @@ Page({
var a = this;
if (a.data.oneTimeLoading) return !1;
a.setData({ oneTimeLoading: !0 });
t.request('/miniprogram/recharge/once', e.globalData.deviceData || {}, !0).then(function (res) {
// 获取单次洗车配置
t.request('/miniprogram/single/getAgentConfig', e.globalData.deviceData || {}, !0).then(function (res) {
a.setData({
oneTimeOptions: res.data && res.data.list ? res.data.list : (res.data || []),
oneTimeOptions: (res.data && Array.isArray(res.data)) ? res.data : (res.data && res.data.list ? res.data.list : []),
showOneTimeOptions: !0,
oneTimeLoading: !1
});
@@ -250,18 +252,18 @@ Page({
this.setData({ showOneTimeOptions: !1 });
},
payOneTime: function (evt) {
var a = this, i = evt.currentTarget.dataset.id;
var a = this, i = evt.currentTarget.dataset.token;
if (!i) return !1;
wx.showLoading({ title: "" });
t.request('/miniprogram/recharge/once/create', {
id: i,
devicecode: e.globalData.devicecode
t.request('/miniprogram/single/create', {
token: i
}, !0).then(function (res) {
if (wx.hideLoading(), 200 != res.code) return wx.showModal({
title: "提示",
content: res.message || ""
}), !1;
var r = res.data.result;
var orderid = res.data.orderid;
wx.requestPayment({
timeStamp: r.timeStamp,
nonceStr: r.nonceStr,
@@ -270,12 +272,34 @@ Page({
paySign: r.paySign,
success: function () {
a.setData({ showOneTimeOptions: !1 });
wx.showModal({
title: "提示",
content: "限单次洗车"
});
a.getData();
a.startup();
var poll = function () {
t.request('/miniprogram/single/notify', {
orderid: orderid
}, !0).then(function (res) {
if (200 == res.code) {
wx.showModal({
title: "提示",
content: "支付成功"
});
wx.navigateTo({
url: "/pages/voucher/voucher"
});
return;
}
}).catch(function (err) {
if (err && err.code == 202) {
setTimeout(poll, 1500);
return;
}
if (err && err.code == 201) {
wx.showModal({
title: "提示",
content: err.message || ""
});
}
});
};
poll();
}
});
}).catch(function () {