소스 검색

手机求购调整

yangc 7 년 전
부모
커밋
5b66154a6f

+ 1 - 0
components/mobile/applyPurchase/SayPrice.vue

@@ -93,6 +93,7 @@
         } else {
           document.body.style.position = 'relative'
         }
+        this.resetSayPrice()
       }
     },
     mounted () {

+ 1 - 1
components/mobile/applyPurchase/SayPriceInfo.vue

@@ -56,7 +56,7 @@
               <ul>
                 <li v-for="replie in item.replies">
                   <span>{{replie.lapQty ? replie.lapQty + '+' : '-'}}</span>
-                  <span>{{replie.price ? (purchaseDetail.currency == 'USD' ? '$' : '¥') + replie.price : '-'}}</span>
+                  <span>{{replie.price ? (item.currency == 'USD' ? '$' : '¥') + replie.price : '-'}}</span>
                 </li>
               </ul>
             </div>

+ 11 - 4
components/mobile/applyPurchase/SeekList.vue

@@ -114,10 +114,17 @@
       },
       goSayPrice: function (id, index) {
         if (this.user.logged) {
-//          this.$router.push('/mobile/applyPurchase/sayPrice/' + path)
-          this.$store.dispatch('applyPurchase/loadPurchaseManDetail', {itemId: id, enuu: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null})
-          this.showSayPriceBox = true
-          this.activeIndex = index
+          if (this.user.data.enterprise.uu) {
+            if (this.user.data.enterprise.isVendor && this.user.data.enterprise.isVendor !== '1690') {
+              this.$store.dispatch('applyPurchase/loadPurchaseManDetail', {itemId: id, enuu: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null})
+              this.showSayPriceBox = true
+              this.activeIndex = index
+            } else {
+              this.onRemind('抱歉,您需开通卖家功能才可报价')
+            }
+          } else {
+            this.onRemind('个人账户暂不可报价')
+          }
         } else {
           this.showLoginBox = true
         }

+ 71 - 4
pages/mobile/user/index.vue

@@ -4,7 +4,17 @@
       <img src="/images/component/default.png"/>
       <div class="user-info">
         <p v-text="userInfo.data.userName"></p>
-        <p v-text="enterpriseInfo.enName"></p>
+        <p>{{enterpriseInfo.enName}}<a @click="setShowEnterpriseToggle(!showEnterpriseToggle, $event)">切换</a></p>
+        <ul class="en-list" v-show="showEnterpriseToggle">
+          <li class="menu-item"
+              v-for="en in sortEnterprises"
+              v-if="en.uu != enterpriseInfo.uu">
+            <a @click="switchEnterprise(en)">{{ en.enName }}</a>
+          </li>
+          <li class="menu-item"  v-if="enterpriseInfo.uu">
+            <a @click="switchEnterprise({uu: 0})"><span v-text="userInfo.data.userName"></span>(个人账户)</a>
+          </li>
+        </ul>
       </div>
       <a v-if="isVendor" v-text="userType === 'saler' ? '切换至买家中心' : '切换至卖家中心'" @click="switchType"></a>
     </div>
@@ -22,7 +32,7 @@
         </ul>
       </div>
       <ul class="switch-list vendor-switch" v-if="userType === 'saler'">
-        <li :class="{active: seekType == 'wait'}" @click="switchSeek('wait')"><div>待报价</div></li>
+        <li :class="{active: seekType == 'wait'}" @click="switchSeek('wait')"><div>全部</div></li>
         <li :class="{active: seekType == 'done'}" @click="switchSeek('done')"><div>已报价</div></li>
       </ul>
       <div class="search-content">
@@ -107,7 +117,8 @@
         seekPage: 1,
         seekSize: 10,
         purchaseManListData: [],
-        isDataChange: false
+        isDataChange: false,
+        showEnterpriseToggle: false
       }
     },
     components: {
@@ -126,9 +137,25 @@
     mounted: function () {
       this.$nextTick(() => {
         window.addEventListener('scroll', this.scroll, false)
+        document.body.addEventListener('click', () => {
+          this.setShowEnterpriseToggle(false)
+        }, false)
       })
     },
     methods: {
+      // 切换当前企业
+      switchEnterprise (en) {
+        this.showEnterpriseToggle = false
+        this.$http.get(`/user/authentication/${en.uu}`).then(() => {
+          this.$store.dispatch('loadUserInfo')
+        })
+      },
+      setShowEnterpriseToggle (flag, e) {
+        if (e) {
+          e.stopPropagation()
+        }
+        this.showEnterpriseToggle = flag
+      },
       cancelFocus: function (type, item, event) {
         event.stopPropagation()
         if (type === 'store') {
@@ -248,6 +275,15 @@
         }
         return {enName: this.userInfo.data.userName + '(个人账户)'}
       },
+      sortEnterprises () {
+        let ens = this.userInfo.data.enterprises
+        if (ens && ens.length) {
+          ens.sort(function (a, b) {
+            return b.lastLoginTime - a.lastLoginTime
+          })
+        }
+        return ens
+      },
       isVendor () {
         return this.enterpriseInfo.isVendor === 313
       },
@@ -335,6 +371,7 @@
         margin-left:.25rem;
         display: inline-block;
         vertical-align: middle;
+        position: relative;
         p{
           font-size:.3rem;
           margin:0;
@@ -342,11 +379,41 @@
           overflow: hidden;
           text-overflow: ellipsis;
           white-space: nowrap;
-          width: 3.92rem;
+          max-width: 3.92rem;
           &:nth-child(2) {
+            position: relative;
             margin-top: .2rem;
+            padding-right: .7rem;
+            a {
+              position: absolute;
+              right: 0;
+            }
           }
         }
+        .en-list {
+          position: absolute;
+          max-width: 8rem;
+          max-height: 3rem;
+          overflow-y: auto;
+          border-radius: .05rem;
+          .menu-item {
+            height: .6rem;
+            line-height: .6rem;
+            font-size: .3rem;
+            padding: 0 .2rem;
+            overflow: hidden;
+            white-space: nowrap;
+            text-overflow: ellipsis;
+            background: rgba(0, 0, 0, .4);
+            &:active, &:focus, &:hover {
+              background: #7d7d7d;
+            }
+            a {
+              color: #fff;
+            }
+          }
+
+        }
       }
       > a {
         font-size: .24rem;