fourPayProject/51uni/homePages/StaffManagement/allocation.vue
2025-03-31 10:23:28 +08:00

339 lines
5.8 KiB
Vue

<template>
<view class="content">
<view class="container">
<view class="haers">
<view style="width: 20%; text-align: left;" @click="goback()">
<u-icon name="arrow-left" color="#fff" size="18"></u-icon>
</view>
<view style="width: 60%; text-align: center; font-size: 18px; ">
(商户)设备列表
</view>
<view style="width: 20%;text-align: right;" @click="goCust()">
完成
</view>
</view>
<view class="list-box" v-for="item in dataList" @click="chooseIt(item.id)">
<view class="qiu" v-if="selectId.indexOf(item.id)<0"></view>
<view class="x-qiu" v-else>
<view class="zxd"></view>
</view>
<view class="">
<view class="t-one">设备SN:{{item.sn}}</view>
<view class="t-two">商户名称:{{item.merchantName||""}}</view>
<view class="t-three">状态: <text style="color: #E4612E;margin-left: 10px;">绑定</text> </view>
</view>
<u-icon name="arrow-right" size="18"></u-icon>
</view>
</view>
</view>
</template>
<script>
import headers from '../../components/header/headers.vue'
import request from '../../utils/request.js'
export default {
data() {
return {
titles: "收款记录",
dataList: [],
page: 1,
totalPage: 0,
limit: 10,
selectId: [],
staffId: null
}
},
onLoad(option) {
this.staffId = option.staffId
},
onShow() {
this.dataList = []
this.page = 1
this.getDataList()
},
onPullDownRefresh() {
this.page = 1,
this.limit = 10,
this.totalPage = 0,
this.dataList = [],
this.getDataList();
uni.stopPullDownRefresh()
},
onReachBottom() {
// 触底加载
if (this.page < this.totalPage) {
this.page++
this.getDataList()
} else {
uni.showToast({
title: '没有下一页数据',
icon: 'none'
})
}
},
components: {
headers
},
methods: {
goCust() {
uni.showLoading({
title: '处理中'
})
if (this.selectId.length == 0) {
uni.showToast({
title: "请选择分配设备",
icon: 'none'
})
return
}
request({
url: 'app/uaMer/addStaffTerminal/' + this.staffId + "/" + this.selectId.join(','),
method: 'post'
}).then(res => {
uni.navigateBack()
}).finally(rrr => {
uni.hideLoading()
})
},
chooseIt(id) {
if (this.selectId.indexOf(id) > -1) {
this.selectId.splice(this.selectId.indexOf(id), 1)
} else {
this.selectId.push(id)
}
},
getDataList() {
uni.showLoading({
title: '加载中'
});
request({
url: 'app/uaMer/nobindTerminal',
method: 'post',
data: {
limit: this.limit,
page: this.page
},
}).then(res => {
if (res.data) {
if (this.page != 1) {
this.dataList = this.dataList.concat(res.data)
} else {
this.dataList = res.data
}
this.totalPage = res.pages
}
}).finally(rrr => {
uni.hideLoading()
})
},
goback() {
uni.navigateBack()
}
}
}
</script>
<style scoped lang="scss">
input {
&::-webkit-input-placeholder,
/* WebKit browsers*/
&:-moz-input-placeholder,
/* Mozilla Firefox 4 to 18*/
&::-moz-input-placeholder,
/* Mozilla Firefox 19+*/
&:-ms-input-placeholder
/* Internet Explorer 10+*/
{
color: #fff !important;
}
}
.content {
background: #f4f4f4;
height: 100vh;
}
.container {
width: 100%;
background: #f4f4f4;
box-sizing: border-box;
padding-top: 98px;
}
.haers {
width: 100%;
background: #E4612E;
height: 88px;
box-sizing: border-box;
padding: 0px 15px;
padding-top: 40px;
color: white;
z-index: 99999;
background: #E4612E;
position: fixed;
top: 0px;
display: flex;
align-items: center;
justify-content: space-between;
}
.input-box {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
width: 65%;
height: 25px;
border-radius: 50px;
border: 1px solid #fff;
color: white;
input {
width: 80%;
}
}
.box_ {
width: 95%;
margin: 0 auto;
margin-bottom: 15px;
background: #fff;
// border-bottom: 1px solid #efefef;
}
.list-box {
width: 100%;
box-sizing: border-box;
padding: 10px 20px;
background: #fff;
display: flex;
align-items: center;
justify-content: space-between;
}
.t-one {
font-size: 14px;
margin-bottom: 10px;
}
.t-two {
margin-bottom: 10px;
}
.t-three {
font-size: 12px;
}
.title_ {
font-size: 18px;
margin: 10px 0px;
}
.box-top {
width: 100%;
border-bottom: 1px solid #efefef;
box-sizing: border-box;
padding: 10px;
}
.box-bottom {
width: 100%;
box-sizing: border-box;
padding: 10px;
border-bottom: 1px solid #efefef;
}
.box-bs {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
color: #979797;
margin: 2px 0px;
}
.bottom-bs {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
color: #000000;
margin-bottom: 5px;
}
.box-end {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
}
.aaniu {
width: 120px;
height: 35px;
border-radius: 50px;
background: #E4612E;
color: white;
display: flex;
align-items: center;
justify-content: center;
}
.box_ {
width: 100%;
background: #fff;
box-sizing: border-box;
padding: 15px;
display: flex;
align-items: center;
justify-content: space-between;
}
.qiu {
border: 1px solid #efefef;
width: 14px;
height: 14px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.x-qiu {
border: 1px solid #efefef;
width: 14px;
height: 14px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.zxd {
width: 12px;
height: 12px;
background: #E4612E;
border-radius: 50%;
}
</style>