Browse Source

处理批量上传确认页bug

yangc 7 years ago
parent
commit
ce568b12b6
1 changed files with 32 additions and 73 deletions
  1. 32 73
      components/applyPurchase/BatchPublish.vue

+ 32 - 73
components/applyPurchase/BatchPublish.vue

@@ -119,9 +119,9 @@
             </div>
           </td>-->
           <!--<td>-->
-            <!--<span v-if="item.deadline">{{item.deadline | date}}</span>-->
-            <!--<span class="red-text" v-if="!item.deadline">请完善信息</span>-->
-            <!--<div class="red-text remind" v-if="!isValidTime(item.deadline)">默认≤90天</div>-->
+          <!--<span v-if="item.deadline">{{item.deadline | date}}</span>-->
+          <!--<span class="red-text" v-if="!item.deadline">请完善信息</span>-->
+          <!--<div class="red-text remind" v-if="!isValidTime(item.deadline)">默认≤90天</div>-->
           <!--</td>-->
           <td class="operate">
             <a @click="modifyItem(index)" class="size-s">编辑</a>
@@ -231,16 +231,16 @@
             <input type="text" class="form-control" v-model="modifyObj.produceDate" @input="onProduceDateChange">
           </td>-->
           <!--<td>-->
-            <!--<el-date-picker-->
-              <!--v-model="modifyObj.deadline"-->
-              <!--type="date"-->
-              <!--:picker-options="pickerOptions"-->
-              <!--:editable="false"-->
-              <!--:class="{'error': !validObj.deadline}"-->
-              <!--@change="getDate1()"-->
-              <!--size="mini">-->
-            <!--</el-date-picker>-->
-            <!--<input type="text" class="form-control" v-model="modifyObj.deadline">-->
+          <!--<el-date-picker-->
+          <!--v-model="modifyObj.deadline"-->
+          <!--type="date"-->
+          <!--:picker-options="pickerOptions"-->
+          <!--:editable="false"-->
+          <!--:class="{'error': !validObj.deadline}"-->
+          <!--@change="getDate1()"-->
+          <!--size="mini">-->
+          <!--</el-date-picker>-->
+          <!--<input type="text" class="form-control" v-model="modifyObj.deadline">-->
           <!--</td>-->
           <td class="operate">
             <a class="btn-ok size-s" @click="submitModify(index)">确认</a>
@@ -256,10 +256,16 @@
         <a class="modify-btn" @click="submitBOM">确认发布</a>
       </div>
     </div>
+    <link-saler-box
+      :tel="tel"
+      v-if="showLinkBox"
+      @cancelAction="showLinkBox = false">
+    </link-saler-box>
   </div>
 </template>
 <script>
   import Page from '~components/common/page/pageComponent.vue'
+  import LinkSalerBox from '~components/common/LinkSalerBox.vue'
   export default {
     data () {
       return {
@@ -277,7 +283,7 @@
           amount: '',
           deadline: '',
           kind: '',
-          spec: '',
+          spec: ''
         },
         pickerOptions: {
           disabledDate (time) {
@@ -304,11 +310,14 @@
         spotGoodsData: [],
         fragments: [],
         bomList: {},
-        bomInfo: {}
+        bomInfo: {},
+        tel: '',
+        showLinkBox: false
       }
     },
     components: {
-      Page
+      Page,
+      LinkSalerBox
     },
     watch: {
       '$store.state.applyPurchase.bomMaterial.bomList.data': {
@@ -646,7 +655,7 @@
         }
       },
       getSingleValidInfo: function (item) {
-      // && item.deadline && this.isValidDate(item.deadline)
+        // && item.deadline && this.isValidDate(item.deadline)
         return item.code && item.brand
       },
       checkCode: function () {
@@ -703,9 +712,9 @@
         return this.validObj.spec
       },
       checkAll: function () {
-      // && this.checkSpec()
-      // && this.checkUnitPrice()
-      // && this.checkDeadline()
+        // && this.checkSpec()
+        // && this.checkUnitPrice()
+        // && this.checkDeadline()
         return this.checkBrand() && this.checkCode() && this.checkKind()  && this.checkAmount()
       },
       checkDeadline: function () {
@@ -854,7 +863,7 @@
       },
       setShowSpotGoods: function (flag, item) {
         if (flag && item && item.spotGoods.length) {
-          this.spotGoodsData = item.spotGoods
+          this.spotGoodsData = this.baseUtils.deepCopy(item.spotGoods)
           this.initFragments()
         }
         if (!this.cancelModifyItem()) {
@@ -888,6 +897,7 @@
         return fragment
       },
       initFragments: function () {
+        this.fragments = []
         for (let i = 0; i < this.spotGoodsData.length; i++) {
           this.fragments.push(this.initFragment(this.spotGoodsData[i]))
         }
@@ -1059,58 +1069,7 @@
           })
       },
       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 => {
-                obj.toPhone = response.data.userTel
-                this.openWebChat(newTab, obj)
-              }, err => {
-                console.log(err)
-                this.$message.error('暂无卖家管理员手机号!')
-              })
-            } else {
-              obj.toPhone = response.data.enTel
-              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)
-            }
-          })
+        this.baseUtils.goLinkUser(this, commodity.enUU)
       }
     },
     created() {