xbx #300
@ -1,6 +1,6 @@
 | 
			
		||||
<template>
 | 
			
		||||
	<view class="c-coupon" v-if="goodsClass.length">
 | 
			
		||||
		<view :class="couponInfo.voucher_state != 1 ? 'coupon-unable' : 'coupon-usable'">
 | 
			
		||||
	<view class="c-coupon" v-if="goodsClass.length" @click="use">
 | 
			
		||||
		<view :class="couponInfo.voucher_state != 1 ? 'coupon-unable' : 'coupon-usable'" :style="{'width': type ? '650rpx' : '' }">
 | 
			
		||||
			<view class="info-type" :style="{ backgroundImage: 'url(' + (couponInfo.voucher_state == 1 ? '/static/image/mine/30.png' : '/static/image/mine/31.png') + ')', backgroundSize:'contain', backgroundRepeat: 'no-repeat' }">
 | 
			
		||||
				<div class="wrap_left_top" v-if="couponInfo.type == 1">{{ couponInfo.vouchertemplate_id == 1 ? '新人专享' : '平台优惠券' }}</div>
 | 
			
		||||
				<div class="wrap_left_top" v-else-if="couponInfo.type == 2">店铺优惠券</div>
 | 
			
		||||
@ -14,12 +14,13 @@
 | 
			
		||||
				<view class="info-integral">兑换积分:{{ couponInfo.voucher_points }}积分</view>
 | 
			
		||||
				<view class="info-date">有效期{{ couponInfo.voucher_startdate }}-{{ couponInfo.voucher_enddate }}</view>
 | 
			
		||||
			</view>
 | 
			
		||||
			<view class="coupon-btn">
 | 
			
		||||
				<text v-if="couponInfo.voucher_state == 1" @click="use">立即使用</text>
 | 
			
		||||
			<view class="coupon-btn" :style="{'right': type ? '110rpx' : '' }">
 | 
			
		||||
				<text v-if="couponInfo.voucher_state == 1">立即使用</text>
 | 
			
		||||
				<image v-if="couponInfo.voucher_state == 2" src="/static/image/mine/28.png"></image>
 | 
			
		||||
				<image v-if="couponInfo.voucher_state == 3" src="/static/image/mine/29.png"></image>
 | 
			
		||||
			</view>
 | 
			
		||||
		</view>
 | 
			
		||||
		<image v-if="type" style="width:35rpx;height:35rpx;margin-left:14rpx;" :src="'/static/image/mine/' + (sel ? '41.png' : '42.png') "></image>
 | 
			
		||||
	</view>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
@ -37,6 +38,8 @@ export default {
 | 
			
		||||
		status: Number,
 | 
			
		||||
		couponInfo: Object,
 | 
			
		||||
		goodsClass: Array,
 | 
			
		||||
		type:Boolean,
 | 
			
		||||
		sel:Boolean
 | 
			
		||||
	},
 | 
			
		||||
	created() {
 | 
			
		||||
		// console.log(this.goodsClass);
 | 
			
		||||
@ -53,6 +56,7 @@ export default {
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		use() {
 | 
			
		||||
			if(this.couponInfo.voucher_state != 1) return;
 | 
			
		||||
			this.$emit('use', this.couponInfo);
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
@ -63,6 +67,8 @@ export default {
 | 
			
		||||
	position: relative;
 | 
			
		||||
	z-index: 9;
 | 
			
		||||
	margin-bottom: 30rpx;
 | 
			
		||||
	display: flex;
 | 
			
		||||
	align-items: center;
 | 
			
		||||
	@mixin coupon-image($url) {
 | 
			
		||||
		width: 690rpx;
 | 
			
		||||
		height: 194rpx;
 | 
			
		||||
 | 
			
		||||
@ -70,13 +70,13 @@
 | 
			
		||||
			<scroll-view class="coupon-choose" scroll-y style="height: 50vh;" v-if="this.couponType.type == 1">
 | 
			
		||||
				<view class="title">优惠券详情</view>
 | 
			
		||||
				<view class="text">平台优惠券</view>
 | 
			
		||||
				<Coupon :couponInfo="coupon" @use="useCoupon($event)" :goodsClass="goodsClass" v-for="(coupon, index) in orderInfo.store_voucher_all_list" :key="index"></Coupon>
 | 
			
		||||
				<Coupon :couponInfo="coupon" @use="useCoupon($event)" :goodsClass="goodsClass" v-for="(coupon, index) in orderInfo.store_voucher_all_list" :key="index" :type="true" :sel="coupon.sel"></Coupon>
 | 
			
		||||
				<u-empty text="无可用优惠券" mode="coupon" v-if="!orderInfo.store_voucher_all_list.length" style="height: 200rpx"></u-empty>
 | 
			
		||||
			</scroll-view>
 | 
			
		||||
			<scroll-view class="coupon-choose" scroll-y style="height: 50vh;" v-if="this.couponType.type == 2">
 | 
			
		||||
				<view class="title">优惠券详情</view>
 | 
			
		||||
				<view class="text">店铺优惠券</view>
 | 
			
		||||
				<Coupon :couponInfo="coupon" @use="useCoupon($event)" :goodsClass="goodsClass" v-for="(coupon, index) in orderInfo.store_voucher_list[this.couponType.store_id]" :key="index"></Coupon>
 | 
			
		||||
				<Coupon :couponInfo="coupon" @use="useCoupon($event)" :goodsClass="goodsClass" v-for="(coupon, index) in orderInfo.store_voucher_list[this.couponType.store_id]" :key="index" :type="true" :sel="coupon.sel"></Coupon>
 | 
			
		||||
				<u-empty text="无可用优惠券" mode="coupon" v-if="!orderInfo.store_voucher_list[this.couponType.store_id].length" style="height: 200rpx"></u-empty>
 | 
			
		||||
			</scroll-view>
 | 
			
		||||
		</u-popup>
 | 
			
		||||
@ -282,15 +282,42 @@ export default {
 | 
			
		||||
			this.couponStatus = true;
 | 
			
		||||
		},
 | 
			
		||||
		useCoupon(coupon) {
 | 
			
		||||
			if(this.couponType.type == 1) this.choiceCoupon = coupon;
 | 
			
		||||
			console.log(coupon)
 | 
			
		||||
			
 | 
			
		||||
			
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
			if(this.couponType.type == 1){
 | 
			
		||||
 | 
			
		||||
				this.choiceCoupon = {}
 | 
			
		||||
				for(let i in this.orderInfo.store_voucher_all_list){
 | 
			
		||||
					if(this.orderInfo.store_voucher_all_list[i].voucher_id == coupon.voucher_id && !this.orderInfo.store_voucher_all_list[i].sel){
 | 
			
		||||
						this.orderInfo.store_voucher_all_list[i].sel = true
 | 
			
		||||
						this.choiceCoupon = coupon;
 | 
			
		||||
					}else{
 | 
			
		||||
						this.orderInfo.store_voucher_all_list[i].sel = false
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				this.$forceUpdate()	
 | 
			
		||||
			} 
 | 
			
		||||
			if(this.couponType.type == 2) {
 | 
			
		||||
				Object.assign(this.storeCoupon, {
 | 
			
		||||
					[this.couponType.store_id]: coupon
 | 
			
		||||
				})
 | 
			
		||||
				this.storeCoupon = {}
 | 
			
		||||
				for(let i in this.orderInfo.store_voucher_list[this.couponType.store_id]){
 | 
			
		||||
					console.log(this.orderInfo.store_voucher_list[this.couponType.store_id][i])
 | 
			
		||||
					if(this.orderInfo.store_voucher_list[this.couponType.store_id][i].voucher_id == coupon.voucher_id && !this.orderInfo.store_voucher_list[this.couponType.store_id][i].sel){
 | 
			
		||||
						this.orderInfo.store_voucher_list[this.couponType.store_id][i].sel = true
 | 
			
		||||
						Object.assign(this.storeCoupon, {
 | 
			
		||||
							[this.couponType.store_id]: coupon
 | 
			
		||||
						})
 | 
			
		||||
					}else{
 | 
			
		||||
						this.orderInfo.store_voucher_list[this.couponType.store_id][i].sel = false
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				this.$forceUpdate()	
 | 
			
		||||
			}
 | 
			
		||||
			// console.log(this.choiceCoupon);
 | 
			
		||||
			// console.log(this.storeCoupon);
 | 
			
		||||
			this.couponStatus = false;
 | 
			
		||||
			// this.couponStatus = false;
 | 
			
		||||
			this.setTotalPrice(); // 计算总价
 | 
			
		||||
		},
 | 
			
		||||
		getFreight() {
 | 
			
		||||
 | 
			
		||||
@ -43,7 +43,7 @@
 | 
			
		||||
	};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
<style lang="scss">
 | 
			
		||||
	page {
 | 
			
		||||
		background-color: #ECECEC;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 1008 B After Width: | Height: | Size: 1.4 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								static/image/mine/41.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								static/image/mine/41.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 3.8 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								static/image/mine/42.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								static/image/mine/42.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 2.3 KiB  | 
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user