优化购物车库存不足或商品下架、优化我的推广(代理商)

master
chen 2022-08-17 14:32:28 +08:00
parent ac04a11951
commit cdd874fe38
3 changed files with 94 additions and 18 deletions

View File

@ -29,6 +29,9 @@
<view class="fon20" style="color: #676767;" v-if="item.created_at">{{item.created_at.slice(0,10).split('-').join('.')}}</view>
</view>
</view>
<view class="" v-if="moreLoading">
<pitera :textStr="`${noMore && total > dataList.length?'上滑加载更多':'到底了'}~~`" textColor="#b0aaa9" paddingStr="40rpx 0 20rpx 0"></pitera>
</view>
</view>
</view>
<dynamic-frame ref="refFrame" :showType="showType"></dynamic-frame>
@ -37,9 +40,11 @@
<script>
import dynamicFrame from '@/components/dynamic-frame.vue';
import pitera from '@/components/nothing/pitera.vue';
export default {
components:{
dynamicFrame
dynamicFrame,
pitera
},
data() {
return {
@ -51,12 +56,22 @@
showType:4,
page:1,
size:20,
loading:false
loading:false,
noMore:false,
moreLoading:false
}
},
onLoad() {
this.getSignInfo();
},
onReachBottom() {
if(this.total!=this.dataList.length){
this.page++;
this.getSignList();
} else {
this.noMore = true;
}
},
methods: {
//
getSignInfo(){
@ -92,9 +107,13 @@
page:this.page,
size:this.size
}
this.moreLoading = false;
if(this.page==1) this.dataList = [];
this.$requst.get('/api/user/sign-score',params).then(res=>{
if(res.code==0){
this.dataList = res.data.list;
this.total = res.data.total;
this.dataList = [...this.dataList,...res.data.list];
this.moreLoading = true;
}
})
}

View File

@ -230,14 +230,67 @@
},
//
chooseAllEv(){
this.ifSelectAll = !this.ifSelectAll;
this.datalist.forEach(item=>item.ifcheck = this.ifSelectAll ? true : false);
let sameType1 = false;
let sameType2 = false;
this.datalist.forEach(item=>{
if(item.is_coupon==1){
sameType1 = true;
}
if(item.is_coupon==0) {
sameType2 = true;
}
})
if((!sameType1 && sameType2) || (sameType1 && !sameType2)){
this.ifSelectAll = !this.ifSelectAll;
this.datalist.forEach(item=>item.ifcheck = this.ifSelectAll ? true : false);
this.datalist.forEach(item=>{
if(item.exception){
item.ifcheck = false;
this.ifSelectAll = false;
}
})
} else {
this.$toolAll.tools.showToast('优惠券不能与商品一同下单');
}
},
//
chooseEv(index) {
this.datalist[index].ifcheck = !this.datalist[index].ifcheck;
if(this.checkTogether(index)){
try{
if(this.datalist[index].exception){
this.$toolAll.tools.showToast(this.datalist[index].exception_text);
} else {
if(this.datalist[index].num > this.datalist[index].sku.sku_stock){
this.$toolAll.tools.showToast(`库存不足`);
} else {
this.datalist[index].ifcheck = !this.datalist[index].ifcheck;
}
}
}catch(e){
//TODO handle the exception
}
}
this.judgeSelectAllEv();
},
//
checkTogether(index){
let result = false;
let tempList = [];
this.datalist.forEach(item=>{
if(item.ifcheck){
tempList.push(item);
}
})
let sameType = tempList.every(item=>item.is_coupon==this.datalist[index].is_coupon);
if(!sameType){
this.$toolAll.tools.showToast('优惠券不能与商品一同下单');
} else {
result = true;
}
return result;
},
//
judgeSelectAllEv() {
if(this.datalist.length){

View File

@ -13,22 +13,26 @@
</view>
<view class="disjbac pad-x20 pad-zy10">
<view class="fon22 col26">我的佣金</view>
<view class="fon26 bold col-e42417" v-if="scoreInfo">{{scoreInfo.score}}</view>
<view class="fon26 bold col-e42417" v-if="scoreInfo">{{scoreInfo.commission}}</view>
</view>
</view>
<view class="mar-s30 pad-zy20 bacf boxshow2">
<view class=" col26 pad-sx20 pad-zy10 disac borbot" v-for="(item,index) in dataList" :key="index">
<view class="mar-s30 pad-zy20 bacf boxshow2 fon24">
<view class="col26 pad-s30 pad-x10 pad-zy10 disjbac borbot" style="color: #6d6d6d;">
<view class="">我的代理商</view>
<view class="">佣金记录</view>
</view>
<view class=" col26 pad-sx20 pad-zy10 disjbac borbot" v-for="(item,index) in dataList" :key="index">
<image :src="item.account.headimgurl" class="flexs radius_100 mar-y20" style="width: 78rpx;height: 78rpx;" mode="aspectFill" lazy-load></image>
<view class="width100">
<view class="disjbac">
<view class="fon24 colb">{{item.account.nickname}}</view>
<view class="col-e42417 fon24">+{{item.num}}</view>
</view>
<view class="disjbac" style="margin-top: 6rpx;">
<!-- <view class="width100"> -->
<!-- <view class="disjbac"> -->
<view class="colb clips1">{{item.account.nickname}}</view>
<!-- <view class="col-e42417">+{{item.num}}</view> -->
<!-- </view> -->
<!-- <view class="disjbac" style="margin-top: 6rpx;">
<view class="fon20" style="color: #747474;" v-if="item.created_at">{{item.created_at.split('-').join('.')}}</view>
<view class="fon24">{{item.name}}</view>
</view>
</view>
<view class="">{{item.name}}</view>
</view> -->
<!-- </view> -->
</view>
</view>
<pitera :textStr="`${noMore && total > dataList.length?'上滑加载更多':'到底了'}~~`" textColor="#b0aaa9" paddingStr="40rpx 0 20rpx 0"></pitera>