Browse Source

Merge branch 'developerD' into developer

zhengjinyi 3 years ago
parent
commit
b9aa374393

+ 177 - 163
common/config/common.js

@@ -1,134 +1,147 @@
 //公共js,主要做表单验证,以及基本方法封装
 const utils = {
-	isNullOrEmpty: function(value) {
-		//是否为空
-		return (value === null || value === '' || value === undefined) ? true : false;
-	},
-	trim: function(value) {
-		//去空格
-		return value.replace(/(^\s*)|(\s*$)/g, "");
-	},
-	isEmail: function(value){
-		//是否为邮箱
-		 return RegExp(/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/).test(value);
-	},
-	isWebsite: function(value){
-		//是否为网址
-		return RegExp(/^((http|ftp|https):\/\/[a-zA-Z0-9]|[a-zA-Z0-9])[-a-zA-Z0-9]{0,62}(.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+.?$/).test(value);
-	},
-	isMobile: function(value) {
-		//是否为手机号
-		return RegExp(/^1[1-9][0-9]{9}$/).test(value);
-	},
-	isFloat: function(value) {
-		//金额,只允许保留两位小数
-		return RegExp(/^([0-9]*[.]?[0-9])[0-9]{0,1}$/).test(value);
-	},
-	isNum: function(value) {
-		//是否全为数字
-		return RegExp(/^[0-9]+$/).test(value);
-	},
-	isEmailCode:function(value) {
-	    return RegExp(/^\d{4}$/).test(value);
-	},
-	isMobileCode:function(value) {
-	    return RegExp(/^\d{6}$/).test(value);
-	},
-	isCredit:function(value) {//统一社会信用代码
-	    return RegExp(/^[0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/).test(value);
-	},
-	checkPwd: function(value) {//密码为8~20位数字和字母组合
-		return RegExp(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/).test(value);
-	},
-	isNoChinese: function(value) {//数字和字母组合
-		return RegExp(/^[A-Za-z0-9]+$/).test(value);
-	},
-	hidePhone:function(value) {
-		return value.replace(/^(\d{3})\d{4}(\d+)/,"$1****$2")
-	},
-	interceptHtmlFn: function(value){
-		return value ? value.replace(/<[^>]+>/g,"") : value
-	},
-	desensitizationName:function(value){
-		if(null != value && value != undefined){
-			if(value.length <= 3){
-				let ruten = value.substring(1);
-				return value.replace(ruten,'**');
-			} else if(value.length > 3 && value.length <= 6){
-				let ruten = value.substring(2);
-				return value.replace(ruten,'**');
-			} 
-		} else {
-			return "";
-		}
-	},
-	formatNum: function(num) {
-		//格式化手机号码
-		if (utils.isMobile(num)) {
-			num = num.replace(/^(\d{3})\d{4}(\d{4})$/, '$1****$2')
-		}
-		return num;
-	},
-	rmoney: function(money) {
-		//金额格式化
-		return parseFloat(money).toFixed(2).toString().split('').reverse().join('').replace(/(\d{3})/g, '$1,').replace(
-			/\,$/, '').split('').reverse().join('');
-	},
-	bankRegex:function(num){
-		let bankNum = ''
-		bankNum = num.replace(/\D/g, '').replace(/(....)(?=.)/g, '$1 ');
-		return bankNum
-	},
-	checkData:function(value){
-		let data;
-		if(value == null || value ==""){
-			data = ''
-		}else{
-			data = value
-		}
-		return data
-	},
-	formatDate: function(formatStr, fdate) {
-		//日期格式化
-		if (fdate) {
-			if (~fdate.indexOf('.')) {
-				fdate = fdate.substring(0, fdate.indexOf('.'));
-			}
-			fdate = fdate.toString().replace('T', ' ').replace(/\-/g, '/');
-			var fTime, fStr = 'ymdhis';
-			if (!formatStr)
-				formatStr = "y-m-d h:i:s";
-			if (fdate)
-				fTime = new Date(fdate);
-			else
-				fTime = new Date();
-			var month = fTime.getMonth() + 1;
-			var day = fTime.getDate();
-			var hours = fTime.getHours();
-			var minu = fTime.getMinutes();
-			var second = fTime.getSeconds();
-			month = month < 10 ? '0' + month : month;
-			day = day < 10 ? '0' + day : day;
-			hours = hours < 10 ? ('0' + hours) : hours;
-			minu = minu < 10 ? '0' + minu : minu;
-			second = second < 10 ? '0' + second : second;
-			var formatArr = [
-				fTime.getFullYear().toString(),
-				month.toString(),
-				day.toString(),
-				hours.toString(),
-				minu.toString(),
-				second.toString()
-			]
-			for (var i = 0; i < formatArr.length; i++) {
-				formatStr = formatStr.replace(fStr.charAt(i), formatArr[i]);
-			}
-			return formatStr;
-		} else {
-			return "";
-		}
-	},
-	throttle: function(fn, gapTime) {
+    isNullOrEmpty: function(value) {
+        //是否为空
+        return (value === null || value === '' || value === undefined) ? true : false
+    },
+    trim: function(value) {
+        //去空格
+        return value.replace(/(^\s*)|(\s*$)/g, '')
+    },
+    isEmail: function(value){
+        //是否为邮箱
+		 return RegExp(/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/).test(value)
+    },
+    isWebsite: function(value){
+        //是否为网址
+        return RegExp(/^((http|ftp|https):\/\/[a-zA-Z0-9]|[a-zA-Z0-9])[-a-zA-Z0-9]{0,62}(.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+.?$/).test(value)
+    },
+    isMobile: function(value) {
+        //是否为手机号
+        return RegExp(/^1[1-9][0-9]{9}$/).test(value)
+    },
+    isFloat: function(value) {
+        //金额,只允许保留两位小数
+        return RegExp(/^([0-9]*[.]?[0-9])[0-9]{0,1}$/).test(value)
+    },
+    isNum: function(value) {
+        //是否全为数字
+        return RegExp(/^[0-9]+$/).test(value)
+    },
+    isEmailCode:function(value) {
+	    return RegExp(/^\d{4}$/).test(value)
+    },
+    isMobileCode:function(value) {
+	    return RegExp(/^\d{6}$/).test(value)
+    },
+    isCredit:function(value) {//统一社会信用代码
+	    return RegExp(/^[0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/).test(value)
+    },
+    checkPwd: function(value) {//密码为8~20位数字和字母组合
+        return RegExp(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/).test(value)
+    },
+    isNoChinese: function(value) {//数字和字母组合
+        return RegExp(/^[A-Za-z0-9]+$/).test(value)
+    },
+    hidePhone:function(value) {
+        return value.replace(/^(\d{3})\d{4}(\d+)/,'$1****$2')
+    },
+    interceptHtmlFn: function(value){
+        return value ? value.replace(/<[^>]+>/g,'') : value
+    },
+    desensitizationName:function(value){
+        if(null != value && value != undefined){
+            if(value.length <= 3){
+                let ruten = value.substring(1)
+                return value.replace(ruten,'**')
+            } else if(value.length > 3 && value.length <= 6){
+                let ruten = value.substring(2)
+                return value.replace(ruten,'**')
+            } 
+        } else {
+            return ''
+        }
+    },
+    formatNum: function(num) {
+        //格式化手机号码
+        if (utils.isMobile(num)) {
+            num = num.replace(/^(\d{3})\d{4}(\d{4})$/, '$1****$2')
+        }
+        return num
+    },
+    rmoney: function(money) {
+        //金额格式化
+        return parseFloat(money).toFixed(2).toString().split('').reverse().join('').replace(/(\d{3})/g, '$1,').replace(
+            /\,$/, '').split('').reverse().join('')
+    },
+    bankRegex:function(num){
+        let bankNum = ''
+        bankNum = num.replace(/\D/g, '').replace(/(....)(?=.)/g, '$1 ')
+        return bankNum
+    },
+    checkData:function(value){
+        let data
+        if(value == null || value ==''){
+            data = ''
+        }else{
+            data = value
+        }
+        return data
+    },
+    formatAccMul:function(value1, value2) {// 修复数额丢失精度
+	    if (value1 == 0 || value2 == 0) {
+	      return 0
+	    }
+	    let m = 0
+	    let v1 = value1.toString()
+	    let v2 = value2.toString()
+	    m += v1.split('.')[1] ? v1.split('.')[1].length : 0
+	    m += v2.split('.')[1] ? v2.split('.')[1].length : 0
+	    let _v1 = Number(v1.replace('.', ''))
+	    let _v2 = Number(v2.replace('.', ''))
+	    return (_v1 * _v2) / Math.pow(10, m)
+    },
+    formatDate: function(formatStr, fdate) {
+        //日期格式化
+        if (fdate) {
+            if (~fdate.indexOf('.')) {
+                fdate = fdate.substring(0, fdate.indexOf('.'))
+            }
+            fdate = fdate.toString().replace('T', ' ').replace(/\-/g, '/')
+            var fTime, fStr = 'ymdhis'
+            if (!formatStr)
+                formatStr = 'y-m-d h:i:s'
+            if (fdate)
+                fTime = new Date(fdate)
+            else
+                fTime = new Date()
+            var month = fTime.getMonth() + 1
+            var day = fTime.getDate()
+            var hours = fTime.getHours()
+            var minu = fTime.getMinutes()
+            var second = fTime.getSeconds()
+            month = month < 10 ? '0' + month : month
+            day = day < 10 ? '0' + day : day
+            hours = hours < 10 ? ('0' + hours) : hours
+            minu = minu < 10 ? '0' + minu : minu
+            second = second < 10 ? '0' + second : second
+            var formatArr = [
+                fTime.getFullYear().toString(),
+                month.toString(),
+                day.toString(),
+                hours.toString(),
+                minu.toString(),
+                second.toString()
+            ]
+            for (var i = 0; i < formatArr.length; i++) {
+                formatStr = formatStr.replace(fStr.charAt(i), formatArr[i])
+            }
+            return formatStr
+        } else {
+            return ''
+        }
+    },
+    throttle: function(fn, gapTime) {
 	  if (gapTime == null || gapTime == undefined) {
 	    gapTime = 1500
 	  }
@@ -143,49 +156,50 @@ const utils = {
 	      _lastTime = _nowTime
 	    }
 	  }
-	},
+    },
 	
-	debounce: function(fn, delay, isImmediate) {
-	  var timer = null;  //初始化timer,作为计时清除依据
+    debounce: function(fn, delay, isImmediate) {
+	  var timer = null  //初始化timer,作为计时清除依据
 	  return function() {
-	    var context = this;  //获取函数所在作用域this
-	    var args = arguments;  //取得传入参数
-	    clearTimeout(timer);
+	    var context = this  //获取函数所在作用域this
+	    var args = arguments  //取得传入参数
+	    clearTimeout(timer)
 	    if(isImmediate && timer === null) {
 	        //时间间隔外立即执行
-	        fn.apply(context,args);
-	      timer = 0;
-	      return;
+	        fn.apply(context,args)
+	      timer = 0
+	      return
 	    }
 	    timer = setTimeout(function() {
-	      fn.apply(context,args);
-	      timer = null;
-	    }, delay);
+	      fn.apply(context,args)
+	      timer = null
+	    }, delay)
 	  }
-	}
+    }
 
 }
 
 module.exports = {
-	isNullOrEmpty: utils.isNullOrEmpty,
-	trim: utils.trim,
-	isMobile: utils.isMobile,
-	isEmail: utils.isEmail,
-	isWebsite:utils.isWebsite,
-	isFloat: utils.isFloat,
-	isNum: utils.isNum,
-	isEmailCode:utils.isEmailCode,
-	isMobileCode:utils.isMobileCode,
-	isNoChinese:utils.isNoChinese,
-	checkPwd: utils.checkPwd,
-	formatNum:utils.formatNum,
-	rmoney: utils.rmoney,
-	formatDate: utils.formatDate,
-	bankRegex: utils.bankRegex,
-	checkData:utils.checkData,
-	hidePhone:utils.hidePhone,
-	interceptHtmlFn:utils.interceptHtmlFn,
-	desensitizationName:utils.desensitizationName,
-	throttle: utils.throttle,
-	debounce: utils.debounce
+    isNullOrEmpty: utils.isNullOrEmpty,
+    trim: utils.trim,
+    isMobile: utils.isMobile,
+    isEmail: utils.isEmail,
+    isWebsite:utils.isWebsite,
+    isFloat: utils.isFloat,
+    isNum: utils.isNum,
+    isEmailCode:utils.isEmailCode,
+    isMobileCode:utils.isMobileCode,
+    isNoChinese:utils.isNoChinese,
+    checkPwd: utils.checkPwd,
+    formatNum:utils.formatNum,
+    rmoney: utils.rmoney,
+    formatDate: utils.formatDate,
+    formatAccMul: utils.formatAccMul,
+    bankRegex: utils.bankRegex,
+    checkData:utils.checkData,
+    hidePhone:utils.hidePhone,
+    interceptHtmlFn:utils.interceptHtmlFn,
+    desensitizationName:utils.desensitizationName,
+    throttle: utils.throttle,
+    debounce: utils.debounce
 }

+ 109 - 10
components/cm-module/cart-components/index.vue

@@ -329,7 +329,7 @@
 								class="empty-container-image"
 								:src="StaticUrl + '/icon/icon-coupon-empty@2x.png'"
 							></image>
-							<text class="error-text">暂无可领的优惠券~</text>
+							<text class="error-text">暂无优惠券~</text>
 						</view>
 						<template v-else>
 							<view
@@ -348,7 +348,13 @@
 									<view class="list-cell-top">
 										<view class="list-cell-type">
 											<view class="list-cell-tags">
-												<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
+												<template v-if="coupon.moneyCouponFlag == 1">
+													<text class="tags" v-if="coupon.moneyCouponType == 1">意向{{ coupon.couponType | TypeFormat }}</text>
+													<text class="tags" v-else>定向{{ coupon.couponType | TypeFormat }}</text>
+												</template>
+												<template v-else>
+													<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
+												</template>
 											</view>
 											<view
 												class="list-cell-texts"
@@ -378,13 +384,26 @@
 										</view>
 										<view class="list-cell-btn">
 											<view class="icon-used">
-												<view
-													class="icon-used-btn receive"
-													v-if="currentTab == 0"
-													@click="receiveCoupon(coupon)"
-													>领取</view
+												<template v-if="coupon.couponBtnType == 0">
+													<template v-if="coupon.moneyCouponFlag == 1">
+														<view class="icon-used-text">购买</view>
+														<view
+															class="icon-used-btn receive"
+															@click="toPayCoupon(coupon)"
+															>¥{{ coupon.moneyCouponPrice }}</view
+														>
+													</template>
+													<template v-else>	
+														<view
+															class="icon-used-btn receive"
+															@click="receiveCoupon(coupon)"
+															>领取</view
+														>
+													</template>
+												</template>
+												<view class="icon-used-btn make" v-if="coupon.couponBtnType == 1"
+													>已领取</view
 												>
-												<view class="icon-used-btn make" v-if="currentTab == 1">已领取</view>
 											</view>
 										</view>
 									</view>
@@ -1409,8 +1428,26 @@ export default {
 					console.log('获取优惠券列表失败')
 				})
 		},
+		toPayCoupon(coupon){
+			// 点击购买优惠券,友盟埋点收集购买优惠券
+			if (process.env.NODE_ENV != 'development') {
+				this.$uma.trackEvent('Um_Event_cartCouponBuy', {
+					Um_Key_PageName: '机构购物车',
+					Um_Key_EvenName: '购买优惠券',
+					Um_Key_CouponId: `${coupon.couponId}`,
+				})
+			}
+			this.MiniWxPayFor(coupon)
+		},
 		receiveCoupon(coupon) {
-			// 点击优惠券领取按钮
+			// 点击优惠券领取按钮,友盟埋点收集领取优惠券
+			if (process.env.NODE_ENV != 'development') {
+				this.$uma.trackEvent('Um_Event_cartCouponReceive', {
+					Um_Key_PageName: '机构购物车',
+					Um_Key_EvenName: '领取优惠券',
+					Um_Key_CouponId: `${coupon.couponId}`,
+				})
+			}
 			this.ProductService.ReceiveCoupon({
 				userId: this.couponParam.userId,
 				couponId: coupon.couponId,
@@ -1428,10 +1465,65 @@ export default {
 					this.$util.msg(error.msg, 2000)
 				})
 		},
+		async MiniWxPayFor(coupon){
+			const wechatcode = await authorize.getCode('weixin')
+			this.PayService.WeChatCouponMiniWxPay(
+				{
+					userId: this.userId,
+					couponId: coupon.couponId,
+					payWay: 'WEIXIN',
+					code: wechatcode,
+					source: 1 //支付来源 1 小程序 2 WWW
+				}
+			)
+			.then(response => {
+				// 友盟埋点收集微信支付
+				if (process.env.NODE_ENV != 'development') {
+					this.$uma.trackEvent('Um_Event_cartCouponPay', {
+						Um_Key_PageName: '机构购物车',
+						Um_Key_SourcePage: '线上支付优惠券',
+						Um_Key_CouponId: `${coupon.couponId}`,
+						Um_Key_userId: `${this.userId}`
+					})
+				}
+				let PayInfo = JSON.parse(response.data.data.payInfo)
+				this.WxRequestPayment(PayInfo)
+			})
+			.catch(error => {
+				this.$util.msg(error.msg, 2000)
+			})
+		},
+		WxRequestPayment(data){
+			let self = this
+			wx.requestPayment({
+				'timeStamp': data.timeStamp,
+				'nonceStr': data.nonceStr,
+				'package': data.package,
+				'signType': data.signType,
+				'paySign': data.paySign,
+				'success':function(res){
+					wx.reLaunch({url: '/pages/tabBar/user/user'})
+				},
+				'fail':function(res){
+					self.$util.msg('用户取消支付~')
+				},
+				'complete':function(res){
+		
+				}
+			})
+		},
 		showPopup(index, shop) {
 			// 显示popup弹窗
 			switch (index) {
 				case 0:
+					// 友盟埋点收集领券按钮
+					if (process.env.NODE_ENV != 'development') {
+						this.$uma.trackEvent('Um_Event_cartCouponButton', {
+							Um_Key_PageName: '机构购物车',
+							Um_Key_EvenName: '点击领券按钮',
+							Um_Key_userId: `${this.userId}`,
+						})
+					}
 					this.currentTab = 0
 					this.couponParam.status = 1
 					this.couponParam.shopId = shop.shopId
@@ -2174,7 +2266,14 @@ page {
 								width: 100%;
 								height: 100%;
 								box-sizing: border-box;
-								padding-top: 57rpx;
+								padding-top: 28rpx;
+								.icon-used-text {
+									width: 100%;
+									text-align: center;
+									line-height: 26rpx;
+									font-size: $font-size-20;
+									color: #f94b4b;
+								}
 								.icon-used-btn {
 									width: 128rpx;
 									height: 48rpx;

+ 30 - 0
components/cm-module/cm-seller/user.vue

@@ -82,6 +82,12 @@
 			</view>
 			<!-- 底部跳转 -->
 			<view class="foot-list">
+				<view class="list-cell-image" @click="navigator('/pages/user/coupon/coupon-activity')">
+					<view class="text">
+						<view class="h1">美博会</view>
+						<view class="p">大额好券等你来领~</view>
+					</view>
+				</view>
 				<view class="list-cell-item">
 					<view class="list-cell"  v-for="(item, index) in firstList" :key="index" @click="navigator(item.path)" hover-class="cell-hover" :hover-stay-time="50">
 						<view class="cell-icon">
@@ -517,6 +523,30 @@
 		padding: 0 24rpx;
 		padding-top: 168rpx;
 	}	
+	.list-cell-image{
+		width: 100%;
+		height: 168rpx;
+		background: url(https://static.caimei365.com/app/meibohui/app/activity-small-banner@2x.png);
+		background-size: cover;
+		box-sizing: border-box;
+		margin-bottom: 24rpx;
+		.text{
+			width: 100%;
+			height: 100%;
+			box-sizing: border-box;
+			padding:38rpx 56rpx;
+			.h1{
+				line-height: 50rpx;
+				font-size: $font-size-36;
+				color: #FFFFFF;
+			}
+			.p{
+				line-height: 34rpx;
+				font-size: $font-size-30;
+				color: #FFFFFF;
+			}
+		}
+	}
 	.list-cell-item{
 		width: 654rpx;
 		height: auto;

+ 12 - 2
components/cm-module/creatOrder/coupon.vue

@@ -29,7 +29,17 @@
 								<view class="list-cell-top">
 									<view class="list-cell-type">
 										<view class="list-cell-tags">
-											<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
+											<template v-if="coupon.moneyCouponFlag == 1">
+												<text class="tags" v-if="coupon.moneyCouponType == 1"
+													>意向{{ coupon.couponType | TypeFormat }}</text
+												>
+												<text class="tags" v-else
+													>定向{{ coupon.couponType | TypeFormat }}</text
+												>
+											</template>
+											<template v-else>
+												<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
+											</template>
 										</view>
 										<view class="list-cell-texts">
 											<text v-if="coupon.couponType == 0">
@@ -393,8 +403,8 @@ export default {
 					}
 				}
 			}
-	}
 		}
+	}
 	.tui-popup-btn {
 		width: 100%;
 		height: auto;

+ 11 - 1
components/cm-module/creatOrder/sellerCoupon.vue

@@ -38,7 +38,17 @@
 									<view class="list-cell-top">
 										<view class="list-cell-type">
 											<view class="list-cell-tags">
-												<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
+												<template v-if="coupon.moneyCouponFlag == 1">
+													<text class="tags" v-if="coupon.moneyCouponType == 1"
+														>意向{{ coupon.couponType | TypeFormat }}</text
+													>
+													<text class="tags" v-else
+														>定向{{ coupon.couponType | TypeFormat }}</text
+													>
+												</template>
+												<template v-else>
+													<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
+												</template>
 											</view>
 											<view class="list-cell-texts">
 												<text v-if="coupon.couponType == 0">

+ 8 - 1
components/cm-module/homeIndex/coupon.vue

@@ -9,7 +9,7 @@
 <script>
 	import { mapState,mapMutations } from 'vuex'
 	export default{
-		name:"navbars",
+		name:'navbars',
 		data() {
 			return{
 				
@@ -23,6 +23,13 @@
 		},
 		methods:{
 			navigator(url){
+				// 友盟埋点收集首页优惠券宣传图点击
+				if (process.env.NODE_ENV != 'development') {
+					this.$uma.trackEvent('Um_Event_homeCouponBannerClick', {
+						Um_Key_PageName: '采美商城首页',
+						Um_Key_SourcePage: '首页优惠券宣传图',
+					})
+				}
 				this.$api.navigateTo(url)
 			},
 		}

+ 2 - 2
components/cm-module/pageTemplate/templateTags.vue

@@ -24,7 +24,7 @@
 			</template>
 		</template>
 		<!-- 协销 -->
-		<template v-if="userIdentity === 1">
+		<template v-else-if="userIdentity === 1">
 			<template v-if="goods.actStatus == 1">
 				<view class="floor-tags" v-if="PromotionsFormat(goods.promotions)">
 					{{ goods.promotions.name }} <text>:¥{{ goods.price | NumFormat }}</text>
@@ -36,7 +36,7 @@
 			</template>
 		</template>
 		<!-- 个人机构 -->
-		<template v-if="userIdentity === 4">
+		<template v-else-if="userIdentity === 4">
 			<template v-if="goods.actStatus == 1">
 				<view class="floor-tags" v-if="PromotionsFormat(goods.promotions)"> {{ goods.promotions.name }} </view>
 				<view class="floor-tags" v-else>{{ goods.promotions.name }}</view>

+ 11 - 6
components/thorui/tui-nomore/tui-nomore.vue

@@ -1,14 +1,14 @@
 <template>
 	<view class="tui-nomore-class tui-loadmore-none" v-if="visible">
 		<view :class="[isDot?'tui-nomore-dot':'tui-nomore']">
-			<view :style="{backgroundColor:backgroundColor}" :class="[isDot?'tui-dot-text':'tui-nomore-text']">{{isDot?dotText:text}}</view>
+			<view :style="{backgroundColor:backgroundColor,color:color}" :class="[isDot?'tui-dot-text':'tui-nomore-text']">{{isDot?dotText:text}}</view>
 		</view>
 	</view>
 </template>
 
 <script>
 	export default {
-		name: "tuiNomore",
+		name: 'tuiNomore',
 		props: {
 			//是否可见
 			visible: {
@@ -18,23 +18,28 @@
 			//当前页面背景颜色
 			backgroundColor: { 
 				type: String,
-				default: "#fafafa"
+				default: '#fafafa'
 			},
 			//是否以圆点代替 "没有更多了"
 			isDot: {
 				type: Boolean,
 				default: false
 			},
+			//是否以圆点代替 "没有更多了"
+			color: {
+				type: String,
+				default: '#999999'
+			},
 			//isDot为false时生效
 			text: {
 				type: String,
-				default: "没有更多了"
+				default: '没有更多了'
 			}
 		},
 		data() {
 			return {
-				dotText: "●"
-			};
+				dotText: '●'
+			}
 		}
 	}
 </script>

+ 22 - 1
pages.json

@@ -397,6 +397,13 @@
                         "enablePullDownRefresh": true
                     }
                 },
+                {
+                    "path": "coupon/coupon-activity",
+                    "style": {
+                        "navigationBarTitleText": "采美云上美博会",
+                        "enablePullDownRefresh": true
+                    }
+                },
                 {
                     "path": "collection/collection",
                     "style": {
@@ -473,11 +480,25 @@
                     "style": {
                         "navigationBarTitleText": "立即下单"
                     }
-                }, {
+                },
+				{
                     "path": "cart/second",
                     "style": {
                         "navigationBarTitleText": "二手下单"
                     }
+                },
+				{
+                    "path": "cart/coupon",
+                    "style": {
+                        "navigationBarTitleText": "优惠券列表",
+						"enablePullDownRefresh": true
+                    }
+                },
+				{
+                    "path": "cart/coupon-share",
+                    "style": {
+                        "navigationBarTitleText": "购买优惠券"
+                    }
                 },
                 {
                     "path": "order/create-order",

+ 137 - 44
pages/goods/product.vue

@@ -172,7 +172,7 @@
 					<!-- 配套商品 -->
 					<view
 						class="product-supporting"
-						v-if="isShowSupportingList && supportingList.length>0"
+						v-if="isShowSupportingList && supportingList.length > 0"
 						@click.stop="handleSupporting"
 					>
 						<view class="product-supporting-title">配套商品({{ supportingNum }})</view>
@@ -251,10 +251,7 @@
 						<view class="title"> <view class="title-tab">商品详情</view> </view>
 						<view class="content tui-banner product-rich-text tui-skeleton-rect">
 							<template v-if="!goodsData.isNoneDisabled && product.productDetail.detailInfo">
-								<parser
-									:html="html"
-									:img-mode="widthFix"
-								></parser>
+								<parser :html="html" :img-mode="widthFix"></parser>
 							</template>
 							<view class="product-rich-text-none" v-else>暂无商品信息</view>
 						</view>
@@ -387,7 +384,13 @@
 											<view class="list-cell-top">
 												<view class="list-cell-type">
 													<view class="list-cell-tags">
-														<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
+														<template v-if="coupon.moneyCouponFlag == 1">
+															<text class="tags" v-if="coupon.moneyCouponType == 1">意向{{ coupon.couponType | TypeFormat }}</text>
+															<text class="tags" v-else>定向{{ coupon.couponType | TypeFormat }}</text>
+														</template>
+														<template v-else>
+															<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
+														</template>
 													</view>
 													<view class="list-cell-texts">
 														<text v-if="coupon.couponType == 0">
@@ -414,13 +417,24 @@
 												</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"
+														<template v-if="coupon.couponBtnType == 0">
+															<template v-if="coupon.moneyCouponFlag == 1">
+																<view class="icon-used-text">购买</view>
+																<view
+																	class="icon-used-btn receive"
+																	@click="toPayCoupon(coupon)"
+																	>¥{{ coupon.moneyCouponPrice }}</view
+																>
+															</template>
+															<template v-else>	
+																<view
+																	class="icon-used-btn receive"
+																	@click="receiveCoupon(coupon)"
+																	>领取</view
+																>
+															</template>
+														</template>
+														<view class="icon-used-btn make" v-if="coupon.couponBtnType == 1"
 															>已领取</view
 														>
 													</view>
@@ -467,7 +481,7 @@
 				<!-- 底部按钮 -->
 				<view class="menu" v-if="isShowButton">
 					<view class="bottom-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0rpx' }">
-						<view class="bottom-le"> 
+						<view class="bottom-le">
 							<view class="item-bt" @click="this.$api.switchTabTo('/pages/tabBar/home/index')">
 								<image src="../../static/icon-home-active@3x.png"></image> <text>首页</text>
 							</view>
@@ -630,7 +644,7 @@ export default {
 			shopId: 0,
 			shopID: 0,
 			vipFlag: 0,
-			firstClubType:0,
+			firstClubType: 0,
 			productId: 0,
 			userIdentity: 0, // 用户类型
 			goodsData: {}, // 自定义数据
@@ -662,7 +676,7 @@ export default {
 			popupShow0: false, // 参数弹窗
 			popupShow1: false, // 培训方案
 			popupShow2: false, // 优惠券
-			popupShow3:false,   // 购买弹窗
+			popupShow3: false, // 购买弹窗
 			tabSelectFlag: false,
 			sectionPropsArr: [],
 			scrollTopArray: [],
@@ -682,9 +696,9 @@ export default {
 			isPreviewImage: false,
 			opentype: '',
 			collectionType: false,
-			isShowSupportingList:false,
+			isShowSupportingList: false,
 			supportingList: [],
-			supportingNum:0 // 组合商品总数
+			supportingNum: 0 // 组合商品总数
 		}
 	},
 	computed: {
@@ -751,7 +765,8 @@ export default {
 		console.log('是iPhoneX', this.isIphoneX)
 	},
 	methods: {
-		async initGetStotage() {// 初始化
+		async initGetStotage() {
+			// 初始化
 			const userInfo = await this.$api.getStorage()
 			this.userId = this.couponParam.userId = userInfo.userId ? userInfo.userId : 0
 			this.userIdentity = userInfo.userIdentity ? userInfo.userIdentity : 0
@@ -803,6 +818,7 @@ export default {
 					this.buyRetailPriceStep = this.product.step
 					this.number = this.product.minBuyNumber
 					this.minBuyNumber = this.product.minBuyNumber
+					
 					//处理商品图片列表
 					this.product.imageList.forEach(item => {
 						this.productImage.push(item.image)
@@ -816,7 +832,6 @@ export default {
 						this.retailPrice = this.product.price.toFixed(2)
 						this.buyRetailPrice = this.product.price
 					}
-
 					//处理下架商品和售罄商品
 					if (this.product.validFlag == 3 || this.stock == 0) {
 						this.isNoneDisabled = true
@@ -834,10 +849,10 @@ export default {
 						} else {
 							this.disabled = false
 						}
-					} else if(this.product.priceFlag == 3){
+					} else if (this.product.priceFlag == 3) {
 						if (this.userIdentity == 4) {
 							this.disabled = true
-						} else if(this.userIdentity == 2 && this.firstClubType != 1){
+						} else if (this.userIdentity == 2 && this.firstClubType != 1) {
 							this.disabled = true
 						} else {
 							this.disabled = false
@@ -860,7 +875,7 @@ export default {
 					// setTimeout(() => {
 					//     this.getSectionProps()
 					// }, 2000)
-					if (this.hasLogin && this.userIdentity == 2 || this.userIdentity == 4) {
+					if ((this.hasLogin && this.userIdentity == 2) || this.userIdentity == 4) {
 						this.ProductCartNumber()
 					}
 					this.queryProductDetilsCoupons()
@@ -874,16 +889,26 @@ export default {
 					this.$util.msg(error.msg, 2000)
 				})
 		},
-		adaptRichTextImg(product){// 商品详情
+		adaptRichTextImg(product) {
+			// 商品详情
 			let defaulHtml = '<div style="text-align: center;color:#333333;">暂无内容</div>'
 			let html = ''
-			if(product.productDetailChose == 1){// 同资质机构显示商品详情
+			if (product.productDetailChose == 1) {
+				// 同资质机构显示商品详情
 				html = product.productDetail ? this.$api.adaptRichTextImg(product.productDetail.detailInfo) : defaulHtml
-			}else{
-				if(this.hasLogin && this.userIdentity !=4){
-					html = product.productDetail ? this.$api.adaptRichTextImg(product.productDetail.detailInfo) : defaulHtml
-				}else{
-					html = product.productDetail ? this.$api.adaptRichTextImg(product.productDetail.commonDetailInfo) : defaulHtml
+			} else {
+				if (this.hasLogin && this.userIdentity != 4) {
+					html = product.productDetail
+						? this.$api.adaptRichTextImg(product.productDetail.detailInfo)
+						: defaulHtml
+				} else {
+					if(product.productDetail.commonDetailInfo){
+						html = product.productDetail
+							? this.$api.adaptRichTextImg(product.productDetail.commonDetailInfo)
+							: defaulHtml
+					}else{
+						html = defaulHtml
+					}
 				}
 			}
 			return html
@@ -894,15 +919,15 @@ export default {
 				userId: this.userId,
 				productId: this.productId,
 				source: 2,
-				pageNum:1,
-				pageSize:4
+				pageNum: 1,
+				pageSize: 4
 			})
 				.then(response => {
-					const data = response.data 
+					const data = response.data
 					this.supportingList = data.results
 					this.supportingNum = data.totalRecord
-					if(this.supportingList.length>0){
-						if(!this.hasLogin || this.userIdentity == 2 || this.userIdentity == 4){
+					if (this.supportingList.length > 0) {
+						if (!this.hasLogin || this.userIdentity == 2 || this.userIdentity == 4) {
 							this.isShowSupportingList = true
 						}
 					}
@@ -949,8 +974,26 @@ export default {
 					console.log('获取购物车数量失败')
 				})
 		},
+		toPayCoupon(coupon) {
+			// 点击购买优惠券,友盟埋点收集购买优惠券
+			if (process.env.NODE_ENV != 'development') {
+				this.$uma.trackEvent('Um_Event_productCouponBuy', {
+					Um_Key_PageName: '商品详情',
+					Um_Key_EvenName: '购买优惠券',
+					Um_Key_CouponId: `${coupon.couponId}`,
+				})
+			}
+			this.MiniWxPayFor(coupon)
+		},
 		receiveCoupon(coupon) {
-			// 点击优惠券领取按钮
+			// 点击优惠券领取按钮,友盟埋点收集领取优惠券
+			if (process.env.NODE_ENV != 'development') {
+				this.$uma.trackEvent('Um_Event_productCouponReceive', {
+					Um_Key_PageName: '商品详情',
+					Um_Key_EvenName: '领取优惠券',
+					Um_Key_CouponId: `${coupon.couponId}`,
+				})
+			}
 			this.ProductService.ReceiveCoupon({
 				userId: this.couponParam.userId,
 				couponId: coupon.couponId,
@@ -968,6 +1011,53 @@ export default {
 					this.$util.msg(error.msg, 2000)
 				})
 		},
+		async MiniWxPayFor(coupon){
+			const wechatcode = await authorize.getCode('weixin')
+			this.PayService.WeChatCouponMiniWxPay(
+				{
+					userId: this.userId,
+					couponId: coupon.couponId,
+					payWay: 'WEIXIN',
+					code: wechatcode,
+					source: 1 //支付来源 1 小程序 2 WWW
+				}
+			)
+			.then(response => {
+				// 友盟埋点收集微信支付
+				if (process.env.NODE_ENV != 'development') {
+					this.$uma.trackEvent('Um_Event_productCouponPay', {
+						Um_Key_PageName: '商品详情',
+						Um_Key_SourcePage: '线上支付优惠券',
+						Um_Key_CouponId: `${coupon.couponId}`,
+						Um_Key_userId: `${this.userId}`
+					})
+				}
+				let PayInfo = JSON.parse(response.data.data.payInfo)
+				this.WxRequestPayment(PayInfo)
+			})
+			.catch(error => {
+				this.$util.msg(error.msg, 2000)
+			})
+		},
+		WxRequestPayment(data){
+			let self = this
+			wx.requestPayment({
+				'timeStamp': data.timeStamp,
+				'nonceStr': data.nonceStr,
+				'package': data.package,
+				'signType': data.signType,
+				'paySign': data.paySign,
+				'success':function(res){
+					wx.reLaunch({url: '/pages/tabBar/user/user'})
+				},
+				'fail':function(res){
+					self.$util.msg('用户取消支付~')
+				},
+				'complete':function(res){
+		
+				}
+			})
+		},
 		swiperChange(e) {
 			//顶部商品图片切换
 			const index = e.detail.current
@@ -1065,7 +1155,6 @@ export default {
 				}
 				this.isBtnType = type
 				this.popupShow3 = true
-				console.log('1313123113121')
 			} else {
 				this.$api.navigateTo('/pages/login/login?type=1')
 			}
@@ -1138,7 +1227,6 @@ export default {
 				this.popupShow3 = false
 			} else {
 				this.toConfirmation()
-				
 			}
 		},
 		toConfirmation() {
@@ -1147,9 +1235,7 @@ export default {
 				productIds: this.product.productId,
 				productCount: this.number
 			}
-			this.$api.navigateTo(
-				`/pages/user/order/create-order?type=1&data=${JSON.stringify({ data: productStp })}`
-			)
+			this.$api.navigateTo(`/pages/user/order/create-order?type=1&data=${JSON.stringify({ data: productStp })}`)
 			this.popupShow3 = false
 		},
 		getAddProductCart() {
@@ -1980,7 +2066,7 @@ page {
 		font-size: 24rpx;
 		color: #999999;
 		line-height: 60rpx;
-		&.bold{
+		&.bold {
 			font-weight: bold;
 			color: #333333;
 		}
@@ -2502,7 +2588,14 @@ page {
 								width: 100%;
 								height: 100%;
 								box-sizing: border-box;
-								padding-top: 57rpx;
+								padding-top: 28rpx;
+								.icon-used-text {
+									width: 100%;
+									text-align: center;
+									line-height: 26rpx;
+									font-size: $font-size-20;
+									color: #f94b4b;
+								}
 								.icon-used-btn {
 									width: 128rpx;
 									height: 48rpx;
@@ -2560,7 +2653,7 @@ page {
 			}
 		}
 	}
-	.tui-shopping-main{
+	.tui-shopping-main {
 		width: 100%;
 		.layer-smimg {
 			width: 114rpx;

+ 281 - 0
pages/seller/cart/coupon-share.vue

@@ -0,0 +1,281 @@
+<template>
+	<view class="container clearfix" >
+		<tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading	="true" :loadingType="5"></tui-skeleton>
+		<view class="container-content tui-skeleton" v-else>
+			<view class="container-list">
+				<view class="coupon-list">
+					<view class="list-cell-le">
+						<view class="list-cell-tags">
+							<template v-if="coupon.moneyCouponFlag == 1">
+								<text class="tags" v-if="coupon.moneyCouponType == 1"
+									>意向{{ coupon.couponType | TypeFormat }}</text
+								>
+								<text class="tags" v-else>定向{{ coupon.couponType | TypeFormat }}</text>
+							</template>
+							<template v-else>
+								<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
+							</template>
+						</view>
+						<view class="list-cell-price"> {{ coupon.couponAmount }}元满{{ coupon.touchPrice }}可用 </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 class="list-cell-time">{{ coupon.startDate }} - {{ coupon.endDate }}</view>
+					</view>
+					<view class="list-cell-ri">
+						<view class="coupon-minMoney">售价</view>
+						<view class="coupon-maxMoney"> <text class="small">¥</text> {{ coupon.moneyCouponPrice }} </view>
+					</view>
+				</view>
+			</view>
+			<view class="container-button">
+				<view class="button" @click="MiniWxPayFor">¥{{ coupon.moneyCouponPrice }}购买</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+import { mapState, mapMutations } from 'vuex'
+import authorize from '@/common/config/authorize.js'
+export default {
+	data() {
+		return {
+			StaticUrl: this.$Static,
+			isIphoneX: this.$store.state.isIphoneX,
+			coupon: {},
+			coupinList: [],
+			userId: 0, // 机构Id
+			couponId: 0, //优惠券Id
+			payAmount: 100 ,//支付金额
+			skeletonShow:true
+		}
+	},
+	onLoad(option) {
+		this.userId = option.userId
+		this.couponId = option.couponId
+		console.log('机构userId', this.userId)
+		console.log('价值优惠券Id', this.couponId)
+		this.initCouponDetail(this.couponId)
+	},
+	filters: {
+		TypeFormat(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: {
+		initCouponDetail(couponId) {
+			// 初始化优惠券信息
+			this.ProductService.QueryCouponDetail({ couponId: couponId })
+				.then(response => {
+					this.coupon = response.data
+					this.skeletonShow = false
+				})
+				.catch(error => {
+					console.log('初始化优惠券信息异常~')
+				})
+		},
+		async MiniWxPayFor() {
+			const wechatcode = await authorize.getCode('weixin')
+			this.PayService.WeChatCouponMiniWxPay({
+				userId: this.userId,
+				couponId: this.couponId,
+				payWay: 'WEIXIN',
+				code: wechatcode,
+				source: 1 //支付来源 1 小程序 2 WWW
+			})
+				.then(response => {
+					// 友盟埋点收集微信支付
+					if (process.env.NODE_ENV != 'development') {
+						this.$uma.trackEvent('Um_Event_shareCouponPay', {
+							Um_Key_PageName: '分享优惠券',
+							Um_Key_SourcePage: '线上支付优惠券',
+							Um_Key_CouponId: `${this.couponId}`,
+							Um_Key_userId: `${this.userId}`
+						})
+					}
+					let PayInfo = JSON.parse(response.data.data.payInfo)
+					this.WxRequestPayment(PayInfo)
+				})
+				.catch(error => {
+					this.$util.msg(error.msg, 2000)
+				})
+		},
+		WxRequestPayment(data) {
+			let self = this
+			wx.requestPayment({
+				timeStamp: data.timeStamp,
+				nonceStr: data.nonceStr,
+				package: data.package,
+				signType: data.signType,
+				paySign: data.paySign,
+				success: function(res) {
+					wx.reLaunch({ url: '/pages/tabBar/user/user' })
+				},
+				fail: function(res) {
+					self.$util.msg('用户取消支付~')
+				},
+				complete: function(res) {}
+			})
+		},
+		navigator(url) {
+			this.$api.navigateTo(url)
+		}
+	},
+	onShow() {}
+}
+</script>
+
+<style lang="scss">
+page {
+	background-color: #FFFFFF;
+}
+.container {
+	width: 100%;
+	height: auto;
+}
+.container-list {
+	box-sizing: border-box;
+	padding: 24rpx;
+	.empty-container-image {
+		width: 260rpx;
+		height: 260rpx;
+		margin-top: -300rpx;
+	}
+	.toIndexPage {
+		bottom: 390rpx;
+	}
+	.coupon-list {
+		width: 702rpx;
+		height: 200rpx;
+		box-sizing: border-box;
+		background: url(https://static.caimei365.com/app/img/icon/icon-coupon-buy@2x.png) no-repeat;
+		background-position: center;
+		background-size: auto 200rpx;
+		position: relative;
+		.list-cell-le {
+			width: 502rpx;
+			height: 100%;
+			box-sizing: border-box;
+			padding: 23rpx 32rpx;
+			float: left;
+			.list-cell-tags {
+				width: 100%;
+				height: 32rpx;
+				margin-bottom: 7rpx;
+				.tags {
+					display: inline-block;
+					padding: 0 10rpx;
+					height: 32rpx;
+					line-height: 32rpx;
+					background: linear-gradient(270deg, #f94b4b 0%, #feb673 100%);
+					color: #ffffff;
+					font-size: $font-size-22;
+					border-radius: 8rpx;
+					text-align: center;
+					float: left;
+				}
+			}
+			.list-cell-price {
+				width: 100%;
+				height: 45rpx;
+				line-height: 45rpx;
+				font-size: $font-size-32;
+				color: #333333;
+				text-align: left;
+				margin-top: 10rpx;
+				font-weight: bold;
+			}
+			.list-cell-texts {
+				width: 100%;
+				height: auto;
+				line-height: 40rpx;
+				text-overflow: ellipsis;
+				display: -webkit-box;
+				word-break: break-all;
+				-webkit-box-orient: vertical;
+				-webkit-line-clamp: 1;
+				overflow: hidden;
+				font-size: 26rpx;
+				color: #333333;
+			}
+			.list-cell-time {
+				width: 100%;
+				height: 32rpx;
+				line-height: 32rpx;
+				text-align: left;
+				font-size: $font-size-20;
+				color: #999999;
+			}
+		}
+		.list-cell-ri {
+			width: 200rpx;
+			height: 100%;
+			box-sizing: border-box;
+			padding: 58rpx 0 0 0;
+			float: right;
+			.coupon-maxMoney {
+				width: 100%;
+				height: 78rpx;
+				line-height: 78rpx;
+				font-size: 40rpx;
+				color: #f94b4b;
+				text-align: center;
+				.small {
+					font-size: $font-size-26;
+				}
+			}
+			.coupon-minMoney {
+				width: 100%;
+				height: 33rpx;
+				line-height: 33rpx;
+				font-size: $font-size-26;
+				color: #f94b4b;
+				text-align: center;
+			}
+		}
+	}
+}
+.container-button {
+	width: 100%;
+	height: 90rpx;
+	margin-top: 190rpx;
+	.button {
+		width: 600rpx;
+		height: 90rpx;
+		text-align: center;
+		background: $btn-confirm;
+		line-height: 90rpx;
+		font-size: $font-size-30;
+		color: #ffffff;
+		margin: 0 auto;
+		border-radius: 45rpx;
+	}
+}
+</style>

+ 376 - 0
pages/seller/cart/coupon.vue

@@ -0,0 +1,376 @@
+<template>
+	<view class="container clearfix">
+		<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-tag">售价¥{{ coupon.moneyCouponPrice }}</view>
+					<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 class="list-cell-ri">
+						<view class="list-cell-top">
+							<view class="list-cell-type">
+								<view class="list-cell-tags">
+									<template v-if="coupon.moneyCouponFlag == 1">
+										<text class="tags" v-if="coupon.moneyCouponType == 1"
+											>意向{{ coupon.couponType | TypeFormat }}</text
+										>
+										<text class="tags" v-else>定向{{ coupon.couponType | TypeFormat }}</text>
+									</template>
+									<template v-else>
+										<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
+									</template>
+								</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-btn">
+								<view class="icon-used">
+									<button open-type="share" class="icon-used-btn receive" :data-coupon="coupon">
+										分享购买
+									</button>
+								</view>
+							</view>
+						</view>
+						<view class="list-cell-time">{{ coupon.startDate }} - {{ coupon.endDate }}</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-->
+			</template>
+		</view>
+	</view>
+</template>
+
+<script>
+import { mapState, mapMutations } from 'vuex'
+import couponTabs from '@/components/cm-module/coupon/tui-tabs.vue'
+export default {
+	components: {
+		couponTabs
+	},
+	data() {
+		return {
+			StaticUrl: this.$Static,
+			isIphoneX: this.$store.state.isIphoneX,
+			listQuery: {
+				userId:0,
+				pageNum: 1,
+				pageSize: 10
+			},
+			coupinList: [],
+			isRequest: false,
+			showEmpty: false,
+			nomoreText: '上拉显示更多',
+			hasNextPage: false,
+			loadding: false,
+			pullUpOn: true,
+			pullFlag: true,
+			isReceiveLoading: false, //领券操作状态
+		}
+	},
+	onLoad() {
+		uni.hideShareMenu()
+		this.initGetStotage()
+	},
+	filters: {
+		TypeFormat(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: {
+		async initGetStotage() {
+			const userInfo = await this.$api.getStorage()
+			const clubInfo = await this.$api.getComStorage('orderUserInfo')
+			this.listQuery.userId = clubInfo.userId ? clubInfo.userId : 0
+			this.QueryCouponList()
+		},
+		QueryCouponList() {
+			// 初始化查询优惠券列表
+			this.coupinList = []
+			this.listQuery.pageNum = 1
+			this.ProductService.QueryMoneyCouponList(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.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)
+				})
+		},
+		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)
+				})
+		},
+		navigator(url) {
+			this.$api.navigateTo(url)
+		}
+	},
+	onShareAppMessage(res) {
+		//分享购买优惠券
+		const coupon = res.target.dataset.coupon
+		console.log('优惠券', coupon)
+		console.log('机构Id', this.listQuery.userId)
+		if (res.from === 'button') {
+			// console.log('来自页面内转发按钮')
+			return {
+				title: `只售${coupon.moneyCouponPrice}元,${coupon.couponAmount}元优惠券等您抢购~`,
+				path: `pages/seller/cart/coupon-share?couponId=${coupon.couponId}&userId=${this.listQuery.userId}`,
+				imageUrl: 'https://static.caimei365.com/app/img/icon/icon-shareCoupon@2x.png'
+			}
+		}
+	},
+	onPullDownRefresh() {
+		setTimeout(() => {
+			this.QueryCouponList()
+			uni.stopPullDownRefresh()
+		}, 200)
+	},
+	onReachBottom() {
+		if (this.hasNextPage) {
+			this.loadding = true
+			this.pullUpOn = true
+			this.getOnReachBottomData()
+		}
+	},
+	onShow() {}
+}
+</script>
+
+<style lang="scss">
+page {
+	background-color: #f7f7f7;
+}
+.container {
+	width: 100%;
+	height: auto;
+}
+.container-list {
+	box-sizing: border-box;
+	padding: 24rpx;
+	.empty-container-image {
+		width: 260rpx;
+		height: 260rpx;
+		margin-top: -300rpx;
+	}
+	.toIndexPage {
+		bottom: 390rpx;
+	}
+	.coupon-list {
+		width: 100%;
+		height: 200rpx;
+		margin-bottom: 24rpx;
+		box-sizing: border-box;
+		background: url(https://static.caimei365.com/app/img/icon/icon-coupon-uesb@2x.png);
+		background-size: cover;
+		position: relative;
+		.list-cell-tag {
+			height: 32rpx;
+			line-height: 32rpx;
+			text-align: center;
+			padding: 0 10rpx;
+			background-color: #fee756;
+			color: #f94b4b;
+			font-size: $font-size-20;
+			position: absolute;
+			top: 0;
+			border-radius: 8rpx 0 8rpx 0;
+		}
+		.list-cell-le {
+			width: 224rpx;
+			height: 100%;
+			box-sizing: border-box;
+			padding: 37rpx 0;
+			float: left;
+			.coupon-maxMoney {
+				width: 100%;
+				height: 78rpx;
+				line-height: 78rpx;
+				font-size: 56rpx;
+				color: #ffffff;
+				text-align: center;
+				.small {
+					font-size: $font-size-24;
+				}
+			}
+			.coupon-minMoney {
+				width: 100%;
+				height: 33rpx;
+				line-height: 33rpx;
+				font-size: $font-size-24;
+				color: #ffffff;
+				text-align: center;
+			}
+		}
+		.list-cell-ri {
+			width: 478rpx;
+			height: 100%;
+			box-sizing: border-box;
+			padding: 20rpx 24rpx 0 24rpx;
+			float: right;
+			.list-cell-top {
+				width: 100%;
+				height: 121rpx;
+				float: left;
+				border-bottom: 1px solid #e1e1e1;
+				.list-cell-type {
+					width: 286rpx;
+					height: 100%;
+					float: left;
+					.list-cell-tags {
+						width: 100%;
+						height: 32rpx;
+						margin-bottom: 7rpx;
+						.tags {
+							display: inline-block;
+							padding: 0 10rpx;
+							height: 32rpx;
+							line-height: 32rpx;
+							background-color: #ffdcce;
+							color: #f94b4b;
+							font-size: $font-size-20;
+							border-radius: 8rpx;
+							text-align: center;
+							float: left;
+						}
+					}
+					.list-cell-texts {
+						width: 100%;
+						height: auto;
+						line-height: 35rpx;
+						text-overflow: ellipsis;
+						display: -webkit-box;
+						word-break: break-all;
+						-webkit-box-orient: vertical;
+						-webkit-line-clamp: 2;
+						overflow: hidden;
+						font-size: 26rpx;
+						color: #333333;
+					}
+				}
+				.list-cell-btn {
+					width: 128rpx;
+					height: 100%;
+					float: right;
+					.icon-used {
+						width: 100%;
+						height: 100%;
+						box-sizing: border-box;
+						padding-top: 57rpx;
+						.icon-used-btn {
+							width: 128rpx;
+							height: 48rpx;
+							border-radius: 28rpx;
+							line-height: 48rpx;
+							font-size: $font-size-26;
+							text-align: center;
+							&.receive {
+								background-image: linear-gradient(270deg, #f94b4b 0%, #feb673 100%);
+								color: #ffffff;
+							}
+							&.make {
+								border: solid 1px #f94b4b;
+								color: #f94b4b;
+							}
+						}
+					}
+				}
+			}
+			.list-cell-time {
+				width: 100%;
+				height: 58rpx;
+				line-height: 58rpx;
+				text-align: left;
+				font-size: $font-size-20;
+				color: #999999;
+			}
+		}
+	}
+}
+</style>

+ 31 - 27
pages/seller/club/club-list.vue

@@ -47,7 +47,7 @@
 							<view class="list-item">
 								<view class="list-title">
 									<text class="list-name">{{ club.name }}</text>
-									<text class="list-hist" @click.stop="_goHistory(club)"
+									<text class="list-hist" @click.stop="_goOperation(5,club)"
 										><text class="iconfont icon-dingdanxuanzhong"></text>订单列表</text
 									>
 								</view>
@@ -59,12 +59,13 @@
 						</view>
 						<view class="club-list-bot">
 							<view class="list-opea">
-								<view class="btn org" @click.stop="_goImmediately(club)"> <text>立即下单</text> </view>
-								<view class="btn gre" @click.stop="_goSecond(club)"> <text>二手下单</text> </view>
-								<view class="btn yel" @click.stop="_goBuyagain(club)"> <text>再次购买</text> </view>
-								<view class="btn yeo" @click.stop="_goRechargeOrder(club)">
+								<view class="btn org" @click.stop="_goOperation(1,club)"> <text>立即下单</text> </view>
+								<view class="btn gre" @click.stop="_goOperation(2,club)"> <text>二手下单</text> </view>
+								<view class="btn yel" @click.stop="_goOperation(3,club)"> <text>再次购买</text> </view>
+								<view class="btn yeo" @click.stop="_goOperation(4,club)">
 									<text>充值/下订金</text>
 								</view>
+								<view class="btn yel" @click.stop="_goOperation(6,club)"> <text>购买优惠券</text> </view>
 							</view>
 						</view>
 					</view>
@@ -212,25 +213,28 @@ export default {
 			this.searchInputVal = ''
 			this.isShowClose = false
 		},
-		_goImmediately(item) {
-			this.$api.setStorage('orderUserInfo', item)
-			this.$api.navigateTo('/pages/seller/cart/immediately')
-		},
-		_goBuyagain(item) {
-			this.$api.setStorage('orderUserInfo', item)
-			this.$api.navigateTo('/pages/seller/cart/buyagain')
-		},
-		_goRechargeOrder(item) {
-			this.$api.setStorage('orderUserInfo', item)
-			this.$api.navigateTo('/pages/seller/order/create-recharge-order')
-		},
-		_goSecond(item) {
-			this.$api.setStorage('orderUserInfo', item)
-			this.$api.navigateTo('/pages/seller/cart/second')
-		},
-		_goHistory(item) {
-			this.$api.setStorage('orderUserInfo', item)
-			this.$api.navigateTo(`/pages/seller/order/order-historylist?clubID=${item.clubID}&listType=0`)
+		_goOperation(type,club){
+			this.$api.setStorage('orderUserInfo', club)
+			switch(type){
+				case 1:
+					this.$api.navigateTo('/pages/seller/cart/immediately')
+					break
+				case 2:
+					this.$api.navigateTo('/pages/seller/cart/second')
+					break
+				case 3:
+					this.$api.navigateTo('/pages/seller/cart/buyagain')
+					break
+				case 4:
+					this.$api.navigateTo('/pages/seller/order/create-recharge-order')
+					break
+				case 5:
+					this.$api.navigateTo('/pages/seller/order/order-historylist?listType=0')
+					break
+				case 6:
+					this.$api.navigateTo('/pages/seller/cart/coupon')
+					break
+			}
 		}
 	},
 	onReachBottom() {
@@ -421,12 +425,11 @@ page,
 		}
 		.club-list-bot {
 			width: 100%;
-			height: 60rpx;
+			height: auto;
 			float: left;
 			margin-top: 20rpx;
 			.list-opea {
 				width: 100%;
-				display: flex;
 				flex: 1;
 				color: #166ce1;
 				flex-direction: row;
@@ -439,7 +442,8 @@ page,
 					font-size: $font-size-24;
 					color: $text-color;
 					text-align: center;
-					margin: 0 15rpx;
+					margin: 7rpx;
+					float: left;
 					&.org {
 						background: rgba(22, 225, 77, 0.1);
 						color: #16e14d;

+ 557 - 0
pages/user/coupon/coupon-activity.vue

@@ -0,0 +1,557 @@
+<template>
+	<view class="container clearfix">
+		<tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading	="true" :loadingType="5"></tui-skeleton>
+		<view class="container-content tui-skeleton" v-else>
+			<view class="container-banner">
+				<image
+					class="image2x"
+					src="https://static.caimei365.com/app/meibohui/app/activity-banner@2x.jpg"
+					mode=""
+				></image>
+			</view>
+			<view class="container-title">超值优惠券</view>
+			<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.couponAmount }} </view>
+							<view class="coupon-minMoney"> 满{{ coupon.touchPrice }}可用 </view>
+						</view>
+						<view class="list-cell-ri">
+							<view class="list-cell-top">
+								<view class="list-cell-type">
+									<view class="list-cell-tags">
+										<template v-if="coupon.moneyCouponFlag == 1">
+											<text class="tags" v-if="coupon.moneyCouponType == 1"
+												>意向{{ coupon.couponType | TypeFormat }}</text
+											>
+											<text class="tags" v-else>定向{{ coupon.couponType | TypeFormat }}</text>
+										</template>
+										<template v-else>
+											<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
+										</template>
+									</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-btn">
+									<view class="icon-used">
+										<template v-if="coupon.moneyCouponFlag == 1">
+											<view class="icon-used-text">购买</view>
+											<view class="icon-used-btn buy" @click="toPayCoupon(coupon)"
+												>¥{{ coupon.moneyCouponPrice }}</view
+											>
+										</template>
+										<template v-else>
+											<view
+												class="icon-used-btn receive"
+												v-if="coupon.couponBtnType == 0"
+												@click="receiveCoupon(coupon)"
+												>领取</view
+											>
+											<view
+												class="icon-used-btn make"
+												v-if="coupon.couponBtnType == 1"
+												@click="toUseCoupon(coupon)"
+												>去使用</view
+											>
+										</template>
+									</view>
+								</view>
+							</view>
+							<view class="list-cell-time">{{ coupon.startDate }} - {{ coupon.endDate }}</view>
+						</view>
+					</view>
+					<!--加载loadding-->
+					<tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
+					<tui-nomore :visible="!pullUpOn" :backgroundColor="'#ff6b2b'" :color="'#FFFFFF'" :text="nomoreText"></tui-nomore>
+					<!--加载loadding-->
+				</template>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+import { mapState, mapMutations } from 'vuex'
+import authorize from '@/common/config/authorize.js'
+import wxLogin from '@/common/config/wxLogin.js'
+import couponTabs from '@/components/cm-module/coupon/tui-tabs.vue'
+export default {
+	components: {
+		couponTabs
+	},
+	data() {
+		return {
+			StaticUrl: this.$Static,
+			isIphoneX: this.$store.state.isIphoneX,
+			listQuery: {
+				userId: 0,
+				pageNum: 1,
+				pageSize: 10
+			},
+			coupinList: [],
+			isRequest: false,
+			showEmpty: false,
+			nomoreText: '上拉显示更多',
+			hasNextPage: false,
+			loadding: false,
+			pullUpOn: true,
+			pullFlag: true,
+			isReceiveLoading: false, //领券操作状态
+			userIdentity: 0,
+			skeletonShow:true
+		}
+	},
+	onLoad(option) {
+		if (option.type == 'share') {
+			wxLogin.wxLoginAuthorize()
+		}
+	},
+	filters: {
+		TypeFormat(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: {
+		async initGetStotage() {
+			// 初始化
+			const userInfo = await this.$api.getStorage()
+			this.listQuery.userId = userInfo.userId ? userInfo.userId : 0
+			this.userIdentity = userInfo.userIdentity ? userInfo.userIdentity : 0
+			this.QueryCouponList()
+		},
+		QueryCouponList() {
+			// 初始化查询优惠券列表
+			this.coupinList = []
+			this.listQuery.pageNum = 1
+			this.ProductService.QueryCouponCenterList(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.skeletonShow = false
+						this.pullFlag = false
+						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)
+				})
+		},
+		getOnReachBottomData() {
+			// 上滑加载分页
+			this.listQuery.pageNum += 1
+			this.ProductService.QueryCouponCenterList(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)
+				})
+		},
+		toPayCoupon(coupon) {
+			// 点击购买优惠券,友盟埋点收集购买优惠券
+			if (process.env.NODE_ENV != 'development') {
+				this.$uma.trackEvent('Um_Event_meibohuiCouponBuy', {
+					Um_Key_PageName: '美博会优惠券活动页',
+					Um_Key_EvenName: '购买优惠券',
+					Um_Key_CouponId: `${coupon.couponId}`,
+				})
+			}
+			if (this.hasLogin) {
+				if (this.userIdentity === 1 || this.userIdentity === 3) {
+					this.$util.msg('您的身份暂不支持领取优惠券', 2000)
+					return
+				}
+				this.MiniWxPayFor(coupon)
+			} else {
+				this.$api.navigateTo('/pages/login/login')
+			}
+		},
+		receiveCoupon(coupon) {
+			// 点击优惠券领取按钮,友盟埋点收集领取优惠券
+			if (process.env.NODE_ENV != 'development') {
+				this.$uma.trackEvent('Um_Event_meibohuiCouponReceive', {
+					Um_Key_PageName: '美博会优惠券活动页',
+					Um_Key_EvenName: '领取优惠券',
+					Um_Key_CouponId: `${coupon.couponId}`,
+				})
+			}
+			if (this.hasLogin) {
+				if (this.userIdentity === 1 || this.userIdentity === 3) {
+					this.$util.msg('您的身份暂不支持领取优惠券', 2000)
+					return
+				}
+				if (this.isReceiveLoading) {
+					return
+				}
+				this.ProductService.ReceiveCoupon({
+					userId: this.listQuery.userId,
+					couponId: coupon.couponId,
+					source: 2
+				})
+					.then(response => {
+						this.isReceiveLoading = true
+						this.$util.msg('领取成功', 1500, true, 'success')
+						setTimeout(() => {
+							coupon.couponBtnType = 1
+							this.isReceiveLoading = false
+						}, 1500)
+					})
+					.catch(error => {
+						this.$util.msg(error.msg, 2000)
+						this.isReceiveLoading = false
+					})
+			} else {
+				this.$api.navigateTo('/pages/login/login')
+			}
+		},
+		toUseCoupon(coupon) {
+			// 去使用跳转路径,友盟埋点收集去使用优惠券
+			if (process.env.NODE_ENV != 'development') {
+				this.$uma.trackEvent('Um_Event_meibohuiCouponToUseCoupon', {
+					Um_Key_PageName: '美博会优惠券活动页',
+					Um_Key_EvenName: '使用优惠券',
+					Um_Key_CouponId: `${coupon.couponId}`,
+				})
+			}
+			switch (coupon.couponType) {
+				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 1: // 品类券:跳转到产品 287 / 仪器页 286
+					this.$api.navigateTo(`/pages/goods/good-floor?linkId=${coupon.categoryType == 1 ? 287 : 286}`)
+					break
+				case 2: // 用户专享券:跳转到商城首页
+					this.$api.switchTabTo('/pages/tabBar/home/index')
+					break
+				case 3: // 店铺券:跳转到店铺首页
+					this.$api.navigateTo('/pages/supplier/user/my-shop?shopId=' + coupon.shopId)
+					break
+				case 4: // 新用户券:跳转到商城首页
+					this.$api.switchTabTo('/pages/tabBar/home/index')
+					break
+			}
+		},
+		async MiniWxPayFor(coupon) {
+			const wechatcode = await authorize.getCode('weixin')
+			this.PayService.WeChatCouponMiniWxPay({
+				userId: this.listQuery.userId,
+				couponId: coupon.couponId,
+				payWay: 'WEIXIN',
+				code: wechatcode,
+				source: 1 //支付来源 1 小程序 2 WWW
+			})
+				.then(response => {
+					// 友盟埋点收集微信支付
+					if (process.env.NODE_ENV != 'development') {
+						this.$uma.trackEvent('Um_Event_meibohuiCouponPay', {
+							Um_Key_PageName: '美博会优惠券活动页',
+							Um_Key_SourcePage: '线上支付优惠券',
+							Um_Key_CouponId: `${coupon.couponId}`,
+							Um_Key_userId: `${this.userId}`
+						})
+					}
+					let PayInfo = JSON.parse(response.data.data.payInfo)
+					this.WxRequestPayment(PayInfo)
+				})
+				.catch(error => {
+					this.$util.msg(error.msg, 2000)
+				})
+		},
+		WxRequestPayment(data) {
+			let self = this
+			wx.requestPayment({
+				timeStamp: data.timeStamp,
+				nonceStr: data.nonceStr,
+				package: data.package,
+				signType: data.signType,
+				paySign: data.paySign,
+				success: function(res) {
+					wx.reLaunch({ url: '/pages/tabBar/user/user' })
+				},
+				fail: function(res) {
+					self.$util.msg('用户取消支付~')
+				},
+				complete: function(res) {}
+			})
+		},
+		navigator(url) {
+			this.$api.navigateTo(url)
+		}
+	},
+	onShareAppMessage(res) {
+		//分享美博会优惠券活动页
+		if (res.from === 'button') {
+			// console.log('来自页面内转发按钮')
+		}
+		return {
+			title: '采美线上美博会盛大开启,众多优惠等着您~',
+			path: '/pages/user/coupon/coupon-activity?type=share',
+			imageUrl: 'https://static.caimei365.com/app/meibohui/app/activity-share@2x.jpg'
+		}
+	},
+	onPullDownRefresh() {
+		setTimeout(() => {
+			this.QueryCouponList()
+			uni.stopPullDownRefresh()
+		}, 200)
+	},
+	onReachBottom() {
+		if (this.hasNextPage) {
+			this.loadding = true
+			this.pullUpOn = true
+			this.getOnReachBottomData()
+		}
+	},
+	onShow() {
+		this.initGetStotage()
+	}
+}
+</script>
+
+<style lang="scss">
+page {
+	background-color: #ff6b2b;
+}
+.container {
+	width: 100%;
+	height: auto;
+}
+.container-banner {
+	width: 750rpx;
+	height: 750rpx;
+	.image2x {
+		width: 750rpx;
+		height: 750rpx;
+		display: block;
+	}
+}
+.container-title {
+	width: 100%;
+	height: 130rpx;
+	line-height: 130rpx;
+	text-align: center;
+	font-size: $font-size-36;
+	color: #FFFFFF;
+}
+.container-list {
+	box-sizing: border-box;
+	padding: 0 24rpx;
+	.empty-container-image {
+		width: 260rpx;
+		height: 260rpx;
+		margin-top: -300rpx;
+	}
+	.toIndexPage {
+		bottom: 390rpx;
+	}
+	.coupon-list {
+		width: 100%;
+		height: 200rpx;
+		margin-bottom: 24rpx;
+		box-sizing: border-box;
+		background: url(https://static.caimei365.com/app/img/icon/icon-coupon-uesbs@2x.png);
+		background-size: cover;
+		.list-cell-le {
+			width: 224rpx;
+			height: 100%;
+			box-sizing: border-box;
+			padding: 37rpx 0;
+			float: left;
+			.coupon-maxMoney {
+				width: 100%;
+				height: 78rpx;
+				line-height: 78rpx;
+				font-size: 56rpx;
+				color: #ffffff;
+				text-align: center;
+				.small {
+					font-size: $font-size-24;
+				}
+			}
+			.coupon-minMoney {
+				width: 100%;
+				height: 33rpx;
+				line-height: 33rpx;
+				font-size: $font-size-24;
+				color: #ffffff;
+				text-align: center;
+			}
+		}
+		.list-cell-ri {
+			width: 478rpx;
+			height: 100%;
+			box-sizing: border-box;
+			padding: 20rpx 24rpx 0 24rpx;
+			float: right;
+			.list-cell-top {
+				width: 100%;
+				height: 121rpx;
+				float: left;
+				border-bottom: 1px solid #e1e1e1;
+				.list-cell-type {
+					width: 286rpx;
+					height: 100%;
+					float: left;
+					.list-cell-tags {
+						width: 100%;
+						height: 32rpx;
+						margin-bottom: 7rpx;
+						.tags {
+							display: inline-block;
+							padding: 0 10rpx;
+							height: 32rpx;
+							line-height: 32rpx;
+							background-color: #ffdcce;
+							color: #f94b4b;
+							font-size: $font-size-20;
+							border-radius: 8rpx;
+							text-align: center;
+							float: left;
+						}
+					}
+					.list-cell-texts {
+						width: 100%;
+						height: auto;
+						line-height: 35rpx;
+						text-overflow: ellipsis;
+						display: -webkit-box;
+						word-break: break-all;
+						-webkit-box-orient: vertical;
+						-webkit-line-clamp: 2;
+						overflow: hidden;
+						font-size: 26rpx;
+						color: #333333;
+					}
+				}
+				.list-cell-btn {
+					width: 128rpx;
+					height: 100%;
+					float: right;
+					.icon-used {
+						width: 100%;
+						height: 100%;
+						box-sizing: border-box;
+						padding-top: 28rpx;
+						.icon-used-text {
+							width: 100%;
+							text-align: center;
+							line-height: 26rpx;
+							font-size: $font-size-20;
+							color: #f94b4b;
+						}
+						.icon-used-btn {
+							height: 48rpx;
+							border-radius: 28rpx;
+							line-height: 48rpx;
+							font-size: $font-size-26;
+							padding: 0 6rpx;
+							text-align: center;
+							box-sizing: border-box;
+							&.buy {
+								background-image: linear-gradient(270deg, #f94b4b 0%, #feb673 100%);
+								color: #ffffff;
+							}
+							&.receive {
+								background-image: linear-gradient(270deg, #f94b4b 0%, #feb673 100%);
+								color: #ffffff;
+							}
+							&.make {
+								border: solid 1px #f94b4b;
+								color: #f94b4b;
+							}
+						}
+					}
+				}
+			}
+			.list-cell-time {
+				width: 100%;
+				height: 58rpx;
+				line-height: 58rpx;
+				text-align: left;
+				font-size: $font-size-20;
+				color: #999999;
+			}
+		}
+	}
+}
+</style>

+ 401 - 271
pages/user/coupon/coupon-collection.vue

@@ -2,41 +2,68 @@
 	<view class="container clearfix">
 		<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>
+				<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 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.couponAmount }}
-						</view>
-						<view class="coupon-minMoney">
-							满{{ coupon.touchPrice }}可用
-						</view>
+						<view class="coupon-maxMoney"> <text class="small">¥</text> {{ coupon.couponAmount }} </view>
+						<view class="coupon-minMoney"> 满{{ coupon.touchPrice }}可用 </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>
+									<template v-if="coupon.moneyCouponFlag == 1">
+										<text class="tags" v-if="coupon.moneyCouponType == 1"
+											>意向{{ coupon.couponType | TypeFormat }}</text
+										>
+										<text class="tags" v-else>定向{{ coupon.couponType | TypeFormat }}</text>
+									</template>
+									<template v-else>
+										<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
+									</template>
 								</view>
 								<view class="list-cell-texts">
 									<text v-if="coupon.couponType == 0">
-										{{ coupon.productType && coupon.productType == 1 ? '全商城商品通用' : '仅可购买指定商品'  }}
+										{{
+											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 == 3"
+										>仅限购买店铺【{{ coupon.shopName }}】的商品</text
+									>
 									<text v-if="coupon.couponType == 4 || coupon.couponType == 2">全商城商品通用</text>
 								</view>
 							</view>
 							<view class="list-cell-btn">
 								<view class="icon-used">
-									<view class="icon-used-btn receive" v-if="coupon.couponBtnType == 0" @click="receiveCoupon(coupon)">领取</view>
-									<view class="icon-used-btn make" v-if="coupon.couponBtnType == 1" @click="toUseCoupon(coupon)">去使用</view>
+									<template v-if="coupon.moneyCouponFlag == 1">
+										<view class="icon-used-text">购买</view>
+										<view class="icon-used-btn buy" @click="toPayCoupon(coupon)"
+											>¥{{ coupon.moneyCouponPrice }}</view
+										>
+									</template>
+									<template v-else>
+										<view
+											class="icon-used-btn receive"
+											v-if="coupon.couponBtnType == 0"
+											@click="receiveCoupon(coupon)"
+											>领取</view
+										>
+										<view
+											class="icon-used-btn make"
+											v-if="coupon.couponBtnType == 1"
+											@click="toUseCoupon(coupon)"
+											>去使用</view
+										>
+									</template>
 								</view>
 							</view>
 						</view>
@@ -45,7 +72,7 @@
 				</view>
 				<!--加载loadding-->
 				<tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
-				<tui-nomore :visible="!pullUpOn" :backgroundColor="'#F7F7F7'" :text='nomoreText'></tui-nomore>
+				<tui-nomore :visible="!pullUpOn" :backgroundColor="'#F7F7F7'" :text="nomoreText"></tui-nomore>
 				<!--加载loadding-->
 			</template>
 		</view>
@@ -53,325 +80,428 @@
 </template>
 
 <script>
-	import { mapState,mapMutations} from 'vuex'
-	import couponTabs from '@/components/cm-module/coupon/tui-tabs.vue'
-	export default {
-		components:{
-			couponTabs
-		},
-		data() {
-			return {
-				StaticUrl:this.$Static,
-				isIphoneX:this.$store.state.isIphoneX,
-				listQuery:{
-					userId:0,
-					pageNum:1,
-					pageSize:10
-				},
-				coupinList:[],
-				isRequest:false,
-				showEmpty: false,
-				nomoreText: '上拉显示更多',
-				hasNextPage:false,
-				loadding: false,
-				pullUpOn: true,
-				pullFlag: true,
-				isReceiveLoading:false, //领券操作状态
-			}
-		},
-		onLoad() {
-			
-		},
-		filters: {
-			TypeFormat(value) {
-				switch (value) {
-					case 0:
-						return  '活动券'
-						break
-					case 1:
-						return  '品类券'
-						break
-					case 2:
-						return  '用户专享券'
-						break
-					case 3:
-						return  '店铺券'
-						break
-					case 4:
-						return  '新用户券'
-						break
-				}
+import { mapState, mapMutations } from 'vuex'
+import authorize from '@/common/config/authorize.js'
+import couponTabs from '@/components/cm-module/coupon/tui-tabs.vue'
+export default {
+	components: {
+		couponTabs
+	},
+	data() {
+		return {
+			StaticUrl: this.$Static,
+			isIphoneX: this.$store.state.isIphoneX,
+			userIdentity: 0,
+			listQuery: {
+				userId: 0,
+				pageNum: 1,
+				pageSize: 10
+			},
+			coupinList: [],
+			isRequest: false,
+			showEmpty: false,
+			nomoreText: '上拉显示更多',
+			hasNextPage: false,
+			loadding: false,
+			pullUpOn: true,
+			pullFlag: true,
+			isReceiveLoading: false //领券操作状态
+		}
+	},
+	onLoad() {},
+	filters: {
+		TypeFormat(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: {
+		async initGetStotage() {
+			// 初始化
+			const userInfo = await this.$api.getStorage()
+			this.listQuery.userId = userInfo.userId ? userInfo.userId : 0
+			this.userIdentity = userInfo.userIdentity ? userInfo.userIdentity : 0
+			this.QueryCouponList()
 		},
-		computed: {
-			...mapState(['hasLogin','userInfo','identity','isActivity'])
-		},
-		methods: {
-			QueryCouponList() {// 初始化查询优惠券列表
-				this.coupinList = []
-				this.listQuery.pageNum = 1
-				this.ProductService.QueryCouponCollarList(this.listQuery).then(response =>{
+		QueryCouponList() {
+			// 初始化查询优惠券列表
+			this.coupinList = []
+			this.listQuery.pageNum = 1
+			this.ProductService.QueryCouponCollarList(this.listQuery)
+				.then(response => {
 					let data = response.data
-					if(data.list&&data.list.length > 0){
+					if (data.list && data.list.length > 0) {
 						this.showEmpty = false
 						this.hasNextPage = response.data.hasNextPage
-						this.coupinList =data.list
+						this.coupinList = data.list
 						this.pullFlag = false
-						setTimeout(()=>{this.pullFlag = true},500)
-						if(this.hasNextPage){
+						setTimeout(() => {
+							this.pullFlag = true
+						}, 500)
+						if (this.hasNextPage) {
 							this.pullUpOn = false
 							this.nomoreText = '上拉显示更多'
-						}else{
-							if(this.coupinList.length < 8){
+						} else {
+							if (this.coupinList.length < 8) {
 								this.pullUpOn = true
-							}else{
+							} else {
 								this.pullUpOn = false
 								this.loadding = false
 								this.nomoreText = '已至底部'
 							}
 						}
-					}else{
+					} else {
 						this.showEmpty = true
 					}
 					this.isRequest = true
-				}).catch(error =>{
-					this.$util.msg(error.msg,2000)
 				})
-			},
-			getOnReachBottomData(){// 上滑加载分页
-				this.listQuery.pageNum+=1
-				this.ProductService.QueryCouponCollarList(this.listQuery)
-				.then(response =>{
+				.catch(error => {
+					this.$util.msg(error.msg, 2000)
+				})
+		},
+		getOnReachBottomData() {
+			// 上滑加载分页
+			this.listQuery.pageNum += 1
+			this.ProductService.QueryCouponCollarList(this.listQuery)
+				.then(response => {
 					let data = response.data
-					if(data.list&&data.list.length > 0){
+					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.coupinList = this.coupinList.concat(data.list)
+						this.pullFlag = false // 防上拉暴滑
+						setTimeout(() => {
+							this.pullFlag = true
+						}, 500)
+						if (this.hasNextPage) {
 							this.pullUpOn = false
 							this.nomoreText = '上拉显示更多'
-						}else{
+						} else {
 							this.pullUpOn = false
 							this.loadding = false
 							this.nomoreText = '已至底部'
 						}
 					}
 				})
-				.catch(error =>{
-					this.$util.msg(error.msg,2000)
+				.catch(error => {
+					this.$util.msg(error.msg, 2000)
 				})
-			},
-			receiveCoupon(coupon){// 点击优惠券领取按钮
-				if(this.hasLogin){
-					if(this.isReceiveLoading){return}
-					this.ProductService.ReceiveCoupon(
-						{
-							userId:this.listQuery.userId,
-							couponId:coupon.couponId,
-							source:2
-						}) 
-					.then(response =>{
+		},
+		toPayCoupon(coupon) {
+			// 点击购买优惠券,友盟埋点收集购买优惠券
+			if (process.env.NODE_ENV != 'development') {
+				this.$uma.trackEvent('Um_Event_userCouponCollectionBuy', {
+					Um_Key_PageName: '领券中心',
+					Um_Key_EvenName: '购买优惠券',
+					Um_Key_CouponId: `${coupon.couponId}`,
+				})
+			}
+			if (this.hasLogin) {
+				if (this.userIdentity === 1 || this.userIdentity === 3) {
+					this.$util.msg('您的身份暂不支持领取优惠券', 2000)
+					return
+				}
+				this.MiniWxPayFor(coupon)
+			} else {
+				this.$api.navigateTo('/pages/login/login')
+			}
+		},
+		receiveCoupon(coupon) {
+			// 点击优惠券领取按钮,友盟埋点收集领取优惠券
+			if (process.env.NODE_ENV != 'development') {
+				this.$uma.trackEvent('Um_Event_userCouponCollectionReceive', {
+					Um_Key_PageName: '领券中心',
+					Um_Key_EvenName: '领取优惠券',
+					Um_Key_CouponId: `${coupon.couponId}`,
+				})
+			}
+			if (this.hasLogin) {
+				if (this.isReceiveLoading) {
+					return
+				}
+				this.ProductService.ReceiveCoupon({
+					userId: this.listQuery.userId,
+					couponId: coupon.couponId,
+					source: 2
+				})
+					.then(response => {
 						this.isReceiveLoading = true
-						this.$util.msg('领取成功',1500,true,'success')
-						setTimeout(()=>{
+						this.$util.msg('领取成功', 1500, true, 'success')
+						setTimeout(() => {
 							coupon.couponBtnType = 1
 							this.isReceiveLoading = false
-						},1500)
+						}, 1500)
 					})
-					.catch(error =>{
-						this.$util.msg(error.msg,2000)
+					.catch(error => {
+						this.$util.msg(error.msg, 2000)
 						this.isReceiveLoading = false
 					})
-				}else{
-					this.$api.navigateTo('/pages/login/login')
-				}
-			},
-			toUseCoupon(coupon){// 去使用跳转路径
-				console.log('coupon',coupon)
-				switch (coupon.couponType) {
-					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 1:// 品类券:跳转到产品 287 / 仪器页 286
-						this.$api.navigateTo(`/pages/goods/good-floor?linkId=${ coupon.categoryType == 1 ? 287 : 286 }`)
-						break
-					case 2:// 用户专享券:跳转到商城首页
-						this.$api.switchTabTo('/pages/tabBar/home/index')
-						break
-					case 3:// 店铺券:跳转到店铺首页
-						this.$api.navigateTo('/pages/supplier/user/my-shop?shopId='+coupon.shopId)
-						break
-					case 4:// 新用户券:跳转到商城首页
-						this.$api.switchTabTo('/pages/tabBar/home/index')
-						break
-				}
-			},
-			navigator(url){
-				this.$api.navigateTo(url)
-			},	
+			} else {
+				this.$api.navigateTo('/pages/login/login')
+			}
 		},
-		onPullDownRefresh() {
-			setTimeout(() => {
-				this.QueryCouponList()
-				uni.stopPullDownRefresh()
-			}, 200)
+		toUseCoupon(coupon) {
+			// 去使用跳转路径,友盟埋点收集去使用优惠券
+			if (process.env.NODE_ENV != 'development') {
+				this.$uma.trackEvent('Um_Event_userCouponCollectionToUseCoupon', {
+					Um_Key_PageName: '领券中心',
+					Um_Key_EvenName: '使用优惠券',
+					Um_Key_CouponId: `${coupon.couponId}`,
+				})
+			}
+			switch (coupon.couponType) {
+				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 1: // 品类券:跳转到产品 287 / 仪器页 286
+					this.$api.navigateTo(`/pages/goods/good-floor?linkId=${coupon.categoryType == 1 ? 287 : 286}`)
+					break
+				case 2: // 用户专享券:跳转到商城首页
+					this.$api.switchTabTo('/pages/tabBar/home/index')
+					break
+				case 3: // 店铺券:跳转到店铺首页
+					this.$api.navigateTo('/pages/supplier/user/my-shop?shopId=' + coupon.shopId)
+					break
+				case 4: // 新用户券:跳转到商城首页
+					this.$api.switchTabTo('/pages/tabBar/home/index')
+					break
+			}
 		},
-		onReachBottom() {
-			if(this.hasNextPage){
-				this.loadding = true
-				this.pullUpOn = true
-				this.getOnReachBottomData()
-			}	
+		async MiniWxPayFor(coupon) {
+			const wechatcode = await authorize.getCode('weixin')
+			this.PayService.WeChatCouponMiniWxPay({
+				userId: this.listQuery.userId,
+				couponId: coupon.couponId,
+				payWay: 'WEIXIN',
+				code: wechatcode,
+				source: 1 //支付来源 1 小程序 2 WWW
+			})
+				.then(response => {
+					// 友盟埋点收集微信支付
+					if (process.env.NODE_ENV != 'development') {
+						this.$uma.trackEvent('Um_Event_userCouponCollectionPay', {
+							Um_Key_PageName: '领券中心',
+							Um_Key_SourcePage: '线上支付优惠券',
+							Um_Key_CouponId: `${coupon.couponId}`,
+							Um_Key_userId: `${this.userId}`
+						})
+					}
+					let PayInfo = JSON.parse(response.data.data.payInfo)
+					this.WxRequestPayment(PayInfo)
+				})
+				.catch(error => {
+					this.$util.msg(error.msg, 2000)
+				})
 		},
-		onShow(){
-			this.$api.getComStorage('userInfo').then((resolve) =>{
-				this.listQuery.userId = resolve.userId ? resolve.userId : 0
-				this.QueryCouponList()
+		WxRequestPayment(data) {
+			let self = this
+			wx.requestPayment({
+				timeStamp: data.timeStamp,
+				nonceStr: data.nonceStr,
+				package: data.package,
+				signType: data.signType,
+				paySign: data.paySign,
+				success: function(res) {
+					wx.reLaunch({ url: '/pages/tabBar/user/user' })
+				},
+				fail: function(res) {
+					self.$util.msg('用户取消支付~')
+				},
+				complete: function(res) {}
 			})
+		},
+		navigator(url) {
+			this.$api.navigateTo(url)
+		}
+	},
+	onPullDownRefresh() {
+		setTimeout(() => {
+			this.QueryCouponList()
+			uni.stopPullDownRefresh()
+		}, 200)
+	},
+	onReachBottom() {
+		if (this.hasNextPage) {
+			this.loadding = true
+			this.pullUpOn = true
+			this.getOnReachBottomData()
 		}
+	},
+	onShow() {
+		this.initGetStotage()
 	}
+}
 </script>
 
 <style lang="scss">
-	page{
-		background-color: #F7F7F7;
+page {
+	background-color: #f7f7f7;
+}
+.container {
+	width: 100%;
+	height: auto;
+}
+.container-list {
+	box-sizing: border-box;
+	padding: 24rpx;
+	.empty-container-image {
+		width: 260rpx;
+		height: 260rpx;
+		margin-top: -300rpx;
 	}
-	.container{
-		width: 100%;
-		height: auto;
+	.toIndexPage {
+		bottom: 390rpx;
 	}
-	.container-list {
+	.coupon-list {
+		width: 100%;
+		height: 200rpx;
+		margin-bottom: 24rpx;
 		box-sizing: border-box;
-		padding:24rpx;
-		.empty-container-image {
-			width: 260rpx;
-			height: 260rpx;
-			margin-top: -300rpx;
-		}
-		.toIndexPage {
-			bottom: 390rpx;
-		}
-		.coupon-list{
-			width: 100%;
-			height: 200rpx;
-			margin-bottom: 24rpx;
+		background: url(https://static.caimei365.com/app/img/icon/icon-coupon-uesb@2x.png);
+		background-size: cover;
+		.list-cell-le {
+			width: 224rpx;
+			height: 100%;
 			box-sizing: border-box;
-			background: url(https://static.caimei365.com/app/img/icon/icon-coupon-uesb@2x.png);
-			background-size: cover;
-			.list-cell-le{
-				width: 224rpx;
-				height: 100%;
-				box-sizing: border-box;
-				padding: 37rpx 0;
-				float: left;
-				.coupon-maxMoney{
-					width: 100%;
-					height: 78rpx;
-					line-height: 78rpx;
-					font-size: 56rpx;
-					color: #FFFFFF;
-					text-align: center;
-					.small{
-						font-size: $font-size-24;
-					}
-				}
-				.coupon-minMoney{
-					width: 100%;
-					height: 33rpx;
-					line-height: 33rpx;
+			padding: 37rpx 0;
+			float: left;
+			.coupon-maxMoney {
+				width: 100%;
+				height: 78rpx;
+				line-height: 78rpx;
+				font-size: 56rpx;
+				color: #ffffff;
+				text-align: center;
+				.small {
 					font-size: $font-size-24;
-					color: #FFFFFF;
-					text-align: center;
 				}
 			}
-			.list-cell-ri{
-				width: 478rpx;
-				height: 100%;
-				box-sizing: border-box;
-				padding: 20rpx 24rpx 0 24rpx;
-				float: right;
-				.list-cell-top{
-					width: 100%;
-					height: 121rpx;
+			.coupon-minMoney {
+				width: 100%;
+				height: 33rpx;
+				line-height: 33rpx;
+				font-size: $font-size-24;
+				color: #ffffff;
+				text-align: center;
+			}
+		}
+		.list-cell-ri {
+			width: 478rpx;
+			height: 100%;
+			box-sizing: border-box;
+			padding: 20rpx 24rpx 0 24rpx;
+			float: right;
+			.list-cell-top {
+				width: 100%;
+				height: 121rpx;
+				float: left;
+				border-bottom: 1px solid #e1e1e1;
+				.list-cell-type {
+					width: 286rpx;
+					height: 100%;
 					float: left;
-					border-bottom: 1px solid #e1e1e1;
-					.list-cell-type{
-						width: 286rpx;
-						height: 100%;
-						float: left;
-						.list-cell-tags{
-							width: 100%;
+					.list-cell-tags {
+						width: 100%;
+						height: 32rpx;
+						margin-bottom: 7rpx;
+						.tags {
+							display: inline-block;
+							padding: 0 10rpx;
 							height: 32rpx;
-							margin-bottom: 7rpx;
-							.tags{
-								display: inline-block;
-								padding: 0 10rpx;
-								height: 32rpx;
-								line-height: 32rpx;
-								background-color: #ffdcce;
-								color: #f94b4b;
-								font-size: $font-size-20;
-								border-radius: 8rpx;
-								text-align: center;
-								float: left;
-							}
-						}
-						.list-cell-texts{
-							width: 100%;
-							height: auto;
-							line-height:35rpx;
-							text-overflow:ellipsis;
-							display: -webkit-box;
-							word-break: break-all;
-							-webkit-box-orient: vertical;
-							-webkit-line-clamp: 2;
-							overflow: hidden;
-							font-size: 26rpx;
-							color: #333333;
+							line-height: 32rpx;
+							background-color: #ffdcce;
+							color: #f94b4b;
+							font-size: $font-size-20;
+							border-radius: 8rpx;
+							text-align: center;
+							float: left;
 						}
 					}
-					.list-cell-btn{
-						width: 128rpx;
+					.list-cell-texts {
+						width: 100%;
+						height: auto;
+						line-height: 35rpx;
+						text-overflow: ellipsis;
+						display: -webkit-box;
+						word-break: break-all;
+						-webkit-box-orient: vertical;
+						-webkit-line-clamp: 2;
+						overflow: hidden;
+						font-size: 26rpx;
+						color: #333333;
+					}
+				}
+				.list-cell-btn {
+					width: 128rpx;
+					height: 100%;
+					float: right;
+					.icon-used {
+						width: 100%;
 						height: 100%;
-						float: right;
-						.icon-used{
+						box-sizing: border-box;
+						padding-top: 28rpx;
+						.icon-used-text {
 							width: 100%;
-							height: 100%;
+							text-align: center;
+							line-height: 26rpx;
+							font-size: $font-size-20;
+							color: #f94b4b;
+						}
+						.icon-used-btn {
+							height: 48rpx;
+							border-radius: 28rpx;
+							line-height: 48rpx;
+							font-size: $font-size-26;
+							text-align: center;
+							padding: 0 6rpx;
 							box-sizing: border-box;
-							padding-top: 57rpx;
-							.icon-used-btn{
-								width: 128rpx;
-								height: 48rpx;
-								border-radius: 28rpx;
-								line-height: 48rpx;
-								font-size: $font-size-26;
-								text-align: center;
-								&.receive{
-									background-image: linear-gradient(270deg, #f94b4b 0%, #feb673 100%);;
-									color: #FFFFFF;
-								}
-								&.make{
-									border: solid 1px #f94b4b;
-									color: #f94b4b;
-								}
+							&.buy {
+								background-image: linear-gradient(270deg, #f94b4b 0%, #feb673 100%);
+								color: #ffffff;
+							}
+							&.receive {
+								background-image: linear-gradient(270deg, #f94b4b 0%, #feb673 100%);
+								color: #ffffff;
+							}
+							&.make {
+								border: solid 1px #f94b4b;
+								color: #f94b4b;
 							}
 						}
 					}
 				}
-				.list-cell-time{
-					width: 100%;
-					height: 58rpx;
-					line-height: 58rpx;
-					text-align: left;
-					font-size: $font-size-20;
-					color: #999999;
-				}
+			}
+			.list-cell-time {
+				width: 100%;
+				height: 58rpx;
+				line-height: 58rpx;
+				text-align: left;
+				font-size: $font-size-20;
+				color: #999999;
 			}
 		}
 	}
+}
 </style>

+ 421 - 388
pages/user/coupon/coupon.vue

@@ -1,56 +1,85 @@
 <template>
 	<view class="container clearfix">
 		<view class="coupon-tabs">
-			<coupon-tabs  :tabs="navbar"
-						  :currentTab="currentTab>2?0:currentTab" 
-						  @change="change" 
-						  :itemWidth="(100/navbar.length)+'%'"
-						  selectedColor="#e15616" 
-						  sliderBgColor="#e15616">
+			<coupon-tabs
+				:tabs="navbar"
+				:currentTab="currentTab > 2 ? 0 : currentTab"
+				@change="change"
+				:itemWidth="100 / navbar.length + '%'"
+				selectedColor="#e15616"
+				sliderBgColor="#e15616"
+			>
 			</coupon-tabs>
 		</view>
-		<view 	class="container-list" 
-				:style="{'overflow':'auto',paddingBottom :isIphoneX ? '140rpx' : '0rpx','height':(coupinList.length>6? windowHeight + 'px' : 'auto')}"
-				v-show="isRequest"
-			>
+		<view
+			class="container-list"
+			:style="{
+				overflow: 'auto',
+				paddingBottom: isIphoneX ? '140rpx' : '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>
+				<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 :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 }}可用
+								<text class="small">¥</text> {{ coupon.couponAmount }}
 							</view>
+							<view class="coupon-minMoney"> 满{{ coupon.touchPrice }}可用 </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="coupon.useStatus == 2 || coupon.useStatus == 3 ? 'none' : ''">
-											{{ coupon.couponType | TypeFormat }}
-										</text>
+										<template v-if="coupon.moneyCouponFlag == 1">
+											<text
+												class="tags"
+												v-if="coupon.moneyCouponType == 1"
+												:class="coupon.useStatus == 2 || coupon.useStatus == 3 ? 'none' : ''"
+												>意向{{ coupon.couponType | TypeFormat }}</text
+											>
+											<text class="tags" v-else>定向{{ coupon.couponType | TypeFormat }}</text>
+										</template>
+										<template v-else>
+											<text
+												class="tags"
+												:class="coupon.useStatus == 2 || coupon.useStatus == 3 ? 'none' : ''"
+												>{{ coupon.couponType | TypeFormat }}</text
+											>
+										</template>
 									</view>
-									<view class="list-cell-texts" :class="coupon.useStatus == 2 || coupon.useStatus == 3 ? 'none' : ''">
+									<view
+										class="list-cell-texts"
+										:class="coupon.useStatus == 2 || coupon.useStatus == 3 ? 'none' : ''"
+									>
 										<text v-if="coupon.couponType == 0">
-											{{ coupon.productType && coupon.productType == 1 ? '全商城商品通用' : '仅可购买指定商品'  }}
+											{{
+												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>
+										<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">
@@ -66,439 +95,443 @@
 					</view>
 					<!--加载loadding-->
 					<tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
-					<tui-nomore :visible="!pullUpOn" :backgroundColor="'#F7F7F7'" :text='nomoreText'></tui-nomore>
+					<tui-nomore :visible="!pullUpOn" :backgroundColor="'#F7F7F7'" :text="nomoreText"></tui-nomore>
 					<!--加载loadding-->
 				</view>
 			</template>
 		</view>
-		<view class="button-bottom" :style="{paddingBottom :isIphoneX ? '68rpx' : '20rpx'}">
-			<view class="button-exchange" @click="navigator('/pages/user/coupon/coupon-exchange')">
-				兑换优惠券
-			</view>
-			<view class="button-receive"  @click="navigator('/pages/user/coupon/coupon-collection')">
-				领更多好券
-			</view>
+		<view class="button-bottom" :style="{ paddingBottom: isIphoneX ? '68rpx' : '20rpx' }">
+			<view class="button-exchange" @click="navigator('/pages/user/coupon/coupon-exchange')"> 兑换优惠券 </view>
+			<view class="button-receive" @click="navigator('/pages/user/coupon/coupon-collection')"> 领更多好券 </view>
 		</view>
 	</view>
 </template>
 
 <script>
-	import { mapState,mapMutations} from 'vuex'
-	import couponTabs from '@/components/cm-module/coupon/tui-tabs.vue'
-	export default {
-		components:{
-			couponTabs
-		},
-		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:0 }, 
-					{ name: '已使用',num:0 }, 
-					{ name: '已失效',num:0 },
-				],
-				coupinList:[],
-				windowHeight:'',
-				scrollHeight:'',
-				showEmpty: false,
-				nomoreText: '上拉显示更多',
-				hasNextPage:false,
-				loadding: false,
-				pullUpOn: true,
-				pullFlag: true,
-			}
-		},
-		onLoad() {
-		
-		},
-		filters: {
-			TypeFormat(value) {
-				switch (value) {
-					case 0:
-						return  '活动券'
-						break
-					case 1:
-						return  '品类券'
-						break
-					case 2:
-						return  '用户专享券'
-						break
-					case 3:
-						return  '店铺券'
-						break
-					case 4:
-						return  '新用户券'
-						break
-				}
+import { mapState, mapMutations } from 'vuex'
+import couponTabs from '@/components/cm-module/coupon/tui-tabs.vue'
+export default {
+	components: {
+		couponTabs
+	},
+	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: 0 }, { name: '已使用', num: 0 }, { name: '已失效', num: 0 }],
+			coupinList: [],
+			windowHeight: '',
+			scrollHeight: '',
+			showEmpty: false,
+			nomoreText: '上拉显示更多',
+			hasNextPage: false,
+			loadding: false,
+			pullUpOn: true,
+			pullFlag: true
+		}
+	},
+	onLoad() {},
+	filters: {
+		TypeFormat(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: {
+		setScrollHeight() {
+			const { windowHeight, pixelRatio } = wx.getSystemInfoSync()
+			this.windowHeight = windowHeight - 1
+			this.scrollHeight = windowHeight - 1
 		},
-		computed: {
-			...mapState(['hasLogin','userInfo','identity','isActivity'])
-		},
-		methods: {
-			setScrollHeight() {
-				const {windowHeight, pixelRatio} = wx.getSystemInfoSync()
-				this.windowHeight = windowHeight - 1
-				this.scrollHeight = windowHeight - 1
-			},
-			QueryCouponList() {// 获取优惠券列表
-				this.coupinList = []
-				this.listQuery.pageNum = 1
-				this.ProductService.QueryCouponCenter(this.listQuery).then(response =>{
+		QueryCouponList() {
+			// 获取优惠券列表
+			this.coupinList = []
+			this.listQuery.pageNum = 1
+			this.ProductService.QueryCouponCenter(this.listQuery)
+				.then(response => {
 					let data = response.data
-					if(data.list&&data.list.length > 0){
+					if (data.list && data.list.length > 0) {
 						this.showEmpty = false
 						this.hasNextPage = data.hasNextPage
 						this.coupinList = data.list
 						this.pullFlag = false
-						setTimeout(()=>{this.pullFlag = true},500)
-						if(this.hasNextPage){
+						setTimeout(() => {
+							this.pullFlag = true
+						}, 500)
+						if (this.hasNextPage) {
 							this.pullUpOn = false
 							this.nomoreText = '上拉显示更多'
-						}else{
-							if(this.coupinList.length < 8){
+						} else {
+							if (this.coupinList.length < 8) {
 								this.pullUpOn = true
-							}else{
+							} else {
 								this.pullUpOn = false
 								this.loadding = false
 								this.nomoreText = '已至底部'
 							}
 						}
-					}else{
+					} else {
 						this.showEmpty = true
 					}
 					this.isRequest = true
-				}).catch(error =>{
-					this.$util.msg(error.msg,2000)
 				})
-			},
-			getOnReachBottomData(){// 上滑加载分页
-				this.listQuery.pageNum+=1
-				this.ProductService.QueryCouponCenter(this.listQuery)
-				.then(response =>{
+				.catch(error => {
+					this.$util.msg(error.msg, 2000)
+				})
+		},
+		getOnReachBottomData() {
+			// 上滑加载分页
+			this.listQuery.pageNum += 1
+			this.ProductService.QueryCouponCenter(this.listQuery)
+				.then(response => {
 					let data = response.data
-					if(data.list&&data.list.length > 0){
+					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.coupinList = this.coupinList.concat(data.list)
+						this.pullFlag = false // 防上拉暴滑
+						setTimeout(() => {
+							this.pullFlag = true
+						}, 500)
+						if (this.hasNextPage) {
 							this.pullUpOn = false
 							this.nomoreText = '上拉显示更多'
-						}else{
+						} else {
 							this.pullUpOn = false
 							this.loadding = false
 							this.nomoreText = '已至底部'
 						}
 					}
 				})
-				.catch(error =>{
-					this.$util.msg(error.msg,2000)
+				.catch(error => {
+					this.$util.msg(error.msg, 2000)
 				})
-			},
-			getQueryCouponsCount(){// 获取优惠券数量
-				this.ProductService.QueryCouponsCount(
-					{
-						userId:this.listQuery.userId, 
-					}
-				) 
-				.then(response =>{
+		},
+		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)
+				.catch(error => {
+					this.$util.msg(error.msg, 2000)
 				})
-			},
-			toUseCoupon(coupon){// 去使用跳转路径
-				console.log('coupon',coupon)
-				switch (coupon.couponType) {
-					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 1:// 品类券:跳转到产品 287 / 仪器页 286
-						this.$api.navigateTo(`/pages/goods/good-floor?linkId=${ coupon.categoryType == 1 ? 287 : 286 }`)
-						break
-					case 2:// 用户专享券:跳转到商城首页
-						this.$api.switchTabTo('/pages/tabBar/home/index')
-						break
-					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
-				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.QueryCouponList()
-				uni.stopPullDownRefresh()
-			}, 200)
+		toUseCoupon(coupon) {
+			// 去使用跳转路径,友盟埋点收集去使用优惠券
+			if (process.env.NODE_ENV != 'development') {
+				this.$uma.trackEvent('Um_Event_userCouponToUseCoupon', {
+					Um_Key_PageName: '机构优惠券列表',
+					Um_Key_EvenName: '使用优惠券',
+					Um_Key_CouponId: `${coupon.couponId}`,
+				})
+			}
+			switch (coupon.couponType) {
+				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 1: // 品类券:跳转到产品 287 / 仪器页 286
+					this.$api.navigateTo(`/pages/goods/good-floor?linkId=${coupon.categoryType == 1 ? 287 : 286}`)
+					break
+				case 2: // 用户专享券:跳转到商城首页
+					this.$api.switchTabTo('/pages/tabBar/home/index')
+					break
+				case 3: // 店铺券:跳转到店铺首页
+					this.$api.navigateTo('/pages/supplier/user/my-shop?shopId=' + coupon.shopId)
+					break
+				case 4: // 新用户券:跳转到商城首页
+					this.$api.switchTabTo('/pages/tabBar/home/index')
+					break
+			}
 		},
-		onReachBottom() {
-			if(this.hasNextPage){
-				this.loadding = true
-				this.pullUpOn = true
-				this.getOnReachBottomData()
-			}	
+		change(e) {
+			this.currentTab = e.index
+			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()
 		},
-		onShow(){		
-			this.setScrollHeight()
-			this.$api.getComStorage('userInfo').then((resolve) =>{
-				this.listQuery.userId = resolve.userId ? resolve.userId : 0
-				this.getQueryCouponsCount()
-				this.QueryCouponList()
-			})
+		navigator(url) {
+			this.$api.navigateTo(url)
+		}
+	},
+	onPullDownRefresh() {
+		setTimeout(() => {
+			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.listQuery.userId = resolve.userId ? resolve.userId : 0
+			this.getQueryCouponsCount()
+			this.QueryCouponList()
+		})
 	}
+}
 </script>
 
 <style lang="scss">
-	page{
-		background-color: #F7F7F7;
+page {
+	background-color: #f7f7f7;
+}
+.coupon-tabs {
+	width: 100%;
+	height: 80rpx;
+	position: fixed;
+	top: 0;
+	left: 0;
+	z-index: 99;
+}
+.container {
+	width: 100%;
+	height: auto;
+	padding-top: 80rpx;
+}
+.container-list {
+	box-sizing: border-box;
+	padding: 24rpx;
+	scroll-view {
+		height: 100%;
+		overflow: scroll;
 	}
-	.coupon-tabs{
-		width: 100%;
-		height: 80rpx;
-		position: fixed;
-		top: 0;
-		left: 0;
-		z-index: 99;
+	.empty-container-image {
+		width: 260rpx;
+		height: 260rpx;
+		margin-top: -300rpx;
 	}
-	.container{
-		width: 100%;
-		height: auto;
-		padding-top: 80rpx;
+	.toIndexPage {
+		bottom: 390rpx;
 	}
-	.container-list {
+	.coupon-list {
+		width: 100%;
+		height: 200rpx;
+		margin-bottom: 24rpx;
 		box-sizing: border-box;
-		padding:24rpx;
-		scroll-view {
-			height: 100%;
-			overflow: scroll;
-		}	
-		.empty-container-image {
-			width: 260rpx;
-			height: 260rpx;
-			margin-top: -300rpx;
+		&.list-used {
+			background: url(https://static.caimei365.com/app/img/icon/icon-coupon-uesb@2x.png);
+			background-size: cover;
 		}
-		.toIndexPage {
-			bottom: 390rpx;
+		&.list-none {
+			background: url(https://static.caimei365.com/app/img/icon/icon-coupon-none@2x.png);
+			background-size: cover;
 		}
-		.coupon-list{
-			width: 100%;
-			height: 200rpx;
-			margin-bottom: 24rpx;
+		.list-cell-le {
+			width: 224rpx;
+			height: 100%;
 			box-sizing: border-box;
-			&.list-used{
-				background: url(https://static.caimei365.com/app/img/icon/icon-coupon-uesb@2x.png);
-				background-size: cover;
-			}
-			&.list-none{
-				background: url(https://static.caimei365.com/app/img/icon/icon-coupon-none@2x.png);
-				background-size: cover;
-			}
-			.list-cell-le{
-				width: 224rpx;
-				height: 100%;
-				box-sizing: border-box;
-				padding: 37rpx 0;
-				float: left;
-				.coupon-maxMoney{
-					width: 100%;
-					height: 78rpx;
-					line-height: 78rpx;
-					font-size: 56rpx;
-					color: #FFFFFF;
-					text-align: center;
-					.small{
-						font-size: $font-size-24;
-					}
-				}
-				.coupon-minMoney{
-					width: 100%;
-					height: 33rpx;
-					line-height: 33rpx;
+			padding: 37rpx 0;
+			float: left;
+			.coupon-maxMoney {
+				width: 100%;
+				height: 78rpx;
+				line-height: 78rpx;
+				font-size: 56rpx;
+				color: #ffffff;
+				text-align: center;
+				.small {
 					font-size: $font-size-24;
-					color: #FFFFFF;
-					text-align: center;
 				}
 			}
-			.list-cell-ri{
-				width: 478rpx;
-				height: 100%;
-				box-sizing: border-box;
-				padding: 20rpx 24rpx 0 24rpx;
-				float: right;
-				.list-cell-top{
-					width: 100%;
-					height: 121rpx;
+			.coupon-minMoney {
+				width: 100%;
+				height: 33rpx;
+				line-height: 33rpx;
+				font-size: $font-size-24;
+				color: #ffffff;
+				text-align: center;
+			}
+		}
+		.list-cell-ri {
+			width: 478rpx;
+			height: 100%;
+			box-sizing: border-box;
+			padding: 20rpx 24rpx 0 24rpx;
+			float: right;
+			.list-cell-top {
+				width: 100%;
+				height: 121rpx;
+				float: left;
+				border-bottom: 1px solid #e1e1e1;
+				.list-cell-type {
+					width: 286rpx;
+					height: 100%;
 					float: left;
-					border-bottom: 1px solid #e1e1e1;
-					.list-cell-type{
-						width: 286rpx;
-						height: 100%;
-						float: left;
-						.list-cell-tags{
-							width: 100%;
+					.list-cell-tags {
+						width: 100%;
+						height: 32rpx;
+						margin-bottom: 7rpx;
+						.tags {
+							display: inline-block;
+							padding: 0 10rpx;
 							height: 32rpx;
-							margin-bottom: 7rpx;
-							.tags{
-								display: inline-block;
-								padding: 0 10rpx;
-								height: 32rpx;
-								line-height: 32rpx;
-								background-color: #ffdcce;
-								color: #f94b4b;
-								font-size: $font-size-20;
-								border-radius: 8rpx;
-								text-align: center;
-								float: left;
-								&.none{
-									background-color: #dbdbdb;
-									color: #FFFFFF;
-								}
+							line-height: 32rpx;
+							background-color: #ffdcce;
+							color: #f94b4b;
+							font-size: $font-size-20;
+							border-radius: 8rpx;
+							text-align: center;
+							float: left;
+							&.none {
+								background-color: #dbdbdb;
+								color: #ffffff;
 							}
 						}
-						.list-cell-texts{
-							width: 100%;
-							height: auto;
-							line-height:35rpx;
-							text-overflow:ellipsis;
-							display: -webkit-box;
-							word-break: break-all;
-							-webkit-box-orient: vertical;
-							-webkit-line-clamp: 2;
-							overflow: hidden;
-							font-size: 26rpx;
-							color: #333333;
-							&.none{
-								color: #999999;
-							}
+					}
+					.list-cell-texts {
+						width: 100%;
+						height: auto;
+						line-height: 35rpx;
+						text-overflow: ellipsis;
+						display: -webkit-box;
+						word-break: break-all;
+						-webkit-box-orient: vertical;
+						-webkit-line-clamp: 2;
+						overflow: hidden;
+						font-size: 26rpx;
+						color: #333333;
+						&.none {
+							color: #999999;
 						}
 					}
-					.list-cell-btn{
-						width: 128rpx;
+				}
+				.list-cell-btn {
+					width: 128rpx;
+					height: 100%;
+					float: right;
+					.icon-used {
+						width: 100%;
 						height: 100%;
-						float: right;
-						.icon-used{
-							width: 100%;
-							height: 100%;
-							box-sizing: border-box;
-							padding-top: 57rpx;
-							.icon-used-btn{
-								width: 128rpx;
-								height: 48rpx;
-								border-radius: 28rpx;
-								border: solid 1px #f94b4b;
-								line-height: 48rpx;
-								font-size: $font-size-26;
-								color: #f94b4b;
-								text-align: center;
-							}
-						}
-						.icon-use{
-							width: 92rpx;
-							height: 92rpx;
-							box-sizing: border-box;
-							background: url(https://static.caimei365.com/app/img/icon/icon-coupon-use@2x.png);
-							background-size: cover;
-							float: right;
-						}
-						.icon-invalid{
-							width: 92rpx;
-							height: 92rpx;
-							box-sizing: border-box;
-							background: url(https://static.caimei365.com/app/img/icon/icon-coupon-invalid@2x.png);
-							background-size: cover;
-							float: right;
+						box-sizing: border-box;
+						padding-top: 57rpx;
+						.icon-used-btn {
+							width: 128rpx;
+							height: 48rpx;
+							border-radius: 28rpx;
+							border: solid 1px #f94b4b;
+							line-height: 48rpx;
+							font-size: $font-size-26;
+							color: #f94b4b;
+							text-align: center;
 						}
 					}
+					.icon-use {
+						width: 92rpx;
+						height: 92rpx;
+						box-sizing: border-box;
+						background: url(https://static.caimei365.com/app/img/icon/icon-coupon-use@2x.png);
+						background-size: cover;
+						float: right;
+					}
+					.icon-invalid {
+						width: 92rpx;
+						height: 92rpx;
+						box-sizing: border-box;
+						background: url(https://static.caimei365.com/app/img/icon/icon-coupon-invalid@2x.png);
+						background-size: cover;
+						float: right;
+					}
 				}
-				.list-cell-time{
-					width: 100%;
-					height: 58rpx;
-					line-height: 58rpx;
-					text-align: left;
-					font-size: $font-size-20;
-					color: #999999;
-				}
+			}
+			.list-cell-time {
+				width: 100%;
+				height: 58rpx;
+				line-height: 58rpx;
+				text-align: left;
+				font-size: $font-size-20;
+				color: #999999;
 			}
 		}
 	}
-	.button-bottom{
-		width: 100%;
-		position: fixed;
-		background-color: #FFFFFF;
-		bottom: 0;
-		left: 0;
-		box-sizing: border-box;
-		padding: 8rpx 24rpx;
-		z-index: 999;
-		.button-exchange{
-			width: 280rpx;
-			height: 84rpx;
-			line-height: 84rpx;
-			background-color: #ffe6dc;
-			border-radius: 50rpx;
-			text-align: center;
-			font-size: $font-size-30;
-			color: #e15616;
-			float: left;
-		}
-		.button-receive{
-			width: 408rpx;
-			height: 84rpx;
-			line-height: 84rpx;
-			background: $btn-confirm;
-			border-radius: 50rpx;
-			text-align: center;
-			font-size: $font-size-30;
-			color: #FFFFFF;
-			float: right;
-		}
+}
+.button-bottom {
+	width: 100%;
+	position: fixed;
+	background-color: #ffffff;
+	bottom: 0;
+	left: 0;
+	box-sizing: border-box;
+	padding: 8rpx 24rpx;
+	z-index: 999;
+	.button-exchange {
+		width: 280rpx;
+		height: 84rpx;
+		line-height: 84rpx;
+		background-color: #ffe6dc;
+		border-radius: 50rpx;
+		text-align: center;
+		font-size: $font-size-30;
+		color: #e15616;
+		float: left;
+	}
+	.button-receive {
+		width: 408rpx;
+		height: 84rpx;
+		line-height: 84rpx;
+		background: $btn-confirm;
+		border-radius: 50rpx;
+		text-align: center;
+		font-size: $font-size-30;
+		color: #ffffff;
+		float: right;
 	}
+}
 </style>

+ 17 - 1
services/pay.service.js

@@ -37,7 +37,23 @@ export default class PayService {
             url:'/order/pay/wechat', 
             data, 
             isLoading: true ,
-              
+            loadText:'请求支付中...'    
+        })
+    }
+    /**
+	 *小程序支付-微信支付
+	 *@param  payWay银联:UNIONPAY,微信:WEIXIN,支付宝:ALIPAY
+	 *@param  payType 微信小程序支付: MINIAPP_WEIXIN ,微信公众号支付: JSAPI_WEIXIN
+	 *@param  code  微信小程序code,微信小程序支付使用
+	 *@param  userId  用户Id
+	 *@param  couponId  优惠券Id
+	 */
+    WeChatCouponMiniWxPay (data = {}) {
+        return this.AjaxService.post({ 
+            url:'/order/pay/coupon/wechat', 
+            data, 
+            isLoading: true ,
+            loadText:'请求支付中...'  
         })
     }
     /**

+ 39 - 0
services/product.service.js

@@ -371,6 +371,45 @@ export default class ProductService {
               
         })
     }
+    /**
+	 * @优惠券-美博会优惠券列表
+	 * @param:userId 用户userId(未登录传0)
+	 * @param:pageNum 每页页码
+	 * @param:pageSize 条数
+	 */
+    QueryCouponCenterList (data = {}) {
+        return this.AjaxService.get({
+            url:'/commodity/coupon/center/list',
+            data,
+            isLoading: false ,
+              
+        })
+    }
+    /**
+	 * @优惠券-协销价值优惠券列表
+	 * @param:pageNum 每页页码
+	 * @param:pageSize 条数
+	 */
+    QueryMoneyCouponList (data = {}) {
+        return this.AjaxService.get({
+            url:'/commodity/coupon/money/coupon/list',
+            data,
+            isLoading: true ,
+              
+        })
+    }
+    /**
+	 * @优惠券-根据优惠券查询优惠券详细信息
+	 * @param:couponId 优惠券Id
+	 */
+    QueryCouponDetail (data = {}) {
+        return this.AjaxService.get({
+            url:'/commodity/coupon/coupon/detail',
+            data,
+            isLoading: true ,
+              
+        })
+    }
     /**
 	 * @优惠券-领取优惠券
 	 * @param:userId 用户userId

+ 178 - 0
utils/mixins/orderList.js

@@ -0,0 +1,178 @@
+const orderList = {
+    data() {
+        return {
+            hanldOrder: {}, // 当前要处理的订单信息
+            modal: false,
+            modalText: '',
+            buyAgainModal: false,
+            invalidList: [], // 失效商品列表
+        }
+    },
+
+    methods: {
+        // 操作订单
+        handleConfirmClick(e) {
+            const { type, order } = (this.hanldOrder = e)
+            switch (type) {
+ 
+            // 其他操作
+            case 'again':
+                this.buyAgain()
+                break
+            case 'share':
+                this.handleShare()
+                break
+            case 'query':
+                this.isModalLayer = true
+                this.$api.navigateTo('/pages/order/order-logistics?orderId=' + order.orderId)
+                break
+            case 'fightDetail':
+                console.log('拼团详情')
+                this.$api.navigateTo('/pages/fight-order/fight-detail?collageId=' + order.collageId)
+                break
+            case 'fightShare':
+                console.log('分享邀请好友拼团')
+                this.$api.navigateTo('/pages/fight-order/fight-detail?collageId=' + order.collageId)
+                break
+                // 常规操作
+            case 'cancel':
+                this.modal = true
+                this.modalText = '确认取消该订单吗?'
+                break
+            case 'delete':
+                this.modal = true
+                this.modalText = '确认删除该订单吗?'
+                break
+            case 'confirm':
+                this.modal = true
+                this.modalText = '是否确认收货?'
+                break
+            case 'pay':
+                this.modal = true
+                this.modalText = '确认支付?'
+                break
+            }
+        },
+        // 确认收货
+        handleConfirm(order) {
+            console.log('确认收货')
+            return this.OrderService.ConfirmReceipt({ orderId: order.orderId })
+        },
+        // 取消订单
+        handleCancel(order) {
+            console.log('取消订单')
+            return this.OrderService.CancelOrder({ orderId: order.orderId })
+        },
+        // 删除订单
+        handleDelete(order) {
+            console.log('删除订单')
+            return this.OrderService.DeleteOrder({ orderId: order.orderId })
+        },
+        // 支付订单
+        handlePay(order) {
+            console.log('支付')
+            this.miniWxPayFor(order)
+        },
+        // 再次购买初始化查询订单商品信息
+        handleAgain(order) {
+            console.log('再次购买初始化查询订单商品信息')
+            return this.OrderService.GetOrderBuyAgain({ orderId: order.orderId })
+        },
+        // 查看物流
+        handleQuery(order) {
+            console.log('查看物流')
+        },
+        // 分享
+        handleShare(order) {
+            console.log('分享')
+        },
+        // 再次购买
+        async buyAgain() {
+            const { type, order } = this.hanldOrder
+            try {
+                await this.handleAgain(order)
+                this.joinToCart(order)
+            } catch (error) {
+                if (error.data && error.data.length > 0) {
+                    this.buyAgainModal = true
+                    this.invalidList = error.data
+                }
+            }
+        },
+
+        // 确认再次购买
+        buyAgainModalClick(e) {
+            this.buyAgainModal = false
+            if (!e.index) return
+            this.joinToCart(this.hanldOrder.order)
+        },
+
+        // 再次购买弹窗关闭
+        buyAgainModalHide() {
+            console.log('再次购买弹窗关闭')
+            this.invalidList = []
+        },
+
+        // 一键加入购物车
+        async joinToCart(order) {
+            try {
+                await this.ProductService.ShoppingAgainCart({ orderId: order.orderId })
+                this.$store.dispatch('cart/getCartNumber')
+                this.$api.switchTabTo('/pages/tabBar/cart/index')
+            } catch (error) {
+                console.log(error.message)
+                // this.$util.msg(error.msg, 2000)
+            }
+        },
+
+        // 操作订单确认事件
+        async handleModalConfirm(e) {
+            this.modal = false
+            if (!e.index) return
+
+            const { type, order } = this.hanldOrder
+
+            // 操作订单
+            const confirmFunc = {
+                cancel: this.handleCancel, //取消订单
+                delete: this.handleDelete, //删除订单
+                pay: this.handlePay, //支付订单
+                confirm: this.handleConfirm //确认收货
+            }
+            try {
+                const res = await confirmFunc[type](order)
+                // 确认操作订单成功后的回调都在这里执行 在this.$on 中监听 orderAction 事件的执行
+                this.$emit('orderAction')
+                if (res && res.msg) this.$util.msg(res.msg, 2000, true, 'success')
+            } catch (error) {
+                this.$util.msg(error.msg, 2000)
+            }
+        },
+        //订单状态文字
+        stateExpFormat(status) {
+            const stateTextObject = {
+                4: '交易完成',
+                5: '订单完成',
+                6: '已关闭',
+                7: '交易全退',
+                77: '交易全退',
+                11: '待付款待发货',
+                12: '待付款部分发货',
+                13: '待付款已发货',
+                // 21: '部分付款待发货',
+                // 22: '部分付款部分发货',
+                // 23: '部分付款已发货',
+                31: '已付款待发货',
+                32: '已付款部分发货',
+                33: '已付款已发货',
+                111: '待付款待发货',
+                81: '拼团中',
+                82: '拼团成功待发货',
+                83: '拼团成功已发货'
+            }
+            return stateTextObject[status] || ''
+        },
+    }
+}
+
+export default orderList

+ 63 - 0
utils/mixins/wechatPay.js

@@ -0,0 +1,63 @@
+import authorize from '@/common/authorize.js'
+
+// 调用微信支付
+function wxRequestPayment(payData) {
+    return new Promise((resolve, reject) => {
+        uni.requestPayment({
+            timeStamp: payData.timeStamp,
+            nonceStr: payData.nonceStr,
+            package: payData.package,
+            signType: payData.signType,
+            paySign: payData.paySign,
+            success: () => {
+                resolve(true)
+            },
+            fail: () => {
+                reject({ msg: 'error' })
+            }
+        })
+    })
+}
+
+// 微信支付
+const wechatCouponPay = {
+    data() {
+        
+    },
+    methods: {
+        // 获取微信支付payment
+        async weChatMiniWxPay(data) {
+            try {
+                // 获取微信code
+                const wechatCode = await authorize.getCode('weixin')
+                // 微信支付请求 返回支付信息
+                const response = await this.PayService.WeChatCouponMiniWxPay({
+                    userId: this.listQuery.userId,
+                    couponId: coupon.couponId,
+                    payWay: 'WEIXIN',
+                    code: wechatcode
+                })
+                // 处理支付信息 调用微信支付
+                const payment = JSON.parse(response.data.data.payInfo)
+                const payFlag = await wxRequestPayment(payment)
+                // debugger
+                // console.log(this.hanldOrder)
+                // 支付成功重定向
+                uni.setStorageSync('orderInfo', this.hanldOrder.order)
+                if (payFlag) {
+                    // 微信支付成功回调 在页面onload中通过this.$on监听orderPaySuccess事件回调
+                    uni.reLaunch({url: '/pages/tabBar/user/user'})
+                } else {
+                    uni.reLaunch({ url: '/pages/order/error' })
+                }
+            } catch (error) {
+                // 微信支付失败
+                this.$util.msg(error.msg, 2000)
+            } 
+        }
+    }
+}
+
+export default {
+    wechatCouponPay
+}