You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
160 lines
5.9 KiB
160 lines
5.9 KiB
<template>
|
|
<view style="display: flex;flex-direction: column;background-color: #fff;">
|
|
|
|
<view class="top">
|
|
<NavBar ref="nav" navTitle="绑定云菜窖" :showIcon="true" :start-change-height="page.startHeight"
|
|
:end-change-height="page.endHeight">
|
|
</NavBar>
|
|
<view>
|
|
<image src="https://supervise.yxtsoft.com/lpk/image/bind_bj.png" mode="scaleToFill"
|
|
style="width: 100%;height: 70vw"></image>
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<!-- <view style="display: flex;flex-direction: column;margin-top: -10vw;box-sizing: border-box;">
|
|
<view
|
|
style="display: flex;flex-direction: column;border-radius: 20rpx;background: #FFFFFF;z-index: 1;align-items: center;box-sizing: border-box;">
|
|
<view style="margin: 15px;">绑定云菜窖卡</view>
|
|
<view
|
|
style="display: flex;flex-direction: row;justify-content: space-between;box-sizing: border-box;width: calc(100vw - 60px);align-items: center;">
|
|
<input maxlength="20" placeholder="请输入/扫码 提货编码"
|
|
style="font-size: 30rpx;flex: 1;background: #F8F8F8;border-radius: 5px;height: 40px;line-height: 40px;margin-right: 10px;padding-left: 10px;"
|
|
type="number" :value="page.code" @input="onKeyInput1" />
|
|
<uni-icons type="camera-filled" color="#c0c4cc" size="22" style="flex-shrink: 0;" @click="scan" />
|
|
</view>
|
|
<view
|
|
style="display: flex;flex-direction: row;justify-content: space-between;box-sizing: border-box;width: calc(100vw - 60px);align-items: center;margin-top: 10px;">
|
|
<input maxlength="6" placeholder="请输入提货密码"
|
|
style="font-size: 30rpx;flex: 1;background: #F8F8F8;border-radius: 5px;height: 40px;line-height: 40px;padding-left: 10px;"
|
|
type="number" :value="page.codeKey" @input="onKeyInput2" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view
|
|
style="margin: 30px;background-color: #fd3655;width: calc(100% - 60px);border-radius: 100rpx;height: 80rpx;display: flex;flex-direction: column;align-items: center;line-height: 80rpx;color: #FFFFFF;font-size: 36rpx;"
|
|
@click="save">
|
|
绑定</view> -->
|
|
|
|
<view style="display: flex;flex-direction: column;padding:20px;">
|
|
|
|
<view style="display: flex;flex-direction: row;align-items: center;">
|
|
<view style="background: #FF9D33; border-radius: 50%;width: 12px;height: 12px;"></view>
|
|
<view style="background: #FFDAB2; border-radius: 50%;width: 12px;height: 12px;"></view>
|
|
<text style="margin-left: 8px;font-size: 18px;color: #333;">绑定云菜窖</text>
|
|
</view>
|
|
|
|
<text style="margin-left: 8px;font-size: 14px;color: #333;margin-top: 20px;">提货编码</text>
|
|
<view style="display: flex;flex-direction: row;justify-content: space-between;
|
|
background: #F8F8F8;border-radius: 5px;box-sizing: border-box;
|
|
width: calc(100vw -40px);align-items: center; padding:10px 0px;margin-top: 5px;">
|
|
<input maxlength="20" placeholder="请输入/扫码"
|
|
style="font-size: 30rpx;flex: 1;margin-right: 20px;padding-left: 10px;" type="number"
|
|
:value="page.code" @input="onKeyInput1" />
|
|
<!-- <view style="width: 1px;height: 20px;background: #ccc; margin-right: 10px;"></view>
|
|
<uni-icons type="camera-filled" color="#c0c4cc" size="22" style="flex-shrink: 0;margin-right: 10px;"
|
|
@click="scan" /> -->
|
|
</view>
|
|
<!-- <text style="margin-left: 8px;font-size: 14px;color: #333;margin-top: 20px;">提货密码</text>
|
|
<view style="display: flex;flex-direction: row;justify-content: space-between;
|
|
background: #F8F8F8;border-radius: 5px; padding:10px 0px;
|
|
box-sizing: border-box;width: calc(100vw - 40px);align-items: center;margin-top: 10px;">
|
|
<input maxlength="6" placeholder="请输入提货密码" style="font-size: 30rpx;flex: 1;padding-left: 10px;"
|
|
type="number" :value="page.codeKey" @input="onKeyInput2" />
|
|
</view> -->
|
|
|
|
<view style="background: -webkit-linear-gradient(left,#FFB176,#FE923B); position: absolute; bottom: 30px;
|
|
width: 90%;border-radius: 100rpx;height: 80rpx;display: flex;
|
|
flex-direction: column;align-items: center;line-height: 80rpx;color: #FFFFFF;font-size: 36rpx;" @click="save">
|
|
接收</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
//引入bus
|
|
import bus from '@/common/bus';
|
|
export default {
|
|
data() {
|
|
return {
|
|
page: {
|
|
code: '',
|
|
codeKey: '',
|
|
customerSid: '',
|
|
startHeight: 0,
|
|
endHeight: 0
|
|
},
|
|
}
|
|
},
|
|
onLoad(options) {
|
|
|
|
this.page.code = options.code
|
|
this.page.codeKey = options.codeKey
|
|
|
|
|
|
this.page.customerSid = getApp().globalData.sid
|
|
let info = uni.getSystemInfoSync();
|
|
|
|
this.page.startHeight = info.windowWidth * 0.6
|
|
this.page.endHeight = info.windowWidth * 0.8
|
|
},
|
|
methods: {
|
|
onKeyInput1(event) {
|
|
this.page.code = event.target.value
|
|
},
|
|
onKeyInput2(event) {
|
|
this.page.codeKey = event.target.value
|
|
},
|
|
scan() {
|
|
// 只允许通过相机扫码
|
|
let _this = this
|
|
uni.scanCode({
|
|
onlyFromCamera: true,
|
|
success(res) {
|
|
_this.page.code = res.result.substring(res.result.length - 20, res.result.length)
|
|
}
|
|
});
|
|
},
|
|
save() {
|
|
if (this.stringIsEmpty(this.page.code) || this.page.code.length != 20) {
|
|
this.shortToast('请输入20位提货编码')
|
|
return
|
|
}
|
|
|
|
// if (this.stringIsEmpty(this.page.codeKey) || this.page.codeKey.length != 6) {
|
|
// this.shortToast('请输入6位提货密码')
|
|
// return
|
|
// }
|
|
let _this = this
|
|
_this.$api.bindAllCard(this.page).then((resp) => {
|
|
// bus.$emit('order', "监听回调");
|
|
// setTimeout(() => {
|
|
// uni.$emit('order', "监听回调")
|
|
// }, 500)
|
|
const pages = getCurrentPages()
|
|
// 有可返回的页面则直接返回,uni.navigateBack 默认返回失败之后会自动刷新页面 ,无法继续返回
|
|
if (pages.length > 1) {
|
|
uni.navigateBack(1)
|
|
return;
|
|
} else {
|
|
uni.switchTab({
|
|
url: '/pages/home/myCellar'
|
|
})
|
|
}
|
|
|
|
|
|
}).catch(e => {
|
|
_this.longToast(e.msg)
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.top {
|
|
width: 100vw;
|
|
height: 70vw;
|
|
}
|
|
</style>
|