Pārlūkot izejas kodu

批量发布需求

yangc 7 gadi atpakaļ
vecāks
revīzija
065a77e885

+ 577 - 179
components/applyPurchase/BatchPublish.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="batch-publish">
-    <p>共上传<b class="red-text">{{bomNumber.successImport || 0}}</b>个产品<br/>其中<span class="red-text">{{bomNumber.nullField || 0}}</span>个产品的必填项缺失,请在当前页完善信息</p>
+    <p><img src="/images/applyPurchase/batch-icon.png" alt="">共上传<b class="blue-text">{{bomNumber.successImport || 0}}</b>个产品其中<span class="red-text">{{bomNumber.nullField || 0}}</span>个产品的必填项缺失,请在当前页完善信息</p>
     <table v-if="bomList.content.length">
       <thead>
         <tr>
@@ -10,14 +10,14 @@
               <!--<label for="all"></label>-->
             <!--</label>全选-->
           <!--</th>-->
-          <th width="190"><i class="red-text">*</i>型号</th>
-          <th width="162"><i class="red-text">*</i>品牌</th>
-          <th width="100">采购数量</th>
-          <th width="128">单价预算</th>
+          <th width="140"><i class="red-text">*</i>型号</th>
+          <th width="132"><i class="red-text">*</i>品牌</th>
+          <th width="80">采购数量</th>
+          <th width="108">单价预算</th>
           <th width="76">封装</th>
           <th width="102">生产日期</th>
-          <th width="144"><i class="red-text">*</i>截止时间</th>
-          <th width="92">操作</th>
+          <th width="124"><i class="red-text">*</i>截止时间</th>
+          <th width="192">操作</th>
         </tr>
       </thead>
       <tbody v-for="(item, index) in bomList.content">
@@ -69,8 +69,54 @@
           <div class="red-text" v-if="!isValidTime(item.deadline)">默认≤90天</div>
         </td>
         <td class="operate">
-          <a class="delete-btn" @click="modifyItem(index)">编辑</a>
-          <a class="modify-btn" @click="deleteItem(index)">删除</a>
+          <a @click="modifyItem(index)">编辑</a>
+          <a @click="deleteItem(index)">删除</a>
+          <a @click="setShowSpotGoods(true, item)" v-if="item.spotGoods && item.spotGoods.length && !item.showSpotGoods">商城现货&nbsp;<i class="fa fa-angle-double-down"></i></a>
+          <a @click="setShowSpotGoods(false)" v-if="item.spotGoods && item.spotGoods.length && item.showSpotGoods">收起&nbsp;<i class="fa fa-angle-double-up"></i></a>
+        </td>
+      </tr>
+      <tr class="spot-goods" v-if="item.showSpotGoods">
+        <td colspan="8">
+          <div class="spot-goods-body">
+            <div class="spot-goods-title">商城现货(998)</div>
+            <table>
+              <thead>
+              <tr>
+                <th width="214">卖家</th>
+                <th width="83">交期(天)</th>
+                <th width="104">单价</th>
+                <th width="137">生产日期</th>
+                <th width="111">库存</th>
+                <th width="142">购买数量</th>
+                <th width="186">操作</th>
+              </tr>
+              </thead>
+            </table>
+            <div class="spot-goods-list">
+              <table>
+                <tbody>
+                <tr v-for="(spotGoods, index) in spotGoodsData">
+                  <td width="214" v-text="spotGoods.enterpriseName"></td>
+                  <td width="83" class="red-text" v-text="spotGoods.minDelivery + '-' + spotGoods.maxDelivery">4-6</td>
+                  <td width="104" class="red-text">$123</td>
+                  <td width="137" v-text="spotGoods.produceDate"></td>
+                  <td width="111" v-text="spotGoods.reserve">21412</td>
+                  <td width="142" class="input-number">
+                    <div>
+                      <span @click="subNum(index)" :class="{'not-allowed': !fragments[index].canSub}">-</span>
+                      <input type="number" v-model="fragments[index].num" @blur="inputNum(index)">
+                      <span @click="addNum(index)" :class="{'not-allowed': !fragments[index].canAdd}">+</span>
+                    </div>
+                  </td>
+                  <td width="186" class="operate">
+                    <a href="javascript:void(0)" @click="linkSaler(spotGoods)">联系卖家<img src="/images/applyPurchase/link-buyer.png" alt=""></a>
+                    <span @click="buyNow(spotGoods, index)">立即购买</span>
+                  </td>
+                </tr>
+                </tbody>
+              </table>
+            </div>
+          </div>
         </td>
       </tr>
       <tr class="modify-row" v-if="item.active">
@@ -121,8 +167,8 @@
           <!--<input type="text" class="form-control" v-model="modifyObj.deadline">-->
         </td>
         <td class="operate">
-          <a class="submit-btn" @click="submitModify(index)">确认</a>
-          <a class="cancel-btn" @click="cancelModify(index)">取消</a>
+          <a class="btn-ok" @click="submitModify(index)">确认</a>
+          <a class="btn-cancel" @click="cancelModify(index)">取消</a>
         </td>
       </tr>
       </tbody>
@@ -131,26 +177,8 @@
           :current="nowPage" @childEvent="listenPage"></page>
     <div class="submit-area" v-if="bomList.content.length">
     <!--  <a class="modify-btn" @click="deleteItem()">删除</a>-->
-      <a class="modify-btn delete-btn" @click="submitBOM">确认发布</a>
+      <a class="modify-btn" @click="submitBOM">确认发布</a>
     </div>
-    <!--提示框-->
-    <!--<div class="modal-wrap" v-if="showRemindBox">
-      <div class="apply-del-box">
-        <div class="title">
-          &lt;!&ndash;<a @click="showRemindBox = false"><i class="fa fa-close fa-lg"></i></a>&ndash;&gt;
-        </div>
-        <div class="content">
-          &lt;!&ndash;<p style="line-height: 20px;margin-top: 10px;padding:0 10px">非常抱歉,目前暂无此品牌!<br>若直接前往“品牌申请”,我们将为您先开通寄售功能,待申请通过后再提交开店申请。</p>&ndash;&gt;
-          &lt;!&ndash;<p style="line-height: 20px;">前往<a @click="goBrandApply()"  target="_blank" style="color: #5078CB">品牌申请&nbsp;<i class="fa fa-arrow-right"></i></a></p>&ndash;&gt;
-          <p><img src="/images/applyPurchase/check.png" alt="">成功发布{{successResult.successAmount || 0}}个</p>
-          <p v-if="successResult.goodsAmount && successResult.goodsAmount > 0 ">其中<span>{{successResult.goodsAmount || 0}}</span>个求购型号有现货在售,您可前往“<span>买家中心-我的求购</span>”查询并直接购买</p>
-          <div>
-            &lt;!&ndash;<a @click="showRemindBox = false">继续发布</a>&ndash;&gt;
-            <a href="/user#/seekPurchase" target="_blank">前往我的求购</a>
-          </div>
-        </div>
-      </div>
-    </div>-->
   </div>
 </template>
 <script>
@@ -237,7 +265,9 @@
         },
 //        successResult: 0,
         showSimilarCodeList: false,
-        showSimilarBrandList: false
+        showSimilarBrandList: false,
+        spotGoodsData: [],
+        fragments: []
       }
     },
     components: {
@@ -252,6 +282,7 @@
           _this.$set(list.content[i], 'active', false)
           _this.$set(list.content[i], 'showCodeWord', false)
           _this.$set(list.content[i], 'showBrandWord', false)
+          _this.$set(list.content[i], 'showSpotGoods', false)
 //          list.content[i].checked = false
 //          list.content[i].active = false
 //          if (!list.content[i].code || list.content[i].brand || !list.content[i].deadline || !this.isValidDate(list.content[i].deadline)) {
@@ -262,6 +293,12 @@
       },
       bomNumber () {
         return this.$store.state.applyPurchase.bomMaterial.bomNumber.data
+      },
+      tab () {
+        return this.$store.state.chat.tab.tab.data
+      },
+      user () {
+        return this.$store.state.option.user
       }
     },
     mounted () {
@@ -287,6 +324,9 @@
         } else {
           return null
         }
+      },
+      currencyStr: function (str) {
+        return typeof str === 'string' && str !== 'RMB' && str !== 'USD' ? str.startsWith('RMB') ? '¥' + str.substring(3, str.length) : '$' + str.substring(3, str.length) : '-'
       }
     },
     methods: {
@@ -377,14 +417,21 @@
           this.bomList.content[i].checked = flag
         }
       },
-      modifyItem: function (index) {
+      cancelModifyItem: function () {
         for (let i = 0; i < this.bomList.content.length; i++) {
           if (this.bomList.content[i].active) {
             this.$message.error('抱歉,您尚有未保存的信息')
-            return
+            return false
           }
           this.bomList.content[i].active = false
         }
+        return true
+      },
+      modifyItem: function (index) {
+        if (!this.cancelModifyItem()) {
+          return
+        }
+        this.cancelShowSpotGoods()
 //        this.$set(this.bomList.content[index], 'active', true)
         this.bomList.content[index].active = true
         let _this = this
@@ -670,6 +717,342 @@
             this.$message.error('系统错误')
             this.reloadData()
           })
+      },
+      cancelShowSpotGoods: function () {
+        for (let i = 0; i < this.bomList.content.length; i++) {
+          this.bomList.content[i].showSpotGoods = false
+        }
+      },
+      setShowSpotGoods: function (flag, item) {
+        if (flag && item && item.spotGoods.length) {
+          this.spotGoodsData = item.spotGoods
+          this.initFragments()
+        }
+        if (!this.cancelModifyItem()) {
+          return
+        }
+        this.cancelShowSpotGoods()
+        item.showSpotGoods = flag
+      },
+      initFragment: function (commodity) {
+        if (!commodity) {
+          return {}
+        }
+        let fragment = {}
+        let prices = commodity.prices[0]
+        fragment.num = commodity.minBuyQty
+        fragment.prices = prices
+
+        if (commodity.currencyName !== 'USD') {
+          fragment.currency = 'RMB'
+        } else {
+          fragment.currency = 'USD'
+        }
+
+        if (fragment.currency !== 'USD') {
+          fragment.price = prices.rMBPrice
+        } else {
+          fragment.price = prices.uSDPrice
+        }
+        fragment.canAdd = true
+        fragment.canSub = false
+        return fragment
+      },
+      initFragments: function () {
+        for (let i = 0; i < this.spotGoodsData.length; i++) {
+          this.fragments.push(this.initFragment(this.spotGoodsData[i]))
+        }
+      },
+      getFragment: function (commodity, fragment) {
+        // 判断是否小于第一分段的起订量
+        if (commodity.prices[0].start > fragment.num) {
+          fragment.num = commodity.prices[0].start
+        }
+        // 获取分段的信息
+        let prices = commodity.prices
+        for (let i = 0; i < prices.length; i++) {
+          if (fragment.num <= prices[i].end) {
+            fragment.prices = prices[i]
+            break
+          }
+        }
+      },
+      onInput: function (index) {
+        let prices = this.spotGoodsData[index].prices
+        if (prices && prices.length) {
+          for (let i = 0; i < prices.length; i++) {
+            if (this.fragments[index].num >= prices[i].start && this.fragments[index].num <= prices[i].end) {
+              this.fragments[index].price = this.fragments[index].currency === 'RMB' ? prices[i].rMBPrice : prices[i].uSDPrice
+              break
+            }
+          }
+        }
+      },
+      changeNum: function (newNum, index) {
+        let pack = this.spotGoodsData[index].perQty || this.spotGoodsData[index].minPackQty
+        let buy = this.spotGoodsData[index].minBuyQty
+        let reserve = this.spotGoodsData[index].reserve
+        let breakUp = this.spotGoodsData[index].breakUp
+        let nowFragment = this.fragments[index]
+        if (!newNum) {
+          nowFragment.num = buy
+        } else {
+          newNum = parseInt(newNum)
+          if (breakUp) {
+            if (newNum < buy) {
+              this.$message.error('最小起订量为' + buy)
+              nowFragment.num = buy
+              nowFragment.canSub = false
+              nowFragment.canAdd = true
+            } else if (newNum > reserve) {
+              this.$message.error('库存不足')
+              nowFragment.num = reserve
+              nowFragment.canAdd = false
+              nowFragment.canSub = true
+            } else {
+              nowFragment.canSub = true
+              nowFragment.canAdd = true
+              nowFragment.num = newNum
+              newNum === buy && (nowFragment.canSub = false)
+              newNum === reserve && (nowFragment.canAdd = false)
+            }
+          } else {
+            if (newNum < buy) {
+              this.$message.error('最小起订量为' + buy)
+              nowFragment.num = buy
+              nowFragment.canSub = false
+              if (newNum > reserve) {
+                this.$message.error('库存不足')
+                nowFragment.num = reserve - (reserve % pack)
+                nowFragment.canAdd = false
+              }
+            } else if (newNum > reserve) {
+              nowFragment.canSub = true
+              nowFragment.canAdd = false
+              this.$message.error('库存不足')
+              nowFragment.num = reserve - (reserve % pack)
+            } else {
+              nowFragment.canSub = true
+              nowFragment.canAdd = true
+              let remainder = newNum % pack
+              if (remainder !== 0) {
+                this.$message.error('不支持拆包且包装量为' + pack)
+                let res = (Math.floor(newNum / pack) + 1) * pack
+                nowFragment.num = res > reserve ? Math.floor(newNum / pack) * pack : res
+              } else {
+                nowFragment.num = newNum
+              }
+              newNum === buy && (nowFragment.canSub = false)
+              newNum === reserve && (nowFragment.canAdd = false)
+            }
+          }
+        }
+      },
+      subNum: function (index) {
+        let nowFragment = this.fragments[index]
+        if (nowFragment.canSub) {
+          let pack = this.spotGoodsData[index].perQty || this.spotGoodsData[index].minPackQty
+          let newNum = 0
+          if (this.spotGoodsData[index].breakUp) {
+            newNum = nowFragment.num - 1
+          } else {
+            newNum = nowFragment.num - pack
+          }
+          this.changeNum(newNum, index)
+          this.getFragment(this.spotGoodsData[index], nowFragment)
+          this.onInput(index)
+        } else {
+          this.$message.error('该商品最少购买' + this.spotGoodsData[index].minBuyQty + '件')
+        }
+      },
+      addNum: function (index) {
+        let nowFragment = this.fragments[index]
+        if (nowFragment.canAdd) {
+          let pack = this.spotGoodsData[index].perQty || this.spotGoodsData[index].minPackQty
+          let newNum = 0
+          if (this.spotGoodsData[index].breakUp) {
+            newNum = nowFragment.num + 1
+          } else {
+            newNum = nowFragment.num + pack
+          }
+          this.changeNum(newNum, index)
+          this.getFragment(this.spotGoodsData[index], nowFragment)
+          this.onInput(index)
+        } else {
+          this.$message.error('库存不足')
+        }
+      },
+      inputNum: function (index) {
+        if ((/^[\d]*$/).test(this.fragments[index].num)) {
+          this.changeNum(this.fragments[index].num, index)
+          this.getFragment(this.spotGoodsData[index], this.fragments[index])
+        } else {
+          this.message.error('请输入整数')
+          this.fragments[index].num = this.spotGoodsData[index].minBuyQty
+        }
+        this.onInput(index)
+      },
+      buyNow: function (goods, index) {
+        this.$http.post('trade/order/buyNow', [{
+          uuid: goods.uuid,
+          batchCode: goods.batchCode,
+          number: this.fragments[index].num,
+          storeid: goods.storeid ? goods.storeid : goods.storeId,
+          storeUuid: goods.storeid ? goods.storeid : goods.storeId,
+          currencyName: goods.currencyName,
+          minPackQty: goods.minPackQty
+        }])
+          .then(response => {
+            if (response.data.success) {
+              if (response.data.message) {
+                this.$message({
+                  message: response.data.message,
+                  type: 'success'
+                })
+                let _self = this
+                window.setTimeout(function () {
+                  window.location.href = '/user#/order/pay/' + _self.enidfilter(response.data.data.orderid)
+                }, 1000)
+              } else {
+                window.location.href = '/user#/order/pay/' + this.enidfilter(response.data.data.orderid)
+              }
+            } else {
+              if (response.data.data && response.data.data.unvailable === 1) {
+                this.$message.error('产品信息已失效,请刷新页面')
+              } else {
+                this.$message.error(response.data.message)
+              }
+            }
+          }, err => {
+            console.log(err)
+            if (goods.minBuyQty > goods.reserve) {
+              this.$message.error('商品' + goods.code + '的库存已经不满足起订量')
+            }
+          })
+      },
+      enidfilter: function (str) {
+        if (str) {
+          let encryptStr = '' // 最终返回的加密后的字符串
+          // 产生三位随机数
+          let num = ''
+          for (let i = 0; i < 3; i++) {
+            num += Math.floor(Math.random() * 10)
+          }
+          encryptStr += num // 产生3位随机数
+
+          // 16位加密
+          let tempspit = ''
+          let strspit = str.toString().toLowerCase()
+          if (strspit.match(/^[-+]?\d*$/) === null) { // 非整数字符,对每一个字符都转换成16进制,然后拼接
+            /**
+             * Unicode汉字、英文字母、数字的unicode范围
+             *汉字:[0x4e00,0x9fa5](或十进制[19968,40869])
+             *数字:[0x30,0x39](或十进制[48, 57])
+             *小写字母:[0x61,0x7a](或十进制[97, 122])
+             *大写字母:[0x41,0x5a](或十进制[65, 90]
+             * 'a'的Unicode编码:'&#97;',charCodeAt()的值是97
+             * '码'的Unicode编码:'\u7801', new String('码').charCodeAt()的值是30721,30721的16进制表示是7801
+             */
+            let s = strspit.split('')
+            for (let i = 0; i < s.length; i++) {
+              s[i] = s[i].charCodeAt() // 先转换成Unicode编码
+              s[i] = s[i].toString(16)
+              // 因为在服务器是每两位当做一个字符进行解析的,所以这里每个字符的Unicode编码范围必须在0——255之间。数字和大小写满足该要求,特殊字符则不一定,如果后续有特殊字符的要求,需要重写编码器和解码器
+              if (s[i].length === 1) {
+                s[i] = '0' + s[i]
+              }
+              tempspit = tempspit + s[i]
+            }
+            tempspit = tempspit + '{' + 1 // 1代表字符
+          } else { // 数字直接转换成16进制
+            strspit = parseInt(strspit)
+              .toString(16)
+            tempspit = strspit + '{' + 0 // 0代表纯数字
+          }
+
+          let temp = tempspit.split('{') // 对要加密的字符转换成16进制
+          let numLength = temp[0].length // 转换后的字符长度
+          numLength = numLength.toString(16) // 字符长度换算成16进制
+          if (numLength.length === 1) { // 如果是1,补一个0
+            numLength = '0' + numLength
+          } else if (numLength.length > 3) { // 转换后的16进制字符长度如果大于2位数,则返回,不支持
+            return ''
+          }
+          encryptStr += numLength
+          if (temp[1] === '0') {
+            encryptStr += 0
+          } else if (temp[1] === '1') {
+            encryptStr += 1
+          }
+          encryptStr += temp[0]
+          if (encryptStr.length < 20) { // 如果小于20位,补上随机数
+            // 产生三位随机数
+            let numtwo = ''
+            for (let i = 0; i < 20 - encryptStr.length; i++) {
+              numtwo += Math.floor(Math.random() * 10)
+            }
+            let ran = numtwo // 产生3位随机数
+            encryptStr += ran
+          }
+          return encryptStr
+        }
+      },
+      linkSaler: function (commodity) {
+        // 获得窗口的垂直位置
+        let iTop = (window.screen.availHeight - 30 - 780) / 2
+        // 获得窗口的水平位置
+        let iLeft = (window.screen.availWidth - 10 - 1030) / 2
+        if (this.tab.close) {
+          this.tab.close()
+        }
+        let newTab = window.open('', '即时对话框', 'height=750, width=1000, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
+        newTab.close()
+        newTab = window.open('', '即时对话框', 'height=750, width=1000, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
+        this.$store.dispatch('chat/setChatTab', {tab: newTab})
+        this.$http.get('/basic/enterprise/' + commodity.enUU + '/info')
+          .then(response => {
+            let obj = {}
+            obj.userPhone = this.user.data.userTel
+            obj.userType = 'ENTERPRISE'
+            this.user.data.enterprises.forEach(function (item, index) {
+              if (item.current) {
+                obj.enUU = item.uu
+                obj.enterprise = {enUU: item.uu, name: item.enName}
+              }
+            })
+            obj.otherEnUU = response.data.uu
+            obj.otherUserType = 'STORE'
+            obj.otherEnterprise = {enUU: response.data.uu, name: response.data.enName}
+            obj.type = 'CHAT'
+            if (!(/^1\d{10}$/).test(response.data.enTel)) {
+              this.$http.get('/basic/enterprise/' + response.data.uu + '/admin').then(response => {
+                console.log(response)
+                obj.toPhone = response.data.userTel
+                console.log(obj)
+                this.openWebChat(newTab, obj)
+              }, err => {
+                console.log(err)
+                this.$message.error('暂无卖家管理员手机号!')
+              })
+            } else {
+              obj.toPhone = response.data.enTel
+              console.log(obj)
+              this.openWebChat(newTab, obj)
+            }
+          }, err => {
+            console.log(err)
+          })
+      },
+      openWebChat: function (newTab, obj) {
+        this.$http.post('https://im.ubtob.com/api/chat/infos?condition=chat_info', obj)
+          .then(response => {
+            if (response.data.success) {
+              newTab.location.href = 'https://im.ubtob.com/chat/visit?gid=' + response.data.content
+            } else {
+              newTab.close()
+              this.$message.error(response.data.message)
+            }
+          })
       }
     }
   }
@@ -677,7 +1060,7 @@
 <style lang="scss">
   .batch-publish {
     margin: 0 auto;
-    width: 998px;
+    width: 1190px;
     .red-text {
       color: #ff0000;
     }
@@ -685,20 +1068,30 @@
       color: #3c7cf5;
     }
     > p {
-      margin: 59px 0 42px;
+      margin: 30px 0 56px;
       font-size: 16px;
+      height: 60px;
+      line-height: 60px;
+      background: #f7f9fd;
+      padding-left: 24px;
+      > img {
+        width: 23px;
+        height: 31px;
+        margin-right: 12px;
+      }
     }
-    table {
-      width: 100%;
+    > table {
+      width: 1150px;
+      margin: 0 auto;
       table-layout: fixed;
-      thead {
+      > thead {
         tr {
           th {
-            background: #b8b8b8;
+            background: #89aefa;
             color: #fff;
             font-weight: normal;
-            height: 50px;
-            line-height: 50px;
+            height: 40px;
+            line-height: 40px;
             text-align: center;
             .com-check-box {
               margin-right: 2px;
@@ -709,45 +1102,45 @@
           }
         }
       }
-      tbody {
-        tr {
-          height: 85px;
-          line-height: 85px;
+      > tbody {
+        > tr {
+          height: 70px;
+          line-height: 70px;
           text-align: center;
           border : {
-            bottom: 1px solid #d9d9d9;
-            left: 1px solid #d9d9d9;
-            right: 1px solid #d9d9d9;
+            bottom: 1px solid #bcd2ff;
+            left: 1px solid #bcd2ff;
+            right: 1px solid #bcd2ff;
           }
           &:hover {
             background: #f3f3f3;
           }
-          td {
+          > td {
             position: relative;
-            font-size: 12px;
             > ul {
               line-height: normal;
               position: absolute;
-              top: 52px;
-              left: 38px;
+              top: 49px;
+              left: 40px;
               background: #fff;
               border: 1px solid #b5b5b5;
               z-index: 1;
               max-height: 120px;
               overflow-y: auto;
               overflow-x: hidden;
-              border-radius: 3px;
-              width: 114px;
+              border-radius: 2px;
+              width: 145px;
               li {
-                height: 24px;
-                line-height: 24px;
+                height: 30px;
+                line-height: 30px;
                 cursor: pointer;
                 overflow: hidden;
                 text-overflow: ellipsis;
                 white-space: nowrap;
                 padding: 0 5px;
                 &:hover {
-                  background: #ddd;
+                  background: #89aefa;
+                  color: #fff;
                 }
               }
               &.brand-similar-list {
@@ -761,23 +1154,23 @@
               text-overflow: ellipsis;
               white-space: nowrap;
               &.similar-select {
-                width: 109px;
+                width: 145px;
                 margin: 0 auto;
                 border: 1px solid #b5b5b5;
-                height: 18px;
-                line-height: 18px;
+                height: 30px;
+                line-height: 30px;
                 overflow-y: hidden;
                 padding: 0 22px 0 5px;
-                background: url('/images/applyPurchase/select.png') no-repeat;
-                background-position: 91px 0;
+                background: url('/images/all/select-icon-full.png') no-repeat;
+                background-position: 125px 10px;
                 cursor: default;
-                border-radius: 3px;
+                border-radius: 2px;
                 & + ul {
-                  width: 110px;
-                  top: 52px;
-                  left: 40px;
+                  width: 145px;
+                  top: 49px;
+                  left: 18px;
                   &.brand-word-list {
-                    left: 27px;
+                    left: 13px;
                   }
                 }
               }
@@ -787,26 +1180,115 @@
               position: absolute;
               left: 42px;
               top: 49px;
+              font-size: 12px;
             }
             &.operate {
+              text-align: left;
+              padding-left: 18px;
               a {
-                display: block;
-                width: 64px;
-                height: 24px;
-                line-height: 22px;
-                text-align: center;
-                border-radius: 3px;
-                margin: 0 auto 4px;
-                font-size: 14px;
-                &.submit-btn {
-                  border: 1px solid #f64900;
+                padding: 5px 12px;
+                color: #3c7cf5;
+                margin-left: 5px;
+                &:hover {
                   color: #fff;
-                  background: #f64900;
+                  background: #3c7cf5;
+                  border-radius: 3px;
                 }
-                &.cancel-btn {
-                  border: 1px solid #bbb;
+                &.btn-ok {
+                  background: #ff8522;
                   color: #fff;
-                  background: #bbb;
+                  border-radius: 3px;
+                }
+              }
+            }
+          }
+          &.spot-goods {
+            background: #fff;
+            > td {
+              .spot-goods-body {
+                .spot-goods-title {
+                  height: 36px;
+                  line-height: 36px;
+                  background: #414140;
+                  color: #fff;
+                }
+                table {
+                  width: 1130px;
+                  margin-left: 9px;
+                  table-layout: fixed;
+                  thead tr th {
+                    text-align: center;
+                    height: 34px;
+                    line-height: 34px;
+                    background: #fce8df;
+                    font-weight: normal;
+                  }
+                }
+                .spot-goods-list {
+                  max-height: 250px;
+                  overflow-y: auto;
+                  overflow-x: hidden;
+                  table {
+                    margin-bottom: 10px;
+                    tbody tr {
+                      border: 1px solid #fce8df;
+                      td {
+                        height: 48px;
+                        line-height: 48px;
+                        &.input-number {
+                          > div {
+                            position: relative;
+                            width: 100px;
+                            margin: 0 auto;
+                            span {
+                              width: 17px;
+                              height: 26px;
+                              background: #4290f7;
+                              line-height: 26px;
+                              color: #fff;
+                              display: inline-block;
+                              font-size: 16px;
+                              vertical-align: middle;
+                              position: absolute;
+                              top: 11px;
+                              cursor: pointer;
+                              &.not-allowed {
+                                cursor: not-allowed;
+                                background: #e8e8e8;
+                              }
+                              &:last-child {
+                                right: 10px;
+                              }
+                            }
+                            input {
+                              width: 80px;
+                              height: 26px;
+                              text-align: center;
+                            }
+                          }
+                        }
+                        &.operate {
+                          a {
+                            color: #5078cb;
+                            font-size: 12px;
+                          }
+                          span {
+                            display: inline-block;
+                            width: 64px;
+                            height: 24px;
+                            line-height: 24px;
+                            text-align: center;
+                            background: #4290f7;
+                            color: #fff;
+                            margin-left: 13px;
+                            cursor: pointer;
+                            font-size: 12px;
+                            border-radius: 2px;
+                          }
+                        }
+                      }
+                    }
+                  }
                 }
               }
             }
@@ -815,9 +1297,8 @@
             td {
               position: relative;
               input, select {
-                height: 20px;
+                height: 30px;
                 border-radius: 3px;
-                background: #f4f4f4;
                 border: 1px solid #b5b5b5;
                 text-align: center;
                 padding: 0 5px;
@@ -827,32 +1308,32 @@
               }
               &:nth-child(1) {
                 input {
-                  width: 113px;
+                  width: 145px;
                 }
               }
               &:nth-child(2) {
                 input {
-                  width: 93px;
+                  width: 145px;
                 }
               }
               &:nth-child(3) {
                 input {
-                  width: 71px;
+                  width: 104px;
                 }
                }
               &:nth-child(4) {
                 input {
-                  width: 65px;
+                  width: 103px;
                   padding: 0 5px 0 30px;
                 }
                 select {
                   width: 25px;
                   padding: 0 0 0 2px;
                   background: url(/images/applyPurchase/select.png) no-repeat right;
-                  background-size: 12px 19px;
-                  background-position: 13px 0;
+                  background-size: 12px 28px;
+                  background-position: 12px 0;
                   position: absolute;
-                  top: 33px;
+                  top: 20px;
                   border-bottom: none;
                   border-top: none;
                   border-left: 0;
@@ -860,12 +1341,12 @@
               }
               &:nth-child(5) {
                 input {
-                  width: 54px;
+                  width: 96px;
                 }
               }
               &:nth-child(6) {
                 input {
-                  width: 72px;
+                  width: 85px;
                 }
               }
               &:nth-child(7) {
@@ -873,7 +1354,7 @@
                   width: 101px;
                   overflow: unset;
                   input {
-                    width: 101px;
+                    width: 125px;
                   }
                 }
               }
@@ -882,102 +1363,19 @@
         }
       }
     }
-    .modify-btn {
-      border: 1px solid #3c7cf5;
-      color: #3c7cf5;
-      background: #fff;
-    }
-    .delete-btn {
-      border: 1px solid #3c7cf5;
-      color: #fff;
-      background: #3c7cf5;
-    }
     .submit-area {
       margin: 51px auto 60px;
       text-align: center;
       clear: both;
       a {
         display: inline-block;
-        width: 64px;
+        width: 90px;
         height: 24px;
         line-height: 22px;
         text-align: center;
         border-radius: 3px;
-        &.modify-btn {
-          width: 90px;
-          margin-left: 14px;
-        }
-      }
-    }
-    .apply-del-box{
-      position: fixed;
-      z-index: 1000;
-      height: auto;
-      opacity: 1;
-      background-color: white;
-      width: 310px;
-      /*-webkit-box-shadow: 0 5px 15px rgba(0,0,0,.5);*/
-      /*-moz-box-shadow: 0 5px 15px rgba(0,0,0,.5);*/
-      /*-o-box-shadow: 0 5px 15px rgba(0,0,0,.5);*/
-      /*box-shadow: 0 5px 15px rgba(0,0,0,.5);*/
-      margin: -155px 0 0 -75px;
-      top: 55%;
-      left: 43%;
-      .title{
-        height: 24px;
-        background-color: #007aff;
-        text-align: right;
-        padding-right: 15px;
-        line-height: 24px;
-        a{
-          color: white;
-          font-size: 12px;
-        }
-      }
-      .content{
-        width: 100%;
-        text-align: center;
-        margin: 0 auto;
-        p{
-          padding: 12px 31px;
-          margin: 0;
-          &:nth-child(2) {
-            font-size: 12px;
-            padding-top: 0;
-          }
-          i{
-            color: #5078cb;
-            font-size: 16px;
-            margin-right: 10px;
-          }
-          span {
-            color: #007aff;
-          }
-          &:last-child {
-            font-size: 12px;
-          }
-        }
-        div{
-          width: 100%;
-          text-align: center;
-          margin: 0 auto 20px;
-          a{
-            padding: 0 19px;
-            height: 26px;
-            line-height: 26px;
-            display: inline-block;
-            text-align: center;
-            font-size: 14px;
-            color: #fff;
-            &:first-child{
-              background: #c8c6c6;
-              margin-right: 10px;
-            }
-            &:last-child{
-              background: #007aff;
-            }
-          }
-        }
+        color: #fff;
+        background: #3c7cf5;
       }
     }
   }

+ 3 - 0
components/store/common/StoreHeader.vue

@@ -225,6 +225,9 @@ export default {
         .then(response => {
           if (response.data.success) {
             newTab.location.href = 'https://im.ubtob.com/chat/visit?gid=' + response.data.content
+          } else {
+            newTab.close()
+            this.$message.error(response.data.message)
           }
         })
     },

+ 1 - 1
nuxt.config.js

@@ -1,6 +1,6 @@
 const path = require('path')
 const isProdMode = Object.is(process.env.NODE_ENV, 'production')
-const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://192.168.253.60:9090/platform-b2c/' : 'http://10.1.51.125:8080/platform-b2c/')
+const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://192.168.253.60:9090/platform-b2c/' : 'http://192.168.253.121:9090/platform-b2c/')
 const commonUrl = process.env.COMMON_URL || (isProdMode ? 'https://api-inquiry.usoftmall.com/' : 'http://218.17.158.219:24000/')
 
 module.exports = {

BIN
static/images/all/select-icon-full.png


BIN
static/images/applyPurchase/batch-icon.png


BIN
static/images/applyPurchase/link-buyer.png


+ 20 - 0
store/applyPurchase.js

@@ -27,6 +27,17 @@ import axios from '~plugins/axios'
 //   })
 // }
 
+// 获取商城现货
+let getSpotGoods = function ({commit}, params = {}) {
+  return axios.get('/seek/getMallGoodsList', {params: {brand: params.brand, code: params.code}})
+    .then(response => {
+      params.spotGoods = response.data
+      // commit('bomMaterial/ADD_BOM_MATERIAL_BY_SPOT_GOODS', params)
+    }, err => {
+      console.log(err)
+    })
+}
+
 export const actions = {
 // 采购商列表
   loadPurchaseManList ({ commit }, params = {}) {
@@ -71,6 +82,15 @@ export const actions = {
     return axios.get('/seek/getSeekPurchaseByBatchPageInfo', {params: params})
       .then(response => {
         commit('bomMaterial/GET_BOM_MATERIAL_SUCCESS', response.data)
+        let list = response.data.content
+        if (list && list.length) {
+          let promises = []
+          for (let i = 0; i < list.length; i++) {
+            list[i].$index = i
+            promises.push(getSpotGoods({commit}, list[i]))
+          }
+          return Promise.all(promises)
+        }
       }, err => {
         commit('bomMaterial/GET_BOM_MATERIAL_FAILURE', err)
       })

+ 6 - 0
store/applyPurchase/bomMaterial.js

@@ -20,6 +20,12 @@ export const mutations = {
     state.bomList.fetching = false
     state.bomList.data = result
   },
+  ADD_BOM_MATERIAL_BY_SPOT_GOODS (state, result) {
+    if (result.$index === 0) {
+      state.bomList.data.content = []
+    }
+    state.bomList.data.content.push(result)
+  },
   REQUEST_BOM_INFO (state) {
     state.bomNumber.fetching = true
   },