twt 3 anos atrás
pai
commit
a7af375207

+ 16 - 19
pages/homePage/allDiscountCard.vue

@@ -44,7 +44,8 @@
 		</view>
 
 		<view class="bottomViewBtn" v-if="itemData.length!=0">
-			<view class="saveCar" @click="alllingqu">一键领取</view>
+			<view class="saveCar" @click="alllingqu" v-if="allHave==false">一键领取</view>
+			<view class="saveCar" style="background-color: #FF9566;" v-else>已全部领取</view>
 		</view>
 
 		<!-- 上拉 加载更多 -->
@@ -66,7 +67,7 @@
 				itemData: [],
 				page: 1,
 				noMoreShow: false,
-
+				allHave:true,
 			}
 		},
 		onLoad(opt) {
@@ -75,22 +76,7 @@
 
 		},
 		methods: {
-			lingqu() {
-
-				uni.showLoading({
-					title: '领取中'
-				})
-				this.$http('worldKeepCar/keepCarMy/listTCouponPage', {
-
-					page: this.page,
-					limit: 10,
-				}, 'GET').then(res => {
-					uni.hideLoading();
-					
-					
-				})
-
-			},
+			
 			lingqu(item, index) {
 				uni.showLoading({
 					title: '领取中'
@@ -121,6 +107,7 @@
 					uni.hideLoading();
 					if (res.code==0) {
 						this.myOrderCoupon()
+						this.allHave = true
 						uni.showToast({
 							title: '领取成功',
 							icon: 'success',
@@ -159,6 +146,16 @@
 					} else {
 						this.noMoreShow = false
 					}
+					
+					if (this.itemData.length != 0) {
+						this.itemData.forEach((item, index) => {
+							if (item.pickNum <= 0) {
+								this.allHave = false
+							}
+						})
+					}
+					
+					
 					
 				})
 			},
@@ -309,7 +306,7 @@
 
 	.saveCar {
 
-		background: linear-gradient(135deg, #FD5300 0%, #FF270A 100%);
+		background-color: #FF4F00;
 		margin: 23rpx 30rpx;
 		height: 74rpx;
 		line-height: 74rpx;

+ 47 - 12
pages/module/maintain.vue

@@ -208,7 +208,7 @@ export default {
 		var replaceData=uni.getStorageSync("replaceData");
 		
 		if(replaceData){
-			replaceData.qty=1;
+			//replaceData.qty=1;
 			console.log(replaceData)
 			//console.log(this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll.goodsList[this.replaceIndex2])
 			this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2].goodsList.unshift(replaceData)
@@ -505,12 +505,48 @@ export default {
 											goods.goodsGroupDetail.forEach((tgoods,tindex)=>{
 											    var addArr=JSON.parse(JSON.stringify(goods.goodsList))
 												if(tindex==0){
-													if(referenceDosageQty>tgoods.capacity){
-														var parseIntNum=parseInt(referenceDosageQty/tgoods.capacity)
-														tgoods.qty=parseIntNum
+													if(tgoods.capacity){
+														if(referenceDosageQty>tgoods.capacity){
+															//console.log("referenceDosageQty>tgoods.capacity")
+															var parseIntNum=parseInt(referenceDosageQty/tgoods.capacity)
+															//console.log("parseIntNum--"+parseIntNum)
+															tgoods.qty=parseIntNum
+															addArr.unshift(tgoods)
+															var reduce= tgoods.capacity*parseIntNum
+															referenceDosageQty=referenceDosageQty - reduce
+															var addDta={
+																goodsGroupDetail:[],
+																goodsList:addArr,
+																del:true,
+															}
+															addDta.goodsList.forEach(add=>{
+																add.del=true;
+															}) 
+																											
+															list.listGoodsAll.splice(index, 1,addDta)
+														}else{
+															console.log("推荐大于容量")
+															if(goods.goodsGroupDetail.length==1){
+																console.log("同组品 一个")
+																addArr.unshift(tgoods)
+																referenceDosageQty=referenceDosageQty-tgoods.capacity
+																var addDta={
+																	goodsGroupDetail:[],
+																	goodsList:addArr,
+																	del:true,
+																}
+																addDta.goodsList.forEach(add=>{
+																	add.del=true;
+																}) 
+																												
+																list.listGoodsAll.splice(index, 1,addDta)
+															}else{
+																list.listGoodsAll.splice(index, 1)
+															}
+															
+														}
+													}else{
 														addArr.unshift(tgoods)
-														var reduce= tgoods.capacity*parseIntNum
-														referenceDosageQty=referenceDosageQty - reduce
 														var addDta={
 															goodsGroupDetail:[],
 															goodsList:addArr,
@@ -521,17 +557,13 @@ export default {
 														}) 
 																										
 														list.listGoodsAll.splice(index, 1,addDta)
-													}else{
-														if(goods.goodsGroupDetail.length==1){
-															addArr.unshift(tgoods)
-															referenceDosageQty=referenceDosageQty-tgoods.capacity
-														}
-														
 													}
 													
 													
 													
+													
 												}else{
+													if(goods.goodsGroupDetail[0].capacity){
 													
 													if(referenceDosageQty>0){
 														console.log('referenceDosageQty'+referenceDosageQty)
@@ -605,6 +637,9 @@ export default {
 													}
 													
 													
+													}
+													
+													
 												}
 												
 											

BIN
static/img/tablehome1.png


BIN
static/img/tablehome2.png