فهرست منبع

促销规则---简称

chenrui 1 سال پیش
والد
کامیت
4fb526ec4e

+ 23 - 18
src/views/promotionRulesManagement/dealerPromotions/addModal.vue

@@ -19,6 +19,9 @@
         <a-form-model-item label="促销名称" prop="title">
           <a-input id="promotionList-promotionName" v-model.trim="form.title" allowClear placeholder="请输入促销名称(最多30个字符)" :maxLength="30"></a-input>
         </a-form-model-item>
+        <a-form-model-item label="促销简称" prop="description">
+          <a-input id="promotionList-description" v-model.trim="form.description" allowClear placeholder="请输入促销简称(最多10个字符)" :maxLength="10"></a-input>
+        </a-form-model-item>
         <a-form-model-item label="促销时间" prop="activeDate">
           <a-range-picker
             style="width:100%"
@@ -30,7 +33,7 @@
             @change="onChangeDate"></a-range-picker>
         </a-form-model-item>
         <a-form-model-item label="费用所属部门" prop="expenseDepartmentSn">
-           <department style="width: 100%;" @change="departementChange" id="promotionList-basicInfo-activeDate" v-model="form.expenseDepartmentSn"></department>
+          <department style="width: 100%;" @change="departementChange" id="promotionList-basicInfo-activeDate" v-model="form.expenseDepartmentSn"></department>
         </a-form-model-item>
         <a-form-model-item label="参与客户" prop="dealerSnList">
           <a-row :gutter="15">
@@ -49,12 +52,12 @@
             </a-col>
           </a-row>
         </a-form-model-item>
-        <a-form-model-item label="促销描述" prop="description">
+        <a-form-model-item label="促销描述" prop="content">
           <a-textarea
-            id="promotionList"
+            id="promotionList-content"
             :maxLength="500"
             :rows="5"
-            v-model="form.description"
+            v-model="form.content"
             placeholder="请输入促销描述"
             allowClear />
         </a-form-model-item>
@@ -102,7 +105,7 @@ import department from '@/views/expenseManagement/expenseReimbursement/departmen
 import warehouse from '@/views/common/chooseWarehouse.js'
 import moment from 'moment'
 import chooseDealer from '../promotionManagement/chooseDealer'
-import { dealerPromotionSave, dealerPromotionInfo,dealerPromotionEdit } from '@/api/promotion'
+import { dealerPromotionSave, dealerPromotionInfo, dealerPromotionEdit } from '@/api/promotion'
 export default {
   name: 'PromotionListBasicInfoModal',
   mixins: [commonMixin],
@@ -128,35 +131,37 @@ export default {
       form: {
         title: '',
         activeDate: undefined,
-        expenseDepartmentSn:undefined,//费用所属部门
-        description: '', // 活动描述
-        attachmentList: '',//附件
-        dealerSnList:[]//参与客户
+        expenseDepartmentSn: undefined, // 费用所属部门
+        description: '', // 活动简称
+        content: '', // 活动描述
+        attachmentList: '', // 附件
+        dealerSnList: []// 参与客户
       },
       openDealerModal: false,
       chooseDealerList: [],
       attachList: [], // 附件
       dateFormat: 'YYYY-MM-DD',
       rules: {
-        title:[{ required: true, message: '请输入促销名称', trigger: 'blur' }],
-        activeDate:[{ required: true, message: '请选择促销时间', trigger: 'change' } ],
+        title: [{ required: true, message: '请输入促销名称', trigger: 'blur' }],
+        activeDate: [{ required: true, message: '请选择促销时间', trigger: 'change' } ],
         expenseDepartmentSn: [{ required: true, message: '请选择费用所属部门', trigger: 'change' }],
         dealerSnList: [{ required: true, message: '请选择参与客户', trigger: 'change' }],
-        description:[{ required: true, message: '请输入促销描述', trigger: 'blur' }]
+        description: [{ required: true, message: '请输入促销简称', trigger: 'blur' }],
+        content: [{ required: true, message: '请输入促销描述', trigger: 'blur' }]
       },
       attachAction: process.env.VUE_APP_API_BASE_URL + '/uploadGetFileInfo'
     }
   },
   methods: {
-    //选择活动时间
-    onChangeDate(date, dateString){
+    // 选择活动时间
+    onChangeDate (date, dateString) {
       this.form.activeDate = date
       if (dateString[0] != '' && dateString[1] != '') {
-       this.form.promotionDateStart = dateString[0] + ' 00:00:00'
+        this.form.promotionDateStart = dateString[0] + ' 00:00:00'
         this.form.promotionDateEnd = dateString[1] + ' 23:59:59'
       }
     },
-    //费用所属部门
+    // 费用所属部门
     departementChange () {
       this.$nextTick(() => {
         this.$refs.ruleForm.validateField('expenseDepartmentSn')
@@ -209,7 +214,7 @@ export default {
           form.attachmentList = _this.attachList
           delete form.activeDate
           _this.spinning = true
-          const ajaxName = _this.itemSn?dealerPromotionEdit:dealerPromotionSave
+          const ajaxName = _this.itemSn ? dealerPromotionEdit : dealerPromotionSave
           ajaxName(form).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
@@ -235,7 +240,7 @@ export default {
           this.chooseDealerList = data.dealerList
           data.dealerSnList = data.dealerSnList
           data.activeDate = [data.promotionDateStart, data.promotionDateEnd]
-          if(data.attachmentList){
+          if (data.attachmentList) {
             this.attachList = data.attachmentList
             this.$nextTick(() => {
               this.$refs.attachList.setFileList(this.attachList)

+ 14 - 13
src/views/promotionRulesManagement/dealerPromotions/chooseProductsModal.vue

@@ -62,7 +62,7 @@
             size="small"
             :rowKey="(record) => record.productSn"
             rowKeyName="productSn"
-            :row-selection="{ columnWidth: 40, getCheckboxProps:record =>({props: { disabled: this.chooseData && this.chooseData.indexOf(record.productSn) > -1 }}) }"
+            :row-selection="{ columnWidth: 40, getCheckboxProps:record =>({props: { disabled: this.chooseDataList && this.chooseDataList.indexOf(record.productSn) > -1 }}) }"
             @rowSelection="rowSelectionFun"
             :columns="columns"
             :data="loadData"
@@ -118,6 +118,7 @@ export default {
         productTypeSn2: '', //  产品二级分类
         productTypeSn3: '' //  产品三级分类
       },
+      chooseDataList: [],
       disabled: false, //  查询、重置按钮是否可操作
       loading: false, //  表格加载中
       columns: [
@@ -175,9 +176,8 @@ export default {
     //  重置
     resetSearchForm () {
       this.resetData()
-      console.log('1111111111111111')
       this.$refs.table.refresh()
-      // this.$refs.table.clearTable()
+      this.$refs.table.clearTable()
     },
     // 保存
     handleSave () {
@@ -204,18 +204,19 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
-        this.resetSearchForm()
       } else {
         const _this = this
-        // let selectedRows = []
-        // const selectedRowKeys = []
-        // selectedRows = this.chooseData
-        // this.chooseData.map(item => {
-        //   selectedRowKeys.push(item.goodsSn)
-        // })
-        // this.$nextTick(() => { // 页面渲染完成后的回调
-        //   _this.$refs.table.setTableSelected(selectedRowKeys, selectedRows) // 设置表格选中项
-        // })
+        _this.resetSearchForm()
+        let selectedRows = []
+        const selectedRowKeys = []
+        selectedRows = this.chooseData
+        this.chooseData.map(item => {
+          selectedRowKeys.push(item.goodsSn)
+        })
+        this.chooseDataList = selectedRowKeys
+        this.$nextTick(() => { // 页面渲染完成后的回调
+          _this.$refs.table.setTableSelected(selectedRowKeys, selectedRows) // 设置表格选中项
+        })
       }
     }
   }

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

@@ -180,8 +180,9 @@ export default {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
         { title: '促销类型', dataIndex: 'promotionRuleTypeDictValue', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '促销简称', dataIndex: 'description', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '规则门槛', scopedSlots: { customRender: 'cillProduct' }, width: '20%', align: 'center' },
-        { title: '规则', scopedSlots: { customRender: 'ruleProduct' }, width: '28%', align: 'center' },
+        { title: '规则', scopedSlots: { customRender: 'ruleProduct' }, width: '20%', align: 'center' },
         { title: '订单起订金额(元)', dataIndex: 'minOrderAmount', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '订单经费上限(元)', dataIndex: 'upperLimitAmount', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '20%', align: 'center' }

+ 29 - 57
src/views/promotionRulesManagement/dealerPromotions/editActiveEndTime.vue

@@ -16,13 +16,13 @@
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
-        <a-form-model-item label="" prop="time">
-          <div style="margin-left:40px;">确定要变更促销名称1的促销时间吗?</div>
+        <a-form-model-item label="" prop="name">
+          <div style="margin-left:40px;">确定要变更{{ form.name }}的促销时间吗?</div>
         </a-form-model-item>
         <a-form-model-item label="原结束日期" prop="time">
-          <span>2023-10-01</span>
+          <span>{{ form.timeStart }}</span>
         </a-form-model-item>
-        <a-form-model-item label="变更后结束日期" prop="supplierSn">
+        <a-form-model-item label="变更后结束日期" prop="timeEnd">
           <a-date-picker style="width:90%" @change="onChange" :format="dateFormat"/>
         </a-form-model-item>
       </a-form-model>
@@ -55,67 +55,47 @@ export default {
         wrapperCol: { span: 16 }
       },
       form: {
-        time: ''
+        name: '',
+        timeStart: '',
+        timeEnd: ''
       },
       dateFormat: 'YYYY-MM-DD',
       rules: {
-        supplierSn: [
-          { required: true, message: '请选择供应商名称', trigger: 'change' }
+        timeEnd: [
+          { required: true, message: '请选择变更的结束时间', trigger: 'change' }
         ]
       }
     }
   },
   methods: {
     onChange (date, dateString) {
-      console.log(date, dateString)
+      this.form.timeEnd = dateString + ' 23:59:59'
     },
     //  保存
     handleSave () {
       const _this = this
-      promotionDateModify({promotionSn:'565316713436389376',promotionDateStart:'2023-08-17 00:00:00',promotionDateEnd:'2023-09-17 00:00:00'}).then(res => {
-        if (res.status == 200) {
-          _this.$message.success(res.message)
-          setTimeout(() => {
-            _this.isShow = false
-            _this.$emit('ok', res.data)
-            _this.spinning = false
-          }, 1000)
-        } else {
-          _this.spinning = false
-        }
-      })
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
-          const form = JSON.parse(JSON.stringify(_this.form))
-          form.attachmentList = _this.attachList
-          _this.spinning = true
-         
+          promotionDateModify({ promotionSn: _this.form.sn, promotionDateStart: _this.form.timeStart, promotionDateEnd: this.form.timeEnd }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              setTimeout(() => {
+                _this.isShow = false
+                _this.$emit('ok', res.data)
+                _this.spinning = false
+              }, 1000)
+            } else {
+              _this.spinning = false
+            }
+          })
         } else {
           return false
         }
       })
     },
-    // 获取编辑详情
-    getDetail () {
-      sparePartsReturnInfo({ sn: this.itemSn }).then(res => {
-        if (res.status == 200) {
-          const resultObj = res.data
-          this.attachList = resultObj.attachmentList
-          const obj = {
-            supplierSn: resultObj.supplierSn,
-            returnReason: resultObj.returnReason, // 退货原因
-            explainInfo: resultObj.explainInfo, // 补充说明
-            warehouseSn: resultObj.warehouseSn,
-            sparePartsReturnSn: this.itemSn
-          }
-          this.$nextTick(() => {
-            this.$refs.attachList.setFileList(this.attachList)
-          })
-          this.form = { ...this.form, ...obj }
-        } else {
-          this.detailsData = null
-        }
-      })
+    // 获取显示内容
+    setData (obj) {
+      this.form = { ...this.form, ...obj }
     },
     // 不可选日期
     disabledDate (date, dateStrings) {
@@ -131,18 +111,10 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
-        this.attachList = []
-        this.supplierName = null
-        this.$nextTick(() => {
-          this.$refs.attachList.setFileList('')
-          this.$refs.ruleForm.resetFields()
-        })
-      } else {
-        if (this.itemSn) {
-          this.getDetail()
-        } else {
-          // 默认仓库
-          this.form.warehouseSn = this.isShowWarehouse ? undefined : this.defWarehouse && this.defWarehouse.warehouseSn
+        this.form = {
+          name: '',
+          timeStart: '',
+          timeEnd: ''
         }
       }
     }

+ 56 - 69
src/views/promotionRulesManagement/dealerPromotions/list.vue

@@ -147,7 +147,36 @@
     <!-- 新增/编辑弹窗-->
     <add-modal v-drag :itemSn="itemSn" :openModal="openModal" @ok="handleOk" @close="openModal=false" />
     <!-- 促销时间变更 -->
-    <edit-active-end-time v-drag :openModal="editEndModal" @ok="handleEditOk" @close="editEndModal=false" />
+    <edit-active-end-time ref="editTime" v-drag :openModal="editEndModal" @ok="$refs.table.refresh()" @close="editEndModal=false" />
+    <!-- 审核弹窗 -->
+    <a-modal
+      :closable="false"
+      v-model="openAuditModal"
+      :footer="null"
+      width="416px"
+      centered>
+      <div style="display:flex;margin:30px 0 20px 20px;">
+        <a-icon type="question-circle" :style="{fontSize:'23px',color:'#faad14'}"/>
+        <div style="margin-left:10px;">
+          <p style="font-size:16px;font-wight:bold;">提示</p>
+          <p>请点击下方按钮确认操作?</p>
+        </div>
+      </div>
+      <!-- 按钮 -->
+      <div style="text-align: right;">
+        <a-button
+          id="auditModal-cancel"
+          class="button-cancel"
+          @click="closeAuditModal"
+          style="margin-right: 15px;">审核不通过</a-button>
+        <a-button
+          type="primary"
+          id="auditModal-save"
+          class="button-primary"
+          @click="handleAuditModal"
+        >审核通过</a-button>
+      </div>
+    </a-modal>
   </a-card>
 </template>
 
@@ -161,7 +190,6 @@ import rangeDate from '@/views/common/rangeDate.vue'
 // import chooseDepartUserModal from './chooseDepartUserModal.vue'
 import editActiveEndTime from './editActiveEndTime.vue'
 import reportModal from '@/views/common/reportModal.vue'
-import { hdExportExcel } from '@/libs/exportExcel'
 import supplier from '@/views/common/supplier.js'
 import warehouse from '@/views/common/chooseWarehouse.js'
 import { dealerPromotionList, dealerPromotionDel, modifyEnabledFlag, promotionAudit, promotionIsOver } from '@/api/promotion'
@@ -175,10 +203,8 @@ export default {
       disabled: false, //  查询、重置按钮是否可操作
       openModal: false, // 新增弹框是否显示
       openCustomerModal: false, // 参与客户弹窗
-      editEndModal: false,
+      editEndModal: false, // 更改促销时间
       openDetailModal: false, // 详情弹窗
-      showExport: false,
-      exportLoading: false,
       tableHeight: 0,
       // 查询参数
       queryParam: {
@@ -192,9 +218,10 @@ export default {
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '促销名称', scopedSlots: { customRender: 'promotionName' }, width: '14%', align: 'center' },
+        { title: '促销简称', dataIndex: 'description', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '促销时间', scopedSlots: { customRender: 'promotionTime' }, width: '15%', align: 'center' },
         { title: '参与客户', scopedSlots: { customRender: 'joinCustomers' }, width: '12%', align: 'center', ellipsis: true },
-        { title: '促销描述', dataIndex: 'description', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '促销描述', dataIndex: 'content', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '活动状态', dataIndex: 'stateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '发布状态', scopedSlots: { customRender: 'releaseStatus' }, width: '9%', align: 'center', ellipsis: true },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
@@ -217,9 +244,8 @@ export default {
           return data
         })
       },
-      itemSnSh: null,
       itemSn: null, // 经销商促销活动SN
-      auditTime: null// 审核时间
+      openAuditModal: false // 审核弹窗
     }
   },
   methods: {
@@ -232,19 +258,6 @@ export default {
       this.queryParam.beginDate = date[0]
       this.queryParam.endDate = date[1]
     },
-    //  导出
-    handleExport () {
-      const _this = this
-      _this.$store.state.app.curActionPermission = 'B_promotionListExport'
-      _this.exportLoading = true
-      _this.spinning = true
-      hdExportExcel(sparePartsReturnExportDetail, _this.queryParam, '采购退货', function () {
-        _this.exportLoading = false
-        _this.spinning = false
-        _this.showExport = true
-        _this.$store.state.app.curActionPermission = ''
-      })
-    },
     //  新增
     handleAdd () {
       this.itemSn = null
@@ -292,20 +305,14 @@ export default {
     // 审核
     handleCheck (row) {
       const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '请点击下方按钮确认操作?',
-        cancelText: '审核不通过',
-        okText: '审核通过',
-        centered: true,
-        closable: true,
-        onOk () {
-          _this.handleAudit({ promotionSn: row.promotionSn, auditFlag: 1 })
-        },
-        onCancel (e) {
-          _this.handleAudit({ promotionSn: row.promotionSn, auditFlag: 0 })
-        }
-      })
+      _this.itemSn = row.promotionSn
+      _this.openAuditModal = true
+    },
+    handleAuditModal () {
+      this.handleAudit({ promotionSn: this.itemSn, auditFlag: 1 })
+    },
+    closeAuditModal () {
+      this.handleAudit({ promotionSn: this.itemSn, auditFlag: 0 })
     },
     handleAudit (ajaxData) {
       const _this = this
@@ -314,17 +321,23 @@ export default {
         if (res.status == 200) {
           _this.$message.success(res.message)
           _this.$refs.table.refresh()
-          _this.spinning = false
-        } else {
-          _this.spinning = false
         }
+        _this.itemSn = null
+        _this.openAuditModal = false
+        _this.spinning = false
       })
     },
     // 促销时间变更
-    handleTime () {
+    handleTime (row) {
       this.editEndModal = true
+      const showData = {
+        sn: row.promotionSn,
+        name: row.title,
+        timeStart: row.promotionDateStart,
+        timeEnd: row.promotionDateEnd
+      }
+      this.$refs.editTime.setData(showData)
     },
-    handleEditOk () {},
     // 终止
     handleEnd (row) {
       const _this = this
@@ -346,27 +359,6 @@ export default {
         }
       })
     },
-    // 再次提交
-    handleResubmit (row) {
-      const _this = this
-      this.$confirm({
-        title: '操作提示',
-        content: '系统将自动生成一个新的采购退货单,新单据中的产品申退数量将以最大可用库存为准,最大可用库存为0时,系统将强制删除已选的对应产品。您可以对新单据进行编辑、提交等操作,原单据保持不变,确认操作吗?',
-        centered: true,
-        onOk () {
-          _this.spinning = true
-          againSubmit({ sparePartsReturnSn: row.sparePartsReturnSn }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.$refs.table.refresh()
-              _this.spinning = false
-            } else {
-              _this.spinning = false
-            }
-          })
-        }
-      })
-    },
     // 关闭采购退货详情弹框
     closeDetailModal () {
       this.itemSn = null
@@ -398,10 +390,8 @@ export default {
       this.queryParam = {
         beginDate: undefined,
         endDate: undefined,
-        sparePartsReturnNo: undefined,
-        supplierSn: undefined,
-        returnReason: undefined,
-        warehouseSn: undefined, // 仓库
+        title: '',
+        publishStatus: undefined, // 发布状态
         state: undefined
       }
       this.$refs.rangeDate.resetDate()
@@ -451,13 +441,10 @@ export default {
   }
 }
 </script>
-<style lang="less">
+<style lang="less" scoped>
   .promotionList-wrap{
     .nameBox{
      padding:0 5px;
     }
-    .common{
-      color: rgba(0, 0, 0);
-    }
   }
 </style>

+ 73 - 46
src/views/promotionRulesManagement/dealerPromotions/sendAmountModal.vue

@@ -16,6 +16,15 @@
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
+        <a-form-model-item label="规则简称" prop="description">
+          <a-input
+            size="small"
+            id="promotionList-description"
+            v-model.trim="form.description"
+            allowClear
+            placeholder="请输入促销简称(最多10个字符)"
+            :maxLength="10"></a-input>
+        </a-form-model-item>
         <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">
@@ -47,7 +56,7 @@
               购买满
               <a-input-number v-model="form.gateAmount" :min="0" :precision="2" size="small"/>
               元门槛产品,可使用
-              <a-input-number v-model="form.quotaAmount" :min="0" :precision="2" size="small"/>
+              <a-input-number v-model="form.quotaAmount" :max="form.gateAmount" :min="0" :precision="2" size="small"/>
               元配额,采购规则中的正价商品(配额算销售额)
             </div>
           </div>
@@ -63,10 +72,23 @@
               </a-select-option>
             </a-select>
             产品购买满
-            <a-input-number v-model="form.regularAmount" @blur="calculatePrice" :min="0" :step="1" :precision="0" size="small"/>
+            <a-input-number
+              v-model="form.regularAmount"
+              @blur="calculatePrice"
+              :min="0"
+              :step="1"
+              :precision="0"
+              size="small"/>
             元正价产品,送
-            <a-input-number v-model="form.giveAmount" @blur="calculatePrice"  :min="0" :step="1" :precision="0" size="small"/>
-            元{{ scaleNum}}%促销品采购额
+            <a-input-number
+              v-model="form.giveAmount"
+              @blur="calculatePrice"
+              :min="0"
+              :step="1"
+              :max="form.regularAmount"
+              :precision="0"
+              size="small"/>
+            元{{ scaleNum }}%促销品采购额
           </div>
         </a-form-model-item>
         <a-form-model-item label="金额叠加" prop="accrualFlag">
@@ -206,22 +228,24 @@ export default {
       },
       form: {
         promotionRuleType: 'BUY_PROD_GIVE_MONEY', // 买产品送采购额
+        description: '',
         gateFlag: '0', // 门槛
         gateType: undefined,
-        gateAmount: '',
-        quotaAmount: '',
+        gateAmount: undefined,
+        quotaAmount: undefined,
         regularSameFlag: '0', // 满赠规则  不同款商品
-        regularAmount: '',
-        giveAmount: '',
+        regularAmount: undefined,
+        giveAmount: undefined,
         restrictCategory: '',
         accrualFlag: '1', // 数量叠加
         minOrderFlag: '1', // 起订金额
-        minOrderAmount: '',
+        minOrderAmount: undefined,
         upperLimitFlag: '1', // 活动经费上限
-        upperLimitAmount: '',
+        upperLimitAmount: undefined,
         scopeFlag: undefined
       },
       rules: {
+        description: [ { required: true, message: '请输入规则简称', trigger: 'blur' } ],
         gateFlag: [ { required: true, message: '请选择规则门槛', trigger: 'change' } ],
         regularSameFlag: [{ required: true, message: '请选择满赠规则', trigger: 'change' }],
         accrualFlag: [{ required: true, message: '请选择数量是否叠加', trigger: 'change' }],
@@ -230,15 +254,15 @@ export default {
         scopeFlag: [{ required: true, message: '请选择采购额适用范围', trigger: 'change' }]
       },
       chooseVal: 'a',
-      scaleNum:0
+      scaleNum: 0
     }
   },
   methods: {
     // 计算百分比
     calculatePrice () {
       const _this = this
-      if(_this.form.regularAmount&&_this.form.giveAmount){
-        _this.scaleNum=Math.floor((( _this.form.giveAmount /_this.form.regularAmount) * 100).toFixed(2))
+      if (_this.form.regularAmount && _this.form.giveAmount) {
+        _this.scaleNum = Math.floor(((_this.form.giveAmount / _this.form.regularAmount) * 100).toFixed(2))
       }
     },
     // 门槛切换  tab 按钮默认显示问题
@@ -254,36 +278,38 @@ export default {
     //  保存
     handleSave () {
       const _this = this
-      // 验证必填
-      if (_this.form.gateFlag == '1') {
-        if (!_this.form.gateType) {
-          _this.$message.warning('请选择规则门槛设置类型!')
-          return
-        }
-        if (!_this.form.gateAmount) {
-          _this.$message.warning('规则门槛条件不能为空!')
-          return
-        }
-        if (_this.form.gateType === 'FIXED_AMOUNT' && !_this.form.quotaAmount) {
-          _this.$message.warning('规则门槛条件不能为空!')
-          return
-        }
-      }
-      if (!_this.form.regularAmount || !_this.form.giveAmount) {
-        _this.$message.warning('满赠规则条件不能为空!')
-        return
-      }
 
-      if (_this.form.minOrderFlag == 1 && !_this.form.minOrderAmount) {
-        _this.$message.warning('请输入订单起订限制金额数!')
-        return
-      }
-      if (_this.form.upperLimitFlag == 1 && !_this.form.upperLimitAmount) {
-        _this.$message.warning('请输入活动经费上限金额!')
-        return
-      }
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
+          // 验证必填
+          if (_this.form.gateFlag == '1') {
+            if (!_this.form.gateType) {
+              _this.$message.warning('请选择规则门槛设置类型!')
+              return
+            }
+            if (!_this.form.gateAmount) {
+              _this.$message.warning('规则门槛条件不能为空!')
+              return
+            }
+            if (_this.form.gateType === 'FIXED_AMOUNT' && !_this.form.quotaAmount) {
+              _this.$message.warning('规则门槛条件不能为空!')
+              return
+            }
+          }
+          if (!_this.form.regularAmount || !_this.form.giveAmount) {
+            _this.$message.warning('满赠规则条件不能为空!')
+            return
+          }
+
+          if (_this.form.minOrderFlag == 1 && !_this.form.minOrderAmount) {
+            _this.$message.warning('请输入订单起订限制金额数!')
+            return
+          }
+          if (_this.form.upperLimitFlag == 1 && !_this.form.upperLimitAmount) {
+            _this.$message.warning('请输入活动经费上限金额!')
+            return
+          }
+
           const form = JSON.parse(JSON.stringify(_this.form))
           if (form.gateFlag == '1') {
             form.gateProductList = this.$refs.cillProduct.getResultVal()
@@ -322,19 +348,20 @@ export default {
     resetSearchForm () {
       this.form = {
         promotionRuleType: 'BUY_PROD_GIVE_MONEY', // 买产品送采购额
+        description: '',
         gateFlag: '0', // 门槛
         gateType: undefined,
-        gateAmount: '',
-        quotaAmount: '',
+        gateAmount: undefined,
+        quotaAmount: undefined,
         regularSameFlag: '0', // 满赠规则  不同款商品
-        regularAmount: '',
-        giveAmount: '',
+        regularAmount: undefined,
+        giveAmount: undefined,
         restrictCategory: '',
         accrualFlag: '1', // 数量叠加
         minOrderFlag: '1', // 起订金额
-        minOrderAmount: '',
+        minOrderAmount: undefined,
         upperLimitFlag: '1', // 活动经费上限
-        upperLimitAmount: '',
+        upperLimitAmount: undefined,
         scopeFlag: undefined,
         gateProductList: undefined,
         giftProductList: undefined,

+ 65 - 46
src/views/promotionRulesManagement/dealerPromotions/sendProductsModal.vue

@@ -16,6 +16,15 @@
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
+        <a-form-model-item label="规则简称" prop="description">
+          <a-input
+            size="small"
+            id="promotionList-description"
+            v-model.trim="form.description"
+            allowClear
+            placeholder="请输入促销简称(最多10个字符)"
+            :maxLength="10"></a-input>
+        </a-form-model-item>
         <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">
@@ -47,7 +56,7 @@
               购买满
               <a-input-number v-model="form.gateAmount" :min="0" :precision="2" size="small"/>
               元门槛产品,可使用
-              <a-input-number v-model="form.quotaAmount" :min="0" :precision="2" size="small"/>
+              <a-input-number v-model="form.quotaAmount" :max="form.gateAmount" :min="0" :precision="2" size="small"/>
               元配额,采购规则中的正价商品(配额算销售额)
             </div>
           </div>
@@ -65,7 +74,13 @@
             产品购买满
             <a-input-number v-model="form.regularQty" :min="0" :step="1" :precision="0" size="small"/>
             个正价产品,送
-            <a-input-number v-model="form.promotionQty" :min="0" :step="1" :precision="0" size="small"/>
+            <a-input-number
+              v-model="form.promotionQty"
+              :max="form.regularQty"
+              :min="0"
+              :step="1"
+              :precision="0"
+              size="small"/>
             个促销产品
           </div>
           <div class="ruleDescList">
@@ -218,23 +233,25 @@ export default {
       },
       form: {
         promotionRuleType: 'BUY_PROD_GIVE_PROD', // 买产品送产品
+        description: '', // 简称
         gateFlag: '0', // 门槛
         gateType: undefined,
-        gateAmount: '',
-        quotaAmount: '',
+        gateAmount: undefined,
+        quotaAmount: undefined,
         regularSameFlag: '0', // 满赠规则  不同款商品
-        regularQty: '',
-        promotionQty: '',
+        regularQty: undefined,
+        promotionQty: undefined,
         restrictFlag: undefined, // 限制正价产品款数
         restrictCategory: '',
         accrualFlag: '1', // 数量叠加
         minOrderFlag: '1', // 起订金额
-        minOrderAmount: '',
+        minOrderAmount: undefined,
         upperLimitFlag: '1', // 活动经费上限
-        upperLimitAmount: '',
+        upperLimitAmount: undefined,
         regularPromotionSameFlag: undefined
       },
       rules: {
+        description: [ { required: true, message: '请输入规则简称', trigger: 'blur' } ],
         gateFlag: [ { required: true, message: '请选择规则门槛', trigger: 'change' } ],
         regularSameFlag: [{ required: true, message: '请选择满赠规则', trigger: 'change' }],
         accrualFlag: [{ required: true, message: '请选择数量是否叠加', trigger: 'change' }],
@@ -262,40 +279,41 @@ export default {
     //  保存
     handleSave () {
       const _this = this
-      // 验证必填
-      if (_this.form.gateFlag == '1') {
-        if (!_this.form.gateType) {
-          _this.$message.warning('请选择规则门槛设置类型!')
-          return
-        }
-        if (!_this.form.gateAmount) {
-          _this.$message.warning('规则门槛条件不能为空!')
-          return
-        }
-        if (_this.form.gateType === 'FIXED_AMOUNT' && !_this.form.quotaAmount) {
-          _this.$message.warning('规则门槛条件不能为空!')
-          return
-        }
-      }
-      if (!_this.form.regularQty || !_this.form.promotionQty) {
-        _this.$message.warning('满赠规则条件不能为空!')
-        return
-      }
-      if (_this.form.restrictFlag && !_this.form.restrictCategory) {
-        _this.$message.warning('请输入限制正价产品款数个数!')
-        return
-      }
-
-      if (_this.form.minOrderFlag == 1 && !_this.form.minOrderAmount) {
-        _this.$message.warning('请输入订单起订限制金额数!')
-        return
-      }
-      if (_this.form.upperLimitFlag == 1 && !_this.form.upperLimitAmount) {
-        _this.$message.warning('请输入活动经费上限金额!')
-        return
-      }
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
+          // 验证必填
+          if (_this.form.gateFlag == '1') {
+            if (!_this.form.gateType) {
+              _this.$message.warning('请选择规则门槛设置类型!')
+              return
+            }
+            if (!_this.form.gateAmount) {
+              _this.$message.warning('规则门槛条件不能为空!')
+              return
+            }
+            if (_this.form.gateType === 'FIXED_AMOUNT' && !_this.form.quotaAmount) {
+              _this.$message.warning('规则门槛条件不能为空!')
+              return
+            }
+          }
+          if (!_this.form.regularQty || !_this.form.promotionQty) {
+            _this.$message.warning('满赠规则条件不能为空!')
+            return
+          }
+          if (_this.form.restrictFlag && !_this.form.restrictCategory) {
+            _this.$message.warning('请输入限制正价产品款数个数!')
+            return
+          }
+
+          if (_this.form.minOrderFlag == 1 && !_this.form.minOrderAmount) {
+            _this.$message.warning('请输入订单起订限制金额数!')
+            return
+          }
+          if (_this.form.upperLimitFlag == 1 && !_this.form.upperLimitAmount) {
+            _this.$message.warning('请输入活动经费上限金额!')
+            return
+          }
+
           const form = JSON.parse(JSON.stringify(_this.form))
           if (form.gateFlag == '1') {
             form.gateProductList = this.$refs.cillProduct.getResultVal()
@@ -335,20 +353,21 @@ export default {
     resetSearchForm () {
       this.form = {
         promotionRuleType: 'BUY_PROD_GIVE_PROD', // 买产品送产品
+        description: '', // 简称
         gateFlag: '0', // 门槛
         gateType: undefined,
-        gateAmount: '',
-        quotaAmount: '',
+        gateAmount: undefined,
+        quotaAmount: undefined,
         regularSameFlag: '0', // 满赠规则  不同款商品
-        regularQty: '',
-        promotionQty: '',
+        regularQty: undefined,
+        promotionQty: undefined,
         restrictFlag: undefined, // 限制正价产品款数
         restrictCategory: '',
         accrualFlag: '1', // 数量叠加
         minOrderFlag: '1', // 起订金额
-        minOrderAmount: '',
+        minOrderAmount: undefined,
         upperLimitFlag: '1', // 活动经费上限
-        upperLimitAmount: '',
+        upperLimitAmount: undefined,
         regularPromotionSameFlag: undefined,
         gateProductList: undefined,
         giftProductList: undefined,

+ 40 - 26
src/views/promotionRulesManagement/dealerPromotions/specialOfferModal.vue

@@ -16,6 +16,15 @@
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
+        <a-form-model-item label="规则简称" prop="description">
+          <a-input
+            size="small"
+            id="promotionList-description"
+            v-model.trim="form.description"
+            allowClear
+            placeholder="请输入促销简称(最多10个字符)"
+            :maxLength="10"></a-input>
+        </a-form-model-item>
         <a-form-model-item label="规则门槛" prop="gateFlag">
           <a-radio-group v-model="form.gateFlag" button-style="solid" size="small" @change="handleChange">
             <a-radio-button value="1">
@@ -47,7 +56,7 @@
               购买满
               <a-input-number v-model="form.gateAmount" :min="0" :precision="2" size="small"/>
               元门槛产品,可使用
-              <a-input-number v-model="form.quotaAmount" :min="0" :precision="2" size="small"/>
+              <a-input-number v-model="form.quotaAmount" :max="form.gateAmount" :min="0" :precision="2" size="small"/>
               元配额,采购规则中的正价商品(配额算销售额)
             </div>
           </div>
@@ -182,16 +191,18 @@ export default {
       },
       form: {
         promotionRuleType: 'PROMO_PROD', // 特价产品
+        description: '',
         gateFlag: '0', // 门槛
         gateType: undefined,
-        gateAmount: '',
-        quotaAmount: '',
+        gateAmount: undefined,
+        quotaAmount: undefined,
         minOrderFlag: '1', // 起订金额
-        minOrderAmount: '',
+        minOrderAmount: undefined,
         upperLimitFlag: '1', // 活动经费上限
-        upperLimitAmount: ''
+        upperLimitAmount: undefined
       },
       rules: {
+        description: [ { required: true, message: '请输入规则简称', trigger: 'blur' } ],
         gateFlag: [ { required: true, message: '请选择规则门槛', trigger: 'change' } ],
         minOrderFlag: [{ required: true, message: '请选择订单起订金额', trigger: 'change' }],
         upperLimitFlag: [{ required: true, message: '请选择活动经费上限', trigger: 'change' }]
@@ -213,23 +224,24 @@ export default {
     //  保存
     handleSave () {
       const _this = this
-      // 验证必填
-      if (_this.form.gateFlag == '1') {
-        if (!_this.form.gateAmount || !_this.form.quotaAmount) {
-          _this.$message.warning('规则门槛条件不能为空!')
-          return
-        }
-      }
-      if (_this.form.minOrderFlag == 1 && !_this.form.minOrderAmount) {
-        _this.$message.warning('请输入订单起订限制金额数!')
-        return
-      }
-      if (_this.form.upperLimitFlag == 1 && !_this.form.upperLimitAmount) {
-        _this.$message.warning('请输入活动经费上限金额!')
-        return
-      }
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
+          // 验证必填
+          if (_this.form.gateFlag == '1') {
+            if (!_this.form.gateAmount || !_this.form.quotaAmount) {
+              _this.$message.warning('规则门槛条件不能为空!')
+              return
+            }
+          }
+          if (_this.form.minOrderFlag == 1 && !_this.form.minOrderAmount) {
+            _this.$message.warning('请输入订单起订限制金额数!')
+            return
+          }
+          if (_this.form.upperLimitFlag == 1 && !_this.form.upperLimitAmount) {
+            _this.$message.warning('请输入活动经费上限金额!')
+            return
+          }
+
           const form = JSON.parse(JSON.stringify(_this.form))
           if (form.gateFlag == '1') {
             form.gateProductList = _this.$refs.cillProduct.getResultVal()
@@ -260,13 +272,15 @@ export default {
     resetSearchForm () {
       this.form = {
         promotionRuleType: 'PROMO_PROD', // 特价产品
+        description: '',
         gateFlag: '0', // 门槛
-        gateAmount: '',
-        quotaAmount: '',
+        gateType: undefined,
+        gateAmount: undefined,
+        quotaAmount: undefined,
         minOrderFlag: '1', // 起订金额
-        minOrderAmount: '',
+        minOrderAmount: undefined,
         upperLimitFlag: '1', // 活动经费上限
-        upperLimitAmount: '',
+        upperLimitAmount: undefined,
         gateProductList: undefined,
         specialProductList: undefined
       }
@@ -281,7 +295,7 @@ export default {
       const _this = this
       getRuleDetail({ sn: this.itemSn }).then(res => {
         if (res.status == 200) {
-         this.chooseVal =  res.data.gateFlag == '0' ? 'd' : 'a'
+          this.chooseVal = res.data.gateFlag == '0' ? 'd' : 'a'
           const resultObj = res.data
           // 重新组成保存数据
           if (resultObj.gateProductList && resultObj.gateProductList.length > 0) {
@@ -355,7 +369,7 @@ export default {
           if (res.status == 200) {
             const newData = {
               productScopeSn: res.data,
-              dataSourceOrigin:'1',
+              dataSourceOrigin: '1',
               productTypeArr: [],
               productTypeList: [],
               productBrandArr: [{ brandSn: item.productBrandSn, brandName: item.productBrandName }],

+ 44 - 4
src/views/promotionRulesManagement/dealerPromotions/tableType1.vue

@@ -126,7 +126,7 @@
       <a-button id="tableType1-add" type="primary" class="button-gray" @click="handleAddRow">+新增一行</a-button>
     </div>
     <!-- 选择产品品牌 -->
-    <chooseBrandModal :openModal="openBrandModal" :chooseData="chooseBrand" @close="openBrandModal=false" @ok="handleBrandOk" />
+    <chooseBrandModal ref="brandBox" :openModal="openBrandModal" :chooseData="chooseBrand" @close="openBrandModal=false" @ok="handleBrandOk" />
     <!-- 选择产品分类 -->
     <chooseTypeModal :openModal="openTypeModal" :linkageStatus="false" :chooseData="chooseType" @close="openTypeModal=false" @ok="handleTypeOk" />
     <!-- 选择产品 -->
@@ -252,8 +252,24 @@ export default {
     },
     // 添加产品品牌
     addBrandTag (pos, row) {
-      this.brandTagIndex = pos
-      this.openBrandModal = true
+      const _this = this
+      _this.brandTagIndex = pos
+      // 每行品牌都是唯一滴
+      // const snArr = []
+      // const snObjList = []
+      // _this.dataSource.forEach(item => {
+      //   if (item.productBrandList && item.productBrandList.length > 0) {
+      //     item.productBrandList.forEach(con => {
+      //       con.goodsSn = con.productBrandSn
+      //       snArr.push(con.productBrandSn)
+      //       snObjList.push(con)
+      //     })
+      //   }
+      // })
+      const dataList = _this.setShowData('Brand')
+      _this.openBrandModal = true
+      _this.chooseBrand = dataList[1]
+      _this.$refs.brandBox.handleDisabled(dataList[0])
     },
     handleBrandOk (conList) {
       const newConList = conList.map(con => {
@@ -267,6 +283,9 @@ export default {
     // 添加产品
     addProductTag (pos, row) {
       this.productTagIndex = pos
+      const dataList = this.setShowData('This')
+      debugger
+      this.chooseProducts = dataList[1]
       this.openProductsModal = true
     },
     handleProductsOk (arr) {
@@ -280,6 +299,27 @@ export default {
       })
       this.dataSource[this.productTagIndex].productThisList = newArr
     },
+    // 获取回显禁用数据
+    setShowData (name) {
+      const _this = this
+      const snArr = []
+      const snObjList = []
+      _this.dataSource.forEach(item => {
+        if (item['product' + name + 'List'] && item['product' + name + 'List'].length > 0) {
+          item['product' + name + 'List'].forEach(con => {
+            if (name === 'This') {
+              con.goodsSn = con.productSn
+              snArr.push(con.productSn)
+            } else {
+              con.goodsSn = con['product' + name + 'Sn']
+              snArr.push(con['product' + name + 'Sn'])
+            }
+            snObjList.push(con)
+          })
+        }
+      })
+      return [snArr, snObjList]
+    },
     getResultVal () {
       const resultObj = JSON.parse(JSON.stringify(this.dataSource))
       resultObj.map(item => {
@@ -304,7 +344,7 @@ export default {
         this.dataSource[pos].productTypeArr.splice(i, 1)
         this.dataSource[pos].productTypeList.splice(i, 1)
       } else if (type === 'brandList') {
-        const j = this.dataSource[pos].productBrandArr.findIndex(con => con.brandSn == row.productBrandSn)
+        const j = this.dataSource[pos].productBrandArr.findIndex(con => con.brandSn == row.brandSn)
         this.dataSource[pos].productBrandArr.splice(j, 1)
         this.dataSource[pos].productBrandList.splice(j, 1)
       } else {