Explorar o código

commit-m 优惠券

zhengjinyi %!s(int64=3) %!d(string=hai) anos
pai
achega
a94e16dabd
Modificáronse 39 ficheiros con 1204 adicións e 846 borrados
  1. 193 136
      components/cm-module/cart-components/index.vue
  2. 11 9
      components/cm-module/listTemplate/buyagainList.vue
  3. 12 10
      components/cm-module/listTemplate/classifyProductList.vue
  4. 22 18
      components/cm-module/listTemplate/commodityList.vue
  5. 22 18
      components/cm-module/listTemplate/immediatelyList.vue
  6. 11 9
      components/cm-module/listTemplate/productList.vue
  7. 1 1
      components/cm-module/pageFloorTemplate/templateA.vue
  8. 1 1
      components/cm-module/pageFloorTemplate/templateB.vue
  9. 1 1
      components/cm-module/pageFloorTemplate/templateC.vue
  10. 1 1
      components/cm-module/pageFloorTemplate/templateD.vue
  11. 1 1
      components/cm-module/pageFloorTemplate/templateE.vue
  12. 1 1
      components/cm-module/pageFloorTemplate/templateF.vue
  13. 1 1
      components/cm-module/pageFloorTemplate/templateG.vue
  14. 1 1
      components/cm-module/pageFloorTemplate/templateI.vue
  15. 1 1
      components/cm-module/pageFloorTemplate/templateJ.vue
  16. 1 1
      components/cm-module/pageFloorTemplate/templateK.vue
  17. 1 1
      components/cm-module/pageTemplate/templateA.vue
  18. 1 1
      components/cm-module/pageTemplate/templateB.vue
  19. 1 1
      components/cm-module/pageTemplate/templateC.vue
  20. 1 1
      components/cm-module/pageTemplate/templateD.vue
  21. 1 1
      components/cm-module/pageTemplate/templateE.vue
  22. 1 1
      components/cm-module/pageTemplate/templateF.vue
  23. 1 1
      components/cm-module/pageTemplate/templateG.vue
  24. 1 1
      components/cm-module/pageTemplate/templateH.vue
  25. 1 1
      components/cm-module/pageTemplate/templateI.vue
  26. 1 1
      components/cm-module/pageTemplate/templateJ.vue
  27. 1 1
      components/cm-module/pageTemplate/templateK.vue
  28. 7 4
      pages/goods/cart-index.vue
  29. 137 113
      pages/goods/product.vue
  30. 27 18
      pages/search/search.vue
  31. 8 6
      pages/tabBar/cart/index.vue
  32. 3 4
      pages/tabBar/user/user.vue
  33. 143 186
      pages/user/coupon/coupon-collection.vue
  34. 215 10
      pages/user/coupon/coupon-exchange.vue
  35. 72 119
      pages/user/coupon/coupon-product.vue
  36. 183 157
      pages/user/coupon/coupon.vue
  37. 2 2
      services/ajax.env.js
  38. 2 2
      services/config.env.js
  39. 113 4
      services/product.service.js

+ 193 - 136
components/cm-module/cart-components/index.vue

@@ -27,7 +27,7 @@
 									<view class="floor-tags" @click.stop="clickPopupShow(item,2)">{{item.promotions.name}}</view>	
 								</view>
 								<view class="text">{{item.name}}</view> 
-								<view class="text-coupon" @click="showPopup(0)">领券</view>
+								<view class="text-coupon" @click="showPopup(0,item)" v-if="item.couponsLogo">领券</view>
 							</view>
 							<view class="productlist">
 								<view 	class="goods-pros" v-for="(pros,idx) in item.cartList" :key="idx" >
@@ -200,38 +200,48 @@
 				</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">
-							<view class="list-cell-le">
-								<view class="coupon-maxMoney">
-									<text class="small">¥</text>
-									{{ coupon.maxMoney }}
-								</view>
-								<view class="coupon-minMoney">
-									满{{ coupon.minMoney }}可用
+						<view class="coupon-empty" v-if="isCouponEmpty">
+							<image class="empty-container-image" :src="StaticUrl+'/icon/icon-coupon-empty@2x.png'"></image>
+							<text class="error-text">暂无可领的优惠券~</text>
+						</view>
+						<template v-else>
+							<view 	v-for="(coupon,index) in productCouponList"
+									:key="index" 
+									:id="coupon.couponId" 
+									class="coupon-list" 
+							>
+								<view class="list-cell-le">
+									<view class="coupon-maxMoney"><text class="small">¥</text>{{ coupon.couponAmount }}</view>
+									<view class="coupon-minMoney">满{{ coupon.touchPrice }}可用</view>
 								</view>
-							</view>
-							<view class="list-cell-ri">
-								<view class="list-cell-top">
-									<view class="list-cell-type">
-										<view class="list-cell-tags">
-											<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
-										</view>
-										<view class="list-cell-texts" :class="currentTab == 1 || currentTab == 2 ? 'none' : ''">
-											<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>
+								<view class="list-cell-ri">
+									<view class="list-cell-top">
+										<view class="list-cell-type">
+											<view class="list-cell-tags">
+												<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
+											</view>
+											<view class="list-cell-texts" :class="currentTab == 1 || currentTab == 2 ? 'none' : ''">
+												<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>
-									<view class="list-cell-btn">
-										<view class="icon-used">
-											<view class="icon-used-btn receive" v-if="currentTab == 0" @click="receiveCoupon(coupon)">领取</view>
-											<view class="icon-used-btn make" v-if="currentTab == 1">已领取</view>
+										<view class="list-cell-btn">
+											<view class="icon-used">
+												<view class="icon-used-btn receive" v-if="currentTab == 0" @click="receiveCoupon(coupon)">领取</view>
+												<view class="icon-used-btn make" v-if="currentTab == 1">已领取</view>
+											</view>
 										</view>
 									</view>
+									<view class="list-cell-time">{{ coupon.endDate }}</view>
 								</view>
-								<view class="list-cell-time">{{ coupon.couponTime }}</view>
 							</view>
-						</view>
+						</template>
 					</scroll-view>
 				</div>
 			</view>	
@@ -298,29 +308,31 @@
 		},
 		data() {
 			return{
-				CustomBar:this.CustomBar,// 顶部导航栏高度
+				StaticUrl:this.$Static, 				// 静态图片路径
+				CustomBar:this.CustomBar,				// 顶部导航栏高度
 				isIphoneX:this.$store.state.isIphoneX,
-				userID:'',
+				userId:'',
 				alertType:'',
 				isStock:'',
-				handlerPros:{},//监听单挑促销商品
-				failureList:[],	//失效商品列表
-				goodsList:[],	//购物车的商品
-				promotionsList:[],//促销列表
-				delGoodsList:'',//要删除的商品
-				setGoodData:'', //确认订单的商品
-				isCheckAll:false,//是否全选
-				kindCount:0,//购物车宝贝数量
-				allPrice:0,//所有价格
-				totalOriginalPrice:0,//所有原价价
-				reducedPrice:0,//满减
-				allCount:0,//被选中的产品数量
+				handlerPros:{},							// 监听单挑促销商品
+				failureList:[],							// 失效商品列表
+				goodsList:[],							// 购物车的商品
+				promotionsList:[],						// 促销列表
+				totalCouponList:[],							// 优惠券算列表	
+				delGoodsList:'',						// 要删除的商品
+				setGoodData:'', 						// 确认订单的商品
+				isCheckAll:false,						// 是否全选
+				kindCount:0,							// 购物车宝贝数量
+				allPrice:0,								//	所有价格
+				totalOriginalPrice:0,					// 所有原价价
+				reducedPrice:0,							// 满减
+				allCount:0,								// 被选中的产品数量
 				isModallayer:false,
 				skeletonShow:true,
 				isshowDelbtn:false,
-				isDisabled: false, // 供应商/店铺全选是否禁用状态
+				isDisabled: false, 						// 供应商/店铺全选是否禁用状态
 				isNoConfim:false,
-				isEmpty:false,//显示空购物车
+				isEmpty:false,							// 显示空购物车
 				scrollHeight: 'auto',
 				nomoreText: '上拉显示更多',
 				hasNextPage: false,
@@ -333,68 +345,24 @@
 				popupShow:false,
 				popupShow0:false,
 				popupShow1:false,
-				currentTab: 0,
+				currentTab: 1,
 				navbar: [
-					{ name: "未领取",num:3 }, 
-					{ name: "已领取",num:4 } 
-				],
-				dataList:[
-					{
-						maxMoney:5000,
-						minMoney:1000,
-						couponType:1,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:1,
-						couponBtnType:0
-					},
-					{
-						maxMoney:2000,
-						minMoney:200,
-						couponType:2,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:2,
-						couponBtnType:0
-					},
-					{
-						maxMoney:4000,
-						minMoney:800,
-						couponType:3,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:3,
-						couponBtnType:0
-					},
-					{
-						maxMoney:6000,
-						minMoney:1000,
-						couponType:4,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:1,
-						couponBtnType:0
-					},
-					{
-						maxMoney:6000,
-						minMoney:1000,
-						couponType:5,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:2,
-						couponBtnType:0
-					}
+					{ name: "未领取",num:0 }, 
+					{ name: "已领取",num:0 } 
 				],
+				couponParam:{							// 获取弹窗优惠券领取参数
+					userId:0,
+					shopId:0,
+					status:1,
+					source:2
+				},
+				productCouponList:[],					// 优惠券弹窗列表
+				isCouponEmpty:false,
 			}
 		},
 		created(){
 			this.setScrollHeight();
 			console.log('pathType',this.pathType)
-			if(this.hasLogin){
-				this.initData()
-			}else{
-				this.initLogin()
-			}
 		},
 		computed: {
 			...mapState(['hasLogin','userInfo','isWxAuthorize'])
@@ -415,37 +383,24 @@
 		    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;
-				}
 			}
 		},	
 		methods:{
@@ -455,12 +410,12 @@
 				this.isCheckAll=false//是否全选
 				this.submitIds = []
 				this.$api.getStorage().then((resolve) => {
-					this.userID = resolve.userId;
+					this.userId = this.couponParam.userId = resolve.userId ? resolve.userId : 0;
 					this.initGetCartGoodsList();
 				})	
 			},
 			initLogin(){
-				this.$api.redirectTo('/pages/login/login?type=4')
+				this.$api.redirectTo('/pages/login/login')
 			},
 			clickPopupShow(pros,type){
 				this.popupShow = true;
@@ -481,11 +436,12 @@
 				}, 500)
 			},
 			initGetCartGoodsList(){//初始化购物车 index:1
-				this.ProductService.QueryShoppingCartList({userId:this.userID}).then(response =>{
+				this.ProductService.QueryShoppingCartList({userId:this.userId}).then(response =>{
 					this.skeletonShow = false
 					let data = response.data
 					this.kindCount = data.kindCount
 					this.promotionsList = data.promotions
+					this.totalCouponList = data.couponList
 					this.$store.commit('updateAllNum',data.kindCount)
 					if( data.list.length > 0 || data.invalid.length > 0){
 						this.isEmpty =false
@@ -716,7 +672,7 @@
 					reducedPrice += item.reducedprice;
 					originalPrice += item.originalprice;
 				})
-				 //总促销计算
+				 // 总促销计算
 				this.promotionsList.forEach(promotions =>{
 					// 凑单满减
 					if(promotions.mode*1===2 && promotions.type*1===2){
@@ -732,11 +688,13 @@
 						}
 					}
 				});
-				//最后统计商品原价
+				// 计算优惠券
+				this.calculationCoupon()
+				// 最后统计商品原价
 				this.totalOriginalPrice = originalPrice;
-				//最后满减金额 = 店铺减去金额 + 单品减去金额 + 凑单减去金额
+				// 最后满减金额 = 店铺减去金额 + 单品减去金额 + 凑单减去金额
 				this.reducedPrice = reducedPrice;
-				//最终合计价格 = 	店铺满减合计 + 单品满减  + 正常合计 + 凑单满减			
+				// 最终合计价格 = 	店铺满减合计 + 单品满减  + 正常合计 + 凑单满减			
 				this.allPrice = totalPrice ;
 			},
 			totalCount(){//计算总数量
@@ -754,7 +712,48 @@
 						}
 					})
 			    })
-			},		
+			},		 
+			calculationCoupon(){// 优惠券计算
+				const checkedProList = []
+				this.goodsList.forEach((shop,index)=>{
+					shop.cartList.forEach(pros=>{	
+						if(pros.productsChecked){								
+							checkedProList.push(pros)
+						}	
+					})
+				})
+				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
+							
+							
+							
+						}
+					})
+				})
+			},
 			changeCountAdd(item,pros){//商品数量加加
 				if(pros.step === 2){
 					pros.isStep = false
@@ -820,7 +819,7 @@
 				}
 			},
 			updateShoppogNum(pros){//加减购物车商品更新到后台
-				let params ={userID:this.userID,productID:pros.productId,productCount:pros.number}
+				let params ={userID:this.userId,productID:pros.productId,productCount:pros.number}
 				this.ProductService.ShoppingCartUpdate(params).then(response =>{
 					this.isshowDelbtn = false;
 					this.initGetCartGoodsList();
@@ -950,7 +949,7 @@
 					return
 				}else{			
 					this.$util.modal('','确定删除选中的商品吗?','确定','取消',true,() =>{
-						this.ProductService.ShoppingCartDelete({userID:this.userID,productIDs:this.delGoodsList}).then(response =>{
+						this.ProductService.ShoppingCartDelete({userID:this.userId,productIDs:this.delGoodsList}).then(response =>{
 							this.$util.msg('删除成功',2000);
 							setTimeout(()=>{
 								this.isshowDelbtn = false;
@@ -965,7 +964,7 @@
 			deletefailureList(){
 				this.failureList.forEach(failure=>{ this.delGoodsList += failure.productId+',' })
 				this.$util.modal('','确定清空全部失效商品吗?','确定','取消',true,() =>{
-					this.ProductService.ShoppingCartDelete({userID:this.userID,productIDs:this.delGoodsList}).then(response =>{
+					this.ProductService.ShoppingCartDelete({userID:this.userId,productIDs:this.delGoodsList}).then(response =>{
 						this.$util.msg('删除成功',2000);
 						setTimeout(()=>{
 							this.isshowDelbtn = false;
@@ -1044,9 +1043,49 @@
 				}
 				return false
 			},
-			showPopup(index){// 显示popup弹窗
+			queryPopupCoupons(){// 获取弹窗优惠券列表
+				this.ProductService.ShoppingCartGetCoupon(this.couponParam).then(response =>{
+					let data = response.data
+					this.navbar[0].num = data.notCouponNum
+					this.navbar[1].num = data.couponNum
+					if(data.couponList && data.couponList.length >0){
+						this.productCouponList = data.couponList
+						this.isCouponEmpty = false
+					}else{
+						this.isCouponEmpty = true
+					}
+				})
+				.catch(error =>{
+					console.log('获取优惠券列表失败')
+				})
+			},
+			receiveCoupon(coupon){// 点击优惠券领取按钮
+				this.ProductService.ReceiveCoupon(
+					{
+						userId:this.couponParam.userId,
+						couponId:coupon.couponId,
+						source:2
+					}
+				) 
+				.then(response =>{
+					this.$util.msg('领取成功',1500,true,'success')
+					setTimeout(()=>{
+						this.currentTab = 1
+						this.couponParam.status = 2
+						this.queryPopupCoupons()
+					},1500)
+				})
+				.catch(error =>{
+					this.$util.msg(error.msg,2000);
+				})
+			},
+			showPopup(index,shop){// 显示popup弹窗
 				switch(index){
 					case 0:
+						this.currentTab = 0
+						this.couponParam.status = 1
+						this.couponParam.shopId = shop.id
+						this.queryPopupCoupons()
 						this.popupShow0 = true
 						break;
 					case 1:
@@ -1066,18 +1105,15 @@
 			},
 			couponChange(e) {
 				this.currentTab = e.index
-				console.log('currentTab',this.currentTab)
 				switch(this.currentTab){
 					case 0:
-						this.listClass = 'list-used'
+						this.couponParam.status = 1
+						this.queryPopupCoupons()
 						break;
 					case 1:
-						this.listClass = 'list-none'
-						break;
-					case 2:
-						this.listClass = 'list-none'
+						this.couponParam.status = 2
+						this.queryPopupCoupons()
 						break;
-					
 				}
 			}
 		}
@@ -1698,6 +1734,27 @@
 			float: left;
 			&.coupon{
 				padding-bottom: 40rpx;
+				.coupon-empty{
+					width: 100%;
+					height: 600rpx;
+					display: flex;
+					align-items: center;
+					justify-content: center;
+					flex-direction: column;
+					position: fixed;
+					background: $bg-color;
+					.empty-container-image{
+						width: 150rpx;
+						height: 150rpx;
+						margin-bottom: 0;
+						margin-top: 0;
+					}
+					.error-text{
+						font-size: $font-size-28;
+						color: #999999;
+						line-height: 88rpx;
+					}
+				}
 			}
 			.tui-popup-scroll{
 				width: 100%;

+ 11 - 9
components/cm-module/listTemplate/buyagainList.vue

@@ -23,17 +23,19 @@
 							</view>
 							<button class="add-cart-btn" @click.stop="operationHanld(item)">数量</button>
 						</view>
-						<view class="list-details-price" v-if="item.actStatus==1">
+						<view class="list-details-price">
 							<view class="floor-item-act">
-								<view class="coupon-tags">优惠券</view>
-								<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
-									{{item.promotions.name}}<text>:¥{{ item.price | NumFormat }}</text>
-								</view>
-								<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
+								<view class="coupon-tags" v-if="item.couponsLogo">优惠券</view>
+								<template v-if="item.actStatus==1">
+									<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
+										{{item.promotions.name}}<text>:¥{{ item.price | NumFormat }}</text>
+									</view>
+									<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
+								</template>
 							</view>
-							<view class="floor-item-act" v-if="item.actStatus ==0  &&  item.ladderPriceFlag==1">
-								<view class="coupon-tags">优惠券</view>
-								<view class="floor-tags">阶梯价格</view>	
+							<view class="floor-item-act">
+								<view class="coupon-tags" v-if="item.couponsLogo">优惠券</view>
+								<view class="floor-tags" v-if="item.actStatus ==0  &&  item.ladderPriceFlag==1">阶梯价格</view>	
 							</view>
 						</view>	
 					</view>

+ 12 - 10
components/cm-module/listTemplate/classifyProductList.vue

@@ -11,21 +11,23 @@
 					<view class="list-details-specs" v-if="item.productCode!=''&&item.productCode!=null">商品编码:{{item.productCode}}</view>
 					<view class="list-details-price">
 						<template v-if="userIdentity == 3">
-							<view class="floor-item-act" v-if="item.actStatus==1">
-								<view class="coupon-tags">优惠券</view>
-								<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
-									{{item.promotions.name}}<text v-if="item.price1TextFlag != '1' && item.supplierId === shopId">:¥{{ item.price | NumFormat }}</text>
-								</view>
-								<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
+							<view class="floor-item-act">
+								<view class="coupon-tags" v-if="item.couponsLogo">优惠券</view>
+								<template v-if="item.actStatus==1">
+									<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
+										{{item.promotions.name}}<text v-if="item.price1TextFlag != '1' && item.supplierId === shopId">:¥{{ item.price | NumFormat }}</text>
+									</view>
+									<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
+								</template>
 							</view>
-							<view class="floor-item-act" v-if="item.actStatus ==0  &&  item.ladderPriceFlag==1">
-								<view class="coupon-tags">优惠券</view>
-								<view class="floor-tags">阶梯价格</view>	
+							<view class="floor-item-act">
+								<view class="coupon-tags" v-if="item.couponsLogo">优惠券</view>
+								<view class="floor-tags" v-if="item.actStatus ==0  &&  item.ladderPriceFlag==1">阶梯价格</view>	
 							</view>
 						</template>
 						<template v-else>
 							<view class="floor-item-act" v-if="item.actStatus==1">
-								<view class="coupon-tags">优惠券</view>
+								<view class="coupon-tags" v-if="item.couponsLogo">优惠券</view>
 								<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
 									{{item.promotions.name}}<text v-if="hasLogin && item.price1TextFlag != '1'">:¥{{ item.price | NumFormat }}</text>
 								</view>

+ 22 - 18
components/cm-module/listTemplate/commodityList.vue

@@ -11,29 +11,33 @@
 					<view class="list-details-specs" v-if="item.p_code!=''&& item.p_code!=null">商品编码:{{item.p_code}}</view>
 					<view class="list-details-price">
 						<template v-if="userIdentity == 3">
-							<view class="floor-item-act" v-if="item.actStatus==1">
-								<view class="coupon-tags">优惠券</view>
-								<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
-									{{item.promotions.name}}<text v-if="item.p_price_flag != '1' && item.supplierId === shopId">:¥{{ item.price | NumFormat }}</text>
-								</view>
-								<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
+							<view class="floor-item-act">
+								<view class="coupon-tags"v-if="item.couponsLogo">优惠券</view>
+								<template v-if="item.actStatus==1">
+									<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
+										{{item.promotions.name}}<text v-if="item.p_price_flag != '1' && item.supplierId === shopId">:¥{{ item.price | NumFormat }}</text>
+									</view>
+									<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
+								</template>
 							</view>
-							<view class="floor-item-act" v-if="item.actStatus ==0  &&  item.ladderPriceFlag==1">
-								<view class="coupon-tags">优惠券</view>
-								<view class="floor-tags">阶梯价格</view>	
+							<view class="floor-item-act">
+								<view class="coupon-tags"v-if="item.couponsLogo">优惠券</view>
+								<view class="floor-tags" v-if="item.actStatus ==0  &&  item.ladderPriceFlag==1">阶梯价格</view>	
 							</view>
 						</template>
 						<template v-else>
-							<view class="floor-item-act" v-if="item.actStatus==1">
-								<view class="coupon-tags">优惠券</view>
-								<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
-									{{item.promotions.name}}<text v-if="hasLogin && item.p_price_flag != '1'">:¥{{ item.price | NumFormat }}</text>
-								</view>
-								<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
+							<view class="floor-item-act">
+								<view class="coupon-tags"v-if="item.couponsLogo">优惠券</view>
+								<template v-if="item.actStatus==1">
+									<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
+										{{item.promotions.name}}<text v-if="hasLogin && item.p_price_flag != '1'">:¥{{ item.price | NumFormat }}</text>
+									</view>
+									<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
+								</template>
 							</view>
-							<view class="floor-item-act" v-if="item.actStatus ==0  &&  item.ladderPriceFlag==1">
-								<view class="coupon-tags">优惠券</view>
-								<view class="floor-tags">阶梯价格</view>	
+							<view class="floor-item-act">
+								<view class="coupon-tags" v-if="item.couponsLogo">优惠券</view>
+								<view class="floor-tags" v-if="item.actStatus ==0  &&  item.ladderPriceFlag==1">阶梯价格</view>	
 							</view>
 						</template>
 						<view v-if="hasLogin" class="list-price">

+ 22 - 18
components/cm-module/listTemplate/immediatelyList.vue

@@ -56,16 +56,18 @@
 								</template>
 							</view>
 							<view class="list-details-price">
-								<view class="floor-item-act" v-if="item.actStatus==1">
-									<view class="coupon-tags">优惠券</view>
-									<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
-										{{item.promotions.name}}<text>:¥{{ item.price | NumFormat }}</text>
-									</view>
-									<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
+								<view class="floor-item-act">
+									<view class="coupon-tags" v-if="item.couponsLogo">优惠券</view>
+									<template v-if="item.actStatus==1">
+										<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
+											{{item.promotions.name}}<text>:¥{{ item.price | NumFormat }}</text>
+										</view>
+										<view class="floor-tags" v-else>{{item.promotions.name}}</view>
+									</template>
 								</view>
-								<view class="floor-item-act" v-if="item.actStatus ==0  &&  item.ladderPriceFlag==1">
-									<view class="coupon-tags">优惠券</view>
-									<view class="floor-tags">阶梯价格</view>	
+								<view class="floor-item-act">
+									<view class="coupon-tags" v-if="item.couponsLogo">优惠券</view>
+									<view class="floor-tags" v-if="item.actStatus ==0  &&  item.ladderPriceFlag==1">阶梯价格</view>	
 								</view>
 							</view>	
 						</view>
@@ -96,16 +98,18 @@
 												<view class="price-larger">价格:¥{{ pros.price | NumFormat }}</view>
 											</view>
 											<view class="zuhe_price-larger zuhe_list_text" >
-												<view class="floor-item-act" v-if="pros.actStatus==1">
-													<view class="coupon-tags">优惠券</view>
-													<view class="floor-tags" v-if="PromotionsFormat(pros.promotions)">
-														{{pros.promotions.name}}<text>:¥{{ pros.price | NumFormat }}</text>
-													</view>
-													<view class="floor-tags" v-else>{{pros.promotions.name}}</view>	
+												<view class="floor-item-act">
+													<view class="coupon-tags" v-if="item.couponsLogo">优惠券</view>
+													<template v-if="pros.actStatus==1">
+														<view class="floor-tags" v-if="PromotionsFormat(pros.promotions)">
+															{{pros.promotions.name}}<text>:¥{{ pros.price | NumFormat }}</text>
+														</view>
+														<view class="floor-tags" v-else>{{pros.promotions.name}}</view>	
+													</template>
 												</view>
-												<view class="floor-item-act" v-if="pros.actStatus ==0  &&  pros.ladderPriceFlag==1">
-													<view class="coupon-tags">优惠券</view>
-													<view class="floor-tags">阶梯价格</view>	
+												<view class="floor-item-act">
+													<view class="coupon-tags" v-if="item.couponsLogo">优惠券</view>
+													<view class="floor-tags" v-if="pros.actStatus ==0  &&  pros.ladderPriceFlag==1">阶梯价格</view>	
 												</view>
 												<view class="count">
 													<view class="number-box">

+ 11 - 9
components/cm-module/listTemplate/productList.vue

@@ -26,17 +26,19 @@
 							</view>
 							<button class="add-cart-btn" @click.stop="operationHanld(item)">数量</button>
 						</view>
-						<view class="list-details-price" v-if="item.actStatus==1">
+						<view class="list-details-price">
 							<view class="floor-item-act">
-								<view class="coupon-tags">优惠券</view>
-								<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
-									{{item.promotions.name}}<text v-if="item.priceFlag != 1">:¥{{ item.price | NumFormat }}</text>
-								</view>
-								<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
+								<view class="coupon-tags" v-if="item.couponsLogo">优惠券</view>
+								<template  v-if="item.actStatus==1">
+									<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
+										{{item.promotions.name}}<text v-if="item.priceFlag != 1">:¥{{ item.price | NumFormat }}</text>
+									</view>
+									<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
+								</template>
 							</view>
-							<view class="floor-item-act" v-if="item.actStatus ==0  &&  item.ladderPriceFlag==1">
-								<view class="coupon-tags">优惠券</view>
-								<view class="floor-tags">阶梯价格</view>	
+							<view class="floor-item-act">
+								<view class="coupon-tags" v-if="item.couponsLogo">优惠券</view>
+								<view class="floor-tags" v-if="item.actStatus ==0  &&  item.ladderPriceFlag==1">阶梯价格</view>	
 							</view>
 						</view>	
 					</view>

+ 1 - 1
components/cm-module/pageFloorTemplate/templateA.vue

@@ -24,7 +24,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus===1">
 								<view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">

+ 1 - 1
components/cm-module/pageFloorTemplate/templateB.vue

@@ -36,7 +36,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus===1">
 								<view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">

+ 1 - 1
components/cm-module/pageFloorTemplate/templateC.vue

@@ -36,7 +36,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus===1">
 								<view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">

+ 1 - 1
components/cm-module/pageFloorTemplate/templateD.vue

@@ -48,7 +48,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus===1">
 								<view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">

+ 1 - 1
components/cm-module/pageFloorTemplate/templateE.vue

@@ -24,7 +24,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus===1">
 								<view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">

+ 1 - 1
components/cm-module/pageFloorTemplate/templateF.vue

@@ -12,7 +12,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus===1">
 								<view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">

+ 1 - 1
components/cm-module/pageFloorTemplate/templateG.vue

@@ -12,7 +12,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus===1">
 								<view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">

+ 1 - 1
components/cm-module/pageFloorTemplate/templateI.vue

@@ -79,7 +79,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus === 1">
 								<view

+ 1 - 1
components/cm-module/pageFloorTemplate/templateJ.vue

@@ -80,7 +80,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus === 1">
 								<view

+ 1 - 1
components/cm-module/pageFloorTemplate/templateK.vue

@@ -119,7 +119,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus === 1">
 								<view

+ 1 - 1
components/cm-module/pageTemplate/templateA.vue

@@ -24,7 +24,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus===1">
 								<view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">

+ 1 - 1
components/cm-module/pageTemplate/templateB.vue

@@ -36,7 +36,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus===1">
 								<view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">

+ 1 - 1
components/cm-module/pageTemplate/templateC.vue

@@ -36,7 +36,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus===1">
 								<view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">

+ 1 - 1
components/cm-module/pageTemplate/templateD.vue

@@ -48,7 +48,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus===1">
 								<view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">

+ 1 - 1
components/cm-module/pageTemplate/templateE.vue

@@ -24,7 +24,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus===1">
 								<view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">

+ 1 - 1
components/cm-module/pageTemplate/templateF.vue

@@ -12,7 +12,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus===1">
 								<view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">

+ 1 - 1
components/cm-module/pageTemplate/templateG.vue

@@ -12,7 +12,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus===1">
 								<view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">

+ 1 - 1
components/cm-module/pageTemplate/templateH.vue

@@ -15,7 +15,7 @@
 							</view>
 							<view class="floor-item-price" v-if="item.listType == 1">
 								<view class="floor-item-act">
-									<view class="coupon-tags">优惠券</view>
+									<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 									<template v-if="userIdentity === 3">
 										<template v-if="item.product.actStatus===1">
 											<view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">

+ 1 - 1
components/cm-module/pageTemplate/templateI.vue

@@ -80,7 +80,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus === 1">
 								<view

+ 1 - 1
components/cm-module/pageTemplate/templateJ.vue

@@ -81,7 +81,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus === 1">
 								<view

+ 1 - 1
components/cm-module/pageTemplate/templateK.vue

@@ -120,7 +120,7 @@
 				</view>
 				<view class="floor-item-price" v-if="item.listType == 1">
 					<view class="floor-item-act">
-						<view class="coupon-tags">优惠券</view>
+						<view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
 						<template v-if="userIdentity === 3">
 							<template v-if="item.product.actStatus === 1">
 								<view

+ 7 - 4
pages/goods/cart-index.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="container cart clearfix" v-if="hasLogin" :style="{paddingTop:CustomBar+'px'}"> 	
 		<custom :systeminfo='systeminfo' :navbar-data='nvabarData' :headerBtnPosi ="headerBtnPosi" :page='1'></custom>
-		<cart :pathType='pathType' v-if="isShowComponents"></cart>
+		<cart ref="cart" :pathType='pathType'></cart>
 	</view>
 </template>
 <script>
@@ -51,12 +51,15 @@
 			}
 		},
 		onPullDownRefresh() {//下拉刷新
-			this.isShowComponents = false;
+			this.$refs.cart.initData()
 			uni.stopPullDownRefresh()
-			this.isShowComponents = true;
 		},
 		onShow(){
-			
+			if(this.hasLogin){
+				this.$refs.cart.initData()
+			}else{
+				this.$refs.cart.initLogin()
+			}
 		},
 	}
 </script>

+ 137 - 113
pages/goods/product.vue

@@ -111,9 +111,9 @@
 					<view class="product-parameter coupon" @click="showPopup(2)">
 						<text class="title">优惠券:</text>
 						<view class="coupon">
-							<text class="tags"> 满5000减100 </text>
-							<text class="tags"> 满5000减100 </text>
-							<text class="tags"> 满5000减100 </text>
+							<text class="tags"  v-for="(coupon, index) in productCoupon.slice(0,3)" :key="index"> 
+								满{{ coupon.touchPrice }}减{{ coupon.couponAmount }} 
+							</text>
 						</view>
 						<text class="iconfont icon-xiayibu"></text>
 					</view>
@@ -224,7 +224,7 @@
 						</view>
 						<view class="tui-popup-tabs">
 							<coupon-tabs  :tabs="navbar"
-										  :currentTab="currentTab>2?0:currentTab" 
+										  :currentTab="currentTab > 2 ? 0 : currentTab" 
 										  @change="couponChange" 
 										  :itemWidth="(100/navbar.length)+'%'"
 										  selectedColor="#e15616" 
@@ -233,38 +233,48 @@
 						</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">
-									<view class="list-cell-le">
-										<view class="coupon-maxMoney">
-											<text class="small">¥</text>
-											{{ coupon.maxMoney }}
-										</view>
-										<view class="coupon-minMoney">
-											满{{ coupon.minMoney }}可用
+								<view class="coupon-empty" v-if="isCouponEmpty">
+									<image class="empty-container-image" :src="StaticUrl+'/icon/icon-coupon-empty@2x.png'"></image>
+									<text class="error-text">暂无可领的优惠券~</text>
+								</view>
+								<template v-else>
+									<view 	v-for="(coupon,index) in productCouponList"
+											:key="index" 
+											:id="coupon.couponId" 
+											class="coupon-list" 
+									>
+										<view class="list-cell-le">
+											<view class="coupon-maxMoney"><text class="small">¥</text>{{ coupon.couponAmount }}</view>
+											<view class="coupon-minMoney">满{{ coupon.touchPrice }}可用</view>
 										</view>
-									</view>
-									<view class="list-cell-ri">
-										<view class="list-cell-top">
-											<view class="list-cell-type">
-												<view class="list-cell-tags">
-													<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
+										<view class="list-cell-ri">
+											<view class="list-cell-top">
+												<view class="list-cell-type">
+													<view class="list-cell-tags">
+														<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
+													</view>
+													<view class="list-cell-texts">
+														<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-texts" :class="currentTab == 1 || currentTab == 2 ? 'none' : ''">
-													<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>
-												</view>
-											</view>
-											<view class="list-cell-btn">
-												<view class="icon-used">
-													<view class="icon-used-btn receive" v-if="currentTab == 0" @click="receiveCoupon(coupon)">领取</view>
-													<view class="icon-used-btn make" v-if="currentTab == 1">已领取</view>
+												<view class="list-cell-btn">
+													<view class="icon-used">
+														<view class="icon-used-btn receive" v-if="currentTab == 0" @click="receiveCoupon(coupon)">领取</view>
+														<view class="icon-used-btn make" v-if="currentTab == 1">已领取</view>
+													</view>
 												</view>
 											</view>
+											<view class="list-cell-time">{{ coupon.endDate }}</view>
 										</view>
-										<view class="list-cell-time">{{ coupon.couponTime }}</view>
 									</view>
-								</view>
+								</template>
 							</scroll-view>
 						</div>
 					</view>	
@@ -397,6 +407,7 @@
 		},
 		data(){
 			return{			
+				StaticUrl:this.$Static, //静态图片路径
 				clickPath:'/pages/search/search',
 				html:'<div style="text-align: center;color:#333333;">暂无内容</div>',
 				productNoneImage:'https://static.caimei365.com/app/img/icon/icon-pnone.png',
@@ -440,6 +451,8 @@
 				minBuyNumber:0,
 				productsList:[],
 				goodListData:[],
+				productCoupon:[], 							// 优惠券
+				productCouponList:[],						// 优惠券弹窗列表
 				headerBtnPosi:	this.setHeaderBtnPosi(), 	// 获取设备顶部胶囊高度
 				systeminfo: this.setSysteminfo(),		 	// 获取设备信息
 				isIphoneX:this.$store.state.isIphoneX,
@@ -462,100 +475,47 @@
 				winHeight:'',
 				isShowButton:true,
 				isNoneSupplier:false,
+				isCouponEmpty:false,
 				currentTab: 0,
+				couponParam:{								// 获取弹窗优惠券领取参数
+					userId:0,
+					productId:0,
+					status:1,
+					source:2
+				},
 				bottomCartNumber:0,
 				navbar: [
-					{ name: "未领取",num:3 }, 
-					{ name: "已领取",num:4 } 
-				],
-				dataList:[
-					{
-						maxMoney:5000,
-						minMoney:1000,
-						couponType:1,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:1,
-						couponBtnType:0
-					},
-					{
-						maxMoney:2000,
-						minMoney:200,
-						couponType:2,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:2,
-						couponBtnType:0
-					},
-					{
-						maxMoney:4000,
-						minMoney:800,
-						couponType:3,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:3,
-						couponBtnType:0
-					},
-					{
-						maxMoney:6000,
-						minMoney:1000,
-						couponType:4,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:1,
-						couponBtnType:0
-					},
-					{
-						maxMoney:6000,
-						minMoney:1000,
-						couponType:5,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:2,
-						couponBtnType:0
-					}
-				],
+					{ name: "未领取",num:0 }, 
+					{ name: "已领取",num:0 } 
+				]
 			}
 		},
 		computed: {
 			...mapState(['hasLogin','isWxAuthorize','identity'])
 		},
 		filters: {
-			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;
-				}
-			}
 		},
 		onLoad(option) {
-			this.productId = option.id;//获取商品ID
+			this.productId = this.couponParam.productId = option.id;//获取商品ID
 			this.isShareType = option.type
 			this.linkPath = option.path
 			this.isHeaderPoduct = true
@@ -648,21 +608,65 @@
 						this.getSectionProps();
 					},2000)
 					this.shoppingHeaderCartNumber()
+					this.queryProductDetilsCoupons()
 					this.isRequest = true
 				})
 				.catch(error =>{
 					this.$util.msg(error.msg,2000);
 				})
 			},
+			queryProductDetilsCoupons(){// 初始化商品详情优惠券信息
+				this.ProductService.QueryProductDetilsCoupons(this.couponParam).then(response =>{
+					this.productCoupon = response.data.list
+				})
+				.catch(error =>{
+					console.log('获取优惠券列表失败')
+				})
+			},
+			queryPopupCoupons(){// 获取弹窗优惠券列表
+				this.ProductService.QueryProductDetilsCoupons(this.couponParam).then(response =>{
+					let data = response.data
+					this.navbar[0].num = data.notCouponNum
+					this.navbar[1].num = data.couponNum
+					if(data.couponList && data.couponList.length >0){
+						this.productCouponList = data.couponList
+						this.isCouponEmpty = false
+					}else{
+						this.isCouponEmpty = true
+					}
+				})
+				.catch(error =>{
+					console.log('获取优惠券列表失败')
+				})
+			},
 			shoppingHeaderCartNumber(){// 获取用户购物车储量
 				this.ProductService.shoppingHeaderCartNumber({userId:this.userId}).then(response =>{
 					this.bottomCartNumber = response.data.length;
-					console.log('获取购物车数量',this.bottomCartNumber)
 				})
 				.catch(error =>{
 					console.log('获取购物车数量失败')
 				})
 			},
+			receiveCoupon(coupon){// 点击优惠券领取按钮
+				this.ProductService.ReceiveCoupon(
+					{
+						userId:this.couponParam.userId,
+						couponId:coupon.couponId,
+						source:2
+					}
+				) 
+				.then(response =>{
+					this.$util.msg('领取成功',1500,true,'success')
+					setTimeout(()=>{
+						this.currentTab = 1
+						this.couponParam.status = 2
+						this.queryPopupCoupons()
+					},1500)
+				})
+				.catch(error =>{
+					this.$util.msg(error.msg,2000);
+				})
+			},
 			swiperChange(e) {//顶部商品图片切换
 				const index = e.detail.current;
 				this.current = index;
@@ -790,9 +794,6 @@
 					})
 				}
 			},
-			receiveCoupon(coupon){//用户领取优惠券
-				coupon.couponBtnType = 1;
-			},
 			showSpec(type) {//显示选择数量确认弹窗
 				this.isBtnType = type
 				this.specClass = 'show';
@@ -890,7 +891,12 @@
 						this.popupShow1 = true
 						break;
 					case 2:
-						this.popupShow2 = true
+						if(this.hasLogin){
+							this.queryPopupCoupons()
+							this.popupShow2 = true
+						}else{
+							this.$api.navigateTo('/pages/login/login')
+						}
 						break;
 				}
 			},
@@ -909,18 +915,15 @@
 			},
 			couponChange(e) {
 				this.currentTab = e.index
-				console.log('currentTab',this.currentTab)
 				switch(this.currentTab){
 					case 0:
-						this.listClass = 'list-used'
+						this.couponParam.status = 1
+						this.queryPopupCoupons()
 						break;
 					case 1:
-						this.listClass = 'list-none'
+						this.couponParam.status = 2
+						this.queryPopupCoupons()
 						break;
-					case 2:
-						this.listClass = 'list-none'
-						break;
-					
 				}
 			},
 			getSectionProps() {//获取每个tab对应区域的scrollTop值
@@ -1015,7 +1018,7 @@
 		},
 		onShow() {
 			this.$api.getStorage().then((resolve) => {
-				this.userId = resolve.userId ? resolve.userId : '';
+				this.userId = this.couponParam.userId = resolve.userId ? resolve.userId : '';
 				this.userIdentity = resolve.userIdentity ? resolve.userIdentity : 0
 				this.shopID =  resolve.shopId ? resolve.shopId : '';
 				if(this.userIdentity == 0 || this.userIdentity == 2 || this.userIdentity == 4){
@@ -2131,6 +2134,27 @@
 			float: left;
 			&.coupon{
 				padding-bottom: 40rpx;
+				.coupon-empty{
+					width: 100%;
+					height: 600rpx;
+					display: flex;
+					align-items: center;
+					justify-content: center;
+					flex-direction: column;
+					position: fixed;
+					background: $bg-color;
+					.empty-container-image{
+						width: 150rpx;
+						height: 150rpx;
+						margin-bottom: 0;
+						margin-top: 0;
+					}
+					.error-text{
+						font-size: $font-size-28;
+						color: #999999;
+						line-height: 88rpx;
+					}
+				}
 			}
 			.tui-popup-scroll{
 				width: 100%;

+ 27 - 18
pages/search/search.vue

@@ -68,29 +68,32 @@
 						</view>
 						<view class="list-details-price">
 							<template v-if="userIdentity == 3">
-								<view class="floor-item-act" v-if="item.actStatus==1">
-									<view class="coupon-tags">优惠券</view>
-									<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
-										{{item.promotions.name}}<text v-if="item.priceFlag != 1 && item.supplierId === shopId">:¥{{ item.price | NumFormat }}</text>
-									</view>
-									<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
+								<view class="floor-item-act" >
+									<view class="coupon-tags" v-if="item.couponsLogo">优惠券</view>
+									<template v-if="item.actStatus==1">
+										<view class="floor-tags" v-if="PromotionsFormat(item.promotions)"></view>
+										<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
+									</template>
 								</view>
-								<view class="floor-item-act" v-if="item.actStatus ==0  &&  item.ladderPriceFlag==1">
-									<view class="coupon-tags">优惠券</view>
-									<view class="floor-tags">阶梯价格</view>	
+								<view class="floor-item-act">
+									<view class="coupon-tags"v-if="item.couponsLogo">优惠券</view>
+									<view class="floor-tags" v-if="item.actStatus ==0  &&  item.ladderPriceFlag==1">阶梯价格</view>	
 								</view>
 							</template>
 							<template v-else>
+								
 								<view class="floor-item-act" v-if="item.actStatus==1">
-									<view class="coupon-tags">优惠券</view>
-									<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
-										{{item.promotions.name}}<text v-if="hasLogin && item.priceFlag != 1">:¥{{ item.price | NumFormat }}</text>
-									</view>
-									<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
+									<view class="coupon-tags" v-if="item.couponsLogo">优惠券</view>
+									<template v-if="item.actStatus==1">
+										<view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
+											{{item.promotions.name}}<text v-if="hasLogin && item.priceFlag != 1">:¥{{ item.price | NumFormat }}</text>
+										</view>
+										<view class="floor-tags" v-else>{{item.promotions.name}}</view>	
+									</template>	
 								</view>
-								<view class="floor-item-act" v-if="item.actStatus ==0  &&  item.ladderPriceFlag==1">
-									<view class="coupon-tags">优惠券</view>
-									<view class="floor-tags">阶梯价格</view>	
+								<view class="floor-item-act">
+									<view class="coupon-tags" v-if="item.couponsLogo">优惠券</view>
+									<view class="floor-tags" v-if="item.actStatus ==0  &&  item.ladderPriceFlag==1">阶梯价格</view>	
 								</view>
 							</template>
 							<view v-if="hasLogin" class="list-price">
@@ -351,7 +354,13 @@
 					productIdArr.push(item.productId)
 				})
 				this.productIds = productIdArr.join(",");
-				this.ProductService.querySearchProductPrice({userId: this.userId,productIds:this.productIds}).then(response =>{
+				this.ProductService.querySearchProductPrice(
+					{
+						userId: this.userId,
+						productIds:this.productIds,
+						source:2,// 来源 1 WWW 2 小程序
+					}
+				).then(response =>{
 					if (response.data) {
 						this.listData = this.ReturnNewProducts(this.listData,response.data);
 					}

+ 8 - 6
pages/tabBar/cart/index.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="container cart clearfix" v-if="hasLogin"> 	
-		<cart :pathType='pathType' v-if="isShowComponents"></cart>
+		<cart ref="cart" :pathType='pathType'></cart>
 	</view>
 </template>
 <script>
@@ -12,12 +12,11 @@
 		},
 		data(){
 			return{
-				isShowComponents:false,
 				pathType:0
 			}
 		},
 		onLoad(){
-			this.isShowComponents = true;
+			
 		},
 		computed: {
 			...mapState(['hasLogin','userInfo','isWxAuthorize'])
@@ -26,12 +25,15 @@
 			
 		},
 		onPullDownRefresh() {//下拉刷新
-			this.isShowComponents = false;
+			this.$refs.cart.initData()
 			uni.stopPullDownRefresh()
-			this.isShowComponents = true;
 		},
 		onShow(){
-			
+			if(this.hasLogin){
+				this.$refs.cart.initData()
+			}else{
+				this.$refs.cart.initLogin()
+			}
 		},
 	}
 </script>

+ 3 - 4
pages/tabBar/user/user.vue

@@ -279,8 +279,8 @@
 			getClubObtainCenter(){// 获取个人中心数据
 				this.UserService.GetClubObtainCenter({userId:this.userId}).then(response =>{
 					let data = response.data
-					// this.userMoney = this.filtersMoney(data.user.ableUserMoney)
-					// console.log('userMoney',this.userMoney)
+					this.userMoney = this.filtersMoney(data.user.ableUserMoney)
+					console.log('userMoney',this.userMoney)
 					this.userIdentity = data.user.userIdentity //机构等级
 					if(this.userIdentity == 2){
 						this.name = data.club.name //会员机构名称
@@ -293,7 +293,7 @@
 					this.headpic = data.user.image // 会所头像
 					this.bindMobile = data.user.bindMobile// 登录手机号
 					this.clubStatus = data.user.clubStatus // 机构审核状态
-					this.couponNum =data.couponNum// 采美豆数量
+					this.couponNum =data.couponNum// 优惠券数量
 					this.isModify =  data.isModify // 是否显示采美豆
 					this.contactNumber = data.contactNumber // 联系电话		
 					this.confirmedCount = this.showBadge(data.confirmedCount)//待确认
@@ -829,7 +829,6 @@
 			}
 		}
 		.cell-more{
-			width: 60rpx;
 			height: 100rpx;
 			line-height: 100rpx;
 			text-align: right;

+ 143 - 186
pages/user/coupon/coupon-collection.vue

@@ -1,15 +1,19 @@
 <template>
 	<view class="container clearfix">
-		<view class="container-list">
-			<template v-if="!showEmpty">
-				<view v-for="(coupon,index) in dataList" :key="index" :id="coupon.id" class="coupon-list">
+		<view class="container-list" v-show="isRequest">
+			<view class="empty-container" v-if="showEmpty">
+				<image class="empty-container-image" :src="StaticUrl+'/icon/icon-coupon-empty@2x.png'"></image>
+				<text class="error-text">暂无可领的优惠券~</text>
+			</view>
+			<template v-else>
+				<view v-for="(coupon,index) in coupinList" :key="index" :id="coupon.id" class="coupon-list">
 					<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">
@@ -18,10 +22,15 @@
 								<view class="list-cell-tags">
 									<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
 								</view>
-								<view class="list-cell-texts" :class="currentTab == 1 || currentTab == 2 ? 'none' : ''">
-									<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>
+								<view class="list-cell-texts">
+									<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">
@@ -31,18 +40,14 @@
 								</view>
 							</view>
 						</view>
-						<view class="list-cell-time">{{ coupon.couponTime }}</view>
+						<view class="list-cell-time">{{ coupon.endDate }}</view>
 					</view>
 				</view>
-				<view v-if="showLoading && dataList.length > 5">
-					<view class="loading-wrapper loading-wrapper-now" v-if="loadingNow">{{loadingText}}<text v-if="loadingText === '已至底部'">‧ ‧ ‧</text></view>
-					<view class="loading-wrapper loading-wrapper-btm" v-else>———<text class="btm-text">已至底部</text>———</view>
-				</view>
+				<!--加载loadding-->
+				<tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
+				<tui-nomore :visible="!pullUpOn" :backgroundColor="'#F7F7F7'" :text='nomoreText'></tui-nomore>
+				<!--加载loadding-->
 			</template>
-			<view class="empty-container" v-else>
-				<image class="empty-container-image" :src="StaticUrl+'/icon/icon-coupon-empty@2x.png'"></image>
-				<text class="error-text">暂无可领的优惠券~</text>
-			</view>
 		</view>
 	</view>
 </template>
@@ -58,93 +63,18 @@
 			return {
 				StaticUrl:this.$Static,
 				isIphoneX:this.$store.state.isIphoneX,
-				currentTab: 0,
-				navbar: [
-					{ name: "未使用",num:3 }, 
-					{ name: "已使用",num:4 }, 
-					{ name: "已失效",num:5 },
-				],
-				dataList:[
-					{
-						maxMoney:5000,
-						minMoney:1000,
-						couponType:1,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:1,
-						couponBtnType:0
-					},
-					{
-						maxMoney:2000,
-						minMoney:200,
-						couponType:2,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:2,
-						couponBtnType:0
-					},
-					{
-						maxMoney:4000,
-						minMoney:800,
-						couponType:3,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:3,
-						couponBtnType:0
-					},
-					{
-						maxMoney:6000,
-						minMoney:1000,
-						couponType:4,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:1,
-						couponBtnType:0
-					},
-					{
-						maxMoney:6000,
-						minMoney:1000,
-						couponType:4,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:1,
-						couponBtnType:0
-					},
-					{
-						maxMoney:6000,
-						minMoney:1000,
-						couponType:4,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:1,
-						couponBtnType:0
-					},
-					{
-						maxMoney:6000,
-						minMoney:1000,
-						couponType:4,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:1,
-						couponBtnType:0
-					},
-					{
-						maxMoney:6000,
-						minMoney:1000,
-						couponType:5,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:2,
-						couponBtnType:0
-					}
-				],
-				windowHeight:'',
-				scrollHeight:'',
+				listQuery:{
+					userId:0,
+					pageNum:1,
+					pageSize:10
+				},
+				coupinList:[],
+				isRequest:false,
 				showEmpty: false,
-				showLoading: false,
-				loadingNow: true,
-				loadingText: '上拉加载更多',
+				nomoreText: '上拉显示更多',
 				hasNextPage:false,
+				loadding: false,
+				pullUpOn: true,
 				pullFlag: true,
 			}
 		},
@@ -152,115 +82,130 @@
 			
 		},
 		filters: {
-			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;
-				}
 			}
 		},
 		computed: {
 			...mapState(['hasLogin','userInfo','identity','isActivity'])
 		},
 		methods: {
-			setScrollHeight() {
-				const {windowHeight, pixelRatio} = wx.getSystemInfoSync();
-				this.windowHeight = windowHeight - 1;
-				this.scrollHeight = windowHeight - 1;
-			},
-			scrolltolower() {
-				if(this.total>this.productList.length && this.pullFlag) {
-					this.getListFromServer(true);
-				}
-			},
-			receiveCoupon(coupon){
-				if(this.hasLogin){
-					coupon.couponBtnType = 1;
-				}else{
-					this.$api.navigateTo('/pages/login/login')
-				}
-			},
-			getListFromServer(loadMore) {//搜索商品
-				this.showLoading = true;
-				this.loadingNow = true;
-				this.loadingText = '加载中';
-				this.showEmpty = false;				
-				if(loadMore) {
-					this.listQuery.pageNum += 1;
-				}
-				this.ProductService.GetProductList(this.listQuery).then(response =>{
-					this.isShowWrapper = true
-					const data = response.data;
-					const dataList = data.list;
-					if(dataList && dataList.length > 0){
-						this.hasNextPage = data.hasNextPage;
-						this.showEmpty = false;
-						if(loadMore) {
-							this.productList = [...this.productList,...dataList];
-						} else {
-							this.productList = [...dataList];
-						}
-						// 防上拉暴滑
+			QueryCouponList() {// 初始化查询优惠券列表
+				this.ProductService.QueryCouponCollarList(this.listQuery).then(response =>{
+					let data = response.data
+					if(data.list&&data.list.length > 0){
+						this.showEmpty = false
+						this.hasNextPage = response.data.hasNextPage
+						this.coupinList =data.list
 						this.pullFlag = false;
-						setTimeout(()=>{ this.pullFlag = true; },500)
-						// 底部提示文案
-						if(this.hasNextPage) {
-							this.loadingText = '上拉加载更多';
-						} else {
-							this.showLoading = true;
-							this.loadingNow = false;
-						}
-					} else {
-						if(!loadMore) {
-							this.showEmpty = true;
+						setTimeout(()=>{this.pullFlag = true;},500)
+						if(this.hasNextPage){
+							this.pullUpOn = false
+							this.nomoreText = '上拉显示更多'
+						}else{
+							if(this.coupinList.length < 8){
+								this.pullUpOn = true
+							}else{
+								this.pullUpOn = false
+								this.loadding = false
+								this.nomoreText = '已至底部'
+							}
 						}
+					}else{
+						this.showEmpty = true
 					}
+					this.isRequest = true;
 				}).catch(error =>{
 					this.$util.msg(error.msg,2000);
 				})
 			},
-			toUseCoupon(coupon){
+			getOnReachBottomData(){// 上滑加载分页
+				this.listQuery.pageNum+=1
+				this.ProductService.QueryCouponCollarList(this.listQuery)
+				.then(response =>{
+					let data = response.data
+					if(data.list&&data.list.length > 0){
+						this.hasNextPage = data.hasNextPage
+						this.coupinList = this.coupinList.concat(data.list) 
+						this.pullFlag = false;// 防上拉暴滑
+						setTimeout(()=>{this.pullFlag = true;},500)
+						if(this.hasNextPage){
+							this.pullUpOn = false
+							this.nomoreText = '上拉显示更多'
+						}else{
+							this.pullUpOn = false
+							this.loadding = false
+							this.nomoreText = '已至底部'
+						}
+					}
+				})
+				.catch(error =>{
+					this.$util.msg(error.msg,2000)
+				})
+			},
+			receiveCoupon(coupon){// 点击优惠券领取按钮
+				if(this.hasLogin){
+					this.ProductService.ReceiveCoupon(
+						{
+							userId:this.listQuery.userId,
+							couponId:coupon.couponId,
+							source:2
+						}) 
+					.then(response =>{
+						this.$util.msg('领取成功',1500,true,'success')
+						setTimeout(()=>{
+							coupon.couponBtnType = 1;
+						},1500)
+					})
+					.catch(error =>{
+						this.$util.msg(error.msg,2000);
+					})
+				}else{
+					this.$api.navigateTo('/pages/login/login')
+				}
+			},
+			toUseCoupon(coupon){// 去使用跳转路径
 				console.log('coupon',coupon)
 				switch (coupon.couponType) {
-					case 1:// 活动券跳转到商城首页 / 或者活动页(看是否指定了商品)
-						this.$api.switchTabTo('/pages/tabBar/home/index')
-						break;
-					case 2:// 品类券:跳转到产品 / 仪器页
-						this.$api.navigateTo('/pages/tabBar/home/index')
+					case 0:// 活动券:跳转到商城首页 / 或者活动页(看是否指定了商品)
+						if(coupon.productType == 1){// 1 全商城通用 2 指定商品
+							this.$api.switchTabTo('/pages/tabBar/home/index')
+						}else{
+							this.$api.navigateTo('/pages/user/coupon/coupon-product?couponId='+coupon.couponId)
+						}
 						break;
-					case 3:// 店铺券:跳转到店铺首页
-						this.$api.navigateTo('/pages/tabBar/home/index')
+					case 1:// 品类券:跳转到产品 287 / 仪器页 286
+						let categoryId = 0;
+						if(coupon.categoryType == 1){
+							categoryId = 287
+						}else{
+							categoryId = 286
+						}
+						this.$api.navigateTo(`/pages/goods/good-floor?linkId=${ coupon.categoryType == 1 ? 287 : 286 }`)
 						break;
-					case 4:// 专享券:跳转到商城首页
+					case 2:// 用户专享券:跳转到商城首页
 						this.$api.switchTabTo('/pages/tabBar/home/index')
 						break;
-					case 5:// 新用户券:跳转到商城首页
+					case 3:// 店铺券:跳转到店铺首页
+						this.$api.navigateTo('/pages/supplier/user/my-shop?shopId='+coupon.shopId)
+						break;
+					case 4:// 新用户券:跳转到商城首页
 						this.$api.switchTabTo('/pages/tabBar/home/index')
 						break;
 				}
@@ -269,13 +214,25 @@
 				this.$api.navigateTo(url)
 			},	
 		},
+		onPullDownRefresh() {
+			setTimeout(() => {
+				this.coupinList = []
+				this.listQuery.pageNum = 1
+				this.QueryCouponList()
+				uni.stopPullDownRefresh()
+			}, 200)
+		},
+		onReachBottom() {
+			if(this.hasNextPage){
+				this.loadding = true
+				this.pullUpOn = true
+				this.getOnReachBottomData()
+			}	
+		},
 		onShow(){
-			this.setScrollHeight();
 			this.$api.getComStorage('userInfo').then((resolve) =>{
-				this.userName = resolve.name;
-				this.userIdentity = resolve.userIdentity
-			}).catch(error =>{
-				
+				this.listQuery.userId = resolve.userId ? resolve.userId : 0
+				this.QueryCouponList();
 			})
 		}
 	}

+ 215 - 10
pages/user/coupon/coupon-exchange.vue

@@ -2,7 +2,7 @@
 	<view class="container clearfix">
 		<view class="coupon-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>
@@ -16,6 +16,39 @@
 				</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">{{ coupon.couponType | TypeFormat }}</text></view>
+						<view class="list-cell-le">
+							<view class="coupon-maxMoney">
+								<text class="small">¥</text>
+								{{ coupon.couponAmount }}
+							</view>
+							<view class="coupon-minMoney">
+								<text class="txt">满{{ coupon.touchPrice }}可用</text>
+							</view>
+						</view>
+						<view class="list-cell-ri">
+							<view class="list-cell-top">
+								<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 class="list-cell-time">有效期:{{ coupon.endDate }}</view>
+						</view>
+					</view>
+					<view class="coupon-btn" @click.stop="handleClickCancel">立即收下</view>
+				</view>
+				<text class="iconfont icon-2guanbi"  @click.stop="handleClickCancel"></text>
+			</view>
+		</view>
 	</view>
 </template>
 
@@ -28,32 +61,68 @@
 		data() {
 			return {
 				params:{
-					couponCode:'',
+					userId:0,
+					redemptionCode:'',
+					source:2,
 				},
-				userName:'',
-				userIdentity:0
+				coupon:{},
+				isCouponModel:false
 			}
 		},
 		onLoad() {
 			
+		},
+		filters: {
+			TypeFormat:function(value) {
+				switch (value) {
+					case 0:
+						return  '活动券';
+						break;
+					case 1:
+						return  '品类券';
+						break;
+					case 2:
+						return  '用户专享券';
+						break;
+					case 3:
+						return  '店铺券';
+						break;
+					case 4:
+						return  '新用户券';
+						break;
+				}
+			}
 		},
 		computed: {
 			...mapState(['hasLogin','userInfo','identity','isActivity'])
 		},
 		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.coupon = response.data
+					this.isCouponModel = true
+				})
+				.catch(error =>{
+					this.$util.msg(error.msg,2000);
+				})
+			},
+			handleClickCancel(){// 关闭弹窗并跳转个人优惠券中心
+				this.isCouponModel = false
+				this.$api.navigateTo('/pages/user/coupon/coupon')
 			}
 		},
 		onShow(){
 			this.$api.getComStorage('userInfo').then((resolve) =>{
-				this.userName = resolve.name;
-				this.userIdentity = resolve.userIdentity
+				this.params.userId = resolve.userId ? resolve.userId : 0;
 			}).catch(error =>{
-				
+				console.log('暂无用户信息~')
 			})
 		}
 	}
@@ -81,7 +150,7 @@
 					line-height: 66rpx;
 					padding: 0 20rpx;
 					font-size: $font-size-26;
-					color: #b2b2b2;
+					color: #333333;
 					border-radius: 2rpx;
 				}
 			}
@@ -121,4 +190,140 @@
 			}
 		}
 	}
+	.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;
+				}
+			}
+			.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>

+ 72 - 119
pages/user/coupon/coupon-product.vue

@@ -4,7 +4,7 @@
 		<!-- 楼层 -->
 		<view class="container-section tui-skeleton">
 			<view class="floor-item-banner ad_01">
-				<image class="item-img-gg" src="https://img.caimei365.com/group1/M00/00/1E/rB-lF2DDKw6Aege4AAHRUhuWVn4676.jpg"></image>
+				<image class="item-img-gg" :src="appletsBanner"></image>
 			</view>
 			<view class="section_page_main clearfix">
 				<view class="floor-item clearfix" v-for="(pros, idx) in productList" :key="idx" @click.stop="navToDetailPage(pros)">
@@ -60,6 +60,10 @@
 					</view>
 				</view>
 			</view>
+			<!--加载loadding-->
+			<tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
+			<tui-nomore :visible="!pullUpOn" :backgroundColor="'#F7F7F7'" :text='nomoreText'></tui-nomore>
+			<!--加载loadding-->
 		</view>
 	</view>
 </template>
@@ -69,111 +73,30 @@
 	export default{
 		data(){
 			return{
-				userId:0,
 				userIdentity:0,
-				productList:[
-					{
-						image:'https://img.caimei365.com/group1/M00/00/10/rB-lGGCHqP-AIE9-AAEQHiqWjQY981.png',
-						beautyActFlag:1,
-						name:'ET-SPACE全身热疗系统(生物热能太空舱)',
-						actStatus:1,
-						promotions:{
-							type:1,
-							mode:1,
-							name:'优惠价'
-						},
-						priceFlag:0,
-						price:2000,
-						originalPrice:1000,
-						ladderPriceFlag:null
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/00/10/rB-lGGCHqP-AIE9-AAEQHiqWjQY981.png',
-						beautyActFlag:1,
-						name:'ET-SPACE全身热疗系统(生物热能太空舱)',
-						actStatus:0,
-						promotions:{
-							type:1,
-							mode:1,
-							name:'优惠价'
-						},
-						priceFlag:0,
-						price:2000,
-						originalPrice:1000,
-						ladderPriceFlag:1
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/00/10/rB-lGGCHqP-AIE9-AAEQHiqWjQY981.png',
-						beautyActFlag:1,
-						name:'ET-SPACE全身热疗系统(生物热能太空舱)',
-						actStatus:1,
-						promotions:{
-							type:1,
-							mode:1,
-							name:'优惠价'
-						},
-						priceFlag:0,
-						price:2000,
-						originalPrice:1000,
-						ladderPriceFlag:null
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/00/10/rB-lGGCHqP-AIE9-AAEQHiqWjQY981.png',
-						beautyActFlag:1,
-						name:'ET-SPACE全身热疗系统(生物热能太空舱)',
-						actStatus:0,
-						promotions:{
-							type:1,
-							mode:1,
-							name:'优惠价'
-						},
-						priceFlag:0,
-						price:2000,
-						originalPrice:1000,
-						ladderPriceFlag:1
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/00/10/rB-lGGCHqP-AIE9-AAEQHiqWjQY981.png',
-						beautyActFlag:1,
-						name:'ET-SPACE全身热疗系统(生物热能太空舱)',
-						actStatus:1,
-						promotions:{
-							type:1,
-							mode:1,
-							name:'优惠价'
-						},
-						priceFlag:0,
-						price:2000,
-						originalPrice:1000,
-						ladderPriceFlag:null
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/00/10/rB-lGGCHqP-AIE9-AAEQHiqWjQY981.png',
-						beautyActFlag:1,
-						name:'ET-SPACE全身热疗系统(生物热能太空舱)',
-						actStatus:0,
-						promotions:{
-							type:1,
-							mode:1,
-							name:'优惠价'
-						},
-						priceFlag:0,
-						price:2000,
-						originalPrice:1000,
-						ladderPriceFlag:1
-					},
-				]
+				productList:[],
+				appletsBanner:'',
+				listQuery:{
+					userId:0,
+					couponId: 0,
+					pageSize: 10,
+					pageNum: 1,
+					source: 2
+				},
+				NavigationBarTitle:'',
+				nomoreText: '上拉显示更多',
+				hasNextPage:false,
+				loadding: false,
+				pullUpOn: true,
+				pullFlag: true
 			}
 		},
 		onLoad(option) {
-			uni.setNavigationBarTitle({title:option.title});
+			this.listQuery.couponId = option.couponId	
 			this.$api.getComStorage('userInfo').then((resolve) =>{
-				this.clubStatus = resolve.clubStatus
-				this.userId = resolve.userId ? resolve.userId : 0;
+				this.listQuery.userId = resolve.userId ? resolve.userId : 0;
 				this.userIdentity = resolve.userIdentity
-				// this.GetHomeFloorContentDetails(this.pageType);
-			}).catch(error =>{
-				// this.GetHomeFloorContentDetails(this.pageType);
+				this.QueryCouponActivityList()
 			})
 		},
 		filters: {
@@ -185,24 +108,45 @@
 			...mapState(['hasLogin','userInfo','identity'])
 		},
 		methods:{
-			GetHomeFloorContentDetails(pageType){//楼层查看更多
-				if(pageType == '1'){
-					this.CommonService.GetHomeFloorContentDetails({userId:this.userID,floorId:this.floorId,source:2}).then(response =>{
-						this.pageData = response.data
-						this.skeletonShow = false
-						this.isRequest = true
-					}).catch(error =>{
-						this.$util.msg(error.msg,2000)
-					})
-				}else{
-					this.CommonService.GePageFloorContentDetails({userId:this.userID,centreId:this.floorId,source:2}).then(response =>{
-						this.pageData = response.data
-						this.skeletonShow = false
-						this.isRequest = true
-					}).catch(error =>{
-						this.$util.msg(error.msg,2000)
-					})
-				}
+			QueryCouponActivityList(){//楼层查看更多
+				this.ProductService.QueryCouponActivityList(this.listQuery).then(response =>{
+					let data  = response.data
+					uni.setNavigationBarTitle({title:data.coupon.name});
+					this.appletsBanner = data.coupon.appletsBanner
+					this.productList = data.pageInfo.list
+					this.hasNextPage = data.pageInfo.hasNextPage
+					this.skeletonShow = false
+					if(this.hasNextPage){
+						this.pullUpOn = false
+						this.nomoreText = '上拉显示更多'
+					}else{
+						this.pullUpOn = false
+						this.loadding = false
+						this.nomoreText = '已至底部'
+					}
+				}).catch(error =>{
+					this.$util.msg(error.msg,2000)
+				})
+			},
+			OnReachBottomData(){// 上滑加载
+				this.listQuery.pageNum+=1
+				this.ProductService.QueryCouponActivityList(this.listQuery).then(response =>{
+					let data  = response.data
+					uni.setNavigationBarTitle({title:data.coupon.name});
+					this.hasNextPage = data.pageInfo.hasNextPage
+					this.productList = this.productList.concat(data.pageInfo.list) 
+					this.skeletonShow = false
+					if(this.hasNextPage){
+						this.pullUpOn = false
+						this.nomoreText = '上拉显示更多'
+					}else{
+						this.pullUpOn = false
+						this.loadding = false
+						this.nomoreText = '已至底部'
+					}
+				}).catch(error =>{
+					this.$util.msg(error.msg,2000)
+				})
 			},
 			PromotionsFormat(promo){//促销活动类型数据处理
 				if(promo!=null){
@@ -217,10 +161,19 @@
 		},
 		onPullDownRefresh() {
 			setTimeout(() => {
-				this.GetHomeFloorContentDetails(this.pageType);
+				this.productList = []
+				this.listQuery.pageNum = 1
+				this.QueryCouponActivityList()
 				uni.stopPullDownRefresh()
 			}, 200)
 		},
+		onReachBottom() {
+			if(this.hasNextPage){
+				this.loadding = true
+				this.pullUpOn = true
+				this.OnReachBottomData()
+			}	
+		},
 		onShow() {
 			
 		}

+ 183 - 157
pages/user/coupon/coupon.vue

@@ -9,50 +9,67 @@
 						  sliderBgColor="#e15616">
 			</coupon-tabs>
 		</view>
-		<view class="container-list" :style="{'overflow':'auto',paddingBottom :isIphoneX ? '68rpx' : '0rpx','height':(dataList.length>6? windowHeight + 'px' : 'auto')}">
-			<scroll-view :style="{'height':(dataList.length>5? scrollHeight+'px' : 'auto')}" @scrolltolower="scrolltolower" scroll-y v-if="!showEmpty">
-				<view v-for="(coupon,index) in dataList" :key="index" :id="coupon.id" class="coupon-list" :class="listClass">
-					<view class="list-cell-le">
-						<view class="coupon-maxMoney">
-							<text class="small">¥</text>
-							{{ coupon.maxMoney }}
-						</view>
-						<view class="coupon-minMoney">
-							满{{ coupon.minMoney }}可用
+		<view 	class="container-list" 
+				:style="{'overflow':'auto',paddingBottom :isIphoneX ? '100rpx' : '0rpx','height':(coupinList.length>6? windowHeight + 'px' : 'auto')}"
+				v-show="isRequest"
+			>
+			<view class="empty-container" v-if="showEmpty">
+				<image class="empty-container-image" :src="StaticUrl+'/icon/icon-coupon-empty@2x.png'"></image>
+				<text class="error-text">暂无优惠券~</text>
+			</view>
+			<template v-else>
+				<view :style="{'height':(coupinList.length>5? scrollHeight+'px' : 'auto')}">
+					<view 	v-for="(coupon,index) in coupinList" 
+							:key="index" 
+							:id="coupon.id" 
+							class="coupon-list" 
+							:class="listClass"
+						>
+						<view class="list-cell-le">
+							<view class="coupon-maxMoney">
+								<text class="small">¥</text>
+								{{ coupon.couponAmount }}
+							</view>
+							<view class="coupon-minMoney">
+								满{{ coupon.touchPrice }}可用
+							</view>
 						</view>
-					</view>
-					<view class="list-cell-ri">
-						<view class="list-cell-top">
-							<view class="list-cell-type">
-								<view class="list-cell-tags">
-									<text class="tags" :class="currentTab == 1 || currentTab == 2 ? 'none' : ''">{{ coupon.couponType | TypeFormat }}</text>
-								</view>
-								<view class="list-cell-texts" :class="currentTab == 1 || currentTab == 2 ? 'none' : ''">
-									<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>
+						<view class="list-cell-ri">
+							<view class="list-cell-top">
+								<view class="list-cell-type">
+									<view class="list-cell-tags">
+										<text class="tags" :class="coupon.useStatus == 2 || coupon.useStatus == 3 ? 'none' : ''">
+											{{ coupon.couponType | TypeFormat }}
+										</text>
+									</view>
+									<view class="list-cell-texts" :class="coupon.useStatus == 2 || coupon.useStatus == 3 ? 'none' : ''">
+										<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>
-							<view class="list-cell-btn">
-								<view class="icon-used" v-if="currentTab == 0">
-									<view class="icon-used-btn" @click="toUseCoupon(coupon)">去使用</view>
+								<view class="list-cell-btn">
+									<view class="icon-used" v-if="coupon.useStatus == 1">
+										<view class="icon-used-btn" @click="toUseCoupon(coupon)">去使用</view>
+									</view>
+									<view class="icon-use" v-if="coupon.useStatus == 2"></view>
+									<view class="icon-invalid" v-if="coupon.useStatus == 3"></view>
 								</view>
-								<view class="icon-use" v-if="currentTab == 1"></view>
-								<view class="icon-invalid" v-if="currentTab == 2"></view>
 							</view>
+							<view class="list-cell-time">{{ coupon.endDate }}</view>
 						</view>
-						<view class="list-cell-time">{{ coupon.couponTime }}</view>
 					</view>
+					<!--加载loadding-->
+					<tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
+					<tui-nomore :visible="!pullUpOn" :backgroundColor="'#F7F7F7'" :text='nomoreText'></tui-nomore>
+					<!--加载loadding-->
 				</view>
-				<view v-if="showLoading && dataList.length > 5">
-					<view class="loading-wrapper loading-wrapper-now" v-if="loadingNow">{{loadingText}}<text v-if="loadingText === '已至底部'">‧ ‧ ‧</text></view>
-					<view class="loading-wrapper loading-wrapper-btm" v-else>———<text class="btm-text">已至底部</text>———</view>
-				</view>
-			</scroll-view>
-			<view class="empty-container" v-else>
-				<image class="empty-container-image" :src="StaticUrl+'/icon/icon-coupon-empty@2x.png'"></image>
-				<text class="error-text">暂无优惠券~</text>
-			</view>
+			</template>
 		</view>
 		<view class="button-bottom" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx',height:isIphoneX ?'168rpx' : '100rpx'}">
 			<view class="button-exchange" @click="navigator('/pages/user/coupon/coupon-exchange')">兑换优惠券</view>
@@ -70,102 +87,55 @@
 		},
 		data() {
 			return {
+				isRequest:false,
 				listClass:'list-used',
 				StaticUrl:this.$Static,
 				isIphoneX:this.$store.state.isIphoneX,
 				currentTab: 0,
+				listQuery:{
+					userId:0,
+					pageNum:1,
+					pageSize:10,
+					status:1
+				},
 				navbar: [
-					{ name: "未使用",num:3 }, 
-					{ name: "已使用",num:4 }, 
-					{ name: "已失效",num:5 },
-				],
-				dataList:[
-					{
-						maxMoney:5000,
-						minMoney:1000,
-						couponType:1,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:1,
-					},
-					{
-						maxMoney:2000,
-						minMoney:200,
-						couponType:2,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:2,
-					},
-					{
-						maxMoney:4000,
-						minMoney:800,
-						couponType:3,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:3,
-					},
-					{
-						maxMoney:6000,
-						minMoney:1000,
-						couponType:4,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:1,
-					},
-					{
-						maxMoney:6000,
-						minMoney:1000,
-						couponType:5,
-						couponTime:'2021.06.28~2021.07.28',
-						couponText:'华熙生物技术有限公司',
-						useType:2
-					}
+					{ name: "未使用",num:0 }, 
+					{ name: "已使用",num:0 }, 
+					{ name: "已失效",num:0 },
 				],
+				coupinList:[],
 				windowHeight:'',
 				scrollHeight:'',
 				showEmpty: false,
-				showLoading: false,
-				loadingNow: true,
-				loadingText: '上拉加载更多',
+				nomoreText: '上拉显示更多',
 				hasNextPage:false,
+				loadding: false,
+				pullUpOn: true,
 				pullFlag: true,
 			}
 		},
 		onLoad() {
-			
+		
 		},
 		filters: {
-			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;
-				}
 			}
 		},
 		computed: {
@@ -177,97 +147,152 @@
 				this.windowHeight = windowHeight - 1;
 				this.scrollHeight = windowHeight - 1;
 			},
-			scrolltolower() {
-				if(this.total>this.productList.length && this.pullFlag) {
-					this.getListFromServer(true);
-				}
-			},
-			getListFromServer(loadMore) {//搜索商品
-				this.showLoading = true;
-				this.loadingNow = true;
-				this.loadingText = '加载中';
-				this.showEmpty = false;				
-				if(loadMore) {
-					this.listQuery.pageNum += 1;
-				}
-				this.ProductService.GetProductList(this.listQuery).then(response =>{
-					this.isShowWrapper = true
-					const data = response.data;
-					const dataList = data.list;
-					if(dataList && dataList.length > 0){
-						this.hasNextPage = data.hasNextPage;
-						this.showEmpty = false;
-						if(loadMore) {
-							this.productList = [...this.productList,...dataList];
-						} else {
-							this.productList = [...dataList];
-						}
-						// 防上拉暴滑
+			QueryCouponList() {// 获取优惠券列表
+				this.ProductService.QueryCouponCenter(this.listQuery).then(response =>{
+					let data = response.data
+					if(data.list&&data.list.length > 0){
+						this.showEmpty = false
+						this.hasNextPage = response.data.hasNextPage
+						this.coupinList =data.list
 						this.pullFlag = false;
-						setTimeout(()=>{ this.pullFlag = true; },500)
-						// 底部提示文案
-						if(this.hasNextPage) {
-							this.loadingText = '上拉加载更多';
-						} else {
-							this.showLoading = true;
-							this.loadingNow = false;
-						}
-					} else {
-						if(!loadMore) {
-							this.showEmpty = true;
+						setTimeout(()=>{this.pullFlag = true;},500)
+						if(this.hasNextPage){
+							this.pullUpOn = false
+							this.nomoreText = '上拉显示更多'
+						}else{
+							if(this.coupinList.length < 8){
+								this.pullUpOn = true
+							}else{
+								this.pullUpOn = false
+								this.loadding = false
+								this.nomoreText = '已至底部'
+							}
 						}
+					}else{
+						this.showEmpty = true
 					}
+					this.isRequest = true;
 				}).catch(error =>{
 					this.$util.msg(error.msg,2000);
 				})
 			},
-			toUseCoupon(coupon){
+			getOnReachBottomData(){// 上滑加载分页
+				this.listQuery.pageNum+=1
+				this.ProductService.QueryCouponCenter(this.listQuery)
+				.then(response =>{
+					let data = response.data
+					if(data.list&&data.list.length > 0){
+						this.hasNextPage = data.hasNextPage
+						this.coupinList = this.coupinList.concat(data.list) 
+						this.pullFlag = false;// 防上拉暴滑
+						setTimeout(()=>{this.pullFlag = true;},500)
+						if(this.hasNextPage){
+							this.pullUpOn = false
+							this.nomoreText = '上拉显示更多'
+						}else{
+							this.pullUpOn = false
+							this.loadding = false
+							this.nomoreText = '已至底部'
+						}
+					}
+				})
+				.catch(error =>{
+					this.$util.msg(error.msg,2000)
+				})
+			},
+			getQueryCouponsCount(){// 获取优惠券数量
+				this.ProductService.QueryCouponsCount(
+					{
+						userId:this.listQuery.userId, 
+					}
+				) 
+				.then(response =>{
+					let data = response.data
+					this.navbar[0].num = data.unusedNum
+					this.navbar[1].num = data.usedNum
+					this.navbar[2].num = data.expiredNum
+				})
+				.catch(error =>{
+					this.$util.msg(error.msg,2000);
+				})
+			},
+			toUseCoupon(coupon){// 去使用跳转路径
 				console.log('coupon',coupon)
 				switch (coupon.couponType) {
-					case 1:// 活动券跳转到商城首页 / 或者活动页(看是否指定了商品)
-						this.$api.switchTabTo('/pages/tabBar/home/index')
+					case 0:// 活动券:跳转到商城首页 / 或者活动页(看是否指定了商品)
+						 if(coupon.productType == 1){// 1 全商城通用 2 指定商品
+							console.log('asdasdasda',coupon.productType)
+							this.$api.switchTabTo('/pages/tabBar/home/index')
+						 }else{
+							this.$api.navigateTo('/pages/user/coupon/coupon-product?couponId='+coupon.couponId)
+						 }
 						break;
-					case 2:// 品类券:跳转到产品 / 仪器页
-						this.$api.navigateTo('/pages/tabBar/home/index')
-						break;
-					case 3:// 店铺券:跳转到店铺首页
-						this.$api.navigateTo('/pages/tabBar/home/index')
+					case 1:// 品类券:跳转到产品 287 / 仪器页 286
+						let categoryId = 0;
+						if(coupon.categoryType == 1){
+							categoryId = 287
+						}else{
+							categoryId = 286
+						}
+						this.$api.navigateTo(`/pages/goods/good-floor?linkId=${ coupon.categoryType == 1 ? 287 : 286 }`)
 						break;
-					case 4:// 专享券:跳转到商城首页
+					case 2:// 用户专享券:跳转到商城首页
 						this.$api.switchTabTo('/pages/tabBar/home/index')
 						break;
-					case 5:// 新用户券:跳转到商城首页
+					case 3:// 店铺券:跳转到店铺首页
+						this.$api.navigateTo('/pages/supplier/user/my-shop?shopId='+coupon.shopId)
+						break;
+					case 4:// 新用户券:跳转到商城首页
 						this.$api.switchTabTo('/pages/tabBar/home/index')
 						break;
 				}
 			},
 			change(e) {
 				this.currentTab = e.index
-				console.log('currentTab',this.currentTab)
+				this.isRequest = false
+				this.listQuery.pageNum = 1
 				switch(this.currentTab){
 					case 0:
 						this.listClass = 'list-used'
+						this.listQuery.status = 1
 						break;
 					case 1:
 						this.listClass = 'list-none'
+						this.listQuery.status = 2
 						break;
 					case 2:
 						this.listClass = 'list-none'
+						this.listQuery.status = 3
 						break;
 					
 				}
+				this.QueryCouponList()
 			},
 			navigator(url){
 				this.$api.navigateTo(url)
 			},	
 		},
+		onPullDownRefresh() {
+			setTimeout(() => {
+				this.coupinList = []
+				this.listQuery.pageNum = 1
+				this.QueryCouponList()
+				uni.stopPullDownRefresh()
+			}, 200)
+		},
+		onReachBottom() {
+			if(this.hasNextPage){
+				this.loadding = true
+				this.pullUpOn = true
+				this.getOnReachBottomData()
+			}	
+		},
 		onShow(){
 			this.setScrollHeight();
 			this.$api.getComStorage('userInfo').then((resolve) =>{
-				this.userName = resolve.name;
-				this.userIdentity = resolve.userIdentity
-			}).catch(error =>{
-				
+				this.listQuery.userId = resolve.userId ? resolve.userId : 0;
+				this.getQueryCouponsCount()
+				this.QueryCouponList();
 			})
 		}
 	}
@@ -454,6 +479,7 @@
 		left: 0;
 		box-sizing: border-box;
 		padding: 8rpx 24rpx;
+		z-index: 999;
 		.button-exchange{
 			width: 280rpx;
 			height: 100%;

+ 2 - 2
services/ajax.env.js

@@ -2,10 +2,10 @@ let URL_CONFIG = ''
 if(process.env.NODE_ENV === 'development'){
     // 开发环境
 	// URL_CONFIG = 'http://192.168.2.68:8008'	 //涛涛联调地址
-	// URL_CONFIG = 'http://192.168.2.67:8008'	 //裴裴联调地址
+	URL_CONFIG = 'http://192.168.2.67:8008'	 //裴裴联调地址
 	// URL_CONFIG = 'http://192.168.2.81:8008'
 	// URL_CONFIG = 'http://192.168.2.75:8008'	 //超超联调地址
-    URL_CONFIG = 'https://spi-b.caimei365.com'	 //采美测试地址
+    // URL_CONFIG = 'https://spi-b.caimei365.com'	 //采美测试地址
 	// URL_CONFIG = 'https://spi.caimei365.com'
 }else{
     // 生产环境

+ 2 - 2
services/config.env.js

@@ -2,8 +2,8 @@ let URL_CONFIG = ''
 if(process.env.NODE_ENV === 'development'){
     // 开发环境
     // URL_CONFIG = 'http://192.168.2.75:18002'	 //超超联调地址
-	// URL_CONFIG = 'http://192.168.2.67:18002'	 //裴裴联调地址
-	URL_CONFIG = 'https://core-b.caimei365.com'
+	URL_CONFIG = 'http://192.168.2.67:18002'	 //裴裴联调地址
+	// URL_CONFIG = 'https://core-b.caimei365.com'
 	// URL_CONFIG = 'https://core.caimei365.com'
 }else{
     // 生产环境

+ 113 - 4
services/product.service.js

@@ -83,6 +83,21 @@ export default class ProductService {
 			isHost:true
 		})
 	}
+	/**
+	 * @商品详情-查看相关优惠券
+	 * @param:userId 用户ID(未登录传0或者'')
+	 * @param:productId 商品ID
+	 * @param:source 来源 1 WWW  2小程序
+	 * @param:status 优惠券领取状态 1 未领取  2 已领取
+	 */
+	QueryProductDetilsCoupons (data = {}) {
+		return this.AjaxService.get({ 
+			url:'/commodity/coupon/details/coupons', 
+			data, 
+			isLoading: true ,
+			isHost:true
+		})
+	}
 	/**
 	 * @商品详情-相关推荐
 	 * @param:productIds 商品ID
@@ -121,13 +136,22 @@ export default class ProductService {
 	}
 	
 	/**
-	 * @更新购物车商品增减
+	 * @更新购物车加减数量
 	 * @param:userId 用户ID(必填)
-	 * @param:productID 商品ID(必填)
-	 * @param:productCount 商品数量ID(必填)
 	 */
 	ShoppingCartUpdate (data = {}) {
-		return this.AjaxService.post({ url:'/shoppingCart/update', data, isLoading: true })
+		return this.AjaxService.post({ url:'/shoppingCart/update', data, isLoading: false })
+	}
+	
+	/**
+	 * @购物车领券弹窗优惠券列表
+	 * @param:userId 用户ID(必填)
+	 * @param:shopId 供应商ID(必填)
+	 * @param:source 来源 1 WWW 2小程序
+	 * @param:status 状态 1 未领取 2已领取
+	 */
+	ShoppingCartGetCoupon(data = {}) {
+		return this.AjaxService.get({ url:'/shoppingCart/get/coupon', data, isLoading: true })
 	}
 	/**
 	 * @删除购物车商品
@@ -249,4 +273,89 @@ export default class ProductService {
 	GetPersonalCenterInvoice (data = {}) {
 		return this.AjaxService.post({ url:'/personalCenter/invoice', data, isLoading: true })
 	}
+	/**
+	 * @优惠券-是定商品活动页列表
+	 * @param:userId 用户userId(未登录传0)
+	 * @param:pageNum 页码
+	 * @param:pageSize 每页条数
+	 * @param:couponId 优惠券ID
+	 */
+	QueryCouponActivityList (data = {}) {
+		return this.AjaxService.get({ 
+			url:'/commodity/coupon/activity/page', 
+			data, 
+			isLoading: true,
+			isHost:true
+		})
+	}
+	/**
+	 * @优惠券-个人中心优惠券列表
+	 * @param:userId 用户userId(必传)
+	 * @param:pageNum 页码
+	 * @param:pageSize 每页条数
+	 * @param:status 使用状态 1未使用 2已使用 3已失效
+	 */
+	QueryCouponCenter (data = {}) {
+		return this.AjaxService.get({ 
+			url:'/commodity/coupon/center', 
+			data, 
+			isLoading: false ,
+			isHost:true
+		})
+	}
+	/**
+	 * @优惠券-领取中心优惠券列表
+	 * @param:userId 用户userId(未登录传0)
+	 * @param:pageNum 每页页码
+	 * @param:pageSize 条数
+	 */
+	QueryCouponCollarList (data = {}) {
+		return this.AjaxService.get({ 
+			url:'/commodity/coupon/collar/list', 
+			data, 
+			isLoading: false ,
+			isHost:true
+		})
+	}
+	/**
+	 * @优惠券-领取优惠券
+	 * @param:userId 用户userId
+	 * @param:couponId 优惠券Id
+	 * @param:source 来源: 1WWW 2小程序
+	 */
+	ReceiveCoupon (data = {}) {
+		return this.AjaxService.post({ 
+			url:'/commodity/coupon/collar', 
+			data, 
+			isLoading: true ,
+			isHost:true
+		})
+	}
+	/**
+	 * @优惠券-兑换优惠券
+	 * @param:userId 用户userId
+	 * @param:redemptionCode 优惠券兑换码
+	 * @param:source 来源: 1WWW 2小程序
+	 */
+	ExchangeCoupon (data = {}) {
+		return this.AjaxService.post({ 
+			url:'/commodity/coupon/redeem', 
+			data, 
+			isLoading: true ,
+			isHost:true
+		})
+	}
+	/**
+	 * @优惠券-我的优惠券数量统计
+	 * @param:userId 用户userId(必传)
+	 */
+	QueryCouponsCount (data = {}) {
+		return this.AjaxService.get({ 
+			url:'/commodity/coupon/coupons/count', 
+			data, 
+			isLoading: false ,
+			isHost:true
+		})
+	}
+	
 }