Skip to content

Commit

Permalink
增加在线排队取号功能
Browse files Browse the repository at this point in the history
  • Loading branch information
woniudiancang committed Oct 5, 2020
1 parent 5e6f236 commit 3497f65
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
|<img src="https://dcdn.it120.cc/2020/08/13/e063c311-7493-46b0-b258-fae298b452a3.png" width="200px">|<img src="https://dcdn.it120.cc/2020/08/13/ab2f640d-9b0e-41d4-b41e-0605f4df0d7e.png" width="200px">|<img src="https://dcdn.it120.cc/2020/08/13/70f9c64e-0c8d-4f35-b50d-0af7f48e2e23.png" width="200px">|<img src="https://dcdn.it120.cc/2020/08/13/39e981cf-cf7e-42f8-9513-9f496f008a03.png" width="200px">

## 其他
| 在线订位 |
| :------: |
| <img src="https://dcdn.it120.cc/2020/08/10/0f7e8d16-d05d-40dd-82e0-b4faedf01520.png" width="200px">
| 在线订位 | 在线取号 |
| :------: | :------: |
| <img src="https://dcdn.it120.cc/2020/08/10/0f7e8d16-d05d-40dd-82e0-b4faedf01520.png" width="200px"> | <img src="https://dcdn.it120.cc/2020/10/05/542ac4b7-e49b-4225-8ee0-b99474082924.png" width="190px">

# QQ交流群

Expand Down
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ App({
}
}
// 自动登录
AUTH.checkHasLogined().then(async isLogined => {
AUTH.checkHasLogined().then(isLogined => {
if (!isLogined) {
AUTH.login()
}
Expand Down
9 changes: 8 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"pages/asset/cash-log",
"pages/sign/index",
"pages/score/logs",
"pages/notice/detail"
"pages/notice/detail",
"pages/queue/index"
],
"window": {
"backgroundTextStyle": "light",
Expand All @@ -39,6 +40,12 @@
"selectedIconPath": "images/nav/index-on.png",
"text": "点餐"
},
{
"pagePath": "pages/queue/index",
"iconPath": "images/nav/qh-off.png",
"selectedIconPath": "images/nav/qh-on.png",
"text": "取号"
},
{
"pagePath": "pages/order-details/doing",
"iconPath": "images/nav/qc-off.png",
Expand Down
4 changes: 2 additions & 2 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
version: "2.10.0",
note: '增加可选配件功能支持',
version: "2.11.0",
note: '增加在线排队取号功能',
subDomain: "beeorder", // 根据教程 https://www.it120.cc/help/qr6l4m.html 查看并设置你自己的 subDomain
}
Binary file added images/nav/qh-off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/nav/qh-on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 88 additions & 0 deletions pages/queue/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
const WXAPI = require('apifm-wxapi')
const AUTH = require('../../utils/auth')
const APP = getApp()
APP.configLoadOK = () => {

}
Page({
data: {

},
onLoad: function (options) {

},
onShow: function () {
this.queuingTypes()
this.queuingMy()
},
async queuingTypes() {
wx.showLoading({
title: '',
})
const res = await WXAPI.queuingTypes()
wx.hideLoading({
success: (res) => {},
})
if (res.code == 0) {
this.setData({
list: res.data
})
}
},
async queuingMy() {
const res = await WXAPI.queuingMy(wx.getStorageSync('token'))
if (res.code == 0) {
const mylist = []
res.data.forEach(ele => {
const queuingLog = ele.queuingLog
const queuingUpType = ele.queuingUpType
const waitMinitus = (queuingLog.number - queuingUpType.curNumber -1) * queuingUpType.minitus
if (waitMinitus) {
queuingLog.waitMinitus = waitMinitus
}
queuingLog.typeEntity = queuingUpType
mylist.push(queuingLog)
})
this.setData({
mylist
})
}
},
async queuingGet(e) {
const index = e.currentTarget.dataset.index
const queueType = this.data.list[index]
const isLogined = await AUTH.checkHasLogined()
if (!isLogined) {
AUTH.openLoginDialog()
return
}
wx.showLoading({
title: '',
})
const res = await WXAPI.queuingGet(wx.getStorageSync('token'), queueType.id)
wx.hideLoading({
success: (res) => {},
})
if (res.code != 0) {
wx.showToast({
title: res.msg,
icon: 'none'
})
} else {
wx.showToast({
title: '取号成功'
})
this.queuingMy()
}
},
processLogin(e) {
if (!e.detail.userInfo) {
wx.showToast({
title: '已取消',
icon: 'none',
})
return;
}
AUTH.register(this);
},
})
3 changes: 3 additions & 0 deletions pages/queue/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"navigationBarTitleText": "排队取号"
}
14 changes: 14 additions & 0 deletions pages/queue/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<van-empty wx:if="{{!list}}" description="暂无队列" />
<van-dialog id="van-dialog-auth-login" bind:getuserinfo="processLogin" />
<view class="btn-groups">
<van-button custom-class="btn" wx:for="{{list}}" wx:key="id" type="primary" block bind:click="queuingGet" data-index="{{ index }}">{{ item.name }} (共 {{item.numberGet}} 号,当前第 {{item.curNumber}} 号)</van-button>
</view>
<van-cell-group wx:if="{{ mylist }}" title="我的号子">
<van-cell
value-class="cell-red"
wx:for="{{mylist}}" wx:key="id"
title="{{ item.typeEntity.name }}"
label="{{ item.statusStr }} {{ item.waitMinitus ? '预计等待: ' + item.waitMinitus + '分钟' : '' }}"
value="{{ item.number }}号"
/>
</van-cell-group>
12 changes: 12 additions & 0 deletions pages/queue/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.btn-groups {
padding-top: 168rpx;
padding-bottom: 64rpx;
width: 600rpx;
margin: auto;
}
.btn-groups .btn {
margin: 32rpx 0;
}
.cell-red {
color: #e64340 !important;
}

0 comments on commit 3497f65

Please sign in to comment.