瀏覽代碼

手机求购

yangc 7 年之前
父節點
當前提交
6b7ea58378

+ 9 - 3
components/mobile/MobileHeader.vue

@@ -89,11 +89,11 @@
     watch: {
       $route: function (val, oldVal) {
         this.showMainSearch = false
-        this.title = this.initHeader(val.path)
+        this.title = this.initHeader(val.path, val.query)
       }
     },
     created () {
-      this.title = this.initHeader(this.$route.path)
+      this.title = this.initHeader(this.$route.path, this.$route.query)
     },
     computed: {
       brandDetail () {
@@ -129,7 +129,7 @@
       goLastPage: function () {
         window.history.back(-1)
       },
-      initHeader: function (val) {
+      initHeader: function (val, query) {
 //        if (val !== '/' || !val || val === '') {
 //          this.showHeader = true
 //          this.showSearch = !val.startsWith('/mobile/search')
@@ -179,6 +179,12 @@
 //          this.rightIcon = 'share'
         } else if (this.startWith(val, '/mobile/applyPurchase/sayPrice')) {
           title = '编辑报价'
+        } else if (this.startWith(val, '/mobile/applyPurchase/list')) {
+          if (query.status === '1') {
+            title = '已采纳'
+          } else {
+            title = '已报价'
+          }
         } else if (val === '' || val === '/' || !val) {
           title = '优软商城'
 //          this.rightIcon = 'phone'

+ 22 - 13
components/mobile/applyPurchase/SayPrice.vue

@@ -24,7 +24,9 @@
       <div class="form-title">
         <span class="fl">价格梯度<span>(PCS)</span></span>
         <span class="fr">
-          <span v-text="sayPriceObj.currency" @click="showCurrencyList = !showCurrencyList"></span>
+          <span v-text="sayPriceObj.currency" @click="setShowCurrencyList($event)"></span>
+          <!--<span v-if="!purchaseDetail.currency" v-text="sayPriceObj.currency" @click="setShowCurrencyList($event)"></span>-->
+          <!--<span v-if="purchaseDetail.currency" v-text="purchaseDetail.currency"></span>-->
           <img v-if="!showCurrencyList" src="/images/mobile/@2x/applyPurchase/currency-arrow-down.png" alt="">
           <img v-if="showCurrencyList" src="/images/mobile/@2x/applyPurchase/currency-arrow-up.png" alt="">
           <ul v-if="showCurrencyList">
@@ -71,6 +73,11 @@
     components: {
       RemindBox
     },
+    mounted () {
+      this.$nextTick(() => {
+        document.addEventListener('click', this.checkCurrencySelect)
+      })
+    },
     filters: {
       date: function (date) {
         if (date) {
@@ -94,6 +101,13 @@
       }
     },
     methods: {
+      checkCurrencySelect: function () {
+        this.showCurrencyList = false
+      },
+      setShowCurrencyList: function (event) {
+        event.stopPropagation()
+        this.showCurrencyList = !this.showCurrencyList
+      },
       setCurrency: function (type) {
         this.sayPriceObj.currency = type
         this.showCurrencyList = false
@@ -112,15 +126,10 @@
       },
       setReplies: function (type, index) {
         if (type === 'add' && this.sayPriceObj.replies.length < 5) {
-          if (this.sayPriceObj.replies[index].lapQty && this.sayPriceObj.replies[index].price) {
-            this.sayPriceObj.replies.splice(this.sayPriceObj.replies.length, 0, {
-              lapQty: '',
-              price: ''
-            })
-          } else {
-//            this.$message.error('请填完整信息')
-            this.onRemind('请填完整信息')
-          }
+          this.sayPriceObj.replies.splice(this.sayPriceObj.replies.length, 0, {
+            lapQty: '',
+            price: ''
+          })
         } else if (type === 'sub' && this.sayPriceObj.replies.length > 1) {
           this.sayPriceObj.replies.splice(index, 1)
         }
@@ -154,18 +163,18 @@
 //            this.showLoading = false
           })
         } else {
-          this.onRemind('报价信息为空或梯度不合法')
+          this.onRemind('请输入正确的报价信息')
         }
       },
       checkValid: function () {
         for (let i = 0; i < this.sayPriceObj.replies.length; i++) {
-          if (!this.sayPriceObj.replies[i].lapQty || !this.sayPriceObj.replies[i].price) {
+          if (!this.sayPriceObj.replies[i].lapQty || this.sayPriceObj.replies[i].lapQty <= 0 || !this.sayPriceObj.replies[i].price || this.sayPriceObj.replies[i].price <= 0) {
             return false
           } else if (i > 0 && ((this.sayPriceObj.replies[i].lapQty <= this.sayPriceObj.replies[i - 1].lapQty) || (this.sayPriceObj.replies[i].price <= this.sayPriceObj.replies[i - 1].price))) {
             return false
           }
         }
-        return this.sayPriceObj.leadtime
+        return this.sayPriceObj.leadtime && this.sayPriceObj.leadtime > 0
       },
       onRemind: function (str) {
         this.remindText = str

+ 7 - 4
components/mobile/applyPurchase/SayPriceInfo.vue

@@ -31,15 +31,18 @@
       </div>
       <div class="base-info say-info" v-for="(item, index) in purchaseDetail.qutations" @click="selectQutation(index)">
         <img v-if="(!item.agreed || item.agreed !== 1) && activeIndex == index" src="/images/mobile/@2x/applyPurchase/say-price-check.png" alt="">
+        <img v-if="(!item.agreed || item.agreed !== 1) && activeIndex != index" src="/images/mobile/@2x/applyPurchase/say-price-default.png" alt="">
         <img v-if="item.agreed == 1" src="/images/mobile/@2x/applyPurchase/say-price-accept.png" alt="">
         <div class="content-line">
           {{item.vendName}}
         </div>
         <div class="content-line">
-          报价人:<span>{{item.user.userName | userNameFilter}}</span>
+          报价人:<span v-if="item.user">{{item.user.userName | userNameFilter}}</span>
+          <span v-else>-</span>
         </div>
         <div class="content-line">
-          电话:<span>{{item.user.userTel}}</span>
+          电话:<span v-if="item.user">{{item.user.userTel}}</span>
+          <span v-else>-</span>
         </div>
         <div class="content-line date">
           交期(天):<span>{{item.leadtime}}</span>
@@ -154,7 +157,7 @@
     },
     methods: {
       selectQutation: function (index) {
-        this.activeIndex = index
+        this.activeIndex = this.activeIndex === index ? -1 : index
       },
       acceptQutation: function () {
         if (this.activeIndex > -1) {
@@ -264,7 +267,7 @@
       }
     }
     .say-price-btn {
-      margin: .87rem auto 0;
+      margin: .37rem auto .7rem;
     }
   }
 </style>

+ 59 - 34
components/mobile/applyPurchase/SeekList.vue

@@ -1,44 +1,56 @@
 <template>
-  <ul class="seek-list">
-    <li v-for="(item, index) in purchaseManList">
-      <p>
-      <span v-if="item.inquiry.enterprise && item.inquiry.enterprise.enName">{{item.inquiry.enterprise.enName | enterpriseFilter}}</span>
-      <span v-else>{{item.userName | userNameFilter}}</span>
-      </p>
-      <div>
-        <div class="fl">
-          <div>
-            品牌:<span>{{item.cmpCode || '-'}}</span>
+  <div>
+    <ul class="seek-list">
+      <li v-for="(item, index) in purchaseManList">
+        <p>
+          <span v-if="item.inquiry.enterprise && item.inquiry.enterprise.enName">{{item.inquiry.enterprise.enName | enterpriseFilter}}</span>
+          <span v-else>{{item.userName | userNameFilter}}</span>
+        </p>
+        <div>
+          <div class="fl">
+            <div>
+              品牌:<span>{{item.cmpCode || '-'}}</span>
+            </div>
+            <div>
+              型号:<span>{{item.inbrand || '-'}}</span>
+            </div>
+            <div>
+              规格:<span>{{item.spec || '-'}}</span>
+            </div>
+            <div>
+              截止日期:<span class="date">{{item.endDate | date}}</span>
+            </div>
           </div>
-          <div>
-            型号:<span>{{item.inbrand || '-'}}</span>
-          </div>
-          <div>
-            规格:<span>{{item.spec || '-'}}</span>
-          </div>
-          <div>
-            截止日期:<span class="date">{{item.endDate | date}}</span>
+          <div class="fr">
+            <p v-if="item.remainingTime > 0">剩余&nbsp;:
+              <span v-if="getDay(item.remainingTime) > 0" v-text="getDay(item.remainingTime)"></span>
+              <i v-if="getDay(item.remainingTime) > 0">&nbsp;天&nbsp;</i>
+              <span v-if="getDay(item.remainingTime) <= 0" v-text="getHours(item.remainingTime)"></span>
+              <i v-if="getDay(item.remainingTime) <= 0" >&nbsp;小时</i>
+            </p>
+            <p v-else>已截止</p>
+            <!--<a v-if="!userType && item.quoted == 1">已报价</a>-->
+            <!--<a v-if="!userType && item.remainingTime > 0 && (!item.quoted || item.quoted != 1) && (user.logged && ((item.inquiry.enterprise && user.data.enterprise && (item.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && item.userUU == user.data.userUU  && !item.inquiry.enterprise)))">自己发布的</a>-->
+            <a v-if="!(userType == 'saler' && seekType  && seekType != 'wait') && (item.remainingTime > 0 && (!item.quoted || item.quoted != 1) && !(user.logged && ((item.inquiry.enterprise && user.data.enterprise && (item.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && item.userUU == user.data.userUU  && !item.inquiry.enterprise))))"  @click="goSayPrice(item.inquiry.id)">我要报价</a>
+            <nuxt-link v-if="((!userType || userType == 'buyer') && (seekType  && seekType != 'wait')) || (userType == 'saler' && seekType  && seekType != 'wait') || item.quoted == 1" :to="'/mobile/applyPurchase/list/' + (userType ? item.inquiry.id + '?type=' + userType : item.id) + (userType ? '&' : '?') + 'status=' + item.agreed">查看报价</nuxt-link>
           </div>
         </div>
-        <div class="fr">
-          <p v-if="item.remainingTime > 0">剩余&nbsp;:
-            <span v-if="getDay(item.remainingTime) > 0" v-text="getDay(item.remainingTime)"></span>
-            <i v-if="getDay(item.remainingTime) > 0">&nbsp;天&nbsp;</i>
-            <span v-if="getDay(item.remainingTime) <= 0" v-text="getHours(item.remainingTime)"></span>
-            <i v-if="getDay(item.remainingTime) <= 0" >&nbsp;小时</i>
-          </p>
-          <p v-else>已截止</p>
-          <!--<a v-if="!userType && item.quoted == 1">已报价</a>-->
-          <!--<a v-if="!userType && item.remainingTime > 0 && (!item.quoted || item.quoted != 1) && (user.logged && ((item.inquiry.enterprise && user.data.enterprise && (item.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && item.userUU == user.data.userUU  && !item.inquiry.enterprise)))">自己发布的</a>-->
-          <nuxt-link v-if="!(userType == 'saler' && seekType  && seekType != 'wait') && (item.remainingTime > 0 && (!item.quoted || item.quoted != 1) && !(user.logged && ((item.inquiry.enterprise && user.data.enterprise && (item.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && item.userUU == user.data.userUU  && !item.inquiry.enterprise))))"  :to="'/mobile/applyPurchase/sayPrice/' + item.inquiry.id" >我要报价</nuxt-link>
-          <nuxt-link v-if="((!userType || userType == 'buyer') && (seekType  && seekType != 'wait')) || (userType == 'saler' && seekType  && seekType != 'wait') || item.quoted == 1" :to="'/mobile/applyPurchase/list/' + (userType ? item.inquiry.id +'?type=' + userType : item.id)">查看报价</nuxt-link>
-          </div>
-      </div>
-    </li>
-  </ul>
+      </li>
+    </ul>
+    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
+  </div>
 </template>
 <script>
+  import {LoginBox} from '~components/mobile/common'
   export default {
+    components: {
+      LoginBox
+    },
+    data () {
+      return {
+        showLoginBox: false
+      }
+    },
     props: ['userType', 'seekType', 'purchaseManList'],
     filters: {
       date: function (date) {
@@ -70,6 +82,13 @@
       },
       getHours: function (timeStamp) {
         return Math.floor((timeStamp / (1000 * 60 * 60)) % 24)
+      },
+      goSayPrice: function (path) {
+        if (this.user.logged) {
+          this.$router.push('/mobile/applyPurchase/sayPrice/' + path)
+        } else {
+          this.showLoginBox = true
+        }
       }
     }
   }
@@ -120,7 +139,13 @@
 
             span {
               color: #333;
+
+              &.date {
+                color: #e6353d;
+              }
+
             }
+
           }
 
         }

+ 1 - 1
pages/mobile/applyPurchase/list/index.vue

@@ -3,7 +3,7 @@
     <div class="mobile-header">
       <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
       <div class="search-content">
-        <input type="text" v-model="seekKeyword" placeholder="请输入您要查找的型号或品牌">
+        <input type="text" v-model="seekKeyword" placeholder="请输入您要查找的型号或品牌" @keyup.13="searchSeek">
         <span @click="searchSeek">
         <i class="iconfont icon-sousuo"></i>
         </span>

+ 1 - 1
pages/mobile/user/index.vue

@@ -20,7 +20,7 @@
         <!--<li :class="{active: seekType == 'accept'}" @click="switchSeek('accept')"><div>已采纳</div></li>-->
       </ul>
       <div class="search-content">
-        <input type="text" placeholder="请输入您要查找的型号或品牌" v-model="seekKeyword">
+        <input type="text" placeholder="请输入您要查找的型号或品牌" v-model="seekKeyword" @keyup.13="searchSeek">
         <span @click="searchSeek">
         <i class="iconfont icon-sousuo"></i>
         </span>

二進制
static/images/mobile/@2x/applyPurchase/say-price-default.png