|
@@ -52,9 +52,8 @@
|
|
|
<view class="cart-footer-left">
|
|
|
<view class="cart-footer-left-all" @click="chooseAll">
|
|
|
<view class="cart-footer-left-all-icon">
|
|
|
- <uni-icons v-if="allDisabled" type="circle-filled" size="24" color="#999"></uni-icons>
|
|
|
+ <uni-icons v-if="allDisabled&&!editFlag" type="circle-filled" size="24" color="#ccc"></uni-icons>
|
|
|
<uni-icons v-else :type="allChecked?'checkbox-filled':'circle'" size="24" :color="allChecked?'#dd0000':'#666'"></uni-icons>
|
|
|
- <!-- <image style="width: 24px;height: 24px;" mode="aspectFill" :src="'../static/'+(allChecked?'round_check_fill':'round')+'.png'"></image> -->
|
|
|
</view>
|
|
|
<view class="cart-footer-left-all-text">
|
|
|
<text>全选</text>
|
|
@@ -110,7 +109,7 @@
|
|
|
return {
|
|
|
loading: false,
|
|
|
status: 'loading',
|
|
|
- noDataText: '暂无活动',
|
|
|
+ noDataText: '暂无产品',
|
|
|
empty: {
|
|
|
tip: '暂无产品',
|
|
|
imgUrl: '/static/nodata.png'
|
|
@@ -136,7 +135,13 @@
|
|
|
return this.$store.state.vuex_userInfo
|
|
|
},
|
|
|
allDisabled(){
|
|
|
- return this.list.every(item => item.status==0||item.dealerScopeFlag==0)
|
|
|
+ let ret = false
|
|
|
+ if(!this.editFlag){
|
|
|
+ this.list.forEach(key => {
|
|
|
+ ret = key.every(item => item.status==0||item.dealerScopeFlag==0)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return ret
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -183,12 +188,14 @@
|
|
|
})
|
|
|
_this.list.push(ret)
|
|
|
_this.total = res.data.count || 0
|
|
|
+ _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
|
|
|
+ _this.noDataText = _this.total>=_this.list.length ? '没有更多了' : '加载更多'
|
|
|
} else {
|
|
|
_this.list = []
|
|
|
_this.total = 0
|
|
|
+ _this.status = 'loadmore'
|
|
|
_this.noDataText = res.message
|
|
|
}
|
|
|
- _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
|
|
|
})
|
|
|
},
|
|
|
// scroll-view到底部加载更多
|
|
@@ -230,7 +237,7 @@
|
|
|
uni.hideLoading()
|
|
|
})
|
|
|
},
|
|
|
- // 选择
|
|
|
+ // 单选择
|
|
|
chooseItem(cartSn){
|
|
|
const crow = this.getItemById(cartSn)
|
|
|
if(crow.p>=0&&crow.s>=0){
|
|
@@ -238,11 +245,15 @@
|
|
|
// 合计
|
|
|
this.getChooseHeji()
|
|
|
// 判断是否全选
|
|
|
- if(this.list.every(key => key.every(item => item.checked))){
|
|
|
- this.allChecked = true
|
|
|
- }else{
|
|
|
- this.allChecked = false
|
|
|
- }
|
|
|
+ this.isAllChecked()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 判断是否全选
|
|
|
+ isAllChecked(){
|
|
|
+ if(this.editFlag){
|
|
|
+ this.allChecked = this.list.every(key => key.every(item => item.checked))
|
|
|
+ }else{
|
|
|
+ this.allChecked = this.list.every(key => key.every(item => item.checked && (item.status==1||item.dealerScopeFlag==1)))
|
|
|
}
|
|
|
},
|
|
|
// 编辑
|
|
@@ -251,8 +262,15 @@
|
|
|
this.list.forEach(key => {
|
|
|
key.forEach(item => {
|
|
|
item.edit = this.editFlag
|
|
|
+ if(item.status==0||item.dealerScopeFlag==0){
|
|
|
+ item.checked = false
|
|
|
+ }
|
|
|
})
|
|
|
})
|
|
|
+ // 合计
|
|
|
+ this.getChooseHeji()
|
|
|
+ // 判断是否全选
|
|
|
+ this.isAllChecked()
|
|
|
},
|
|
|
// 清空购物车
|
|
|
clearAll(){
|
|
@@ -274,10 +292,15 @@
|
|
|
},
|
|
|
// 全选
|
|
|
chooseAll(){
|
|
|
+ if(this.allDisabled){
|
|
|
+ return
|
|
|
+ }
|
|
|
this.allChecked = !this.allChecked
|
|
|
this.list.forEach(key => {
|
|
|
key.forEach(item => {
|
|
|
- item.checked = this.allChecked
|
|
|
+ if(item.status == 1 || item.dealerScopeFlag == 1){
|
|
|
+ item.checked = this.allChecked
|
|
|
+ }
|
|
|
})
|
|
|
})
|
|
|
// 合计
|
|
@@ -293,6 +316,8 @@
|
|
|
// 合计
|
|
|
if(!isBatch){
|
|
|
this.getChooseHeji()
|
|
|
+ // 判断是否全选
|
|
|
+ this.isAllChecked()
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -348,6 +373,8 @@
|
|
|
_this.allChecked = false
|
|
|
}
|
|
|
_this.getChooseHeji()
|
|
|
+ // 判断是否全选
|
|
|
+ this.isAllChecked()
|
|
|
}
|
|
|
}
|
|
|
uni.hideLoading()
|
|
@@ -379,7 +406,7 @@
|
|
|
soldOutSn.push(item.productCode)
|
|
|
}
|
|
|
//售罄产品提示
|
|
|
- else if(item.sellout == 0){
|
|
|
+ else if(item.dealerScopeFlag == 0){
|
|
|
sellOutSn.push(item.productCode)
|
|
|
}else{
|
|
|
detailList.push({
|