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.
253 lines
5.9 KiB
253 lines
5.9 KiB
<template>
|
|
<view>
|
|
|
|
<view class="input-box">
|
|
<view class="icon search"></view>
|
|
<input placeholder="输入二维码序列号" v-model="scanNo" placeholder-style="color:#c0c0c0;" @input="toSearch()" />
|
|
</view>
|
|
|
|
<view v-if="serviceList == ''" class="mart60 fotct font14 fcor666">
|
|
<image mode="widthFix" style="width: 70vw;" src="../../../static/img/noorder.png"></image>
|
|
</view>
|
|
<view class="height110 width94 backcorfff mart20" v-for="(item,index) in serviceList" :key="index">
|
|
<view class="font20 font306adb paddtop10 fontwig6 padleft15">{{item.serialNumber}}</view>
|
|
<view class="mart10 fcor666 padleft15 font14" v-if="typeId == 2">绑定时间: {{item.storeBindTime | timeFormat('yyyy-mm-dd')}}
|
|
{{item.storeBindTime | timeFormat('hh:mm')}}
|
|
</view>
|
|
<view class="mart10 fcor666 padleft15 font14" v-else>创建: {{item.createTime | timeFormat('yyyy-mm-dd')}}
|
|
{{item.createTime | timeFormat('hh:mm')}}
|
|
</view>
|
|
<button class="btns" @click="bindStore(item.id)" v-if="typeId == 1">绑定二维码</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
bindStore,
|
|
getSalesmanQrCodeList,
|
|
getStoreQrCodeList
|
|
} from '../../../Utils/Api.js';
|
|
let app = getApp();
|
|
export default {
|
|
data() {
|
|
return {
|
|
serviceList: [],
|
|
pageNum: 1,
|
|
pageSize: 15,
|
|
isLoadMore: false, //是否加载中
|
|
userInfo: app.globalData.userInfo, //用户信息
|
|
typeId: '', //类型
|
|
storeId: '', //门店id
|
|
scanNo: '' // 二维码编号
|
|
}
|
|
},
|
|
onReachBottom() { //上拉触底函数
|
|
if (this.typeId == 2) {
|
|
this.getStoreQrCodeList();
|
|
} else {
|
|
this.getSalesmanQrCodeList();
|
|
}
|
|
},
|
|
onLoad(options) {
|
|
this.typeId = options.type;
|
|
this.storeId = options.storeid;
|
|
if (options.type == 2) {
|
|
uni.setNavigationBarTitle({
|
|
title: '二维码列表'
|
|
});
|
|
this.getStoreQrCodeList();
|
|
} else {
|
|
this.getSalesmanQrCodeList();
|
|
}
|
|
},
|
|
methods: {
|
|
toSearch() {
|
|
this.pageNum = 1;
|
|
this.isLoadMore = false;
|
|
this.serviceList = [];
|
|
if (this.typeId == 2) {
|
|
this.getStoreQrCodeList();
|
|
} else {
|
|
this.getSalesmanQrCodeList();
|
|
}
|
|
},
|
|
//门店查询设备列表
|
|
getStoreQrCodeList() {
|
|
if (this.isLoadMore) {
|
|
return false;
|
|
}
|
|
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
let params = {
|
|
pageNum: this.pageNum,
|
|
pageSize: this.pageSize,
|
|
serialNumber: this.scanNo,
|
|
storeId: this.storeId
|
|
}
|
|
getStoreQrCodeList(params).then(res => {
|
|
uni.hideLoading();
|
|
if (res.return_code == '000000' && res.return_data.list) {
|
|
this.serviceList = this.serviceList.concat(res.return_data.list);
|
|
if (res.return_data.total == this.serviceList.length) {
|
|
this.isLoadMore = true;
|
|
}else{
|
|
this.isLoadMore = false;
|
|
}
|
|
this.pageNum = this.pageNum + 1;
|
|
} else {
|
|
this.serviceList = [];
|
|
this.isLoadMore = true;
|
|
uni.showToast({
|
|
title: res.return_msg,
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
}
|
|
});
|
|
},
|
|
//业务员查询设备列表
|
|
getSalesmanQrCodeList() {
|
|
if (this.isLoadMore) {
|
|
return false;
|
|
}
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
|
|
let datas = {
|
|
salesmanId: this.userInfo.salesman.id,
|
|
isAssignStore: false,
|
|
serialNumber: this.scanNo,
|
|
pageNum: this.pageNum,
|
|
pageSize: this.pageSize,
|
|
}
|
|
getSalesmanQrCodeList(datas).then(res => {
|
|
uni.hideLoading();
|
|
if (res.return_code == '000000' && res.return_data.list) {
|
|
this.serviceList = this.serviceList.concat(res.return_data.list);
|
|
if (res.return_data.total == this.serviceList.length) {
|
|
this.isLoadMore = true;
|
|
}else{
|
|
this.isLoadMore = false;
|
|
}
|
|
this.pageNum = this.pageNum + 1;
|
|
|
|
} else {
|
|
this.serviceList = [];
|
|
this.isLoadMore = true;
|
|
uni.showToast({
|
|
title: res.return_msg,
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
}
|
|
});
|
|
},
|
|
//绑定设备
|
|
bindStore(item) {
|
|
let that = this;
|
|
uni.showModal({
|
|
title: '绑定二维码',
|
|
content: '是否绑定当前二维码。',
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
uni.showLoading({
|
|
title: '提交中...'
|
|
})
|
|
let params = {
|
|
"qrCodeId": item,
|
|
"storeId": that.storeId
|
|
}
|
|
bindStore(params).then(res => {
|
|
uni.hideLoading();
|
|
if (res.return_code == '000000') {
|
|
uni.showToast({
|
|
title: '提交成功',
|
|
icon: 'none',
|
|
duration: 2000,
|
|
success() {
|
|
setTimeout(() => {
|
|
uni.navigateBack({})
|
|
}, 1000);
|
|
}
|
|
})
|
|
} else {
|
|
uni.showToast({
|
|
title: res.return_msg,
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
}
|
|
})
|
|
} else if (res.cancel) {
|
|
console.log('用户点击取消');
|
|
}
|
|
}
|
|
});
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page {
|
|
background-color: #f8f9f9;
|
|
}
|
|
|
|
.input-box {
|
|
width: 90%;
|
|
margin-left: 5%;
|
|
margin-top: 15px;
|
|
height: 70rpx;
|
|
background-color: #f5f5f5;
|
|
border-radius: 10rpx;
|
|
position: relative;
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
.icon {
|
|
display: flex;
|
|
align-items: center;
|
|
position: absolute;
|
|
top: 2px;
|
|
left: 5px;
|
|
width: 60upx;
|
|
height: 60upx;
|
|
font-size: 34upx;
|
|
color: #c0c0c0;
|
|
}
|
|
|
|
input {
|
|
padding-left: 50upx;
|
|
height: 28upx;
|
|
font-size: 28upx;
|
|
width: 100%;
|
|
}
|
|
}
|
|
|
|
.font306adb {
|
|
color: #306adb;
|
|
}
|
|
|
|
.xfimg {
|
|
width: 100rpx;
|
|
bottom: 60rpx;
|
|
position: fixed;
|
|
right: 40rpx;
|
|
}
|
|
|
|
.btns {
|
|
width: 25%;
|
|
margin-left: 68%;
|
|
height: 35px;
|
|
line-height: 35px;
|
|
background-color: #0083f5;
|
|
color: #FFFFFF;
|
|
font-weight: bold;
|
|
font-size: 14px;
|
|
padding: 0px;
|
|
}
|
|
</style>
|
|
|