Selaa lähdekoodia

规则设置 --- 详情

chenrui 1 vuosi sitten
vanhempi
commit
c0117cc231

+ 48 - 19
src/views/promotionRulesManagement/dealerPromotions/detail.vue

@@ -76,21 +76,21 @@
           <!-- 操作 -->
           <template slot="action" slot-scope="text, record">
             <a-button
-              v-if="$route.params.type=='rule'"
+              v-if="$route.query.type=='rule'"
               size="small"
               type="link"
-              @click="handleDetail(record)"
+              @click="handleEdit(record)"
               class="button-info"
               id="promotionList-edit-btn">编辑</a-button>
             <a-button
-              v-if="$route.params.type=='rule'"
+              v-if="$route.query.type=='rule'"
               size="small"
               type="link"
               @click="handleDel(record)"
               class="button-error"
               id="promotionList-del-btn">删除</a-button>
             <a-button
-              v-if="!$route.params.type"
+              v-if="!$route.query.type"
               size="small"
               type="link"
               @click="handleDetail(record)"
@@ -105,7 +105,7 @@
     <!-- 促销品费用归属品牌/促销品费用归属品类 -->
     <brandCategoryModal :openType="openType" :openModal="openModal" @close="openModal = false"></brandCategoryModal>
     <!-- 详情 -->
-    <detailModal :openModal="openDetailModal" @close="openDetailModal = false"></detailModal>
+    <detailModal :openModal="openDetailModal" :itemSn="detailSn" @close="closeDetailModal"></detailModal>
     <!-- 买产品送产品  弹窗 -->
     <sendProductsModal :openModal="openSendProductsModal" :promotionSn="$route.query.sn" @ok="$refs.table.refresh()" @close="openSendProductsModal = false"></sendProductsModal>
     <!-- 买产品送采购额 弹窗 -->
@@ -124,7 +124,7 @@ import detailModal from './detailModal'
 import sendProductsModal from './sendProductsModal'
 import sendAmountModal from './sendAmountModal'
 import specialOfferModal from './specialOfferModal'
-import { getRuleQueryList, dealerPromotionInfo } from '@/api/promotion'
+import { getRuleQueryList, dealerPromotionInfo, promotionRulesDel } from '@/api/promotion'
 export default {
   name: 'SalesOrderWarehouseDetail',
   mixins: [commonMixin],
@@ -161,7 +161,8 @@ export default {
           this.spinning = false
           return data
         })
-      }
+      },
+      detailSn: null
     }
   },
   computed: {
@@ -169,26 +170,32 @@ export default {
       const _this = this
       const arr = [
         { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
-        { title: '促销类型', dataIndex: 'promotionRuleTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '促销类型', dataIndex: 'promotionRuleTypeDictValue', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '规则门槛', scopedSlots: { customRender: 'cillProduct' }, width: '20%', align: 'center' },
         { title: '规则', scopedSlots: { customRender: 'ruleProduct' }, width: '28%', align: 'center' },
-        { title: '订单起订金额(元)', dataIndex: 'minOrderAmount', width: '15%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '订单经费上限(元)', dataIndex: 'upperLimitAmount', width: '15%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '12%', 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' }
       ]
       return arr
     }
   },
   methods: {
-    // 查看详情
-    handleDetail (con) {
+    // 打开详情弹窗
+    handleDetail (row) {
+      this.detailSn = row.promotionRuleSn
       this.openDetailModal = true
     },
+    // 关闭详情弹窗
+    closeDetailModal () {
+      this.detailSn = null
+      this.openDetailModal = false
+    },
     //  返回
     handleBack () {
       this.$router.push({ name: 'dealerPromotionManagement' })
     },
-    //  详情
+    //  基础信息详情
     getDetail () {
       dealerPromotionInfo({ sn: this.$route.query.sn }).then(res => {
         if (res.status == 200) {
@@ -199,11 +206,6 @@ export default {
         }
       })
     },
-    // 基础信息  详情弹窗
-    handleSeeDetail (name) {
-      this.openType = name
-      this.openModal = true
-    },
     // 买产品送产品
     handleProduct () {
       this.openSendProductsModal = true
@@ -219,6 +221,33 @@ export default {
     // 查看客户
     handleSee () {
       this.openCustomerModal = true
+      this.$nextTick(() => {
+        this.$refs.lookUpCustomers.pageInit({ dealerSnList: this.detailData.dealerSnList ? this.detailData.dealerSnList : undefined })
+      })
+    },
+    // 删除规则
+    handleDel (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '确认要该规则吗?',
+        centered: true,
+        onOk () {
+          _this.spinning = true
+          promotionRulesDel({ promotionSn: _this.$route.query.sn, promotionRuleSn: row.promotionRuleSn }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
+        }
+      })
+    },
+    handleEdit () {
+
     }
   },
   mounted () {

+ 182 - 140
src/views/promotionRulesManagement/dealerPromotions/detailModal.vue

@@ -16,65 +16,134 @@
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
-        <a-form-model-item label="规则门槛" prop="supplierSn">是</a-form-model-item>
-        <a-form-model-item label="满赠规则" prop="supplierSn">
-          <div>购买满10000元门槛产品,可使用200  元配额,采购规则中的正价商品(配额算销售额)</div>
-          <div>同款产品购买满10个正价产品,送2个促销产品,限制正价产品款数40</div>
+        <a-form-model-item label="规则门槛" prop="gateFlag" v-if="form.gateFlag">
+          <div>{{ form.gateFlag=== '0'?'无':'有' }}</div>
+          <div v-if="gateFlag==='1'">购买满{{ form.gateAmount }}元门槛产品,可使用{{ form.quotaAmount }}元配额,采购规则中的正价商品(配额算销售额)</div>
         </a-form-model-item>
-        <a-form-model-item label="数量叠加" prop="supplierSn">是</a-form-model-item>
-        <a-form-model-item prop="supplierSn" v-bind="formItemLayout">
+        <!-- 买产品送产品 -->
+        <a-form-model-item label="满赠规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_PROD'">
+          <span>{{ form.regularSameFlag==='1'?'同款':'不同款' }}产品购买满{{ form.regularQty }}个正价产品,送{{ form.promotionQty }}个促销产品</span>
+          <span v-if="form.restrictFlag&&form.restrictFlag==1">,限制正价产品款数{{ form.restrictCategory }}</span>
+        </a-form-model-item>
+        <a-form-model-item label="满赠规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_MONEY'">
+          {{ form.regularSameFlag==='1'?'同款':'不同款' }}产品购买满{{ form.regularAmount }}元正价产品,送{{ form.giveAmount }}元{{ perCentNum }}促销品采购额
+        </a-form-model-item>
+        <a-form-model-item label="数量叠加" prop="accrualFlag" v-if="form.accrualFlag">{{ form.accrualFlag==='1'?'是':'否' }}</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-icon type="info-circle" />
             </a-tooltip>
             订单起订金额
           </span>
+          {{ form.minOrderFlag === '1'?'限制':'不限制' }}{{ form.minOrderAmount }}元
+        </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-icon type="info-circle" />
+            </a-tooltip>
+            活动经费上限
+          </span>
+          {{ form.upperLimitFlag === '1'?'限制':'不限制' }}{{ form.upperLimitAmount }}元
         </a-form-model-item>
-        <a-form-model-item label="活动经费上限" prop="supplierSn">限制 20000元</a-form-model-item>
-        <a-form-model-item label="促销品是否与正品一致" prop="supplierSn">否</a-form-model-item>
+        <a-form-model-item label="促销品是否与正品一致" v-if="form.regularPromotionSameFlag" prop="regularPromotionSameFlag">{{ form.regularPromotionSameFlag==='1'?'是':'否' }}</a-form-model-item>
+        <a-form-model-item label="采购额使用范围" v-if="form.scopeFlag" prop="scopeFlag">{{ form.scopeFlag==='1'?'全部产品':'部分产品' }}</a-form-model-item>
       </a-form-model>
       <a-card size="small" :bordered="false" class="pages-wrap">
         <a-radio-group v-model="chooseVal" button-style="solid">
-          <a-radio-button value="a">
+          <a-radio-button value="a" v-show="form.gateFlag==='1'">
             门槛产品
           </a-radio-button>
-          <a-radio-button value="b">
+          <a-radio-button value="b" v-show="form.promotionRuleType!='PROMO_PROD'">
             正价产品
           </a-radio-button>
-          <a-radio-button value="c">
+          <a-radio-button value="c" v-show="form.regularPromotionSameFlag==='0'||form.scopeFlag==='0'">
             促销产品
           </a-radio-button>
+          <a-radio-button value="d" v-show="form.promotionRuleType=='PROMO_PROD'">
+            特价产品
+          </a-radio-button>
         </a-radio-group>
         <!-- 列表 -->
-        <s-table
-          class="sTable"
-          style="margin-top:10px;max-height:280px;"
-          ref="table"
-          size="small"
-          :rowKey="(record) => record.id"
-          :columns="columns"
-          :data="loadData"
-          :scroll="{ y: 500 }"
-          :defaultLoadData="false"
-          bordered>
-          <!-- 产品分类 -->
-          <template slot="productType" slot-scope="text, record">
-            <a-tag>产品分类</a-tag>
-          </template>
-          <!-- 品牌 -->
-          <template slot="productBrand" slot-scope="text, record">
-            <a-tag>品牌</a-tag>
-          </template>
-          <!-- 产品 -->
-          <template slot="product" slot-scope="text, record">
-            <a-tag>产品</a-tag>
-          </template>
-          <!-- 设置起订量 -->
-          <template slot="setNum" slot-scope="text, record">
-            <span style="margin-right:10px;">按数量设置</span>
-            <span>1</span>
-          </template>
-        </s-table>
+        <div v-show="chooseVal!='d'">
+          <a-table
+            class="sTable"
+            style="margin-top:10px;max-height:280px;"
+            ref="table"
+            size="small"
+            :rowKey="(record) => record.productScopeSn"
+            :columns="columns"
+            :data-source="chooseVal==='a'?form.gateProductList:chooseVal==='b'?form.regularProductList:form.giftProductList"
+            :scroll="{ y: 500 }"
+            :pagination="false"
+            bordered
+          >
+            <!-- 产品分类 -->
+            <template slot="productType" slot-scope="text, record">
+              <div style="max-height:100px;overflow-y:scroll;" v-if="record.productTypeList && record.productTypeList.length>0">
+                <a-tag style="margin-bottom:5px;" v-for="item in record.productTypeList" :key="item.id">{{ item.productTypeName1 }}{{ item.productTypeName2?'/'+item.productTypeName2 :'' }}{{ item.productTypeName3?'/'+item.productTypeName3:'' }}</a-tag>
+              </div>
+            </template>
+            <!-- 品牌 -->
+            <template slot="productBrand" slot-scope="text, record">
+              <div style="max-height:100px;overflow-y:scroll;" v-if="record.productBrandList && record.productBrandList.length>0">
+                <a-tag style="margin-bottom:5px;" v-for="item in record.productBrandList" :key="item.id">{{ item.productBrandName }}</a-tag>
+              </div>
+            </template>
+            <!-- 产品 -->
+            <template slot="product" slot-scope="text, record">
+              <div style="max-height:100px;overflow-y:scroll;" v-if="record.productThisList && record.productThisList.length>0">
+                <a-tag style="margin-bottom:5px;" v-for="item in record.productThisList" :key="item.id">{{ item.productCode }}</a-tag>
+              </div>
+            </template>
+            <!-- 设置起订量 -->
+            <template slot="setNum" slot-scope="text, record">
+              <span style="margin-right:10px;">{{ record.unitTypeDictValue }}</span>
+              <span>{{ record.unitQty }}</span>
+            </template>
+          </a-table>
+        </div>
+        <!-- 特价产品 -->
+        <div v-show="chooseVal=='d'">
+          <a-table
+            class="sTable"
+            style="margin-top:10px;max-height:280px;"
+            ref="table"
+            size="small"
+            :rowKey="(record) => record.productScopeSn"
+            :columns="specialColumns"
+            :data-source="form.specialProductList"
+            :scroll="{ y: 500 }"
+            :pagination="false"
+            bordered
+          >
+            <!-- 产品分类 -->
+            <template slot="productType" slot-scope="text, record">
+              <div style="max-height:100px;overflow-y:scroll;" v-if="record.productTypeList && record.productTypeList.length>0">
+                <a-tag style="margin-bottom:5px;" v-for="item in record.productTypeList" :key="item.id">{{ item.productTypeName1 }}{{ item.productTypeName2?'/'+item.productTypeName2 :'' }}{{ item.productTypeName3?'/'+item.productTypeName3:'' }}</a-tag>
+              </div>
+            </template>
+            <!-- 品牌 -->
+            <template slot="productBrand" slot-scope="text, record">
+              <div style="max-height:100px;overflow-y:scroll;" v-if="record.productBrandList && record.productBrandList.length>0">
+                <a-tag style="margin-bottom:5px;" v-for="item in record.productBrandList" :key="item.id">{{ item.productBrandName }}</a-tag>
+              </div>
+            </template>
+            <!-- 产品 -->
+            <template slot="product" slot-scope="text, record">
+              <div style="max-height:100px;overflow-y:scroll;" v-if="record.productThisList && record.productThisList.length>0">
+                <a-tag style="margin-bottom:5px;" v-for="item in record.productThisList" :key="item.id">{{ item.productCode }}</a-tag>
+              </div>
+              <span v-else>--</span>
+            </template>
+            <!-- 设置起订量 -->
+            <template slot="setNum" slot-scope="text, record">
+              <span style="margin-right:10px;">{{ record.unitTypeDictValue }}</span>
+              <span>{{ record.unitQty }}</span>
+            </template>
+          </a-table>
+        </div>
       </a-card>
       <div class="btn-cont">
         <a-button id="dealerPromotions-basicInfo-modal-back" @click="isShow = false">关闭</a-button>
@@ -86,7 +155,7 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { STable } from '@/components'
-import { sparePartsReturnSave, sparePartsReturnInfo } from '@/api/sparePartsReturn'
+import { getRuleDetail } from '@/api/promotion'
 export default {
   name: 'DetailModal',
   mixins: [commonMixin],
@@ -97,11 +166,12 @@ export default {
       default: false
     },
     itemSn: {
-      type: [Number, String],
+      type: String,
       default: ''
     }
   },
   data () {
+    const _this = this
     return {
       isShow: this.openModal, //  是否打开弹框
       spinning: false,
@@ -110,115 +180,97 @@ export default {
         wrapperCol: { span: 16 }
       },
       form: {
-        promotionName: '',
-        activeDate: undefined,
-        supplierSn: undefined, // 供应商
-        returnReason: '', // 退货原因
-        explainInfo: '', // 补充说明
-        warehouseSn: undefined,
-        attachmentList: ''
+        promotionRuleType: undefined,
+        gateFlag: undefined, // 门槛
+        gateAmount: undefined,
+        quotaAmount: undefined,
+        regularSameFlag: undefined, // 满赠规则  不同款商品
+        regularQty: undefined,
+        promotionQty: undefined,
+        regularAmount: undefined,
+        giveAmount: undefined,
+        restrictFlag: undefined, // 限制正价产品款数
+        restrictCategory: undefined,
+        accrualFlag: undefined, // 数量叠加
+        minOrderFlag: undefined, // 起订金额
+        minOrderAmount: undefined,
+        upperLimitFlag: undefined, // 活动经费上限
+        upperLimitAmount: undefined,
+        regularPromotionSameFlag: undefined,
+        productTypeArr: [],
+        productTypeList: [],
+        productBrandArr: [],
+        productBrandList: [],
+        productThisList: []
       },
-      rules: {
-        supplierSn: [
-          { required: true, message: '请选择供应商名称', trigger: 'change' }
-        ]
-      },
-      chooseVal: 'a'
+      chooseVal: 'a',
+      specialColumns: [
+        { title: '产品分类', width: '11%', scopedSlots: { customRender: 'productType' }, align: 'center' },
+        { title: '品牌', width: '11%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
+        { title: '产品', scopedSlots: { customRender: 'product' }, width: '8%', align: 'center' },
+        { title: '省价原价', dataIndex: 'provincePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '省价特价', dataIndex: 'provinceDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '省价折扣', dataIndex: 'provinceDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
+        { title: '市价原价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '市价特价', dataIndex: 'cityDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '市价折扣', dataIndex: 'cityDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
+        { title: '特约原价', dataIndex: 'specialPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '特约特价', dataIndex: 'specialDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '特约折扣', dataIndex: 'specialDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
+        { title: '设置起订量', width: '12%', scopedSlots: { customRender: 'setNum' }, align: 'center' }
+      ]
     }
   },
   computed: {
     columns () {
       const _this = this
       const arr = [
-        { title: '产品分类', width: '20%', scopedSlots: { customRender: 'productType' }, align: 'center' },
-        { title: '品牌', width: '40%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
-        { title: '产品', width: '40%', scopedSlots: { customRender: 'product' }, align: 'center' },
+        { title: '产品分类', width: '30%', scopedSlots: { customRender: 'productType' }, align: 'center' },
+        { title: '品牌', width: '35%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
+        { title: '产品', width: '35%', scopedSlots: { customRender: 'product' }, align: 'center' },
         { title: '设置起订量', width: '20%', scopedSlots: { customRender: 'setNum' }, align: 'center' }
       ]
       if (_this.chooseVal == 'c') {
         arr.pop()
       }
       return arr
+    },
+    perCentNum () {
+      return Math.floor(((this.form.giveAmount / this.form.regularAmount) * 100).toFixed(2)) + '%'
     }
   },
   methods: {
-    // 选择参与客户
-    handleDealerModal () {
-      this.openDealerModal = true
-      const _this = this
-      if (_this.chooseDealerList.length == 0) {
-        _this.form.promoBuyerList = []
+    // 重置
+    resetSearchForm () {
+      this.form = {
+        promotionRuleType: undefined,
+        gateFlag: undefined, // 门槛
+        gateAmount: undefined,
+        quotaAmount: undefined,
+        regularSameFlag: undefined, // 满赠规则  不同款商品
+        regularQty: undefined,
+        promotionQty: undefined,
+        regularAmount: undefined,
+        giveAmount: undefined,
+        restrictFlag: undefined, // 限制正价产品款数
+        restrictCategory: undefined,
+        accrualFlag: undefined, // 数量叠加
+        minOrderFlag: undefined, // 起订金额
+        minOrderAmount: undefined,
+        upperLimitFlag: undefined, // 活动经费上限
+        upperLimitAmount: undefined,
+        regularPromotionSameFlag: undefined
       }
-      const arr = _this.chooseDealerList.map(item => {
-        return item.buyerSn
-      })
-      // 选择经销商回显
-      _this.$nextTick(() => {
-        _this.$refs.dealerChoose.pageInit(arr)
-      })
-    },
-    // 添加经销商
-    handleAddDealer (list) {
-      this.chooseDealerList = list.map(con => {
-        return {
-          buyerSn: con.dealerSn,
-          buyerName: con.dealerName
-        }
-      })
-      this.openDealerModal = false
-      // 移除表单必填项
-      this.$refs.ruleForm.clearValidate('promoBuyerList')
     },
-    //  保存
-    handleSave () {
-      const _this = this
-      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
-        }
-      })
-    },
-    // 获取编辑详情
+    // 获取列表详情
     getDetail () {
-      sparePartsReturnInfo({ sn: this.itemSn }).then(res => {
+      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.$nextTick(() => {
-            this.$refs.attachList.setFileList(this.attachList)
-          })
-          this.form = { ...this.form, ...obj }
-        } else {
-          this.detailsData = null
+          this.chooseVal = resultObj.gateFlag == '1' ? 'a' : 'b'
+          this.form = { ...this.form, ...resultObj }
         }
       })
-    },
-    // 不可选日期
-    disabledDate (date, dateStrings) {
-      return date && date.valueOf('day') < moment().subtract(1, 'day') // 今天以后,包含今天
     }
   },
   watch: {
@@ -230,19 +282,9 @@ 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()
-        })
+        this.resetSearchForm()
       } else {
-        if (this.itemSn) {
-          this.getDetail()
-        } else {
-          // 默认仓库
-          this.form.warehouseSn = this.isShowWarehouse ? undefined : this.defWarehouse && this.defWarehouse.warehouseSn
-        }
+        this.getDetail()
       }
     }
   }

+ 9 - 9
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.brandSn">
+              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')" v-for="item in record.productBrandArr" :key="item.productBrandSn">
                 {{ item.brandName }}
               </a-tag>
             </a-col>
@@ -216,7 +216,7 @@ export default {
         if (item.productTypeLevel == 1) {
           if (!item.dataRef.children) {
             const objType1 = {
-              productType1: item.snPaths
+              productTypeSn1: item.snPaths
             }
             newClassifyArr.push(objType1)
             const obj = JSON.parse(JSON.stringify(objType1))
@@ -229,8 +229,8 @@ export default {
           if (!item.dataRef.children) {
             const typeArr1 = item.snPaths ? item.snPaths.split(',') : []
             const objType2 = {
-              productType1: typeArr1[0],
-              productType2: typeArr1[1]
+              productTypeSn1: typeArr1[0],
+              productTypeSn2: typeArr1[1]
             }
             newClassifyArr.push(objType2)
             const obj = JSON.parse(JSON.stringify(objType2))
@@ -242,9 +242,9 @@ export default {
         if (item.productTypeLevel == 3) {
           const typeArr2 = item.snPaths ? item.snPaths.split(',') : []
           const objType3 = {
-            productType1: typeArr2[0],
-            productType2: typeArr2[1],
-            productType3: typeArr2[2]
+            productTypeSn1: typeArr2[0],
+            productTypeSn2: typeArr2[1],
+            productTypeSn3: typeArr2[2]
           }
           newClassifyArr.push(objType3)
           const obj = JSON.parse(JSON.stringify(objType3))
@@ -264,7 +264,7 @@ export default {
     handleBrandOk (conList) {
       const newConList = conList.map(con => {
         return {
-          brandSn: con.brandSn
+          productBrandSn: con.brandSn
         }
       })
       this.dataSource[this.brandTagIndex].productBrandArr = conList
@@ -307,7 +307,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.brandSn)
+        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)
       } else {

+ 31 - 10
src/views/promotionRulesManagement/dealerPromotions/tableType2.vue

@@ -16,7 +16,7 @@
         <div style="max-height:80px;width:100%;overflow-y:scroll;">
           <a-row v-if="record.productTypeArr && record.productTypeArr.length>0">
             <a-col :span="18">
-              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.bizUserScopeSn,con,'typeList')" v-for="(con,i) in record.productTypeArr" :key="i">
+              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,con,'typeList')" v-for="con in record.productTypeArr" :key="con.id">
                 {{ con.title }}
               </a-tag>
             </a-col>
@@ -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.bizUserScopeSn,item,'brandList')" v-for="(item,j) in record.productBrandArr" :key="j">
+              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')" v-for="item in record.productBrandArr" :key="item.productBrandSn">
                 {{ item.brandName }}
               </a-tag>
             </a-col>
@@ -64,7 +64,7 @@
         <div style="max-height:64px;overflow-y:scroll;">
           <a-row v-if="record.productThisList && record.productThisList.length>0">
             <a-col :span="20">
-              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.bizUserScopeSn,item,'productList')" v-for="(item,k) in record.productThisList" :key="k">
+              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'productList')" v-for="item in record.productThisList" :key="item.productSn">
                 {{ item.productCode }}
               </a-tag>
             </a-col>
@@ -170,6 +170,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
@@ -182,7 +187,7 @@ export default {
         if (item.productTypeLevel == 1) {
           if (!item.dataRef.children) {
             const objType1 = {
-              productType1: item.snPaths
+              productTypeSn1: item.snPaths
             }
             newClassifyArr.push(objType1)
             const obj = JSON.parse(JSON.stringify(objType1))
@@ -194,8 +199,8 @@ export default {
           if (!item.dataRef.children) {
             const typeArr1 = item.snPaths ? item.snPaths.split(',') : []
             const objType2 = {
-              productType1: typeArr1[0],
-              productType2: typeArr1[1]
+              productTypeSn1: typeArr1[0],
+              productTypeSn2: typeArr1[1]
             }
             newClassifyArr.push(objType2)
             const obj = JSON.parse(JSON.stringify(objType2))
@@ -206,9 +211,9 @@ export default {
         if (item.productTypeLevel == 3) {
           const typeArr2 = item.snPaths ? item.snPaths.split(',') : []
           const objType3 = {
-            productType1: typeArr2[0],
-            productType2: typeArr2[1],
-            productType3: typeArr2[2]
+            productTypeSn1: typeArr2[0],
+            productTypeSn2: typeArr2[1],
+            productTypeSn3: typeArr2[2]
           }
           newClassifyArr.push(objType3)
           const obj = JSON.parse(JSON.stringify(objType3))
@@ -227,7 +232,7 @@ export default {
     handleBrandOk (conList) {
       const newConList = conList.map(con => {
         return {
-          brandSn: con.brandSn
+          productBrandSn: con.brandSn
         }
       })
       this.dataSource[this.brandTagIndex].productBrandArr = conList
@@ -261,6 +266,22 @@ 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)
+      } else {
+        const k = this.dataSource[pos].productThisList.findIndex(con => con.productSn == row.productSn)
+        this.dataSource[pos].productThisList.splice(k, 1)
+      }
     }
   }
 }

+ 15 - 15
src/views/promotionRulesManagement/dealerPromotions/tableType3.vue

@@ -16,7 +16,7 @@
         <div style="max-height:64px;overflow-y:scroll;" v-if="!record.dataSourceOrigin">
           <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.bizUserScopeSn,con,'typeList')" v-for="con in record.productTypeArr" :key="con.id">
+              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,con,'typeList')" v-for="con in record.productTypeArr" :key="con.id">
                 {{ con.title }}
               </a-tag>
             </a-col>
@@ -41,7 +41,7 @@
         <div style="max-height:64px;overflow-y:scroll;" v-if="!record.dataSourceOrigin">
           <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.bizUserScopeSn,item,'brandList')" v-for="item in record.productBrandArr" :key="item.brandSn">
+              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')" v-for="item in record.productBrandArr" :key="item.productBrandSn">
                 {{ item.brandName }}
               </a-tag>
             </a-col>
@@ -70,7 +70,7 @@
       <template slot="provincePrice" slot-scope="text, record">
         <a-input-number
           size="small"
-          style="width:90%;"
+          style="width:80%;"
           v-model="record.provinceDiscountPrice"
           :min="0"
           :step="1"
@@ -86,7 +86,7 @@
         <div v-if="!record.dataSourceOrigin">
           <a-input-number
             size="small"
-            style="width:90%;"
+            style="width:80%;"
             v-model="record.provinceDiscountRate"
             :min="0"
             :step="1"
@@ -100,7 +100,7 @@
       <template slot="cityPrice" slot-scope="text, record">
         <a-input-number
           size="small"
-          style="width:90%;"
+          style="width:80%;"
           v-model="record.cityDiscountPrice"
           :min="0"
           :step="1"
@@ -116,7 +116,7 @@
         <div v-if="!record.dataSourceOrigin">
           <a-input-number
             size="small"
-            style="width:90%;"
+            style="width:80%;"
             v-model="record.cityDiscountRate"
             :min="0"
             :step="1"
@@ -129,7 +129,7 @@
       <template slot="specialPrice" slot-scope="text, record">
         <a-input-number
           size="small"
-          style="width:90%;"
+          style="width:80%;"
           v-model="record.specialDiscountPrice"
           :min="0"
           :step="1"
@@ -145,7 +145,7 @@
         <div v-if="!record.dataSourceOrigin">
           <a-input-number
             size="small"
-            style="width:90%;"
+            style="width:80%;"
             v-model="record.specialDiscountRate"
             :min="0"
             :step="1"
@@ -288,7 +288,7 @@ export default {
         if (item.productTypeLevel == 1) {
           if (!item.dataRef.children) {
             const objType1 = {
-              productType1: item.snPaths
+              productTypeSn1: item.snPaths
             }
             newClassifyArr.push(objType1)
             const obj = JSON.parse(JSON.stringify(objType1))
@@ -300,8 +300,8 @@ export default {
           if (!item.dataRef.children) {
             const typeArr1 = item.snPaths ? item.snPaths.split(',') : []
             const objType2 = {
-              productType1: typeArr1[0],
-              productType2: typeArr1[1]
+              productTypeSn1: typeArr1[0],
+              productTypeSn2: typeArr1[1]
             }
             newClassifyArr.push(objType2)
             const obj = JSON.parse(JSON.stringify(objType2))
@@ -312,9 +312,9 @@ export default {
         if (item.productTypeLevel == 3) {
           const typeArr2 = item.snPaths ? item.snPaths.split(',') : []
           const objType3 = {
-            productType1: typeArr2[0],
-            productType2: typeArr2[1],
-            productType3: typeArr2[2]
+            productTypeSn1: typeArr2[0],
+            productTypeSn2: typeArr2[1],
+            productTypeSn3: typeArr2[2]
           }
           newClassifyArr.push(objType3)
           const obj = JSON.parse(JSON.stringify(objType3))
@@ -333,7 +333,7 @@ export default {
     handleBrandOk (conList) {
       const newConList = conList.map(con => {
         return {
-          brandSn: con.brandSn
+          productBrandSn: con.brandSn
         }
       })
       this.dataSource[this.brandTagIndex].productBrandArr = conList