소스 검색

commit 商品详情可见度

zhengjinyi 2 년 전
부모
커밋
ae530a3b4d
4개의 변경된 파일226개의 추가작업 그리고 140개의 파일을 삭제
  1. 1 1
      components/cm-module/pageTemplate/template-product.vue
  2. 155 0
      pages/goods/components/cm-product-modal.vue
  3. 69 138
      pages/goods/product.vue
  4. 1 1
      services/config.env.js

+ 1 - 1
components/cm-module/pageTemplate/template-product.vue

@@ -58,7 +58,7 @@ export default{
     methods: {
         // 跳转商品详情ss
 	   navToDetailPage(pros) {
-			this.cmsSysStatistics(5)
+			this.cmsSysStatistics(5,pros.productId)
 			this.$api.navigateTo(`/pages/goods/product?id=${pros.productId}&typeId=5`)
 	   }
     }

+ 155 - 0
pages/goods/components/cm-product-modal.vue

@@ -0,0 +1,155 @@
+<template name="cm-product-modal">
+	<!-- 商品详情可见度弹窗提醒 -->
+	<view>
+		<tui-modal
+			:show="showModal"
+			@click="handleClick"
+			@cancel="hideMobel"
+			:content="contentModalText"
+			:button="modalButton"
+			color="#333"
+			:size="32"
+			shape="circle"
+			:maskClosable="false"
+		>
+		</tui-modal>
+	</view>
+</template>
+
+<script>
+import { mapState } from 'vuex'
+export default {
+	name: 'cm-product-modal',
+	props: {
+		showModal: {
+			type: Boolean,
+			default: false
+		},
+		commodityDetailsFlag: {
+			type: Number
+		},
+		userIdentity: {
+			type: Number
+		},
+		firstClubType: {
+			type: Number
+		},
+		isShareType:{
+			type:String
+		}
+	},
+	data() {
+		return {
+			contentModalText: '',
+			modalButton: [],
+			
+		}
+	},
+	computed: {
+		...mapState(['hasLogin'])
+	},
+	created() {
+		// 根据商品详情可见度显示弹窗 product.commodityDetailsFlag 1.所有人可见 2.所有机构可见 3.仅会员机构可见 4.仅医美机构可见
+		this.initModal(this.commodityDetailsFlag, this.userIdentity, this.firstClubType)
+	},
+	methods: {
+		initModal(flag, identity, clubType) {
+			this.contentModalText = this.setModalText(flag, identity, clubType, this.hasLogin)
+			this.modalButton = this.setModalButton(flag, identity, clubType, this.hasLogin)
+		},
+		setModalText(flag = '', identity = '', clubType = '', hasLogin) {
+			const map = {
+				'2': '该商品仅限已注册机构查看,请注册机构账户后继续查看。有采美账号的,请直接登录',
+				'3': '该商品仅限资质机构查看,请注册资质机构后继续查看。有采美账号的,请直接登录。',
+				'4': '该商品仅限医美类机构查看,请注册医美机构后继续查看。有采美账号的,请直接登录。',
+				'34': '该商品仅限资质机构查看,请升级为资质机构后继续查看。',
+				'44': '该商品仅限医美类机构查看,请升级为医美机构后继续查看。',
+				'42': '该商品仅限医美类机构查看,您暂无权限。您可去机构资料页面查看机构类型。'
+			}
+			// 游客提示语
+			if (!hasLogin) {
+				return map[flag]
+			}
+			const code = flag === 4 && identity === 2 && clubType !== 1 ? '42' : `${flag}${identity}`
+			return map[code]
+		},
+		setModalButton(flag = '', identity = '', clubType = '', hasLogin) {
+			const customStyle = { color: '#fff', bgColor: 'linear-gradient(90deg, #F28F31 0%, #E15616 100%)' }
+			const btnMap = {
+				'22': [
+					{ text: '关闭', type: 'gray', plain: true },
+					{
+						text: '去注册/登录',
+						customStyle: customStyle,
+						plain: false
+					}
+				],
+				'34': [
+					{ text: '关闭', type: 'gray', plain: true },
+					{
+						text: '去升级',
+						customStyle: customStyle,
+						plain: false
+					}
+				],
+				'44': [
+					{ text: '关闭', type: 'gray', plain: true },
+					{
+						text: '去升级',
+						customStyle: customStyle,
+						plain: false
+					}
+				],
+				'42': [
+					{ text: '关闭', type: 'gray', plain: true },
+					{
+						text: '去查看资料',
+						customStyle: customStyle,
+						plain: false
+					}
+				]
+			}
+			if (!hasLogin) {
+				// 游客按钮
+				return btnMap['22']
+			} 
+			const code = flag === 4 && identity === 2 && clubType !== 1 ? '42' : `${flag}${identity}`
+			console.log('code',code)
+			return btnMap[code]
+		},
+		handleClick(e) {
+			// 医美
+			if (e.index == 1) {
+				if (!this.hasLogin) {
+					//游客跳转登录页
+					this.$api.navigateTo('/pages/login/login')
+				} else {
+					if (this.userIdentity === 4) {
+						// 个人机构跳转升级页面
+						this.$api.navigateTo('/pages/login/apply')
+					} else if (this.userIdentity === 2) {
+						//会员机构
+						if (this.firstClubType != 1) {
+							// 会员非医美机构跳转资料页
+							this.$api.navigateTo('/pages/login/information')
+						}
+					}
+				}
+				this.$parent.showModal = false
+			} else {
+				this.$parent.showModal = false
+				if (this.isShareType == 'share') {
+					this.$api.switchTabTo('/pages/tabBar/home/index')
+				} else {
+					this.$api.navigateBack(1)
+				}
+			}
+		},
+		hideMobel() {
+			this.$parent.showModal = false
+		}
+	}
+}
+</script>
+
+<style lang="scss"></style>

+ 69 - 138
pages/goods/product.vue

@@ -299,7 +299,9 @@
 									<view class="ladder-item-td">
 										<view class="te-text last">{{ product.qualificationLink }}</view>
 										<view class="te-copy">
-											<text class="clipboard" @click.stop="clipboard(product.qualificationLink)">复制</text>
+											<text class="clipboard" @click.stop="clipboard(product.qualificationLink)"
+												>复制</text
+											>
 										</view>
 									</view>
 								</view>
@@ -655,19 +657,15 @@
 			:maskClosable="false"
 		>
 		</tui-modal>
-		<!-- 限制医疗器械商品查看限制 -->
-		<tui-modal
-			:show="modal1"
-			@click="handleClick1"
-			@cancel="hideMobel1"
-			:content="contentModalText1"
-			:button="modalButton1"
-			color="#333"
-			:size="32"
-			shape="circle"
-			:maskClosable="false"
-		>
-		</tui-modal>
+		<!-- 商品详情可见度弹窗提醒 -->
+		<cm-product-modal
+			v-if="showModal"
+			:showModal="showModal"
+			:commodityDetailsFlag="product.commodityDetailsFlag"
+			:isShareType="isShareType"
+			:userIdentity="userIdentity"
+			:firstClubType="firstClubType"
+		/>
 	</view>
 </template>
 
@@ -681,6 +679,7 @@ import cmRecommend from './components/recommend' //相关推荐
 import cmParameter from './components/cm-parameter' //相关参数
 import cmService from './components/cm-service' //服务项目
 import cmProductDoc from './components/cm-product-doc.vue'
+import cmProductModal from './components/cm-product-modal.vue'
 import couponTabs from '@/components/cm-module/coupon/tui-tabs.vue'
 import authorize from '@/common/config/authorize.js'
 import wxLogin from '@/common/config/wxLogin.js'
@@ -699,7 +698,8 @@ export default {
 		cmParameter,
 		cmService,
 		couponTabs,
-		cmProductDoc
+		cmProductDoc,
+		cmProductModal
 	},
 	data() {
 		return {
@@ -791,9 +791,7 @@ export default {
 			supportingList: [],
 			supportingNum: 0, // 组合商品总数
 			contentModalText: '', //操作文字提示语句
-			contentModalText1: '', //操作文字提示语句
 			modal: false,
-			modal1: false,
 			modalButton: [
 				{
 					text: '取消',
@@ -809,21 +807,7 @@ export default {
 					plain: false
 				}
 			],
-			modalButton1: [
-				{
-					text: '取消',
-					type: 'gray',
-					plain: true //是否空心
-				},
-				{
-					text: '去升级',
-					customStyle: {
-						color: '#fff',
-						bgColor: 'linear-gradient(90deg, #F28F31 0%, #E15616 100%)'
-					},
-					plain: false
-				}
-			],
+			showModal: false,
 			isShowCaimeiShop: false
 		}
 	},
@@ -864,7 +848,7 @@ export default {
 	},
 	onLoad(option) {
 		this.productId = this.couponParam.productId = option.id //获取商品ID
-		this.typeId =  option.typeId
+		this.typeId = option.typeId
 		this.opentype = option.open
 		this.isShareType = option.type
 		this.linkPath = option.path
@@ -915,7 +899,7 @@ export default {
 				userId: this.userId,
 				productId: this.productId,
 				identity: this.identity,
-				typeId:this.typeId
+				typeId: this.typeId
 			})
 				.then(response => {
 					this.productImage = []
@@ -1003,9 +987,7 @@ export default {
 					// setTimeout(() => {
 					//     this.getSectionProps()
 					// }, 2000)
-					if (this.product.productType === 2 && (this.userIdentity != 1 || this.userIdentity != 3)) {
-						this.handleShowProductType()
-					}
+					this.handleShowProductType(this.product.commodityDetailsFlag)
 					if ((this.hasLogin && this.userIdentity == 2) || this.userIdentity == 4) {
 						this.ProductCartNumber()
 					}
@@ -1020,90 +1002,39 @@ export default {
 					this.$util.msg(error.msg, 2000)
 				})
 		},
-		handleShowProductType() {
-			// 根据用户弹窗提示
+		handleShowProductType(flag = '') {
+			// 根据商品详情可见度显示弹窗 flag 1.所有人可见 2.所有机构可见 3.仅会员机构可见 4.仅医美机构可见
+			const flagMap = {
+				'2': true,
+				'3': true,
+				'4': true
+			}
 			if (!this.hasLogin) {
-				//游客
-				this.modal1 = true
-				this.contentModalText1 =
-					'该商品仅限医美类机构查看,请注册医美机构后继续查看。有采美账号的,请直接登录。'
-				this.modalButton1 = [
-					{ text: '关闭', type: 'gray', plain: true },
-					{
-						text: '去注册/登录',
-						customStyle: { color: '#fff', bgColor: 'linear-gradient(90deg, #F28F31 0%, #E15616 100%)' },
-					 plain: false
-					}
-				]
+				this.showModal = flagMap[flag]
+				return
+			}
+			if (this.vipFlag === 1) {
+				this.showModal = false
+				return
+			}
+			if (flag === 3 && this.userIdentity === 4) {
+				this.showModal = true
+				return
+			}
+			if (flag === 4 && this.userIdentity === 4) {
+				this.showModal = true
+				return
+			}
+			if (flag === 4 && this.userIdentity === 2 && this.firstClubType !== 1) {
+				this.showModal = true
 				return
-			} else {
-				if (this.userIdentity === 4) {
-					// 普通机构
-					this.modal1 = true
-					this.contentModalText1 = '该商品仅限医美类机构查看,请升级为医美机构后继续查看。'
-					this.modalButton1 = [
-						{ text: '关闭', type: 'gray', plain: true },
-						{
-							text: '去升级',
-							customStyle: { color: '#fff', bgColor: 'linear-gradient(90deg, #F28F31 0%, #E15616 100%)' },
-							plain: false
-						}
-					]
-					return
-				} else if (this.userIdentity === 2) {
-					//会员机构
-					if (this.firstClubType != 1) {
-						this.modal1 = true
-						this.contentModalText1 =
-							'该商品仅限医美类机构查看,您暂无权限。您可去机构资料页面查看机构类型。'
-						this.modalButton1 = [
-							{ text: '关闭', type: 'gray', plain: true },
-							{
-								text: '去查看资料',
-								customStyle: {
-									color: '#fff',
-									bgColor: 'linear-gradient(90deg, #F28F31 0%, #E15616 100%)'
-								},
-								plain: false
-							}
-						]
-						return
-					}
-				}
 			}
 		},
 		hideMobel1() {
 			this.modal1 = false
 			this.$api.navigateBack(1)
 		},
-		handleClick1(e) {
-			// 医美器械弹窗跳转
-			if (e.index == 1) {
-				if (!this.hasLogin) {
-					//游客跳转登录页
-					this.$api.navigateTo('/pages/login/login')
-				} else {
-					if (this.userIdentity === 4) {
-						// 个人机构跳转升级页面
-						this.$api.navigateTo('/pages/login/apply')
-					} else if (this.userIdentity === 2) {
-						//会员机构
-						if (this.firstClubType != 1) {
-							// 会员非医美机构跳转资料页
-							this.$api.navigateTo('/pages/login/information')
-						}
-					}
-				}
-				this.modal1 = false
-			} else {
-				this.modal1 = false
-				if (this.isShareType == 'share') {
-					this.$api.switchTabTo('/pages/tabBar/home/index')
-				} else {
-					this.$api.navigateBack(1)
-				}
-			}
-		},
+
 		adaptRichTextImg(product) {
 			// 商品详情
 			let defaulHtml = '<div style="text-align: center;color:#333333;">暂无内容</div>'
@@ -1689,19 +1620,19 @@ export default {
 		),
 		debounce(fn, delay) {
 			let timer = null //借助闭包
-		 return function() {
+			return function() {
 				if (timer) {
-		 		clearTimeout(timer)
+					clearTimeout(timer)
 				}
 				timer = setTimeout(fn, delay) // 简化写法
 			}
 		},
 		clipboard(data) {
-			thorui.getClipboardData(data, (res) => {
+			thorui.getClipboardData(data, res => {
 				if (res) {
-					this.$util.msg("复制成功",2000,true,'success');
+					this.$util.msg('复制成功', 2000, true, 'success')
 				} else {
-					this.$util.msg("复制失败",2000,true,'none');
+					this.$util.msg('复制失败', 2000, true, 'none')
 				}
 			})
 		},
@@ -2359,29 +2290,29 @@ page {
 		min-height: 856rpx;
 		box-sizing: border-box;
 		padding: 0 24rpx;
-		.product-details-table{
+		.product-details-table {
 			width: 100%;
 			min-height: 160rpx;
-			border: 1px solid #E1E1E1;
+			border: 1px solid #e1e1e1;
 			border-radius: 10rpx;
-			.ladder-tr{
+			.ladder-tr {
 				display: flex;
 				width: 100%;
 				justify-content: center;
 				height: 80rpx;
 				align-items: center;
-				border-bottom: 1px solid #E1E1E1;
-				&:last-child{
+				border-bottom: 1px solid #e1e1e1;
+				&:last-child {
 					border-bottom: none;
 				}
-				.ladder-item-td{
+				.ladder-item-td {
 					height: 80rpx;
 					justify-content: center;
 					text-align: center;
 					box-sizing: border-box;
 					padding: 10rpx;
 					float: left;
-					.te-text{
+					.te-text {
 						line-height: 28rpx;
 						font-size: $font-size-24;
 						text-overflow: ellipsis;
@@ -2391,29 +2322,29 @@ page {
 						-webkit-line-clamp: 2;
 						overflow: hidden;
 						color: #999999;
-						&.last{
+						&.last {
 							width: 60%;
 							float: left;
 						}
 					}
-					.te-copy{
+					.te-copy {
 						width: 40%;
 						float: right;
 						font-size: $font-size-24;
 						padding-top: 10rpx;
-						.clipboard{
+						.clipboard {
 							width: 84rpx;
 							height: 36rpx;
 							background: #4688fa;
 							text-align: center;
 							font-size: $font-size-24;
-							color: #FFFFFF;
+							color: #ffffff;
 							border-radius: 18rpx;
 							line-height: 36rpx;
 							display: inline-block;
 						}
 					}
-					&.th{
+					&.th {
 						display: flex;
 						height: 80rpx;
 						align-items: center;
@@ -2421,16 +2352,16 @@ page {
 						font-size: 26rpx;
 						color: #666;
 					}
-					&:nth-child(1){
-						width:25%;
-						border-right: 1px solid #E1E1E1;
+					&:nth-child(1) {
+						width: 25%;
+						border-right: 1px solid #e1e1e1;
 					}
-					&:nth-child(2){
-						width:35%;
-						border-right: 1px solid #E1E1E1;
+					&:nth-child(2) {
+						width: 35%;
+						border-right: 1px solid #e1e1e1;
 					}
-					&:nth-child(3){
-						width:40%;
+					&:nth-child(3) {
+						width: 40%;
 					}
 				}
 			}

+ 1 - 1
services/config.env.js

@@ -3,7 +3,7 @@ if(process.env.NODE_ENV === 'development'){
     // 开发环境
     // URL_CONFIG = 'http://192.168.2.67:18002'	 //智捷联调地址
     // URL_CONFIG = 'http://192.168.2.68:18002'	 //涛涛联调地址
-    // URL_CONFIG = 'http://192.168.2.17:18002' //超超联调地址
+    // URL_CONFIG = 'http://192.168.2.17:18002' //志国联调地址
     URL_CONFIG = 'https://core-b.caimei365.com'
     // URL_CONFIG = 'https://core.caimei365.com'
 }else{