zh 2 år sedan
förälder
incheckning
a06b1d03a2

+ 39 - 3
src/api/policy_list.js

@@ -9,7 +9,7 @@ export function policyListV2(data) {
   })
 }
 
-//政策列表V2-导出
+// 政策列表V2-导出
 export function policyListV2Export(data, name) {
   return postBlob({
     url: '/policy/list/v2/export',
@@ -254,7 +254,7 @@ export function saleTypeRebateListV2(data) {
     data
   })
 }
-//销售类型列表V2-导出
+// 销售类型列表V2-导出
 export function saleTypeRebateListV2Export(data, name) {
   return postBlob({
     url: '/sale/type/list/v2/export',
@@ -453,7 +453,7 @@ export function walletRebateSaletypeListV2(data) {
   })
 }
 
-//返利钱包销售类型V2-导出
+// 返利钱包销售类型V2-导出
 export function walletRebateSaletypeListV2Export(data, name) {
   return postBlob({
     url: '/wallet/rebate_saletype/list/v2/export',
@@ -529,3 +529,39 @@ export function setStauts(params) {
     params
   })
 }
+
+// 政策-批量修改延期时间
+export function updateDelayPolicy(params) {
+  return request({
+    url: '/policy/batch/delay/update',
+    method: 'post',
+    data: params
+  })
+}
+
+// 政策-批量修改机型
+export function updateMaterialPolicy(params) {
+  return request({
+    url: '/policy/batch/material/update',
+    method: 'post',
+    params
+  })
+}
+// 政策对应经销商-批量设置提货数量/批量备注
+export function updateCustomerCountBatch(params) {
+  return request({
+    url: '/policy/customer_count/batch',
+    method: 'post',
+    params
+  })
+}
+
+// 经销商购买上限-批量修改起提数/提数数
+export function updateLimitBatchupdate(params) {
+  return request({
+    url: '/policy/limit/batchupdate',
+    method: 'post',
+    params
+  })
+}
+

+ 0 - 117
src/views/delayRecord/delayRecordForm.vue

@@ -1,117 +0,0 @@
-<template>
-  <div>
-    <div>
-      <h4>政策延期</h4>
-      <el-divider />
-      <el-row :gutter="20">
-        <el-col :span="2">延期方式</el-col>
-        <el-col :span="3">  <el-radio v-model="value" :label="1">按政策延期</el-radio>
-        </el-col>
-      </el-row>
-    </div>
-    <div>
-      <h4>政策</h4>
-      <el-divider />
-      <zj-table
-        :table-attributes="tableAttributes"
-        :is-drop="true"
-        :columns="columns"
-        :table-data="policyData"
-      />
-    </div>
-    <div style="margin: 20px 0;">
-      <el-button type="primary" size="mini" @click="">提交</el-button>
-      <el-button type="primary" size="mini" @click="">审核</el-button>
-    </div>
-  </div>
-</template>
-
-<script>
-export default {
-  data() {
-    return {
-      value: 1,
-      policyData: [],
-      tableAttributes: {}
-    }
-  },
-  computed: {
-    columns() {
-      return [
-        {
-          columnAttributes: {
-            label: '销售政策编码',
-            prop: 'materialName'
-          }
-        },
-        {
-          columnAttributes: {
-            label: '销售政策名称',
-            prop: 'materialName'
-          }
-        },
-        {
-          columnAttributes: {
-            label: '销售政策类型',
-            prop: 'materialName'
-          }
-        },
-        {
-          columnAttributes: {
-            label: '生效日期',
-            prop: 'materialName'
-          }
-        },
-        {
-          columnAttributes: {
-            label: '失效日期',
-            prop: 'materialName'
-          }
-        },
-        {
-          columnAttributes: {
-            label: '延期日期',
-            prop: 'materialName'
-          },
-          render: (h, { column, row, index }) => {
-            return <el-date-picker
-              value={row.date}
-              onInput={e => { row.date = e }}
-              type='datetime'
-              default-time='00:00:00'
-              value-format='yyyy-MM-dd HH:mm:ss'
-              placeholder='选择日期'>
-            </el-date-picker>
-          }
-        },
-        {
-          columnAttributes: {
-            label: '操作',
-            prop: ''
-          },
-          render: (h, { column, row, index }) => {
-            return (
-              <div>
-                <el-button
-                  type='text'
-                  size='default'
-                  onClick={() => {
-
-                  }}
-                >
-                      删除
-                </el-button>
-              </div>
-            )
-          }
-        }
-      ]
-    }
-  }
-}
-</script>
-
-  <style lang="scss" scoped>
-
-  </style>
-

+ 3 - 3
src/views/delayRecord/delayRecordList.vue

@@ -9,7 +9,7 @@
   >
     <popu v-if="visible">
       <el-page-header slot="head" content="政策延期" @back="handleClose" />
-      <delay-record-form />
+      <!-- <delay-record-form /> -->
     </popu>
   </template-page>
 </template>
@@ -18,11 +18,11 @@
 import TemplatePage from '@/components/template/template-page-1.vue'
 import import_mixin from '@/components/template/import_mixin.js'
 import add_callback_mixin from '@/components/template/add_callback_mixin.js'
-import DelayRecordForm from './delayRecordForm.vue';
+// import DelayRecordForm from '../sales_policy/components/delayRecordForm.vue';
 import Popu from '@/components/template/popu.vue'
 import { getDealerListV2, exportDealerListV2 } from '@/api/basic_data/dealer'
 export default {
-  components: { TemplatePage, Popu, DelayRecordForm },
+  components: { TemplatePage, Popu,  },
   mixins: [import_mixin, add_callback_mixin],
   data() {
     return {

+ 0 - 156
src/views/replaceRecord/replaceRecordForm.vue

@@ -1,156 +0,0 @@
-<template>
-  <div>
-    <div>
-      <h4>新机型</h4>
-      <el-divider />
-      <zj-table
-        :table-attributes="tableAttributes"
-        :is-drop="true"
-        :columns="ovalColumns"
-        :table-data="ovalData"
-      />
-    </div>
-    <div>
-      <h4>旧机型</h4>
-      <el-divider />
-      <zj-table
-        :table-attributes="tableAttributes"
-        :is-drop="true"
-        :columns="newColumns"
-        :table-data="newData"
-      />
-    </div>
-    <div style="margin: 20px 0;">
-      <el-button type="primary" size="mini" @click="">提交</el-button>
-      <el-button type="primary" size="mini" @click="">审核</el-button>
-    </div>
-  </div>
-</template>
-
-<script>
-export default {
-  data() {
-    return {
-      ovalData: [],
-      newData: [],
-      tableAttributes: {}
-    }
-  },
-  computed: {
-    ovalColumns() {
-      return [
-        {
-          columnAttributes: {
-            label: '货品编码',
-            prop: 'materialName'
-          }
-        },
-        {
-          columnAttributes: {
-            label: '货品名称',
-            prop: 'materialName'
-          }
-        },
-        {
-          columnAttributes: {
-            label: '规格型号',
-            prop: 'materialName'
-          }
-        },
-        {
-          columnAttributes: {
-            label: '操作',
-            prop: ''
-          },
-          render: (h, { column, row, index }) => {
-            return (
-              <div>
-                <el-button
-                  type='text'
-                  size='default'
-                  onClick={() => {
-
-                  }}
-                >
-                    删除
-                </el-button>
-              </div>
-            )
-          }
-        }
-      ]
-    },
-    newColumns() {
-      return [
-        {
-          columnAttributes: {
-            label: '政策编码',
-            prop: 'materialName'
-          }
-        },
-        {
-          columnAttributes: {
-            label: '政策名称',
-            prop: 'materialName'
-          }
-        },
-        {
-          columnAttributes: {
-            label: '物流编码',
-            prop: 'materialName'
-          }
-        },
-        {
-          columnAttributes: {
-            label: '产品名称',
-            prop: 'materialName'
-          }
-        },
-        {
-          columnAttributes: {
-            label: '规格型号',
-            prop: 'materialName'
-          }
-        },
-        {
-          columnAttributes: {
-            label: '单位',
-            prop: 'materialName'
-          }
-        },
-        {
-          columnAttributes: {
-            label: '单价',
-            prop: 'materialName'
-          }
-        },
-        {
-          columnAttributes: {
-            label: '操作',
-            prop: ''
-          },
-          render: (h, { column, row, index }) => {
-            return (
-              <div>
-                <el-button
-                  type='text'
-                  size='default'
-                  onClick={() => {
-
-                  }}
-                >
-                    删除
-                </el-button>
-              </div>
-            )
-          }
-        }
-      ]
-    }
-  }
-}
-</script>
-
-<style lang="scss" scoped>
-
-</style>

+ 3 - 3
src/views/replaceRecord/replaceRecordList.vue

@@ -9,7 +9,7 @@
   >
     <popu v-if="visible">
       <el-page-header slot="head" content="替换机型" @back="handleClose" />
-      <replace-record-form />
+      <!-- <replace-record-form /> -->
     </popu>
   </template-page>
 </template>
@@ -18,11 +18,11 @@
 import TemplatePage from '@/components/template/template-page-1.vue'
 import import_mixin from '@/components/template/import_mixin.js'
 import add_callback_mixin from '@/components/template/add_callback_mixin.js'
-import ReplaceRecordForm from './replaceRecordForm.vue';
+// import ReplaceRecordForm from '../sales_policy/components/replaceRecordForm.vue';
 import Popu from '@/components/template/popu.vue'
 import { getDealerListV2, exportDealerListV2 } from '@/api/basic_data/dealer'
 export default {
-  components: { TemplatePage, Popu, ReplaceRecordForm },
+  components: { TemplatePage, Popu,  },
   mixins: [import_mixin, add_callback_mixin],
   data() {
     return {

+ 65 - 29
src/views/sales_policy/components/AddPolicy.vue

@@ -5,7 +5,7 @@
         <div class="screen-container">
           <h4>销售政策信息</h4>
           <el-divider />
-          <el-form ref="form" :model="searchForm" label-width="120px" size="mini" class="demo-searchForm">
+          <el-form ref="form" :model="searchForm" label-width="140px" size="mini" class="demo-searchForm">
             <el-row>
               <el-col :xs="24" :ms="12" :lg="12">
                 <el-form-item label="销售政策编号">
@@ -62,8 +62,7 @@
                     placeholder="生效日期"
                     default-time="00:00:00"
                     value-format="yyyy-MM-dd HH:mm:ss"
-                  /> </el-form-item
-              ></el-col>
+                  /> </el-form-item></el-col>
               <el-col :xs="24" :ms="12" :lg="12">
                 <el-form-item label="失效日期" prop="endTime">
                   <el-date-picker
@@ -72,13 +71,25 @@
                     placeholder="失效日期"
                     default-time="00:00:00"
                     value-format="yyyy-MM-dd HH:mm:ss"
-                  /> </el-form-item
-              ></el-col>
+                  /> </el-form-item></el-col>
               <el-col :xs="24" :ms="24" :lg="24">
                 <el-form-item label="表头备注" prop="remark">
                   <el-input v-model="searchForm.remark" placeholder="新风机变频挂机。按提货数量1:3开单" />
                 </el-form-item>
               </el-col>
+              <template v-if="searchForm.type === 'LIMIT'">
+
+                <el-col :xs="24" :ms="12" :lg="12">
+                  <el-form-item label="商家最少起提数量" prop="minBuyNum">
+                    <el-input v-model="searchForm.minBuyNum" type="number" placeholder="商家最少起提数量" />
+                  </el-form-item>
+                </el-col>
+                <el-col :xs="24" :ms="12" :lg="12">
+                  <el-form-item label="商家最大提货组数" prop="maxBuyNum">
+                    <el-input v-model="searchForm.maxBuyNum" type="number" placeholder="商家最大提货组数" />
+                  </el-form-item>
+                </el-col>
+              </template>
               <el-col :xs="24" :ms="24" :lg="24">
                 <el-form-item label="政策封面图">
                   <ImageUpload class="elImageClose" :file-list="fileList" multiple :limit="3" />
@@ -117,10 +128,10 @@
             :data="dataList"
             row-key="index"
             use-virtual
-            fixedColumnsRoll
-            :dataChangesScrollTop="false"
+            fixed-columns-roll
+            :data-changes-scroll-top="false"
             inverse-current-row
-            bigDataCheckbox
+            big-data-checkbox
             element-loading-text="Loading"
             max-height="700"
             border
@@ -247,13 +258,20 @@
                 <template v-if="scope.row.fang">
                   {{ scope.row.priceType }}
                 </template>
-                <el-input
+                <el-select
                   v-else
                   v-model="scope.row.priceType"
-                  placeholder="价格类型"
                   size="mini"
+                  filterable
                   @change="setText($event, scope.$index, scope.row, 'priceType')"
-                />
+                >
+                  <el-option
+                    v-for="item in priceList"
+                    :key="item.priceTypeId"
+                    :label="item.priceTypeName"
+                    :value="item.priceTypeId"
+                  />
+                </el-select>
               </template>
             </pl-table-column>
             <pl-table-column prop="price" label="单价" align="right" show-overflow-tooltip min-width="150">
@@ -341,9 +359,11 @@
             </pl-table-column>
             <pl-table-column fixed="right" label="操作" align="center" min-width="150">
               <template slot-scope="scope">
-                <el-button type="text" class="textColor el-popover-left" @click="scope.row.fang = !scope.row.fang"
-                  >编辑</el-button
-                >
+                <el-button
+                  type="text"
+                  class="textColor el-popover-left"
+                  @click="scope.row.fang = !scope.row.fang"
+                >编辑</el-button>
                 <el-popconfirm
                   confirm-button-text="好的"
                   cancel-button-text="不用了"
@@ -383,7 +403,7 @@
           <div style="margin: 20px 20px 20px 0; display: flex; justify-content: space-between">
             <div>
               <el-button type="primary" size="mini" @click="handleNewInfo">添加</el-button>
-              <el-button type="primary" size="mini" @click="handleSave" v-loading="fullscreenLoading">保存</el-button>
+              <el-button v-loading="fullscreenLoading" type="primary" size="mini" @click="handleSave">保存</el-button>
             </div>
             <!--            <el-pagination-->
             <!--              :current-page="dcurrentPage"-->
@@ -401,8 +421,7 @@
             <el-row type="flex">
               <el-col :span="12">
                 <h4 style="display: inline-block; margin-right: 20px">条件信息</h4>
-                <el-button type="primary" size="mini" @click="isCondition = 1">添加</el-button></el-col
-              >
+                <el-button type="primary" size="mini" @click="isCondition = 1">添加</el-button></el-col>
             </el-row>
             <el-divider />
           </el-row>
@@ -428,8 +447,7 @@
                     scope.row.fang = false
                     conditName = scope.row.name
                   "
-                  >编辑</el-button
-                >
+                >编辑</el-button>
                 <el-button type="text" size="mini" @click="handleCondition(scope.row.id, scope.$index)">删除</el-button>
               </template>
             </el-table-column>
@@ -448,6 +466,7 @@
           <TabelTransfer
             v-if="searchForm.code"
             :code="searchForm.code"
+            :policy-type="searchForm.type"
             @handlEditPolicy="handleAddPolicy"
             @handleReset="handleReset"
           />
@@ -455,7 +474,7 @@
         </div>
       </div>
     </div>
-    <AddCondition v-show="isCondition == 1" :code="searchForm.code" @handleSubmitCon="handleSubmitCon" @back="handleBack"  :isShow="isShow" :isFlag="isFlag" :isCondition="isCondition"/>
+    <AddCondition v-show="isCondition == 1" :code="searchForm.code" :is-show="isShow" :is-flag="isFlag" :is-condition="isCondition" @handleSubmitCon="handleSubmitCon" @back="handleBack" />
   </div>
 </template>
 
@@ -476,13 +495,13 @@ import {
   setStauts,
   updateCondition
 } from '@/api/policy_list'
+import { getProductPriceListV2 } from '@/api/priceType'
 import { downloadFiles, handleImport } from '@/utils/util'
 // import Transfer from './Transfer'
 import TabelTransfer from './TabelTransfer'
 import AddCondition from './AddCondition'
 import ImageUpload from '@/components/Common/image-upload.vue'
 import { PlTable, PlTableColumn } from 'pl-table'
-import { nextTick } from 'process'
 
 export default {
   directives: {
@@ -490,7 +509,7 @@ export default {
       bind(el, binding) {
         // 获取element-ui定义好的scroll盒⼦
         const SELECTWRAP_DOM = el.querySelector('.el-table__body-wrapper')
-        SELECTWRAP_DOM.addEventListener('scroll', function () {
+        SELECTWRAP_DOM.addEventListener('scroll', function() {
           /**
            * scrollHeight 获取元素内容⾼度(只读)
            * scrollTop 获取或者设置元素的偏移值,常⽤于, 计算滚动条的位置, 当⼀个元素的容器没有产⽣垂直⽅向的滚动条, 那它的scrollTop的值默认为0.
@@ -506,8 +525,8 @@ export default {
       }
     }
   },
-  props: ['isShow','isFlag'],
   mixins: [Minxin],
+  props: ['isShow', 'isFlag'],
   data() {
     return {
       fang: false,
@@ -523,9 +542,11 @@ export default {
         title: '',
         mainId: '',
         mainName: '',
-        type: '',
+        type: 'PROVISION',
         isFullRebate: false,
-        commercialType: false
+        commercialType: false,
+        maxBuyNum: 0,
+        minBuyNum: 0
       },
       dataList: [],
       addList: [],
@@ -558,7 +579,8 @@ export default {
       dpageSize: 10,
       dcurrentPage: 1,
       rebateList: [],
-      fullscreenLoading: false
+      fullscreenLoading: false,
+      priceList: []
     }
   },
   computed: {
@@ -586,6 +608,11 @@ export default {
       })
     },
     setText(e, index, row, name) {
+      if (name === 'priceType') {
+        console.log(e, this.priceList.find(k => k.priceTypeId === e).priceTypeName)
+        this.dataList[index][name] = this.priceList.find(k => k.priceTypeId === e).priceTypeName
+        return
+      }
       this.dataList[index][name] = row[name]
     },
     // 下载excel模板
@@ -684,6 +711,7 @@ export default {
       // 获取销售类型列表
       const typeData = await getTypeList(params)
       this.typeList = typeData.data.records
+      this.getProductPriceListV2()
     },
     handleSalesType(e, row, index, name) {
       console.log(e)
@@ -867,7 +895,7 @@ export default {
           })
         }
 
-        let imgUrl = []
+        const imgUrl = []
         this.fileList.forEach(k => {
           imgUrl.push(k.url)
         })
@@ -1006,9 +1034,17 @@ export default {
       Object.assign(this.$data, this.$options.data())
       this.getCommonApi()
     },
-    handleBack(){
-      this.isCondition = 0 
+    handleBack() {
+      this.isCondition = 0
       this.$emit('upDataIsFlag')
+    },
+    getProductPriceListV2() {
+      getProductPriceListV2({
+        pageNum: 1,
+        pageSize: -1
+      }).then(res => {
+        this.priceList = res.data.records
+      })
     }
   },
   components: {

+ 40 - 24
src/views/sales_policy/components/Examine.vue

@@ -84,6 +84,20 @@
                 />
               </div>
             </el-col>
+            <template v-if="detail.type === 'LIMIT'">
+              <el-col :span="12" class="item">
+                <div class="label">商家最少起提数量</div>
+                <div class="value">
+                  {{ detail.minBuyNum }}
+                </div>
+              </el-col>
+              <el-col :span="12" class="item">
+                <div class="label">商家最大提货组数</div>
+                <div class="value">
+                  {{ detail.maxBuyNum }}
+                </div>
+              </el-col>
+            </template>
           </el-row>
 
           <el-row v-if="detail.imgSrc" class="img-box">
@@ -100,9 +114,9 @@
                     :preview-src-list="[$imageUrl + item]"
                     class="elImageClose"
                   />
-                  <img v-if="checkFileType(item) == 'word'" class="file" src="@/assets/common/word.png" />
-                  <img v-if="checkFileType(item) == 'excel'" class="file" src="@/assets/common/excel.png" />
-                  <img v-if="checkFileType(item) == 'ppt'" class="file" src="@/assets/common/ppt.png" />
+                  <img v-if="checkFileType(item) == 'word'" class="file" src="@/assets/common/word.png">
+                  <img v-if="checkFileType(item) == 'excel'" class="file" src="@/assets/common/excel.png">
+                  <img v-if="checkFileType(item) == 'ppt'" class="file" src="@/assets/common/ppt.png">
 
                   <img
                     v-if="checkFileType(item) == 'pdf'"
@@ -110,9 +124,9 @@
                     style="cursor: pointer"
                     src="@/assets/common/pdf.png"
                     @click="openPdf(item)"
-                  />
+                  >
 
-                  <img v-if="checkFileType(item) == 'file'" class="file aaa" src="@/assets/common/zip.jpeg" />
+                  <img v-if="checkFileType(item) == 'file'" class="file aaa" src="@/assets/common/zip.jpeg">
                 </template>
               </div>
             </el-col>
@@ -176,7 +190,8 @@
             </el-row>
             <el-divider />
           </el-row>
-          <el-table
+          <div class="table">
+            <el-table
             v-loading="listLoading"
             :data="dataList"
             element-loading-text="Loading"
@@ -249,6 +264,7 @@
               </template>
             </el-table-column>
           </el-table>
+          </div>
           <!-- 分页 -->
           <div style="margin: 20px 0">
             <el-pagination
@@ -325,8 +341,7 @@
                   <template slot-scope="scope">
                     <CopyButton :copy-text="scope.row.customerNumber" />
                     <span>{{ scope.row.customerNumber }}</span>
-                  </template></el-table-column
-                >
+                  </template></el-table-column>
                 <el-table-column prop="customerName" label="经销商名称" align="left">
                   <template slot-scope="scope">
                     <CopyButton :copy-text="scope.row.customerName" />
@@ -353,7 +368,7 @@
               <el-col :span="10" :offset="0">
                 <h5>未选经销商</h5>
                 <el-divider direction="horizontal" content-position="left" />
-
+                <div class="table">
                 <el-table
                   ref="multipleTable"
                   :data="dataL"
@@ -379,6 +394,7 @@
                     </template>
                   </el-table-column>
                 </el-table>
+                </div>
                 <!-- 分页 -->
                 <div style="margin: 20px 0">
                   <el-pagination
@@ -394,19 +410,18 @@
               </el-col>
               <el-col :span="4" class="middle_box" :offset="0">
                 <el-col>
-                  <el-button size="small" :disabled="type == 2" @click="handleAllAdd">全部添加</el-button></el-col
-                >
+                  <el-button size="small" :disabled="type == 2" @click="handleAllAdd">全部添加</el-button></el-col>
                 <el-col> <el-button size="small" :disabled="type == 2" @click="handleAdd">增加</el-button></el-col>
                 <el-col> <el-button size="small" :disabled="type == 1" @click="handleDelete">删除</el-button></el-col>
                 <el-col>
-                  <el-button size="small" :disabled="type == 1" @click="handleAllDelete">全部删除</el-button></el-col
-                >
+                  <el-button size="small" :disabled="type == 1" @click="handleAllDelete">全部删除</el-button></el-col>
               </el-col>
               <el-col :span="10" :offset="0">
                 <h5>已选经销商</h5>
                 <el-divider direction="horizontal" content-position="left" />
 
-                <el-table
+                <div class="table">
+                  <el-table
                   v-loading="listLoading"
                   :data="custoList"
                   element-loading-text="Loading"
@@ -432,6 +447,7 @@
                     </template>
                   </el-table-column>
                 </el-table>
+                </div>
                 <!-- 分页 -->
                 <!-- <div style="margin: 20px 0">
                   <el-pagination
@@ -569,7 +585,7 @@
         </div>
       </div>
     </div>
-    <AddCondition v-else :id="cid" @close="handleConditionClose" @back="handleBack" :isEdit="isEdit" />
+    <AddCondition v-else :id="cid" :is-edit="isEdit" @close="handleConditionClose" @back="handleBack" />
   </div>
 </template>
 
@@ -595,6 +611,11 @@ import Minxin from '@/mixin'
 
 export default {
   name: 'Examine',
+  components: {
+    AddCondition,
+    ImageUpload
+  },
+  mixins: [Minxin],
   props: {
     id: {
       type: String,
@@ -604,11 +625,6 @@ export default {
       type: Number
     }
   },
-  components: {
-    AddCondition,
-    ImageUpload
-  },
-  mixins: [Minxin],
   data() {
     return {
       baseURL: '',
@@ -765,9 +781,9 @@ export default {
         }
         this.dataL = res.data.records
         for (let k = 0; k < this.dataL.length; k++) {
-          ;(this.dataL[k].customerId = this.dataL[k].id),
-            (this.dataL[k].customerName = this.dataL[k].name),
-            (this.dataL[k].customerNumber = this.dataL[k].number)
+          (this.dataL[k].customerId = this.dataL[k].id),
+          (this.dataL[k].customerName = this.dataL[k].name),
+          (this.dataL[k].customerNumber = this.dataL[k].number)
         }
 
         console.log(this.dataL, '获取经销商列表')
@@ -929,7 +945,7 @@ export default {
      * @param {String} index - 索引值
      * @return Boolean
      */
-    selectable: function (row, index) {
+    selectable: function(row, index) {
       // row.disabled == undefined 才能被选中
       if (row.disabled == undefined || row.disabled == false) {
         return true

+ 76 - 0
src/views/sales_policy/components/OperationRecords.vue

@@ -0,0 +1,76 @@
+<template>
+  <div>
+    <h4>操作记录</h4>
+    <zj-table
+      :table-attributes="tableAttributes"
+      :is-drop="true"
+      :columns="columns"
+      :table-data="tableData"
+    />
+  </div>
+</template>
+
+<script>
+import { commonLogList } from '@/api/common'
+export default {
+  props: {
+    policyId: {
+      type: String,
+      default: null
+    }
+  },
+  data() {
+    return {
+      tableAttributes: {},
+      tableData: []
+    }
+  },
+  computed: {
+    columns() {
+      return [{
+        columnAttributes: {
+          label: '帐号',
+          prop: 'userName'
+        }
+      },
+      {
+        columnAttributes: {
+          label: '操作内容',
+          prop: 'content'
+        }
+      },
+      {
+        columnAttributes: {
+          label: 'ip',
+          prop: 'ip'
+        }
+      },
+      {
+        columnAttributes: {
+          label: '模块名称',
+          prop: 'moduleName'
+        }
+      }]
+    }
+  },
+  mounted() {
+    this.policyId && this.getCommonLogList()
+  },
+  methods: {
+    getCommonLogList() {
+      commonLogList({
+        objId: this.policyId,
+        pageNum: 1,
+        pageSize: -1
+      }).then(res => {
+        this.tableData = res.data.records
+      })
+    }
+  }
+
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 216 - 22
src/views/sales_policy/components/TabelTransfer.vue

@@ -265,24 +265,23 @@
         </el-upload>
         <el-button type="primary" size="mini" @click="hanleDownloadFilesPolicy">下载模板</el-button>
       </div>
-      <el-row type="flex" style="margin: 20px 0">
-        <el-col :xs="24" :sm="12" :lg="14">
+      <el-row style="margin: 20px 0">
+        <el-col :span="12">
           <el-input v-model="keyword2" placeholder="查找经销商" size="mini" />
         </el-col>
-        <el-col
-          :xs="24"
-          :sm="1"
-          :lg="1"
-          style="margin-left: 10px"
-        ><el-button size="mini" @click="submitScreenForm2">确定</el-button></el-col>
-        <el-col
-          :xs="24"
-          :sm="1"
-          :lg="1"
-          style="margin-left: 20px"
-        ><el-button size="mini" @click="resetScreenForm2">重置</el-button></el-col>
+        <el-col :span="10" style="margin-left: 20px">
+          <el-button size="mini" @click="submitScreenForm2">确定</el-button>
+          <el-button size="mini" @click="resetScreenForm2">重置</el-button>
+          <template v-if="batch">
+            <el-button v-if="list.length" type="primary" size="mini" @click="handelBatchData">批量修改上限</el-button>
+            <el-button v-if="list.length" type="primary" size="mini" @click="handelBatchData2">批量修改组数</el-button>
+          </template>
+        </el-col>
       </el-row>
-      <div style="font-size: 14px;">注:经销商最大提货套数仅与经销商相关联,与机型没有限制关联;机型订货上线仅对机型做限制</div>
+
+      <div style="font-size: 14px">
+        注:经销商最大提货套数仅与经销商相关联,与机型没有限制关联;机型订货上线仅对机型做限制
+      </div>
       <div>
         <div class="table">
           <el-table
@@ -296,10 +295,7 @@
             @select-all="handleSelectionAllChange2"
             @selection-change="handleSelectionChange2"
           >
-            <el-table-column
-              type="index"
-              width="50"
-            />
+            <el-table-column type="index" width="50" />
             <el-table-column
               prop="customerNumber"
               label="经销商编号
@@ -373,6 +369,96 @@
         <el-button type="primary" size="mini" @click="handleReset">重置</el-button>
       </el-row>
     </slot>
+    <el-dialog
+      title="批量修改"
+      :visible.sync="visible"
+      width="50%"
+      :append-to-body="true"
+      :close-on-click-modal="false"
+      @close="handleDialogVisible"
+    >
+      <el-row :gutter="20">
+        <el-col :span="24" style="display: flex; align-items: center; margin-bottom: 20px">
+          <el-col :span="4" :offset="0"> 购买量上限 </el-col>
+          <el-col :span="8" :offset="0"> <el-input v-model="limitQty" size="mini" /></el-col>
+        </el-col>
+        <el-col :span="24" :offset="0" style="margin-bottom: 20px">
+          <div style="display: flex">
+            <el-input v-model="limitQtyKeyWord" placeholder="输入关键字搜索" size="mini" />
+            <el-button style="margin-left: 20px" type="primary" size="mini" @click="handelBatchData('search')">查询</el-button>
+            <el-button size="mini" @click="onReset">重置</el-button>
+          </div>
+        </el-col>
+      </el-row>
+
+      <zj-table
+        :table-attributes="tableAttributes"
+        :table-events="tableEvents"
+        :is-drop="true"
+        :columns="columns"
+        :table-data="tableData"
+      />
+      <div style="margin: 20px 0">
+        <el-pagination
+          :current-page="batchCurrentPages"
+          :page-sizes="[10, 20, 30, 50]"
+          :page-size="10"
+          layout="total, sizes, prev, pager, next, jumper"
+          :total="batchTotal"
+          @size-change="handleBatchSizeChanges"
+          @current-change="handleBatchCurrentChanges"
+        />
+      </div>
+      <span slot="footer">
+        <el-button @click="handleDialogVisible">取消</el-button>
+        <el-button type="primary" @click="onSubmit('limit')">确定</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog
+      title="批量修改"
+      :visible.sync="maxBuyNumVisible"
+      width="50%"
+      :append-to-body="true"
+      :close-on-click-modal="false"
+      @close="handleDialogVisible"
+    >
+      <el-row :gutter="20">
+        <el-col :span="24" style="display: flex; align-items: cente; margin-bottom: 20px">
+          <el-col :span="5" :offset="0"> 最大提货组数 </el-col>
+          <el-col :span="8" :offset="0"> <el-input v-model="maxBuyNum" size="mini" /></el-col>
+        </el-col>
+        <el-col :span="24" :offset="0" style="margin-bottom: 20px">
+          <div style="display: flex">
+            <el-input v-model="maxBuyNumKeyWord" placeholder="输入关键字搜索" size="mini" clearable />
+            <el-button style="margin-left: 20px" type="primary" size="mini" @click="handelBatchData('search')">查询</el-button>
+            <el-button size="mini" @click="onReset">重置</el-button>
+          </div>
+        </el-col>
+      </el-row>
+
+      <zj-table
+        :table-attributes="tableAttributes"
+        :table-events="tableEvents"
+        :is-drop="true"
+        :columns="columns"
+        :table-data="tableData"
+      />
+      <div style="margin: 20px 0">
+        <el-pagination
+          :current-page="batchCurrentPages"
+          :page-sizes="[10, 20, 30, 50]"
+          :page-size="10"
+          layout="total, sizes, prev, pager, next, jumper"
+          :total="batchTotal"
+          @size-change="handleBatchSizeChanges"
+          @current-change="handleBatchCurrentChanges"
+        />
+      </div>
+      <span slot="footer">
+        <el-button @click="handleDialogVisible">取消</el-button>
+        <el-button type="primary" @click="onSubmit">确定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -383,7 +469,9 @@ import {
   getConditionList,
   getCrList,
   getCustomerList,
-  getPolicyList
+  getPolicyList,
+  updateCustomerCountBatch,
+  updateLimitBatchupdate
 } from '@/api/policy_list'
 import { downloadFiles, handleImport } from '@/utils/util'
 import ImageUpload from '@/components/Common/image-upload.vue'
@@ -392,11 +480,12 @@ import Minxin from '@/mixin'
 export default {
   name: 'Examine',
   components: {
+    // eslint-disable-next-line vue/no-unused-components
     ImageUpload
   },
   mixins: [Minxin],
   // eslint-disable-next-line vue/require-prop-types
-  props: ['code', 'yregion', 'policyType'],
+  props: ['code', 'yregion', 'policyType', 'batch'],
   data() {
     return {
       keyword: '',
@@ -466,12 +555,45 @@ export default {
       },
       list: [],
       cTotal: 1,
-      clistLoading: false
+      clistLoading: false,
+      visible: false,
+      maxBuyNumVisible: false,
+      tableData: [],
+      tableAttributes: {
+        selectColumn: true
+      },
+      tableEvents: {
+        'selection-change': this.selectionChange
+      },
+      limitQty: 0,
+      maxBuyNum: 0,
+      limitQtyKeyWord: '',
+      maxBuyNumKeyWord: '',
+      selectedData: [],
+      batchCurrentPages: 1,
+      batchPageSizes: 10,
+      batchTotal: 0
     }
   },
   computed: {
     adminWebsit() {
       return JSON.parse(localStorage.getItem('supply_user')).adminWebsit
+    },
+    columns() {
+      return [
+        {
+          columnAttributes: {
+            label: '经销商编码',
+            prop: 'customerNumber'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '经销商名称',
+            prop: 'customerName'
+          }
+        }
+      ]
     }
   },
   watch: {
@@ -801,6 +923,78 @@ export default {
       this.dataR = this.rightData = []
       this.keyword = ''
       this.$emit('handleReset')
+    },
+    selectionChange(data) {
+      this.selectedData = data
+    },
+    handelBatchData(search) {
+      if (search) {
+        this.batchCurrentPages = 1
+      }
+      getPolicyList({
+        pageNum: this.batchCurrentPages,
+        pageSize: this.batchPageSizes,
+        policyId: this.comCode || this.code,
+        keyword: this.limitQtyKeyWord
+      }).then(res => {
+        this.tableData = res.data.records
+        this.batchTotal = res.data.total
+      })
+      this.visible = true
+    },
+    handelBatchData2() {
+      this.maxBuyNumVisible = true
+    },
+    handleDialogVisible() {
+      this.visible = false
+      this.maxBuyNumVisible = false
+      this.batchCurrentPages = 1
+      this.batchPageSizes = 10
+      this.limitQty = 0
+      this.maxBuyNum = 0
+      this.limitQtyKeyWord = ''
+      this.maxBuyNumKeyWord = ''
+    },
+    onSubmit(type) {
+      if (!this.selectedData.length) {
+        this.$errorMsg('不能为空,请选择')
+        return
+      }
+      if (this.limitQty <= 0 || this.maxBuyNum <= 0) {
+        this.$errorMsg(type ? '购买量上限不能小于0' : '最大提货组数不能小于0')
+        return
+      }
+      const customerIds = this.selectedData
+        .map(k => {
+          return k.customerId
+        })
+        .join('')
+      const params = {
+        customerIds,
+        policyId: this.comCode || this.code
+      }
+      if (type) {
+        params.limitQty = this.limitQty
+      } else {
+        params.maxBuyNum = this.maxBuyNum
+      }
+      updateLimitBatchupdate(params).then(res => {
+        this.handleDialogVisible()
+        this.$successMsg('批量修改成功')
+      })
+    },
+    handleBatchSizeChanges(val) {
+      this.batchCurrentPages = 1
+      this.batchPageSizes = val
+      this.handelBatchData()
+    },
+    onReset() {
+      this.handleDialogVisible()
+      this.handelBatchData()
+    },
+    handleBatchCurrentChanges(val) {
+      this.batchCurrentPages = val
+      this.handelBatchData()
     }
   }
 }

+ 164 - 0
src/views/sales_policy/components/delayRecordForm.vue

@@ -0,0 +1,164 @@
+<template>
+  <div>
+    <div>
+      <h4>政策延期</h4>
+      <el-divider />
+      <zj-table
+        :table-attributes="tableAttributes"
+        :is-drop="true"
+        :columns="columns"
+        :table-data="tableData"
+      />
+    </div>
+    <div style="margin: 20px 0;text-align: right;">
+      <el-button type="primary" size="mini" @click="onClose">取消</el-button>
+      <el-button type="primary" size="mini" @click="onSubmit">确定</el-button>
+    </div>
+  </div>
+</template>
+
+<script>
+import { updateDelayPolicy } from '@/api/policy_list'
+export default {
+  props: {
+    recordSelected: {
+      type: Array,
+      default: () => []
+    }
+  },
+  data() {
+    return {
+      tableData: [],
+      tableAttributes: {}
+    }
+  },
+  computed: {
+    columns() {
+      return [
+        {
+          columnAttributes: {
+            label: '销售政策编码',
+            prop: 'code'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '销售政策名称',
+            prop: 'title'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '销售政策类型',
+            prop: 'type'
+          },
+          render: (h, { column, row, index }) => {
+            return (
+              <div>
+                {row.type === 'PROVISION' ? '配提' : '限量'}
+              </div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '生效日期',
+            prop: 'startTime'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '失效日期',
+            prop: 'endTime'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '延期日期',
+            prop: 'materialName'
+          },
+          render: (h, { column, row, index }) => {
+            return <div style='margin:0 10px'>
+              <el-date-picker
+                style='width:100%'
+                value={row.date}
+                onInput={e => { row.date = e }}
+                type='datetime'
+                size='mini'
+                default-time='00:00:00'
+                picker-options={ this.setDisabled(row.startTime) }
+                value-format='yyyy-MM-dd HH:mm:ss'
+                placeholder='选择日期'>
+              </el-date-picker>
+            </div>
+          }
+        },
+        {
+          columnAttributes: {
+            label: '操作',
+            prop: ''
+          },
+          render: (h, { column, row, index }) => {
+            return (
+              <div>
+                <el-button
+                  type='text'
+                  size='default'
+                  onClick={() => {
+                    this.tableData.splice(index, 1)
+                  }}
+                >
+                      删除
+                </el-button>
+              </div>
+            )
+          }
+        }
+      ]
+    }
+  },
+  mounted() {
+    this.recordSelected.forEach(k => {
+      this.$set(k, 'date', '')
+    })
+    this.tableData = this.recordSelected
+  },
+  methods: {
+    setDisabled(e) {
+      return {
+        disabledDate: time => {
+          return time.getTime() < new Date(e).getTime() + 24 * 3600 * 1000
+        }
+      }
+    },
+    onSubmit() {
+      if (!this.tableData.every(k => !!k.endTime)) {
+        this.$errorMsg('政策没有失效时间不能延迟')
+        return
+      }
+      if (!this.tableData.every(k => !!k.date)) {
+        this.$errorMsg('请选择日期时间')
+        return
+      }
+      const list = this.tableData.map(k => {
+        return {
+          endTime: k.date,
+          policyId: k.id
+        }
+      })
+      updateDelayPolicy(list).then(res => {
+        this.$successMsg('批量修改成功')
+        this.onClose()
+      })
+    },
+    onClose() {
+      this.$emit('close')
+    }
+  }
+}
+</script>
+
+  <style lang="scss" scoped>
+
+  </style>
+

+ 214 - 100
src/views/sales_policy/components/details.vue

@@ -61,7 +61,23 @@
                 {{ detail.endTime }}
               </div>
             </el-col>
+            <template v-if="detail.type === 'LIMIT'">
+
+              <el-col :span="12" class="item">
+                <div class="label">商家最少起提数量</div>
+                <div class="value">
+                  {{ detail.minBuyNum }}
+                </div>
+              </el-col>
+              <el-col :span="12" class="item">
+                <div class="label">商家最大提货组数</div>
+                <div class="value">
+                  {{ detail.maxBuyNum }}
+                </div>
+              </el-col>
+            </template>
           </el-row>
+
           <el-row v-if="detail.imgSrc && isShow !== 5" class="img-box">
             <el-col :span="24" class="item">
               <div class="label" style="height: 150px">政策封面图</div>
@@ -76,9 +92,9 @@
                     :preview-src-list="[$imageUrl + item]"
                     class="elImageClose"
                   />
-                  <img v-if="checkFileType(item) == 'word'" class="file" src="@/assets/common/word.png" />
-                  <img v-if="checkFileType(item) == 'excel'" class="file" src="@/assets/common/excel.png" />
-                  <img v-if="checkFileType(item) == 'ppt'" class="file" src="@/assets/common/ppt.png" />
+                  <img v-if="checkFileType(item) == 'word'" class="file" src="@/assets/common/word.png">
+                  <img v-if="checkFileType(item) == 'excel'" class="file" src="@/assets/common/excel.png">
+                  <img v-if="checkFileType(item) == 'ppt'" class="file" src="@/assets/common/ppt.png">
 
                   <img
                     v-if="checkFileType(item) == 'pdf'"
@@ -86,9 +102,9 @@
                     style="cursor: pointer"
                     src="@/assets/common/pdf.png"
                     @click="openPdf(item)"
-                  />
+                  >
 
-                  <img v-if="checkFileType(item) == 'file'" class="file aaa" src="@/assets/common/zip.jpeg" />
+                  <img v-if="checkFileType(item) == 'file'" class="file aaa" src="@/assets/common/zip.jpeg">
                 </template>
                 <!-- <el-image
                   v-for="item in detail.imgSrc"
@@ -104,7 +120,7 @@
             <el-col :span="24" class="item">
               <div class="label" style="height: 150px">政策封面图</div>
               <div class="value" style="height: 150px">
-                <ImageUpload :file-list="fileList" :multiple="false" />
+                <image-upload :file-list="fileList" :multiple="false" />
               </div>
             </el-col>
           </el-row>
@@ -169,9 +185,7 @@
                   <el-button size="mini">导入货品价格表</el-button>
                 </el-upload>
               </el-col>
-              <el-col :span="12" class="tr">
-
-              </el-col>
+              <el-col :span="12" class="tr" />
             </el-row>
             <el-divider />
           </el-row>
@@ -354,8 +368,7 @@
                     <template slot-scope="scope">
                       <CopyButton :copy-text="scope.row.customerNumber" />
                       <span>{{ scope.row.customerNumber }}</span>
-                    </template></el-table-column
-                  >
+                    </template></el-table-column>
                   <el-table-column prop="customerName" label="经销商名称" align="left">
                     <template slot-scope="scope">
                       <CopyButton :copy-text="scope.row.customerName" />
@@ -424,13 +437,11 @@
                 </el-col>
                 <el-col :span="4" class="middle_box" :offset="0">
                   <el-col>
-                    <el-button size="mini" :disabled="type == 2" @click="handleAllAdd">全部添加</el-button></el-col
-                  >
+                    <el-button size="mini" :disabled="type == 2" @click="handleAllAdd">全部添加</el-button></el-col>
                   <el-col> <el-button size="mini" :disabled="type == 2" @click="handleAdd">增加</el-button></el-col>
                   <el-col> <el-button size="mini" :disabled="type == 1" @click="handleDelete">删除</el-button></el-col>
                   <el-col>
-                    <el-button size="mini" :disabled="type == 1" @click="handleAllDelete">全部删除</el-button></el-col
-                  >
+                    <el-button size="mini" :disabled="type == 1" @click="handleAllDelete">全部删除</el-button></el-col>
                 </el-col>
                 <el-col :span="10" :offset="0">
                   <h5>已选经销商</h5>
@@ -478,36 +489,8 @@
                 </el-col>
               </el-row>
             </template>
+
             <template>
-              <div style="margin: 20px 0">
-                <!-- <el-upload
-        class="import-btn"
-        :action="baseURL + 'student/import'"
-        :http-request="handleImports"
-        :file-list="importFileList"
-        :show-file-list="false"
-      >
-        <el-button type="primary" size="mini">导入经销商</el-button>
-      </el-upload> -->
-                <!-- <el-button type="primary" size="mini" @click="hanleDownloadFilesPolicy"
-        >下载模板</el-button
-      > -->
-              </div>
-              <!-- <el-row type="flex" style="margin: 20px 0">
-      <el-col :xs="24" :sm="12" :lg="14">
-        <el-input v-model="keyword2" placeholder="查找经销商" size="mini" />
-      </el-col>
-      <el-col :xs="24" :sm="1" :lg="1" style="margin-left: 10px"
-        ><el-button size="mini" @click="submitScreenForm2"
-          >确定</el-button
-        ></el-col
-      >
-      <el-col :xs="24" :sm="1" :lg="1" style="margin-left: 20px"
-        ><el-button size="mini" @click="resetScreenForm2"
-          >重置</el-button
-        ></el-col
-      >
-    </el-row> -->
               <div style="dispaly: flex">
                 <h4 style="display: inline-block; margin-right: 20px">经销商上限</h4>
                 <ExportButton
@@ -515,9 +498,10 @@
                   :ex-url="'policy/limit/export'"
                   :ex-params="exParams"
                 />
+                <el-button v-if="list.length" type="primary" size="mini" @click="handelBatchData">批量修改</el-button>
+
                 <el-divider />
               </div>
-
               <div>
                 <div class="table">
                   <el-table
@@ -531,67 +515,41 @@
                     @select-all="handleSelectionAllChange2"
                     @selection-change="handleSelectionChange2"
                   >
-                    <!-- <el-table-column type="selection" width="55" align="left" /> -->
-                    <el-table-column
-                      prop="customerNumber"
-                      label="经销商编号
-"
-                      align="left"
-                    >
-                      <template slot-scope="scope">
-                        <CopyButton :copy-text="scope.row.customerNumber" />
-                        <span>{{ scope.row.customerNumber }}</span>
-                      </template>
-                    </el-table-column>
                     <el-table-column prop="customerName" label="经销商名称" align="left">
                       <template slot-scope="scope">
                         <CopyButton :copy-text="scope.row.customerName" />
                         <span>{{ scope.row.customerName }}</span>
                       </template>
                     </el-table-column>
-                    <el-table-column
-                      prop="materialName"
-                      label="物料名称
 
-"
-                      align="left"
-                    >
+                    <el-table-column prop="maxBuyNum" label="最大配套套数" align="left">
                       <template slot-scope="scope">
-                        <CopyButton :copy-text="scope.row.materialName" />
-                        <span>{{ scope.row.materialName }}</span>
+                        {{ scope.row.maxBuyNum }}
                       </template>
                     </el-table-column>
-                    <el-table-column
-                      prop="materialNumber"
-                      label="物料编号
-"
-                      align="left"
-                    >
+                    <el-table-column prop="examineOrderNums" label="已审订单数" align="left">
                       <template slot-scope="scope">
-                        <CopyButton :copy-text="scope.row.materialNumber" />
-                        <span>{{ scope.row.materialNumber }}</span>
+                        {{ scope.row.examineOrderNums }}
                       </template>
                     </el-table-column>
-                    <el-table-column
-                      prop="examineOrderNums"
-                      label="已审订单数
-"
-                      align="left"
-                    >
+                    <el-table-column prop="orderNums" label="已下订单数" align="left">
                       <template slot-scope="scope">
-                        {{ scope.row.examineOrderNums | numToFixed }}
+                        {{ scope.row.orderNums }}
                       </template>
                     </el-table-column>
-
-                    <el-table-column
-                      prop="limitQty"
-                      label="购买量上限
-
-"
-                      align="left"
-                    >
+                    <el-table-column prop="materialName" label="物料名称" align="left">
                       <template slot-scope="scope">
-                        {{ scope.row.limitQty | numToFixed }}
+                        {{ scope.row.materialName }}
+                      </template>
+                    </el-table-column>
+                    <el-table-column prop="materialNumber" label="物料编号" align="left">
+                      <template slot-scope="scope">
+                        {{ scope.row.materialNumber }}
+                      </template>
+                    </el-table-column>
+                    <el-table-column prop="limitQty" label="订货上限" align="left">
+                      <template slot-scope="scope">
+                        {{ scope.row.limitQty }}
                       </template>
                     </el-table-column>
                   </el-table>
@@ -641,8 +599,56 @@
           <el-button v-if="isShow == 5" type="primary" size="default" @click="handleSave">保存</el-button>
         </div>
       </div>
+      <operation-records v-if="detail" :policy-id="detail.code" />
+      <el-dialog
+        title="批量修改"
+        :visible.sync="visible"
+        width="50%"
+        :append-to-body="true"
+        :close-on-click-modal="false"
+        @close="handleDialogVisible"
+      >
+        <el-row :gutter="20">
+          <el-col :span="24" style="display: flex; align-items: center; margin-bottom: 20px">
+            <el-col :span="4" :offset="0"> 最小起起提数 </el-col>
+            <el-col :span="8" :offset="0"> <el-input v-model="minBuyNum" size="mini" /></el-col>
+            <el-col :span="4" :offset="0"> 最大可提组数 </el-col>
+            <el-col :span="8" :offset="0"> <el-input v-model="maxBuyNum" size="mini" /></el-col>
+          </el-col>
+          <el-col :span="24" :offset="0" style="margin-bottom: 20px">
+            <div style="display: flex">
+              <el-input v-model="buyNumKeyWord" placeholder="输入关键字搜索" size="mini" />
+              <el-button style="margin-left: 20px" type="primary" size="mini" @click="handelBatchData('search')">查询</el-button>
+              <el-button size="mini" @click="onReset">重置</el-button>
+            </div>
+          </el-col>
+        </el-row>
+
+        <zj-table
+          :table-attributes="tableAttributes"
+          :table-events="tableEvents"
+          :is-drop="true"
+          :columns="columns"
+          :table-data="tableData"
+        />
+        <div style="margin: 20px 0">
+          <el-pagination
+            :current-page="batchCurrentPages"
+            :page-sizes="[10, 20, 30, 50]"
+            :page-size="10"
+            layout="total, sizes, prev, pager, next, jumper"
+            :total="batchTotal"
+            @size-change="handleBatchSizeChanges"
+            @current-change="handleBatchCurrentChanges"
+          />
+        </div>
+        <span slot="footer">
+          <el-button @click="handleDialogVisible">取消</el-button>
+          <el-button type="primary" @click="onSubmit('limit')">确定</el-button>
+        </span>
+      </el-dialog>
     </div>
-    <AddCondition v-else :id="cid" @close="handleConditionClose" @back="handleBack" :isEdit="isEdit" :isShow="isShow"/>
+    <add-condition v-else :id="cid" :is-edit="isEdit" :is-show="isShow" @close="handleConditionClose" @back="handleBack" />
   </div>
 </template>
 
@@ -657,11 +663,12 @@ import {
   getPolicyDetail,
   toExamine,
   updatePolicy,
-  getPolicyList
+  getPolicyList,
+  updateLimitBatchupdate
 } from '@/api/policy_list'
 import AddCondition from './AddCondition'
 import ImageUpload from '@/components/Common/image-upload.vue'
-
+import OperationRecords from './OperationRecords.vue'
 import { handleImport } from '@/utils/util'
 
 import Minxin from '@/mixin'
@@ -670,10 +677,11 @@ export default {
   name: 'Examine',
   components: {
     AddCondition,
-    ImageUpload
+    ImageUpload,
+    OperationRecords
   },
-  props: ['id', 'isShow'],
   mixins: [Minxin],
+  props: ['id', 'isShow'],
   data() {
     return {
       baseURL: '',
@@ -742,7 +750,25 @@ export default {
       },
       list: [],
       cTotal: 1,
-      clistLoading: false
+      clistLoading: false,
+      visible: false,
+      maxBuyNumVisible: false,
+      tableData: [],
+      tableAttributes: {
+        selectColumn: true
+      },
+      tableEvents: {
+        'selection-change': this.selectionChange
+      },
+      limitQty: 0,
+      maxBuyNum: 0,
+      minBuyNum: 0,
+      limitQtyKeyWord: '',
+      buyNumKeyWord: '',
+      selectedData: [],
+      batchCurrentPages: 1,
+      batchPageSizes: 10,
+      batchTotal: 0
     }
   },
   computed: {
@@ -750,6 +776,22 @@ export default {
       return {
         policyId: this.detail.code
       }
+    },
+    columns() {
+      return [
+        {
+          columnAttributes: {
+            label: '经销商编码',
+            prop: 'customerNumber'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '经销商名称',
+            prop: 'customerName'
+          }
+        }
+      ]
     }
   },
   created() {},
@@ -761,7 +803,7 @@ export default {
       const title = '详情页'
       return title
     },
-    handleBack(){
+    handleBack() {
       this.isEdit = 1
     },
     getList() {
@@ -845,9 +887,9 @@ export default {
         }
         this.dataL = res.data.records
         for (let k = 0; k < this.dataL.length; k++) {
-          ;(this.dataL[k].customerId = this.dataL[k].id),
-            (this.dataL[k].customerName = this.dataL[k].name),
-            (this.dataL[k].customerNumber = this.dataL[k].number)
+          (this.dataL[k].customerId = this.dataL[k].id),
+          (this.dataL[k].customerName = this.dataL[k].name),
+          (this.dataL[k].customerNumber = this.dataL[k].number)
         }
 
         console.log(this.dataL, '获取经销商列表')
@@ -994,7 +1036,7 @@ export default {
      * @param {String} index - 索引值
      * @return Boolean
      */
-    selectable: function (row, index) {
+    selectable: function(row, index) {
       // row.disabled == undefined 才能被选中
       if (row.disabled == undefined || row.disabled == false) {
         return true
@@ -1119,6 +1161,78 @@ export default {
         this.fileList = []
         this.isShow = 1
       }
+    },
+    selectionChange(data) {
+      this.selectedData = data
+    },
+    handelBatchData(search) {
+      if (search) {
+        this.batchCurrentPages = 1
+      }
+      getPolicyList({
+        pageNum: this.batchCurrentPages,
+        pageSize: this.batchPageSizes,
+        policyId: this.id,
+        keyword: this.buyNumKeyWord
+      }).then(res => {
+        this.tableData = res.data.records
+        this.batchTotal = res.data.total
+      })
+      this.visible = true
+    },
+    handelBatchData2() {
+      this.maxBuyNumVisible = true
+    },
+    handleDialogVisible() {
+      this.visible = false
+      this.maxBuyNumVisible = false
+      this.batchCurrentPages = 1
+      this.batchPageSizes = 10
+      this.limitQty = 0
+      this.maxBuyNum = 0
+      this.minBuyNum = ''
+      this.limitQtyKeyWord = ''
+      this.buyNumKeyWord = ''
+    },
+    onSubmit(type) {
+      if (!this.selectedData.length) {
+        this.$errorMsg('不能为空,请选择')
+        return
+      }
+      if (this.minBuyNum <= 0) {
+        this.$errorMsg('最小起起提数不能小于0')
+        return
+      }
+      const customerIds = this.selectedData
+        .map(k => {
+          return k.customerId
+        })
+        .join('')
+      const params = {
+        customerIds,
+        policyId: this.id,
+        minBuyNum: this.minBuyNum,
+        maxBuyNum: this.maxBuyNum
+      }
+
+      updateLimitBatchupdate(params).then(res => {
+        this.handleDialogVisible()
+        this.$successMsg('批量修改成功')
+      })
+    },
+
+    handleBatchSizeChanges(val) {
+      this.batchCurrentPages = 1
+      this.batchPageSizes = val
+      this.handelBatchData()
+    },
+    handleBatchCurrentChanges(val) {
+      this.batchCurrentPages = val
+      this.handelBatchData()
+    },
+    onReset() {
+      this.handleDialogVisible()
+      this.handelBatchData()
     }
   }
 }

+ 86 - 35
src/views/sales_policy/components/editPolicy.vue

@@ -82,6 +82,19 @@
                   <el-input v-model="searchForm.remark" placeholder="新风机变频挂机。按提货数量1:3开单" />
                 </el-form-item>
               </el-col>
+              <template v-if="searchForm.type === 'LIMIT'">
+
+                <el-col :xs="24" :ms="12" :lg="12">
+                  <el-form-item label="商家最少起提数量" prop="minBuyNum">
+                    <el-input v-model.number="searchForm.minBuyNum" type="number" placeholder="商家最少起提数量" />
+                  </el-form-item>
+                </el-col>
+                <el-col :xs="24" :ms="12" :lg="12">
+                  <el-form-item label="商家最大提货组数" prop="maxBuyNum">
+                    <el-input v-model.number="searchForm.maxBuyNum" type="number" placeholder="商家最大提货组数" />
+                  </el-form-item>
+                </el-col>
+              </template>
               <el-col :xs="24" :ms="24" :lg="24">
                 <el-form-item label="政策封面图">
                   <ImageUpload class="elImageClose" :file-list="fileList" multiple :limit="3" />
@@ -120,10 +133,10 @@
               :data="dataList"
               row-key="index"
               use-virtual
-              fixedColumnsRoll
-              :dataChangesScrollTop="false"
+              fixed-columns-roll
+              :data-changes-scroll-top="false"
               inverse-current-row
-              bigDataCheckbox
+              big-data-checkbox
               element-loading-text="Loading"
               max-height="700"
               border
@@ -249,13 +262,20 @@
                   <template v-if="scope.row.fang">
                     {{ scope.row.priceType }}
                   </template>
-                  <el-input
+                  <el-select
                     v-else
                     v-model="scope.row.priceType"
-                    placeholder="价格类型"
                     size="mini"
+                    filterable
                     @change="setText($event, scope.$index, scope.row, 'priceType')"
-                  />
+                  >
+                    <el-option
+                      v-for="item in priceList"
+                      :key="item.priceTypeId"
+                      :label="item.priceTypeName"
+                      :value="item.priceTypeId"
+                    />
+                  </el-select>
                 </template>
               </pl-table-column>
               <pl-table-column prop="price" label="单价" align="right" show-overflow-tooltip min-width="150">
@@ -343,8 +363,11 @@
               </pl-table-column>
               <pl-table-column fixed="right" label="操作" align="center" min-width="150">
                 <template slot-scope="scope">
-                  <el-button type="text" class="textColor el-popover-left" @click="scope.row.fang = !scope.row.fang"
-                    >编辑
+                  <el-button
+                    type="text"
+                    class="textColor el-popover-left"
+                    @click="scope.row.fang = !scope.row.fang"
+                  >编辑
                   </el-button>
                   <el-popconfirm
                     confirm-button-text="好的"
@@ -386,7 +409,7 @@
           <div style="margin: 20px 20px 20px 0; display: flex; justify-content: space-between">
             <div>
               <el-button type="primary" size="mini" @click="handleNewInfo">添加</el-button>
-              <el-button type="primary" size="mini" @click="handleSave" v-loading="fullscreenLoading">保存</el-button>
+              <el-button v-loading="fullscreenLoading" type="primary" size="mini" @click="handleSave">保存</el-button>
             </div>
             <!--            <el-pagination-->
             <!--              :current-page="dcurrentPage"-->
@@ -431,7 +454,7 @@
                     scope.row.fang = false
                     conditName = scope.row.name
                   "
-                  >编辑
+                >编辑
                 </el-button>
                 <el-button type="text" size="mini" @click="handleCondition(scope.row.id, scope.$index)">删除</el-button>
                 <el-button type="text" size="mini" @click="catCond(scope.row)">查看条件</el-button>
@@ -452,7 +475,9 @@
           <TabelTransfer
             v-if="detail && detail.code"
             :code="detail.code"
+            :batch="true"
             :yregion="region"
+            :policy-type="searchForm.type"
             @handlEditPolicy="handlEditPolicy"
             @handleReset="handleReset"
           />
@@ -463,21 +488,21 @@
       v-show="isCondition === 1"
       ref="comDom"
       :code="searchForm.code"
+      :is-show="isShow"
+      :is-flag="isFlag"
+      :is-condition="isCondition"
       @handleSubmitCon="handleSubmitCon"
       @back="handleBack"
-      :isShow="isShow"
-      :isFlag="isFlag"
-      :isCondition="isCondition"
     />
     <AddCondition
       v-show="isCondition === 2"
       :id="cid"
       ref="cond"
       :code="searchForm.code"
-      :isShow="isShow"
-      :isFlag="isFlag"
+      :is-show="isShow"
+      :is-flag="isFlag"
+      :is-condition="isCondition"
       @back="handleBack"
-      :isCondition="isCondition"
     />
   </div>
 </template>
@@ -500,6 +525,8 @@ import {
   updatePolicy,
   setStauts
 } from '@/api/policy_list'
+import { getProductPriceListV2 } from '@/api/priceType'
+
 import { downloadFiles, handleImport } from '@/utils/util'
 // import Transfer from './Transfer'
 import TabelTransfer from './TabelTransfer'
@@ -509,18 +536,6 @@ import ImageUpload from '@/components/Common/image-upload.vue'
 import { PlTable, PlTableColumn } from 'pl-table'
 
 export default {
-  props: {
-    id: {
-      type: String,
-      default: ''
-    },
-    isShow: {
-      type: Number
-    },
-    isFlag: {
-      type: [Number, String]
-    }
-  },
   directives: {
     'el-select-loadmore': {
       bind(el, binding) {
@@ -530,7 +545,7 @@ export default {
           '.el-table__body-wrapper'
           // '.el-select-dropdown .el-select-dropdown__wrap'
         )
-        SELECTWRAP_DOM.addEventListener('scroll', function () {
+        SELECTWRAP_DOM.addEventListener('scroll', function() {
           /**
            * scrollHeight 获取元素内容⾼度(只读)
            * scrollTop 获取或者设置元素的偏移值,常⽤于, 计算滚动条的位置, 当⼀个元素的容器没有产⽣垂直⽅向的滚动条, 那它的scrollTop的值默认为0.
@@ -547,6 +562,18 @@ export default {
     }
   },
   mixins: [Minxin],
+  props: {
+    id: {
+      type: String,
+      default: ''
+    },
+    isShow: {
+      type: Number
+    },
+    isFlag: {
+      type: [Number, String]
+    }
+  },
   data() {
     return {
       fang: false,
@@ -564,7 +591,9 @@ export default {
         mainName: '',
         type: '',
         isFullRebate: false,
-        commercialType: false
+        commercialType: false,
+        maxBuyNum: 0,
+        minBuyNum: 0
       },
       conditName: '',
       dataList: [],
@@ -602,7 +631,8 @@ export default {
       cpolicyId: '',
       region: 0,
       fullscreenLoading: false,
-      srcList: []
+      srcList: [],
+      priceList: []
     }
   },
   computed: {
@@ -621,6 +651,11 @@ export default {
       })
     },
     setText(e, index, row, name) {
+      if (name === 'priceType') {
+        console.log(e, this.priceList.find(k => k.priceTypeId === e).priceTypeName)
+        this.dataList[index][name] = this.priceList.find(k => k.priceTypeId === e).priceTypeName
+        return
+      }
       this.dataList[index][name] = row[name]
     },
     // 下载excel模板
@@ -729,6 +764,12 @@ export default {
       const typeData = await getTypeList(params)
 
       this.typeList = typeData.data.records
+      getProductPriceListV2({
+        pageNum: 1,
+        pageSize: -1
+      }).then(res => {
+        this.priceList = res.data.records
+      })
     },
     handleSalesType(e, row, index, name) {
       let item
@@ -832,10 +873,13 @@ export default {
           title: this.detail.title,
           type: this.detail.type,
           isFullRebate: this.detail.isFullRebate,
-          commercialType: this.detail.commercialType
+          commercialType: this.detail.commercialType,
+          maxBuyNum: this.detail.maxBuyNum,
+          minBuyNum: this.detail.minBuyNum
+
         }
         this.region = res.data.flag
- 
+
         // this.srcList = [this.$imageUrl + this.detail.imgSrc]
         if (this.isShow === 3 && this.detail.imgSrc) {
           this.detail.imgSrc.split(',').forEach(k => {
@@ -911,6 +955,12 @@ export default {
                 k.walletIds = [...k.walletIds, d.walletId]
               }
             }
+            k.priceType
+            this.priceList.forEach(k => {
+              if (k.priceTypeName === k.priceType) {
+                k.priceType = k.priceTypeId
+              }
+            })
           })
 
           this.dataList = result.data.records
@@ -954,7 +1004,7 @@ export default {
         //     this.searchForm.mainName = k.dictValue;
         //   }
         // });
-        let imgUrl = []
+        const imgUrl = []
         this.fileList.forEach(k => {
           imgUrl.push(k.url)
         })
@@ -1086,9 +1136,10 @@ export default {
     },
     handleBack() {
       this.isCondition = 0
- 
+
       this.$emit('upDataIsFlag')
     }
+
   },
   components: {
     // Transfer,

+ 420 - 0
src/views/sales_policy/components/replaceRecordForm.vue

@@ -0,0 +1,420 @@
+<template>
+  <div>
+    <div>
+      <h4>旧机型</h4>
+      <el-divider />
+      <zj-table :table-attributes="tableAttributes" :is-drop="true" :columns="oldColumns" :table-data="oldData" />
+      <div style="margin: 20px 0; text-align: right">
+        <el-button size="mini" @click="handleQuery">查询机型</el-button>
+      </div>
+    </div>
+    <div>
+      <h4>有效政策</h4>
+      <el-divider />
+      <zj-table
+        :table-attributes="{
+          ...tableAttributes, selectColumn: true
+        }"
+        :table-events="tableEvents"
+        :is-drop="true"
+        :columns="policyColumns"
+        :table-data="policyList"
+      />
+    </div>
+    <div>
+      <h4>新机型</h4>
+      <el-divider />
+      <zj-table :table-attributes="tableAttributes" :is-drop="true" :columns="newColumns" :table-data="newData" />
+    </div>
+    <div style="margin: 20px 0;text-align: right;">
+      <el-button type="primary" size="mini" @click="onClose">取消</el-button>
+      <el-button type="primary" size="mini" @click="onSubmit">确定</el-button>
+    </div>
+  </div>
+</template>
+
+<script>
+import { updateMaterialPolicy, getK3List, getList } from '@/api/policy_list'
+
+export default {
+  props: {
+    recordSelected: {
+      type: Array,
+      default: () => []
+    }
+  },
+  data() {
+    return {
+      loading: false,
+      oldData: [
+        {
+          name: '',
+          number: '',
+          specification: ''
+        }
+      ],
+      k3List: [],
+      newK3List: [],
+      policyList: [],
+      selectedData: [],
+      newData: [
+        {
+          name: '',
+          number: '',
+          specification: ''
+        }
+      ],
+      tableAttributes: {},
+      tableEvents: {
+        'selection-change': this.selectionChange
+      }
+    }
+  },
+  computed: {
+    oldColumns() {
+      return [
+        {
+          columnAttributes: {
+            label: '货品编码',
+            prop: 'number'
+          },
+          render: (h, { column, row, index }) => {
+            return (
+              <div style='margin:0 10px'>
+                <el-select
+                  style='width:100%'
+                  value={row.number}
+                  onInput={e => (row.number = e)}
+                  onChange={e => this.setCheckeData(e, 'old')}
+                  filterable
+                  size='mini'
+                  remote
+                  reserve-keyword
+                  placeholder='请输入关键词'
+                  remote-method={e => this.remoteMethod(e, 'number', 'old')}
+                  loading={this.loading}
+                >
+                  {this.k3List.map(k => {
+                    return <el-option key={k.id} label={k.number} value={k.id}></el-option>
+                  })}
+                </el-select>
+              </div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '货品名称',
+            prop: 'name'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '规格型号',
+            prop: 'specification'
+          },
+          render: (h, { column, row, index }) => {
+            return (
+              <div style='margin:0 10px'>
+                <el-select
+                  style='width:100%'
+                  value={row.specification}
+                  onInput={e => (row.specification = e)}
+                  onChange={e => this.setCheckeData(e, 'old')}
+                  filterable
+                  size='mini'
+                  remote
+                  reserve-keyword
+                  placeholder='请输入规格型号'
+                  remote-method={e => this.remoteMethod(e, 'specification', 'old')}
+                  loading={this.loading}
+                >
+                  {this.k3List.map(k => {
+                    return <el-option key={k.id} label={k.specification} value={k.id}></el-option>
+                  })}
+                </el-select>
+              </div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '单价',
+            prop: 'title'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '操作',
+            prop: ''
+          },
+          render: (h, { column, row, index }) => {
+            return (
+              <div>
+                <el-button
+                  type='text'
+                  size='default'
+                  onClick={() => {
+                    this.oldData = [
+                      {
+                        name: '',
+                        number: '',
+                        specification: ''
+                      }
+                    ]
+                  }}
+                >
+                  清空
+                </el-button>
+              </div>
+            )
+          }
+        }
+      ]
+    },
+    policyColumns() {
+      return [
+        {
+          columnAttributes: {
+            label: '政策编码',
+            prop: 'code'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '政策名称',
+            prop: 'title'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '政策类型',
+            prop: 'type'
+          },
+          render: (h, { column, row, index }) => {
+            return (
+              <div>
+                {row.type === 'PROVISION' ? '配提' : '限量'}
+              </div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '操作',
+            prop: ''
+          },
+          render: (h, { column, row, index }) => {
+            return (
+              <div>
+                <el-button type='text' size='default' onClick={() => {
+                  this.policyList.splice(index, 1)
+                }}>
+                  删除
+                </el-button>
+              </div>
+            )
+          }
+        }
+      ]
+    },
+    newColumns() {
+      return [
+        {
+          columnAttributes: {
+            label: '货品编码',
+            prop: 'number'
+          },
+          render: (h, { column, row, index }) => {
+            return (
+              <div style='margin:0 10px'>
+                <el-select
+                  style='width:100%'
+                  value={row.number}
+                  onInput={e => (row.number = e)}
+                  onChange={e => this.setCheckeData(e)}
+                  filterable
+                  size='mini'
+                  remote
+                  reserve-keyword
+                  placeholder='请输入关键词'
+                  remote-method={e => this.remoteMethod(e, 'number')}
+                  loading={this.loading}
+                >
+                  {this.newK3List.map(k => {
+                    return <el-option key={k.id} label={k.number} value={k.id}></el-option>
+                  })}
+                </el-select>
+              </div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '货品名称',
+            prop: 'name'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '规格型号',
+            prop: 'specification'
+          },
+          render: (h, { column, row, index }) => {
+            return (
+              <div style='margin:0 10px'>
+                <el-select
+                  style='width:100%'
+                  value={row.specification}
+                  onInput={e => (row.specification = e)}
+                  onChange={e => this.setCheckeData(e)}
+                  filterable
+                  size='mini'
+                  remote
+                  reserve-keyword
+                  placeholder='请输入规格型号'
+                  remote-method={e => this.remoteMethod(e, 'specification')}
+                  loading={this.loading}
+                >
+                  {this.newK3List.map(k => {
+                    return <el-option key={k.id} label={k.specification} value={k.id}></el-option>
+                  })}
+                </el-select>
+              </div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '单价',
+            prop: 'title'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '操作',
+            prop: ''
+          },
+          render: (h, { column, row, index }) => {
+            return (
+              <div>
+                <el-button
+                  type='text'
+                  size='default'
+                  onClick={() => {
+                    this.newData = [
+                      {
+                        name: '',
+                        number: '',
+                        specification: ''
+                      }
+                    ]
+                  }}
+                >
+                  清空
+                </el-button>
+              </div>
+            )
+          }
+        }
+      ]
+    }
+  },
+  mounted() {
+    this.tableData = this.recordSelected
+  },
+  methods: {
+    remoteMethod(query, type, name) {
+      if (query !== '') {
+        this.loading = true
+        getK3List({
+          pageNum: 1,
+          pageSize: 100,
+          number: type === 'number' ? query : '',
+          oldNumber: '',
+          specification: type === 'specification' ? query : ''
+        }).then(res => {
+          if (name) {
+            this.k3List = res.data.records
+          } else {
+            this.newK3List = res.data.records
+          }
+          this.loading = false
+        })
+      } else {
+        this.options = []
+      }
+    },
+    setCheckeData(e, type) {
+      if (type) {
+        this.oldData[0].specification = e
+        this.oldData[0].number = e
+        if (e) {
+          const k3Obj = this.findData(e, type)
+          this.oldData[0].name = k3Obj.name
+        }
+      } else {
+        this.newData[0].specification = e
+        this.newData[0].number = e
+        if (e) {
+          const k3Obj = this.findData(e)
+          this.newData[0].name = k3Obj.name
+        }
+      }
+    },
+    handleQuery() {
+      const number = this.oldData[0].number
+      if (!number) {
+        this.$errorMsg('旧机型内容不能为空')
+        return
+      }
+      this.selectedData = []
+      const specification = this.findData(number, 'old').specification
+      getList({
+        pageNum: 1,
+        pageSize: -1,
+        specification: specification,
+        status: 1
+      }).then(res => {
+        this.policyList = res.data.records
+      })
+    },
+    selectionChange(data) {
+      this.selectedData = data
+    },
+    onSubmit() {
+      if (!this.selectedData.length) {
+        this.$errorMsg('请选择有效政策')
+        return
+      }
+      const policyIds = this.selectedData.map(k => k.id).join('')
+      const newMaterialId = this.newData[0].number
+      const oldMaterialId = this.oldData[0].number
+      if (!newMaterialId) {
+        this.$errorMsg('新机型内容不能为空')
+        return
+      }
+      updateMaterialPolicy({
+        policyIds,
+        newMaterialId,
+        oldMaterialId
+      }).then(res => {
+        this.$successMsg('批量修改成功')
+        this.onClose()
+      })
+    },
+    findData(e, type) {
+      if (type) {
+        return this.k3List.find(k => k.id === e)
+      } else {
+        return this.newK3List.find(k => k.id === e)
+      }
+    },
+    onClose() {
+      this.$emit('close')
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 71 - 16
src/views/sales_policy/policy_list.vue

@@ -12,16 +12,16 @@
     :operation-column-width="200"
     :field-beans-hook="fieldBeansHook"
   >
-    <Popu v-if="isShow !== 1">
+    <popu v-if="isShow !== 1">
       <el-page-header slot="head" :content="content" @back="handleClose" />
-      <AddPolicy
+      <add-policy
         v-if="isShow === 2"
         :is-show="isShow"
         :is-flag="isFlag"
         @close="handleClose"
         @upDataIsFlag="upDataIsFlag"
       />
-      <EditPolicy
+      <edit-policy
         v-if="isShow === 3"
         :id="id"
         :is-show="isShow"
@@ -30,8 +30,28 @@
         @upDataIsFlag="upDataIsFlag"
       />
       <Details v-if="isShow === 4" :id="id" :is-show="isShow" @close="handleClose" />
-      <Examine v-if="isShow === 5" :id="id" :is-show="isShow" @close="handleClose" />
-    </Popu>
+      <examine v-if="isShow === 5" :id="id" :is-show="isShow" @close="handleClose" />
+    </popu>
+    <el-dialog
+      title="批量修改机型"
+      :visible.sync="replaceVisible"
+      width="80%"
+      :append-to-body="true"
+      :close-on-click-modal="false"
+      @close="handleDialogClose"
+    >
+      <replace-record-form v-if="replaceVisible" :record-selected="recordSelected" @close="handleDialogClose" />
+    </el-dialog>
+    <el-dialog
+      title="批量修改延期"
+      :visible.sync="delayVisible"
+      width="80%"
+      :append-to-body="true"
+      :close-on-click-modal="false"
+      @close="handleDialogClose"
+    >
+      <delay-record-form v-if="delayVisible" :record-selected="recordSelected" @close="handleDialogClose" />
+    </el-dialog>
   </template-page>
 </template>
 
@@ -39,28 +59,23 @@
 import TemplatePage from '@/components/template/template-page-1.vue'
 import Popu from '@/components/template/popu.vue'
 import add_callback_mixin from '@/components/template/add_callback_mixin.js'
-
+import DelayRecordForm from './components/delayRecordForm.vue'
+import ReplaceRecordForm from './components/replaceRecordForm.vue'
 import {
   cancelPolicy,
   cloneList,
   deletePolicy,
   getCrList,
   getId,
-  getList,
   getpolicySubmit,
-  getTypeList,
   toExamine,
   setAbandon,
   policyListV2,
   policyListV2Export
 } from '@/api/policy_list'
-// import Minxin from '@/mixin'
 import { downloadFiles, handleImport } from '@/utils/util'
 import AddPolicy from './components/AddPolicy'
 import EditPolicy from './components/editPolicy'
-import AddModel from './components/AddModel'
-import Pagination from './components/Pagination'
-import AddCondition from './components/AddCondition'
 import Details from './components/details.vue'
 import Examine from './components/Examine'
 import { mapState } from 'vuex'
@@ -69,6 +84,8 @@ export default {
   mixins: [add_callback_mixin],
   data() {
     return {
+      replaceVisible: false,
+      delayVisible: false,
       showPage: true,
       // 事件组合
       optionsEvensGroup: [
@@ -81,12 +98,38 @@ export default {
               })
             }
           ]
+        ],
+        [
+          [
+            {
+              name: '批量修改机型',
+              click: () => {
+                this.replaceVisible = true
+              }
+            }
+          ]
+        ],
+        [
+          [
+            {
+              name: '批量修改延期',
+              click: () => {
+                if (!this.recordSelected.length) {
+                  this.$errorMsg('请选择内容')
+                  return
+                }
+                this.delayVisible = true
+              }
+            }
+          ]
         ]
       ],
       // 表格属性
       tableAttributes: {
         // 启用勾选列
-        selectColumn: false
+        selectColumn: true,
+        selectable: this.selectable
+
       },
       // 表格事件
       tableEvents: {
@@ -170,6 +213,18 @@ export default {
     }
   }),
   methods: {
+    selectable(row, index) {
+      if (row.status === '有效' && row.examineStatus === '审核通过') {
+        return true
+      } else {
+        return false
+      }
+    },
+    handleDialogClose() {
+      this.replaceVisible = false
+      this.delayVisible = false
+      this.$refs.pageRef.refreshList()
+    },
     fieldBeansHook(list) {
       return [
         ...list,
@@ -522,16 +577,16 @@ export default {
       }
     }
   },
+  // eslint-disable-next-line vue/order-in-components
   components: {
     TemplatePage,
     Popu,
     Examine,
     Details,
-    AddModel,
     AddPolicy,
     EditPolicy,
-    Pagination,
-    AddCondition
+    DelayRecordForm,
+    ReplaceRecordForm
   }
 }
 </script>