小程序端扫门禁码跳转;门禁端调整;bugfix小程序端商品售价和划线价反了
This commit is contained in:
1
weixin-miniprogram/image/icon/gate-background.svg
Normal file
1
weixin-miniprogram/image/icon/gate-background.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M768 149.333333a21.333333 21.333333 0 0 1 21.333333-21.333333h64v-21.333333a21.333333 21.333333 0 0 1 42.666667 0v21.333333h64a21.333333 21.333333 0 0 1 0 42.666667h-170.666667a21.333333 21.333333 0 0 1-21.333333-21.333334zM64 170.666667h170.666667a21.333333 21.333333 0 0 0 0-42.666667h-64v-21.333333a21.333333 21.333333 0 0 0-42.666667 0v21.333333H64a21.333333 21.333333 0 0 0 0 42.666667z m917.333333 64v640a21.333333 21.333333 0 0 1-21.333333 21.333333h-170.666667a21.333333 21.333333 0 0 1-21.333333-21.333333v-21.333334H256v21.333334a21.333333 21.333333 0 0 1-21.333333 21.333333H64a21.333333 21.333333 0 0 1-21.333333-21.333333V234.666667a21.333333 21.333333 0 0 1 21.333333-21.333334h170.666667a21.333333 21.333333 0 0 1 21.333333 21.333334v106.666666h42.666667v-64a21.333333 21.333333 0 0 1 42.666666 0v490.666667h85.333334V597.333333h-21.333334a21.333333 21.333333 0 0 1-21.333333-21.333333V490.666667a21.333333 21.333333 0 0 1 21.333333-21.333334h21.333334V384h-21.333334a21.333333 21.333333 0 0 1 0-42.666667h21.333334V192a21.333333 21.333333 0 0 1 42.666666 0v149.333333h85.333334V192a21.333333 21.333333 0 0 1 42.666666 0v149.333333h85.333334v-64a21.333333 21.333333 0 0 1 42.666666 0v64h42.666667V234.666667a21.333333 21.333333 0 0 1 21.333333-21.333334h170.666667a21.333333 21.333333 0 0 1 21.333333 21.333334zM298.666667 384h-42.666667v384h42.666667z m256 213.333333H469.333333v170.666667h85.333334z m0-213.333333H469.333333v85.333333h85.333334z m128 0H597.333333v85.333333h21.333334a21.333333 21.333333 0 0 1 21.333333 21.333334v85.333333a21.333333 21.333333 0 0 1-21.333333 21.333333h-21.333334v170.666667h42.666667v42.666667h42.666667z m85.333333 0h-42.666667v384h42.666667z" fill="#5C5C66"></path></svg>
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
@@ -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;
|
||||
|
||||
15
weixin-miniprogram/services/gate.js
Normal file
15
weixin-miniprogram/services/gate.js
Normal file
@@ -0,0 +1,15 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
|
||||
const send_request = require('../utils/sendRequest')
|
||||
|
||||
/** 获取门禁详情 */
|
||||
export function getGateDetail(id) {
|
||||
console.log("gateId", id)
|
||||
return send_request({
|
||||
url: '/access/gate/miniprogram/detail',
|
||||
method: "GET",
|
||||
data: {
|
||||
id: id,
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -1,19 +1,21 @@
|
||||
function scanQRCode(Taro) {
|
||||
function scanQRCode(wx) {
|
||||
// 只允许从相机扫码
|
||||
Taro.scanCode({
|
||||
wx.scanCode({
|
||||
onlyFromCamera: true,
|
||||
success(res) {
|
||||
console.log(res)
|
||||
if (res.scanType == "WX_CODE" && res.path) {
|
||||
let searchParams = res.path.split('?');
|
||||
if (searchParams.length > 1 && searchParams[1].startsWith('scene=guard')) {
|
||||
Taro.navigateTo({
|
||||
url: "/pages/scan/entrance"
|
||||
// let scene = searchParams[1].substring(searchParams[1].indexOf('='))
|
||||
console.log("searchParams", searchParams)
|
||||
wx.navigateTo({
|
||||
url: "/pages/scan/entrance?" + searchParams[1]
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
Taro.showToast({
|
||||
wx.showToast({
|
||||
title: "您扫描的不是门禁码",
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
|
||||
Reference in New Issue
Block a user