<template>
|
<view class="box">
|
<view class="title">输入自提码</view>
|
<view class="input">
|
<input type="number" v-model="code" placeholder="请输入6位自提码" />
|
</view>
|
<view class="btn" v-if="!loading" @click="confirmDo">确认</view>
|
<view class="btn1" v-if="loading" >正在查询</view>
|
<view class="footer" @click="scanCodeDo">
|
<image src="/pagesA/static/ic_saoma@2x.png" mode="widthFix"></image>
|
<text>扫码核销</text>
|
</view>
|
<u-popup :show="show1" round="15" :safeAreaInsetBottom="false" mode="center">
|
<view class="tc">
|
<view class="tc-contemt">
|
<view class="tc-contemt-title">订单查询结果</view>
|
<view class="tc-contemt-nr">
|
订单【{{info.code}}】不满足核销条件!
|
</view>
|
</view>
|
<view class="tc-btn">
|
<view class="tc-btn-item" @click="show1=false ">确认</view>
|
</view>
|
</view>
|
</u-popup>
|
</view>
|
</template>
|
|
<script>
|
import QRCode from 'qrcode';
|
import { mapState } from 'vuex'
|
export default {
|
computed: {
|
...mapState(['navHeight', 'statusbarHeight','shopInfo', 'shopToken'])
|
},
|
data() {
|
return {
|
code:null,
|
show1:false,
|
loading:false,
|
id:null,
|
info:{}
|
};
|
},
|
onShow() {
|
this.loading =false
|
this.show1 =false
|
this.info={}
|
this.code =''
|
this.checkShopLogin()
|
},
|
onLoad(options) {
|
},
|
methods:{
|
scanCodeDo(){
|
this.code = ''
|
var that =this
|
uni.scanCode({
|
success: function (res) {
|
console.log('条码类型:' + res.scanType);
|
console.log('条码内容:' + res.result);
|
// 处理扫描结果
|
that.code = res.result
|
that.confirmDo()
|
},
|
fail: function (err) {
|
uni.showToast({
|
title:'扫码失败',
|
icon:'error'
|
})
|
}
|
});
|
},
|
async confirmDo(){
|
if(this.code ){
|
this.getShopDetail()
|
}
|
},
|
jumpWriteoffA(){
|
if(this.info && this.info.orderId){
|
uni.navigateTo({
|
url: '/pagesA/pages/write-off-a/write-off-a?id='+this.info.orderId
|
})
|
}
|
},
|
jumpBack(){
|
uni.navigateBack({delta:1})
|
},
|
getShopDetail(){
|
if(this.loading){
|
return
|
}
|
this.loading =true
|
var that =this
|
that.$u.api.getOrderDetailByCode({exchangeCode:this.code,tokenType:1 })
|
.then(res=>{
|
console.log(res)
|
if (res.code === 200) {
|
that.info = res.data
|
if(res.data.orderStatus == 1 && res.data.receiveType ==1){
|
that.jumpWriteoffA()
|
}else{
|
this.show1 = !this.show1
|
this.loading =false
|
}
|
}
|
}).catch(e=>{
|
this.loading =false
|
}).finally(e=>{
|
// this.loading =false
|
})
|
},
|
checkShopLogin(){
|
var that =this
|
if( this.shopInfo ==null || this.shopInfo.id==null || this.shopToken==null || this.shopToken==''){
|
uni.navigateTo({
|
url: '/pages/login/login'
|
})
|
}
|
},
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.box {
|
width: 100vw;
|
height: 100vh;
|
display: flex;
|
padding-top: 198rpx;
|
box-sizing: border-box;
|
align-items: center;
|
flex-direction: column;
|
background: linear-gradient( 180deg, #C8F3FF 0%, #FFFFFF 52.19%, #FFFFFF 100%);
|
.title {
|
font-weight: 600;
|
font-size: 34rpx;
|
color: #222222;
|
}
|
.input {
|
width: 630rpx;
|
height: 88rpx;
|
padding: 0 30rpx;
|
box-sizing: border-box;
|
background: #FFFFFF;
|
border-radius: 50rpx;
|
border: 2rpx solid #004096;
|
margin-top: 40rpx;
|
input {
|
width: 100%;
|
height: 100%;
|
font-weight: 400;
|
font-size: 32rpx;
|
color: #111111;
|
text-align: center;
|
}
|
}
|
.btn1{
|
width: 630rpx;
|
height: 88rpx;
|
line-height: 88rpx;
|
text-align: center;
|
background: #666666;
|
border-radius: 44rpx;
|
font-weight: 600;
|
font-size: 32rpx;
|
color: #FFFFFF;
|
margin-top: 40rpx;
|
}
|
.btn {
|
width: 630rpx;
|
height: 88rpx;
|
line-height: 88rpx;
|
text-align: center;
|
background: #004096;
|
border-radius: 44rpx;
|
font-weight: 600;
|
font-size: 32rpx;
|
color: #FFFFFF;
|
margin-top: 40rpx;
|
}
|
.footer {
|
display: flex;
|
align-items: center;
|
margin-top: 48rpx;
|
image {
|
width: 40rpx;
|
height: 40rpx;
|
margin-right: 12rpx;
|
}
|
text {
|
font-weight: 400;
|
font-size: 28rpx;
|
color: #004096;
|
}
|
}
|
}
|
</style>
|