Kaynağa Gözat

首页公告栏修改样式

zhengjinyi 2 yıl önce
ebeveyn
işleme
00199b84cf

+ 2 - 1
src/main/resources/static/css/index/index_new.pc.css

@@ -73,7 +73,8 @@ li{list-style:none;}
 .section_right  .item_text .item_text_name:before{content:'';width:4px;height:4px;border-radius:50%;background-color:#cccccc;position:absolute;left:0;top:11px}
 .section_right  .item_text .item_text_time{float:right}
 .section_right .item_text .item_text_name.info{width:164px;}
-.section_right  .item_text:hover{color:#E15616;text-decoration:underline}
+.section_right  .item_text:hover{color:#E15616;}
+.section_right  .item_text:hover .item_text_name{text-decoration:underline;}
 .section_right  .item_text:hover .item_text_name:before{background-color:#E15616}
 
 footer{width:100%;height:auto;float:left}

+ 59 - 47
src/main/resources/static/js/product/detail.js

@@ -221,10 +221,7 @@ var productDetail = new Vue({
                     if (product.stock == 0 && product.validFlag != 3) {
                         _self.disabledText = '售罄'
                     }
-                    if(product.productType === 2 && (GLOBAL_CLUB_TYPE != 1)){
-                        _self.isHideButton = true
-                        _self.handleShowProductType()
-                    }
+                    _self.handleShowProductType(product.commodityDetailsFlag);
                     _self.getRecommends();
                     _self.getProdcutArchiveDetails();  //获取资料列表
                     // 获取路由hash标识,设置默认展开tab
@@ -237,47 +234,63 @@ var productDetail = new Vue({
                 }
             })
         },
-        handleShowProductType: function (){
-            if(GLOBAL_USER_ID === 0){//游客
+        handleShowProductType: function (flag = ''){
+            // 根据商品详情可见度显示弹窗 flag 1.所有人可见 2.所有机构可见 3.仅会员机构可见 4.仅医美机构可见
+            let showModal = false;
+            const flagMap = {
+                '2': true,
+                '3': true,
+                '4': true
+            }
+            const textMap = {
+                '2': '该商品仅限已注册机构查看,请注册机构账户后继续查看。有采美账号的,请直接登录',
+                '3': '该商品仅限资质机构查看,请注册资质机构后继续查看。有采美账号的,请直接登录。',
+                '4': '该商品仅限医美类机构查看,请注册医美机构后继续查看。有采美账号的,请直接登录。',
+                '34': '该商品仅限资质机构查看,请升级为资质机构后继续查看。',
+                '44': '该商品仅限医美类机构查看,请升级为医美机构后继续查看。',
+                '42': '该商品仅限医美类机构查看,您暂无权限。您可去机构资料页面查看机构类型。'
+            }
+            const code = flag === 4 && GLOBAL_USER_IDENTITY === 2 && GLOBAL_CLUB_TYPE !== 1 ? '42' : `${flag}${GLOBAL_USER_IDENTITY}`
+            if (GLOBAL_USER_ID === 0) {
+                showModal = flagMap[flag];
+                this.showProsPopup(showModal,textMap[flag],'去注册/登录','/login.html')
+                return
+            }
+            if(GLOBAL_VIP_FLAG === 1){ return; }
+            if (flag === 3 && GLOBAL_USER_IDENTITY === 4) {
+                showModal = true
+                this.showProsPopup(showModal,textMap[code],'去升级','/user/setting/upgrade.html')
+                return
+            }
+            if (flag === 4 && GLOBAL_USER_IDENTITY === 4) {
+                showModal = true
+                this.showProsPopup(showModal,textMap[code],'去升级','/user/setting/upgrade.html')
+                return
+            }
+            if (flag === 4 && GLOBAL_USER_IDENTITY=== 2 && GLOBAL_CLUB_TYPE !== 1) {
+                showModal = true
+                this.showProsPopup(showModal,textMap[code],'去查看资料','/user/setting/information.html')
+                return
+            }
+        },
+        showProsPopup:function (showFlag,content,confitmBtnText,href) {// 商品详情限制弹窗
+            if(showFlag){
                 CAIMEI.Popup({
-                    content: '<div class="payAlert"><p>该商品仅限医美类机构查看,请注册医美机构后继续查看。有采美账号的,请直接登录。</p></div>',
-                    confitmBtnText: '去注册/登录',
+                    content: `<div class="payAlert"><p>${content}</p></div>`,
+                    confitmBtnText: confitmBtnText,
                     cancelBtnText: '关闭'
                 },function(){
                     // 确定
-                    window.location.href = '/login.html';
+                    window.location.href = href;
                 },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);
-                        });
+                    if(document.referrer === ''){
+                        window.location.href="/index.html";
+                        window.close();
+                    }else{
+                        window.history.go(-1);
                     }
-                }
+                });
             }
         },
         getProductPrice: function () {//获取商品价格
@@ -810,15 +823,14 @@ var productDetail = new Vue({
         // this.getImages();
         // identity: 0个人,1协销,2会员机构,3供应商,4普通机构
         // visibility:3:所有人可见,2:普通机构可见,1:会员机构可见 4:仅医美机构可见
-        var visible = $("#productVisibility").val() * 1;
-        console.log('visible',visible)
-        var identity = GLOBAL_USER_IDENTITY;
-        this.identity = identity
-        console.log('identity',identity)
-        this.showProduct = visible === 3 || visible == 4 || identity === 1 || identity === 2 || (identity === 4 && visible === 2);
-        if (!this.showProduct) {
-            window.location.href = "/404.html?error=未查询到该商品";
-        }
+        // var visible = $("#productVisibility").val() * 1;
+        // console.log('visible',visible)
+        // var identity = GLOBAL_USER_IDENTITY;
+        // console.log('identity',identity)
+        // this.showProduct = visible === 3 || visible == 4 || identity === 1 || identity === 2 || (identity === 4 && visible === 2);
+        // if (!this.showProduct) {
+        //     window.location.href = "/404.html?error=未查询到该商品";
+        // }
     },
     mounted: function () {
         this.userId = this.couponParam.userId = GLOBAL_USER_ID;

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

@@ -17,7 +17,7 @@
 <template th:replace="components/header"></template>
 
 <!-- 商品详情 -->
-<div id="productDetail" v-show="showProduct" v-cloak>
+<div id="productDetail" v-cloak>
     <input type="hidden" th:value="${productId}" id="productId">
     <input type="hidden" th:value="${typeId}" id="typeId">
     <input type="hidden" th:value="${product?.stock}" id="productStock">