Ver código fonte

增加优惠券限制医美机构购买

zhengjinyi 3 anos atrás
pai
commit
1c08d9d51f

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

@@ -454,6 +454,19 @@
 				</div>
 			</view>
 		</tui-bottom-popup>
+		<!-- 弹窗提示 -->
+		<tui-modal
+			:show="modal"
+			@click="handleClick"
+			@cancel="hideMobel"
+			:content="contentModalText"
+			:button="modalButton"
+			color="#333"
+			:size="32"
+			shape="circle"
+			:maskClosable="false"
+		>
+		</tui-modal>
 	</view>
 </template>
 
@@ -539,6 +552,23 @@ export default {
 			},
 			productCouponList: [], // 优惠券弹窗列表
 			isCouponEmpty: false,
+			contentModalText: '', //操作文字提示语句
+			modal: false,
+			modalButton: [
+				{
+					text: '取消',
+					type: 'gray',
+					plain: true //是否空心
+				},
+				{
+					text: '去升级',
+					customStyle: {
+						color: '#fff',
+						bgColor: 'linear-gradient(90deg, #F28F31 0%, #E15616 100%)'
+					},
+					plain: false
+				}
+			],
 		}
 	},
 	created() {
@@ -1475,7 +1505,13 @@ export default {
 				this.MiniWxPayFor(coupon,response.data.couponRecordId)
 			})
 			.catch(error => {
-				console.log(error)
+				if(error.code == -1){//个人机构不能购买
+					this.contentModalText ='该优惠券仅限医美机构购买,请升级为医美机构后再次购买。'
+					this.modal = true
+					
+				}else if(error.code == -2){//会员机构不是医美机构不能购买
+					this.$util.msg('该优惠券仅限医美机构购买', 2000)
+				}
 			})
 		},
 		async MiniWxPayFor(coupon,couponRecordId){
@@ -1526,6 +1562,16 @@ export default {
 				}
 			})
 		},
+		hideMobel(){
+			this.modal = false
+		},
+		handleClick(e){
+			//个人机构跳转升级页面
+			if (e.index == 1) {
+				this.$api.navigateTo('/pages/login/apply')
+			}
+			this.modal = false
+		},
 		showPopup(index, shop) {
 			// 显示popup弹窗
 			switch (index) {

+ 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

+ 48 - 2
pages/goods/product.vue

@@ -580,6 +580,19 @@
 				<scroll-top :isScrollTop="isScrollTop" :bottom="200" v-show="tabCurrentIndex !== 3"></scroll-top>
 			</view>
 		</template>
+		<!-- 弹窗提示 -->
+		<tui-modal
+			:show="modal"
+			@click="handleClick"
+			@cancel="hideMobel"
+			:content="contentModalText"
+			:button="modalButton"
+			color="#333"
+			:size="32"
+			shape="circle"
+			:maskClosable="false"
+		>
+		</tui-modal>
 	</view>
 </template>
 
@@ -699,7 +712,24 @@ export default {
 			collectionType: false,
 			isShowSupportingList: false,
 			supportingList: [],
-			supportingNum: 0 // 组合商品总数
+			supportingNum: 0 ,// 组合商品总数
+			contentModalText: '', //操作文字提示语句
+			modal: false,
+			modalButton: [
+				{
+					text: '取消',
+					type: 'gray',
+					plain: true //是否空心
+				},
+				{
+					text: '去升级',
+					customStyle: {
+						color: '#fff',
+						bgColor: 'linear-gradient(90deg, #F28F31 0%, #E15616 100%)'
+					},
+					plain: false
+				}
+			],
 		}
 	},
 	computed: {
@@ -1022,7 +1052,13 @@ export default {
 				this.MiniWxPayFor(coupon,response.data.couponRecordId)
 			})
 			.catch(error => {
-				console.log(error)
+				if(error.code == -1){//个人机构不能购买
+					this.contentModalText ='该优惠券仅限医美机构购买,请升级为医美机构后再次购买。'
+					this.modal = true
+					
+				}else if(error.code == -2){//会员机构不是医美机构不能购买
+					this.$util.msg('该优惠券仅限医美机构购买', 2000)
+				}
 			})
 		},
 		async MiniWxPayFor(coupon,couponRecordId){
@@ -1073,6 +1109,16 @@ export default {
 				}
 			})
 		},
+		hideMobel(){
+			this.modal = false
+		},
+		handleClick(e){
+			//个人机构跳转升级页面
+			if (e.index == 1) {
+				this.$api.navigateTo('/pages/login/apply')
+			}
+			this.modal = false
+		},
 		swiperChange(e) {
 			//顶部商品图片切换
 			const index = e.detail.current

+ 50 - 2
pages/seller/cart/coupon-share.vue

@@ -39,11 +39,25 @@
 				<view class="button" @click="createCouponRecord">¥{{ coupon.moneyCouponPrice }}购买</view>
 			</view>
 		</view>
+		<!-- 弹窗提示 -->
+		<tui-modal
+			:show="modal"
+			@click="handleClick"
+			@cancel="hideMobel"
+			:content="contentModalText"
+			:button="modalButton"
+			color="#333"
+			:size="32"
+			shape="circle"
+			:maskClosable="false"
+		>
+		</tui-modal>
 	</view>
 </template>
 
 <script>
 import { mapState, mapMutations } from 'vuex'
+import wxLogin from '@/common/config/wxLogin.js'
 import authorize from '@/common/config/authorize.js'
 export default {
 	data() {
@@ -55,10 +69,28 @@ export default {
 			userId: 0, // 机构Id
 			couponId: 0, //优惠券Id
 			payAmount: 100 ,//支付金额
-			skeletonShow:true
+			skeletonShow:true,
+			contentModalText: '', //操作文字提示语句
+			modal: false,
+			modalButton: [
+				{
+					text: '取消',
+					type: 'gray',
+					plain: true //是否空心
+				},
+				{
+					text: '去升级',
+					customStyle: {
+						color: '#fff',
+						bgColor: 'linear-gradient(90deg, #F28F31 0%, #E15616 100%)'
+					},
+					plain: false
+				}
+			],
 		}
 	},
 	onLoad(option) {
+		wxLogin.wxLoginAuthorize()
 		this.userId = option.userId
 		this.couponId = option.couponId
 		console.log('机构userId', this.userId)
@@ -111,7 +143,13 @@ export default {
 				this.MiniWxPayFor(response.data.couponRecordId)
 			})
 			.catch(error => {
-				console.log(error)
+				if(error.code == -1){//个人机构不能购买
+					this.contentModalText ='该优惠券仅限医美机构购买,请升级为医美机构后再次购买。'
+					this.modal = true
+					
+				}else if(error.code == -2){//会员机构不是医美机构不能购买
+					this.$util.msg('该优惠券仅限医美机构购买', 2000)
+				}
 			})
 		},
 		async MiniWxPayFor(couponRecordId) {
@@ -158,6 +196,16 @@ export default {
 				complete: function(res) {}
 			})
 		},
+		hideMobel(){
+			this.modal = false
+		},
+		handleClick(e){
+			//个人机构跳转升级页面
+			if (e.index == 1) {
+				this.$api.navigateTo('/pages/login/apply')
+			}
+			this.modal = false
+		},
 		navigator(url) {
 			this.$api.navigateTo(url)
 		}

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

@@ -87,6 +87,19 @@
 				</template>
 			</view>
 		</view>
+		<!-- 弹窗提示 -->
+		<tui-modal
+			:show="modal"
+			@click="handleClick"
+			@cancel="hideMobel"
+			:content="contentModalText"
+			:button="modalButton"
+			color="#333"
+			:size="32"
+			shape="circle"
+			:maskClosable="false"
+		>
+		</tui-modal>
 	</view>
 </template>
 
@@ -118,7 +131,24 @@ export default {
 			pullFlag: true,
 			isReceiveLoading: false, //领券操作状态
 			userIdentity: 0,
-			skeletonShow:true
+			skeletonShow:true,
+			contentModalText: '', //操作文字提示语句
+			modal: false,
+			modalButton: [
+				{
+					text: '取消',
+					type: 'gray',
+					plain: true //是否空心
+				},
+				{
+					text: '去升级',
+					customStyle: {
+						color: '#fff',
+						bgColor: 'linear-gradient(90deg, #F28F31 0%, #E15616 100%)'
+					},
+					plain: false
+				}
+			],
 		}
 	},
 	onLoad(option) {
@@ -321,7 +351,13 @@ export default {
 				this.MiniWxPayFor(coupon,response.data.couponRecordId)
 			})
 			.catch(error => {
-				console.log(error)
+				if(error.code == -1){//个人机构不能购买
+					this.contentModalText ='该优惠券仅限医美机构购买,请升级为医美机构后再次购买。'
+					this.modal = true
+					
+				}else if(error.code == -2){//会员机构不是医美机构不能购买
+					this.$util.msg('该优惠券仅限医美机构购买', 2000)
+				}
 			})
 		},
 		async MiniWxPayFor(coupon,couponRecordId) {
@@ -368,6 +404,16 @@ export default {
 				complete: function(res) {}
 			})
 		},
+		hideMobel(){
+			this.modal = false
+		},
+		handleClick(e){
+			//个人机构跳转升级页面
+			if (e.index == 1) {
+				this.$api.navigateTo('/pages/login/apply')
+			}
+			this.modal = false
+		},
 		navigator(url) {
 			this.$api.navigateTo(url)
 		}

+ 48 - 3
pages/user/coupon/coupon-collection.vue

@@ -76,6 +76,19 @@
 				<!--加载loadding-->
 			</template>
 		</view>
+		<!-- 弹窗提示 -->
+		<tui-modal
+			:show="modal"
+			@click="handleClick"
+			@cancel="hideMobel"
+			:content="contentModalText"
+			:button="modalButton"
+			color="#333"
+			:size="32"
+			shape="circle"
+			:maskClosable="false"
+		>
+		</tui-modal>
 	</view>
 </template>
 
@@ -105,7 +118,24 @@ export default {
 			loadding: false,
 			pullUpOn: true,
 			pullFlag: true,
-			isReceiveLoading: false //领券操作状态
+			isReceiveLoading: false ,//领券操作状态
+			contentModalText: '', //操作文字提示语句
+			modal: false,
+			modalButton: [
+				{
+					text: '取消',
+					type: 'gray',
+					plain: true //是否空心
+				},
+				{
+					text: '去升级',
+					customStyle: {
+						color: '#fff',
+						bgColor: 'linear-gradient(90deg, #F28F31 0%, #E15616 100%)'
+					},
+					plain: false
+				}
+			],
 		}
 	},
 	onLoad() {},
@@ -285,7 +315,6 @@ export default {
 					return
 				}
 				this.createCouponRecord(coupon)
-				
 			} else {
 				this.$api.navigateTo('/pages/login/login')
 			}
@@ -300,7 +329,13 @@ export default {
 				this.MiniWxPayFor(coupon,response.data.couponRecordId)
 			})
 			.catch(error => {
-				console.log(error)
+				if(error.code == -1){//个人机构不能购买
+					this.contentModalText ='该优惠券仅限医美机构购买,请升级为医美机构后再次购买。'
+					this.modal = true
+					
+				}else if(error.code == -2){//会员机构不是医美机构不能购买
+					this.$util.msg('该优惠券仅限医美机构购买', 2000)
+				}
 			})
 		},
 		async MiniWxPayFor(coupon,couponRecordId) {
@@ -347,6 +382,16 @@ export default {
 				complete: function(res) {}
 			})
 		},
+		hideMobel(){
+			this.modal = false
+		},
+		handleClick(e){
+			//个人机构跳转升级页面
+			if (e.index == 1) {
+				this.$api.navigateTo('/pages/login/apply')
+			}
+			this.modal = false
+		},
 		navigator(url) {
 			this.$api.navigateTo(url)
 		}