mirror of
https://github.com/sunniejs/vue-h5-template.git
synced 2025-04-27 03:58:57 +08:00
二维码入场券
This commit is contained in:
parent
652e4001a0
commit
026e1a0767
@ -70,3 +70,16 @@ export function bindPhoneNumber(params) {
|
|||||||
data: qs.stringify(_bale('addPhoneNumber', params))
|
data: qs.stringify(_bale('addPhoneNumber', params))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取门禁二维码值
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export function getDoorKey(params) {
|
||||||
|
return request({
|
||||||
|
url: '/user/getDoorKey',
|
||||||
|
method: 'post',
|
||||||
|
data: qs.stringify(_bale('getDoorKey', params))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ export default {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-top: 55px;
|
margin-top: 55px;
|
||||||
|
|
||||||
.empty-tips {
|
.empty-tips {
|
||||||
color: #999999;
|
color: #999999;
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
{{title}}
|
{{title}}
|
||||||
</div>
|
</div>
|
||||||
<div class="qrcode-bottom">
|
<div class="qrcode-bottom">
|
||||||
<img class="qrcode-img" :src="src" alt="">
|
<qrcode :value="src" tag="img" :options="{ width: 145,margin:0 }"></qrcode>
|
||||||
<div class="qrcode-tips" v-html="tips">
|
<div class="qrcode-tips" v-html="tips">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -21,13 +21,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import VueQrcode from '@chenfengyuan/vue-qrcode'
|
||||||
import { Popup, Toast } from 'vant'
|
import { Popup, Toast } from 'vant'
|
||||||
import * as Validate from '@/utils/validate'
|
import * as Validate from '@/utils/validate'
|
||||||
import { bindPhoneNumber, sendCode } from '@/api/user'
|
import { bindPhoneNumber, sendCode } from '@/api/user'
|
||||||
export default {
|
export default {
|
||||||
name: 'QrCodePopup',
|
name: 'QrCodePopup',
|
||||||
components: {
|
components: {
|
||||||
'van-popup': Popup
|
'van-popup': Popup,
|
||||||
|
'qrcode': VueQrcode
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
visible: {
|
visible: {
|
||||||
@ -116,10 +118,6 @@ export default {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 25px 0 41px 0;
|
padding: 25px 0 41px 0;
|
||||||
.qrcode-img {
|
|
||||||
height: 190px;
|
|
||||||
width: 190px;
|
|
||||||
}
|
|
||||||
.qrcode-tips {
|
.qrcode-tips {
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: #666666;
|
color: #666666;
|
||||||
|
@ -3,6 +3,7 @@ import store from './store'
|
|||||||
import getPageTitle from '@/utils/get-page-title'
|
import getPageTitle from '@/utils/get-page-title'
|
||||||
import wechatAuth from './plugins/wechatAuth' // 微信登录插件
|
import wechatAuth from './plugins/wechatAuth' // 微信登录插件
|
||||||
const qs = require('qs')
|
const qs = require('qs')
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
const loginStatus = Number(store.getters.loginStatus)
|
const loginStatus = Number(store.getters.loginStatus)
|
||||||
document.title = getPageTitle(to.meta.title)
|
document.title = getPageTitle(to.meta.title)
|
||||||
@ -55,7 +56,6 @@ router.beforeEach((to, from, next) => {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// alert(to.fullPath)
|
// alert(to.fullPath)
|
||||||
|
|
||||||
next()
|
next()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -16,6 +16,7 @@ export const constantRoutes = [
|
|||||||
keepAlive: false
|
keepAlive: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/coupon',
|
path: '/coupon',
|
||||||
name: 'coupon',
|
name: 'coupon',
|
||||||
|
@ -35,7 +35,6 @@ service.interceptors.response.use(
|
|||||||
response => {
|
response => {
|
||||||
Toast.clear()
|
Toast.clear()
|
||||||
const res = response.data
|
const res = response.data
|
||||||
|
|
||||||
if (res.status && res.status !== 200) {
|
if (res.status && res.status !== 200) {
|
||||||
Toast({
|
Toast({
|
||||||
message: res.info
|
message: res.info
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
<div class="user-name">{{ vipInfo.nickName|formatName }}<span class="user-level"></span></div>
|
<div class="user-name">{{ vipInfo.nickName|formatName }}<span class="user-level"></span></div>
|
||||||
<div class="user-code">代购编号:{{ vipInfo.userCode }}</div>
|
<div class="user-code">代购编号:{{ vipInfo.userCode }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="qrcode-warp" @click="showUserQrcode($event)">
|
<div class="qrcode-warp" @click="showUserQrcode()">
|
||||||
<qrcode v-if="vipInfo.userPhone!==''" :value="vipInfo.userPhone" tag="img" :options="{ width: 145,margin:0 }"></qrcode>
|
<qrcode v-if="vipInfo.userPhone!==''" :value="vipInfo.userPhone" tag="img" :options="{ width: 45,margin:0 }"></qrcode>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="account-info">
|
<div class="account-info">
|
||||||
@ -27,7 +27,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<van-cell-group>
|
<van-cell-group>
|
||||||
<van-cell is-link>
|
<van-cell is-link @click="doorAccessKey">
|
||||||
<div slot="title" class="account-cell">
|
<div slot="title" class="account-cell">
|
||||||
<span class="icon-ticket"></span>
|
<span class="icon-ticket"></span>
|
||||||
<span class="custom-text">我的入场券 </span>
|
<span class="custom-text">我的入场券 </span>
|
||||||
@ -42,9 +42,10 @@
|
|||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
</div>
|
</div>
|
||||||
<!-- 绑定手机 -->
|
<!-- 绑定手机 -->
|
||||||
<msg-code :visible="codeVisible" @close="()=>{ codeVisible = false }"></msg-code>
|
<msg-code :visible="codeVisible" @close="closeCodePop"></msg-code>
|
||||||
<!-- 二维码 -->
|
<!-- 二维码 -->
|
||||||
<qrcode-popup :visible="qrcodeVisible" :src="qrSrc" :title="qrTitle" :tips="qrTips" @close="()=>{ qrcodeVisible = false }">
|
<qrcode-popup :visible="qrcodeVisible" :src="qrSrc" :title="qrTitle" :tips="qrTips" @close="()=>{ qrcodeVisible = false }">
|
||||||
|
|
||||||
</qrcode-popup>
|
</qrcode-popup>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -53,7 +54,7 @@ import VueQrcode from '@chenfengyuan/vue-qrcode'
|
|||||||
import { Cell, CellGroup } from 'vant'
|
import { Cell, CellGroup } from 'vant'
|
||||||
import VerificationCode from '@/components/VerificationCode'
|
import VerificationCode from '@/components/VerificationCode'
|
||||||
import QrCodePopup from '@/components/QrCodePopup'
|
import QrCodePopup from '@/components/QrCodePopup'
|
||||||
import { getAccountInfo } from '@/api/user'
|
import { getAccountInfo, getDoorKey } from '@/api/user'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
'van-cell-group': CellGroup,
|
'van-cell-group': CellGroup,
|
||||||
@ -69,34 +70,58 @@ export default {
|
|||||||
vipInfo: {},
|
vipInfo: {},
|
||||||
qrSrc: '',
|
qrSrc: '',
|
||||||
qrTitle: '',
|
qrTitle: '',
|
||||||
qrTips: ''
|
qrTips: '',
|
||||||
|
accesskey: null,
|
||||||
|
access: this.$route.query.access
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
// console.log(this.access)
|
||||||
this.init()
|
this.init()
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 获取初始数据
|
// 获取初始数据
|
||||||
init () {
|
init () {
|
||||||
|
|
||||||
// 获取全部的会员信息
|
// 获取全部的会员信息
|
||||||
getAccountInfo().then(res => {
|
getAccountInfo().then(res => {
|
||||||
this.vipInfo = res.data.vipUserInfo
|
this.vipInfo = res.data.vipUserInfo
|
||||||
// 手机号为空的时候绑定
|
// 手机号为空的时候绑定
|
||||||
if (this.vipInfo && this.vipInfo.userPhone === '') {
|
if (this.vipInfo && this.vipInfo.userPhone === '') {
|
||||||
this.codeVisible = true
|
this.codeVisible = true
|
||||||
|
// 点击入场券进入的
|
||||||
|
} else if (this.access === '1') {
|
||||||
|
this.doorAccessKey()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
closeCodePop () {
|
||||||
|
this.codeVisible = false
|
||||||
|
// 点击入场券进入的 绑定完之后弹出入场券
|
||||||
|
if (this.access === '1') {
|
||||||
|
this.doorAccessKey()
|
||||||
|
}
|
||||||
|
},
|
||||||
// 展示会员二维码
|
// 展示会员二维码
|
||||||
showUserQrcode (event) {
|
showUserQrcode () {
|
||||||
this.qrSrc = event.target.currentSrc
|
this.qrSrc = this.vipInfo.userPhone
|
||||||
this.qrTitle = '小蚁货仓会员码'
|
this.qrTitle = '小蚁货仓会员码'
|
||||||
this.qrTips = '<p>会员码用于会员储值及支付</p> <p>请勿随意泄漏给</p>'
|
this.qrTips = '<p>会员码用于会员储值及支付</p> <p>请勿随意泄漏给</p>'
|
||||||
this.qrcodeVisible = true
|
this.qrcodeVisible = true
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取门禁二维码值
|
||||||
|
async doorAccessKey () {
|
||||||
|
this.qrTitle = '小蚁货仓入场券'
|
||||||
|
this.qrTips = '<p>凭入场券二维码入场</p>'
|
||||||
|
if (!this.accesskey) {
|
||||||
|
const { data } = await getDoorKey()
|
||||||
|
this.accesskey = data.doorKey
|
||||||
|
}
|
||||||
|
this.qrSrc = this.accesskey
|
||||||
|
this.qrcodeVisible = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ module.exports = {
|
|||||||
// entry: ['@babel/polyfill', './src/main.js'],
|
// entry: ['@babel/polyfill', './src/main.js'],
|
||||||
externals: externals,
|
externals: externals,
|
||||||
optimization: {
|
optimization: {
|
||||||
minimize: false
|
minimize: false // 换行
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user