fourPayProject/51pay-uni/homePages/Manage/addDevice.vue
2025-03-31 10:14:11 +08:00

258 lines
4.8 KiB
Vue

<template>
<view class="content">
<view class="my-header">
<view class="my-icons" @click="goback">
<uni-icons type="arrow-left" color="#fff" size="22px"></uni-icons>
</view>
<view class="top_whit">
<input type="text" @input="getTerminalList()" v-model="merchantNameOrSn" placeholder="请输入商户名称或SN查询"
placeholder-style="text-align: center; color:#fff;font-size:12px">
</view>
<view class="c-text" @click="show=true">
添加设备
</view>
</view>
<view class="container">
<view class="list-box" @click="goDetails(item.sn)" v-for="item in terminalList">
<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>
<u-popup :show="show" mode="center" @close="close" @open="open">
<view class="box-pop">
<view class="pop-title">绑定机具</view>
<view class="p-input-box">
<input type="text" v-model="addSnNo" placeholder="请输入设备SN" />
</view>
<view class="popup-bs">
<view class="bottom-left" @click="closeBind()">取消</view>
<view class="bottom-right" @click="bindTr()">确定</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import request from '../../utils/request.js'
export default {
data() {
return {
show: false,
terminalList: [],
merId: null,
merchantNameOrSn: null,
addSnNo: null
}
},
onLoad(option) {
this.merId = option.merId
},
onShow() {
this.getTerminalList()
},
components: {
},
methods: {
bindTr() {
request({
url: 'app/uaSalesman/bindTerminal',
method: 'post',
data: {
merchantId: this.merId,
sn: this.addSnNo
},
}).then(res => {
this.getTerminalList()
uni.showToast({
title: "添加成功"
})
}).finally(rrr => {
this.show = false
this.addSnNo = null
})
},
closeBind() {
this.addSnNo = null
this.show = false
},
getTerminalList() {
request({
url: 'app/uaMer/terminalList',
method: 'post',
data: {
merchantId: this.merId,
limit: 10000,
page: 1,
merchantNameOrSn: this.merchantNameOrSn
},
}).then(res => {
this.terminalList = res.data
this.terminalList = [
{
sn: '123456789',
merchantName: '测试商户'
},
{
sn: '123456789',
merchantName: '测试商户'
},
{
sn: '123456789',
merchantName: '测试商户'
},
]
})
},
close() {
this.show = false
},
open() {
},
goDetails(sn) {
uni.navigateTo({
url: '/homePages/Manage/DeviceDetails?sn=' + sn
})
},
goback() {
uni.navigateBack()
}
}
}
</script>
<style scoped lang="scss">
.content {
background: #f4f5f6;
height: 100vh;
}
.container {
width: 100%;
background: #f4f5f6;
box-sizing: border-box;
padding-top: 88px;
justify-items: center;
}
.my-header {
width: 100%;
height: 88px;
display: flex;
align-items: center;
justify-content: space-between;
color: #fff;
box-sizing: border-box;
padding: 0px 15px;
padding-top: 40px;
z-index: 99999;
background: #E4612E;
position: fixed;
top: 0px;
.top_whit {
width: 55%;
border-radius: 50px;
border: 1px solid #fff;
box-sizing: border-box;
padding: 5px;
}
.my-icons {
height: 20px;
width: 15%;
}
.my-text {
width: 25%;
font-weight: bold;
}
}
.c-text {
font-size: 14px;
color: #fff;
}
.popup-bs {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.bottom-left {
width: 50%;
display: flex;
align-items: center;
justify-content: center;
height: 30px;
}
.bottom-right {
width: 50%;
display: flex;
align-items: center;
justify-content: center;
height: 30px;
color: #E4612E;
}
.p-input-box {
width: 100%;
border: 1px solid #e7e7e8;
border-radius: 4px;
box-sizing: border-box;
padding: 10px 15px;
margin-bottom: 20px;
}
.box-pop {
width: 300px;
background: #fff;
box-sizing: border-box;
padding: 15px;
}
.pop-title {
width: 100%;
text-align: center;
margin-bottom: 15px;
}
.list-box {
width: 90%;
box-sizing: border-box;
padding: 10px 20px;
background: #fff;
display: flex;
align-items: center;
justify-content: space-between;
border-radius: 20rpx;
margin-top: 15rpx;
}
.t-one {
font-size: 14px;
margin-bottom: 10px;
}
.t-two {
margin-bottom: 10px;
}
</style>