chao 4 tahun lalu
induk
melakukan
d14c05ed51

+ 3 - 1
src/main/resources/static/js/base.js

@@ -9,7 +9,7 @@ if(localStorage.getItem('userInfo')){
     globalUserData = JSON.parse(localStorage.getItem('userInfo'));
     GLOBAL_TOKEN = globalUserData.token;
     GLOBAL_USER_ID = globalUserData.userId;
-    GLOBAL_USER_IDENTITY = globalUserData.identity ? globalUserData.identity : globalUserData.userIdentity;
+    GLOBAL_USER_IDENTITY = globalUserData.userIdentity;
     GLOBAL_SHOP_ID = globalUserData.shopId;
 } else {
     if(!getCookie("weChatAutoLogin")){
@@ -78,6 +78,8 @@ var globalHead = new Vue({
                 if (r.code === 0 && r.data) {
                     _self.headCart.cartList = r.data;
                     _self.headCart.cartCount = r.data.length;
+                    _self.headCart.productCount = 0;
+                    _self.headCart.priceTotal = 0;
                     r.data.map(function(item){
                         _self.headCart.productCount += item.number;
                         _self.headCart.priceTotal += item.number*item.price;

+ 1 - 3
src/main/resources/static/js/product/detail.js

@@ -3,7 +3,6 @@ var productDetail = new Vue({
     data: {
         productId: 0,
         userId: 0,
-        userIdentity: '', //2-会员机构;3-供应商;4-普通机构
         number: 0,
         productStock: 0,
         images: [],
@@ -18,7 +17,7 @@ var productDetail = new Vue({
             promotions: '',
             step: 1,
             supplierId: 0,
-            userIdentity: 0
+            userIdentity: 0 //2-会员机构;3-供应商;4-普通机构
         },
         ladderList:[],//阶梯价
         promotions:{},//促销活动信息
@@ -220,7 +219,6 @@ var productDetail = new Vue({
     },
     mounted: function () {
         this.userId = GLOBAL_USER_ID;
-        this.userIdentity = GLOBAL_USER_IDENTITY;
         this.getProductPrice();
         this.getParameters();
         this.getRecommends();

+ 9 - 4
src/main/resources/templates/product/detail.html

@@ -71,7 +71,7 @@
                         </div>
                     </template>
                     <div class="row" v-if="priceObj.actStatus==1||priceObj.ladderPriceFlag==1" ><span class="l">促销</span><i>:</i>
-                        <template v-if="GLOBAL_USER_ID && GLOBAL_USER_ID>0">
+                        <template v-if="GLOBAL_USER_ID && GLOBAL_USER_ID>0 && (priceObj.priceFlag==0 || (priceObj.priceFlag==2 && priceObj.userIdentity==2) || (priceObj.userIdentity==3 && priceObj.supplierId==GLOBAL_SHOP_ID))">
                             <!-- 阶梯价 -->
                             <div v-if="priceObj.ladderPriceFlag==1" class="priceTag">
                                 <i class="tag icon mIcon" @click="toggleThisLadder($event)">阶梯价格</i>
@@ -120,11 +120,16 @@
                                 <i v-if="priceObj.ladderPriceFlag==1" class="tag icon mIcon" @click="toggleThisLadder($event)">阶梯价格</i>
                                 <i v-if="priceObj.actStatus==1" class="tag icon mIcon" @click="toggleThisLadder($event)" v-text="promotions?promotions.name:''"></i>
                                 <div class="promotion mFixed">
-                                    <div>
+                                    <div v-if="!GLOBAL_USER_ID">
                                         <p v-if="priceObj.ladderPriceFlag==1"><em @click="toLogin">登录</em>,享受阶梯价格优惠</p>
                                         <p v-if="priceObj.actStatus==1"><em @click="toLogin">登录</em>,参与促销活动</p>
                                         <p class="c"><a class="close" @click="hideThisLadder($event)" href="JavaScript:void(0);">了解</a></p>
                                     </div>
+                                    <div v-else>
+                                        <p v-if="priceObj.ladderPriceFlag==1"><em @click="toLogin">升级会员</em>,享受阶梯价格优惠</p>
+                                        <p v-if="priceObj.actStatus==1"><em @click="toLogin">升级会员</em>,参与促销活动</p>
+                                        <p class="c"><a class="close" @click="hideThisLadder($event)" href="JavaScript:void(0);">了解</a></p>
+                                    </div>
                                 </div>
                             </div>
                         </template>
@@ -150,10 +155,10 @@
                     </div>
                 </div>
                <template v-if="GLOBAL_USER_ID && GLOBAL_USER_ID>0">
-                   <div  class="btnBox" v-if="priceObj.priceFlag==2 && userIdentity!=2">
+                   <div  class="btnBox" v-if="priceObj.priceFlag==2 && priceObj.userIdentity!=2">
                       <a class="upgrade" href="/user/setting/upgrade.html">升级会员查看价格</a>
                    </div>
-                    <div class="btnBox" v-else-if="priceObj.priceFlag==0 || (priceObj.priceFlag==2 && userIdentity==2)">
+                    <div class="btnBox" v-else-if="priceObj.priceFlag==0 || (priceObj.priceFlag==2 && priceObj.userIdentity==2)">
                         <a href="javascript:void(0);" class="cart icon" @click='addShopCart()'>加入购物车</a>
                         <a href="javascript:void(0);" class="buy" @click="buyNowSubmit()">立即购买</a>
                     </div>