Browse Source

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

lilei 1 year ago
parent
commit
8be4b8685d

+ 14 - 54
src/api/promotion.js

@@ -44,79 +44,39 @@ export const dealerPromotionDel = params => {
     method: 'get'
   })
 }
-
-// 获取默认仓库
-export const getDefaultWarehouse = (params) => {
-  return axios({
-    url: '/warehouse/getDefaultWithExt',
-    data: params,
-    method: 'get'
-  })
-}
-//  仓库列表  无分页 有权限
-export const queryAuthWarehouse = (params) => {
+// 规则设置页面  详情
+export const getRuleDetail = (params) => {
   return axios({
-    url: '/bizuser/queryAuthWarehouse',
-    data: params,
+    url: `/promotion/rule/findBySn/${params.sn}`,
+    data: {},
     method: 'get'
   })
 }
-//  仓库列表  无分页
-export const warehouseAllList = (params) => {
-  const url = '/warehouse/queryList'
-  return axios({
-    url: url,
-    data: params,
-    method: 'post'
-  })
-}
-//  仓库仓位  级联数据
-export const warehouseCascadeList = (params) => {
-  const url = '/warehouse/queryListWithExt'
-  return axios({
-    url: url,
-    data: params,
-    method: 'post'
-  })
-}
-// 新增/编辑仓库
-export const warehouseSave = params => {
+// 规则设置 列表
+export const getRuleQueryList = (params) => {
   return axios({
-    url: '/warehouse/save',
+    url: '/promotion/rule/queryList',
     data: params,
     method: 'post'
   })
 }
-// 删除仓库
-export const warehouseDel = params => {
-  return axios({
-    url: `/warehouse/delete/${params.sn}`,
-    data: {},
-    method: 'get'
-  })
-}
 
-//  仓位列表  有分页
-export const warehouseLocList = (params) => {
-  const url = `/warehouseLoc/queryPage/${params.pageNo}/${params.pageSize}`
-  delete params.pageNo
-  delete params.pageSize
+// 新增一行
+export const getNewScopeSn = (params) => {
   return axios({
-    url: url,
+    url: '/promotion/rule/getNewScopeSn',
     data: params,
-    method: 'post'
+    method: 'get'
   })
 }
-//  仓位列表  无分页
-export const warehouseLocAllList = (params) => {
-  const url = '/warehouseLoc/queryList'
+// 规则保存
+export const promotionSave = (params) => {
   return axios({
-    url: url,
+    url: '/promotion/rule/save',
     data: params,
     method: 'post'
   })
 }
-
 // 删除仓位
 export const warehouseLocDel = params => {
   return axios({

+ 236 - 0
src/views/promotionRulesManagement/dealerPromotions/chooseProductsModal.vue

@@ -0,0 +1,236 @@
+<template>
+  <a-modal
+    centered
+    class="chooseProducts-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="选择产品"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="900">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div class="products-con">
+        <div>
+          <!-- 搜索条件 -->
+          <div class="table-page-search-wrapper">
+            <a-form-model
+              ref="ruleForm"
+              class="form-model-con"
+              layout="inline"
+              :model="queryParam"
+              @keyup.enter.native="handleSearch"
+              :label-col="formItemLayout.labelCol"
+              :wrapper-col="formItemLayout.wrapperCol">
+              <a-row :gutter="15">
+                <a-col :md="6" :sm="24">
+                  <a-form-model-item label="产品编码">
+                    <a-input id="chooseProducts-code" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码"/>
+                  </a-form-model-item>
+                </a-col>
+                <a-col :md="6" :sm="24">
+                  <a-form-model-item label="产品名称">
+                    <a-input id="chooseProducts-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
+                  </a-form-model-item>
+                </a-col>
+                <a-col :md="6" :sm="24">
+                  <a-form-model-item label="产品分类">
+                    <productTypeAll :isAll="type!='default'" placeholder="请选择产品分类" @change="changeProductType" v-model="queryParam.productType" id="chooseProducts-productType"></productTypeAll>
+                  </a-form-model-item>
+                </a-col>
+                <a-col :md="6" :sm="24">
+                  <a-form-model-item label="产品品牌">
+                    <ProductBrand id="chooseProducts-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
+                  </a-form-model-item>
+                </a-col>
+                <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+                  <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="chooseProducts-refresh">查询</a-button>
+                  <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chooseProducts-reset">重置</a-button>
+                </a-col>
+              </a-row>
+            </a-form-model>
+          </div>
+          <div style="margin-bottom: 10px">
+            <a-button type="primary" ghost :loading="loading" @click="handleSave">批量添加</a-button>
+            <span style="margin-left: 5px">
+              <template v-if="selectCount"> {{ `已选 ${selectCount} 项` }} </template>
+            </span>
+          </div>
+          <!-- 列表 -->
+          <s-table
+            class="sTable"
+            ref="table"
+            size="small"
+            :rowKey="(record) => record.productSn"
+            rowKeyName="productSn"
+            :row-selection="{ columnWidth: 40, getCheckboxProps:record =>({props: { disabled: (this.type == 'supplier') && (this.chooseData && this.chooseData.indexOf(record.productSn) > -1) }}) }"
+            @rowSelection="rowSelectionFun"
+            :columns="columns"
+            :data="loadData"
+            :defaultLoadData="false"
+            bordered>
+          </s-table>
+        </div>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { STable } from '@/components'
+import tablePagination from '@/views/common/tablePagination.vue'
+import ProductBrand from '@/views/common/productBrand.js'
+import productTypeAll from '@/views/common/productTypeAll.js'
+import { dealerScopeValidProduct } from '@/api/dealerScope'
+import { productList, productPricedList, productPricingList } from '@/api/product'
+export default {
+  name: 'ChooseProductsModal',
+  components: { STable, tablePagination, ProductBrand, productTypeAll },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    chooseData: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    type: { //  类型,经销权设置dealership,  供应商添加产品supplier
+      type: String,
+      default: 'default'
+    },
+    dealerSn: {
+      type: String || Number,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      spinning: false,
+      isShow: this.openModal, //  是否打开弹框
+      formItemLayout: {
+        labelCol: { span: 4 },
+        wrapperCol: { span: 20 }
+      },
+      queryParam: { //  查询条件
+        name: '', // 产品名称
+        code: '', //  产品编码
+        productBrandSn: undefined, //  产品品牌
+        productType: [],
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '' //  产品三级分类
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      loading: false, //  表格加载中
+      columns: [
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
+        { title: '产品编码', dataIndex: 'code', align: 'center' },
+        { title: '产品名称', dataIndex: 'name', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        const params = Object.assign(parameter, this.queryParam)
+        return productList(params).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      },
+      rowSelectionInfo: null
+    }
+  },
+  computed: {
+    selectCount () {
+      return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length
+    }
+  },
+  methods: {
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
+    // 重置数据
+    resetData () {
+      this.queryParam.code = ''
+      this.queryParam.name = ''
+      this.queryParam.productBrandSn = undefined
+      this.queryParam.productTypeSn1 = ''
+      this.queryParam.productTypeSn2 = ''
+      this.queryParam.productTypeSn3 = ''
+      this.queryParam.productType = []
+    },
+    //  重置
+    resetSearchForm () {
+      this.resetData()
+      this.$refs.table.clearTable()
+    },
+    // 保存
+    handleSave () {
+      if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+        this.$message.warning('请在列表勾选后再进行操作!')
+        return
+      }
+      this.$emit('ok', this.rowSelectionInfo && this.rowSelectionInfo.selectedRows)
+      this.isShow = false
+    },
+    //  产品分类  change
+    changeProductType (val, opt) {
+      this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
+      this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
+      this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.$refs.table.clearTable()
+        this.resetData()
+      } else {
+        const _this = this
+        _this.$refs.table.refresh()
+        // let selectedRows = []
+        // const selectedRowKeys = []
+        // selectedRows = this.chooseData
+        // this.chooseData.map(item => {
+        //   selectedRowKeys.push(item.goodsSn)
+        // })
+        // this.$nextTick(() => { // 页面渲染完成后的回调
+        //   _this.$refs.table.setTableSelected(selectedRowKeys, selectedRows) // 设置表格选中项
+        // })
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .chooseProducts-modal{
+    .products-con{
+      .btn-con{
+        text-align: center;
+        margin: 30px 0 20px;
+        .button-cancel{
+          font-size: 12px;
+        }
+      }
+    }
+  }
+</style>

+ 15 - 20
src/views/promotionRulesManagement/dealerPromotions/detail.vue

@@ -12,23 +12,18 @@
       </a-page-header>
       <!-- 基础信息 -->
       <a-card size="small" title="基础信息" :bordered="false" v-show="!isShowBisiceInfo" class="salesDetail-cont">
-        <a-descriptions size="small" :column="3" v-if="detailData">
+        <a-descriptions size="small" :column="2" v-if="detailData">
           <a-descriptions-item label="促销名称">{{ detailData.title || '--' }}</a-descriptions-item>
           <a-descriptions-item label="促销时间" v-if="detailData.promotionDateStart&& detailData.promotionDateEnd">{{ detailData.promotionDateStart }}-{{ detailData.promotionDateEnd }}</a-descriptions-item>
           <a-descriptions-item label="促销时间" v-else>--</a-descriptions-item>
 
-          <a-descriptions-item :span="2" label="促销品费用归属品牌">{{ detailData.createDate || '--' }}all是积分兑换更好地给好的坤哥电饭锅快递费给对方看个房<span class="link-bule btn-box" @click="handleSeeDetail('brand')">详情</span></a-descriptions-item>
-          <a-descriptions-item label="费用所属部门">{{ detailData.buyerName || '--' }}</a-descriptions-item>
-          <a-descriptions-item label="参与客户">{{ detailData.buyerName || '--' }}<span class="link-bule btn-box" @click="handleSee">查看</span></a-descriptions-item>
-          <a-descriptions-item :span="2" label="促销品费用归属品类">{{ detailData.buyerName || '--' }}<span class="link-bule btn-box" @click="handleSeeDetail('category')">详情</span></a-descriptions-item>
+          <a-descriptions-item label="费用所属部门">{{ detailData.expenseDepartmentName || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="参与客户"> 部分客户,共{{ detailData.dealerQty }}个<span class="link-bule btn-box" @click="handleSee">查看</span></a-descriptions-item>
 
-          <a-descriptions-item label="促销描述" :span="3">
-            <div class="flex">
-              <div>{{ detailData.description || '' }}</div>
-              <span class="link-bule btn-box">查看全部</span>
-            </div>
+          <a-descriptions-item label="促销描述" :span="2">
+            <div>{{ detailData.description || '' }}</div>
           </a-descriptions-item>
-          <a-descriptions-item label="附件">
+          <a-descriptions-item label="附件" :span="2">
             <div v-if="detailData.attachmentList&&detailData.attachmentList.length>0">
               <a
                 class="link-bule"
@@ -43,7 +38,7 @@
         </a-descriptions>
       </a-card>
       <a-card size="small" title="规则设置" :bordered="false" class="pages-wrap">
-        <div class="btnGroup" v-if="$route.params.type=='rule'">
+        <div class="btnGroup" v-if="$route.query.type=='rule'">
           <a-button type="primary" class="button-warning" @click="handleProduct" :disabled="disabled">买产品送产品</a-button>
           <a-button style="margin:0 10px" type="primary" class="button-warn" @click="handleAmount" :disabled="disabled">买产品送采购额</a-button>
           <a-button type="primary" @click="handleSpecialProduct" :disabled="disabled">特价产品</a-button>
@@ -58,6 +53,7 @@
           :data="loadData"
           :scroll="{ y: 500 }"
           :defaultLoadData="false"
+          :showPagination="false"
           bordered>
           <!-- 产品编码 -->
           <template slot="productCode" slot-scope="text, record">
@@ -100,7 +96,7 @@
     <!-- 详情 -->
     <detailModal :openModal="openDetailModal" @close="openDetailModal = false"></detailModal>
     <!-- 买产品送产品  弹窗 -->
-    <sendProductsModal :openModal="openSendProductsModal" @close="openSendProductsModal = false"></sendProductsModal>
+    <sendProductsModal :openModal="openSendProductsModal" :promotionSn="$route.query.sn" @close="openSendProductsModal = false"></sendProductsModal>
     <!-- 买产品送采购额 弹窗 -->
     <sendAmountModal :openModal="openSendAmountModal" @close="openSendAmountModal = false"></sendAmountModal>
     <!-- 特价产品  弹窗 -->
@@ -117,7 +113,7 @@ import detailModal from './detailModal'
 import sendProductsModal from './sendProductsModal'
 import sendAmountModal from './sendAmountModal'
 import specialOfferModal from './specialOfferModal'
-import { queryPageForWarehouseDetail, dealerPromotionInfo } from '@/api/promotion'
+import { getRuleQueryList, dealerPromotionInfo } from '@/api/promotion'
 export default {
   name: 'SalesOrderWarehouseDetail',
   mixins: [commonMixin],
@@ -129,14 +125,13 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        const dataAjax = Object.assign(parameter, { salesBillSn: '559837590779535360', warehouseSn: '527851347359506432' })
-        return queryPageForWarehouseDetail(dataAjax).then(res => {
+        const dataAjax = Object.assign(parameter, { sn: this.$route.query.sn })
+        return getRuleQueryList(dataAjax).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
-            const no = (data.pageNo - 1) * data.pageSize
-            for (var i = 0; i < data.list.length; i++) {
-              data.list[i].no = no + i + 1
+            for (var i = 0; i < data.length; i++) {
+              data[i].no = i + 1
             }
             this.disabled = false
           }
@@ -183,7 +178,7 @@ export default {
     getDetail () {
       dealerPromotionInfo({ sn: this.$route.query.sn }).then(res => {
         if (res.status == 200) {
-          // this.$refs.table.refresh(true)
+          this.$refs.table.refresh(true)
           this.detailData = res.data || null
         } else {
           this.detailData = null

+ 3 - 3
src/views/promotionRulesManagement/dealerPromotions/list.vue

@@ -42,14 +42,14 @@
               <span class="table-page-search-submitButtons">
                 <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="promotionList-refresh">查询</a-button>
                 <a-button style="margin-left: 5px" @click="resetSearchForm()" :disabled="disabled" id="promotionList-reset">重置</a-button>
-                <a-button
+                <!-- <a-button
                   style="margin-left: 10px"
                   type="primary"
                   class="button-warning"
                   @click="handleExport"
                   :disabled="disabled"
                   :loading="exportLoading"
-                >导出</a-button>
+                >导出</a-button> -->
                 <!-- v-if="$hasPermissions('B_promotionListExport')" -->
               </span>
             </a-col>
@@ -287,7 +287,7 @@ export default {
     },
     // 规则设置
     handleSetRules (row) {
-      this.$router.push({ name: 'dealerPromotionManagementRule', params: { type: 'rule' } })
+      this.$router.push({ name: 'dealerPromotionManagementRule', query: { type: 'rule', sn: row.promotionSn } })
     },
     // 审核
     handleCheck (row) {

+ 76 - 60
src/views/promotionRulesManagement/dealerPromotions/sendAmountModal.vue

@@ -7,7 +7,7 @@
     title="规则设置"
     v-model="isShow"
     @cancel="isShow=false"
-    width="80%">
+    width="70%">
     <a-spin :spinning="spinning" tip="Loading...">
       <a-form-model
         id="promotionList-basicInfo-form"
@@ -16,111 +16,113 @@
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
-        <a-form-model-item label="规则门槛" prop="supplierSn">
-          <a-radio-group v-model="form.supplierSn" button-style="solid" size="small">
-            <a-radio-button value="a">
+        <a-form-model-item label="规则门槛" prop="gateFlag">
+          <a-radio-group v-model="form.gateFlag" button-style="solid" size="small" @change="changeGateFlag">
+            <a-radio-button value="1">
             </a-radio-button>
-            <a-radio-button value="b">
+            <a-radio-button value="0">
             </a-radio-button>
           </a-radio-group>
-          <div class="ruleDescList">
+          <div class="ruleDescList" v-if="form.gateFlag && form.gateFlag === '1'">
             购买满
-            <a-input-number v-model="form.starAmount" :min="0" :precision="2" size="small"/>
+            <a-input-number v-model="form.gateAmount" :min="0" :precision="2" size="small"/>
             元门槛产品,可使用
-            <a-input-number v-model="form.endAmount" :min="0" :precision="2" size="small"/>
+            <a-input-number v-model="form.quotaAmount" :min="0" :precision="2" size="small"/>
             元配额,采购规则中的正价商品(配额算销售额)
           </div>
         </a-form-model-item>
-        <a-form-model-item label="满赠规则" prop="supplierSn">
+        <a-form-model-item label="满赠规则" prop="regularSameFlag">
           <div class="ruleDescList">
-            <a-select default-value="a" style="width: 100px" size="small">
-              <a-select-option value="a">
+            <a-select default-value="0" :value="form.regularSameFlag" style="width: 100px" size="small">
+              <a-select-option value="1">
                 同款
               </a-select-option>
-              <a-select-option value="b">
+              <a-select-option value="0">
                 不同款
               </a-select-option>
             </a-select>
             产品购买满
-            <a-input-number v-model="form.starAmount" :min="0" :step="1" :precision="0" size="small"/>
+            <a-input-number v-model="form.regularAmount" :min="0" :step="1" :precision="0" size="small"/>
             元正价产品,送
-            <a-input-number v-model="form.endAmount" :min="0" :step="1" :precision="0" size="small"/>
+            <a-input-number v-model="form.giveAmount" :min="0" :step="1" :precision="0" size="small"/>
             元%促销品采购额
           </div>
           <div class="ruleDescList">
-            <a-checkbox size="small">
+            <a-checkbox size="small" :value="form.restrictFlag">
               限制正价产品款数
             </a-checkbox>
-            <a-input-number v-model="form.endAmount" :min="0" :step="1" :precision="0" size="small"/>
+            <a-input-number v-model="form.restrictCategory" :min="0" :step="1" :precision="0" size="small"/>
           </div>
         </a-form-model-item>
-        <a-form-model-item label="金额叠加" prop="returnReason">
-          <a-radio-group v-model="form.supperSn" button-style="solid" size="small">
-            <a-radio-button value="a">
+        <a-form-model-item label="金额叠加" prop="accrualFlag">
+          <a-radio-group v-model="form.accrualFlag" button-style="solid" size="small">
+            <a-radio-button value="1">
             </a-radio-button>
-            <a-radio-button value="b">
+            <a-radio-button value="0">
             </a-radio-button>
           </a-radio-group>
           <span style="color:gray;">(如:满1000送200,金额叠加则:满2000送400,以此类推)</span>
         </a-form-model-item>
-        <a-form-model-item prop="supplierSn" v-bind="formItemLayout">
+        <a-form-model-item prop="minOrderFlag">
           <span slot="label">
             <a-tooltip title="What do you want others to call you?">
               <a-icon type="info-circle" />
             </a-tooltip>
             订单起订金额
           </span>
-          <a-select default-value="b" style="width: 160px" size="small">
-            <a-select-option value="a">
+          <a-select default-value="1" :value="form.minOrderFlag" style="width: 160px" size="small">
+            <a-select-option value="0">
               不限
             </a-select-option>
-            <a-select-option value="b">
+            <a-select-option value="1">
               限制
             </a-select-option>
           </a-select>
           <a-input-number
+            v-show="form.minOrderFlag && form.minOrderFlag=='1'"
             size="small"
             style="margin-left:10px;width:300px;"
-            v-model="form.endAmount"
+            v-model="form.minOrderAmount"
             :min="0"
             :step="1"
             :precision="2"
             placeholder="请输入金额"/>
         </a-form-model-item>
-        <a-form-model-item prop="supplierSn" v-bind="formItemLayout">
+        <a-form-model-item prop="upperLimitFlag">
           <span slot="label">
             <a-tooltip title="What do you want others to call you?">
               <a-icon type="info-circle" />
             </a-tooltip>
             活动经费上限
           </span>
-          <a-select default-value="b" style="width: 160px" size="small">
-            <a-select-option value="a">
+          <a-select default-value="1" :value="form.upperLimitFlag" style="width: 160px" size="small">
+            <a-select-option value="0">
               不限
             </a-select-option>
-            <a-select-option value="b">
+            <a-select-option value="1">
               限制
             </a-select-option>
           </a-select>
           <a-input-number
+            v-show="form.upperLimitFlag&&form.upperLimitFlag=='1'"
             size="small"
             style="margin-left:10px;width:300px;"
-            v-model="form.endAmount"
+            v-model="form.upperLimitAmount"
             :min="0"
             :step="1"
             :precision="2"
             placeholder="请输入金额"/>
         </a-form-model-item>
-        <a-form-model-item label="采购额适用范围" prop="returnReason">
-          <a-radio-group v-model="form.supplier" button-style="solid" size="small">
-            <a-radio-button value="a">
+        <a-form-model-item label="采购额适用范围" prop="regularPromotionSameFlag">
+          <a-radio-group v-model="form.regularPromotionSameFlag" button-style="solid" size="small">
+            <a-radio-button value="0">
               部分产品
             </a-radio-button>
-            <a-radio-button value="b">
+            <a-radio-button value="1">
               全部产品
             </a-radio-button>
           </a-radio-group>
@@ -129,13 +131,13 @@
       <a-card size="small" :bordered="false" class="pages-wrap">
         <div class="flex">
           <a-radio-group v-model="chooseVal" button-style="solid" size="small">
-            <a-radio-button value="a">
+            <a-radio-button value="a" v-show="form.gateFlag==='1'">
               门槛产品
             </a-radio-button>
             <a-radio-button value="b">
               正价产品
             </a-radio-button>
-            <a-radio-button value="c">
+            <a-radio-button value="c" v-show="form.regularPromotionSameFlag==='0'">
               促销产品
             </a-radio-button>
           </a-radio-group>
@@ -145,7 +147,9 @@
             class="button-info"
             id="promotionList-edit-btn">+导入产品</a-button>
         </div>
-        <tableType1></tableType1>
+        <div v-show="chooseVal=='a'"><tableType1 ref="cillProduct" selectType="gateProduct"></tableType1></div>
+        <div v-show="chooseVal=='b'"><tableType1 ref="normalPriceProduct" selectType="regularProduct"></tableType1></div>
+        <div v-show="chooseVal=='c'"><tableType2 ref="offerProduct" selectType="specialProductList"></tableType2></div>
       </a-card>
       <div class="btn-cont">
         <a-button id="promotionList-basicInfo-modal-back" @click="isShow = false">取消</a-button>
@@ -159,11 +163,12 @@
 import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
 import tableType1 from './tableType1.vue'
+import tableType2 from './tableType2.vue'
 import { sparePartsReturnSave, sparePartsReturnInfo } from '@/api/sparePartsReturn'
 export default {
   name: 'PromotionListBasicInfoModal',
   mixins: [commonMixin],
-  components: { VSelect, tableType1 },
+  components: { VSelect, tableType1, tableType2 },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -183,32 +188,44 @@ export default {
         wrapperCol: { span: 17 }
       },
       form: {
-        promotionName: '',
-        activeDate: undefined,
-        supplierSn: 'b', // 供应商
-        returnReason: '', // 退货原因
-        explainInfo: '', // 补充说明
-        warehouseSn: undefined,
-        attachmentList: ''
+        promotionRuleType: 'BUY_PROD_GIVE_MONEY', // 买产品送采购额
+        gateFlag: '0', // 门槛
+        gateAmount: '',
+        quotaAmount: '',
+        regularSameFlag: '0', // 满赠规则  不同款商品
+        regularQty: '',
+        promotionQty: '',
+        restrictFlag: undefined, // 限制正价产品款数
+        restrictCategory: '',
+        accrualFlag: '1', // 数量叠加
+        minOrderFlag: '1', // 起订金额
+        minOrderAmount: '',
+        upperLimitFlag: '1', // 活动经费上限
+        upperLimitAmount: '',
+        regularPromotionSameFlag: undefined
       },
-      openDealerModal: false,
-      chooseDealerList: [],
-      attachList: [], // 附件
-      dateFormat: 'YYYY-MM-DD',
       rules: {
-        supplierSn: [
-          { required: true, message: '请选择供应商名称', trigger: 'change' }
-        ],
-        returnReason: [
-          { required: true, message: '请选择退货原因', trigger: 'change' }
-        ],
-        warehouseSn: [{ required: true, message: '请选择退货仓库', trigger: 'change' }]
+        gateFlag: [ { required: true, message: '请选择规则门槛', trigger: 'change' } ],
+        regularSameFlag: [{ required: true, message: '请选择满赠规则', trigger: 'change' }],
+        accrualFlag: [{ required: true, message: '请选择数量是否叠加', trigger: 'change' }],
+        minOrderFlag: [{ required: true, message: '请选择订单起订金额', trigger: 'change' }],
+        upperLimitFlag: [{ required: true, message: '请选择活动经费上限', trigger: 'change' }],
+        regularPromotionSameFlag: [{ required: true, message: '请选择采购额适用范围', trigger: 'change' }]
       },
-      chooseVal: 'a',
-      attachAction: process.env.VUE_APP_API_BASE_URL + '/uploadGetFileInfo'
+      chooseVal: 'a'
     }
   },
   methods: {
+    // 门槛切换  tab 按钮默认显示问题
+    changeGateFlag (e) {
+      if (this.chooseVal != 'c') {
+        if (e.target.value == '0') {
+          this.chooseVal = 'b'
+        } else {
+          this.chooseVal = 'a'
+        }
+      }
+    },
     //  附件上传
     changeAttach (file) {
       this.attachList = JSON.parse(file)
@@ -314,8 +331,7 @@ export default {
         if (this.itemSn) {
           this.getDetail()
         } else {
-          // 默认仓库
-          this.form.warehouseSn = this.isShowWarehouse ? undefined : this.defWarehouse && this.defWarehouse.warehouseSn
+          this.chooseVal = this.form.gateFlag == '0' ? 'b' : 'a'
         }
       }
     }

+ 81 - 99
src/views/promotionRulesManagement/dealerPromotions/sendProductsModal.vue

@@ -7,7 +7,7 @@
     title="规则设置"
     v-model="isShow"
     @cancel="isShow=false"
-    width="80%">
+    width="70%">
     <a-spin :spinning="spinning" tip="Loading...">
       <a-form-model
         id="promotionList-basicInfo-form"
@@ -16,111 +16,113 @@
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
-        <a-form-model-item label="规则门槛" prop="supplierSn">
-          <a-radio-group v-model="form.supplierSn" button-style="solid" size="small">
-            <a-radio-button value="a">
+        <a-form-model-item label="规则门槛" prop="gateFlag">
+          <a-radio-group v-model="form.gateFlag" button-style="solid" size="small" @change="changeGateFlag">
+            <a-radio-button value="1">
             </a-radio-button>
-            <a-radio-button value="b">
+            <a-radio-button value="0">
             </a-radio-button>
           </a-radio-group>
-          <div class="ruleDescList">
+          <div class="ruleDescList" v-if="form.gateFlag && form.gateFlag === '1'">
             购买满
-            <a-input-number v-model="form.starAmount" :min="0" :precision="2" size="small"/>
+            <a-input-number v-model="form.gateAmount" :min="0" :precision="2" size="small"/>
             元门槛产品,可使用
-            <a-input-number v-model="form.endAmount" :min="0" :precision="2" size="small"/>
+            <a-input-number v-model="form.quotaAmount" :min="0" :precision="2" size="small"/>
             元配额,采购规则中的正价商品(配额算销售额)
           </div>
         </a-form-model-item>
-        <a-form-model-item label="满赠规则" prop="supplierSn">
+        <a-form-model-item label="满赠规则" prop="regularSameFlag">
           <div class="ruleDescList">
-            <a-select default-value="a" style="width: 100px" size="small">
-              <a-select-option value="a">
+            <a-select default-value="0" :value="form.regularSameFlag" style="width: 100px" size="small">
+              <a-select-option value="1">
                 同款
               </a-select-option>
-              <a-select-option value="b">
+              <a-select-option value="0">
                 不同款
               </a-select-option>
             </a-select>
             产品购买满
-            <a-input-number v-model="form.starAmount" :min="0" :step="1" :precision="0" size="small"/>
+            <a-input-number v-model="form.regularQty" :min="0" :step="1" :precision="0" size="small"/>
             个正价产品,送
-            <a-input-number v-model="form.endAmount" :min="0" :step="1" :precision="0" size="small"/>
+            <a-input-number v-model="form.promotionQty" :min="0" :step="1" :precision="0" size="small"/>
             个促销产品
           </div>
           <div class="ruleDescList">
-            <a-checkbox size="small">
+            <a-checkbox size="small" :value="form.restrictFlag">
               限制正价产品款数
             </a-checkbox>
-            <a-input-number v-model="form.endAmount" :min="0" :step="1" :precision="0" size="small"/>
+            <a-input-number v-model="form.restrictCategory" :min="0" :step="1" :precision="0" size="small"/>
           </div>
         </a-form-model-item>
-        <a-form-model-item label="数量叠加" prop="returnReason">
-          <a-radio-group v-model="form.supperSn" button-style="solid" size="small">
-            <a-radio-button value="a">
+        <a-form-model-item label="数量叠加" prop="accrualFlag">
+          <a-radio-group v-model="form.accrualFlag" button-style="solid" size="small">
+            <a-radio-button value="1">
             </a-radio-button>
-            <a-radio-button value="b">
+            <a-radio-button value="0">
             </a-radio-button>
           </a-radio-group>
           <span style="color:gray;">(如:满10送2,数量叠加则:满20送4,满30送6)</span>
         </a-form-model-item>
-        <a-form-model-item prop="supplierSn" v-bind="formItemLayout">
+        <a-form-model-item prop="minOrderFlag">
           <span slot="label">
             <a-tooltip title="What do you want others to call you?">
               <a-icon type="info-circle" />
             </a-tooltip>
             订单起订金额
           </span>
-          <a-select default-value="b" style="width: 160px" size="small">
-            <a-select-option value="a">
+          <a-select default-value="1" :value="form.minOrderFlag" style="width: 160px" size="small">
+            <a-select-option value="0">
               不限
             </a-select-option>
-            <a-select-option value="b">
+            <a-select-option value="1">
               限制
             </a-select-option>
           </a-select>
           <a-input-number
+            v-show="form.minOrderFlag && form.minOrderFlag=='1'"
             size="small"
             style="margin-left:10px;width:300px;"
-            v-model="form.endAmount"
+            v-model="form.minOrderAmount"
             :min="0"
             :step="1"
             :precision="2"
             placeholder="请输入金额"/>
         </a-form-model-item>
-        <a-form-model-item prop="supplierSn" v-bind="formItemLayout">
+        <a-form-model-item prop="upperLimitFlag">
           <span slot="label">
             <a-tooltip title="What do you want others to call you?">
               <a-icon type="info-circle" />
             </a-tooltip>
             活动经费上限
           </span>
-          <a-select default-value="b" style="width: 160px" size="small">
-            <a-select-option value="a">
+          <a-select default-value="1" :value="form.upperLimitFlag" style="width: 160px" size="small">
+            <a-select-option value="0">
               不限
             </a-select-option>
-            <a-select-option value="b">
+            <a-select-option value="1">
               限制
             </a-select-option>
           </a-select>
           <a-input-number
+            v-show="form.upperLimitFlag&&form.upperLimitFlag=='1'"
             size="small"
             style="margin-left:10px;width:300px;"
-            v-model="form.endAmount"
+            v-model="form.upperLimitAmount"
             :min="0"
             :step="1"
             :precision="2"
             placeholder="请输入金额"/>
         </a-form-model-item>
-        <a-form-model-item label="促销品与正品一致" prop="returnReason">
-          <a-radio-group v-model="form.supplier" button-style="solid" size="small">
-            <a-radio-button value="a">
+        <a-form-model-item label="促销品与正品一致" prop="regularPromotionSameFlag">
+          <a-radio-group v-model="form.regularPromotionSameFlag" button-style="solid" size="small">
+            <a-radio-button value="1">
             </a-radio-button>
-            <a-radio-button value="b">
+            <a-radio-button value="0">
             </a-radio-button>
           </a-radio-group>
@@ -129,13 +131,13 @@
       <a-card size="small" :bordered="false" class="pages-wrap">
         <div class="flex">
           <a-radio-group v-model="chooseVal" button-style="solid" size="small">
-            <a-radio-button value="a">
+            <a-radio-button value="a" v-show="form.gateFlag==='1'">
               门槛产品
             </a-radio-button>
             <a-radio-button value="b">
               正价产品
             </a-radio-button>
-            <a-radio-button value="c">
+            <a-radio-button value="c" v-show="form.regularPromotionSameFlag==='0'">
               促销产品
             </a-radio-button>
           </a-radio-group>
@@ -145,7 +147,9 @@
             class="button-info"
             id="promotionList-edit-btn">+导入产品</a-button>
         </div>
-        <tableType1></tableType1>
+        <div v-show="chooseVal=='a'"><tableType1 ref="cillProduct" selectType="gateProduct"></tableType1></div>
+        <div v-show="chooseVal=='b'"><tableType1 ref="normalPriceProduct" selectType="regularProduct"></tableType1></div>
+        <div v-show="chooseVal=='c'"><tableType2 ref="offerProduct" selectType="specialProductList"></tableType2></div>
       </a-card>
       <div class="btn-cont">
         <a-button id="promotionList-basicInfo-modal-back" @click="isShow = false">取消</a-button>
@@ -159,17 +163,18 @@
 import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
 import tableType1 from './tableType1.vue'
-import { sparePartsReturnSave, sparePartsReturnInfo } from '@/api/sparePartsReturn'
+import tableType2 from './tableType2.vue'
+import { promotionSave, sparePartsReturnInfo } from '@/api/promotion'
 export default {
   name: 'PromotionListBasicInfoModal',
   mixins: [commonMixin],
-  components: { VSelect, tableType1 },
+  components: { VSelect, tableType1, tableType2 },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
       default: false
     },
-    itemSn: {
+    promotionSn: {
       type: [Number, String],
       default: ''
     }
@@ -183,75 +188,57 @@ export default {
         wrapperCol: { span: 17 }
       },
       form: {
-        promotionName: '',
-        activeDate: undefined,
-        supplierSn: 'b', // 供应商
-        returnReason: '', // 退货原因
-        explainInfo: '', // 补充说明
-        warehouseSn: undefined,
-        attachmentList: ''
+        promotionRuleType: 'BUY_PROD_GIVE_PROD', // 买产品送产品
+        gateFlag: '0', // 门槛
+        gateAmount: '',
+        quotaAmount: '',
+        regularSameFlag: '0', // 满赠规则  不同款商品
+        regularQty: '',
+        promotionQty: '',
+        restrictFlag: undefined, // 限制正价产品款数
+        restrictCategory: '',
+        accrualFlag: '1', // 数量叠加
+        minOrderFlag: '1', // 起订金额
+        minOrderAmount: '',
+        upperLimitFlag: '1', // 活动经费上限
+        upperLimitAmount: '',
+        regularPromotionSameFlag: undefined
       },
-      openDealerModal: false,
-      chooseDealerList: [],
-      attachList: [], // 附件
-      dateFormat: 'YYYY-MM-DD',
       rules: {
-        supplierSn: [
-          { required: true, message: '请选择供应商名称', trigger: 'change' }
-        ],
-        returnReason: [
-          { required: true, message: '请选择退货原因', trigger: 'change' }
-        ],
-        warehouseSn: [{ required: true, message: '请选择退货仓库', trigger: 'change' }]
+        gateFlag: [ { required: true, message: '请选择规则门槛', trigger: 'change' } ],
+        regularSameFlag: [{ required: true, message: '请选择满赠规则', trigger: 'change' }],
+        accrualFlag: [{ required: true, message: '请选择数量是否叠加', trigger: 'change' }],
+        minOrderFlag: [{ required: true, message: '请选择订单起订金额', trigger: 'change' }],
+        upperLimitFlag: [{ required: true, message: '请选择活动经费上限', trigger: 'change' }],
+        regularPromotionSameFlag: [{ required: true, message: '请选择促销品与正品是否一致', trigger: 'change' }]
       },
-      chooseVal: 'a',
-      attachAction: process.env.VUE_APP_API_BASE_URL + '/uploadGetFileInfo'
+      chooseVal: 'a'
     }
   },
   methods: {
-    //  附件上传
-    changeAttach (file) {
-      this.attachList = JSON.parse(file)
-      this.attachList.map(item => {
-        item.fileType = item.extName
-      })
-    },
-    // 选择参与客户
-    handleDealerModal () {
-      this.openDealerModal = true
-      const _this = this
-      if (_this.chooseDealerList.length == 0) {
-        _this.form.promoBuyerList = []
-      }
-      const arr = _this.chooseDealerList.map(item => {
-        return item.buyerSn
-      })
-      // 选择经销商回显
-      _this.$nextTick(() => {
-        _this.$refs.dealerChoose.pageInit(arr)
-      })
-    },
-    // 添加经销商
-    handleAddDealer (list) {
-      this.chooseDealerList = list.map(con => {
-        return {
-          buyerSn: con.dealerSn,
-          buyerName: con.dealerName
+    // 门槛切换  tab 按钮默认显示问题
+    changeGateFlag (e) {
+      if (this.chooseVal != 'c') {
+        if (e.target.value == '0') {
+          this.chooseVal = 'b'
+        } else {
+          this.chooseVal = 'a'
         }
-      })
-      this.openDealerModal = false
-      // 移除表单必填项
-      this.$refs.ruleForm.clearValidate('promoBuyerList')
+      }
     },
     //  保存
     handleSave () {
       const _this = this
+      const tableData = this.$refs.cillProduct.getResultVal()
+      const newtableData = this.$refs.normalPriceProduct.getResultVal()
+      const newtableData1 = this.$refs.offerProduct.getResultVal()
+      debugger
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const form = JSON.parse(JSON.stringify(_this.form))
           form.attachmentList = _this.attachList
           _this.spinning = true
-          sparePartsReturnSave(form).then(res => {
+          promotionSave(form).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               setTimeout(() => {
@@ -289,10 +276,6 @@ export default {
           this.detailsData = null
         }
       })
-    },
-    // 不可选日期
-    disabledDate (date, dateStrings) {
-      return date && date.valueOf('day') < moment().subtract(1, 'day') // 今天以后,包含今天
     }
   },
   watch: {
@@ -314,8 +297,7 @@ export default {
         if (this.itemSn) {
           this.getDetail()
         } else {
-          // 默认仓库
-          this.form.warehouseSn = this.isShowWarehouse ? undefined : this.defWarehouse && this.defWarehouse.warehouseSn
+          this.chooseVal = this.form.gateFlag == '0' ? 'b' : 'a'
         }
       }
     }

+ 37 - 42
src/views/promotionRulesManagement/dealerPromotions/specialOfferModal.vue

@@ -7,7 +7,7 @@
     title="规则设置"
     v-model="isShow"
     @cancel="isShow=false"
-    width="80%">
+    width="70%">
     <a-spin :spinning="spinning" tip="Loading...">
       <a-form-model
         id="promotionList-basicInfo-form"
@@ -16,66 +16,68 @@
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
-        <a-form-model-item label="规则门槛" prop="supplierSn">
-          <a-radio-group v-model="form.supplierSn" button-style="solid" size="small">
-            <a-radio-button value="a">
+        <a-form-model-item label="规则门槛" prop="gateFlag">
+          <a-radio-group v-model="form.gateFlag" button-style="solid" size="small">
+            <a-radio-button value="1">
             </a-radio-button>
-            <a-radio-button value="b">
+            <a-radio-button value="0">
             </a-radio-button>
           </a-radio-group>
           <div class="ruleDescList">
             购买满
-            <a-input-number v-model="form.starAmount" :min="0" :precision="2" size="small"/>
+            <a-input-number v-model="form.gateAmount" :min="0" :precision="2" size="small"/>
             元门槛产品,可使用
-            <a-input-number v-model="form.endAmount" :min="0" :precision="2" size="small"/>
+            <a-input-number v-model="form.quotaAmount" :min="0" :precision="2" size="small"/>
             元配额,采购规则中的特价商品(配额算销售额)
           </div>
         </a-form-model-item>
-        <a-form-model-item prop="supplierSn" v-bind="formItemLayout">
+        <a-form-model-item prop="minOrderFlag">
           <span slot="label">
             <a-tooltip title="What do you want others to call you?">
               <a-icon type="info-circle" />
             </a-tooltip>
             订单起订金额
           </span>
-          <a-select default-value="b" style="width: 160px" size="small">
-            <a-select-option value="a">
+          <a-select default-value="1" :value="form.minOrderFlag" style="width: 160px" size="small">
+            <a-select-option value="0">
               不限
             </a-select-option>
-            <a-select-option value="b">
+            <a-select-option value="1">
               限制
             </a-select-option>
           </a-select>
           <a-input-number
+            v-show="form.minOrderFlag && form.minOrderFlag=='1'"
             size="small"
             style="margin-left:10px;width:300px;"
-            v-model="form.endAmount"
+            v-model="form.minOrderAmount"
             :min="0"
             :step="1"
             :precision="2"
             placeholder="请输入金额"/>
         </a-form-model-item>
-        <a-form-model-item prop="supplierSn" v-bind="formItemLayout">
+        <a-form-model-item prop="upperLimitFlag">
           <span slot="label">
             <a-tooltip title="What do you want others to call you?">
               <a-icon type="info-circle" />
             </a-tooltip>
             活动经费上限
           </span>
-          <a-select default-value="b" style="width: 160px" size="small">
-            <a-select-option value="a">
+          <a-select default-value="1" :value="form.upperLimitFlag" style="width: 160px" size="small">
+            <a-select-option value="0">
               不限
             </a-select-option>
-            <a-select-option value="b">
+            <a-select-option value="1">
               限制
             </a-select-option>
           </a-select>
           <a-input-number
+            v-show="form.upperLimitFlag&&form.upperLimitFlag=='1'"
             size="small"
             style="margin-left:10px;width:300px;"
-            v-model="form.endAmount"
+            v-model="form.upperLimitAmount"
             :min="0"
             :step="1"
             :precision="2"
@@ -85,7 +87,7 @@
       <a-card size="small" :bordered="false" class="pages-wrap">
         <div class="flex">
           <a-radio-group v-model="chooseVal" button-style="solid" size="small">
-            <a-radio-button value="a">
+            <a-radio-button value="a" v-show="form.gateFlag==='1'">
               门槛产品
             </a-radio-button>
             <a-radio-button value="c">
@@ -106,7 +108,8 @@
               id="promotionList-edit-btn">+新增产品</a-button>
           </div>
         </div>
-        <tableType3></tableType3>
+        <div v-show="chooseVal=='a'"><tableType1 ref="cillProduct" selectType="gateProduct"></tableType1></div>
+        <div v-show="chooseVal=='c'"> <tableType3></tableType3></div>
       </a-card>
       <div class="btn-cont">
         <a-button id="promotionList-basicInfo-modal-back" @click="isShow = false">取消</a-button>
@@ -119,12 +122,13 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
+import tableType1 from './tableType1.vue'
 import tableType3 from './tableType3.vue'
 import { sparePartsReturnSave, sparePartsReturnInfo } from '@/api/sparePartsReturn'
 export default {
   name: 'PromotionListBasicInfoModal',
   mixins: [commonMixin],
-  components: { VSelect, tableType3 },
+  components: { VSelect, tableType1, tableType3 },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -144,29 +148,21 @@ export default {
         wrapperCol: { span: 17 }
       },
       form: {
-        promotionName: '',
-        activeDate: undefined,
-        supplierSn: 'b', // 供应商
-        returnReason: '', // 退货原因
-        explainInfo: '', // 补充说明
-        warehouseSn: undefined,
-        attachmentList: ''
+        promotionRuleType: 'PROMO_PROD', // 特价产品
+        gateFlag: '0', // 门槛
+        gateAmount: '',
+        quotaAmount: '',
+        minOrderFlag: '1', // 起订金额
+        minOrderAmount: '',
+        upperLimitFlag: '1', // 活动经费上限
+        upperLimitAmount: ''
       },
-      openDealerModal: false,
-      chooseDealerList: [],
-      attachList: [], // 附件
-      dateFormat: 'YYYY-MM-DD',
       rules: {
-        supplierSn: [
-          { required: true, message: '请选择供应商名称', trigger: 'change' }
-        ],
-        returnReason: [
-          { required: true, message: '请选择退货原因', trigger: 'change' }
-        ],
-        warehouseSn: [{ required: true, message: '请选择退货仓库', trigger: 'change' }]
+        gateFlag: [ { required: true, message: '请选择规则门槛', trigger: 'change' } ],
+        minOrderFlag: [{ required: true, message: '请选择订单起订金额', trigger: 'change' }],
+        upperLimitFlag: [{ required: true, message: '请选择活动经费上限', trigger: 'change' }]
       },
-      chooseVal: 'a',
-      attachAction: process.env.VUE_APP_API_BASE_URL + '/uploadGetFileInfo'
+      chooseVal: 'a'
     }
   },
   methods: {
@@ -275,8 +271,7 @@ export default {
         if (this.itemSn) {
           this.getDetail()
         } else {
-          // 默认仓库
-          this.form.warehouseSn = this.isShowWarehouse ? undefined : this.defWarehouse && this.defWarehouse.warehouseSn
+          this.chooseVal = this.form.gateFlag == '0' ? 'c' : 'a'
         }
       }
     }

+ 78 - 36
src/views/promotionRulesManagement/dealerPromotions/tableType1.vue

@@ -10,14 +10,15 @@
       :rowKey="(record) => record.id"
       :columns="columns"
       :data="loadData"
+      :defaultLoadData="false"
       bordered>
       <!-- 产品分类 -->
-      <template slot="productType" slot-scope="text, record">
-        <div style="max-height:64px;overflow-y:scroll;">
+      <template slot="productType" slot-scope="text, record,index">
+        <div style="max-height:80px;width:100%;overflow-y:scroll;">
           <a-row v-if="record.productTypeList && record.productTypeList.length>0">
-            <a-col :span="20">
+            <a-col :span="18">
               <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.bizUserScopeSn,con,'typeList')" v-for="(con,i) in record.productTypeList" :key="i">
-                {{ con.dataName }}
+                {{ con.title }}
               </a-tag>
             </a-col>
             <a-col :span="4" style="text-align:right;">
@@ -36,12 +37,12 @@
         </div>
       </template>
       <!-- 品牌 -->
-      <template slot="productBrand" slot-scope="text, record">
-        <div style="max-height:64px;overflow-y:scroll;">
+      <template slot="productBrand" slot-scope="text, record,index">
+        <div style="max-height:106spx;overflow-y:scroll;">
           <a-row v-if="record.productBrandList && record.productBrandList.length>0">
             <a-col :span="20">
               <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.bizUserScopeSn,item,'brandList')" v-for="(item,j) in record.productBrandList" :key="j">
-                {{ item.dataName }}
+                {{ item.brandName }}
               </a-tag>
             </a-col>
             <a-col :span="4" style="text-align:right;">
@@ -60,12 +61,12 @@
         </div>
       </template>
       <!-- 产品 -->
-      <template slot="product" slot-scope="text, record">
+      <template slot="product" slot-scope="text, record,index">
         <div style="max-height:64px;overflow-y:scroll;">
-          <a-row v-if="record.productList && record.productList.length>0">
+          <a-row v-if="record.productThisList && record.productThisList.length>0">
             <a-col :span="20">
-              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.bizUserScopeSn,item,'productList')" v-for="(item,j) in record.productList" :key="j">
-                {{ item.dataName }}
+              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.bizUserScopeSn,item,'productList')" v-for="(item,k) in record.productThisList" :key="k">
+                {{ item.code }}
               </a-tag>
             </a-col>
             <a-col :span="4" style="text-align:right;">
@@ -87,17 +88,17 @@
       <template slot="setNum" slot-scope="text, record">
         <div>
           <v-select
-            v-model="record.returnReason"
+            v-model="record.unitType"
             size="small"
             style="width:55%;"
             ref="returnReason"
-            code="SPARE_PARTS_RETURN_REASON"
+            code="SCOPE_UNIT_TYPE"
             placeholder="请选择"
             allowClear></v-select>
           <a-input-number
             size="small"
             style="margin-left:10px;width:30%;"
-            v-model="record.endAmount"
+            v-model="record.unitQty"
             :min="0"
             :step="1"
             :precision="2"
@@ -137,9 +138,10 @@ import { commonMixin } from '@/utils/mixin'
 import { VSelect, STable } from '@/components'
 import ChooseBrandModal from '@/views/common/chooseBrandModal.vue'
 import ChooseTypeModal from '@/views/common/chooseTypeModal.vue'
-import chooseProductsModal from '@/views/common/chooseProductsModal.vue'
+import chooseProductsModal from './chooseProductsModal.vue'
 
 import { sparePartsReturnList } from '@/api/sparePartsReturn'
+import { getNewScopeSn } from '@/api/promotion'
 export default {
   name: 'TableType1',
   mixins: [commonMixin],
@@ -148,6 +150,10 @@ export default {
     itemSn: {
       type: [Number, String],
       default: ''
+    },
+    selectType: {
+      type: String,
+      default: ''
     }
   },
   data () {
@@ -168,44 +174,80 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.spinning = true
-        return sparePartsReturnList(Object.assign(parameter, this.queryParam)).then(res => {
-          let data
-          if (res.status == 200) {
-            data = res.data
-            const no = (data.pageNo - 1) * data.pageSize
-            for (var i = 0; i < data.list.length; i++) {
-              data.list[i].no = no + i + 1
-            }
-            this.dataSource = data.list
-          }
-          this.spinning = false
-          return data
+
+        // return sparePartsReturnList(Object.assign(parameter, this.queryParam)).then(res => {
+        //   let data
+        //   if (res.status == 200) {
+        //     data = res.data
+        //     const no = (data.pageNo - 1) * data.pageSize
+        //     for (var i = 0; i < data.list.length; i++) {
+        //       data.list[i].no = no + i + 1
+        //     }
+        //     this.dataSource[this.selectType] = data.list
+        //   }
+        //   this.spinning = false
+        //   return data
+        // })
+        return new Promise((resolve, reject) => {
+          resolve({
+            list: [],
+            count: 0
+          })
         })
-      }
+      },
+      chooseBrand: [],
+      chooseType: [],
+      brandTagIndex: null, // 所选品牌位置
+      classifyTagIndex: null, // 所选分类位置
+      productTagIndex: null, // 所选产品位置
+      chooseProducts: []
     }
   },
   methods: {
-    // 新增一行
+  // 新增一行
     handleAddRow () {
       const _this = this
-      const newData = {
-        productTypeList: [],
-        productBrandList: [],
-        productList: []
-      }
-      _this.dataSource.push(newData)
+      _this.spinning = false
+      getNewScopeSn({}).then(res => {
+        if (res.status == 200) {
+          const newData = {
+            productScopeSn: res.data,
+            productTypeList: [],
+            productBrandList: [],
+            productThisList: []
+          }
+          _this.dataSource[_this.selectType].push(newData)
+        } else {
+          _this.spinning = false
+        }
+      })
     },
     // 添加产品分类
     addClassifyTag (pos, row) {
+      this.classifyTagIndex = pos
       this.openTypeModal = true
     },
+    handleTypeOk (mainArr) {
+      this.dataSource[this.selectType][this.classifyTagIndex].productTypeList = mainArr
+    },
     // 添加产品品牌
     addBrandTag (pos, row) {
+      this.brandTagIndex = pos
       this.openBrandModal = true
     },
+    handleBrandOk (conList) {
+      this.dataSource[this.selectType][this.brandTagIndex].productBrandList = conList
+    },
     // 添加产品
-    addProductTag () {
+    addProductTag (pos, row) {
+      this.productTagIndex = pos
       this.openProductsModal = true
+    },
+    getResultVal () {
+      return this.dataSource
+    },
+    handleProductsOk (arr) {
+      this.dataSource[this.selectType][this.productTagIndex].productThisList = arr
     }
   }
 }

+ 54 - 42
src/views/promotionRulesManagement/dealerPromotions/tableType2.vue

@@ -12,12 +12,12 @@
       :data="loadData"
       bordered>
       <!-- 产品分类 -->
-      <template slot="productType" slot-scope="text, record">
-        <div style="max-height:64px;overflow-y:scroll;">
+      <template slot="productType" slot-scope="text, record,index">
+        <div style="max-height:80px;width:100%;overflow-y:scroll;">
           <a-row v-if="record.productTypeList && record.productTypeList.length>0">
-            <a-col :span="20">
+            <a-col :span="18">
               <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.bizUserScopeSn,con,'typeList')" v-for="(con,i) in record.productTypeList" :key="i">
-                {{ con.dataName }}
+                {{ con.title }}
               </a-tag>
             </a-col>
             <a-col :span="4" style="text-align:right;">
@@ -36,12 +36,12 @@
         </div>
       </template>
       <!-- 品牌 -->
-      <template slot="productBrand" slot-scope="text, record">
-        <div style="max-height:64px;overflow-y:scroll;">
+      <template slot="productBrand" slot-scope="text, record,index">
+        <div style="max-height:106spx;overflow-y:scroll;">
           <a-row v-if="record.productBrandList && record.productBrandList.length>0">
             <a-col :span="20">
               <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.bizUserScopeSn,item,'brandList')" v-for="(item,j) in record.productBrandList" :key="j">
-                {{ item.dataName }}
+                {{ item.brandName }}
               </a-tag>
             </a-col>
             <a-col :span="4" style="text-align:right;">
@@ -60,12 +60,12 @@
         </div>
       </template>
       <!-- 产品 -->
-      <template slot="product" slot-scope="text, record">
+      <template slot="product" slot-scope="text, record,index">
         <div style="max-height:64px;overflow-y:scroll;">
-          <a-row v-if="record.productList && record.productList.length>0">
+          <a-row v-if="record.productThisList && record.productThisList.length>0">
             <a-col :span="20">
-              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.bizUserScopeSn,item,'productList')" v-for="(item,j) in record.productList" :key="j">
-                {{ item.dataName }}
+              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.bizUserScopeSn,item,'productList')" v-for="(item,k) in record.productThisList" :key="k">
+                {{ item.code }}
               </a-tag>
             </a-col>
             <a-col :span="4" style="text-align:right;">
@@ -83,27 +83,6 @@
           </a-row>
         </div>
       </template>
-      <!-- 设置起订量 -->
-      <template slot="setNum" slot-scope="text, record">
-        <div>
-          <v-select
-            v-model="record.returnReason"
-            size="small"
-            style="width:55%;"
-            ref="returnReason"
-            code="SPARE_PARTS_RETURN_REASON"
-            placeholder="请选择"
-            allowClear></v-select>
-          <a-input-number
-            size="small"
-            style="margin-left:10px;width:30%;"
-            v-model="record.endAmount"
-            :min="0"
-            :step="1"
-            :precision="2"
-            placeholder="请输入"/>
-        </div>
-      </template>
       <span slot="action" slot-scope="text,record">
         <a-button
           size="small"
@@ -137,9 +116,10 @@ import { commonMixin } from '@/utils/mixin'
 import { VSelect, STable } from '@/components'
 import ChooseBrandModal from '@/views/common/chooseBrandModal.vue'
 import ChooseTypeModal from '@/views/common/chooseTypeModal.vue'
-import chooseProductsModal from '@/views/common/chooseProductsModal.vue'
+import chooseProductsModal from './chooseProductsModal.vue'
 
 import { sparePartsReturnList } from '@/api/sparePartsReturn'
+import { getNewScopeSn } from '@/api/promotion'
 export default {
   name: 'TableType1',
   mixins: [commonMixin],
@@ -148,6 +128,10 @@ export default {
     itemSn: {
       type: [Number, String],
       default: ''
+    },
+    selectType: {
+      type: String,
+      default: ''
     }
   },
   data () {
@@ -175,36 +159,64 @@ export default {
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
             }
-            this.dataSource = data.list
+            this.dataSource[this.selectType] = data.list
           }
           this.spinning = false
           return data
         })
-      }
+      },
+      chooseBrand: [],
+      chooseType: [],
+      brandTagIndex: null, // 所选品牌位置
+      classifyTagIndex: null, // 所选分类位置
+      productTagIndex: null// 所选产品位置
     }
   },
   methods: {
     // 新增一行
     handleAddRow () {
       const _this = this
-      const newData = {
-        productTypeList: [],
-        productBrandList: [],
-        productList: []
-      }
-      _this.dataSource.push(newData)
+      _this.spinning = false
+      getNewScopeSn({}).then(res => {
+        if (res.status == 200) {
+          const newData = {
+            productScopeSn: res.data,
+            productTypeList: [],
+            productBrandList: [],
+            productThisList: []
+          }
+          _this.dataSource[this.selectType].push(newData)
+        } else {
+          _this.spinning = false
+        }
+      })
     },
     // 添加产品分类
     addClassifyTag (pos, row) {
+      this.classifyTagIndex = pos
       this.openTypeModal = true
     },
+    handleTypeOk (mainArr) {
+      this.dataSource[this.selectType][this.classifyTagIndex].productTypeList = mainArr
+    },
     // 添加产品品牌
     addBrandTag (pos, row) {
+      this.brandTagIndex = pos
       this.openBrandModal = true
     },
+    handleBrandOk (conList) {
+      this.dataSource[this.selectType][this.brandTagIndex].productBrandList = conList
+    },
     // 添加产品
-    addProductTag () {
+    addProductTag (pos, row) {
+      this.productTagIndex = pos
       this.openProductsModal = true
+    },
+    getResultVal () {
+      return this.dataSource
+    },
+    handleProductsOk (arr) {
+      this.dataSource[this.selectType][this.productTagIndex].productThisList = arr
     }
   }
 }

+ 98 - 40
src/views/promotionRulesManagement/dealerPromotions/tableType3.vue

@@ -59,27 +59,93 @@
           </a-row>
         </div>
       </template>
-      <!-- 设置起订量 -->
-      <template slot="setNum" slot-scope="text, record">
-        <div>
-          <v-select
-            v-model="record.returnReason"
-            size="small"
-            style="width:55%;"
-            ref="returnReason"
-            code="SPARE_PARTS_RETURN_REASON"
-            placeholder="请选择"
-            allowClear></v-select>
-          <a-input-number
-            size="small"
-            style="margin-left:10px;width:30%;"
-            v-model="record.endAmount"
-            :min="0"
-            :step="1"
-            :precision="2"
-            placeholder="请输入"/>
-        </div>
+      <!-- 省价特价 -->
+      <template slot="provincePrice" slot-scope="text, record">
+        <a-input-number
+          size="small"
+          style="width:80%;"
+          v-model="record.provinceDiscountPrice"
+          :min="0"
+          :step="1"
+          :precision="2"
+          placeholder="请输入"/>
+      </template>
+      <!-- 省价折扣 -->
+      <template slot="provinceDiscount" slot-scope="text, record">
+        <a-input-number
+          size="small"
+          style="width:80%;"
+          v-model="record.provinceDiscountRate"
+          :min="0"
+          :step="1"
+          :precision="0"
+          placeholder="请输入"/>%
+      </template>
+      <!-- 市价特价 -->
+      <template slot="cityPrice" slot-scope="text, record">
+        <a-input-number
+          size="small"
+          style="width:80%;"
+          v-model="record.cityDiscountPrice"
+          :min="0"
+          :step="1"
+          :precision="2"
+          placeholder="请输入"/>
       </template>
+      <!-- 市价折扣 -->
+      <template slot="cityDiscount" slot-scope="text, record">
+        <a-input-number
+          size="small"
+          style="width:80%;"
+          v-model="record.cityDiscountRate"
+          :min="0"
+          :step="1"
+          :precision="0"
+          placeholder="请输入"/>%
+      </template>
+      <!-- 特约特价 -->
+      <template slot="specialPrice" slot-scope="text, record">
+        <a-input-number
+          size="small"
+          style="width:80%;"
+          v-model="record.specialDiscountPrice"
+          :min="0"
+          :step="1"
+          :precision="2"
+          placeholder="请输入"/>
+      </template>
+      <!-- 特约折扣 -->
+      <template slot="specialDiscount" slot-scope="text, record">
+        <a-input-number
+          size="small"
+          style="width:80%;"
+          v-model="record.specialDiscountRate"
+          :min="0"
+          :step="1"
+          :precision="0"
+          placeholder="请输入"/>%
+      </template>
+      <!-- 设置起订量 -->
+     <template slot="setNum" slot-scope="text, record">
+       <div>
+         <v-select
+           v-model="record.unitType"
+           size="small"
+           style="width:55%;"
+           ref="returnReason"
+           code="SCOPE_UNIT_TYPE"
+           placeholder="请选择"
+           allowClear></v-select>
+         <a-input-number
+           size="small"
+           style="margin-left:10px;width:30%;"
+           v-model="record.unitQty"
+           :min="0"
+           :step="1"
+           :precision="2"
+           placeholder="请输入"/>
+       </div>
+     </template>
       <span slot="action" slot-scope="text,record">
         <a-button
           size="small"
@@ -98,13 +164,6 @@
     <chooseBrandModal :openModal="openBrandModal" :chooseData="chooseBrand" @close="openBrandModal=false" @ok="handleBrandOk" />
     <!-- 选择产品分类 -->
     <chooseTypeModal :openModal="openTypeModal" :chooseData="chooseType" @close="openTypeModal=false" @ok="handleTypeOk" />
-    <!-- 选择产品 -->
-    <chooseProductsModal
-      type="dealership"
-      :openModal="openProductsModal"
-      :chooseData="chooseProducts"
-      @close="openProductsModal=false"
-      @ok="handleProductsOk" />
   </div>
 </template>
 
@@ -131,20 +190,19 @@ export default {
     return {
       spinning: false,
       columns: [
-        { title: '产品分类', width: '10%', scopedSlots: { customRender: 'productType' }, align: 'center' },
-        { title: '品牌', width: '10%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
+        { title: '产品分类', width: '11%', scopedSlots: { customRender: 'productType' }, align: 'center' },
+        { title: '品牌', width: '11%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
         { title: '产品', dataIndex: 'auditDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '省价原价', dataIndex: 'cityPrice', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '省价特价', dataIndex: 'cityPrice1', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '省价折扣', dataIndex: 'cityPrice2', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '市价原价', dataIndex: 'cityPrice3', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '市价特价', dataIndex: 'cityPrice4', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '市价折扣', dataIndex: 'cityPrice5', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '特约原价', dataIndex: 'cityPrice6', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '特约特价', dataIndex: 'cityPrice7', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '特约折扣', dataIndex: 'cityPrice8', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '特约原价', dataIndex: 'cityPrice9', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '设置起订量', width: '10%', scopedSlots: { customRender: 'setNum' }, align: 'center' },
+        { title: '省价原价', dataIndex: 'provincePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '省价特价', scopedSlots: { customRender: 'provincePrice' }, width: '6%', align: 'right'},
+        { title: '省价折扣',scopedSlots: { customRender: 'provinceDiscount' },width: '6%', align: 'right'},
+        { title: '市价原价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '市价特价', scopedSlots: { customRender: 'cityPrice' },width: '6%', align: 'right' },
+        { title: '市价折扣',scopedSlots: { customRender: 'cityDiscount' },width: '6%', align: 'right' },
+        { title: '特约原价', dataIndex: 'specialPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '特约特价', scopedSlots: { customRender: 'specialPrice' },width: '6%', align: 'right'},
+        { title: '特约折扣', scopedSlots: { customRender: 'specialDiscount' },width: '6%', align: 'right'},
+        { title: '设置起订量', width: '14%', scopedSlots: { customRender: 'setNum' }, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
       ],
       queryParam: {},