zhengkaixin 3 лет назад
Родитель
Сommit
dd8dd7ca78

+ 53 - 11
pages/searchPile/chargeProcess/charge.vue

@@ -60,17 +60,31 @@
 			 <view class="discounts2">
 			 	<view class="left">
 			 		优惠券
-			 	</view>
-				<view class="right"  @click="chooseCoupons"  v-if="listlength">
-					未选择,剩余{{listlength}}张优惠券
+			 	</view>
+				<view class="right" @click="chooseCoupons"  v-if="selectObj.id">
+					{{selectObj.threshold == 0 ? '无门槛' : '满'+selectObj.threshold+'元可用'}},
+					
+					<span class="price" v-if="selectObj.classify == '1'">抵扣¥{{selectObj.value}}元</span>
+					<span class="price" v-if="selectObj.classify == '2'">可享{{selectObj.value*10}}折</span>
+					
+					<view class="iconfont">&#xe600;</view>
+				</view>
+				<view class="right"  @click="chooseCoupons"  v-else-if="listlength">
+					未选择,剩余{{listlength}}张优惠券
 					<view class="iconfont">&#xe600;</view>
 				</view>
-				<view class="right" v-else>
+				<view class="right" @click="chooseCoupons"   v-else>
 					无优惠券
 					<view class="iconfont">&#xe600;</view>
 				</view>
 				
 			 </view>
+			 <view style="color: rgba(153, 153, 153, 100);
+			 margin-top: 10px;
+			 font-size: 12px;
+			 text-align: left;
+			 font-family: AlibabaPuHui-regular;"><span style="color:red">*</span>{{couponsuse}}</view>
+			 
 			
 		</view>
 		<view class="bottom">
@@ -99,7 +113,8 @@
 			return {
 				isback:true,
 				moneyActiveClass: "20",
-				detail: {},
+				detail: {},
+				couponsuse:'',
 				//提交信息
 				submitForm: {
 					deviceNo: '',
@@ -135,6 +150,7 @@
 					},
 
 				],
+				selectObj:{},
 				value:"",
 				// 优惠券
 				listlength:0,
@@ -152,9 +168,22 @@
 			if(op.isback){
 				this.isback=false;
 			}
-			this.useCoupon()
+			this.useCoupon()
+			
+			var  couponsuse=this.carhelp.getConfig().couponsuse
+						// img="https://yktwechat.xiaoxinda.com/config/xxd2021.jpg"		
+			if(couponsuse){
+							this.couponsuse=couponsuse
+				}
 		},
-		onShow() {
+		onShow() {
+			var obj=this.carhelp.get("chooseCoupons");
+			if(obj){
+				if(obj.uuid==this.uuid){
+					this.selectObj=obj.selectObj;
+				}
+			}
+			
 			this.getHomePage()
 		},
 		methods: {
@@ -187,21 +216,34 @@
 					})
 				
 				}
-				
+				
+				this.selectJudge();
 
 			},
 			moneyClick(index) {
 				this.otherNum = ''
 				this.moneyActiveClass = index;
-			
+				this.selectJudge();
 
 			},
+			selectJudge(){
+				this.submitInit()
+				if(this.submitForm.amount==0){
+					return
+				}
+				if(this.selectObj.id&&this.selectObj.threshold>this.submitForm.amount){
+					uni.showToast({
+						title:"请重新选择优惠券"
+					})
+					this.selectObj={}
+				}
+			},
 			radioChange(e){},
 			confirm() {
 
 				//console.log(JSON.stringify(this.submitForm))
-				if(this.value){
-					this.submitForm.userCouponId=this.value
+				if(this.selectObj.id){
+					this.submitForm.userCouponId=this.selectObj.id
 				}
 
 				uni.showLoading({

+ 70 - 11
pages/user/coupon/chooseCoupons.vue

@@ -6,13 +6,26 @@
 		 description="同类型优惠券只显示一张"></u-alert-tips>
 		
 		
-		<view class="list-item"  v-for="(item,index) in myCouponList" :key="item.id">
+		<view class="list-item"  
+		
+		v-for="(item,index) in myCouponList"
+		:style="item.chooseStatus == '0' ? 'opacity: 0.5':'' "
+		 @click="ckselectObj(item)"
+		 :key="item.id">
+			
+			<view 
+			:style="item.chooseStatus == '0' ? 'background-color:#9F9F9F':'' "
+			
+			class="voucher" v-if="item.classify == '1'">优惠券</view>
+			<view 
+			:style="item.chooseStatus == '0' ? 'background-color:#9F9F9F':'' "
 			
-			<view class="voucher" v-if="item.classify == '1'">优惠券</view>
-			<view class="voucher" v-if="item.classify == '2'">折扣卷</view>
-			<view class="checked">
+			class="voucher" v-if="item.classify == '2'">折扣卷</view>
+			<view class="checked" v-if="selectObj.id==item.id">
 				<img src="../../../static/img/选中.png" alt="">
 			</view>
+			
+			 
 			<view class="item-left">
 				<view class="title">
 					{{item.couponName}}
@@ -23,14 +36,20 @@
 			</view>
 			<view class="item-right">
 				
-					<view class="price" v-if="item.classify == '1'">¥{{item.value}}</view>
-					<view class="price" v-if="item.classify == '2'">{{item.value*10}}折</view>
+					<view class="price" 
+					 :style="item.chooseStatus == '0' ? 'color:#666':'' "
+					
+					v-if="item.classify == '1'">¥{{item.value}}</view>
+					<view class="price"
+					 :style="item.chooseStatus == '0' ? 'color:#666':'' "
+					 
+					 v-if="item.classify == '2'">{{item.value*10}}折</view>
 				 
 				  <view class="contidion">
-				  	{{item.threshold == 0 ? '无门槛' : '满'+item.threshold+'可用'}}
+				  	{{item.threshold == 0 ? '无门槛' : '满'+item.threshold+'可用'}}
 				  </view>
 			</view>
-			
+		
 		</view>
 		<u-divider  v-if="myCouponList.length > 0" style="padding-bottom: 80px;margin-top: 10px;">已经到底了</u-divider>
 		
@@ -41,12 +60,18 @@
 		
 	<view class="bottom">
 		<view class="text">
-			已选1张,预计可减
+			
 			<view class="num">
-				<text style="font-size: 14px;">¥</text><text>6</text>
+				 
+				<view class="price" v-if="selectObj.classify == '1'">抵扣¥{{selectObj.value}}元</view>
+				<view class="price" v-if="selectObj.classify == '2'">可享{{selectObj.value*10}}折</view>
+								 
 			</view>
 		</view>
-		<u-button class="confirm" >
+		<u-button 
+		:style="selectObj.id  ?'' : 'background-color:#9F9F9F'"
+		@click="submitBtn"
+		class="confirm" >
 			<span>确定</span>
 		</u-button>
 	</view>
@@ -63,6 +88,7 @@
 	export default{
 		data(){
 			return{
+				selectObj:{},
 				amount:0,
 				uuid:0,
 				myCouponList: [],
@@ -86,6 +112,27 @@
 				this.getCouponList();
 		},
 		methods:{
+			submitBtn(){
+				if(this.selectObj.id){
+					this.carhelp.set("chooseCoupons",{
+						uuid:this.uuid,
+						selectObj:this.selectObj
+					})
+					uni.navigateBack({
+						
+					})
+				}
+			},
+			ckselectObj(item){
+				if(item.chooseStatus==1){
+					this.selectObj=item;
+				}else{
+					uni.showToast({
+						title:"不满足使用条件"
+					})
+				}
+				
+			},
 			toConversion() {
 				uni.navigateTo({
 					url: '/pages/user/coupon/conversion'
@@ -207,6 +254,18 @@
 		}
 	}
 
+  .have-used{
+	  
+	  width: 54px;
+	  height: 54px;
+	  position: absolute;
+	  top: -12px;
+	 right: 0;
+	  img{
+		  width: 100%;
+		  height: 100%;
+	  }
+  }
 .bottom{
 	position: fixed;
 	bottom: 0;

+ 1 - 1
pages/user/coupon/myCoupon.vue

@@ -23,7 +23,7 @@
 						<view class="price" v-if="item.classify == '1'">¥{{item.value}}</view>
 						<view class="price" v-if="item.classify == '2'">{{item.value*10}}折</view>
 						<view class="price-condition">
-							{{item.threshold == 0 ? '无门槛' : '满'+item.threshold+'可用'}}
+							{{item.threshold == 0 ? '无门槛' : '满'+item.threshold+'可用'}}
 						</view>
 					</view>
 				</view>