小程序端扫门禁码跳转;门禁端调整;bugfix小程序端商品售价和划线价反了
This commit is contained in:
@@ -46,10 +46,11 @@ Page({
|
||||
//判断用户是否是通过扫小程序码进来的
|
||||
if (options && options.scene) {
|
||||
// 扫门禁的小程序码
|
||||
if (options.scene.split('%')[0] == "guard") {
|
||||
options.scene = null
|
||||
let scene = options.scene
|
||||
if (scene.startsWith("guard%")) { // scene.split('%')[0] == "guard"
|
||||
options.scene = null // 清掉参数 避免重复触发
|
||||
wx.navigateTo({
|
||||
url: "/pages/scan/entrance"
|
||||
url: "/pages/scan/entrance?scene=" + scene
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1,11 +1,24 @@
|
||||
// pages/scan/entrance.js
|
||||
|
||||
const gateService = require("../../services/gate")
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
options: {},
|
||||
// 传入参数
|
||||
gateId: "",
|
||||
|
||||
// 接口返回数据
|
||||
gateDetail: "",
|
||||
|
||||
// UI显示用
|
||||
gateName: "未知",
|
||||
open: false,
|
||||
|
||||
currentTime: "",
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -13,9 +26,23 @@ Page({
|
||||
*/
|
||||
onLoad(options) {
|
||||
console.log(options)
|
||||
let scene = options.scene
|
||||
if (!scene) {
|
||||
wx.navigateBack()
|
||||
return
|
||||
}
|
||||
scene = decodeURIComponent(scene) // %26 == &
|
||||
if (scene.indexOf('&') == -1) {
|
||||
wx.navigateBack()
|
||||
return
|
||||
}
|
||||
|
||||
let gateId = scene.split('&')[1]
|
||||
this.setData({
|
||||
options: JSON.stringify(options),
|
||||
})
|
||||
gateId: gateId,
|
||||
});
|
||||
|
||||
this.loadPageData()
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -50,7 +77,7 @@ Page({
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
this.loadPageData()
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -65,5 +92,24 @@ Page({
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
},
|
||||
|
||||
|
||||
loadPageData() {
|
||||
let gateId = this.data.gateId;
|
||||
(async () => {
|
||||
let gateDetail = await gateService.getGateDetail(gateId)
|
||||
console.log("gateDetail", gateDetail)
|
||||
this.setData({
|
||||
gateDetail: JSON.stringify(gateDetail),
|
||||
gateName: gateDetail.name,
|
||||
open: gateDetail.open,
|
||||
currentTime: new Date(Date.now() + 8 * 3600 * 1000).toISOString().replace('T', ' ').substring(0, 19)
|
||||
});
|
||||
})();
|
||||
},
|
||||
|
||||
navigateBack: function () {
|
||||
wx.navigateBack()
|
||||
}
|
||||
})
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "进入社区"
|
||||
"navigationBarTitleText": "进入社区",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
@@ -1,5 +1,30 @@
|
||||
<!--pages/scan/entrance.wxml-->
|
||||
<view>
|
||||
您将要进入社区:未知
|
||||
{{ options }}
|
||||
<view style="text-align: center;">
|
||||
<view style="margin-top: 10vh;">
|
||||
<image src="../../image/icon/gate-background.svg" style="height: 40vh;"></image>
|
||||
</view>
|
||||
|
||||
<view style="margin-top: 2vh;">
|
||||
<text>您将要进入社区</text>
|
||||
</view>
|
||||
|
||||
<view style="margin-top: 10px;">
|
||||
<text style="font-size: 1.5em; font-weight: bold; color: {{ open ? '#0ee919' : 'red' }};">{{ gateName }}</text>
|
||||
</view>
|
||||
|
||||
<view style="margin-top: 2vh;">
|
||||
<view wx:if="{{ !open }}">当前大门暂不允许通行</view>
|
||||
<view>当前时间:{{ currentTime }}</view>
|
||||
</view>
|
||||
|
||||
<view class="btnView">
|
||||
<!--按钮-->
|
||||
<button disabled="{{ !open }}" class="btn" type="primary" bindtap="enterGate">确认进入</button>
|
||||
<button class="btn" type="warn" bindtap="navigateBack">不进入</button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view style="font-size: 0.6em; color: #c5c5c5; position: absolute; bottom: 16px; width: 100%; text-align: center;">
|
||||
大门id: {{ gateId }}
|
||||
</view>
|
||||
@@ -1 +1,8 @@
|
||||
/* pages/scan/entrance.wxss */
|
||||
/* pages/scan/entrance.wxss */
|
||||
.btnView {
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
<view class="good-wapper">
|
||||
<image class="good-image" src="{{goodinfo.picUrl}}" />
|
||||
<view class="good-detail">
|
||||
<view class="good-price good-price-counter">
|
||||
<!-- 原价 -->
|
||||
<view class="good-price-symbol">¥</view>
|
||||
<view class="good-price-number">{{ goodinfo.counterPrice }}</view>
|
||||
</view>
|
||||
<view class="good-price good-price-retail">
|
||||
<!-- 售价 -->
|
||||
<view style="height:0.12em;" class="good-price-line"></view>
|
||||
<view class="good-price-symbol">¥</view>
|
||||
<view class="good-price-number">{{ goodinfo.retailPrice }}</view>
|
||||
</view>
|
||||
<view class="good-price good-price-counter">
|
||||
<!-- 原价 -->
|
||||
<view style="height:0.12em;" class="good-price-line"></view>
|
||||
<view class="good-price-symbol">¥</view>
|
||||
<view class="good-price-number">{{ goodinfo.counterPrice }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 商品标题 -->
|
||||
<view class="good-title line-wrap">
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.good-price-counter {
|
||||
.good-price-retail {
|
||||
color: #fa4126;
|
||||
font-size: 72rpx;
|
||||
}
|
||||
|
||||
.good-price-retail {
|
||||
.good-price-counter {
|
||||
color: #bbbbbb;
|
||||
font-size: 32rpx;
|
||||
margin: 0 0 0 18rpx;
|
||||
|
||||
Reference in New Issue
Block a user