lilei 1 anno fa
parent
commit
7597fc7069

+ 85 - 44
src/views/dealerManagement/rebateBinding/priceDiffModal.vue

@@ -19,18 +19,9 @@
           :label-col="formItemLayout.labelCol"
           :wrapper-col="formItemLayout.wrapperCol"
         >
-          <a-form-model-item label="关联经销商">
-            <a-row :gutter="10">
-              <a-col :span="17">
-                <custList ref="custList" @change="custChange" placeholder="请输入经销商名称搜索"></custList>
-              </a-col>
-              <a-col :span="6">
-              </a-col>
-            </a-row>
-          </a-form-model-item>
           <a-form-model-item label="差价归属方" prop="cjgsf">
             <a-row :gutter="10">
-              <a-col :span="17">
+              <a-col :span="22">
                 <a-select
                   v-model="form.cjgsf"
                   placeholder="请选择差价归属方"
@@ -41,40 +32,41 @@
                   <a-select-option v-for="item in cjgsfList" :key="item.code" :value="item.code">{{ item.name }}</a-select-option>
                 </a-select>
               </a-col>
-              <a-col :span="6">
+              <a-col :span="2">
               </a-col>
             </a-row>
           </a-form-model-item>
-          <a-form-model-item label="已绑经销商" v-if="form.cjgsf.indexOf('0')>=0">
+          <a-form-model-item label="上级经销商" prop="dealerSn" v-if="form.cjgsf.indexOf('0')>=0">
             <a-row :gutter="10">
-              <a-col :span="17">
-                <a-input v-model.trim="form.name" disabled />
+              <a-col :span="22">
+                <custList ref="custList" @change="custChange" placeholder="请输入经销商名称搜索"></custList>
               </a-col>
-              <a-col :span="6" v-if="showPercent">
-                <a-input-number :min="0" :max="100"/> %
+              <a-col :span="2">
               </a-col>
             </a-row>
           </a-form-model-item>
-          <a-form-model-item label="指定经销商" v-if="form.cjgsf.indexOf('1')>=0">
-            <a-row :gutter="10" v-for="(item,index) in zdDealearList" :key="item.id">
-              <a-col :span="17">
+          <!-- <a-form-model-item label="指定经销商" v-if="form.cjgsf.indexOf('1')>=0">
+            <a-row :gutter="10" v-for="(item,index) in chooseDealerList" :key="item.id">
+              <a-col :span="22">
                 <custList ref="custList" @change="custChange" placeholder="请输入经销商名称搜索"></custList>
               </a-col>
-              <a-col :span="5" v-if="showPercent||showPercent1">
-                <a-input-number :min="0" :max="100"/> %
-              </a-col>
               <a-col :span="2">
-                <a-button @click="addOrDel(item,index)" size="small" shape="circle" :icon="index==zdDealearList.length-1?'plus':'minus'" style="margin-left: 10px;" />
+                <a-button @click="addOrDel(item,index)" size="small" shape="circle" :icon="index==chooseDealerList.length-1?'plus':'minus'" style="margin-left: 10px;" />
               </a-col>
             </a-row>
-          </a-form-model-item>
-          <a-form-model-item label="箭冠总公司" v-if="form.cjgsf.indexOf('2')>=0">
-            <a-row :gutter="10">
-              <a-col :span="17">
-                <a-input v-model.trim="form.name" disabled />
+          </a-form-model-item> -->
+          <a-form-model-item label="指定经销商" prop="dealerScope" v-if="form.cjgsf.indexOf('1')>=0">
+            <a-row :gutter="15">
+              <a-col :md="24" :sm="24">
+                <a-button type="primary" :loading="spinning" @click="handleDealerModal">选择</a-button>
+                <span style="margin-left:10px;">已{{ chooseDealerList.length }}选项</span>
               </a-col>
-              <a-col :span="6" v-if="showPercent">
-                <a-input-number :min="0" :max="100"/> %
+              <a-col :md="24" :sm="24" v-show="chooseDealerList && chooseDealerList.length>0">
+                <div class="buyerBox">
+                  <a-tag closable v-for="con in chooseDealerList" :key="con.dealerSn" @close="delBuyerName(con)">
+                    {{ con.dealerName }}
+                  </a-tag>
+                </div>
               </a-col>
             </a-row>
           </a-form-model-item>
@@ -96,6 +88,20 @@
         >确定</a-button>
       </div>
     </a-spin>
+    <!-- 选择参与客户 -->
+    <a-modal
+      title="选择经销商"
+      :visible="openDealerModal"
+      :footer="null"
+      centered
+      class="lookUpCustomers-modal"
+      @cancel="openDealerModal = false"
+      width="60%"
+    >
+      <div class="dealerModalCon">
+        <chooseDealer ref="dealerChoose" @plAdd="handleAddDealer"></chooseDealer>
+      </div>
+    </a-modal>
   </a-modal>
 </template>
 
@@ -103,10 +109,11 @@
 import custList from '@/views/common/custList.vue'
 import { VSelect } from '@/components'
 import categoryList from './categoryList.vue'
+import chooseDealer from '@/views/promotionRulesManagement/dealerPromotions/chooseDealer'
 
 export default {
   name: 'PriceDiffModal',
-  components: { VSelect, custList, categoryList },
+  components: { VSelect, custList, categoryList, chooseDealer },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -124,17 +131,21 @@ export default {
       },
       form: {
         dealerSn: undefined,
-        cjgsf: []
+        cjgsf: [],
+        promotionDealerList: [] // 参与客户
       },
       rules: {
-        cjgsf: [{ required: true, message: '请选择差价归属方', trigger: 'change' }]
+        cjgsf: [{ required: true, message: '请选择差价归属方', trigger: 'change' }],
+        dealerSn: [{ required: true, message: '请选择上级经销商', trigger: 'change' }],
+        dealerScope: [{ required: true, message: '请选择参与客户', trigger: 'change' }]
       },
       cjgsfList: [
-        { code: '0', name: '已绑经销商' },
+        { code: '0', name: '上级经销商' },
         { code: '1', name: '指定经销商' },
         { code: '2', name: '箭冠总公司' }
       ],
-      zdDealearList: []
+      chooseDealerList: [],
+      openDealerModal: false
     }
   },
   computed: {
@@ -142,7 +153,7 @@ export default {
       return this.form.cjgsf.length > 1
     },
     showPercent1 () {
-      return this.zdDealearList.length > 1
+      return this.chooseDealerList.length > 1
     }
   },
   methods: {
@@ -153,22 +164,49 @@ export default {
     // 差价归属变更
     cjgsgChange (val) {
       if (val.indexOf('1') >= 0) {
-        if (this.zdDealearList.length == 0) {
-          this.zdDealearList.push({ id: new Date().getTime(), dealerSn: '', percent: '' })
+        if (this.chooseDealerList.length == 0) {
+          // this.chooseDealerList.push({ id: new Date().getTime(), dealerSn: '', percent: '' })
         }
       } else {
-        this.zdDealearList = []
+        this.chooseDealerList = []
+      }
+    },
+    // 选择参与客户
+    handleDealerModal () {
+      this.openDealerModal = true
+      const _this = this
+      if (_this.chooseDealerList.length == 0) {
+        _this.form.promotionDealerList = []
       }
+      const arr = _this.chooseDealerList.map(item => {
+        return item.dealerSn
+      })
+      // 选择参与客户回显
+      _this.$nextTick(() => {
+        _this.$refs.dealerChoose.pageInit(arr)
+      })
+    },
+    // 删除所选参与客户
+    delBuyerName (row) {
+      const pot = this.chooseDealerList.findIndex(con => { return con.dealerSn == row.dealerSn })
+      this.chooseDealerList.splice(pot, 1)
+    },
+    // 添加经销商
+    handleAddDealer (list) {
+      this.chooseDealerList = list
+      this.openDealerModal = false
+      // 移除表单必填项
+      this.$refs.ruleForm.clearValidate('promotionDealerList')
     },
     // 增加或删除指定经销商
     addOrDel (row, index) {
       // 加
-      if ((this.zdDealearList.length - 1) == index) {
-        this.zdDealearList.push({ id: new Date().getTime(), dealerSn: '', percent: '' })
+      if ((this.chooseDealerList.length - 1) == index) {
+        this.chooseDealerList.push({ id: new Date().getTime(), dealerSn: '', percent: '' })
       } else {
-        const i = this.zdDealearList.findIndex(item => item.id == row.id)
+        const i = this.chooseDealerList.findIndex(item => item.id == row.id)
         if (i >= 0) {
-          this.zdDealearList.splice(i, 1)
+          this.chooseDealerList.splice(i, 1)
         }
       }
     },
@@ -176,7 +214,7 @@ export default {
     resetForm () {
       this.form.dealerSn = undefined
       this.form.cjgsf = []
-      this.zdDealearList = []
+      this.chooseDealerList = []
       this.$refs.custList.resetForm()
     },
     // 保存
@@ -220,6 +258,9 @@ export default {
   .priceDifference-modal{
     .ant-modal-body {
       padding: 24px!important;
+      .buyerBox{
+        border:1px solid #d9d9d9;margin-top:10px;border-radius:4px;padding:4px 10px;background:#f2f2f2;max-height:130px;overflow-y:scroll;
+      }
     }
     .btn-cont {
       text-align: center;

+ 2 - 1
src/views/promotionRulesManagement/dealerPromotions/chooseDealer.vue

@@ -53,6 +53,7 @@
       :columns="columns"
       :data-source="dealerList"
       @change="handlePage"
+      :loading="spinning"
     >
       <template slot="addressInfo" slot-scope="text, record">
         {{ record.provinceName }}{{ '-'+ record.cityName }}{{ '-'+ record.districtName }}
@@ -175,7 +176,7 @@ export default {
     },
     searchForm () {
       this.loadData()
-      this.spinning = false
+      // this.spinning = false
     },
     subareaChange (val) {
       this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined