mirror of
https://gitee.com/ZhongBangKeJi/crmeb_java.git
synced 2026-04-23 03:58:35 +08:00
更新代码
This commit is contained in:
@@ -17,10 +17,10 @@
|
||||
<block v-for="(item,index) in cartList.valid" :key="index">
|
||||
<view class='item acea-row row-between-wrapper'>
|
||||
<!-- #ifndef MP -->
|
||||
<checkbox :value="(item.id).toString()" :checked="item.checked" :disabled="item.attrStatus?false:true" />
|
||||
<checkbox :value="(item.id).toString()" :checked="item.checked" :disabled="!item.attrStatus && footerswitch" />
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<checkbox :value="item.id" :checked="item.checked" :disabled="item.attrStatus?false:true" />
|
||||
<checkbox :value="item.id" :checked="item.checked" :disabled="!item.attrStatus && footerswitch" />
|
||||
<!-- #endif -->
|
||||
<navigator :url='"/pages/goods_details/index?id="+item.productId' hover-class='none' class='picTxt acea-row row-between-wrapper'>
|
||||
<view class='pictrue'>
|
||||
@@ -91,7 +91,7 @@
|
||||
<view class='footer acea-row row-between-wrapper' v-if="cartList.valid.length > 0">
|
||||
<view>
|
||||
<checkbox-group @change="checkboxAllChange">
|
||||
<checkbox value="all" :checked="!!isAllSelect" /><text class='checkAll'>全选 ({{cartCount}})</text>
|
||||
<checkbox value="all" :checked="!!isAllSelect" /><text class='checkAll'>全选 ({{selectValue.length}})</text>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
<view class='money acea-row row-middle' v-if="footerswitch==true">
|
||||
@@ -510,22 +510,52 @@
|
||||
this.setAllSelectValue(0)
|
||||
}
|
||||
},
|
||||
// setAllSelectValue: function(status) {
|
||||
// let that = this;
|
||||
// let selectValue = [];
|
||||
// let valid = that.cartList.valid;
|
||||
// if (valid.length > 0) {
|
||||
// for (let index in valid) {
|
||||
// if (status == 1) {
|
||||
// if(valid[index].attrStatus){
|
||||
// valid[index].checked = true;
|
||||
// selectValue.push(valid[index].id);
|
||||
// }else{
|
||||
// valid[index].checked = false;
|
||||
// }
|
||||
// } else valid[index].checked = false;
|
||||
// }
|
||||
// that.$set(that.cartList, 'valid', valid);
|
||||
// that.selectValue = selectValue;
|
||||
// that.switchSelect();
|
||||
// }
|
||||
// },
|
||||
setAllSelectValue: function(status) {
|
||||
let that = this;
|
||||
let selectValue = [];
|
||||
let valid = that.cartList.valid;
|
||||
if (valid.length > 0) {
|
||||
for (let index in valid) {
|
||||
if (status == 1) {
|
||||
if(valid[index].attrStatus){
|
||||
valid[index].checked = true;
|
||||
selectValue.push(valid[index].id);
|
||||
}else{
|
||||
valid[index].checked = false;
|
||||
let newValid = valid.map(item => {
|
||||
if (status) {
|
||||
if (that.footerswitch) {
|
||||
if (item.attrStatus) {
|
||||
item.checked = true;
|
||||
selectValue.push(item.id);
|
||||
} else{
|
||||
item.checked = false;
|
||||
}
|
||||
} else{
|
||||
item.checked = true;
|
||||
selectValue.push(item.id);
|
||||
}
|
||||
} else valid[index].checked = false;
|
||||
}
|
||||
that.$set(that.cartList, 'valid', valid);
|
||||
that.isAllSelect = true;
|
||||
} else{
|
||||
item.checked = false;
|
||||
that.isAllSelect = false;
|
||||
}
|
||||
return item;
|
||||
});
|
||||
that.$set(that.cartList, 'valid', newValid);
|
||||
that.selectValue = selectValue;
|
||||
that.switchSelect();
|
||||
}
|
||||
@@ -534,23 +564,59 @@
|
||||
let that = this;
|
||||
let value = event.detail.value;
|
||||
let valid = that.cartList.valid;
|
||||
for (let index in valid) {
|
||||
if (that.inArray(valid[index].id, value)){
|
||||
if(valid[index].attrStatus){
|
||||
valid[index].checked = true;
|
||||
}else{
|
||||
valid[index].checked = false;
|
||||
let arr1 = [];
|
||||
let arr2 = [];
|
||||
let arr3 = [];
|
||||
let newValid = valid.map(item => {
|
||||
if (that.inArray(item.id, value)) {
|
||||
if (that.footerswitch) {
|
||||
if (item.attrStatus) {
|
||||
item.checked = true;
|
||||
arr1.push(item);
|
||||
} else{
|
||||
item.checked = false;
|
||||
}
|
||||
} else{
|
||||
item.checked = true;
|
||||
arr1.push(item);
|
||||
}
|
||||
} else {
|
||||
valid[index].checked = false;
|
||||
}
|
||||
} else{
|
||||
item.checked = false;
|
||||
arr2.push(item);
|
||||
}
|
||||
return item;
|
||||
});
|
||||
if (that.footerswitch) {
|
||||
arr3 = arr2.filter(item => !item.attrStatus);
|
||||
}
|
||||
that.$set(that.cartList, 'valid', valid);
|
||||
let newArr = that.cartList.valid.filter(item => item.attrStatus);
|
||||
that.isAllSelect = value.length == newArr.length;
|
||||
that.$set(that.cartList, 'valid', newValid);
|
||||
// let newArr = that.cartList.valid.filter(item => item.attrStatus);
|
||||
that.isAllSelect = newValid.length === arr1.length + arr3.length;
|
||||
that.selectValue = value;
|
||||
console.log(that.selectValue)
|
||||
that.switchSelect();
|
||||
},
|
||||
// checkboxChange: function(event) {
|
||||
// let that = this;
|
||||
// let value = event.detail.value;
|
||||
// let valid = that.cartList.valid;
|
||||
// for (let index in valid) {
|
||||
// if (that.inArray(valid[index].id, value)){
|
||||
// if(valid[index].attrStatus){
|
||||
// valid[index].checked = true;
|
||||
// }else{
|
||||
// valid[index].checked = false;
|
||||
// }
|
||||
// } else {
|
||||
// valid[index].checked = false;
|
||||
// }
|
||||
// }
|
||||
// that.$set(that.cartList, 'valid', valid);
|
||||
// let newArr = that.cartList.valid.filter(item => item.attrStatus);
|
||||
// that.isAllSelect = value.length == newArr.length;
|
||||
// that.selectValue = value;
|
||||
// that.switchSelect();
|
||||
// },
|
||||
inArray: function(search, array) {
|
||||
for (let i in array) {
|
||||
if (array[i] == search) {
|
||||
@@ -755,6 +821,33 @@
|
||||
manage: function() {
|
||||
let that = this;
|
||||
that.footerswitch = !that.footerswitch;
|
||||
let arr1 = [];
|
||||
let arr2 = [];
|
||||
let newValid = that.cartList.valid.map(item => {
|
||||
if (that.footerswitch) {
|
||||
if (item.attrStatus) {
|
||||
if (item.checked) {
|
||||
arr1.push(item.id);
|
||||
}
|
||||
} else{
|
||||
item.checked = false;
|
||||
arr2.push(item);
|
||||
}
|
||||
} else {
|
||||
if (item.checked) {
|
||||
arr1.push(item.id);
|
||||
}
|
||||
}
|
||||
return item;
|
||||
});
|
||||
that.cartList.valid = newValid;
|
||||
if (that.footerswitch) {
|
||||
that.isAllSelect = newValid.length === arr1.length + arr2.length;
|
||||
} else{
|
||||
that.isAllSelect = newValid.length === arr1.length;
|
||||
}
|
||||
that.selectValue = arr1;
|
||||
that.switchSelect();
|
||||
},
|
||||
unsetCart: function() {
|
||||
let that = this,
|
||||
@@ -780,7 +873,7 @@
|
||||
that.getCartList();
|
||||
}
|
||||
if (that.cartList.valid.length == 0 && that.cartList.invalid.length == 0) {
|
||||
that.getHostProduct();
|
||||
// that.getHostProduct();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,12 +17,37 @@
|
||||
<block v-for="(item,index) in cartList.valid" :key="index">
|
||||
<view class='item acea-row row-between-wrapper'>
|
||||
<!-- #ifndef MP -->
|
||||
<checkbox :value="(item.id).toString()" :checked="item.checked" />
|
||||
<checkbox :value="(item.id).toString()" :checked="item.checked" :disabled="!item.attrStatus && footerswitch" />
|
||||
<!-- <checkbox :value="(item.id).toString()" :checked="item.checked" /> -->
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<checkbox :value="item.id" :checked="item.checked" />
|
||||
<checkbox :value="item.id" :checked="item.checked" :disabled="!item.attrStatus && footerswitch" />
|
||||
<!-- <checkbox :value="item.id" :checked="item.checked" /> -->
|
||||
<!-- #endif -->
|
||||
<navigator :url='"/pages/goods_details/index?id="+item.product_id' hover-class='none' class='picTxt acea-row row-between-wrapper'>
|
||||
<view class='pictrue'>
|
||||
<image v-if="item.productInfo.attrInfo" :src='item.productInfo.attrInfo.image'></image>
|
||||
<image v-else :src='item.productInfo.image'></image>
|
||||
</view>
|
||||
<view class='text'>
|
||||
<view class='line1' :class="item.attrStatus?'':'reColor'">{{item.productInfo.store_name}}</view>
|
||||
<view class='infor line1' v-if="item.productInfo.attrInfo">属性:{{item.productInfo.attrInfo.suk}}</view>
|
||||
<view class='money' v-if="item.attrStatus">¥{{item.truePrice}}</view>
|
||||
<view class="reElection acea-row row-between-wrapper" v-else>
|
||||
<view class="title">请重新选择商品规格</view>
|
||||
<view class="reBnt cart-color acea-row row-center-wrapper" @click.stop="reElection(item)">重选</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='carnum acea-row row-center-wrapper' v-if="item.attrStatus">
|
||||
<view class="reduce" :class="item.numSub ? 'on' : ''" @click.stop='subCart(index)'>-</view>
|
||||
<view class='num'>{{item.cart_num}}</view>
|
||||
<!-- <view class="num">
|
||||
<input type="number" v-model="item.cart_num" @click.stop @input="iptCartNum(index)" @blur="blurInput(index)"/>
|
||||
</view> -->
|
||||
<view class="plus" :class="item.numAdd ? 'on' : ''" @click.stop='addCart(index)'>+</view>
|
||||
</view>
|
||||
</navigator>
|
||||
<!-- <navigator :url='"/pages/goods_details/index?id="+item.product_id' hover-class='none' class='picTxt acea-row row-between-wrapper'>
|
||||
<view class='pictrue'>
|
||||
<image v-if="item.productInfo.attrInfo" :src='item.productInfo.attrInfo.image'></image>
|
||||
<image v-else :src='item.productInfo.image'></image>
|
||||
@@ -35,12 +60,9 @@
|
||||
<view class='carnum acea-row row-center-wrapper'>
|
||||
<view class="reduce" :class="item.numSub ? 'on' : ''" @click.stop='subCart(index)'>-</view>
|
||||
<view class='num'>{{item.cart_num}}</view>
|
||||
<!-- <view class="num">
|
||||
<input type="number" v-model="item.cart_num" @click.stop @input="iptCartNum(index)" @blur="blurInput(index)"/>
|
||||
</view> -->
|
||||
<view class="plus" :class="item.numAdd ? 'on' : ''" @click.stop='addCart(index)'>+</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</navigator> -->
|
||||
</view>
|
||||
</block>
|
||||
</checkbox-group>
|
||||
@@ -70,6 +92,12 @@
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<view class='loadingicon acea-row row-center-wrapper' v-if="cartList.valid.length&&!loadend">
|
||||
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
|
||||
</view>
|
||||
<view class='loadingicon acea-row row-center-wrapper' v-if="cartList.invalid.length&&loadend">
|
||||
<text class='loading iconfont icon-jiazai' :hidden='loadingInvalid==false'></text>{{loadTitleInvalid}}
|
||||
</view>
|
||||
</view>
|
||||
<view class='noCart' v-if="cartList.valid.length == 0 && cartList.invalid.length == 0">
|
||||
<view class='pictrue'>
|
||||
@@ -81,7 +109,7 @@
|
||||
<view class='footer acea-row row-between-wrapper' v-if="cartList.valid.length > 0">
|
||||
<view>
|
||||
<checkbox-group @change="checkboxAllChange">
|
||||
<checkbox value="all" :checked="!!isAllSelect" /><text class='checkAll'>全选 ({{cartCount}})</text>
|
||||
<checkbox value="all" :checked="!!isAllSelect" /><text class='checkAll'>全选 ({{selectValue.length}})</text>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
<view class='money acea-row row-middle' v-if="footerswitch==true">
|
||||
@@ -152,7 +180,29 @@
|
||||
isShowAuth: false, //是否隐藏授权
|
||||
hotScroll:false,
|
||||
hotPage:1,
|
||||
hotLimit:10
|
||||
hotLimit:10,
|
||||
|
||||
loading: false,
|
||||
loadend: false,
|
||||
loadTitle: '加载更多', //提示语
|
||||
page: 1,
|
||||
limit: 20,
|
||||
loadingInvalid: false,
|
||||
loadendInvalid: false,
|
||||
loadTitleInvalid: '加载更多', //提示语
|
||||
pageInvalid: 1,
|
||||
limitInvalid: 20,
|
||||
attr: {
|
||||
cartAttr: false,
|
||||
productAttr: [],
|
||||
productSelect: {}
|
||||
},
|
||||
productValue: [], //系统属性
|
||||
storeInfo: {},
|
||||
attrValue: '', //已选属性
|
||||
attrTxt: '请选择', //属性页面提示
|
||||
cartId: 0,
|
||||
product_id: 0
|
||||
};
|
||||
},
|
||||
computed: mapGetters(['isLogin']),
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<view class='item'><text class='iconfont icon-xuanzhong'></text>售后无忧</view>
|
||||
</view>
|
||||
<view class='nav acea-row row-between-wrapper'>
|
||||
<view>{{footerswitch}}购物车 <text class='num font-color'>{{cartCount}}</text></view>
|
||||
<view>购物数量 <text class='num font-color'>{{cartCount}}</text></view>
|
||||
<view v-if="cartList.valid.length > 0 || cartList.invalid.length > 0" class='administrate acea-row row-center-wrapper'
|
||||
@click='manage'>{{ footerswitch ? '管理' : '取消'}}</view>
|
||||
</view>
|
||||
@@ -17,10 +17,10 @@
|
||||
<block v-for="(item,index) in cartList.valid" :key="index">
|
||||
<view class='item acea-row row-between-wrapper'>
|
||||
<!-- #ifndef MP -->
|
||||
<checkbox :value="(item.id).toString()" :checked="item.checked" :disabled="item.attrStatus || !footerswitch ?false:true" />
|
||||
<checkbox :value="(item.id).toString()" :checked="item.checked" :disabled="item.attrStatus?false:true" />
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<checkbox :value="item.id" :checked="item.checked" :disabled="item.attrStatus || !footerswitch ?false:true" />
|
||||
<checkbox :value="item.id" :checked="item.checked" :disabled="item.attrStatus?false:true" />
|
||||
<!-- #endif -->
|
||||
<navigator :url='"/pages/goods_details/index?id="+item.productId' hover-class='none' class='picTxt acea-row row-between-wrapper'>
|
||||
<view class='pictrue'>
|
||||
@@ -28,15 +28,15 @@
|
||||
<image v-else :src='item.productInfo.image'></image>
|
||||
</view>
|
||||
<view class='text'>
|
||||
<view class='line1' :class="item.trueStock || item.trueStock > 0 ?'':'reColor'">{{item.productInfo.storeName}}</view>
|
||||
<view class='line1' :class="item.attrStatus?'':'reColor'">{{item.productInfo.storeName}}</view>
|
||||
<view class='infor line1' v-if="item.productInfo.attrInfo">属性:{{item.productInfo.attrInfo.suk}}</view>
|
||||
<view class='money' v-if="item.trueStock || item.trueStock > 0 ">¥{{item.truePrice}}</view>
|
||||
<view class="reElection acea-row row-between-wrapper" v-if="!item.trueStock || item.trueStock === 0 ">
|
||||
<view class='money' v-if="item.attrStatus">¥{{item.truePrice}}</view>
|
||||
<view class="reElection acea-row row-between-wrapper" v-else>
|
||||
<view class="title">请重新选择商品规格</view>
|
||||
<view class="reBnt cart-color acea-row row-center-wrapper" @click.stop="reElection(item)">重选</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='carnum acea-row row-center-wrapper' v-if="item.trueStock || item.trueStock > 0 ">
|
||||
<view class='carnum acea-row row-center-wrapper' v-if="item.attrStatus">
|
||||
<view class="reduce" :class="item.numSub ? 'on' : ''" @click.stop='subCart(index)'>-</view>
|
||||
<view class='num'>{{item.cartNum}}</view>
|
||||
<!-- <view class="num">
|
||||
@@ -83,14 +83,13 @@
|
||||
</view>
|
||||
<view class='noCart' v-if="cartList.valid.length == 0 && cartList.invalid.length == 0">
|
||||
<view class='pictrue'>
|
||||
<image src='../columnGoods/static/noCart.png'></image>
|
||||
<image src='../../static/images/noCart.png'></image>
|
||||
</view>
|
||||
<recommend :hostProduct='hostProduct'></recommend>
|
||||
</view>
|
||||
<view style='height:120rpx;color: #F5F5F5;'>{{selectCountPrice}}</view>
|
||||
<view class='footer acea-row row-between-wrapper' v-if="cartList.valid.length > 0">
|
||||
<view>
|
||||
{{isAllSelect}}
|
||||
<checkbox-group @change="checkboxAllChange">
|
||||
<checkbox value="all" :checked="!!isAllSelect" /><text class='checkAll'>全选 ({{cartCount}})</text>
|
||||
</checkbox-group>
|
||||
@@ -190,8 +189,7 @@
|
||||
attrValue: '', //已选属性
|
||||
attrTxt: '请选择', //属性页面提示
|
||||
cartId: 0,
|
||||
product_id: 0,
|
||||
delCheck: [] // 删除选中的
|
||||
product_id: 0
|
||||
};
|
||||
},
|
||||
computed: mapGetters(['isLogin']),
|
||||
@@ -234,7 +232,6 @@
|
||||
},
|
||||
this.isAllSelect = false; //全选
|
||||
this.selectValue = []; //选中的数据
|
||||
this.delCheck = [];
|
||||
this.selectCountPrice = 0.00;
|
||||
this.cartCount = 0;
|
||||
this.isShowAuth = false;
|
||||
@@ -281,7 +278,7 @@
|
||||
})
|
||||
.catch(res => {
|
||||
return that.$util.Tips({
|
||||
title: res.msg
|
||||
title: res
|
||||
});
|
||||
});
|
||||
},
|
||||
@@ -444,19 +441,18 @@
|
||||
subDel: function(event) {
|
||||
let that = this,
|
||||
selectValue = that.selectValue;
|
||||
|
||||
// if (selectValue.length > 0)
|
||||
// cartDel(selectValue).then(res => {
|
||||
// that.loadend = false;
|
||||
// that.page = 1;
|
||||
// that.cartList.valid = [];
|
||||
// that.getCartList();
|
||||
// that.getCartNum();
|
||||
// });
|
||||
// else
|
||||
// return that.$util.Tips({
|
||||
// title: '请选择产品'
|
||||
// });
|
||||
if (selectValue.length > 0)
|
||||
cartDel(selectValue).then(res => {
|
||||
that.loadend = false;
|
||||
that.page = 1;
|
||||
that.cartList.valid = [];
|
||||
that.getCartList();
|
||||
that.getCartNum();
|
||||
});
|
||||
else
|
||||
return that.$util.Tips({
|
||||
title: '请选择产品'
|
||||
});
|
||||
},
|
||||
getSelectValueProductId: function() {
|
||||
let that = this;
|
||||
@@ -477,16 +473,16 @@
|
||||
selectValue = that.selectValue;
|
||||
if (selectValue.length > 0) {
|
||||
let selectValueProductId = that.getSelectValueProductId();
|
||||
// collectAll(that.getSelectValueProductId()).then(res => {
|
||||
// return that.$util.Tips({
|
||||
// title: res.msg,
|
||||
// icon: 'success'
|
||||
// });
|
||||
// }).catch(err => {
|
||||
// return that.$util.Tips({
|
||||
// title: err
|
||||
// });
|
||||
// });
|
||||
collectAll(that.getSelectValueProductId()).then(res => {
|
||||
return that.$util.Tips({
|
||||
title: '收藏成功',
|
||||
icon: 'success'
|
||||
});
|
||||
}).catch(err => {
|
||||
return that.$util.Tips({
|
||||
title: err
|
||||
});
|
||||
});
|
||||
} else {
|
||||
return that.$util.Tips({
|
||||
title: '请选择产品'
|
||||
@@ -497,9 +493,9 @@
|
||||
let that = this,
|
||||
selectValue = that.selectValue;
|
||||
if (selectValue.length > 0) {
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/users/order_confirm/index?new=false&cartId=' + selectValue.join(',')
|
||||
// });
|
||||
uni.navigateTo({
|
||||
url: '/pages/users/order_confirm/index?new=false&cartId=' + selectValue.join(',')
|
||||
});
|
||||
} else {
|
||||
return that.$util.Tips({
|
||||
title: '请选择产品'
|
||||
@@ -521,18 +517,12 @@
|
||||
if (valid.length > 0) {
|
||||
for (let index in valid) {
|
||||
if (status == 1) {
|
||||
if(that.footerswitch){
|
||||
if(valid[index].attrStatus){
|
||||
valid[index].checked = true;
|
||||
selectValue.push(valid[index].id);
|
||||
}else{
|
||||
valid[index].checked = false;
|
||||
}
|
||||
}else{
|
||||
if(valid[index].attrStatus){
|
||||
valid[index].checked = true;
|
||||
selectValue.push(valid[index].id);
|
||||
}else{
|
||||
valid[index].checked = false;
|
||||
}
|
||||
|
||||
} else valid[index].checked = false;
|
||||
}
|
||||
that.$set(that.cartList, 'valid', valid);
|
||||
@@ -544,42 +534,21 @@
|
||||
let that = this;
|
||||
let value = event.detail.value;
|
||||
let valid = that.cartList.valid;
|
||||
//that.delCheck = value;
|
||||
for (let index in valid) {
|
||||
const item = valid[index]
|
||||
if (that.inArray(valid[index].id, value)){
|
||||
this.$set(item,'checked',true)
|
||||
}else{
|
||||
this.$set(item,'checked',false)
|
||||
}
|
||||
}
|
||||
// for (let index in valid) {
|
||||
// if (that.inArray(valid[index].id, value)){
|
||||
// // if(that.footerswitch && valid[index].trueStock){
|
||||
// // valid[index].checked = true;
|
||||
// // }else{
|
||||
// // valid[index].checked = true;
|
||||
// // }
|
||||
// if(that.footerswitch){
|
||||
// if(valid[index].attrStatus){
|
||||
// valid[index].checked = true;
|
||||
// }
|
||||
// else{
|
||||
// valid[index].checked = false;
|
||||
// }
|
||||
// }else{
|
||||
// valid[index].checked = true;
|
||||
|
||||
// }
|
||||
|
||||
// } else {
|
||||
// valid[index].checked = false;
|
||||
// }
|
||||
// }
|
||||
if (that.inArray(valid[index].id, value)){
|
||||
if(valid[index].attrStatus){
|
||||
valid[index].checked = true;
|
||||
}else{
|
||||
valid[index].checked = false;
|
||||
}
|
||||
} else {
|
||||
valid[index].checked = false;
|
||||
}
|
||||
}
|
||||
that.$set(that.cartList, 'valid', valid);
|
||||
let newArr = that.cartList.valid.filter(item => item.attrStatus);
|
||||
that.isAllSelect = value.length == newArr.length;
|
||||
that.selectValue = value
|
||||
that.selectValue = value;
|
||||
that.switchSelect();
|
||||
},
|
||||
inArray: function(search, array) {
|
||||
@@ -599,18 +568,13 @@
|
||||
that.selectCountPrice = selectCountPrice;
|
||||
} else {
|
||||
for (let index in validList) {
|
||||
// if ((validList[index].trueStock)) {
|
||||
// selectCountPrice = that.$util.$h.Add(selectCountPrice, that.$util.$h.Mul(validList[index].cartNum, validList[
|
||||
// index].truePrice))
|
||||
// }
|
||||
if (that.inArray(validList[index].id, selectValue) && validList[index].trueStock) {
|
||||
if (that.inArray(validList[index].id, selectValue)) {
|
||||
selectCountPrice = that.$util.$h.Add(selectCountPrice, that.$util.$h.Mul(validList[index].cartNum, validList[
|
||||
index].truePrice))
|
||||
}
|
||||
}
|
||||
that.selectCountPrice = selectCountPrice;
|
||||
}
|
||||
console.log(that.selectCountPrice)
|
||||
},
|
||||
/**
|
||||
* 购物车手动填写
|
||||
@@ -690,12 +654,9 @@
|
||||
isValid : true
|
||||
}
|
||||
getCartList(data).then(res => {
|
||||
//console.log(that.$util.toStringValue(res.data.list))
|
||||
let valid = res.data.list;
|
||||
let loadend = valid.length < that.limit;
|
||||
let validList = that.$util.SplitArray(valid, that.cartList.valid)
|
||||
//console.log(that.$util.toStringValue(validList))
|
||||
|
||||
let validList = that.$util.SplitArray(valid, that.cartList.valid);
|
||||
let numSub = [{
|
||||
numSub: true
|
||||
}, {
|
||||
@@ -709,8 +670,6 @@
|
||||
selectValue = [];
|
||||
if (validList.length > 0) {
|
||||
for (let index in validList) {
|
||||
that.$set(validList[index], 'id', validList[index].id.toString());
|
||||
//validList[index].id = validList[index].id.toString();
|
||||
if (validList[index].cartNum == 1) {
|
||||
validList[index].numSub = true;
|
||||
} else {
|
||||
@@ -734,19 +693,20 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('validList', validList)
|
||||
that.$set(that.cartList, 'valid', [...validList]);
|
||||
that.$set(that.cartList, 'valid', validList);
|
||||
that.loadend = loadend;
|
||||
that.loadTitle = loadend ? '我也是有底线的' : '加载更多';
|
||||
that.page = that.page + 1;
|
||||
that.loading = false;
|
||||
// that.goodsHidden = cartList.valid.length <= 0 ? false : true;
|
||||
that.selectValue = selectValue;
|
||||
that.delCheck = selectValue;
|
||||
let newArr = validList.filter(item => item.attrStatus);
|
||||
that.isAllSelect = newArr.length == selectValue.length && newArr.length;
|
||||
that.switchSelect();
|
||||
}).catch(function() {
|
||||
}).catch(function(err) {
|
||||
that.$util.Tips({
|
||||
title: err
|
||||
});
|
||||
that.loading = false;
|
||||
that.loadTitle = '加载更多';
|
||||
})
|
||||
@@ -795,59 +755,6 @@
|
||||
manage: function() {
|
||||
let that = this;
|
||||
that.footerswitch = !that.footerswitch;
|
||||
let valid = that.cartList.valid
|
||||
for (let index in valid) {
|
||||
if(that.footerswitch && !valid[index].attrStatus){
|
||||
that.$set(valid[index],'checked',false);
|
||||
//that.selectValue.splice(index, 1)
|
||||
}
|
||||
|
||||
}
|
||||
// for (let index in valid) {
|
||||
// for(let indexn in that.selectValue){
|
||||
// if((valid[index].id = that.selectValue[indexn]) && that.footerswitch && !valid[index].attrStatus && !valid[index].checked){
|
||||
// console.log(indexn)
|
||||
// //that.selectValue.splice(indexn, 1)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//that.$set(that.cartList, 'valid', valid);
|
||||
console.log(valid)
|
||||
// that.cartList.valid.map(item => {
|
||||
// if(item.checked){
|
||||
// that.$set(that.selectValue, item.id);
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// let selectValue = []
|
||||
// that.cartList.valid.map(item => {
|
||||
// // if(!item.trueStock){
|
||||
// // console.log('trueStock', item.trueStock)
|
||||
// // if(that.footerswitch){
|
||||
// // that.$set(item, 'attrStatus', false);
|
||||
// // that.$set(item, 'checked', false);
|
||||
// // console.log('item', item)
|
||||
// // }else{
|
||||
// // that.$set(item, 'attrStatus', true);
|
||||
// // }
|
||||
// // }
|
||||
// // if(!item.trueStock && !that.footerswitch){
|
||||
// // that.$set(item, 'attrStatus', true);
|
||||
// // }
|
||||
|
||||
// if(that.footerswitch){
|
||||
// if(!item.trueStock || item.trueStock === 0){
|
||||
// that.$set(item, 'attrStatus', false);
|
||||
// that.$set(item, 'checked', false);
|
||||
// }
|
||||
// }else{
|
||||
// console.log('lala', that.footerswitch)
|
||||
// if(!item.trueStock || item.trueStock === 0) {
|
||||
// that.$set(item, 'attrStatus', true);
|
||||
// selectValue.push(item.id);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
},
|
||||
unsetCart: function() {
|
||||
let that = this,
|
||||
|
||||
Reference in New Issue
Block a user