Browse Source

Merge branch 'develop_sale20' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into develop_sale20

lilei 2 years ago
parent
commit
accf7e3df7

+ 10 - 0
src/api/dealer.js

@@ -147,3 +147,13 @@ export const dealerUserSave = (params) => {
     method: 'post'
   })
 }
+
+// 根据经销商sn查询经销商信息   选择列表回显可用
+
+export const getDealerListInfo = (params) => {
+  return axios({
+    url: `/dealer/queryBySns`,
+    data: params,
+    method: 'post'
+  })
+}

+ 12 - 6
src/components/UploadFile/index.vue

@@ -139,10 +139,10 @@ export default {
       this.previewVisible = false
     },
     handlePreview (file) {
-      if (this.listType == 'text') {
-        return
-      }
-      console.log(file)
+      // if (this.listType == 'text') {
+      //   return
+      // }
+      // console.log(file)
       if (file.response.status == 200) {
         this.previewImage = file.response.data
       } else {
@@ -252,7 +252,7 @@ export default {
   }
 }
 </script>
-<style lang="less">
+<style lang="less" scoped>
   .upload-file{
     float: left;
     overflow: hidden;
@@ -292,5 +292,11 @@ export default {
       white-space: normal;
     }
   }
-
+/deep/.ant-modal-body{
+      max-height:860px;
+      text-align:center;
+  }
+ /deep/.ant-modal-body video{
+    width: 90% !important;
+  }
 </style>

+ 6 - 6
src/views/promotionRulesManagement/promotionManagement/addModal.vue

@@ -175,12 +175,6 @@ export default {
           buyerName: con.dealerName
         }
       })
-      const newArr = list.map(item => {
-        return {
-          buyerSn: item.dealerSn
-        }
-      })
-      this.form.promoBuyerList = newArr
       this.openDealerModal = false
       // 移除表单必填项
       this.$refs.ruleForm.clearValidate('promoBuyerList')
@@ -209,6 +203,12 @@ export default {
     //  保存促销
     handleSave () {
       const _this = this
+      const newArr = this.chooseDealerList.map(item => {
+        return {
+          buyerSn: item.buyerSn
+        }
+      })
+      this.form.promoBuyerList = newArr
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const form = JSON.parse(JSON.stringify(_this.form))

+ 27 - 27
src/views/promotionRulesManagement/promotionManagement/chooseDealer.vue

@@ -55,7 +55,7 @@
       :scroll="{ y: 230 }"
       :bordered="true"
       :pagination="pagination"
-      :row-key="record => record.no"
+      :row-key="record => record.dealerSn"
       :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
       :columns="columns"
       :data-source="dealerList"
@@ -68,7 +68,7 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import AreaList from '@/views/common/areaList.js'
-import { dealerQueryList } from '@/api/dealer'
+import { dealerQueryList, getDealerListInfo } from '@/api/dealer'
 import subarea from '@/views/common/subarea.js'
 export default {
   name: 'ChooseDealer',
@@ -130,26 +130,24 @@ export default {
   },
   methods: {
     onSelectChange (selectedRowKeys) {
-      console.log('selectedRowKeys changed: ', selectedRowKeys)
       this.selectedRowKeys = selectedRowKeys
     },
     handlePage (pagination, filters, sorter) {
-      console.log(pagination);
-      const pager = { ...this.pagination };
-      pager.current = pagination.current;
-      pager.pageSize = pagination.pageSize;
-      this.pagination = pager;
-      
+      const pager = { ...this.pagination }
+      pager.current = pagination.current
+      pager.pageSize = pagination.pageSize
+      this.pagination = pager
+
       this.loadData({ pageNo: pagination.current, pageSize: pagination.pageSize })
     },
     loadData (pager) {
       this.spinning = true
-      const params = {pageSize: 20,pageNo:1,...pager}
+      const params = { pageSize: 20, pageNo: 1, ...pager }
       dealerQueryList(Object.assign(params, this.queryParam)).then(res => {
         let data
         if (res.status == 200) {
           data = res.data
-          const pagination = { ...this.pagination };
+          const pagination = { ...this.pagination }
           pagination.total = data.count
           const no = 0
           for (var i = 0; i < data.list.length; i++) {
@@ -157,6 +155,10 @@ export default {
           }
           this.dealerList = data.list
           this.pagination = pagination
+          if (this.chooseInfo && !this.pageFlag) {
+            this.pageFlag = true
+            this.selectedRowKeys = this.chooseInfo
+          }
         }
         this.spinning = false
       })
@@ -170,8 +172,8 @@ export default {
       this.queryParam.citySn = val[1] ? val[1] : ''
       this.queryParam.districtSn = val[2] ? val[2] : ''
     },
-    searchForm (flag) {
-      this.$refs.table.refresh(flag)
+    searchForm () {
+      this.loadData()
       this.spinning = false
     },
     subareaChange (val) {
@@ -198,8 +200,13 @@ export default {
       } else {
         this.$refs.areaList.clearData()
       }
-      this.$refs.table.clearSelected()
-      this.$refs.table.refresh(true)
+      this.pagination = {
+        pageSize: 20,
+        showSizeChanger: true,
+        current: 1
+      }
+      this.selectedRowKeys = []
+      this.loadData()
       this.pageFlag = false
     },
     clearTable () {
@@ -207,22 +214,15 @@ export default {
       this.$refs.table.clearTable()
     },
     // 批量添加
-    handleBatchAudit () {
+    async handleBatchAudit () {
       const _this = this
-      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+      if (_this.selectedRowKeys && _this.selectedRowKeys.length < 1) {
         _this.$message.warning('请在列表勾选后再进行批量操作!')
         return
       }
-      const dealerSnList = _this.rowSelectionInfo.selectedRows
-      // const newDealerSnList = dealerSnList.map(con => {
-      //   const obj = {
-      //     buyerName: con.dealerName,
-      //     buyerSn: con.dealerSn
-      //   }
-      //   return obj
-      // })
+      const dealerInfoList = await getDealerListInfo({ dealerSnList: _this.selectedRowKeys })
       this.spinning = false
-      this.$emit('plAdd', dealerSnList)
+      this.$emit('plAdd', dealerInfoList.data)
     },
     handleAdd (row) {
       if (row.subareaArea) {
@@ -247,7 +247,7 @@ export default {
         _this.setTableH()
       })
       this.chooseInfo = data || []
-      this.loadData()
+      this.resetSearchForm()
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight