Explorar o código

新增价值优惠券购买功能

zhengjinyi %!s(int64=3) %!d(string=hai) anos
pai
achega
1c6e8b227a

+ 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
 }

+ 61 - 1
components/cm-module/cart-components/index.vue

@@ -378,6 +378,13 @@
 										</view>
 										<view class="list-cell-btn">
 											<view class="icon-used">
+												<view class="icon-used-text" v-if="coupon.couponBtnType == 2">购买</view>
+												<view
+													class="icon-used-btn receive"
+													v-if="coupon.couponBtnType == 2"
+													@click="toPayCoupon(coupon)"
+													>¥500</view
+												>
 												<view
 													class="icon-used-btn receive"
 													v-if="currentTab == 0"
@@ -1409,6 +1416,9 @@ export default {
 					console.log('获取优惠券列表失败')
 				})
 		},
+		toPayCoupon(coupon){// 点击购买优惠券
+			this.MiniWxPayFor(coupon)
+		},
 		receiveCoupon(coupon) {
 			// 点击优惠券领取按钮
 			this.ProductService.ReceiveCoupon({
@@ -1428,6 +1438,49 @@ export default {
 					this.$util.msg(error.msg, 2000)
 				})
 		},
+		async MiniWxPayFor(coupon){
+			const wechatcode = await authorize.getCode('weixin')
+			const params ={
+					payAmount:this.$reg.formatAccMul(coupon.couponAmount,100),
+					payWay:'WEIXIN',
+					code:wechatcode,
+					orderId:18399
+				}
+			this.PayService.WeChatMiniWxPay(params).then(response =>{
+				// 友盟埋点收集微信支付
+				if(process.env.NODE_ENV != 'development'){
+					this.$uma.trackEvent('Um_Event_ConfirmWechatPay', {
+						Um_Key_PageName: '微信支付',
+						Um_Key_SourcePage: '线上支付',
+						Um_Key_PayName:`${this.buttonText}`,
+						Um_Key_PayOrderID:`${this.orderId}`
+					})
+				}
+				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) {
@@ -2174,7 +2227,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;

+ 2 - 2
main.js

@@ -5,7 +5,7 @@ import './services/index.js'
 import * as Api from '@/common/config/caimeiApi.js'
 import * as Regs from '@/common/config/common.js'
 // 友盟
-import Uma from './plugins/uma'
+// import Uma from './plugins/uma'
 
 // 公共组件 全局组件
 import { msg, modal, prePage, boundingClientRect } from './utils/util'
@@ -42,7 +42,7 @@ Vue.prototype.$Static = 'https://static.caimei365.com/app/img/'
 App.mpType = 'app'
 
 // 使用插件
-Vue.use(Uma)
+// Vue.use(Uma)
 
 const app = new Vue({
     ...App

+ 16 - 1
pages.json

@@ -473,11 +473,26 @@
                     "style": {
                         "navigationBarTitleText": "立即下单"
                     }
-                }, {
+                },
+				{
                     "path": "cart/second",
                     "style": {
                         "navigationBarTitleText": "二手下单"
                     }
+                },
+				{
+                    "path": "cart/coupon",
+                    "style": {
+                        "navigationBarTitleText": "优惠券列表",
+						"enablePullDownRefresh": true
+                    }
+                },
+				{
+                    "path": "cart/coupon-share",
+                    "style": {
+                        "navigationBarTitleText": "购买优惠券",
+						"enablePullDownRefresh": true
+                    }
                 },
                 {
                     "path": "order/create-order",

+ 94 - 33
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>
@@ -414,6 +411,13 @@
 												</view>
 												<view class="list-cell-btn">
 													<view class="icon-used">
+														<view class="icon-used-text" v-if="coupon.couponBtnType == 2">购买</view>
+														<view
+															class="icon-used-btn receive"
+															v-if="coupon.couponBtnType == 2"
+															@click="toPayCoupon(coupon)"
+															>¥500</view
+														>
 														<view
 															class="icon-used-btn receive"
 															v-if="currentTab == 0"
@@ -467,7 +471,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 +634,7 @@ export default {
 			shopId: 0,
 			shopID: 0,
 			vipFlag: 0,
-			firstClubType:0,
+			firstClubType: 0,
 			productId: 0,
 			userIdentity: 0, // 用户类型
 			goodsData: {}, // 自定义数据
@@ -662,7 +666,7 @@ export default {
 			popupShow0: false, // 参数弹窗
 			popupShow1: false, // 培训方案
 			popupShow2: false, // 优惠券
-			popupShow3:false,   // 购买弹窗
+			popupShow3: false, // 购买弹窗
 			tabSelectFlag: false,
 			sectionPropsArr: [],
 			scrollTopArray: [],
@@ -682,9 +686,9 @@ export default {
 			isPreviewImage: false,
 			opentype: '',
 			collectionType: false,
-			isShowSupportingList:false,
+			isShowSupportingList: false,
 			supportingList: [],
-			supportingNum:0 // 组合商品总数
+			supportingNum: 0 // 组合商品总数
 		}
 	},
 	computed: {
@@ -751,7 +755,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
@@ -835,10 +840,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
@@ -861,7 +866,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()
@@ -872,16 +877,22 @@ 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 {
+					html = product.productDetail
+						? this.$api.adaptRichTextImg(product.productDetail.commonDetailInfo)
+						: defaulHtml
 				}
 			}
 			return html
@@ -892,15 +903,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
 						}
 					}
@@ -947,6 +958,9 @@ export default {
 					console.log('获取购物车数量失败')
 				})
 		},
+		toPayCoupon(coupon){// 点击购买优惠券
+			this.MiniWxPayFor(coupon)
+		},
 		receiveCoupon(coupon) {
 			// 点击优惠券领取按钮
 			this.ProductService.ReceiveCoupon({
@@ -966,6 +980,49 @@ export default {
 					this.$util.msg(error.msg, 2000)
 				})
 		},
+		async MiniWxPayFor(coupon){
+			const wechatcode = await authorize.getCode('weixin')
+			const params ={
+					payAmount:this.$reg.formatAccMul(coupon.couponAmount,100),
+					payWay:'WEIXIN',
+					code:wechatcode,
+					orderId:18399
+				}
+			this.PayService.WeChatMiniWxPay(params).then(response =>{
+				// 友盟埋点收集微信支付
+				if(process.env.NODE_ENV != 'development'){
+					this.$uma.trackEvent('Um_Event_ConfirmWechatPay', {
+						Um_Key_PageName: '微信支付',
+						Um_Key_SourcePage: '线上支付',
+						Um_Key_PayName:`${this.buttonText}`,
+						Um_Key_PayOrderID:`${this.orderId}`
+					})
+				}
+				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
@@ -1136,7 +1193,6 @@ export default {
 				this.popupShow3 = false
 			} else {
 				this.toConfirmation()
-				
 			}
 		},
 		toConfirmation() {
@@ -1145,9 +1201,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() {
@@ -1969,7 +2023,7 @@ page {
 		font-size: 24rpx;
 		color: #999999;
 		line-height: 60rpx;
-		&.bold{
+		&.bold {
 			font-weight: bold;
 			color: #333333;
 		}
@@ -2491,7 +2545,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;
@@ -2549,7 +2610,7 @@ page {
 			}
 		}
 	}
-	.tui-shopping-main{
+	.tui-shopping-main {
 		width: 100%;
 		.layer-smimg {
 			width: 114rpx;

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

@@ -0,0 +1,296 @@
+<template>
+	<view class="container clearfix">
+		<view class="container-list">
+			<view class="coupon-list">
+				<view class="list-cell-le">
+					<view class="list-cell-tags">
+						<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
+					</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.couponAmount }}
+					</view>
+				</view>
+			</view>
+		</view>
+		<view class="container-button">
+			<view class="button" @click="MiniWxPayFor">¥10000购买</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:{
+					couponId:257,
+					couponAmount:10000.00,
+					touchPrice:20000.00,
+					startDate:"2022.02.10",
+					endDate:"2022.04.10",
+					couponType:0,
+					userId:null,
+					shopId:null,
+					productType:1,
+					categoryType:null,
+					shopName:null,
+					useStatus:null,
+					couponBtnType:0,
+					usePeriod:null
+				},
+				coupinList:[],
+				clubId:0 ,// 机构Id
+				couponId:0,//优惠券Id
+				payAmount:100 //支付金额
+			}
+		},
+		onLoad(option) {
+			this.clubId = option.clubId
+			this.couponId = option.couponId
+			console.log('机构Id',this.clubId)
+			console.log('价值优惠券Id',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: {
+			async initGetStotage() {
+				const userInfo = await this.$api.getStorage()
+				const clubInfo = await this.$api.getComStorage('orderUserInfo')
+				this.shareClubId = clubInfo.clubId ? clubInfo.clubId : 0
+			},
+			async MiniWxPayFor(){
+				const wechatcode = await authorize.getCode('weixin')
+				const params ={
+						payAmount:this.$reg.formatAccMul(this.payAmount,100),
+						payWay:'WEIXIN',
+						code:wechatcode,
+						orderId:18399
+					}
+				this.PayService.WeChatMiniWxPay(params).then(response =>{
+					// 友盟埋点收集微信支付
+					if(process.env.NODE_ENV != 'development'){
+						this.$uma.trackEvent('Um_Event_ConfirmWechatPay', {
+							Um_Key_PageName: '微信支付',
+							Um_Key_SourcePage: '线上支付',
+							Um_Key_PayName:`${this.buttonText}`,
+							Um_Key_PayOrderID:`${this.orderId}`
+						})
+					}
+					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)
+			},	
+		},
+		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;
+	}
+	.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;
+			box-sizing: border-box;
+			background: url(https://static.caimei365.com/app/img/icon/icon-coupon-buy@2x.png);
+			background-size: cover;
+			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>

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

@@ -0,0 +1,366 @@
+<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.couponAmount}}</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">
+									<text class="tags">{{ coupon.couponType | TypeFormat }}</text>
+								</view>
+								<view class="list-cell-texts">
+									<text v-if="coupon.couponType == 0">
+										{{ coupon.productType && coupon.productType == 1 ? '全商城商品通用' : '仅可购买指定商品'  }}
+									</text>
+									<text v-if="coupon.couponType == 1">
+										{{ coupon.categoryType == 1 ? '仅限购买产品类商品' : '仅限购买仪器类商品' }}
+									</text>
+									<text v-if="coupon.couponType == 3">仅限购买店铺【{{ coupon.shopName }}】的商品</text>
+									<text v-if="coupon.couponType == 4 || coupon.couponType == 2">全商城商品通用</text>
+								</view>
+							</view>
+							<view class="list-cell-btn">
+								<view class="icon-used">
+									<button open-type="share" 
+											class="icon-used-btn receive" 
+											@tap="onShareCoupon(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, //领券操作状态
+				shareClubId:0 ,// 机构Id
+				shareCoupon:0 ,// 分享优惠券
+			}
+		},
+		onLoad() {
+			uni.hideShareMenu()
+		},
+		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.shareClubId = clubInfo.clubId ? clubInfo.clubId : 0
+				this.listQuery.userId = clubInfo.userId ? clubInfo.userId : 0
+				this.QueryCouponList()
+			},
+			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){
+						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)
+				})
+			},
+			onShareCoupon(coupon){//分享购买优惠券
+				this.shareCoupon = coupon
+				
+			},
+			navigator(url){
+				this.$api.navigateTo(url)
+			},	
+		},
+		onShareAppMessage(res) {
+			//分享转发
+			if (res.from === 'button') {
+				console.log('来自页面内转发按钮')
+				return {
+					title: `只售${this.shareCoupon.couponAmount}元,${this.shareCoupon.touchPrice}元优惠券等您抢购~`,
+					path: `pages/seller/cart/coupon-share?couponId=${this.shareCoupon.couponId}&clubId=${this.shareClubId}`,
+					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(){
+			this.initGetStotage()
+		}
+	}
+</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>

+ 28 - 25
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,13 +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="_goBuyagain(club)"> <text>购买优惠券</text> </view>
+								<view class="btn yel" @click.stop="_goOperation(6,club)"> <text>购买优惠券</text> </view>
 							</view>
 						</view>
 					</view>
@@ -213,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() {

+ 59 - 2
pages/user/coupon/coupon-collection.vue

@@ -35,6 +35,8 @@
 							</view>
 							<view class="list-cell-btn">
 								<view class="icon-used">
+									<view class="icon-used-text" v-if="coupon.couponBtnType == 2">购买</view>
+									<view class="icon-used-btn receive" v-if="coupon.couponBtnType == 2" @click="toPayCoupon(coupon)">¥500</view>
 									<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>
 								</view>
@@ -54,6 +56,7 @@
 
 <script>
 	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:{
@@ -162,6 +165,9 @@
 					this.$util.msg(error.msg,2000)
 				})
 			},
+			toPayCoupon(coupon){// 点击购买优惠券
+				this.MiniWxPayFor(coupon)
+			},
 			receiveCoupon(coupon){// 点击优惠券领取按钮
 				if(this.hasLogin){
 					if(this.isReceiveLoading){return}
@@ -211,6 +217,49 @@
 						break
 				}
 			},
+			async MiniWxPayFor(coupon){
+				const wechatcode = await authorize.getCode('weixin')
+				const params ={
+						payAmount:this.$reg.formatAccMul(coupon.couponAmount,100),
+						payWay:'WEIXIN',
+						code:wechatcode,
+						orderId:18399
+					}
+				this.PayService.WeChatMiniWxPay(params).then(response =>{
+					// 友盟埋点收集微信支付
+					if(process.env.NODE_ENV != 'development'){
+						this.$uma.trackEvent('Um_Event_ConfirmWechatPay', {
+							Um_Key_PageName: '微信支付',
+							Um_Key_SourcePage: '线上支付',
+							Um_Key_PayName:`${this.buttonText}`,
+							Um_Key_PayOrderID:`${this.orderId}`
+						})
+					}
+					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)
 			},	
@@ -343,14 +392,22 @@
 							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;
 								border-radius: 28rpx;
 								line-height: 48rpx;
 								font-size: $font-size-26;
 								text-align: center;
+								padding: 0 26rpx;
+								box-sizing: border-box;
 								&.receive{
 									background-image: linear-gradient(270deg, #f94b4b 0%, #feb673 100%);;
 									color: #FFFFFF;