Procházet zdrojové kódy

Merge remote-tracking branch 'origin/developerB' into developer

zhengjinyi před 3 roky
rodič
revize
ae317b24e0

+ 48 - 2
components/cm-module/cart-components/index.vue

@@ -387,7 +387,15 @@
 										<view class="list-cell-btn">
 											<view class="icon-used">
 												<template v-if="coupon.couponBtnType == 0">
-													<template v-if="coupon.moneyCouponFlag == 1">
+													<template v-if="coupon.couponPayWay == 2">
+														<view class="icon-used-text">{{ coupon.moneyCouponPrice }}采美豆</view>
+														<view
+															class="icon-used-btn receive"
+															@click="toDeductCoupon(coupon)"
+															>抵扣</view
+														>
+													</template>								
+													<template v-else-if="coupon.couponPayWay == 1">
 														<view class="icon-used-text">购买</view>
 														<view
 															class="icon-used-btn receive"
@@ -1477,7 +1485,7 @@ export default {
 			this.ProductService.ReceiveCoupon({
 				userId: this.couponParam.userId,
 				couponId: coupon.couponId,
-				source: 2
+				source: 1
 			})
 				.then(response => {
 					this.$util.msg('领取成功', 1500, true, 'success')
@@ -1491,6 +1499,44 @@ export default {
 					this.$util.msg(error.msg, 2000)
 				})
 		},
+		toDeductCoupon(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.WeChatPayCouponBeans(coupon)
+			} else {
+				this.$api.navigateTo('/pages/login/login')
+			}
+		},
+		WeChatPayCouponBeans(coupon){
+			// 采美豆抵扣优惠券
+			this.PayService.WeChatPayCouponBeans({
+				source: 1, //领取渠道 1 小程序  2 网站
+				userId: this.couponParam.userId,
+				couponId: coupon.couponId
+			})
+			.then(response => {
+				this.$util.msg('抵扣成功', 1500)
+				setTimeout(() => {
+					this.currentTab = 1
+					this.couponParam.status = 2
+					this.queryPopupCoupons()
+				}, 1500)
+			})
+			.catch(error => {
+				this.$util.msg(error.msg, 2000)
+			})
+		},
 		toPayCoupon(coupon){
 			// 点击购买优惠券,友盟埋点收集购买优惠券
 			if (process.env.NODE_ENV != 'development') {

+ 2 - 2
components/cm-module/cm-seller/user.vue

@@ -82,12 +82,12 @@
 			</view>
 			<!-- 底部跳转 -->
 			<view class="foot-list">
-<!-- 				<view class="list-cell-image" @click="navigator('/pages/user/coupon/coupon-activity')">
+				<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>
 				<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">

+ 48 - 2
pages/goods/product.vue

@@ -422,7 +422,15 @@
 												<view class="list-cell-btn">
 													<view class="icon-used">
 														<template v-if="coupon.couponBtnType == 0">
-															<template v-if="coupon.moneyCouponFlag == 1">
+															<template v-if="coupon.couponPayWay == 2">
+																<view class="icon-used-text">{{ coupon.moneyCouponPrice }}采美豆</view>
+																<view
+																	class="icon-used-btn receive"
+																	@click="toDeductCoupon(coupon)"
+																	>抵扣</view
+																>
+															</template>								
+															<template v-else-if="coupon.couponPayWay == 1">
 																<view class="icon-used-text">购买</view>
 																<view
 																	class="icon-used-btn receive"
@@ -1122,7 +1130,7 @@ export default {
 			this.ProductService.ReceiveCoupon({
 				userId: this.couponParam.userId,
 				couponId: coupon.couponId,
-				source: 2
+				source: 1
 			})
 				.then(response => {
 					this.$util.msg('领取成功', 1500, true, 'success')
@@ -1136,6 +1144,44 @@ export default {
 					this.$util.msg(error.msg, 2000)
 				})
 		},
+		toDeductCoupon(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.WeChatPayCouponBeans(coupon)
+			} else {
+				this.$api.navigateTo('/pages/login/login')
+			}
+		},
+		WeChatPayCouponBeans(coupon){
+			// 采美豆抵扣优惠券
+			this.PayService.WeChatPayCouponBeans({
+				source: 1, //领取渠道 1 小程序  2 网站
+				userId: this.couponParam.userId,
+				couponId: coupon.couponId
+			})
+			.then(response => {
+				this.$util.msg('抵扣成功', 1500)
+				setTimeout(() => {
+					this.currentTab = 1
+					this.couponParam.status = 2
+					this.queryPopupCoupons()
+				}, 1500)
+			})
+			.catch(error => {
+				this.$util.msg(error.msg, 2000)
+			})
+		},
 		toPayCoupon(coupon) {
 			// 点击购买优惠券,友盟埋点收集购买优惠券
 			if (process.env.NODE_ENV != 'development') {

+ 28 - 4
pages/seller/cart/coupon-share.vue

@@ -30,13 +30,20 @@
 						<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>
+						<template  v-if="coupon.couponPayWay == 1">
+							<view class="coupon-minMoney">售价</view>
+							<view class="coupon-maxMoney"> <text class="small">¥</text> {{ coupon.moneyCouponPrice }} </view>
+						</template>
+						<template v-if="coupon.couponPayWay == 2">
+							<view class="coupon-minMoney">售价</view>
+							<view class="coupon-maxMoney">{{ coupon.moneyCouponPrice }}采美豆</view>
+						</template>
 					</view>
 				</view>
 			</view>
 			<view class="container-button">
-				<view class="button" @click="createCouponRecord">¥{{ coupon.moneyCouponPrice }}购买</view>
+				<view class="button" v-if="coupon.couponPayWay == 1" @click="createCouponRecord">¥{{ coupon.moneyCouponPrice }}购买</view>
+				<view class="button" v-if="coupon.couponPayWay == 2" @click="WeChatPayCouponBeans">{{ coupon.moneyCouponPrice }}采美豆抵扣</view>
 			</view>
 		</view>
 		<!-- 弹窗提示 -->
@@ -135,6 +142,23 @@ export default {
 					console.log('初始化优惠券信息异常~')
 				})
 		},
+		WeChatPayCouponBeans(coupon){
+			// 采美豆抵扣优惠券
+			this.PayService.WeChatPayCouponBeans({
+				source: 1, //领取渠道 1 小程序  2 网站
+				userId: this.userId,
+				couponId: this.couponId
+			})
+			.then(response => {
+				this.$util.msg('抵扣成功', 1500)
+				setTimeout(() => {
+					this.$api.switchTabTo('/pages/tabBar/home/index')
+				}, 1500)
+			})
+			.catch(error => {
+				this.$util.msg(error.msg, 2000)
+			})
+		},
 		createCouponRecord(){
 			// 生成购买优惠券记录Id
 			this.PayService.WeChatCouponRecord({
@@ -276,7 +300,7 @@ page {
 				width: 100%;
 				height: 78rpx;
 				line-height: 78rpx;
-				font-size: 40rpx;
+				font-size: 28rpx;
 				color: #f94b4b;
 				text-align: center;
 				.small {

+ 2 - 1
pages/seller/cart/coupon.vue

@@ -7,7 +7,8 @@
 			</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-tag" v-if="coupon.couponPayWay == 1">售价¥{{ coupon.moneyCouponPrice }}</view>
+					<view class="list-cell-tag" v-else>售价{{ 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>

+ 2 - 0
pages/user/account/account-bean.vue

@@ -143,6 +143,8 @@
                         14:'购买超级会员',
                         15:'系统扣除',
                         16:'系统退回',
+                        17:'抵扣优惠券',
+                        18:'优惠券退款',
 					}
 				Object.keys(stateTextObject).forEach(function(key){
 					if(key == state){

+ 54 - 2
pages/user/coupon/coupon-activity.vue

@@ -54,7 +54,23 @@
 								</view>
 								<view class="list-cell-btn">
 									<view class="icon-used">
-										<template v-if="coupon.moneyCouponFlag == 1">
+										<template v-if="coupon.couponPayWay == 2">
+											<template v-if="coupon.couponBtnType == 0">
+												<view class="icon-used-text">{{ coupon.moneyCouponPrice }}采美豆</view>
+												<view class="icon-used-btn buy" @click="toDeductCoupon(coupon)"
+													>抵扣</view
+												>
+											</template>
+											<template v-else>
+												<view
+													class="icon-used-btn make"
+													v-if="coupon.couponBtnType == 1"
+													@click="toUseCoupon(coupon)"
+													>去使用</view
+												>
+											</template>
+										</template>								
+										<template v-else-if="coupon.couponPayWay == 1">
 											<view class="icon-used-text">购买</view>
 											<view class="icon-used-btn buy" @click="toPayCoupon(coupon)"
 												>¥{{ coupon.moneyCouponPrice }}</view
@@ -274,7 +290,7 @@ export default {
 				this.ProductService.ReceiveCoupon({
 					userId: this.listQuery.userId,
 					couponId: coupon.couponId,
-					source: 2
+					source: 1
 				})
 					.then(response => {
 						this.isReceiveLoading = true
@@ -324,6 +340,42 @@ export default {
 					break
 			}
 		},
+		toDeductCoupon(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.WeChatPayCouponBeans(coupon)
+			} else {
+				this.$api.navigateTo('/pages/login/login')
+			}
+		},
+		WeChatPayCouponBeans(coupon){
+			// 采美豆抵扣优惠券
+			this.PayService.WeChatPayCouponBeans({
+				source: 1, //领取渠道 1 小程序  2 网站
+				userId: this.listQuery.userId,
+				couponId: coupon.couponId
+			})
+			.then(response => {
+				this.$util.msg('抵扣成功', 1500)
+				setTimeout(() => {
+					coupon.couponBtnType = 1
+				}, 1500)
+			})
+			.catch(error => {
+				this.$util.msg(error.msg, 2000)
+			})
+		},
 		toPayCoupon(coupon) {
 			// 点击购买优惠券,友盟埋点收集购买优惠券
 			if (process.env.NODE_ENV != 'development') {

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

@@ -44,7 +44,23 @@
 							</view>
 							<view class="list-cell-btn">
 								<view class="icon-used">
-									<template v-if="coupon.moneyCouponFlag == 1">
+									<template v-if="coupon.couponPayWay == 2">
+										<template v-if="coupon.couponBtnType == 0">
+											<view class="icon-used-text">{{ coupon.moneyCouponPrice }}采美豆</view>
+											<view class="icon-used-btn buy" @click="toDeductCoupon(coupon)"
+												>抵扣</view
+											>
+										</template>
+										<template v-else>
+											<view
+												class="icon-used-btn make"
+												v-if="coupon.couponBtnType == 1"
+												@click="toUseCoupon(coupon)"
+												>去使用</view
+											>
+										</template>
+									</template>								
+									<template v-else-if="coupon.couponPayWay == 1">
 										<view class="icon-used-text">购买</view>
 										<view class="icon-used-btn buy" @click="toPayCoupon(coupon)"
 											>¥{{ coupon.moneyCouponPrice }}</view
@@ -252,7 +268,7 @@ export default {
 				this.ProductService.ReceiveCoupon({
 					userId: this.listQuery.userId,
 					couponId: coupon.couponId,
-					source: 2
+					source: 1
 				})
 					.then(response => {
 						this.isReceiveLoading = true
@@ -302,6 +318,42 @@ export default {
 					break
 			}
 		},
+		toDeductCoupon(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.WeChatPayCouponBeans(coupon)
+			} else {
+				this.$api.navigateTo('/pages/login/login')
+			}
+		},
+		WeChatPayCouponBeans(coupon){
+			// 采美豆抵扣优惠券
+			this.PayService.WeChatPayCouponBeans({
+				source: 1, //领取渠道 1 小程序  2 网站
+				userId: this.listQuery.userId,
+				couponId: coupon.couponId
+			})
+			.then(response => {
+				this.$util.msg('抵扣成功', 1500)
+				setTimeout(() => {
+					coupon.couponBtnType = 1
+				}, 1500)
+			})
+			.catch(error => {
+				this.$util.msg(error.msg, 2000)
+			})
+		},
 		toPayCoupon(coupon) {
 			// 点击购买优惠券,友盟埋点收集购买优惠券
 			if (process.env.NODE_ENV != 'development') {

+ 2 - 2
services/config.env.js

@@ -8,7 +8,7 @@ if(process.env.NODE_ENV === 'development'){
     // URL_CONFIG = 'https://core.caimei365.com'
 }else{
     // 生产环境
-    // URL_CONFIG = 'https://core-b.caimei365.com'
-    URL_CONFIG = 'https://core.caimei365.com'
+    URL_CONFIG = 'https://core-b.caimei365.com'
+    // URL_CONFIG = 'https://core.caimei365.com'
 }
 export default URL_CONFIG

+ 14 - 0
services/pay.service.js

@@ -103,6 +103,20 @@ export default class PayService {
             isLoading: false ,
         })
     }
+    /**
+	 *采美豆抵扣优惠券
+	 *@param  source  领取渠道 1 小程序  2 网站
+	 *@param  userId  用户Id
+	 *@param  couponId  优惠券Id
+	 */
+    WeChatPayCouponBeans (data = {}) {
+        return this.AjaxService.post({ 
+            url:'/order/pay/coupon/beans', 
+            data, 
+            isLoading: true ,
+            loadText:'请求抵扣中...'  
+        })
+    }
     /**
 	 *生成支付链接
 	 *@param  unpaidAmount 本次待付款金额