0000
This commit is contained in:
130
pages/washCodeList/washCodeList.js
Normal file
130
pages/washCodeList/washCodeList.js
Normal file
@@ -0,0 +1,130 @@
|
||||
var t = getApp(), e = require("../../utils/login.js"), a = require("../../utils/common.js");
|
||||
|
||||
Page({
|
||||
data: {
|
||||
showLoding: !0,
|
||||
list: [],
|
||||
user: {},
|
||||
loading: !1,
|
||||
selectIndex: null,
|
||||
selectID: null,
|
||||
isScan: !1
|
||||
},
|
||||
onLoad: function(a) {
|
||||
var i = this;
|
||||
e.pageStart(t).then(function(e) {
|
||||
i.getList(), console.log("app.globalData.devicecode", t.globalData.user.money, t.globalData.devicecode),
|
||||
i.setData({
|
||||
isScan: !!t.globalData.devicecode
|
||||
});
|
||||
});
|
||||
},
|
||||
onShow: function() {
|
||||
this.isneedUpload && (this.getList(), this.isneedUpload = !1);
|
||||
},
|
||||
onPullDownRefresh: function() {},
|
||||
onShareAppMessage: function() {},
|
||||
toPage: function(t) {
|
||||
var e = t.currentTarget.dataset.url;
|
||||
e ? wx.navigateTo({
|
||||
url: "/pages/".concat(e)
|
||||
}) : wx.showToast({
|
||||
title: "页面开发中~",
|
||||
icon: "none",
|
||||
duration: 2e3
|
||||
});
|
||||
},
|
||||
selectItem: function(t) {
|
||||
var e = t.currentTarget.dataset, a = (e.index, e.code);
|
||||
if (1 != e.available) return wx.showToast({
|
||||
title: "该洗车券不可用~",
|
||||
icon: "none"
|
||||
}), !1;
|
||||
this.setData({
|
||||
selectID: this.data.selectID == a ? null : a
|
||||
});
|
||||
},
|
||||
isloading: !1,
|
||||
getList: function(i) {
|
||||
var o = this;
|
||||
if (this.isloading) return !1;
|
||||
wx.showLoading(), this.setData({
|
||||
loading: !0
|
||||
}), this.isloading = !0, e.request(t.globalData.config.carwashcoupon.lists, {}, !0).then(function(t) {
|
||||
if (o.isloading = !1, o.setData({
|
||||
loading: !1
|
||||
}), wx.hideLoading(), 200 != t.code) return wx.showModal({
|
||||
title: "提示",
|
||||
content: t.message
|
||||
}), !1;
|
||||
t.data.list.map(function(t) {
|
||||
t.starttime = a.changeTimeyear(new Date(1e3 * t.starttime)), t.deadline = a.changeTimeyear(new Date(1e3 * t.deadline));
|
||||
}), o.setData({
|
||||
list: t.data.list,
|
||||
user: t.data.user,
|
||||
showLoding: !1
|
||||
});
|
||||
}).catch(function(t) {
|
||||
o.isloading = !1, o.setData({
|
||||
loading: !1
|
||||
}), wx.hideLoading();
|
||||
});
|
||||
},
|
||||
toScan: function() {
|
||||
var a = this;
|
||||
if (this.isSubmit) return !1;
|
||||
wx.scanCode({
|
||||
success: function(i) {
|
||||
wx.showLoading({
|
||||
title: ""
|
||||
}), t.globalData.qrcode = i.result, e.request("https://jmqf.v0750.com/miniprogram/identify", i, !0).then(function(e) {
|
||||
if (wx.hideLoading(), 200 != e.code) return wx.showModal({
|
||||
title: "提示",
|
||||
content: e.message
|
||||
}), !1;
|
||||
t.globalData.devicecode = e.data.devicecode || t.globalData.devicecode, a.setData({
|
||||
isScan: !!e.data.devicecode
|
||||
}), a.getList();
|
||||
}).catch(function(t) {
|
||||
wx.hideLoading(), a.isSubmit = !1;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
isSubmit: !1,
|
||||
isneedUpload: !1,
|
||||
isshowModal: !1,
|
||||
toStart: function() {
|
||||
var t = this;
|
||||
return console.log("this.isSubmit", this.isSubmit), !this.isSubmit && (0 == this.data.list.length ? (wx.showModal({
|
||||
title: "提示",
|
||||
content: "暂无可用洗车券~"
|
||||
}), !1) : t.data.selectID ? void this.startup() : (wx.showModal({
|
||||
title: "提示",
|
||||
content: "请选择洗车券"
|
||||
}), !1));
|
||||
},
|
||||
startup: function() {
|
||||
var a = this;
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "你当前将要使用的机器编号是:".concat(t.globalData.devicecode, ",确认开机吗?"),
|
||||
success: function(i) {
|
||||
i.confirm && (a.isSubmit = !0, wx.showLoading({
|
||||
title: "正在启动"
|
||||
}), e.request(t.globalData.config.machine.carwashcodestartup, {
|
||||
washcode: a.data.selectID
|
||||
}, !0).then(function(t) {
|
||||
a.isSubmit = !1, wx.hideLoading(), 200 == t.code && wx.redirectTo({
|
||||
url: "/pages/user/user"
|
||||
});
|
||||
}).catch(function(t) {
|
||||
a.isSubmit = !1, wx.hideLoading();
|
||||
}));
|
||||
},
|
||||
fail: function(t) {
|
||||
console.log("fail:", t);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
8
pages/washCodeList/washCodeList.json
Normal file
8
pages/washCodeList/washCodeList.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"navigationBarTitleText": "聚美汽服",
|
||||
"usingComponents": {
|
||||
"service-tel": "../../template/serviceTel/serviceTel",
|
||||
"my-money": "../../template/myMoney/myMoney",
|
||||
"page-loding": "../../template/pageLoding/pageLoding"
|
||||
}
|
||||
}
|
||||
21
pages/washCodeList/washCodeList.wxml
Normal file
21
pages/washCodeList/washCodeList.wxml
Normal file
@@ -0,0 +1,21 @@
|
||||
<view class="container">
|
||||
<page-loding wx:if="{{showLoding}}"></page-loding>
|
||||
<view class="title-tip" wx:if="{{list.length>0}}">请选择洗车券</view>
|
||||
<view class="list">
|
||||
<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>
|
||||
<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>
|
||||
<view class="indate">有效期:{{item.starttime}} - {{item.deadline}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="no-content" wx:if="{{list.length==0&&!loading}}">
|
||||
<image src="/img/nocontent.png"></image>
|
||||
<view>暂无洗车券</view>
|
||||
</view>
|
||||
<view bindtap="toScan" class="scan-btn" wx:if="{{!isScan}}">扫码启动</view>
|
||||
<view bindtap="toStart" class="{{list.length>0?'scan-btn':'scan-btn scan-btn-unavailable'}}" wx:if="{{isScan}}">立即启动</view>
|
||||
</view>
|
||||
165
pages/washCodeList/washCodeList.wxss
Normal file
165
pages/washCodeList/washCodeList.wxss
Normal file
@@ -0,0 +1,165 @@
|
||||
.container {
|
||||
background: #fafafa;
|
||||
box-sizing: border-box;
|
||||
min-height: 100vh;
|
||||
padding: 0 27rpx 140rpx;
|
||||
}
|
||||
|
||||
.form-box {
|
||||
background: #fff;
|
||||
height: 294rpx;
|
||||
margin: 0 27rpx;
|
||||
}
|
||||
|
||||
.form-box .title {
|
||||
border-bottom: 1px solid #eee;
|
||||
color: #666;
|
||||
font-size: 26rpx;
|
||||
padding: 18rpx 24rpx 30rpx;
|
||||
}
|
||||
|
||||
.input-box {
|
||||
background: #eee;
|
||||
border-radius: 9rpx;
|
||||
height: 90rpx;
|
||||
margin: 60rpx 30rpx 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.input-box input {
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
font-size: 32rpx;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
padding: 0 28rpx;
|
||||
width: calc(100% - 97rpx);
|
||||
}
|
||||
|
||||
.placeholder {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.input-box .btn {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
height: 90rpx;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
width: 97rpx;
|
||||
}
|
||||
|
||||
.input-box .btn image {
|
||||
height: 43rpx;
|
||||
width: 45rpx;
|
||||
}
|
||||
|
||||
.title-tip {
|
||||
border-bottom: 1px solid #f2f2f2;
|
||||
color: #666;
|
||||
font-size: 26rpx;
|
||||
line-height: 80rpx;
|
||||
padding-left: 14rpx;
|
||||
}
|
||||
|
||||
.list {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.item {
|
||||
border-radius: 18rpx;
|
||||
box-shadow: 0 0rpx 9rpx 4rpx hsla(0,0%,80%,.75);
|
||||
padding: 14rpx 20rpx 14rpx 14rpx;
|
||||
}
|
||||
|
||||
.item .top {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.item .l {
|
||||
align-items: flex-end;
|
||||
color: #666;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.item .index,.item .l {
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
.item .index {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.item .code {
|
||||
color: #333;
|
||||
display: inline-flex;
|
||||
font-size: 33rpx;
|
||||
line-height: 44rpx;
|
||||
}
|
||||
|
||||
.item .indate {
|
||||
color: #999;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.item .r {
|
||||
display: inline-flex;
|
||||
padding: 14rpx;
|
||||
}
|
||||
|
||||
.item .radio {
|
||||
border: 5rpx solid #666;
|
||||
border-radius: 50%;
|
||||
display: block;
|
||||
height: 31rpx;
|
||||
margin-right: 10rpx;
|
||||
width: 31rpx;
|
||||
}
|
||||
|
||||
.item.active {
|
||||
box-shadow: 0 0rpx 9rpx 4rpx rgba(255,102,0,.4);
|
||||
}
|
||||
|
||||
.item.active .code {
|
||||
color: #f60;
|
||||
}
|
||||
|
||||
.item.active .radio {
|
||||
border-color: #f60;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.item.active .radio::after {
|
||||
background: #f60;
|
||||
border-radius: 50%;
|
||||
content: "";
|
||||
display: block;
|
||||
height: 15rpx;
|
||||
left: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translate(-50%,-50%);
|
||||
width: 15rpx;
|
||||
}
|
||||
|
||||
.item.item-notavailable .code {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.item .location {
|
||||
color: #666;
|
||||
font-size: 22rpx;
|
||||
line-height: 33rpx;
|
||||
margin: 10rpx 0 2rpx;
|
||||
}
|
||||
|
||||
.item.item-notavailable .location {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.scan-btn-unavailable {
|
||||
opacity: .5;
|
||||
}
|
||||
Reference in New Issue
Block a user