Bläddra i källkod

Merge remote-tracking branch 'origin/release-201827-wangcz' into release-201827-wangcz

wangcz 7 år sedan
förälder
incheckning
19e6bc2b19
3 ändrade filer med 78 tillägg och 37 borttagningar
  1. 51 21
      components/mobile/center/upoff-material.vue
  2. 22 11
      pages/mobile/center/vendor/material.vue
  3. 5 5
      store/shop.js

+ 51 - 21
components/mobile/center/upoff-material.vue

@@ -96,7 +96,7 @@
                       <input v-else oninput="if(value.length>5)value=value.slice(0,9)"
                              type="tel" placeholder="数量" class="otherNumber"
                              :class="{firstNumber: index === 0}"
-                             v-model.lazy.trim="chooseItem.goods.minBuyQty"
+                             v-model.lazy.trim="item.start"
                              :disabled="index === 0" :readonly="index === 0"
                              @blur="startpriceBlur(item, index)" maxlength="9"
                       />
@@ -115,14 +115,14 @@
                              class="priceM" type="text"
                              placeholder="单价(¥)"
                              v-model.lazy="item.rMBPrice"
-                             @blur="rMBPriceBlur(item)"/>
+                             @blur="rMBPriceBlur(item, 'rMBPrice')"/>
                       <input v-show="chooseItem.currencyName !== 'RMB'"
                              class="priceM" type="text"
                              placeholder="单价($)"
-                             v-model.lazy="item.rMBPrice"
-                             @blur="rMBPriceBlur(item)"/>
+                             v-model.lazy="item.uSDPrice"
+                             @blur="rMBPriceBlur(item, 'uSDPrice')"/>
                       <span @click="miuPrice(index)" class="clearfix"><img class="pull-left" src="/images/mobile/product/mui_icon.png"/></span>
-                      <span @click="addPrice()" class="clearfix"><img  class="pull-left"src="/images/mobile/product/add_icon.png"/></span>
+                      <span @click="addPrice()" class="clearfix"><img class="pull-left" src="/images/mobile/product/add_icon.png"/></span>
                     </div>
                   </div>
                 </li>
@@ -147,6 +147,10 @@
         chooseItem: {
           type: Object,
           default: {}
+        },
+        firstPrice: {
+          type: String,
+          default: ''
         }
       },
       computed: {
@@ -161,7 +165,7 @@
           ShowShopshelfOff: false,
           showDrop: false,
           storeObj: ['寄售', '自营'],
-          showUpoff: false
+          showUpoff: false,
         }
       },
       methods: {
@@ -203,7 +207,12 @@
                 this.collectResult = '分段数量必须填写'
                 isHas = true
                 break
-              }  else if (Math.abs(this.chooseItem.goods.prices[i].rMBPrice) <= 0) {
+              } else if (Math.abs(this.chooseItem.goods.prices[i].rMBPrice) <= 0 && this.storeInfoStore.enType !== 'HK') {
+                this.timeoutCount++
+                this.collectResult = '单价必须是大于0的数字'
+                isHas = true
+                break
+              } else if (Math.abs(this.chooseItem.goods.prices[i].uSDPrice) <= 0 && this.storeInfoStore.enType === 'HK') {
                 this.timeoutCount++
                 this.collectResult = '单价必须是大于0的数字'
                 isHas = true
@@ -213,7 +222,12 @@
                 this.collectResult = '分段数量必须是正整数'
                 isHas = true
                 break
-              } else if (!/^[0-9]+([.]{1}[0-9]{1,6})?$/.test(this.chooseItem.goods.prices[i].rMBPrice)) {
+              } else if (!/^[0-9]+([.]{1}[0-9]{1,6})?$/.test(this.chooseItem.goods.prices[i].rMBPrice) && this.storeInfoStore.enType !== 'HK') {
+                this.timeoutCount++
+                this.collectResult = '单价只能输入数字'
+                isHas = true
+                break
+              } else if (!/^[0-9]+([.]{1}[0-9]{1,6})?$/.test(this.chooseItem.goods.prices[i].uSDPrice) && this.storeInfoStore.enType === 'HK') {
                 this.timeoutCount++
                 this.collectResult = '单价只能输入数字'
                 isHas = true
@@ -236,6 +250,12 @@
             }
           }
           this.chooseItem.goods.prices[this.chooseItem.goods.prices.length - 1].end = '9999999999'
+          // if (this.storeInfoStore.enType === 'HK') {
+          //   for (let i = 0; i < this.chooseItem.goods.prices.length; i++) {
+          //     this.chooseItem.goods.prices[i].uSDPrice = this.chooseItem.goods.prices[i].rMBPrice
+          //     this.chooseItem.goods.prices[i].uSDNTPrice = ''
+          //   }
+          // }
           this.$http.put('/trade/goods', this.chooseItem.goods).then(res => {
             if (res.data.success) {
               this.timeoutCount++
@@ -262,7 +282,7 @@
             this.timeoutCount++
             this.collectResult = '起订量必须是大于0的整数'
             this.chooseItem.goods.minBuyQty = 1
-          } else if ((!this.chooseItem.breakUp && this.chooseItem.goods.minBuyQty) && this.chooseItem.goods.minBuyQty % this.chooseItem.minPackQty !== 0) {
+          } else if ((!this.chooseItem.goods.breakUp && this.chooseItem.goods.minBuyQty) && this.chooseItem.goods.minBuyQty % this.chooseItem.minPackQty !== 0) {
             this.timeoutCount++
             this.collectResult = '不可拆卖时,起订量必须是包装数量的倍数'
             if (!this.chooseItem.minPackQty) {
@@ -275,7 +295,11 @@
               }
             }
           }
-          this.chooseItem.goods.prices[0].start = this.chooseItem.goods.minBuyQty
+          if (Number(this.firstPrice) <= Number(this.chooseItem.goods.minBuyQty)) {
+            this.chooseItem.goods.prices[0].start = this.firstPrice
+          } else {
+            this.chooseItem.goods.prices[0].start = this.chooseItem.goods.minBuyQty
+          }
         },
         changeautoPublish() {
           this.chooseItem.goods.autoPublish = !this.chooseItem.goods.autoPublish
@@ -327,27 +351,27 @@
           }
         },
         // 单价失去焦点
-        rMBPriceBlur(item) {
-          if (item.rMBPrice === '' || !item.rMBPrice) { return false }
-          if (!/^[0-9]+([.]{1}[0-9]{1,6})?$/.test(item.rMBPrice)) {
+        rMBPriceBlur(item, key) {
+          if (item[key] === '' || !item[key]) { return false }
+          if (!/^[0-9]+([.]{1}[0-9]{1,6})?$/.test(item[key])) {
             this.timeoutCount++
             this.collectResult = '单价只能输入数字带6位小数'
-          } else if (Math.abs(item.rMBPrice) === 0) {
+          } else if (Math.abs(item[key]) === 0) {
             return false
-          } else if (Math.abs(item.rMBPrice) >= 10000) {
+          } else if (Math.abs(item[key]) >= 10000) {
             this.timeoutCount++
-            item.rMBPrice = 9999
+            item[key] = 9999
             this.collectResult = '单价不能高于10000'
             return false
           }
-          item.rMBPrice = item.rMBPrice.toString()
-          let splits = item.rMBPrice.split('.')
+          item[key] = item[key].toString()
+          let splits = item[key].split('.')
           if (splits[0].length >= 4) {
             splits[0] = splits[0].substr(0, 4)
-            item.rMBPrice = splits[0]
+            item[key] = splits[0]
           }
           if (splits[1]) {
-            item.rMBPrice = splits[0] + '.' + splits[1]
+            item[key] = splits[0] + '.' + splits[1]
           }
           if (splits[1] && splits[1].length > 6) {
             splits[1] = splits[1].substr(0, 7)
@@ -356,7 +380,7 @@
               str = splits[1].substr(0, 6)
               str = Math.abs(str) + 1
             }
-            item.rMBPrice = splits[0] + '.' + Math.ceil(str)
+            item[key] = splits[0] + '.' + Math.ceil(str)
           }
         },
         addPrice() {
@@ -373,6 +397,8 @@
             end: '',
             rMBNTPrice: '',
             rMBPrice: '',
+            uSDNTPrice: '',
+            uSDPrice: '',
             start: ''
           })
         },
@@ -380,21 +406,25 @@
           if (index === 0) {
             if (this.chooseItem.goods.prices.length === 3) {
               this.chooseItem.goods.prices[0].rMBPrice = this.chooseItem.goods.prices[1].rMBPrice
+              this.chooseItem.goods.prices[0].uSDPrice = this.chooseItem.goods.prices[1].uSDPrice
               this.chooseItem.goods.prices[0].end = this.chooseItem.goods.prices[1].end
               this.chooseItem.goods.prices[1].start = this.chooseItem.goods.prices[2].start
               this.chooseItem.goods.prices[1].rMBPrice = this.chooseItem.goods.prices[2].rMBPrice
+              this.chooseItem.goods.prices[1].uSDPrice = this.chooseItem.goods.prices[2].uSDPrice
               this.chooseItem.goods.prices[1].end = '9999999999'
               this.chooseItem.goods.prices.splice(2, 1)
             } else {
               index++
               if (this.chooseItem.goods.prices.length === 1) return
               this.chooseItem.goods.prices[0].rMBPrice = this.chooseItem.goods.prices[1].rMBPrice
+              this.chooseItem.goods.prices[0].uSDPrice = this.chooseItem.goods.prices[1].uSDPrice
               this.chooseItem.goods.prices[0].end = '9999999999'
               this.chooseItem.goods.prices.splice(index, 1)
             }
           } else if (index === 1) {
             if (this.chooseItem.prices.goods.length === 3) {
               this.chooseItem.goods.prices[1].rMBPrice = this.chooseItem.goods.prices[2].rMBPrice
+              this.chooseItem.goods.prices[1].uSDPrice = this.chooseItem.goods.prices[2].uSDPrice
               this.chooseItem.goods.prices[1].end = '9999999999'
               this.chooseItem.goods.prices.splice(2, 1)
             } else {

+ 22 - 11
pages/mobile/center/vendor/material.vue

@@ -106,7 +106,7 @@
                     <li v-for="price in item.goods.prices">
                       <div>{{price.start}}+</div>
                       <div v-if="item.currencyName == 'RMB'">¥{{price.rMBPrice}}</div>
-                      <div v-else>${{price.rMBPrice}}</div>
+                      <div v-else>${{price.uSDPrice}}</div>
                     </li>
                   </template>
                   <template v-else>
@@ -134,7 +134,7 @@
     <div class="update-materiel" v-show="showMateriel">
       <div class="mobile-nav">
         <div class="mobile-header mobile-center-header">
-          <a @click="showMateriel = false"><i class="iconfont icon-fanhui"></i></a>
+          <a @click="showMateriel = false; showdropmenu(' ')"><i class="iconfont icon-fanhui"></i></a>
           <p>编辑物料</p>
           <p class="en-name">
             <img :src="`/images/mobile/center/${user.data.enterprise && user.data.enterprise.uu ? 'en' : 'self'}.png`" alt="">{{currentEnName}}
@@ -205,7 +205,7 @@
               <div class="update-materiel-wrapper-list clearfix">
                 <div class="name pull-left"><a class="red" style="opacity: 0">*</a>最小包装数:</div>
                 <div class="input pull-left clearfix" style="width: 4.15rem;">
-                  <input type="number"  placeholder="请输入最小包装数" v-model="MaterielItem.minPackQty" maxlength="6"/>
+                  <input type="number" placeholder="请输入最小包装数" v-model="MaterielItem.minPackQty" maxlength="6" oninput="if(value.length>6)value=value.slice(0,6)"/>
                   <i class="iconfont icon-guanbi1" @click.stop="MaterielItem.minPackQty = ''"></i>
                 </div>
               </div>
@@ -240,7 +240,7 @@
                   <div class="name"><a class="red">*</a>更新规格书需重新审核</div>
                 </span>
                 <div style="clear:both"></div>
-                <div class="uploadImgBtn pull-left">上传规格书<input type="file" class="com-input" @change.stop="update" accept=".pdf" /></div>
+                <div class="uploadImgBtn pull-left" v-if="MaterielItem.Regulpic === ''">上传规格书<input type="file" class="com-input" @change.stop="update" accept=".pdf" /></div>
 
               </div>
 
@@ -272,7 +272,7 @@
 
     <!-- 物料上下架 -->
     <div>
-      <upoff-material ref="upoffMaterial" :chooseItem="MaterielItem" @upoffMaterial="upoffMaterial">
+      <upoff-material ref="upoffMaterial" :chooseItem="MaterielItem" @upoffMaterial="upoffMaterial" :firstPrice="firstPrice">
 
       </upoff-material>
     </div>
@@ -310,7 +310,8 @@
         similarBrand: [],
         similarCode: [],
         packObj: ['Bulk-散装', 'Reel-卷装', 'Tape/Reel-编带', 'Tray-盘装', 'Tube-管装', '盒装', '袋装', '罐装', '瓶装', '桶装', '箱装', '其他'],
-        showDrop: ''
+        showDrop: '',
+        firstPrice: ''
       }
     },
     created() {
@@ -413,11 +414,11 @@
       },
       // 编辑上架
       toAddpro(item, index) {
-        if (item.erpReserve === '' || item.erpReserve === 0 || !item.erpReserve) {
-          this.setRemindText(`当前物料库存为0,请先入库`)
-          return false
-        }
-        if (item.minPackQty === '' || item.minPackQty === 0 || !item.erpReserve) {
+        // if (item.erpReserve === '' || item.erpReserve === 0 || !item.erpReserve) {
+        //   this.setRemindText(`当前物料库存为0,请先入库`)
+        //   return false
+        // }
+        if (item.minPackQty === '' || item.minPackQty === 0 || !item.minPackQty) {
           this.setRemindText(`请先编辑物料,最小包装数选项`)
           return false
         }
@@ -441,6 +442,7 @@
             minBuyQty: 1
           })
         }
+        this.firstPrice =  this.MaterielItem.goods.prices[0].start.toString()
         let rf = document.body.offsetHeight // 触发浏览器重绘
         // console.log(item)
         this.$refs.upoffMaterial.show()
@@ -452,6 +454,10 @@
           this.setRemindText(`上传文件不得超过1M`)
           return false
         }
+        if (file.type.indexOf('gif') > -1) {
+          this.setRemindText(`不允许上传gif`)
+          return false
+        }
         let param = new FormData()
         param.append('file', file, file.name)
         param.append('chunk', '0')
@@ -471,6 +477,10 @@
           this.setRemindText(`上传文件不得超过20M`)
           return false
         }
+        if (file.type.indexOf('pdf') < 0) {
+          this.setRemindText(`规格书只允许上传pdf文件`)
+          return false
+        }
         let param = new FormData()
         param.append('file', file, file.name)
         param.append('chunk', '0')
@@ -507,6 +517,7 @@
             this.MaterielItem[_key2[i]] = this.$item[_key1[i]]
           }
           this.showMateriel = false
+          this.showDrop = ''
           return
         }
         if (this.MaterielItem.pbranden === '') {

+ 5 - 5
store/shop.js

@@ -44,17 +44,17 @@ export const actions = {
       .then(response => {
         commit('storeInfo/GET_COMMODITY_SUCCESS', response.data)
         let commodity = response.data || {}
-        if(commodity.uuid) {
-          commit('storeInfo/REQUEST_COMPONENT')
+        commit('storeInfo/REQUEST_COMPONENT')
+        if (commodity.uuid) {
           return axios.get(`/api/commodity/component/${commodity.uuid}`)
             .then(response => {
               commit('storeInfo/GET_COMPONENT_SUCCESS', response.data)
-              return Promise.all([
-                findStoreInfoFromUuid({ commit }, {uuid: commodity.storeid})
-              ])
+              return findStoreInfoFromUuid({ commit }, {uuid: commodity.storeid})
             }, err => {
               commit('storeInfo/GET_COMPONENT_FAILURE', err)
             })
+        } else {
+          return findStoreInfoFromUuid({ commit }, {uuid: commodity.storeid})
         }
       }, err => {
         commit('storeInfo/GET_COMMODITY_FAILURE', err)