|
@@ -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,64 @@ 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: '去注册/登录',
|
|
|
- cancelBtnText: '关闭'
|
|
|
+ content: `<div class="payAlert"><p>${content}</p></div>`,
|
|
|
+ confitmBtnText: confitmBtnText,
|
|
|
+ cancelBtnText: '关闭',
|
|
|
+ closeIcon:false
|
|
|
},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 +824,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;
|