Browse Source

commit -m 优惠券

zhengjinyi 3 years ago
parent
commit
3e62820b1a

+ 86 - 51
components/cm-module/cart-components/index.vue

@@ -121,13 +121,13 @@
 							</view>
 						
 							<view class="sum">
-								<view class="sum-price" :class="reducedPrice == 0 ? 'none' : ''">
+								<view class="sum-price" :class="isDiscount ? '' : 'none'">
 									总价:<text class="money-sign">¥</text><text class="money">{{allPrice | NumFormat}}</text>
 								</view>
-								<view class="sum-none"  v-if="reducedPrice>0">
+								<view class="sum-none"  v-if="isDiscount">
 									<!-- <text class="money-sign">¥</text> -->
 									<!-- <text class="money">{{ totalOriginalPrice | NumFormat }}</text> -->
-									<text class="money-reduced">共减<text>¥{{ reducedPrice | NumFormat}}</text></text>
+									<text class="money-reduced">共减<text>¥{{ totalDiscountAmount | NumFormat}}</text></text>
 									<text class="money-popup" @click="showPopup(1)">优惠明细<text class="iconfont icon-xiangshangjiantou"></text></text>
 								</view>
 							</view>
@@ -149,13 +149,13 @@
 								<view class="text">全选</view>
 							</view>
 							<view class="sum">
-								<view class="sum-price" :class="reducedPrice == 0 ? 'none' : ''">
+								<view class="sum-price" :class="isDiscount ? '' : 'none'">
 									总价:<text class="money-sign">¥</text><text class="money">{{allPrice | NumFormat}}</text>
 								</view>
-								<view class="sum-none" v-if="reducedPrice>0">
+								<view class="sum-none" v-if="isDiscount">
 									<!-- <text class="money-sign">¥</text> -->
 									<!-- <text class="money">{{ totalOriginalPrice | NumFormat }}</text> -->
-									<text class="money-reduced">共减<text>¥{{ reducedPrice | NumFormat}}</text></text>
+									<text class="money-reduced">共减<text>¥{{ totalDiscountAmount | NumFormat}}</text></text>
 									<text class="money-popup" @click="showPopup(1)">优惠明细<text class="iconfont icon-xiangshangjiantou"></text></text>
 								</view>
 							</view>
@@ -257,23 +257,23 @@
 					<view class="tui-popup-coupon">
 						<view class="tui-popup-h1">
 							<view class="tui-popup-text left">商品总额</view>
-							<view class="tui-popup-text right bold">¥4500.00</view>
+							<view class="tui-popup-text right bold">¥{{allPrice | NumFormat}}</view>
 						</view>
-						<view class="tui-popup-h1">
+						<view class="tui-popup-h1" v-if="reducedPrice>0">
 							<view class="tui-popup-text left">促销满减</view>
-							<view class="tui-popup-text right bold red">¥500.00</view>
+							<view class="tui-popup-text right bold red">-¥{{ reducedPrice | NumFormat}}</view>
 						</view>
-						<view class="tui-popup-h1">
+						<view class="tui-popup-h1" v-if="couponPrice>0">
 							<view class="tui-popup-text left">优惠券</view>
-							<view class="tui-popup-text right bold red">¥100.00</view>
+							<view class="tui-popup-text right bold red">-¥{{ couponPrice | NumFormat}}</view>
 						</view>
 						<view class="tui-popup-h1">
 							<view class="tui-popup-text left bold">共减</view>
-							<view class="tui-popup-text right bold red">¥600.00</view>
+							<view class="tui-popup-text right bold red">-¥{{ totalDiscountAmount | NumFormat }}</view>
 						</view>
 						<view class="tui-popup-h1">
 							<view class="tui-popup-text left bold">总计</view>
-							<view class="tui-popup-text right bold">¥3900.00</view>
+							<view class="tui-popup-text right bold">¥{{ (allPrice - totalDiscountAmount) | NumFormat }}</view>
 						</view>
 					</view>
 				</div>
@@ -318,14 +318,18 @@
 				failureList:[],							// 失效商品列表
 				goodsList:[],							// 购物车的商品
 				promotionsList:[],						// 促销列表
-				totalCouponList:[],							// 优惠券算列表	
+				totalCouponList:[],						// 优惠券算列表	
+				eligibleCoupons:[],						// 最终需要用到优惠券	
 				delGoodsList:'',						// 要删除的商品
 				setGoodData:'', 						// 确认订单的商品
 				isCheckAll:false,						// 是否全选
 				kindCount:0,							// 购物车宝贝数量
-				allPrice:0,								//	所有价格
+				allPrice:0,								// 所有价格
 				totalOriginalPrice:0,					// 所有原价价
 				reducedPrice:0,							// 满减
+				couponPrice:0,							// 优惠金额
+				totalDiscountAmount:0,					// 总共减去金额
+				isDiscount:false,						// 控制显示优惠明细
 				allCount:0,								// 被选中的产品数量
 				isModallayer:false,
 				skeletonShow:true,
@@ -409,6 +413,10 @@
 				this.skeletonShow = true //预加载圆圈
 				this.isCheckAll=false//是否全选
 				this.submitIds = []
+				this.couponPrice = 0
+				this.totalDiscountAmount = 0
+				this.isDiscount = false
+				this.eligibleCoupons = []
 				this.$api.getStorage().then((resolve) => {
 					this.userId = this.couponParam.userId = resolve.userId ? resolve.userId : 0;
 					this.initGetCartGoodsList();
@@ -688,14 +696,24 @@
 						}
 					}
 				});
-				// 计算优惠券
-				this.calculationCoupon()
 				// 最后统计商品原价
 				this.totalOriginalPrice = originalPrice;
 				// 最后满减金额 = 店铺减去金额 + 单品减去金额 + 凑单减去金额
 				this.reducedPrice = reducedPrice;
 				// 最终合计价格 = 	店铺满减合计 + 单品满减  + 正常合计 + 凑单满减			
 				this.allPrice = totalPrice ;
+				// 计算优惠券
+				if(this.totalCouponList.length>0){
+					this.calculationCoupon()
+				}
+				// 最后满减金额 = 店铺减去金额 + 单品减去金额 + 凑单减去金额
+				this.totalDiscountAmount = this.reducedPrice + this.couponPrice;
+				// 控制显示优惠明细
+				if(this.totalDiscountAmount > 0 ){
+					this.isDiscount = true
+				}else{
+					this.isDiscount = false
+				}
 			},
 			totalCount(){//计算总数量
 			    this.allCount = 0
@@ -714,45 +732,62 @@
 			    })
 			},		 
 			calculationCoupon(){// 优惠券计算
-				const checkedProList = []
+				const eligibleCoupons = [];
 				this.goodsList.forEach((shop,index)=>{
 					shop.cartList.forEach(pros=>{	
-						if(pros.productsChecked){								
-							checkedProList.push(pros)
+						if(pros.productsChecked){		
+							this.totalCouponList.map((coupon,index)=>{//循环优惠券
+								const couponType = coupon.couponType;
+								if(couponType == 0){// 活动券
+									if(coupon.productType == 1){// 活动券-全商城商品
+										if(this.allPrice>=coupon.touchPrice){
+											eligibleCoupons.push(coupon)
+											eligibleCoupons.sort((a,b)=> b.couponAmount - a.couponAmount )
+										}
+									}else if(coupon.productType == 2){// 活动券-指定商品
+										if(coupon.productIds && coupon.productIds.includes(pros.productId)){
+											if(this.allPrice>=coupon.touchPrice){
+												eligibleCoupons.push(coupon)
+												eligibleCoupons.sort((a,b)=> b.couponAmount - a.couponAmount )
+											}
+										}else{
+											return false
+										}
+									}
+								// 品类券适用于产品或者仪器,购买产品类或仪器类的商品,商品金额达到优惠标准即可使用优惠券	
+								}else if(couponType == 1){// 品类券 categoryType(commodityType) : 1 产品  2 仪器 
+									if( coupon.categoryType && coupon.categoryType == pros.commodityType){
+										if(this.allPrice>=coupon.touchPrice){
+											eligibleCoupons.push(coupon)
+											eligibleCoupons.sort((a,b)=> b.couponAmount - a.couponAmount )
+										}
+									}
+								// 适用于商城全部商品
+								}else if(couponType == 2 || couponType == 4){// 用户专享券和新用户券
+									if(this.allPrice>=coupon.touchPrice){
+										eligibleCoupons.push(coupon)
+										eligibleCoupons.sort((a,b)=> b.couponAmount - a.couponAmount )
+									}
+								// 店铺券适用于某个供应商的全部商品	
+								}else if(couponType == 3){// 店铺券 supplierId
+									if(coupon.shopId && pros.supplierId == coupon.shopId){
+										if(this.allPrice>=coupon.touchPrice){
+											eligibleCoupons.push(coupon)
+											eligibleCoupons.sort((a,b)=> b.couponAmount - a.couponAmount )
+										}
+									}
+								}
+							})
 						}	
 					})
 				})
-				console.log('checkedProList',checkedProList)
-				this.totalCouponList.map((coupon,index)=>{
-					const couponType = coupon.couponType
-					checkedProList.forEach(pros=>{	
-						if(couponType == 0){// 活动券
-							if(coupon.productType == 1){// 活动券-全商城商品
-								
-								
-								
-							}else if(coupon.productType == 2){// 活动券-指定商品
-								
-								
-								
-							}
-						}else if(couponType == 1){// 品类券 commodityType
-							
-							
-							
-							
-						}else if(couponType == 2 || couponType == 4){// 用户专享券和新用户券
-							
-							
-							
-							
-						}else if(couponType == 3){// 店铺券 supplierId
-							
-							
-							
-						}
-					})
-				})
+				if(eligibleCoupons.length>0){
+					this.eligibleCoupons.push(eligibleCoupons[0])
+					this.couponPrice = this.eligibleCoupons.sort((a,b)=> b.couponAmount - a.couponAmount)[0].couponAmount
+				}
+			},
+			checkenTotalPrice(){
+				
 			},
 			changeCountAdd(item,pros){//商品数量加加
 				if(pros.step === 2){

+ 45 - 85
components/cm-module/creatOrder/coupon.vue

@@ -2,7 +2,7 @@
 	<view class="coupon-template">
 		<view class="coupon-title" @tap.stop="showPopup">
 			<text class="text">优惠券:</text>
-			<text class="text-coupon">-¥20.00</text>
+			<text class="text-coupon">-¥{{ coupon.couponAmount | NumFormat }}</text>
 			<text class="iconfont icon-xiayibu"></text>
 		</view>
 		<!-- 优惠券 -->
@@ -14,14 +14,14 @@
 				</view>
 				<div class="tui-popup-main coupon">
 					<scroll-view class="tui-popup-scroll"  scroll-y="true">
-						<view v-for="(coupon,index) in dataList" :key="index" :id="coupon.id" class="coupon-list"  @click.stop="checkedCoupon(coupon,index)">
+						<view v-for="(coupon,index) in dataList" :key="index" class="coupon-list"  @click.stop="checkedCoupon(coupon,index)">
 							<view class="list-cell-le">
 								<view class="coupon-maxMoney">
 									<text class="small">¥</text>
-									{{ coupon.maxMoney }}
+									{{ coupon.couponAmount }}
 								</view>
 								<view class="coupon-minMoney">
-									满{{ coupon.minMoney }}可用
+									满{{ coupon.touchPrice }}可用
 								</view>
 							</view>
 							<view class="list-cell-ri">
@@ -31,9 +31,14 @@
 											<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
 										</view>
 										<view class="list-cell-texts">
-											<text v-if="coupon.useType == 1">{{ coupon.useType | TypeFormatText }}</text>
-											<text v-if="coupon.useType == 2">{{ coupon.useType | TypeFormatText }}</text>
-											<text v-if="coupon.useType == 3">{{ coupon.useType | TypeFormatText }}{{ coupon.couponText }}的商品</text>
+											<text v-if="coupon.couponType == 0">
+												{{ coupon.productType && coupon.productType == 1 ? '全商城商品通用' : '仅可购买指定商品'  }}
+											</text>
+											<text v-if="coupon.couponType == 1">
+												{{ coupon.categoryType == 1 ? '仅限购买产品类商品' : '仅限购买仪器类商品' }}
+											</text>
+											<text v-if="coupon.couponType == 3">仅限购买店铺【{{ coupon.shopName }}】的商品</text>
+											<text v-if="coupon.couponType == 4 || coupon.couponType == 2">全商城商品通用</text>
 										</view>
 									</view>
 									<view class="list-cell-btn">
@@ -45,7 +50,7 @@
 										</view>
 									</view>
 								</view>
-								<view class="list-cell-time">{{ coupon.couponTime }}</view>
+								<view class="list-cell-time">{{ coupon.endDate }}</view>
 							</view>
 						</view>
 					</scroll-view>
@@ -64,114 +69,58 @@
 	export default{
 		name:"coupon",
 		props:{
-			
+			couponList:{
+				type:Array
+			}
 		},
 		data() {
 			return{
 				popupShow:false,
 				isIphoneX:this.$store.state.isIphoneX,
 				checkedIndex:null,
-				dataList:[
-					{
-						maxMoney:5000,
-						minMoney:1000,
-						couponType:1,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:1,
-						couponBtnType:0,
-						ischecked:false
-					},
-					{
-						maxMoney:2000,
-						minMoney:200,
-						couponType:2,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:2,
-						couponBtnType:0,
-						ischecked:false
-					},
-					{
-						maxMoney:4000,
-						minMoney:800,
-						couponType:3,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:3,
-						couponBtnType:0,
-						ischecked:false
-					},
-					{
-						maxMoney:6000,
-						minMoney:1000,
-						couponType:4,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:1,
-						couponBtnType:0,
-						ischecked:false
-					},
-					{
-						maxMoney:6000,
-						minMoney:1000,
-						couponType:5,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:2,
-						couponBtnType:0,
-						ischecked:false
-					}
-				],
+				dataList:[],
+				coupon:{
+					couponAmount:0,
+					clubCouponId:0,
+				},
 			}
 		},
 		filters:{
 			NumFormat(value) {//处理金额
 				return Number(value).toFixed(2);
 			},
-		    totalprice(val,count){//单件商品的价格 × 数量
-		        return (val * count).toFixed(2)
-		    },
-			TypeFormat:function(value) {
+			TypeFormat(value) {
 				switch (value) {
-					case 1:
+					case 0:
 						return  '活动券';
 						break;
-					case 2:
+					case 1:
 						return  '品类券';
 						break;
+					case 2:
+						return  '用户专享券';
+						break;
 					case 3:
 						return  '店铺券';
 						break;
 					case 4:
-						return  '专享券';
-						break;
-					case 5:
 						return  '新用户券';
 						break;
 				}
-			},
-			TypeFormatText:function(value) {
-				switch (value) {
-					case 1:
-						return  '全商城商品通用';
-						break;
-					case 2:
-						return  '仅限购买仪器类商品';
-						break;
-					case 3:
-						return  '仅可购买店铺';
-						break;
-				}
 			}
 		},	
 		created(){
-			
+			this.initData(this.couponList)
 		},
 		computed: {
 
 		},
 		methods:{
+			initData(data){
+				data.forEach((el,index) => {
+					this.dataList.push(Object.assign({},el,{ischecked:false}))
+				})
+			},
 			checkedCoupon(coupon,idx){// 选择优惠券
 				this.checkedIndex = idx;
 				this.dataList.forEach((el,index) => {
@@ -181,7 +130,6 @@
 						el.ischecked = false
 					}
 				})
-				console.log('this.dataList===>',this.dataList)
 			},
 			showExchangePopup(){
 				this.popupShow = false
@@ -192,6 +140,18 @@
 			},
 			hidePopup(){
 				this.popupShow = false
+				let coupon = {
+						couponAmount:0,
+						clubCouponId:0,
+					};
+				this.dataList.forEach((el,index) => {
+					if(el.ischecked){
+						coupon.couponAmount = el.couponAmount
+						coupon.clubCouponId = el.clubCouponId
+					}
+				})
+				this.coupon = coupon
+				this.$emit('handleChoiceaCoupon',this.coupon);
 			}
 		}
 	}

+ 23 - 6
components/cm-module/creatOrder/exchangeCoupon.vue

@@ -9,7 +9,7 @@
 				</view>
 				<view class="text-content">
 					<view class="coupon-input">
-						<input class="input" type="text" v-model="params.couponCode" maxlength="16"  placeholder="请输入16位兑换码"/>
+						<input class="input" type="text" v-model="params.redemptionCode" maxlength="16"  placeholder="请输入16位兑换码"/>
 					</view>
 					<view class="coupon-main">
 						<view class="coupon-button" @click="exchangeConfirm">立即兑换</view>
@@ -37,22 +37,39 @@
 		data() {
 			return{
 				params:{
-					couponCode:'',
+					userId:0,
+					redemptionCode:'',
+					source:2,
 				},
 			}
 		},
 		created() {
-			
+			this.$api.getComStorage('userInfo').then((resolve) =>{
+				this.params.userId = resolve.userId ? resolve.userId : 0;
+			}).catch(error =>{
+				console.log('暂无用户信息~')
+			})
 		},
 		onLoad(){
 			
 		},
 		methods:{
-			exchangeConfirm(){
-				if( this.params.couponCode == ''){
+			exchangeConfirm(){// 立即兑换
+				if( this.params.redemptionCode == ''){
 					this.$util.msg('请输入位兑换码',2000)
 					return
 				}
+				this.ExchangeCoupon(this.params)
+			},
+			ExchangeCoupon(param){// 兑换优惠券
+				this.ProductService.ExchangeCoupon(param).then(response =>{
+					this.$parent.ExchangeCouponData = response.data
+					this.$parent.isExchangePopup = false
+					this.$parent.isCouponModel = true
+				})
+				.catch(error =>{
+					this.$util.msg(error.msg,2000);
+				})
 			},
 			hidePopup(){
 				this.$parent.isExchangePopup = false
@@ -136,7 +153,7 @@
 						line-height: 66rpx;
 						padding: 0 20rpx;
 						font-size: $font-size-26;
-						color: #b2b2b2;
+						color: #333333;
 						border-radius: 2rpx;
 					}
 				}

+ 2 - 2
components/cm-module/orderDetails/orderInformation.vue

@@ -42,8 +42,8 @@
 				<view class="information-view same" v-show="orderData.promotionFullReduction>0">
 					<view class="view-man" >促销满减:<label class="label">¥{{ orderData.promotionFullReduction | NumFormat}}</label></view>
 				</view>
-				<view class="information-view" v-show="orderData.promotionFullReduction>0">
-					<view class="view-man" >优惠券:<label class="label">¥{{ orderData.promotionFullReduction | NumFormat}}</label></view>
+				<view class="information-view" v-show="orderData.couponAmount>0">
+					<view class="view-man" >优惠券:<label class="label">¥{{ orderData.couponAmount | NumFormat}}</label></view>
 				</view>
 				<view class="information-view same" v-show="(orderData.presentCount + orderData.promotionalGiftsCount)>0">
 					<view class="view-man">赠品总数:<label class="label">{{ orderData.presentCount + orderData.promotionalGiftsCount}}</label></view>

+ 0 - 13
pages/user/coupon/coupon-exchange.vue

@@ -46,7 +46,6 @@
 					</view>
 					<view class="coupon-btn" @click.stop="handleClickCancel">立即收下</view>
 				</view>
-				<text class="iconfont icon-2guanbi"  @click.stop="handleClickCancel"></text>
 			</view>
 		</view>
 	</view>
@@ -312,18 +311,6 @@
 					font-size: $font-size-36;
 				}
 			}
-			.icon-2guanbi{
-				display: block;
-				width: 50rpx;
-				height: 50rpx;
-				line-height: 50rpx;
-				text-align: center;
-				color: #FFFFFF;
-				position: absolute;
-				top: 0;
-				right: 0;
-				font-size: 40rpx;
-			}
 		}
 	}
 </style>

+ 210 - 20
pages/user/order/create-order.vue

@@ -11,7 +11,11 @@
 					  @handleChoiceaInvoice="handleChoiceaInvoiceData">
 		</invoice-tent>
 		<!-- 优惠券选择弹窗 -->
-		<coupon ref="coupon" v-if="isRequest"></coupon>
+		<coupon ref="coupon" 
+				v-if="isCouponShow"
+				:couponList="couponList" 
+				@handleChoiceaCoupon="handleChoiceaCouponData">
+		</coupon>
 		<!-- 兑换优惠券弹窗 -->
 		<exchangeCoupon v-if="isExchangePopup"></exchangeCoupon>
 		<!-- 运费 -->
@@ -56,11 +60,11 @@
 					<text>共{{allCount}}件商品</text>
 				</view>
 				<view class="footer-price">
-					<view class="sum" :class="reducedPrice == 0 ? 'none' : ''">总价:<text class="price">¥{{payAllPrice | NumFormat}}</text></view>
-					<view class="sum-none" v-if="reducedPrice>0">
-						<!-- <text class="money-sign">¥</text> -->
-						<!-- <text class="money">{{ totalOriginalPrice | NumFormat }}</text> -->
-						<text class="money-reduced">减<text>¥{{ reducedPrice | NumFormat}}</text></text>
+					<view class="sum" :class="totalDiscountAmount == 0 ? 'none' : ''">
+						总价:<text class="price">¥{{payAllPrice | NumFormat}}</text>
+					</view>
+					<view class="sum-none" v-if="totalDiscountAmount > 0">
+						<text class="money-reduced">共减<text>¥{{ totalDiscountAmount  | NumFormat}}</text></text>
 					</view>
 				</view>
 			</view>
@@ -68,6 +72,39 @@
 				<view class="btn" :class="isSubLoading ? 'disabled' : ''" >提交订单</view>
 			</view>
 		</view>
+		<!-- 优惠券 -->
+		<view class="coupon-content-model" v-if="isCouponModel">
+			<view class="coupon-alert-content">
+				<view class="coupon">
+					<view class="coupon-list">
+						<view class="list-cell-tags">{{ ExchangeCouponData.couponType | TypeFormat }}</text></view>
+						<view class="list-cell-le">
+							<view class="coupon-maxMoney">
+								<text class="small">¥</text>
+								{{ ExchangeCouponData.couponAmount }}
+							</view>
+							<view class="coupon-minMoney">
+								<text class="txt">满{{ ExchangeCouponData.touchPrice }}可用</text>
+							</view>
+						</view>
+						<view class="list-cell-ri">
+							<view class="list-cell-top">
+								<text v-if="ExchangeCouponData.couponType == 0">
+									{{ ExchangeCouponData.productType && ExchangeCouponData.productType == 1 ? '全商城商品通用' : '仅可购买指定商品'  }}
+								</text>
+								<text v-if="ExchangeCouponData.couponType == 1">
+									{{ ExchangeCouponData.categoryType == 1 ? '仅限购买产品类商品' : '仅限购买仪器类商品' }}
+								</text>
+								<text v-if="ExchangeCouponData.couponType == 3">仅限购买店铺【{{ ExchangeCouponData.shopName }}】的商品</text>
+								<text v-if="ExchangeCouponData.couponType == 4 || ExchangeCouponData.couponType == 2">全商城商品通用</text>
+							</view>
+							<view class="list-cell-time">有效期:{{ ExchangeCouponData.endDate }}</view>
+						</view>
+					</view>
+					<view class="coupon-btn" @click.stop="handleClickCancel">立即收下</view>
+				</view>
+			</view>
+		</view>
 	</view>
 </template>
 
@@ -105,6 +142,8 @@
 				allCount:1,				  // 订单提交总数量
 				totalOriginalPrice:0,	  // 订单总原价(划线部分)
 				reducedPrice:0,			  // 满减金额
+				couponAmount:0,	  		  // 优惠券金额
+				totalDiscountAmount:0,	  // 共减金额
 				payAllPrice:0.00,		  // 订单提交总金额
 				allPrice:0.00,			  // 订单总金额
 				surplusMoney:0.00,		  // 显示勾选后的剩余抵扣
@@ -122,14 +161,19 @@
 				hanldFreight:'',		  // 邮费
 				addressData:{},			  // 初始化地址信息
 				goodsData:[],			  // 初始化商品信息
+				couponList:[],		  	  // 初始化优惠券信息
 				invoiceData:{type:0},	  // 初始化发票信息
 				freightData:{},			  // 邮费数据
 				orderInfo:[],			  // 提交的商品信息
 				payInfo:{},				  // 订单信息
+				clubCouponId:0,			  // 用户关联优惠Id
 				rechargeGoods:null,		  // 判断订单里有定金商品或者充值商品时,余额抵扣部分不显示
 				freightBeansMoney:0,	  // 存储采美豆抵扣金额
 				hanldUserBeans:0,		  // 抵扣的采美豆数	
+				isCouponShow:false,		  // 是否显示可选优惠券
 				isCheckedBeans:false,     // 是否抵扣采美豆
+				isCouponModel:false,	  // 兑换优惠券成功提示
+				ExchangeCouponData:{}	  // 兑换优惠券信息
 			}
 		},
 		onLoad(option){//商品数据
@@ -145,7 +189,7 @@
 			}
 			this.$api.getStorage().then((resolve) =>{
 				this.userID = resolve.userId ? resolve.userId : 0
-				this.getInitCrearOrder(option);
+				this.getInitCrearOrder();
 			})
 		},
 		filters:{
@@ -154,7 +198,7 @@
 			},
 		},	
 		methods: {
-			getInitCrearOrder(option){//获取订单商品信息
+			getInitCrearOrder(){//获取订单商品信息
 				this.OrderService.CreateOrderInfo({
 					userId:this.userID,
 					count:this.productCount,
@@ -165,11 +209,15 @@
 					let resData = response.data
 					this.isRequest = true
 					this.goodsData = resData.list
+					this.couponList = resData.couponList
 					this.userMoney = resData.userMoney
-					this.reducedPrice = resData.reducedPrice
+					this.totalDiscountAmount = this.reducedPrice = resData.reducedPrice
 					this.allPrice = this.payAllPrice = resData.totalPrice
 					this.totalOriginalPrice = resData.totalOriginalPrice
 					this.rechargeGoods = resData.rechargeGoods
+					if(this.couponList.length>0){
+						this.isCouponShow = true
+					}
 				})
 				.catch(error =>{
 					this.$util.msg(error.msg,2000)
@@ -271,12 +319,12 @@
 								this.deductMoney = this.allPrice							// 当前使用金额等于订单金额
 								this.surplusMoney = this.userMoney - this.deductMoney	    // 剩余金额等于余额-当前使用金额
 							}else{
-								this.payAllPrice = this.allPrice - this.userMoney       	// 订单最终支付金额等于订单金额-账户余额
+								this.payAllPrice = this.allPrice - this.userMoney - this.couponAmount       	// 订单最终支付金额等于订单金额-账户余额
 								this.deductMoney = this.userMoney				            // 当前使用金额等于总余额
 								this.surplusMoney = this.userMoney - this.deductMoney	    // 剩余余额等于总余额-当前使用金额
 							}
 						}else{
-							this.payAllPrice = this.allPrice + this.hanldFreight - this.freightBeansMoney
+							this.payAllPrice = this.allPrice + this.hanldFreight - this.freightBeansMoney - this.couponAmount
 						}
 						console.log('抵扣',this.payAllPrice)
 					}
@@ -288,6 +336,14 @@
 					}
 				}
 			},
+			handleChoiceaCouponData(data){// 勾选使用优惠券
+				console.log('优惠券信息',data)
+				this.couponAmount = data.couponAmount
+				this.totalDiscountAmount = this.reducedPrice + this.couponAmount;
+				this.clubCouponId = data.clubCouponId
+				this.attributePallPrice()
+				this.hanldFreightBeans(this.isCheckedBeans)
+			},
 			checkedBalabce(){//勾选使用余额
 				if(this.userMoney > 0){
 					this.ischecked = !this.ischecked
@@ -297,15 +353,17 @@
 					}else{
 						if(this.hanldFreePostFlag == 1 || this.hanldFreePostFlag == '1'){ //如果是有运费时
 							if(this.isCheckedBeans){
-								this.payAllPrice =  this.allPrice
+								this.payAllPrice =  this.allPrice - this.couponAmount
 							}else{
-								this.payAllPrice = this.allPrice+parseInt(this.freightData.freight)
+								this.payAllPrice = this.allPrice+parseInt(this.freightData.freight) - this.couponAmount
 							}
 						}else{
-							this.payAllPrice = this.allPrice
+							this.payAllPrice = this.allPrice - this.couponAmount
 						}
 						this.balanceDeductionFlag = 2
 					}
+					console.log('this.payAllPrice',this.payAllPrice)
+					console.log('this.couponAmount',this.couponAmount)
 				}else{
 					return
 				}
@@ -324,15 +382,17 @@
 						this.deductMoney = this.allPrice							// 当前使用金额等于订单金额
 						this.surplusMoney = this.userMoney - this.deductMoney	    // 剩余金额等于余额-当前使用金额
 					}else{
-						this.payAllPrice = this.allPrice - this.userMoney       	// 订单最终支付金额等于订单金额-账户余额
+						this.payAllPrice = this.allPrice - this.userMoney - this.couponAmount       	// 订单最终支付金额等于订单金额-账户余额
 						this.deductMoney = this.userMoney				            // 当前使用金额等于总余额
 						this.surplusMoney = this.userMoney - this.deductMoney	    // 剩余余额等于总余额-当前使用金额
 					}
 				}else{
-					this.payAllPrice = this.allPrice;
+					this.payAllPrice = this.allPrice - this.couponAmount;
 					this.deductMoney = 0.00; // 当前使用
 					this.surplusMoney = this.userMoney; // 剩余余额
 				}
+				console.log('this.payAllPrice',this.payAllPrice)
+				console.log('this.couponAmount',this.couponAmount)
 			},
 			attributeHashfreight(freight){// 计算需要邮费的支付价格
 				this.payAllPrice = this.allPrice+parseInt(freight)// 计算不包邮的价格 总价等于商品价格+邮费
@@ -348,20 +408,22 @@
 						}
 					}else{// 部分抵扣
 						if(this.isCheckedBeans){// 抵扣运费了
-							this.payAllPrice = this.allPrice - this.userMoney // 订单最终支付金额等于订单金额+运费-账户余额
+							this.payAllPrice = this.allPrice - this.userMoney - this.couponAmount // 订单最终支付金额等于订单金额+运费-账户余额
 							this.deductMoney = this.userMoney				            		// 当前使用金额等于账户余额
 							this.surplusMoney = this.userMoney - this.deductMoney	    		// 剩余余额等于账户余额-当前使用金额
 						}else{
-							this.payAllPrice = this.allPrice+parseInt(freight) - this.userMoney // 订单最终支付金额等于订单金额+运费-账户余额
+							this.payAllPrice = this.allPrice+parseInt(freight) - this.userMoney - this.couponAmount // 订单最终支付金额等于订单金额+运费-账户余额
 							this.deductMoney = this.userMoney				            		// 当前使用金额等于账户余额
 							this.surplusMoney = this.userMoney - this.deductMoney	    		// 剩余余额等于账户余额-当前使用金额
 						}
 					}
 				}else{
-					this.payAllPrice = this.allPrice+parseInt(freight)
+					this.payAllPrice = this.allPrice+parseInt(freight) - this.couponAmount
 					this.deductMoney = 0.00 // 当前使用金额
 					this.surplusMoney = this.userMoney // 剩余余额
 				}
+				console.log('this.payAllPrice',this.payAllPrice)
+				console.log('this.couponAmount',this.couponAmount)
 			},
 			orderSubmitMit(){// 提交订单
 				if(this.isSubLoading){ return; }
@@ -391,6 +453,7 @@
 						userBeans:this.hanldUserBeans
 					}					
 				let param = {
+						clubCouponId:this.clubCouponId,
 						orderSource:6,
 						clubUserId:this.userID,
 						cartType:this.cartType,
@@ -435,6 +498,10 @@
 			handFreightAlertShow(){//显示邮费弹窗
 				this.isfreightTip = true;
 			},
+			handleClickCancel(){// 关闭优惠券弹窗
+				this.isCouponModel = false;
+				this.getInitCrearOrder();
+			},
 			hideFreight(){//关闭邮费弹窗
 				this.isfreightTip = false;
 			},
@@ -644,5 +711,128 @@
 			}
 		}
 	}
-
+	.coupon-content-model{
+		width: 100%;
+		height: 100%;
+		background: rgba(0,0,0,.5);
+		position: fixed;
+		top: 0;
+		left: 0;
+		z-index: 8888;
+		transition: all 0.4s;
+		.coupon-alert-content{
+			width: 600rpx;
+			height: 612rpx;
+			position: absolute;
+			top: 0;
+			left: 0;
+			bottom: 0;
+			right: 0;
+			margin: auto;
+			box-sizing: border-box;
+			padding-top: 92rpx;
+			.coupon{
+				width: 600rpx;
+				height: 522rpx;
+				background: url(https://static.caimei365.com/app/img/icon/icon-coupon-alertbg@2x.png);
+				background-size: cover;
+				box-sizing: border-box;
+				padding: 230rpx 40rpx 0 40rpx;
+				.coupon-list{
+					width: 100%;
+					height: 147rpx;
+					margin-bottom: 32rpx;
+					box-sizing: border-box;
+					background: url(https://static.caimei365.com/app/img/icon/icon-coupon-bg@2x.png);
+					background-size: cover;
+					position: relative;
+					.list-cell-tags{
+						display: inline-block;
+						padding: 0 10rpx;
+						height: 32rpx;
+						line-height: 32rpx;
+						background-color: #f94b4b;
+						color: #FFFFFF;
+						font-size: 18rpx;
+						border-radius: 16rpx 0 16rpx 0;
+						text-align: center;
+						position: absolute;
+						top: 0;
+						left: 0;
+					}
+					.list-cell-le{
+						width: 154rpx;
+						height: 100%;
+						box-sizing: border-box;
+						padding: 30rpx 0;
+						float: left;
+						.coupon-maxMoney{
+							width: 100%;
+							height: 54rpx;
+							line-height: 54rpx;
+							font-size: 42rpx;
+							color: #f94b4b;
+							text-align: center;
+							margin-top: 10rpx;
+							.small{
+								font-size: $font-size-20;
+							}
+						}
+						.coupon-minMoney{
+							width: 100%;
+							height: 28rpx;
+							float: left;
+							box-sizing: border-box;
+							padding-left: 24rpx;
+							.txt{
+								display: block;
+								height: 28rpx;
+								line-height: 28rpx;
+								font-size: 16rpx;
+								color: #f94b4b;
+								text-align: center;
+								padding: 0 5rpx;
+								background-color: #fff1eb;
+								border-radius: 4rpx;
+								float: left;
+							}
+						}
+					}
+					.list-cell-ri{
+						width: 366rpx;
+						height: 100%;
+						box-sizing: border-box;
+						padding:30rpx 20rpx;
+						float: left;
+						.list-cell-top{
+							width: 100%;
+							height: 64rpx;
+							line-height: 64rpx;
+							font-size: $font-size-26;
+							color: #333333;
+							float: left;
+						}
+						.list-cell-time{
+							width: 100%;
+							height: 28rpx;
+							line-height: 28rpx;
+							text-align: left;
+							font-size: $font-size-20;
+							color: #999999;
+						}
+					}
+				}
+				.coupon-btn{
+					width: 100%;
+					height: 78rpx;
+					background: url(https://static.caimei365.com/app/img/icon/icon-coupon-alertbtnbg@2x.png);
+					background-size: cover;
+					line-height: 78rpx;
+					text-align: center;
+					color: #FFFFFF;
+					font-size: $font-size-36;
+				}
+			}
+		}
+	}
 </style>