Parcourir la source

商品详情医疗器械查看权限限制

zhengjinyi il y a 3 ans
Parent
commit
186b634300

+ 51 - 0
src/main/resources/static/js/product/detail.js

@@ -5,6 +5,7 @@ var productDetail = new Vue({
         showProduct: false,
         productId: 0,
         userId: 0,
+        identity:0,
         number: 0,
         productStock: 0,
         pcActType: 0,
@@ -22,6 +23,7 @@ var productDetail = new Vue({
             supplierId: 0,
             userIdentity: 0 //2-会员机构;3-供应商;4-普通机构
         },
+        product:{},// 商品信息
         ladderList: [],//阶梯价
         promotions: {},//促销活动信息
         promotionsId: 0,//活动id
@@ -171,6 +173,7 @@ var productDetail = new Vue({
             ProductApi.GetProductDdtails({userId: GLOBAL_USER_ID, productId: _self.productId}, function (response) {
                 if (response.code == 0) {
                     var product = response.data;
+                    _self.product = response.data;
                     _self.pcActType = product.pcActType;
                     _self.beautyActFlag = product.beautyActFlag;
                     _self.productTypeName = product.typeName;
@@ -210,6 +213,10 @@ var productDetail = new Vue({
                     if (product.stock == 0 && product.validFlag != 3) {
                         _self.disabledText = '售罄'
                     }
+                    if(product.productType === 2 && (GLOBAL_USER_IDENTITY != 3)){
+                        _self.handleShowProductType()
+                        return
+                    }
                     _self.getRecommends();
                     _self.getProdcutArchiveDetails();  //获取资料列表
                     // 获取路由hash标识,设置默认展开tab
@@ -222,6 +229,49 @@ var productDetail = new Vue({
                 }
             })
         },
+        handleShowProductType: function (){
+            if(GLOBAL_USER_ID === 0){//游客
+                CAIMEI.Popup({
+                    content: '<div class="payAlert"><p>该商品仅限医美类机构查看,请注册医美机构后继续查看。有采美账号的,请直接登录。</p></div>',
+                    confitmBtnText: '去注册/登录',
+                    cancelBtnText: '关闭'
+                },function(){
+                    // 确定
+                    window.location.href = '/login.html';
+                },function(){
+                    // 关闭
+                    window.history.back(-1);
+                });
+            }else{
+                if(GLOBAL_USER_IDENTITY === 4 ){// 普通机构
+                    CAIMEI.Popup({
+                        content: '<div class="payAlert"><p>该商品仅限医美类机构查看,请升级为医美机构后继续查看。</p></div>',
+                        confitmBtnText: '去升级',
+                        cancelBtnText: '关闭'
+                    },function(){
+                        // 确定
+                        window.location.href = '/user/setting/upgrade.html';
+                    },function(){
+                        // 关闭
+                        window.history.back(-1);
+                    });
+                }else if( GLOBAL_USER_IDENTITY === 2 ){//会员机构
+                    if(GLOBAL_CLUB_TYPE != 1){
+                        CAIMEI.Popup({
+                            content: '<div class="payAlert"><p>该商品仅限医美类机构查看,您暂无权限。您可去机构资料页面查看机构类型。</p></div>',
+                            confitmBtnText: '去查看资料',
+                            cancelBtnText: '关闭'
+                        },function(){
+                            // 确定
+                            window.location.href = '/user/setting/information.html';
+                        },function(){
+                            // 关闭
+                            window.history.back(-1);
+                        });
+                    }
+                }
+            }
+        },
         getProductPrice: function () {//获取商品价格
             var _self = this;
             if (_self.productId === 0) {
@@ -731,6 +781,7 @@ var productDetail = new Vue({
         // visibility:3:所有人可见,2:普通机构可见,1:会员机构可见
         var visible = $("#productVisibility").val() * 1;
         var identity = GLOBAL_USER_IDENTITY;
+        this.identity = identity
         this.showProduct = visible === 3 || identity === 1 || identity === 2 || (identity === 4 && visible === 2);
         if (!this.showProduct) {
             window.location.href = "/404.html?error=未查询到该商品";

+ 7 - 2
src/main/resources/static/js/utils.js

@@ -141,6 +141,7 @@ CAIMEI.Modal = function(content,cancelText,confitmText,callback){
  * @auth charles
  */
 CAIMEI.Popup = function(params,confirmCallback, cancelCallback){
+    document.body.style.overflow = 'hidden';
     $.confirm({
         boxWidth: (isPC?'300px':'70%'),
         title:'提示',
@@ -154,12 +155,16 @@ CAIMEI.Popup = function(params,confirmCallback, cancelCallback){
             cancel: {
                 text: params.cancelBtnText,
                 btnClass: 'btn-cancel',
-                action: cancelCallback?cancelCallback:function(){}
+                action: cancelCallback?cancelCallback:function(){
+                    document.body.style.overflow = 'auto';
+                }
             },
             confirm:{
                 text: params.confitmBtnText,
                 btnClass: 'btn-confirm',
-                action: confirmCallback?confirmCallback:function(){}
+                action: confirmCallback?confirmCallback:function(){
+                    document.body.style.overflow = 'auto';
+                }
             }
         }
     });

+ 2 - 2
src/main/resources/templates/index.html

@@ -184,7 +184,7 @@
                                     <!-- 商品/图片 列表 -->
                                     <a :href="pros.link" class="page_main_item ad_04 swiper-slide" target="_blank" v-for="pros in floor.floorImageList">
                                         <img class="page_main_image" src="/img/base/placeholder.png" :data-original="pros.image" :alt="pros.name">
-                                        <div class="page_main_type">医疗器械</div>
+                                        <div class="page_main_type" v-if="pros.productType == 2">医疗器械</div>
                                         <div class="page_main_tag" v-if="pros.listType == 2"><p v-text="pros.label"></p></div>
                                         <div class="page_main_text">
                                             <span class="tag" v-if="pros.beautyActFlag == 1">美博会</span>
@@ -319,7 +319,7 @@
                                         <th:block th:each="pros : ${floor.get('floorImageList')}"  th:object="${pros}">
                                             <a th:href="*{link}" class="page_main_item ad_04 swiper-slide" target="_blank">
                                                 <img class="page_main_image" src="/img/base/placeholder.png" th:attr="data-original=*{image}" th:alt="*{name}">
-                                                <div class="page_main_type">医疗器械</div>
+                                                <div class="page_main_type" th:if="*{productType}== 2">医疗器械</div>
                                                 <div class="page_main_tag" th:if="*{listType}==2"><p th:text="*{label}"></p></div>
                                                 <div class="page_main_text">
                                                     <th:block th:if="${pros.containsKey('product')}">

+ 2 - 2
src/main/resources/templates/product/detail.html

@@ -23,7 +23,7 @@
     <div class="wrap">
         <div class="productBox clear">
             <div class="imageBox" id="imgShown">
-                <div class="page_main_type">医疗器械</div>
+                <div class="page_main_type" v-if="product.productType == 2">医疗器械</div>
                 <div v-if="isPC" class="bigImage">
                     <img :src="images[0]">
                     <span class="mask"></span>
@@ -286,7 +286,7 @@
                             <div class="product-supporting-list" v-for="(pros,index) in defaultSupportingList" :class="index == 0 ? 'active' : ''">
                                 <div class="tr tr-1">
                                     <a :href="'/product-'+pros.productId+'.html'" target="_blank">
-                                        <img class="smalltype" src="/img/base/icon-smalltype@2x.png" alt="">
+                                        <img class="smalltype" src="/img/base/icon-smalltype@2x.png" alt="" v-if="pros.productType == 2">
                                         <img class="images" :src="pros.image" :alt="pros.name">
                                     </a>
                                 </div>

+ 2 - 2
src/main/resources/templates/product/instrument.html

@@ -107,7 +107,7 @@
                                 <!-- 商品/图片 列表 -->
                                 <a :href="pros.link" class="page_main_item ad_04 swiper-slide" target="_blank" v-for="pros in floor.floorImageList">
                                     <img class="page_main_image" src="/img/base/placeholder.png" :data-original="pros.image" :alt="pros.name">
-                                    <div class="page_main_type">医疗器械</div>
+                                    <div class="page_main_type" v-if="pros.productType == 2">医疗器械</div>
                                     <div class="page_main_tag" v-if="pros.listType == 2"><p v-text="pros.label"></p></div>
                                     <div class="page_main_text">
                                         <span class="tag" v-if="pros.beautyActFlag == 1">美博会</span>
@@ -244,7 +244,7 @@
                                     <th:block th:each="pros : ${floor.get('floorImageList')}"  th:object="${pros}">
                                         <a th:href="*{link}" class="page_main_item ad_04 swiper-slide" target="_blank">
                                             <img class="page_main_image" src="/img/base/placeholder.png" th:attr="data-original=*{image}" th:alt="*{name}">
-                                            <div class="page_main_type">医疗器械</div>
+                                            <div class="page_main_type" th:if="*{productType}== 2">医疗器械</div>
                                             <div class="page_main_tag" th:if="*{listType}==2"><p th:text="*{label}"></p></div>
                                             <div class="page_main_text">
                                                 <th:block th:if="${pros.containsKey('product')}">

+ 1 - 1
src/main/resources/templates/product/list.html

@@ -144,7 +144,7 @@
             <!--商品列表-->
             <ul class="productList clear mfw">
                 <li class="productItem " v-for="p in listData">
-                    <div class="page_main_type">医疗器械</div>
+                    <div class="page_main_type" v-if="p.productType == 2">医疗器械</div>
                     <a class="image" :href="'/product-'+p.productId+'.html'">
                         <img src="/img/base/placeholder.png" :data-original="p.image" :alt="p.name">
                         <p class="name" v-html="addhtml + p.name" v-if="p.beautyActFlag==1"></p>

+ 1 - 1
src/main/resources/templates/product/product-coupon.html

@@ -28,7 +28,7 @@
         <div class="coupon-content clear">
             <ul class="productList clear mfw">
                 <li class="productItem " v-for="p in listData">
-                    <div class="page_main_type">医疗器械</div>
+                    <div class="page_main_type" v-if="p.productType == 2">医疗器械</div>
                     <a class="image" :href="'/product-'+p.productId+'.html'">
                         <img src="/img/base/placeholder.png" :data-original="p.image" :alt="p.name">
                         <p class="name" v-html="addhtml + p.name" v-if="p.beautyActFlag==1"></p>

+ 1 - 1
src/main/resources/templates/product/promotions.html

@@ -38,7 +38,7 @@
             <li class="productItem mfc" v-for="p in listData">
                 <div class="">
                     <a class="image" :href="'/product-'+p.productId+'.html'" target="_blank">
-                        <div class="page_main_type">医疗器械</div>
+                        <div class="page_main_type" v-if="p.productType == 2">医疗器械</div>
                         <img :src="p.image" :alt="p.name">
                     </a>
                     <a class="name" :href="'/product-'+p.productId+'.html'" target="_blank">

+ 1 - 1
src/main/resources/templates/supplier/index.html

@@ -60,7 +60,7 @@
                         <ul class="productList clear mfw" v-if="floor.productList.length > 0">
                             <li class="productItem " v-for="p in floor.productList">
                                 <a class="image" :href="'/product-'+p.productId+'.html'">
-                                    <div class="page_main_type">医疗器械</div>
+                                    <div class="page_main_type" v-if="p.productType == 2">医疗器械</div>
                                     <img src="/img/base/placeholder.png" :data-original="p.image" :alt="p.name">
                                     <p class="name" v-html="addhtml + p.name" v-if="p.beautyActFlag==1"></p>
                                     <p class="name" v-html="p.name" v-else></p>

+ 1 - 1
src/main/resources/templates/user-center/collection/collection.html

@@ -58,7 +58,7 @@
             <span class="mask-checked" :class="[p.isChecked ?'checked':'']"></span>
           </div>
           <a class="image" :href="'/product-'+p.productId+'.html'" target="_blank">
-            <div class="page_main_type">医疗器械</div>
+            <div class="page_main_type" v-if="p.productType == 2">医疗器械</div>
             <img :src="p.image" :data-original="p.image" :alt="p.name">
             <p class="name" v-html="p.name" v-if="p.beautyActFlag==1"></p>
             <p class="name" v-html="p.name" v-else></p>