@@ -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: "该洗车券不可用~",
|
||||
@@ -77,11 +86,12 @@ Page({
|
||||
success: function (i) {
|
||||
wx.showLoading({
|
||||
title: ""
|
||||
}), t.globalData.qrcode = i.result, e.request("/miniprogram/identify", i, !0).then(function (e) {
|
||||
}), t.globalData.qrcode = i.result, e.request("/miniprogram/identify/index", i, !0).then(function (e) {
|
||||
if (wx.hideLoading(), 200 != e.code) return wx.showModal({
|
||||
title: "提示",
|
||||
content: e.message
|
||||
}), !1;
|
||||
t.globalData.deviceData = e.data || t.globalData.deviceData || {};
|
||||
t.globalData.devicecode = e.data.devicecode || t.globalData.devicecode, a.setData({
|
||||
isScan: !!e.data.devicecode
|
||||
}), a.getList();
|
||||
@@ -108,15 +118,22 @@ Page({
|
||||
var a = this;
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "你当前将要使用的机器编号是:".concat(t.globalData.devicecode, ",确认开机吗?"),
|
||||
content: "你当前将要使用的机器编号是:".concat(t.globalData.deviceData.title || t.globalData.deviceData.devicecode, ",确认开机吗?"),
|
||||
success: function (i) {
|
||||
|
||||
// 合并参数 t.globalData.deviceData 与 washcode
|
||||
let params = Object.assign(t.globalData.deviceData, {
|
||||
washcode: a.data.selectID
|
||||
});
|
||||
|
||||
i.confirm && (a.isSubmit = !0, wx.showLoading({
|
||||
title: "正在启动"
|
||||
}), e.request('/miniprogram/machine/carwashcodestartup', {
|
||||
washcode: a.data.selectID
|
||||
}, !0).then(function (t) {
|
||||
}), e.request('/miniprogram/' + t.globalData.deviceData.type + '/carwashcodestartup', params, !0).then(function (t) {
|
||||
// 成功后返回提示
|
||||
wx.showToast({ title: t.message || '启动成功', icon: 'success' });
|
||||
// 成功后跳转
|
||||
a.isSubmit = !1, wx.hideLoading(), 200 == t.code && wx.redirectTo({
|
||||
url: "/pages/user/user"
|
||||
url: "/pages/washing/washing"
|
||||
});
|
||||
}).catch(function (t) {
|
||||
a.isSubmit = !1, wx.hideLoading();
|
||||
|
||||
@@ -5,11 +5,15 @@
|
||||
<view bindtap="selectItem" class="{{item.available!=1?'item item-notavailable':selectID==item.code?'active item':'item'}}" data-available="{{item.available}}" data-code="{{item.code}}" wx:for="{{list}}" wx:key="index">
|
||||
<view class="top">
|
||||
<view class="radio"></view>
|
||||
<view class="code">{{item.code}}</view>
|
||||
<view class="code">{{item.title}}</view>
|
||||
</view>
|
||||
<view class="location">可使用网点:<block wx:for="{{item.agent}}" wx:for-index="i" wx:for-item="s">{{s.t_name+(i<item.agent.length-1?'、':'')}} </block>
|
||||
<view class="location">可使用网点:<block wx:for="{{item.agent}}" wx:for-index="i" wx:for-item="s">{{s.t_name}}{{ i< item.agent.length-1?'、':''}}</block>
|
||||
<block wx:if="{{item.agent.length==0}}">不限</block>
|
||||
</view>
|
||||
<view class="indate">有效期:{{item.starttime}} - {{item.deadline}}</view>
|
||||
<view class="indate">兑换时间:{{item.created_at}}, 兑换码: {{item.code}}</view>
|
||||
<!-- 如果有note -->
|
||||
<view class="indate" wx:if="{{item.note}}">{{item.note}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="no-content" wx:if="{{list.length==0&&!loading}}">
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
border-radius: 18rpx;
|
||||
box-shadow: 0 0rpx 9rpx 4rpx hsla(0,0%,80%,.75);
|
||||
padding: 14rpx 20rpx 14rpx 14rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.item .top {
|
||||
|
||||
Reference in New Issue
Block a user