|
@@ -1,22 +1,254 @@
|
|
|
<template>
|
|
|
<div class="pages-wrap">
|
|
|
- <!-- 列表 触底加载 -->
|
|
|
- <ve-table
|
|
|
- :style="{width:'100%'}"
|
|
|
- border-y
|
|
|
- :scroll-width="0"
|
|
|
- :max-height="tableHeight"
|
|
|
- :fixed-header="true"
|
|
|
- :row-style-option="{clickHighlight: true}"
|
|
|
- :cellSelectionOption="{enable: false}"
|
|
|
- :virtual-scroll-option="{enable: true}"
|
|
|
+ <!-- 列表 -->
|
|
|
+ <a-table
|
|
|
+ class="sTable"
|
|
|
+ style="margin-top:10px;width:100%;"
|
|
|
+ ref="table"
|
|
|
+ size="small"
|
|
|
+ :pagination="false"
|
|
|
+ :rowKey="(record) => record.productScopeSn"
|
|
|
:columns="columns"
|
|
|
- :table-data="dataSource"
|
|
|
- row-key-field-name="productScopeSn"
|
|
|
- :column-width-resize-option="columnWidthResizeOption"
|
|
|
- s
|
|
|
- />
|
|
|
- <div v-show="showEmpty" class="empty-data"><a-empty description="暂无产品" :image="simpleImage"/></div>
|
|
|
+ :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>
|
|
|
<div class="btn-cont">
|
|
|
<a-button id="tableType1-add" type="primary" class="button-gray" @click="handleAddRow">+新增一行</a-button>
|
|
|
</div>
|
|
@@ -44,7 +276,6 @@ 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],
|
|
@@ -62,7 +293,7 @@ export default {
|
|
|
type: Array,
|
|
|
default: () => []
|
|
|
},
|
|
|
- unitTypeList: {
|
|
|
+ unitTypeList:{
|
|
|
type: Array,
|
|
|
default: () => []
|
|
|
}
|
|
@@ -78,326 +309,40 @@ export default {
|
|
|
val: '',
|
|
|
brandTagIndex: null, // 所选品牌位置
|
|
|
classifyTagIndex: null, // 所选分类位置
|
|
|
- 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
|
|
|
+ dataSourceOrigin: 0 // 数据来源 1 选择产品 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
|
|
|
- // 分类
|
|
|
- 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 onclose={() => _this.delLabel(record.productScopeSn, con, 'typeList')}>
|
|
|
- { con.title.slice(0, 7) + '...' }
|
|
|
- </a-tag>
|
|
|
- </a-tooltip> : <a-tag style="margin-bottom:10px;" closable onclose={() => _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 onclose={() => _this.delLabel(record.productScopeSn, item, 'brandList')}>{ item.brandName.slice(0, 7) + '...' }</a-tag></a-tooltip> : <a-tag style="margin-bottom:10px;" closable onclose={() => _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]) } }
|
|
|
+ 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' }
|
|
|
]
|
|
|
if (_this.rulesType === '0') {
|
|
|
- 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]) } })
|
|
|
+ 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' })
|
|
|
} else if (_this.rulesType === '1') {
|
|
|
- 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]) } })
|
|
|
+ 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' })
|
|
|
} else {
|
|
|
- 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]) } })
|
|
|
+ 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' })
|
|
|
}
|
|
|
return arr
|
|
|
}
|
|
@@ -418,18 +363,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
|
|
|
- const newSn = _this.generateUniqueRandomNumber()
|
|
|
- if (newSn) {
|
|
|
- const newData = {
|
|
|
+ let newSn = _this.generateUniqueRandomNumber()
|
|
|
+ if(newSn){
|
|
|
+ let newData = {
|
|
|
productScopeSn: newSn,
|
|
|
dataSourceOrigin: '0',
|
|
|
productTypeArr: [],
|
|
@@ -821,33 +766,7 @@ 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>
|
|
@@ -858,17 +777,6 @@ 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>
|