Ver código fonte

Merge branch 'developerA' of git.caimei365.com:caimei-repository/caimei-applets-caimei into developerA

zhengjinyi 5 anos atrás
pai
commit
1dce3e0213
2 arquivos alterados com 42 adições e 21 exclusões
  1. 40 18
      pages/goods/cart.vue
  2. 2 3
      pages/tabBar/cart/cart.vue

+ 40 - 18
pages/goods/cart.vue

@@ -67,7 +67,7 @@
 									<!--选择商品-->
 									<view class="checkbox-box" @click.stop="ischeckFailure(failure)" v-if="isshowDelbtn">
 										<button class="checkbox iconfont" 
-										:disabled="!isshowDelbtn"
+										:disabled="!isCheckAll"
 										:class="[failure.productsChecked ?'icon-gouxuanl':'icon-weigouxuan']">
 									</button>
 									</view>
@@ -224,7 +224,7 @@
 					this.skeletonShow = false
 					this.$store.commit('updateAllNum',response.data.cartQuantity)
 					const responseData = response.data
-					if(responseData.pageDate.length > 0 || responseData.failureList.length>0){
+					if(responseData.pageDate.length > 0 || responseData.failureList.length > 0){
 						this.isEmpty =false
 					}else{
 						this.isEmpty =true
@@ -314,6 +314,7 @@
 				let goodsCheckedLength = 0,
 					disabledListLength = 0,
 					goodsList = this.goodsList;
+					
 				goodsList.forEach(item => {
 					if(item.checked) {
 						goodsCheckedLength++;
@@ -346,6 +347,10 @@
 						pros.productsChecked = false;
 					}
 				})
+				//删除按钮 全选包括失效商品勾选
+				this.failureList.forEach(failureItem=>{
+					failureItem.productsChecked = !failureItem.productsChecked;
+				})
 			},
 			updateBothCheckBtn() {
 				if(this.isshowDelbtn) {
@@ -354,6 +359,7 @@
 						item.checked = this.isCheckAll;
 						this.setProductChecked(item);
 					})
+					
 				} else {
 					this.goodsList.forEach((item)=>{
 						item.checked = this.isCheckAll && !item.isDisabled;
@@ -445,7 +451,7 @@
 			},
 			changeCountSub(item,pros){//商品数量减减
 				if(pros.productCount<=pros.minBuyNumber){
-					pros.productCount = pros.minBuyNumber
+					pros.productCount= pros.minBuyNumber
 					this.$util.msg(`该商品最小起订量为${pros.minBuyNumber}`,2000);
 					return
 				}else{
@@ -504,25 +510,36 @@
 					this.$util.msg("请先选择结算商品~",2000);
 					return
 				}else{
-					/**
-					 * @获取勾选的商品ID拼接字符串逗号隔开,最后一个逗号去掉
-					 * @获取勾选的商品分类ID拼接字符串格式逗号隔开,最后一个逗号去掉
-					 */
-					let productID = '';
+					this.isNoConfim = false
 					this.goodsList.forEach(el=>{
 						el.productsList.forEach(pros=>{
 							if(pros.productsChecked){
-							   productID += pros.productID+','
+							   if(pros.productCount<pros.minBuyNumber){
+								   this.isNoConfim = true
+							   }
 							}
 						})
 					})
-					let cartPramsData={
-							allPrice:this.allPrice,
-							allCount:this.allCount,
-							productID:productID.substring(0,productID.lastIndexOf(',')),
-							productCount:''
+					if(this.isNoConfim){
+						this.$util.modal('','有商品的购买量没达到最小起订量,请修改数量后再次提交结算','去修改','',false,() =>{})
+						return;
+					}else{
+						let productID = '';
+						this.goodsList.forEach(el=>{//获取勾选的商品ID拼接字符串逗号隔开,最后一个逗号去掉
+							el.productsList.forEach(pros=>{
+								if(pros.productsChecked){
+								   productID += pros.productID+','
+								}
+							})
+						})
+						let cartPramsData={
+								allPrice:this.allPrice,
+								allCount:this.allCount,
+								productID:productID.substring(0,productID.lastIndexOf(',')),
+								productCount:''
+						    }
+						this.$api.navigateTo(`/pages/user/order/create-order?data=${JSON.stringify({data:cartPramsData})}`)
 					}
-					this.$api.navigateTo(`/pages/user/order/create-order?data=${JSON.stringify({data:cartPramsData})}`)
 				}
 			},
 			showDelManager(){//显示删除商品管理
@@ -531,7 +548,6 @@
 				if(this.isCheckAll) {
 					this.updateBothCheckBtn();	
 				} else {
-					// 失效也被勾选
 					this.goodsList.forEach(item => {
 						if(item.checked) {
 							item.productsList.forEach(pros => {
@@ -541,6 +557,7 @@
 					})
 					this.updateCheckAllBtn();
 				}
+				// 失效也被勾选
 				this.failureList.forEach(failureItem => {
 					if(failureItem.isFailureLayer){
 						failureItem.isFailureLayer = false
@@ -594,7 +611,8 @@
 				if(this.delGoodsList.length == 0){
 					this.$util.msg("请选择要删除的商品~",2000);
 					return
-				}else{				
+				}else{			
+					console.log(this.delGoodsList);
 					this.$util.modal('','确定删除选中的商品吗?','确定','取消',true,() =>{
 						shoppingCartDelete({userID:this.userID,productIDs:this.delGoodsList}).then(response =>{
 							this.$util.msg('删除成功',2000);
@@ -639,7 +657,11 @@
 				this.$api.navigateTo(`/pages/goods/product?id=${id}`)
 			},
 			failureToProduct(failure){
-				if(failure.failureState == 1 || failure.failureState == 2){
+				if(failure.failureState == 1){
+					this.$util.msg('商品已丢失,不能查看',2000)
+					return
+				}else if(failure.failureState == 2){
+					this.$util.msg('商品已停售,不能查看',2000)
 					return
 				}else{
 					this.isModallayer = true;

+ 2 - 3
pages/tabBar/cart/cart.vue

@@ -67,7 +67,7 @@
 									<!--选择商品-->
 									<view class="checkbox-box" @click.stop="ischeckFailure(failure)" v-if="isshowDelbtn">
 										<button class="checkbox iconfont" 
-										:disabled="!isshowDelbtn"
+										:disabled="!isCheckAll"
 										:class="[failure.productsChecked ?'icon-gouxuanl':'icon-weigouxuan']">
 									</button>
 									</view>
@@ -341,7 +341,7 @@
 				})
 				//删除按钮 全选包括失效商品勾选
 				this.failureList.forEach(failureItem=>{
-					failureItem.productsChecked = true;
+					failureItem.productsChecked = !failureItem.productsChecked;
 				})
 			},
 			updateBothCheckBtn() {
@@ -605,7 +605,6 @@
 					return
 				}else{			
 					console.log(this.delGoodsList);
-					debugger
 					this.$util.modal('','确定删除选中的商品吗?','确定','取消',true,() =>{
 						shoppingCartDelete({userID:this.userID,productIDs:this.delGoodsList}).then(response =>{
 							this.$util.msg('删除成功',2000);