平板端快衣店
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.
 
 
 
 
 

272 lines
8.0 KiB

<template>
<view class="page1">
<view style="position: fixed;top: 0;z-index: 99;height: 70px;width: 100%;display: flex;background: #fff;padding-top: 30px;">
<uni-icons type="left" size='10' @tap="backPage"></uni-icons>
</view>
<view style="overflow:scroll;padding-bottom: 60px;margin-top: 80px;">
<view v-if="popleType== 'khName' || popleType== 'gysName'" style="overflow:scroll;">
<!-- 供应商、客户走这一套 -->
<view class="list-1" v-for="item in popleList" :key="item" v-if="item.name !='散客' && item.consigneeName !='默认供应商'"
style="display: flex;flex-direction: column;height: auto;">
<view class="name-tel" style="width: 100%;" v-if="popleType=='gysName'">
<text style="line-height: 40px;">{{item.consigneeName}}</text>
<text>{{item.consigneeMobile != 'undefined' &&item.consigneeMobile != null &&item.consigneeMobile != undefined ?item.consigneeMobile:'-'}}</text>
</view>
<view class="name-tel" style="width: 100%;" v-else>
<text style="line-height: 40px;">{{item.name}}<text v-if="item.notBuyDays!=null">({{item.notBuyDays+'天未拿货'}})</text> </text>
<text>{{item.phone}}</text>
</view>
<view class="name-tel" style="width: 100%;display: flex;flex-direction: column;height:auto;">
<text style="width:100%;color:#747474;height: auto;line-height: 40px;">{{(item.name == '散客' || item.consigneeName == '默认供应商') && item.city != null && item.city != undefined?'-':item.province + item.city + item.area}} {{(item.name == '散客' || item.consigneeName == '默认供应商')?'-':item.address}}</text>
</view>
<view v-if="item.name != '散客' && popleType== 'khName' && item.noEarn > 0 && userType == 0" style="color: red;position: absolute;top: 10px;right: 150px;">
欠款:{{item.noEarn?item.noEarn :0}}
</view>
<view v-if="item.consigneeName !='默认供应商' && popleType== 'gysName' && item.noEarn > 0 && userType == 0" style="color: red;position: absolute;top: 10px;right: 150px;">
欠款:{{item.noEarn?item.noEarn :0}}
</view>
<view v-if="item.name != '散客' && popleType== 'khName' && item.noEarn < 0 && userType == 0" style="color: red;position: absolute;top: 10px;right: 150px;">
余额:{{item.noEarn?Math.abs(item.noEarn) :0}}
</view>
<view v-if="item.consigneeName != '默认供应商' && popleType== 'gysName' && item.noEarn < 0 && userType == 0" style="color: red;position: absolute;top: 10px;right: 150px;">
余额:{{item.noEarn?Math.abs(item.noEarn) :0}}
</view>
<checkbox @tap="checkboxChange(item)" :checked="item.checked" class="checkbox" />
</view>
</view>
<u-loadmore :status="status" />
</view>
<view style="position: fixed;bottom: 0;width: 100%;height: 50px;background: #fff;">
<view @tap="batchDelPeople('1')" style="height: 40px;text-align: center;line-height: 40px;background: #5fd9ee; width: 95%;margin: 5px auto;border-radius: 10px;color: #fff;">
批量删除
</view>
</view>
<!-- 弹出删除警示框 -->
<uni-popup ref="delPopup" background-color="#fff">
<view class="popup-del-content">
<view class="popup-del-title">
<text>警告</text>
</view>
<view style="line-height: 60px;">
删除后的<text>{{popleType == 'gysName'?'供应商':'客户'}}</text><text style="color: red;">无法找回</text>,是否继续?
</view>
<view style="display: flex;margin-top: 20px;">
<view class="popup-bottom-left">
<view class="bottom-del-btn" @tap="this.$refs.delPopup.close()"
style="background: linear-gradient(90deg, #FF9797, #FFC1E0);">再想想</view>
</view>
<view class="popup-bottom-right">
<view class="bottom-del-btn" @tap="batchDelPeople()">确认删除</view>
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
export default {
data() {
return {
popleType: '',
popleList: [],
status: 'loadmore',
sort:'',
carList:[],
notBuyDays:'',
nahuoDay:false,
khName:{},
userType:'',
searchName:'',
pages: 1,
totalPages: 0,
user:''
}
},
onReachBottom() {
if (this.pages >= this.totalPages) return;
this.status = 'loading';
this.pages = ++this.pages;
this.khOrGysList();
},
onLoad(options) {
this.popleType = options.popleType
uni.setStorageSync('clearMsg','1')
this.user = uni.getStorageSync('username')
this.userType = uni.getStorageSync('type')
this.khOrGysList();
},
methods: {
backPage(){
uni.navigateBack()
},
//客户、供应商列表
khOrGysList() {
this.status = 'loading';
if(this.popleType == 'gysName'){ //供应商
this.tui.request("/app/supplier/getByCondition", "post", {
searchStr:this.searchName,
pageNumber: this.pages,
pageSize: 10
}, false, true).then((res) => {
this.status = 'nomore';
if (res.code == 200) {
if (this.pages == 1) {
this.popleList = res.result.content
} else {
this.popleList = [...this.popleList, ...res.result.content]
}
this.totalPages = res.result.totalPages
}else{
this.tui.toast(res.message)
}
})
}else{ //客户
this.tui.request("/app/customer/list", "post", {
searchStr:this.searchName,
pageNum: this.pages,
pageSize: 10,
sort:this.sort,
notBuyDays:this.notBuyDays
}, false, false).then((res) => {
this.status = 'nomore';
if (res.code == 200) {
if (this.pages == 1) {
this.popleList = res.result.records
} else {
this.popleList = [...this.popleList, ...res.result.records]
}
this.totalPages = res.result.pages
}else{
this.tui.toast(res.message)
}
})
}
for(var i = 0; i < this.popleList.length; i++){
if(this.popleList != ''){
this.popleList[i].checked = false
}
}
},
batchDelPeople(type){
if(type == '1'){
this.$refs.delPopup.open()
}else{
if(this.carList == ''){
this.tui.toast("请勾选商品后再删除~")
return
}
let url
if(this.popleType == 'gysName'){
url = '/app/supplier/delByIds'
}else{
url = '/app/customer/batchDeleteCustomer'
}
this.tui.request(url, "post", {
ids:this.carList
}, false, true).then((res) => {
if (res.code == 200) {
this.khOrGysList()
setTimeout(res=>{
this.tui.toast('删除成功')
},300)
}else{
this.tui.toast(res.message)
}
})
this.$refs.delPopup.close()
}
},
//选中商品
checkboxChange(item) {
item.checked = !item.checked
if (this.carList.indexOf(item.id) != -1) {
this.carList.splice(this.carList.indexOf(item.id), 1)
} else {
this.carList.push(item.id)
}
console.log(this.carList)
},
//顶部搜索框
search(res) {
this.pages = 1
this.searchName = res.value
this.popleList = []
this.khOrGysList()
}
}
}
</script>
<style lang="scss" scoped>
page,.page1{
font-size: 14px;
}
button {
color: #ffffff;
background: #5fd9ee;
width: 90%;
}
.list-1 {
border-bottom: 1px solid #eee;
background: #fff;
margin: 0 auto 10px;
width: 95%;
padding-left: 10px;
position: relative;
min-height: 80px;
}
.name-tel {
width: 75%;
height: auto;
}
.title-box {
background: #fff;
}
.checkbox {
width: 40rpx;
height: 40rpx;
position: absolute;
top: 20rpx;
right: 30rpx;
}
.popup-del-content {
align-items: center;
justify-content: center;
padding: 10px 20px;
width: 300px;
height: 165px;
text-align: center;
background-color: #fff;
border-radius: 10px;
}
.popup-del-title {
font-weight: bold;
text-align: center;
position: relative;
}
.popup-bottom-left {
width: 50%;
line-height: 40px;
}
.popup-bottom-right {
width: 50%;
line-height: 40px;
}
.bottom-del-btn {
width: 90%;
line-height: 40px;
height: 40px;
text-align: center;
color: #fff;
margin: 0 auto;
background: linear-gradient(90deg, #60F3FF, #088FEB);
border-radius: 40px;
}
</style>