Browse Source

修改bug

chenrui 1 năm trước cách đây
mục cha
commit
3adb616a26

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

@@ -445,8 +445,8 @@ export default {
             }
           } else {
             newInfo = '按比例;'
-            _this.fullGiftRuleList.forEach(item => {
-              newInfo += `<div>购买满${item.regularValue}${form.regularUnit == 'YUAN' ? '元' : '个'}正价产品,送正价产品总金额的${item.promotionValue}%为促销品采购额</div>`
+            _this.fullGiftRuleList.forEach((item, i) => {
+              newInfo += `<div>${i * 1 + 1}、购买满${item.regularValue}${form.regularUnit == 'YUAN' ? '元' : '个'}正价产品,送正价产品总金额的${item.promotionValue}%为促销品采购额</div>`
             })
           }
           form.ruleInfo = newInfo
@@ -680,5 +680,4 @@ export default {
       justify-content:space-between;
     }
   }
-
 </style>

+ 2 - 2
src/views/promotionRulesManagement/dealerPromotions/sendProductsModal.vue

@@ -478,8 +478,8 @@ export default {
             }
           }
           var newInfo = `<div>${form.accrualFlag == '1' ? '数量叠加;' : ''}${form.convertExpenseFlag == '1' ? '可转费用报销单;' : ''}</div>`
-          _this.fullGiftRuleList.forEach(item => {
-            newInfo += `<div>${form.regularSameFlag == '1' ? '同款' : '不同款'}产品购买满${item.regularValue}${form.regularUnit == 'YUAN' ? '元' : '个'}正价产品,送${item.promotionValue}个促销产品</div>`
+          _this.fullGiftRuleList.forEach((item,i) => {
+            newInfo += `<div>${i*1+1}、${form.regularSameFlag == '1' ? '同款' : '不同款'}产品购买满${item.regularValue}${form.regularUnit == 'YUAN' ? '元' : '个'}正价产品,送${item.promotionValue}个促销产品</div>`
           })
           newInfo += form.restrictFlag == '1' ? `<div>限制正价产品${form.restrictCategory}款</div>` : ''
           form.ruleInfo = newInfo

+ 9 - 6
src/views/promotionRulesManagement/dealerPromotions/specialOfferModal.vue

@@ -167,7 +167,7 @@
         </a-form-model-item>
       </a-form-model>
       <a-card size="small" :bordered="false" class="pages-wrap">
-        <div class="flex">
+        <div class="flex" style="margin-bottom:10px;">
           <a-radio-group v-model="chooseVal" button-style="solid">
             <a-radio-button value="a" v-show="form.gateFlag==='1'">
               门槛产品
@@ -735,9 +735,9 @@ export default {
     handleProductsOk (con) {
       const _this = this
       _this.spinning = true
-      setTimeout(()=>{
-         _this.spinning = false
-      },1500)
+      setTimeout(() => {
+        _this.spinning = false
+      }, 1500)
       con.forEach(async (item) => {
         const chooseProductsList = []
         const getSn = this.generateUniqueRandomNumber()
@@ -849,7 +849,7 @@ export default {
     }
     .btn-cont {
       text-align: center;
-      margin: 35px 0 10px;
+      margin: 20px 0 10px;
     }
     .flex{
       display:flex;
@@ -857,5 +857,8 @@ export default {
       justify-content:space-between;
     }
   }
- 
+ /deep/.ve-table{
+    border-radius:5px;
+  }
+
 </style>

+ 373 - 283
src/views/promotionRulesManagement/dealerPromotions/tableType3.vue

@@ -1,254 +1,20 @@
 <template>
   <div class="pages-wrap">
-    <!-- 列表 -->
-    <a-table
-      class="sTable"
-      style="margin-top:10px;width:100%;"
-      ref="table"
-      size="small"
-      :pagination="false"
-      :rowKey="(record) => record.productScopeSn"
+    <!-- 列表  触底加载 -->
+    <ve-table
+      border-y
+      :scroll-width="0"
+      :max-height="tableHeight"
+      :fixed-header="true"
+      :row-style-option="{clickHighlight: true}"
+      :cellSelectionOption="{enable: false}"
+      :virtual-scroll-option="{enable: true}"
       :columns="columns"
-      :data-source="dataSource"
-      bordered>
-      <!-- 产品分类 -->
-      <template slot="productType" slot-scope="text, record,index">
-        <div style="max-height:126px;width:100%;overflow-y:scroll;" v-if="record.dataSourceOrigin=='0'">
-          <a-row v-if="record.productTypeArr && record.productTypeArr.length>0">
-            <a-col :span="17">
-              <div v-for="con in record.productTypeArr" :key="con.id">
-                <a-tooltip v-if="con.title&&con.title.length > 7" :title="con.title">
-                  <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,con,'typeList')">
-                    {{ `${con.title.slice(0, 7)}...` }}
-                  </a-tag>
-                </a-tooltip>
-                <a-tag v-else style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,con,'typeList')">
-                  {{ con.title }}
-                </a-tag>
-              </div>
-            </a-col>
-            <a-col :span="6" style="text-align:right;">
-              <a-tag style="background: #fff; borderStyle: dashed;" @click="addClassifyTag(index, record)" color="blue">
-                <a-icon type="plus" />
-              </a-tag>
-            </a-col>
-          </a-row>
-          <a-row v-else>
-            <a-col :span="24">
-              <a-tag style="background: #fff; borderStyle: dashed;" @click="addClassifyTag(index, record)" color="blue">
-                <a-icon type="plus" />
-              </a-tag>
-            </a-col>
-          </a-row>
-        </div>
-        <span v-else v-for="con in record.productTypeArr" :key="con.id">{{ con.title }}</span>
-      </template>
-      <!-- 品牌 -->
-      <template slot="productBrand" slot-scope="text, record,index">
-        <div style="max-height:126px;overflow-y:scroll;" v-if="record.dataSourceOrigin=='0'">
-          <a-row v-if="record.productBrandArr && record.productBrandArr.length>0">
-            <a-col :span="17">
-              <div v-for="item in record.productBrandArr" :key="item.brandSn">
-                <a-tooltip v-if="item.brandName&&item.brandName.length > 7" :title="item.brandName">
-                  <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')">
-                    {{ `${item.brandName.slice(0, 7)}...` }}
-                  </a-tag>
-                </a-tooltip>
-                <a-tag v-else style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')">
-                  {{ item.brandName }}
-                </a-tag>
-              </div>
-            </a-col>
-
-            <a-col :span="6" style="text-align:right;">
-              <a-tag style="background: #fff; borderStyle: dashed;" @click="addBrandTag(index, record)" color="blue">
-                <a-icon type="plus" />
-              </a-tag>
-            </a-col>
-          </a-row>
-          <a-row v-else>
-            <a-col :span="24">
-              <a-tag style="background: #fff; borderStyle: dashed;" @click="addBrandTag(index, record)" color="blue">
-                <a-icon type="plus" />
-              </a-tag>
-            </a-col>
-          </a-row>
-        </div>
-        <span v-else v-for="item in record.productBrandArr" :key="item.brandSn">{{ item.brandName }}</span>
-      </template>
-      <!-- 产品 -->
-      <template slot="product" slot-scope="text, record">
-        <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">
-        <div v-if="rulesType==='0'">
-          <div v-if="record.dataSourceOrigin=='1'">
-            <a-input-number
-              size="small"
-              style="width:90%;"
-              v-model="record.provinceDiscountPrice"
-              :min="0"
-              :step="1"
-              :precision="2"
-              placeholder="请输入"
-              :max="999999"
-              @blur="e=>calculatePrice(e.target.value,record.productScopeSn,'province')"/>
-          </div>
-          <span v-else>--</span>
-        </div>
-        <div v-else >
-          <div v-if="record.provincePrice" style="width:90%;background:#ccc;border-radius: 3px;text-align:center;">
-            <span v-if="rulesType=='1'">{{ (setData[0].provinceValue||setData[0].provinceValue==0)?(record.provincePrice*setData[0].provinceValue/100).toFixed(2):'--' }}</span>
-            <span v-else>{{ (setData[0].provinceValue||setData[0].provinceValue==0)?(record.provincePrice - setData[0].provinceValue).toFixed(2):'--' }}</span>
-          </div>
-          <span v-else>--</span>
-        </div>
-      </template>
-      <!-- 省价折扣 -->
-      <template slot="provinceDiscount" slot-scope="text, record">
-        <div v-if="rulesType=='0'">
-          <div v-if="record.dataSourceOrigin=='0'">
-            <a-input-number
-              size="small"
-              style="width:80%;"
-              v-model="record.provinceDiscountRate"
-              :min="0"
-              :step="1"
-              :precision="2"
-              placeholder="请输入"
-              :max="999999"/>%
-          </div>
-          <span v-else>{{ (record.provinceDiscountRate||record.provinceDiscountRate==0)?record.provinceDiscountRate+'%':'--' }}</span>
-        </div>
-        <div v-else>
-          <span v-if="rulesType=='1'">{{ (setData[0].provinceValue||setData[0].provinceValue==0)?setData[0].provinceValue+'%':'--' }}</span>
-          <span v-else>{{ setData[0].provinceValue?'-'+(setData[0].provinceValue).toFixed(2):setData[0].provinceValue==0?'0.00':'--' }}</span>
-        </div>
-      </template>
-      <!-- 市价特价 -->
-      <template slot="cityPrice" slot-scope="text, record">
-        <div v-if="rulesType==='0'">
-          <div v-if="record.dataSourceOrigin=='1'">
-            <a-input-number
-              size="small"
-              style="width:90%;"
-              v-model="record.cityDiscountPrice"
-              :min="record.provinceDiscountPrice || 0"
-              :step="1"
-              :precision="2"
-              placeholder="请输入"
-              :max="999999"
-              :disabled="rulesType!='0'"
-              @blur="e=>calculatePrice(e.target.value,record.productScopeSn,'city')"/>
-          </div>
-          <span v-else>--</span>
-        </div>
-        <div v-else >
-          <div v-if="record.cityPrice" style="width:90%;background:#ccc;border-radius: 3px;text-align:center;">
-            <span v-if="rulesType=='1'">{{ (setData[0].cityValue||setData[0].cityValue==0)?(record.cityPrice*setData[0].cityValue/100).toFixed(2):'--' }}</span>
-            <span v-else>{{ (setData[0].cityValue||setData[0].cityValue==0)?(record.cityPrice - setData[0].cityValue).toFixed(2):'--' }}</span>
-          </div>
-          <span v-else>--</span>
-        </div>
-      </template>
-      <!-- 市价折扣 -->
-      <template slot="cityDiscount" slot-scope="text, record">
-        <div v-if="rulesType=='0'">
-          <div v-if="record.dataSourceOrigin=='0'">
-            <a-input-number
-              size="small"
-              style="width:80%;"
-              v-model="record.cityDiscountRate"
-              :min="record.provinceDiscountRate ||0"
-              :step="1"
-              :precision="2"
-              placeholder="请输入"
-              :max="999999"/>%
-          </div>
-          <span v-else>{{ (record.cityDiscountRate||record.cityDiscountRate==0)?record.cityDiscountRate+'%':'--' }}</span>
-        </div>
-        <div v-else>
-          <span v-if="rulesType=='1'">{{ (setData[0].cityValue||setData[0].cityValue==0)?setData[0].cityValue+'%':'--' }}</span>
-          <span v-else>{{ setData[0].cityValue?'-'+(setData[0].cityValue).toFixed(2):setData[0].cityValue==0?'0.00':'--' }}</span>
-        </div>
-      </template>
-      <!-- 特约特价 -->
-      <template slot="specialPrice" slot-scope="text, record">
-        <div v-if="rulesType==='0'">
-          <div v-if="record.dataSourceOrigin=='1'">
-            <a-input-number
-              size="small"
-              style="width:90%;"
-              v-model="record.specialDiscountPrice"
-              :min="record.cityDiscountPrice ||0"
-              :step="1"
-              :precision="2"
-              placeholder="请输入"
-              :max="999999"
-              :disabled="rulesType!='0'"
-              @blur="e=>calculatePrice(e.target.value,record.productScopeSn,'special')"/>
-          </div>
-          <span v-else>--</span>
-        </div>
-        <div v-else>
-          <div v-if="record.specialPrice" style="width:90%;background:#ccc;border-radius: 3px;text-align:center;">
-            <span v-if="rulesType=='1'">{{ (setData[0].specialValue||setData[0].specialValue==0)?(record.specialPrice*setData[0].specialValue/100).toFixed(2):'--' }}</span>
-            <span v-else>{{ (setData[0].specialValue||setData[0].specialValue==0)?(record.specialPrice - setData[0].specialValue).toFixed(2):'--' }}</span>
-          </div>
-          <span v-else>--</span>
-        </div>
-      </template>
-      <!-- 特约折扣 -->
-      <template slot="specialDiscount" slot-scope="text, record">
-        <div v-if="rulesType=='0'">
-          <div v-if="record.dataSourceOrigin=='0'">
-            <a-input-number
-              size="small"
-              style="width:80%;"
-              v-model="record.specialDiscountRate"
-              :min="record.cityDiscountRate ||0"
-              :step="1"
-              :precision="2"
-              placeholder="请输入"
-              :max="999999"/>%
-          </div>
-          <span v-else>{{ (record.specialDiscountRate||record.specialDiscountRate==0) ? record.specialDiscountRate+'%':'--' }}</span>
-        </div>
-        <div v-else>
-          <span v-if="rulesType=='1'">{{ (setData[0].specialValue||setData[0].specialValue==0)?setData[0].specialValue+'%':'--' }}</span>
-          <span v-else>{{ setData[0].specialValue?'-'+(setData[0].specialValue).toFixed(2):setData[0].specialValue==0?'0.00':'--' }}</span>
-        </div>
-      </template>
-      <!-- 设置起订量 -->
-      <template slot="setNum" slot-scope="text, record">
-        <a-select default-value="SL" v-model="record.unitType" size="small" style="width:100%;"  placeholder="请选择" allowClear>
-          <a-select-option :value="con.code" v-for="con in unitTypeList" :key="con.id">
-            {{con.dispName}}
-          </a-select-option>
-        </a-select>
-        <a-input-number
-          size="small"
-          style="margin-top:8px;width:100%;"
-          v-model="record.unitQty"
-          :min="0"
-          :step="1"
-          :precision="0"
-          :max="999999"
-          placeholder="请输入"/>
-      </template>
-      <span slot="action" slot-scope="text,record">
-        <a-button
-          size="small"
-          type="link"
-          class="button-error"
-          @click="handleDel(record)"
-        >
-          删除
-        </a-button>
-      </span>
-    </a-table>
+      :table-data="dataSource"
+      row-key-field-name="productScopeSn"
+      :column-width-resize-option="columnWidthResizeOption"
+    />
+    <div v-show="showEmpty" class="empty-data"><a-empty description="暂无产品" :image="simpleImage"/></div>
     <div class="btn-cont">
       <a-button id="tableType1-add" type="primary" class="button-gray" @click="handleAddRow">+新增一行</a-button>
     </div>
@@ -276,6 +42,7 @@ import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
 import ChooseBrandModal from '@/views/common/chooseBrandModal.vue'
 import ChooseTypeModal from '@/views/common/chooseTypeModal.vue'
+import { Empty } from 'ant-design-vue'
 export default {
   name: 'TableType3',
   mixins: [commonMixin],
@@ -293,7 +60,7 @@ export default {
       type: Array,
       default: () => []
     },
-    unitTypeList:{
+    unitTypeList: {
       type: Array,
       default: () => []
     }
@@ -309,40 +76,326 @@ export default {
       val: '',
       brandTagIndex: null, // 所选品牌位置
       classifyTagIndex: null, // 所选分类位置
-      dataSourceOrigin: 0 // 数据来源  1  选择产品  0 新增一行品类
+      dataSourceOrigin: 0, // 数据来源  1  选择产品  0 新增一行品类
+
+      columnWidthResizeOption: {
+        enable: true,
+        minWidth: 50
+      },
+      showEmpty: true,
+      simpleImage: Empty.PRESENTED_IMAGE_SIMPLE
+    }
+  },
+  watch: {
+    dataSource (newValue, oldValue) {
+      this.showEmpty = newValue.length == 0
     }
   },
   computed: {
+    // 计算表格高度
+    tableHeight () {
+      var boxHeight = 0
+      if (this.dataSource && this.dataSource.length) {
+        this.dataSource.forEach(item => {
+          boxHeight += 96
+        })
+      }
+      if (boxHeight * 1 > 380) {
+        boxHeight = 380
+      }
+      return (this.showEmpty ? '' : boxHeight + 'px')
+    },
     columns () {
       const _this = this
-      var arr = [
-        { title: '产品分类', width: '16%', scopedSlots: { customRender: 'productType' }, align: 'center' },
-        { title: '品牌', width: '16%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
-        { title: '产品', scopedSlots: { customRender: 'product' }, width: '10%', align: 'center' },
-        { title: '省级原价', dataIndex: 'provincePrice', width: '5%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '省级特价', scopedSlots: { customRender: 'provincePrice' }, width: '5%', align: 'center' },
-        // { title: '省级折扣', scopedSlots: { customRender: 'provinceDiscount' }, width: '5%', align: 'center' },
-        { title: '市级原价', dataIndex: 'cityPrice', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '市级特价', scopedSlots: { customRender: 'cityPrice' }, width: '5%', align: 'center' },
-        // { title: '市级折扣', scopedSlots: { customRender: 'cityDiscount' }, width: '5%', align: 'center' },
-        { title: '特约原价', dataIndex: 'specialPrice', width: '5%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '特约特价', scopedSlots: { customRender: 'specialPrice' }, width: '5%', align: 'center' },
-        // { title: '特约折扣', scopedSlots: { customRender: 'specialDiscount' }, width: '5%', align: 'center' },
-        { title: '设置起订量', width: '7%', scopedSlots: { customRender: 'setNum' }, align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
+      // 分类
+      const productType = (record, data, index) => {
+        if (record.dataSourceOrigin == '0') {
+          if (record.productTypeArr && record.productTypeArr.length > 0) {
+            return (
+              <a-row>
+                <a-col span={17}>
+                  {record.productTypeArr.map(con =>
+                    <div>
+                      {con.title && con.title.length > 7 ? <a-tooltip title={con.title}>
+                        <a-tag style="margin-bottom:10px;" closable onclick={() => _this.delLabel(record.productScopeSn, con, 'typeList')}>
+                          { con.title.slice(0, 7) + '...' }
+                        </a-tag>
+                      </a-tooltip> : <a-tag style="margin-bottom:10px;" closable onclick={() => _this.delLabel(record.productScopeSn, con, 'typeList')}>
+                        {con.title }
+                      </a-tag>}
+                    </div>
+                  )}
+                </a-col>
+                <a-col span={6} style="text-align:right;">
+                  <a-tag style="background: #fff; borderStyle: dashed;" onclick={() => _this.addClassifyTag(index, record)} color="blue">
+                    <a-icon type="plus" />
+                  </a-tag>
+                </a-col>
+              </a-row>
+            )
+          } else {
+            return (
+              <a-row>
+                <a-col span={24}>
+                  <a-tag style="background: #fff; borderStyle: dashed;" onClick={() => _this.addClassifyTag(index, record)} color="blue">
+                    <a-icon type="plus" />
+                  </a-tag>
+                </a-col>
+              </a-row>
+            )
+          }
+        } else {
+          if (record.productTypeArr && record.productTypeArr.length > 0) {
+            return <span>{record.productTypeArr.map(con => con.title)}</span>
+          } else {
+            return '--'
+          }
+        }
+      }
+      // 品牌
+      const productBrand = (record, data, index) => {
+        if (record.dataSourceOrigin == '0') {
+          if (record.productBrandArr && record.productBrandArr.length > 0) {
+            return (
+              <a-row>
+                <a-col span={17}>
+                  {record.productBrandArr.map(item => {
+                    return <div>{item.brandName && item.brandName.length > 7 ? <a-tooltip title={item.brandName}><a-tag style="margin-bottom:10px;" closable onclick={() => _this.delLabel(record.productScopeSn, item, 'brandList')}>{ item.brandName.slice(0, 7) + '...' }</a-tag></a-tooltip> : <a-tag v-else style="margin-bottom:10px;" closable onclick={() => _this.delLabel(record.productScopeSn, item, 'brandList')}>{item.brandName } </a-tag>}</div>
+                  })}
+                </a-col>
+                <a-col span={6} style="text-align:right;">
+                  <a-tag style="background: #fff; borderStyle: dashed;" onclick={() => _this.addBrandTag(index, record)} color="blue">
+                    <a-icon type="plus" />
+                  </a-tag>
+                </a-col>
+              </a-row>
+            )
+          } else {
+            return (
+              <a-row>
+                <a-col span={24}>
+                  <a-tag style="background: #fff; borderStyle: dashed;" onClick={() => _this.addBrandTag(index, record)} color="blue">
+                    <a-icon type="plus" />
+                  </a-tag>
+                </a-col>
+              </a-row>
+            )
+          }
+        } else {
+          if (record.productBrandArr && record.productBrandArr.length > 0) {
+            return <span>{record.productBrandArr.map(item => item.brandName)}</span>
+          } else {
+            return '--'
+          }
+        }
+      }
+      // 产品
+      const productList = (record, data) => {
+        if (record.productThisList && record.productThisList.length > 0) {
+          return <span>{record.productThisList.map(item => item.productCode)}</span>
+        } else {
+          return '--'
+        }
+      }
+      // 省价特价
+      const provincePrice = (record, data) => {
+        if (_this.rulesType === '0') {
+          if (record.dataSourceOrigin == '1') {
+            return (<a-input-number
+              size="small"
+              style="width:90%;"
+              value={record.provinceDiscountPrice}
+              min={0}
+              step={1}
+              precision={2}
+              placeholder="请输入"
+              max={999999}
+              onblur={e => _this.calculatePrice(e.target.value, record.productScopeSn, 'province')} />)
+          } else {
+            return '--'
+          }
+        } else {
+          if (record.provincePrice) {
+            if (_this.rulesType == '1') {
+              return <div style="width:90%;background:#ccc;border-radius: 3px;text-align:center;">{ (_this.setData[0].provinceValue || _this.setData[0].provinceValue == 0) ? (record.provincePrice * _this.setData[0].provinceValue / 100).toFixed(2) : '--' }</div>
+            } else {
+              return <span>{ (_this.setData[0].provinceValue || _this.setData[0].provinceValue == 0) ? (record.provincePrice - _this.setData[0].provinceValue).toFixed(2) : '--' }</span>
+            }
+          } else {
+            return '--'
+          }
+        }
+      }
+      // 省价折扣
+      const provinceDiscount = (record, data) => {
+        if (_this.rulesType == '0') {
+          if (record.dataSourceOrigin == '0') {
+            return <div><a-input-number size="small" onchange={e => _this.handleProvinceDiscount(e, record)} style="width:80%;" value={record.provinceDiscountRate} min={0} step={1} precision={2} placeholder="请输入" max={999999} /><span>%</span></div>
+          } else {
+            return <span>{(record.provinceDiscountRate || record.provinceDiscountRate == 0) ? record.provinceDiscountRate + '%' : '--' }</span>
+          }
+        } else {
+          if (_this.rulesType == '1') {
+            return <span>{ (_this.setData[0].provinceValue || _this.setData[0].provinceValue == 0) ? _this.setData[0].provinceValue + '%' : '--' }</span>
+          } else {
+            return <span>{ _this.setData[0].provinceValue ? '-' + (_this.setData[0].provinceValue).toFixed(2) : _this.setData[0].provinceValue == 0 ? '0.00' : '--' }</span>
+          }
+        }
+      }
+      // 市价特价
+      const cityPrice = (record, data) => {
+        if (_this.rulesType === '0') {
+          if (record.dataSourceOrigin == '1') {
+            return (<a-input-number
+              size="small"
+              style="width:90%;"
+              value={record.cityDiscountPrice}
+              min={record.provinceDiscountPrice || 0}
+              step={1}
+              precision={2}
+              placeholder="请输入"
+              max={999999}
+              disabled={_this.rulesType != '0'}
+              onblur={e => _this.calculatePrice(e.target.value, record.productScopeSn, 'city')} />)
+          } else {
+            return '--'
+          }
+        } else {
+          if (record.cityPrice) {
+            if (_this.rulesType == '1') {
+              return <div style="width:90%;background:#ccc;border-radius: 3px;text-align:center;">{ (_this.setData[0].cityValue || _this.setData[0].cityValue == 0) ? (record.cityPrice * _this.setData[0].cityValue / 100).toFixed(2) : '--' }</div>
+            } else {
+              return <span>{ (_this.setData[0].cityValue || _this.setData[0].cityValue == 0) ? (record.cityPrice - _this.setData[0].cityValue).toFixed(2) : '--' }</span>
+            }
+          } else {
+            return '--'
+          }
+        }
+      }
+
+      // 市级折扣
+      const cityDiscount = (record, data) => {
+        if (_this.rulesType == '0') {
+          if (record.dataSourceOrigin == '0') {
+            return <div><a-input-number onchange={e => _this.handleCityDiscount(e, record)} size="small" style="width:80%;" value={record.cityDiscountRate} min={record.provinceDiscountRate || 0} step={1} precision={2} placeholder="请输入" max={999999} /><span>%</span></div>
+          } else {
+            return <span>{ (record.cityDiscountRate || record.cityDiscountRate == 0) ? record.cityDiscountRate + '%' : '--' }</span>
+          }
+        } else {
+          if (_this.rulesType == '1') {
+            return <span>{ (_this.setData[0].cityValue || _this.setData[0].cityValue == 0) ? _this.setData[0].cityValue + '%' : '--' }</span>
+          } else {
+            return <span>{ _this.setData[0].cityValue ? '-' + (_this.setData[0].cityValue).toFixed(2) : _this.setData[0].cityValue == 0 ? '0.00' : '--' }</span>
+          }
+        }
+      }
+      // 特约特价
+      const specialPrice = (record, data) => {
+        if (_this.rulesType === '0') {
+          if (record.dataSourceOrigin == '1') {
+            return (<a-input-number
+              size="small"
+              style="width:90%;"
+              value={record.specialDiscountPrice}
+              min={record.cityDiscountPrice || 0}
+              step={1}
+              precision={2}
+              placeholder="请输入"
+              max={999999}
+              disabled={_this.rulesType != '0'}
+              onblur={e => _this.calculatePrice(e.target.value, record.productScopeSn, 'special')} />)
+          } else {
+            return '--'
+          }
+        } else {
+          if (record.specialPrice) {
+            if (_this.rulesType == '1') {
+              return <div style="width:90%;background:#ccc;border-radius: 3px;text-align:center;">{ (_this.setData[0].specialValue || _this.setData[0].specialValue == 0) ? (record.specialPrice * _this.setData[0].specialValue / 100).toFixed(2) : '--' }</div>
+            } else {
+              return <span>{ (_this.setData[0].specialValue || _this.setData[0].specialValue == 0) ? (record.specialPrice - _this.setData[0].specialValue).toFixed(2) : '--' }</span>
+            }
+          } else {
+            return '--'
+          }
+        }
+      }
+      // 特约折扣
+      const specialDiscount = (record, data) => {
+        if (_this.rulesType == '0') {
+          if (record.dataSourceOrigin == '0') {
+            return <div><a-input-number size="small" onchange={e => _this.handleSpecialDiscount(e, record)} style="width:80%;" value={record.specialDiscountRate} min={record.cityDiscountRate || 0} step={1} precision={2} placeholder="请输入" max={999999} /><span>%</span></div>
+          } else {
+            return <span>{ (record.specialDiscountRate || record.specialDiscountRate == 0) ? record.specialDiscountRate + '%' : '--' }</span>
+          }
+        } else {
+          if (_this.rulesType == '1') {
+            return <span>{ (_this.setData[0].specialValue || _this.setData[0].specialValue == 0) ? _this.setData[0].specialValue + '%' : '--' }</span>
+          } else {
+            return <span>{ _this.setData[0].specialValue ? '-' + (_this.setData[0].specialValue).toFixed(2) : _this.setData[0].specialValue == 0 ? '0.00' : '--' }</span>
+          }
+        }
+      }
+      // 设置起订量
+      const setNum = (record, data) => {
+        return (<div>
+          <a-select
+            default-value="SL"
+            value={record.unitType}
+            size="small"
+            style="width:100%;"
+            placeholder="请选择"
+            allowClear
+            onchange={e => _this.handleUnitType(e, record)}
+          >
+            {_this.unitTypeList.map(con => <a-select-option value={con.code}>{ con.dispName }</a-select-option>)}
+          </a-select><a-input-number
+            size="small"
+            style="margin-top:8px;width:100%;"
+            value={record.unitQty}
+            min={0}
+            step={1}
+            precision={0}
+            max={999999}
+            placeholder="请输入"
+            onchange={e => _this.handleUnitQty(e, record)}/></div>)
+      }
+      // 操作
+      const actionFormat = (record, data) => {
+        return <a-button
+          size="small"
+          type="link"
+          class="button-error"
+          onclick={() => _this.handleDel(record)}
+        >
+          删除
+        </a-button>
+      }
+
+      const arr = [
+        { title: '产品分类', width: '16%', field: 'productTypeArr', key: 'a', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return productType(row, row[column.field], rowIndex) } },
+        { title: '品牌', width: '16%', field: 'productBrandArr', key: 'b', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return productBrand(row, row[column.field], rowIndex) } },
+        { title: '产品', width: '10%', field: 'productThisList', key: 'c', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return productList(row, row[column.field]) } },
+        { title: '省级原价', width: '5%', field: 'provincePrice', key: 'd', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return _this.toThousands(row[column.field]) || '--' } },
+        { title: '省级特价', width: '5%', field: 'provinceDiscountPrice', key: 'e', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return provincePrice(row, row[column.field]) } },
+        { title: '市级原价', width: '5%', field: 'cityPrice', key: 'f', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return _this.toThousands(row[column.field]) || '--' } },
+        { title: '市级特价', width: '5%', field: 'cityDiscountPrice', key: 'g', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return cityPrice(row, row[column.field]) } },
+        { title: '特约原价', width: '5%', field: 'specialPrice', key: 'h', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return _this.toThousands(row[column.field]) || '--' } },
+        { title: '特约特价', width: '5%', field: 'specialDiscountPrice', key: 'i', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return specialPrice(row, row[column.field]) } },
+        { title: '设置起订量', width: '7%', field: 'unitType', key: 'J', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return setNum(row, row[column.field], rowIndex) } },
+        { title: '操作', field: 'action', width: '6%', key: 'K', align: 'center', fixed: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return actionFormat(row, row[column.field]) } }
       ]
       if (_this.rulesType === '0') {
-        arr.splice(5, 0, { title: '省级折扣', scopedSlots: { customRender: 'provinceDiscount' }, width: '5%', align: 'center' })
-        arr.splice(8, 0, { title: '市级折扣', scopedSlots: { customRender: 'cityDiscount' }, width: '5%', align: 'center' })
-        arr.splice(11, 0, { title: '特约折扣', scopedSlots: { customRender: 'specialDiscount' }, width: '5%', align: 'center' })
+        arr.splice(5, 0, { title: '省级折扣', width: '5%', field: 'provinceDiscountRate', key: 'x', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return provinceDiscount(row, row[column.field]) } })
+        arr.splice(8, 0, { title: '市级折扣', width: '5%', field: 'cityDiscountRate', key: 'y', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return cityDiscount(row, row[column.field]) } })
+        arr.splice(11, 0, { title: '特约折扣', width: '5%', field: 'specialDiscountRate', key: 'z', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return specialDiscount(row, row[column.field]) } })
       } else if (_this.rulesType === '1') {
-        arr.splice(5, 0, { title: '省级折扣', scopedSlots: { customRender: 'provinceDiscount' }, width: '5%', align: 'center' })
-        arr.splice(8, 0, { title: '市级折扣', scopedSlots: { customRender: 'cityDiscount' }, width: '5%', align: 'center' })
-        arr.splice(11, 0, { title: '特约折扣', scopedSlots: { customRender: 'specialDiscount' }, width: '5%', align: 'center' })
+        arr.splice(5, 0, { title: '省级折扣', width: '5%', field: 'provinceDiscountRate', key: 'x', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return provinceDiscount(row, row[column.field]) } })
+        arr.splice(8, 0, { title: '市级折扣', width: '5%', field: 'cityDiscountRate', key: 'y', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return cityDiscount(row, row[column.field]) } })
+        arr.splice(11, 0, { title: '特约折扣', width: '5%', field: 'specialDiscountRate', key: 'z', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return specialDiscount(row, row[column.field]) } })
       } else {
-        arr.splice(5, 0, { title: '省价直降金额', scopedSlots: { customRender: 'provinceDiscount' }, width: '5%', align: 'center' })
-        arr.splice(8, 0, { title: '市价直降金额', scopedSlots: { customRender: 'cityDiscount' }, width: '5%', align: 'center' })
-        arr.splice(11, 0, { title: '特约直降金额', scopedSlots: { customRender: 'specialDiscount' }, width: '5%', align: 'center' })
+        arr.splice(5, 0, { title: '省价直降金额', width: '5%', field: 'provinceValue', key: 'x', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return provinceDiscount(row, row[column.field]) } })
+        arr.splice(8, 0, { title: '市价直降金额', width: '5%', field: 'cityValue', key: 'y', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return cityDiscount(row, row[column.field]) } })
+        arr.splice(11, 0, { title: '特约直降金额', width: '5%', field: 'specialValue', key: 'z', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return specialDiscount(row, row[column.field]) } })
       }
       return arr
     }
@@ -363,18 +416,18 @@ export default {
       this.dataSource = this.dataSource.concat(list)
     },
     // 生成随机数
-     generateUniqueRandomNumber() {
-        const timestamp = new Date().getTime();
-        const randomNumber = Math.floor(Math.random() * 1e5).toString().padStart(5, '0');
-        const uniqueRandomNumber = timestamp + randomNumber;
-       return uniqueRandomNumber
-      },
+    generateUniqueRandomNumber () {
+      const timestamp = new Date().getTime()
+      const randomNumber = Math.floor(Math.random() * 1e5).toString().padStart(5, '0')
+      const uniqueRandomNumber = timestamp + randomNumber
+      return uniqueRandomNumber
+    },
     // 新增一行
     handleAddRow () {
       const _this = this
-      let newSn = _this.generateUniqueRandomNumber()
-      if(newSn){
-        let newData = {
+      const newSn = _this.generateUniqueRandomNumber()
+      if (newSn) {
+        const newData = {
           productScopeSn: newSn,
           dataSourceOrigin: '0',
           productTypeArr: [],
@@ -766,7 +819,33 @@ export default {
         }
       })
       return { list: c_brandArr, flag: flag, noTypeFlag: noTypeFlag }
+    },
+    // 省折扣取值
+    handleProvinceDiscount (e, row) {
+      row.provinceDiscountRate = e
+      this.dataSource.splice()
+    },
+    // 市折扣取值
+    handleCityDiscount (e, row) {
+      row.cityDiscountRate = e
+      this.dataSource.splice()
+    },
+    // 特约折扣取值
+    handleSpecialDiscount (e, row) {
+      row.specialDiscountRate = e
+      this.dataSource.splice()
+    },
+    // 起订类型取值
+    handleUnitType (e, row) {
+      row.unitType = e
+      this.dataSource.splice()
+    },
+    // 起订量取值
+    handleUnitQty (e, row) {
+      row.unitQty = e
+      this.dataSource.splice()
     }
+
   }
 }
 </script>
@@ -777,6 +856,17 @@ export default {
       text-align: center;
       margin: 10px 0;
     }
+    .empty-data {
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            height: 200px;
+            width: 100%;
+            color: #666;
+            font-size: 16px;
+            border: 1px solid #eee;
+            border-top: 0;
+        }
   }
 
 </style>