chenrui 1 年間 前
コミット
5082c49ee9

+ 45 - 4
src/api/promotion.js

@@ -69,7 +69,7 @@ export const getNewScopeSn = (params) => {
     method: 'get'
   })
 }
-// 规则保存
+// 规则保存/修改
 export const promotionSave = (params) => {
   return axios({
     url: '/promotion/rule/save',
@@ -77,10 +77,51 @@ export const promotionSave = (params) => {
     method: 'post'
   })
 }
-// 删除仓位
-export const warehouseLocDel = params => {
+// 删除规则列表
+export const promotionRulesDel = (params) => {
   return axios({
-    url: `/warehouseLoc/delete/${params.sn}`,
+    url: '/promotion/rule/delete',
+    data: params,
+    method: 'post'
+  })
+}
+// 提交
+export const promotionSubmit = (params) => {
+  return axios({
+    url: `/promotion/submit/${params.sn}`,
+    data: {},
+    method: 'get'
+  })
+}
+
+// 改变发布状态
+export const modifyEnabledFlag = (params) => {
+  return axios({
+    url: '/promotion/modifyEnabledFlag',
+    data: params,
+    method: 'post'
+  })
+}
+// 审核
+export const promotionAudit = (params) => {
+  return axios({
+    url: '/promotion/audit',
+    data: params,
+    method: 'post'
+  })
+}
+// 变更促销时间
+export const promotionDateModify = (params) => {
+  return axios({
+    url: '/promotion/promotionDateModify',
+    data: params,
+    method: 'post'
+  })
+}
+// 中止
+export const promotionIsOver = (params) => {
+  return axios({
+    url: `/promotion/isOver/${params.sn}`,
     data: {},
     method: 'get'
   })

+ 44 - 22
src/views/promotionRulesManagement/dealerPromotions/detail.vue

@@ -39,9 +39,9 @@
       </a-card>
       <a-card size="small" title="规则设置" :bordered="false" class="pages-wrap">
         <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>
+          <a-button type="primary" class="button-warning" @click="openBtnModal('SendProducts')" :disabled="disabled">买产品送产品</a-button>
+          <a-button style="margin:0 10px" type="primary" class="button-warn" @click="openBtnModal('SendAmount')" :disabled="disabled">买产品送采购额</a-button>
+          <a-button type="primary" @click="openBtnModal('SpecialOffer')" :disabled="disabled">特价产品</a-button>
         </div>
         <!-- 列表 -->
         <s-table
@@ -57,7 +57,13 @@
           <!-- 门槛规则 -->
           <template slot="cillProduct" slot-scope="text, record">
             <div v-if="record.gateFlag === '1'">
-              购买满{{ record.gateAmount }}元门槛产品,可使用 {{ record.quotaAmount }}元配额,采购规则中的正价商品
+              <span v-if="record.gateType==='RATIO_AMOUNT'">
+                购买门槛产品金额{{ record.gateAmount*100 }}%作为配额
+              </span>
+              <span v-else-if="record.gateType==='MIN_AMOUNT'">
+                购买门槛产品满最低金额{{ record.gateAmount }}不限制配额。
+              </span>
+              <span v-else>购买满{{ record.gateAmount }}元门槛产品,可使用 {{ record.quotaAmount }}元配额,采购规则中的正价商品</span>
             </div>
             <span v-else>--</span>
           </template>
@@ -98,6 +104,9 @@
               id="promotionList-edit-btn">详情</a-button>
           </template>
         </s-table>
+        <div style="text-align:center;margin-top:20px;">
+          <a-button type="primary" size="large" style="padding:0 30px;" @click="handleSubmit" :disabled="disabled">提交</a-button>
+        </div>
       </a-card>
     </a-spin>
     <!-- 查看参与客户 -->
@@ -107,11 +116,11 @@
     <!-- 详情 -->
     <detailModal :openModal="openDetailModal" :itemSn="detailSn" @close="closeDetailModal"></detailModal>
     <!-- 买产品送产品  弹窗 -->
-    <sendProductsModal :openModal="openSendProductsModal" :promotionSn="$route.query.sn" @ok="$refs.table.refresh()" @close="openSendProductsModal = false"></sendProductsModal>
+    <sendProductsModal :openModal="openSendProductsModal" :itemSn="detailSn" :promotionSn="$route.query.sn" @ok="$refs.table.refresh()" @close="openSendProductsModal = false"></sendProductsModal>
     <!-- 买产品送采购额 弹窗 -->
-    <sendAmountModal :openModal="openSendAmountModal" :promotionSn="$route.query.sn" @ok="$refs.table.refresh()" @close="openSendAmountModal = false"></sendAmountModal>
+    <sendAmountModal :openModal="openSendAmountModal" :itemSn="detailSn" :promotionSn="$route.query.sn" @ok="$refs.table.refresh()" @close="openSendAmountModal = false"></sendAmountModal>
     <!-- 特价产品  弹窗 -->
-    <specialOfferModal :openModal="openSpecialOfferModal" :promotionSn="$route.query.sn" @ok="$refs.table.refresh()" @close="openSpecialOfferModal = false"></specialOfferModal>
+    <specialOfferModal :openModal="openSpecialOfferModal" :itemSn="detailSn" :promotionSn="$route.query.sn" @ok="$refs.table.refresh()" @close="openSpecialOfferModal = false"></specialOfferModal>
   </div>
 </template>
 
@@ -124,7 +133,7 @@ import detailModal from './detailModal'
 import sendProductsModal from './sendProductsModal'
 import sendAmountModal from './sendAmountModal'
 import specialOfferModal from './specialOfferModal'
-import { getRuleQueryList, dealerPromotionInfo, promotionRulesDel } from '@/api/promotion'
+import { getRuleQueryList, dealerPromotionInfo, promotionRulesDel, promotionSubmit } from '@/api/promotion'
 export default {
   name: 'SalesOrderWarehouseDetail',
   mixins: [commonMixin],
@@ -148,7 +157,7 @@ export default {
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        const dataAjax = Object.assign(parameter, { sn: this.$route.query.sn })
+        const dataAjax = Object.assign(parameter, { promotionSn: this.$route.query.sn })
         return getRuleQueryList(dataAjax).then(res => {
           let data
           if (res.status == 200) {
@@ -206,17 +215,11 @@ export default {
         }
       })
     },
-    // 买产品送产品
-    handleProduct () {
-      this.openSendProductsModal = true
-    },
-    // 买产品送采购额
-    handleAmount () {
-      this.openSendAmountModal = true
-    },
-    // 特价产品
-    handleSpecialProduct () {
-      this.openSpecialOfferModal = true
+    // 买产品送产品、买产品送采购额、特价产品   弹窗
+    openBtnModal (str) {
+      this.detailSn = null
+      const name = 'open' + str + 'Modal'
+      this[name] = true
     },
     // 查看客户
     handleSee () {
@@ -246,8 +249,27 @@ export default {
         }
       })
     },
-    handleEdit () {
-
+    // 提交
+    handleSubmit () {
+      const _this = this
+      _this.disabled = true
+      promotionSubmit({ sn: _this.$route.query.sn }).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.handleBack()
+        }
+        _this.disabled = false
+      })
+    },
+    handleEdit (row) {
+      this.detailSn = row.promotionRuleSn
+      if (row.promotionRuleType === 'BUY_PROD_GIVE_PROD') {
+        this.openSendProductsModal = true
+      } else if (row.promotionRuleType === 'BUY_PROD_GIVE_MONEY') {
+        this.openSendAmountModal = true
+      } else {
+        this.openSpecialOfferModal = true
+      }
     }
   },
   mounted () {

+ 2 - 3
src/views/promotionRulesManagement/dealerPromotions/detailModal.vue

@@ -13,12 +13,11 @@
         id="dealerPromotions-basicInfo-form"
         ref="ruleForm"
         :model="form"
-        :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
-        <a-form-model-item label="规则门槛" prop="gateFlag" v-if="form.gateFlag">
+        <a-form-model-item label="规则门槛" v-if="form.gateFlag">
           <div>{{ form.gateFlag=== '0'?'无':'有' }}</div>
-          <div v-if="gateFlag==='1'">购买满{{ form.gateAmount }}元门槛产品,可使用{{ form.quotaAmount }}元配额,采购规则中的正价商品(配额算销售额)</div>
+          <div v-if="form.gateFlag==='1'">购买满{{ form.gateAmount }}元门槛产品,可使用{{ form.quotaAmount }}元配额,采购规则中的正价商品(配额算销售额)</div>
         </a-form-model-item>
         <!-- 买产品送产品 -->
         <a-form-model-item label="满赠规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_PROD'">

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

@@ -37,7 +37,7 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import moment from 'moment'
-import { sparePartsReturnSave, sparePartsReturnInfo } from '@/api/sparePartsReturn'
+import { promotionDateModify } from '@/api/promotion'
 export default {
   name: 'EditActiveEndTimeModal',
   mixins: [commonMixin],
@@ -72,23 +72,24 @@ export default {
     //  保存
     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
-          sparePartsReturnSave(form).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
         }

+ 29 - 25
src/views/promotionRulesManagement/dealerPromotions/list.vue

@@ -88,20 +88,20 @@
         <!-- 发布状态 -->
         <template slot="releaseStatus" slot-scope="text, record">
           <a-switch
-            v-if="record.enabledFlag"
+            v-if="record.state === 'NOT_START'||record.state ==='RUNNING'"
             id="promotionList-enable"
             @change="changeStatus(record)"
             :checked="record.enabledFlag == 1 ? true : false"></a-switch>
         </template>
         <!-- 操作 -->
-        <!-- state 待提交 WAIT_SUBMIT 待审核 WAIT_AUDIT 未开始 NO_START 进行中 A_FOOT 已完结 FINISH 审核不通过 AUDIT_REJECT -->
+        <!--  state 待提交:WAIT_SUBMIT 待审核:WAIT_AUDIT 未开始:NOT_START 进行中:RUNNING 审核不通过:AUDIT_REJECT 已结束:IS_OVER -->
         <template slot="action" slot-scope="text, record">
           <a-button
             size="small"
             type="link"
             class="button-warning"
             @click="handleSetRules(record)"
-            v-if="record.state =='WAIT_SUBMIT'"
+            v-if="record.state =='WAIT_SUBMIT'||record.state == 'AUDIT_REJECT'"
             id="allocateBillList-examine-btn">规则设置</a-button>
           <a-button
             size="small"
@@ -120,14 +120,14 @@
           <a-button
             size="small"
             type="link"
-            v-if="record.state == 'NO_START' || record.state=='A_FOOT'"
+            v-if="record.state == 'NOT_START' || record.state=='RUNNING'"
             @click="handleTime(record)"
             class="button-info"
             id="promotionList-edit-btn">促销时间变更</a-button>
           <a-button
             size="small"
             type="link"
-            v-if="record.state == 'NO_START' || record.state=='A_FOOT'"
+            v-if="record.state == 'NO_START' || record.state=='RUNNING'"
             @click="handleEnd(record)"
             class="button-info"
             id="promotionList-edit-btn">终止</a-button>
@@ -138,7 +138,7 @@
             @click="handleDel(record)"
             class="button-error"
             id="promotionList-del-btn">删除</a-button>
-          <div v-if="record.state == 'FINISH'">--</div>
+          <div v-if="record.state == 'IS_OVER'">--</div>
         </template>
       </s-table>
     </a-spin>
@@ -164,7 +164,7 @@ 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, sparePartsReturnExportDetail, againSubmit } from '@/api/promotion'
+import { dealerPromotionList, dealerPromotionDel, modifyEnabledFlag, promotionAudit, promotionIsOver } from '@/api/promotion'
 export default {
   name: 'PromotionManagementList',
   mixins: [commonMixin],
@@ -253,9 +253,9 @@ export default {
     // 参与客户
     handleCustomers (row) {
       this.openCustomerModal = true
-      // this.$nextTick(() => {
-      //   this.$refs.lookUpCustomers.pageInit({ dealerSnList: row.promoBuyerSnSet ? row.promoBuyerSnSet : undefined, promoActiveSn: row.promoActiveSn })
-      // })
+      this.$nextTick(() => {
+        this.$refs.lookUpCustomers.pageInit({ dealerSnList: row.dealerSnList })
+      })
     },
     //  基本信息  保存
     handleOk () {
@@ -270,11 +270,11 @@ export default {
     // 发布状态
     changeStatus (record) {
       const params = {
-        id: record.id,
-        flag: record.loginFlag == 1 ? '0' : '1'
+        promotionSn: record.promotionSn,
+        enabledFlag: record.enabledFlag == 1 ? '0' : '1'
       }
       this.spinning = true
-      dealerUserEnable(params).then(res => {
+      modifyEnabledFlag(params).then(res => {
         if (res.status == 200) {
           this.$message.success(res.message)
           this.$refs.table.refresh()
@@ -300,19 +300,23 @@ export default {
         centered: true,
         closable: true,
         onOk () {
-          _this.spinning = true
-          sparePartsReturnDelete({ sn: row.sparePartsReturnSn }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.$refs.table.refresh()
-              _this.spinning = false
-            } else {
-              _this.spinning = false
-            }
-          })
+          _this.handleAudit({ promotionSn: row.promotionSn, auditFlag: 1 })
         },
         onCancel (e) {
-          console.log('不通过', e)
+          _this.handleAudit({ promotionSn: row.promotionSn, auditFlag: 0 })
+        }
+      })
+    },
+    handleAudit (ajaxData) {
+      const _this = this
+      _this.spinning = true
+      promotionAudit(ajaxData).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.$refs.table.refresh()
+          _this.spinning = false
+        } else {
+          _this.spinning = false
         }
       })
     },
@@ -330,7 +334,7 @@ export default {
         centered: true,
         onOk () {
           _this.spinning = true
-          sparePartsReturnDelete({ sn: row.sparePartsReturnSn }).then(res => {
+          promotionIsOver({ sn: row.promotionSn }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()

+ 121 - 25
src/views/promotionRulesManagement/dealerPromotions/sendAmountModal.vue

@@ -25,12 +25,31 @@
             </a-radio-button>
           </a-radio-group>
-          <div class="ruleDescList" v-if="form.gateFlag && form.gateFlag === '1'">
-            购买满
-            <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"/>
-            元配额,采购规则中的正价商品(配额算销售额)
+          <div v-if="form.gateFlag && form.gateFlag === '1'">
+            <v-select
+              size="small"
+              style="width:60%;"
+              v-model="form.gateType"
+              id="promotionList-gateType"
+              code="PROMOTION_GATE_TYPE"
+              placeholder="请选择"
+              allowClear></v-select>
+            <div v-if="form.gateType==='RATIO_AMOUNT'">
+              购买门槛产品金额 <a-input-number v-model="form.gateAmount" :min="0" :max="100" size="small"/> %作为配额
+              <a-tooltip title="如:填写100%,则购买10000元门槛产品,可享受10000配额购买正价产品,根据门槛金额动态调整配额">
+                <a-icon type="question-circle" theme="filled" :style="{ fontSize: '14px', color: 'gray' }"/>
+              </a-tooltip>
+            </div>
+            <div v-if="form.gateType==='MIN_AMOUNT'">
+              购买门槛产品满最低金额 <a-input-number v-model="form.gateAmount" :min="0" :precision="2" size="small"/> 不限制配额。
+            </div>
+            <div class="ruleDescList" v-if="form.gateType==='FIXED_AMOUNT'">
+              购买满
+              <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"/>
+              元配额,采购规则中的正价商品(配额算销售额)
+            </div>
           </div>
         </a-form-model-item>
         <a-form-model-item label="满赠规则" prop="regularSameFlag">
@@ -44,10 +63,10 @@
               </a-select-option>
             </a-select>
             产品购买满
-            <a-input-number v-model="form.regularAmount" :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" :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}}%促销品采购额
           </div>
         </a-form-model-item>
         <a-form-model-item label="金额叠加" prop="accrualFlag">
@@ -158,7 +177,7 @@ import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
 import tableType1 from './tableType1.vue'
 import tableType2 from './tableType2.vue'
-import { promotionSave, sparePartsReturnInfo } from '@/api/promotion'
+import { promotionSave, getRuleDetail } from '@/api/promotion'
 export default {
   name: 'PromotionListBasicInfoModal',
   mixins: [commonMixin],
@@ -171,6 +190,10 @@ export default {
     promotionSn: {
       type: [Number, String],
       default: ''
+    },
+    itemSn: {
+      type: [Number, String],
+      default: ''
     }
   },
   data () {
@@ -184,6 +207,7 @@ export default {
       form: {
         promotionRuleType: 'BUY_PROD_GIVE_MONEY', // 买产品送采购额
         gateFlag: '0', // 门槛
+        gateType: undefined,
         gateAmount: '',
         quotaAmount: '',
         regularSameFlag: '0', // 满赠规则  不同款商品
@@ -205,10 +229,18 @@ export default {
         upperLimitFlag: [{ required: true, message: '请选择活动经费上限', trigger: 'change' }],
         scopeFlag: [{ required: true, message: '请选择采购额适用范围', trigger: 'change' }]
       },
-      chooseVal: 'a'
+      chooseVal: 'a',
+      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))
+      }
+    },
     // 门槛切换  tab 按钮默认显示问题
     changeGateFlag (e) {
       if (this.chooseVal != 'c') {
@@ -224,7 +256,15 @@ export default {
       const _this = this
       // 验证必填
       if (_this.form.gateFlag == '1') {
-        if (!_this.form.gateAmount || !_this.form.quotaAmount) {
+        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
         }
@@ -249,6 +289,9 @@ export default {
             form.gateProductList = this.$refs.cillProduct.getResultVal()
           } else {
             form.gateProductList = []
+            form.gateAmount = ''
+            form.quotaAmount = ''
+            form.gateType = undefined
           }
           if (form.scopeFlag == '0') {
             form.giftProductList = this.$refs.offerProduct.getResultVal()
@@ -280,6 +323,7 @@ export default {
       this.form = {
         promotionRuleType: 'BUY_PROD_GIVE_MONEY', // 买产品送采购额
         gateFlag: '0', // 门槛
+        gateType: undefined,
         gateAmount: '',
         quotaAmount: '',
         regularSameFlag: '0', // 满赠规则  不同款商品
@@ -305,25 +349,77 @@ export default {
     },
     // 获取编辑详情
     getDetail () {
-      sparePartsReturnInfo({ sn: this.itemSn }).then(res => {
+      const _this = this
+      getRuleDetail({ sn: this.itemSn }).then(res => {
         if (res.status == 200) {
+          this.chooseVal = res.data.gateFlag == '0' ? 'b' : 'a'
           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
+          // 重新组成保存数据
+          if (resultObj.gateProductList && resultObj.gateProductList.length > 0) {
+            resultObj.gateProductList = _this.newData(resultObj.gateProductList)
+            this.$refs.cillProduct.setTabVal(resultObj.gateProductList)
+          }
+          if (resultObj.regularProductList && resultObj.regularProductList.length > 0) {
+            resultObj.regularProductList = _this.newData(resultObj.regularProductList)
+            this.$refs.normalPriceProduct.setTabVal(resultObj.regularProductList)
           }
-          this.$nextTick(() => {
-            this.$refs.attachList.setFileList(this.attachList)
+          if (resultObj.giftProductList && resultObj.giftProductList.length > 0) {
+            resultObj.giftProductList = _this.newData(resultObj.giftProductList)
+            this.$refs.offerProduct.setTabVal(resultObj.giftProductList)
+          }
+          this.form = { ...this.form, ...resultObj }
+        }
+      })
+    },
+    newData (list) {
+      list.forEach(con => {
+        // 品牌
+        if (con.productBrandList) {
+          const brandList = []
+          con.productBrandList.forEach(item => {
+            item.brandName = item.productBrandName
+            const brandObj = {
+              productBrandSn: item.productBrandSn
+            }
+            brandList.push(brandObj)
           })
-          this.form = { ...this.form, ...obj }
-        } else {
-          this.detailsData = null
+          con.productBrandArr = con.productBrandList
+          con.productBrandList = brandList
+        }
+        // 分类
+        if (con.productTypeList) {
+          const typeList = []
+          con.productTypeList.forEach(item => {
+            const typeObj = {}
+            item.title = ''
+            const num = 3
+            for (var i = 0; i < num; i++) {
+              if (item['productTypeName' + (i + 1)]) {
+                item.title += item['productTypeName' + (i + 1)] + (item['productTypeName' + (i + 1)] ? '/' : '')
+                typeObj['productTypeSn' + (i + 1)] = item['productTypeSn' + (i + 1)] ? item['productTypeSn' + (i + 1)] : ''
+              }
+            }
+            item.title = item.title.slice(0, item.title.length - 1)
+            item.id = item.productTypeSn3 ? item.productTypeSn3 : item.productTypeSn2 ? item.productTypeSn2 : item.productTypeSn1
+            typeList.push(typeObj)
+          })
+          con.productTypeArr = con.productTypeList
+          con.productTypeList = typeList
+        }
+        // 产品
+        if (con.productThisList) {
+          const productList = []
+          con.productThisList.forEach(item => {
+            const productObj = {
+              productCode: item.productCode,
+              productSn: item.productSn
+            }
+            productList.push(productObj)
+          })
+          con.productThisList = productList
         }
       })
+      return list
     }
   },
   watch: {

+ 128 - 27
src/views/promotionRulesManagement/dealerPromotions/sendProductsModal.vue

@@ -25,12 +25,31 @@
             </a-radio-button>
           </a-radio-group>
-          <div class="ruleDescList" v-if="form.gateFlag && form.gateFlag === '1'">
-            购买满
-            <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"/>
-            元配额,采购规则中的正价商品(配额算销售额)
+          <div v-if="form.gateFlag && form.gateFlag === '1'">
+            <v-select
+              size="small"
+              style="width:60%;"
+              v-model="form.gateType"
+              id="promotionList-gateType"
+              code="PROMOTION_GATE_TYPE"
+              placeholder="请选择"
+              allowClear></v-select>
+            <div v-if="form.gateType==='RATIO_AMOUNT'">
+              购买门槛产品金额 <a-input-number v-model="form.gateAmount" :min="0" :max="100" size="small"/> %作为配额
+              <a-tooltip title="如:填写100%,则购买10000元门槛产品,可享受10000配额购买正价产品,根据门槛金额动态调整配额">
+                <a-icon type="question-circle" theme="filled" :style="{ fontSize: '14px', color: 'gray' }"/>
+              </a-tooltip>
+            </div>
+            <div v-if="form.gateType==='MIN_AMOUNT'">
+              购买门槛产品满最低金额 <a-input-number v-model="form.gateAmount" :min="0" :precision="2" size="small"/> 不限制配额。
+            </div>
+            <div class="ruleDescList" v-if="form.gateType==='FIXED_AMOUNT'">
+              购买满
+              <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"/>
+              元配额,采购规则中的正价商品(配额算销售额)
+            </div>
           </div>
         </a-form-model-item>
         <a-form-model-item label="满赠规则" prop="regularSameFlag">
@@ -50,10 +69,16 @@
             个促销产品
           </div>
           <div class="ruleDescList">
-            <a-checkbox size="small" :value="form.restrictFlag">
+            <a-checkbox size="small" @change="onChange">
               限制正价产品款数
             </a-checkbox>
-            <a-input-number v-model="form.restrictCategory" :min="0" :step="1" :precision="0" size="small"/>
+            <a-input-number
+              v-if="form.restrictFlag==='1'"
+              v-model="form.restrictCategory"
+              :min="0"
+              :step="1"
+              :precision="0"
+              size="small"/>
           </div>
         </a-form-model-item>
         <a-form-model-item label="数量叠加" prop="accrualFlag">
@@ -69,9 +94,9 @@
         </a-form-model-item>
         <a-form-model-item prop="minOrderFlag">
           <span slot="label">
-            <a-tooltip title="What do you want others to call you?">
+            <!-- <a-tooltip title="What do you want others to call you?">
               <a-icon type="info-circle" />
-            </a-tooltip>
+            </a-tooltip> -->
             订单起订金额
           </span>
           <a-select v-model="form.minOrderFlag" style="width: 160px" size="small">
@@ -94,9 +119,9 @@
         </a-form-model-item>
         <a-form-model-item prop="upperLimitFlag">
           <span slot="label">
-            <a-tooltip title="What do you want others to call you?">
+            <!-- <a-tooltip title="What do you want others to call you?">
               <a-icon type="info-circle" />
-            </a-tooltip>
+            </a-tooltip> -->
             活动经费上限
           </span>
           <a-select v-model="form.upperLimitFlag" style="width: 160px" size="small">
@@ -164,7 +189,7 @@ import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
 import tableType1 from './tableType1.vue'
 import tableType2 from './tableType2.vue'
-import { promotionSave, sparePartsReturnInfo } from '@/api/promotion'
+import { promotionSave, getRuleDetail } from '@/api/promotion'
 export default {
   name: 'PromotionListBasicInfoModal',
   mixins: [commonMixin],
@@ -177,6 +202,10 @@ export default {
     promotionSn: {
       type: [Number, String],
       default: ''
+    },
+    itemSn: {
+      type: [Number, String],
+      default: ''
     }
   },
   data () {
@@ -190,6 +219,7 @@ export default {
       form: {
         promotionRuleType: 'BUY_PROD_GIVE_PROD', // 买产品送产品
         gateFlag: '0', // 门槛
+        gateType: undefined,
         gateAmount: '',
         quotaAmount: '',
         regularSameFlag: '0', // 满赠规则  不同款商品
@@ -216,6 +246,9 @@ export default {
     }
   },
   methods: {
+    onChange (e) {
+      this.form.restrictFlag = e.target.checked ? '1' : '0'
+    },
     // 门槛切换  tab 按钮默认显示问题
     changeGateFlag (e) {
       if (this.chooseVal != 'c') {
@@ -231,7 +264,15 @@ export default {
       const _this = this
       // 验证必填
       if (_this.form.gateFlag == '1') {
-        if (!_this.form.gateAmount || !_this.form.quotaAmount) {
+        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
         }
@@ -258,8 +299,12 @@ export default {
           const form = JSON.parse(JSON.stringify(_this.form))
           if (form.gateFlag == '1') {
             form.gateProductList = this.$refs.cillProduct.getResultVal()
+            form.gateAmount = form.gateType === 'RATIO_AMOUNT' ? form.gateAmount / 100 : form.gateAmount
           } else {
             form.gateProductList = []
+            form.gateAmount = ''
+            form.quotaAmount = ''
+            form.gateType = undefined
           }
           if (form.regularPromotionSameFlag == '0') {
             form.giftProductList = this.$refs.offerProduct.getResultVal()
@@ -291,6 +336,7 @@ export default {
       this.form = {
         promotionRuleType: 'BUY_PROD_GIVE_PROD', // 买产品送产品
         gateFlag: '0', // 门槛
+        gateType: undefined,
         gateAmount: '',
         quotaAmount: '',
         regularSameFlag: '0', // 满赠规则  不同款商品
@@ -317,25 +363,80 @@ export default {
     },
     // 获取编辑详情
     getDetail () {
-      sparePartsReturnInfo({ sn: this.itemSn }).then(res => {
+      const _this = this
+      getRuleDetail({ 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.chooseVal = resultObj.gateFlag == '0' ? 'b' : 'a'
+          if (resultObj.gateFlag === '1') {
+            resultObj.gateAmount = resultObj.gateType === 'RATIO_AMOUNT' ? resultObj.gateAmount * 100 : resultObj.gateAmount
+          }
+          // 重新组成保存数据
+          if (resultObj.gateProductList && resultObj.gateProductList.length > 0) {
+            resultObj.gateProductList = _this.newData(resultObj.gateProductList)
+            this.$refs.cillProduct.setTabVal(resultObj.gateProductList)
+          }
+          if (resultObj.regularProductList && resultObj.regularProductList.length > 0) {
+            resultObj.regularProductList = _this.newData(resultObj.regularProductList)
+            this.$refs.normalPriceProduct.setTabVal(resultObj.regularProductList)
           }
-          this.$nextTick(() => {
-            this.$refs.attachList.setFileList(this.attachList)
+          if (resultObj.giftProductList && resultObj.giftProductList.length > 0) {
+            resultObj.giftProductList = _this.newData(resultObj.giftProductList)
+            this.$refs.offerProduct.setTabVal(resultObj.giftProductList)
+          }
+          this.form = { ...this.form, ...resultObj }
+        }
+      })
+    },
+    newData (list) {
+      list.forEach(con => {
+        // 品牌
+        if (con.productBrandList) {
+          const brandList = []
+          con.productBrandList.forEach(item => {
+            item.brandName = item.productBrandName
+            const brandObj = {
+              productBrandSn: item.productBrandSn
+            }
+            brandList.push(brandObj)
           })
-          this.form = { ...this.form, ...obj }
-        } else {
-          this.detailsData = null
+          con.productBrandArr = con.productBrandList
+          con.productBrandList = brandList
+        }
+        // 分类
+        if (con.productTypeList) {
+          const typeList = []
+          con.productTypeList.forEach(item => {
+            const typeObj = {}
+            item.title = ''
+            const num = 3
+            for (var i = 0; i < num; i++) {
+              if (item['productTypeName' + (i + 1)]) {
+                item.title += item['productTypeName' + (i + 1)] + (item['productTypeName' + (i + 1)] ? '/' : '')
+                typeObj['productTypeSn' + (i + 1)] = item['productTypeSn' + (i + 1)] ? item['productTypeSn' + (i + 1)] : ''
+              }
+            }
+            item.title = item.title.slice(0, item.title.length - 1)
+            item.id = item.productTypeSn3 ? item.productTypeSn3 : item.productTypeSn2 ? item.productTypeSn2 : item.productTypeSn1
+            typeList.push(typeObj)
+          })
+          con.productTypeArr = con.productTypeList
+          con.productTypeList = typeList
+        }
+        // 产品
+        if (con.productThisList) {
+          const productList = []
+          con.productThisList.forEach(item => {
+            const productObj = {
+              productCode: item.productCode,
+              productSn: item.productSn
+            }
+            productList.push(productObj)
+          })
+          con.productThisList = productList
         }
       })
+      return list
     }
   },
   watch: {

+ 93 - 22
src/views/promotionRulesManagement/dealerPromotions/specialOfferModal.vue

@@ -25,12 +25,31 @@
             </a-radio-button>
           </a-radio-group>
-          <div class="ruleDescList" v-if="form.gateFlag && form.gateFlag === '1'">
-            购买满
-            <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"/>
-            元配额,采购规则中的特价商品(配额算销售额)
+          <div v-if="form.gateFlag && form.gateFlag === '1'">
+            <v-select
+              size="small"
+              style="width:60%;"
+              v-model="form.gateType"
+              id="promotionList-gateType"
+              code="PROMOTION_GATE_TYPE"
+              placeholder="请选择"
+              allowClear></v-select>
+            <div v-if="form.gateType==='RATIO_AMOUNT'">
+              购买门槛产品金额 <a-input-number v-model="form.gateAmount" :min="0" :max="100" size="small"/> %作为配额
+              <a-tooltip title="如:填写100%,则购买10000元门槛产品,可享受10000配额购买正价产品,根据门槛金额动态调整配额">
+                <a-icon type="question-circle" theme="filled" :style="{ fontSize: '14px', color: 'gray' }"/>
+              </a-tooltip>
+            </div>
+            <div v-if="form.gateType==='MIN_AMOUNT'">
+              购买门槛产品满最低金额 <a-input-number v-model="form.gateAmount" :min="0" :precision="2" size="small"/> 不限制配额。
+            </div>
+            <div class="ruleDescList" v-if="form.gateType==='FIXED_AMOUNT'">
+              购买满
+              <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"/>
+              元配额,采购规则中的正价商品(配额算销售额)
+            </div>
           </div>
         </a-form-model-item>
         <a-form-model-item prop="minOrderFlag">
@@ -133,7 +152,7 @@ import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
 import tableType1 from './tableType1.vue'
 import tableType3 from './tableType3.vue'
-import { promotionSave, sparePartsReturnInfo, getNewScopeSn } from '@/api/promotion'
+import { promotionSave, getRuleDetail, getNewScopeSn } from '@/api/promotion'
 import chooseProductsModal from './chooseProductsModal.vue'
 export default {
   name: 'PromotionListBasicInfoModal',
@@ -147,6 +166,10 @@ export default {
     promotionSn: {
       type: [Number, String],
       default: ''
+    },
+    itemSn: {
+      type: [Number, String],
+      default: ''
     }
   },
   data () {
@@ -160,6 +183,7 @@ export default {
       form: {
         promotionRuleType: 'PROMO_PROD', // 特价产品
         gateFlag: '0', // 门槛
+        gateType: undefined,
         gateAmount: '',
         quotaAmount: '',
         minOrderFlag: '1', // 起订金额
@@ -254,29 +278,76 @@ export default {
     },
     // 获取编辑详情
     getDetail () {
-      sparePartsReturnInfo({ sn: this.itemSn }).then(res => {
+      const _this = this
+      getRuleDetail({ sn: this.itemSn }).then(res => {
         if (res.status == 200) {
+         this.chooseVal =  res.data.gateFlag == '0' ? 'd' : 'a'
           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
+          // 重新组成保存数据
+          if (resultObj.gateProductList && resultObj.gateProductList.length > 0) {
+            resultObj.gateProductList = _this.newData(resultObj.gateProductList)
+            this.$refs.cillProduct.setTabVal(resultObj.gateProductList)
           }
-          this.$nextTick(() => {
-            this.$refs.attachList.setFileList(this.attachList)
+          if (resultObj.specialProductList && resultObj.specialProductList.length > 0) {
+            resultObj.specialProductList = _this.newData(resultObj.specialProductList)
+            this.$refs.specialProduct.setSourceData(resultObj.specialProductList)
+          }
+          this.form = { ...this.form, ...resultObj }
+        }
+      })
+    },
+    newData (list) {
+      list.forEach(con => {
+        // 品牌
+        if (con.productBrandList) {
+          const brandList = []
+          con.productBrandList.forEach(item => {
+            item.brandName = item.productBrandName
+            const brandObj = {
+              productBrandSn: item.productBrandSn
+            }
+            brandList.push(brandObj)
           })
-          this.form = { ...this.form, ...obj }
-        } else {
-          this.detailsData = null
+          con.productBrandArr = con.productBrandList
+          con.productBrandList = brandList
+        }
+        // 分类
+        if (con.productTypeList) {
+          const typeList = []
+          con.productTypeList.forEach(item => {
+            const typeObj = {}
+            item.title = ''
+            const num = 3
+            for (var i = 0; i < num; i++) {
+              if (item['productTypeName' + (i + 1)]) {
+                item.title += item['productTypeName' + (i + 1)] + (item['productTypeName' + (i + 1)] ? '/' : '')
+                typeObj['productTypeSn' + (i + 1)] = item['productTypeSn' + (i + 1)] ? item['productTypeSn' + (i + 1)] : ''
+              }
+            }
+            item.title = item.title.slice(0, item.title.length - 1)
+            item.id = item.productTypeSn3 ? item.productTypeSn3 : item.productTypeSn2 ? item.productTypeSn2 : item.productTypeSn1
+            typeList.push(typeObj)
+          })
+          con.productTypeArr = con.productTypeList
+          con.productTypeList = typeList
+        }
+        // 产品
+        if (con.productThisList) {
+          const productList = []
+          con.productThisList.forEach(item => {
+            const productObj = {
+              productCode: item.productCode,
+              productSn: item.productSn
+            }
+            productList.push(productObj)
+          })
+          con.productThisList = productList
         }
       })
+      return list
     },
     // +新增产品
     handleProductsOk (con) {
-      debugger
       const chooseProductsList = []
       const _this = this
       con.forEach(item => {
@@ -284,7 +355,7 @@ export default {
           if (res.status == 200) {
             const newData = {
               productScopeSn: res.data,
-              dataSourceOrigin: 'sel',
+              dataSourceOrigin:'1',
               productTypeArr: [],
               productTypeList: [],
               productBrandArr: [{ brandSn: item.productBrandSn, brandName: item.productBrandName }],

+ 5 - 8
src/views/promotionRulesManagement/dealerPromotions/tableType1.vue

@@ -47,7 +47,7 @@
         <div style="max-height:106spx;overflow-y:scroll;">
           <a-row v-if="record.productBrandArr && record.productBrandArr.length>0">
             <a-col :span="20">
-              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')" v-for="item in record.productBrandArr" :key="item.productBrandSn">
+              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')" v-for="item in record.productBrandArr" :key="item.brandSn">
                 {{ item.brandName }}
               </a-tag>
             </a-col>
@@ -107,7 +107,7 @@
             v-model="record.unitQty"
             :min="0"
             :step="1"
-            :precision="2"
+            :precision="0"
             placeholder="请输入"/>
         </div>
       </template>
@@ -150,12 +150,6 @@ export default {
   name: 'TableType1',
   mixins: [commonMixin],
   components: { VSelect, ChooseBrandModal, ChooseTypeModal, chooseProductsModal },
-  props: {
-    itemSn: {
-      type: [Number, String],
-      default: ''
-    }
-  },
   data () {
     return {
       spinning: false,
@@ -295,6 +289,9 @@ export default {
       })
       return resultObj
     },
+    setTabVal (formData) {
+      this.dataSource = formData
+    },
     // 关闭时清空表格数据
     reSetTableData () {
       this.dataSource = []

+ 4 - 7
src/views/promotionRulesManagement/dealerPromotions/tableType2.vue

@@ -40,7 +40,7 @@
         <div style="max-height:106spx;overflow-y:scroll;">
           <a-row v-if="record.productBrandArr && record.productBrandArr.length>0">
             <a-col :span="20">
-              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')" v-for="item in record.productBrandArr" :key="item.productBrandSn">
+              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')" v-for="item in record.productBrandArr" :key="item.brandSn">
                 {{ item.brandName }}
               </a-tag>
             </a-col>
@@ -122,12 +122,6 @@ export default {
   name: 'TableType1',
   mixins: [commonMixin],
   components: { VSelect, ChooseBrandModal, ChooseTypeModal, chooseProductsModal },
-  props: {
-    itemSn: {
-      type: [Number, String],
-      default: ''
-    }
-  },
   data () {
     return {
       spinning: false,
@@ -263,6 +257,9 @@ export default {
       })
       return resultObj
     },
+    setTabVal (formData) {
+      this.dataSource = formData
+    },
     // 关闭时清空表格数据
     reSetTableData () {
       this.dataSource = []

+ 72 - 50
src/views/promotionRulesManagement/dealerPromotions/tableType3.vue

@@ -13,7 +13,7 @@
       bordered>
       <!-- 产品分类 -->
       <template slot="productType" slot-scope="text, record,index">
-        <div style="max-height:64px;overflow-y:scroll;" v-if="!record.dataSourceOrigin">
+        <div style="max-height:64px;overflow-y:scroll;" v-if="record.dataSourceOrigin=='0'">
           <a-row v-if="record.productTypeArr && record.productTypeArr.length>0">
             <a-col :span="20">
               <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,con,'typeList')" v-for="con in record.productTypeArr" :key="con.id">
@@ -38,10 +38,10 @@
       </template>
       <!-- 品牌 -->
       <template slot="productBrand" slot-scope="text, record,index">
-        <div style="max-height:64px;overflow-y:scroll;" v-if="!record.dataSourceOrigin">
+        <div style="max-height:64px;overflow-y:scroll;" v-if="record.dataSourceOrigin=='0'">
           <a-row v-if="record.productBrandArr && record.productBrandArr.length>0">
             <a-col :span="20">
-              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')" v-for="item in record.productBrandArr" :key="item.productBrandSn">
+              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')" v-for="item in record.productBrandArr" :key="item.brandSn">
                 {{ item.brandName }}
               </a-tag>
             </a-col>
@@ -63,30 +63,31 @@
       </template>
       <!-- 产品 -->
       <template slot="product" slot-scope="text, record">
-        <span v-if="record.dataSourceOrigin" v-for="item in record.productThisList" :key="item.productSn">{{ item.productCode }}</span>
+        <span v-if="record.dataSourceOrigin=='1'" v-for="item in record.productThisList" :key="item.productSn">{{ item.productCode }}</span>
         <span v-else>--</span>
       </template>
       <!-- 省价特价 -->
       <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="请输入"
-          v-if="record.dataSourceOrigin"
-          :max="record.provincePrice"
-          @blur="e=>calculatePrice(e.target.value,record.productScopeSn,'province')"/>
+        <div v-if="record.dataSourceOrigin=='1'">
+          <a-input-number
+            size="small"
+            style="width:75%;"
+            v-model="record.provinceDiscountPrice"
+            :min="0"
+            :step="1"
+            :precision="2"
+            placeholder="请输入"
+            :max="record.provincePrice"
+            @blur="e=>calculatePrice(e.target.value,record.productScopeSn,'province')"/>
+        </div>
         <span v-else>--</span>
       </template>
       <!-- 省价折扣 -->
       <template slot="provinceDiscount" slot-scope="text, record">
-        <div v-if="!record.dataSourceOrigin">
+        <div v-if="record.dataSourceOrigin=='0'">
           <a-input-number
             size="small"
-            style="width:80%;"
+            style="width:75%;"
             v-model="record.provinceDiscountRate"
             :min="0"
             :step="1"
@@ -94,65 +95,67 @@
             placeholder="请输入"
           />%
         </div>
-        <span v-else>{{ record.provinceDiscountRate?record.provinceDiscountRate:'--' }}</span>
+        <span v-else>{{ record.provinceDiscountRate?record.provinceDiscountRate+'%':'--' }}</span>
       </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="请输入"
-          v-if="record.dataSourceOrigin"
-          :max="record.cityPrice"
-          @blur="e=>calculatePrice(e.target.value,record.productScopeSn,'city')"/>
+        <div  v-if="record.dataSourceOrigin=='1'">
+          <a-input-number
+            size="small"
+            style="width:75%;"
+            v-model="record.cityDiscountPrice"
+            :min="0"
+            :step="1"
+            :precision="2"
+            placeholder="请输入"
+            :max="record.cityPrice"
+            @blur="e=>calculatePrice(e.target.value,record.productScopeSn,'city')"/>
+        </div>
         <span v-else>--</span>
       </template>
       <!-- 市价折扣 -->
       <template slot="cityDiscount" slot-scope="text, record">
-        <div v-if="!record.dataSourceOrigin">
+        <div v-if="record.dataSourceOrigin=='0'">
           <a-input-number
             size="small"
-            style="width:80%;"
+            style="width:75%;"
             v-model="record.cityDiscountRate"
             :min="0"
             :step="1"
             :max="100"
             placeholder="请输入"/>%
         </div>
-        <span v-else>{{ record.cityDiscountRate?record.cityDiscountRate:'--' }}</span>
+        <span v-else>{{ record.cityDiscountRate?record.cityDiscountRate+'%':'--' }}</span>
       </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="请输入"
-          v-if="record.dataSourceOrigin"
-          :max="record.specialPrice"
-          @blur="e=>calculatePrice(e.target.value,record.productScopeSn,'special')"/>
+       <div  v-if="record.dataSourceOrigin=='1'">
+         <a-input-number
+           size="small"
+           style="width:75%;"
+           v-model="record.specialDiscountPrice"
+           :min="0"
+           :step="1"
+           :precision="2"
+           placeholder="请输入"
+           :max="record.specialPrice"
+           @blur="e=>calculatePrice(e.target.value,record.productScopeSn,'special')"/>
+       </div>
         <span v-else>--</span>
       </template>
       <!-- 特约折扣 -->
       <template slot="specialDiscount" slot-scope="text, record">
-        <div v-if="!record.dataSourceOrigin">
+        <div v-if="record.dataSourceOrigin=='0'">
           <a-input-number
             size="small"
-            style="width:80%;"
+            style="width:75%;"
             v-model="record.specialDiscountRate"
             :min="0"
             :step="1"
             :max="100"
-            placeholder="请输入"/>%
+            placeholder="请输入"/>
         </div>
-        <span v-else>{{ record.specialDiscountRate ? record.specialDiscountRate:'--' }}</span>
+        <span v-else>{{ record.specialDiscountRate ? record.specialDiscountRate+'%':'--' }}</span>
       </template>
       <!-- 设置起订量 -->
       <template slot="setNum" slot-scope="text, record">
@@ -239,7 +242,7 @@ export default {
       chooseType: [],
       brandTagIndex: null, // 所选品牌位置
       classifyTagIndex: null, // 所选分类位置
-      dataSourceOrigin: null // 数据来源  sle  选择产品  null 新增一行品类
+      dataSourceOrigin: 0 // 数据来源  1  选择产品  0 新增一行品类
     }
   },
   methods: {
@@ -248,14 +251,14 @@ export default {
       const _this = this
       const pos = _this.dataSource.findIndex(con => con.productScopeSn == sn)
       const oldPrice = typePrice + 'Price'
-      const str = Math.floor(((val / _this.dataSource[pos][oldPrice]) * 100).toFixed(2)) + '%'
+      const str = Math.floor(((val / _this.dataSource[pos][oldPrice]) * 100).toFixed(2))
       const name = typePrice + 'DiscountRate'
       _this.dataSource[pos][name] = str
       _this.$forceUpdate()
     },
     // 新增产品 数据
     setSourceData (list) {
-      this.dataSource = list
+      this.dataSource=this.dataSource.concat(list)
     },
     // 新增一行
     handleAddRow () {
@@ -265,6 +268,7 @@ export default {
         if (res.status == 200) {
           const newData = {
             productScopeSn: res.data,
+            dataSourceOrigin:'0',
             productTypeArr: [],
             productTypeList: [],
             productBrandArr: [],
@@ -276,6 +280,11 @@ export default {
         }
       })
     },
+    // 删除一行
+    handleDel (row) {
+      const pos = this.dataSource.findIndex(con => con.productScopeSn == row.productScopeSn)
+      this.dataSource.splice(pos, 1)
+    },
     // 添加产品分类
     addClassifyTag (pos, row) {
       this.classifyTagIndex = pos
@@ -351,6 +360,19 @@ export default {
     // 关闭时清空表格数据
     reSetTableData () {
       this.dataSource = []
+    },
+    // 删除标签
+    delLabel (sn, row, type) {
+      const pos = this.dataSource.findIndex(con => con.productScopeSn == sn)
+      if (type === 'typeList') {
+        const i = this.dataSource[pos].productTypeArr.findIndex(con => con.id == row.id)
+        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)
+        this.dataSource[pos].productBrandArr.splice(j, 1)
+        this.dataSource[pos].productBrandList.splice(j, 1)
+      }
     }
   }
 }