|
@@ -1,40 +1,5 @@
|
|
|
<template>
|
|
|
<div class="categoryList-wrap">
|
|
|
- <div ref="tableSearch" v-if="showTable" class="table-page-search-wrapper">
|
|
|
- <a-form-model
|
|
|
- ref="ruleForm"
|
|
|
- class="form-model-con"
|
|
|
- layout="inline"
|
|
|
- :model="queryParam"
|
|
|
- @keyup.enter.native="handleSearch">
|
|
|
- <a-row :gutter="15">
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
- <a-form-item label="品牌分类">
|
|
|
- <v-select
|
|
|
- code="BRAND_TYPE"
|
|
|
- v-model="queryParam.productBrandType"
|
|
|
- allowClear
|
|
|
- placeholder="请选择品牌分类"></v-select>
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
- <a-form-model-item label="品牌">
|
|
|
- <ProductBrand v-model="queryParam.productBrandSn"></ProductBrand>
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
- <a-form-model-item label="产品分类">
|
|
|
- <ProductType placeholder="请选择产品分类" @change="changeProductType" v-model="productType"></ProductType>
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
- <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
|
|
|
- <a-button type="primary" @click="handleSearch">查询</a-button>
|
|
|
- <a-button style="margin-left: 5px" @click="resetSearchForm">重置</a-button>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
- </a-form-model>
|
|
|
- </div>
|
|
|
-
|
|
|
<a-spin :spinning="spinning" tip="Loading...">
|
|
|
<ve-table
|
|
|
v-show="!showEmpty"
|
|
@@ -45,10 +10,9 @@
|
|
|
:cellSelectionOption="{enable: false}"
|
|
|
:virtual-scroll-option="{enable: true}"
|
|
|
:columns="columns"
|
|
|
- :table-data="dataSource"
|
|
|
+ :table-data="list"
|
|
|
row-key-field-name="id"
|
|
|
- :cell-style-option="cellStyleOption"
|
|
|
- :checkbox-option="checkboxOption"
|
|
|
+ :cell-span-option="cellSpanOption"
|
|
|
/>
|
|
|
<div v-show="showEmpty" class="empty-data"><a-empty description="暂无品类" :image="simpleImage"/></div>
|
|
|
</a-spin>
|
|
@@ -59,14 +23,12 @@
|
|
|
<script>
|
|
|
import { commonMixin } from '@/utils/mixin'
|
|
|
import { VSelect } from '@/components'
|
|
|
-import { dealerUpsPlQuery } from '@/api/dealer'
|
|
|
+import { dealerUpsList, dealerUpsDelete } from '@/api/dealer'
|
|
|
import { Empty } from 'ant-design-vue'
|
|
|
-import ProductBrand from '@/views/common/productBrand.js'
|
|
|
-import ProductType from '@/views/common/productType.js'
|
|
|
export default {
|
|
|
name: 'DetailProductList',
|
|
|
mixins: [commonMixin],
|
|
|
- components: { VSelect, ProductType, ProductBrand },
|
|
|
+ components: { VSelect },
|
|
|
props: {
|
|
|
newLoading: {
|
|
|
type: Boolean,
|
|
@@ -75,10 +37,6 @@ export default {
|
|
|
maxHeight: {
|
|
|
type: [String, Number],
|
|
|
default: '300'
|
|
|
- },
|
|
|
- showTable: {
|
|
|
- type: Boolean,
|
|
|
- default: false
|
|
|
}
|
|
|
},
|
|
|
data () {
|
|
@@ -87,150 +45,152 @@ export default {
|
|
|
spinning: false,
|
|
|
simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
|
dataSource: [],
|
|
|
+ list: [],
|
|
|
tableHeight: this.maxHeight,
|
|
|
- cellStyleOption: {
|
|
|
- bodyCellClass: ({ row, column, rowIndex }) => {
|
|
|
- if (row.id.indexOf('promo-') >= 0 && column.field === 'no') {
|
|
|
- return 'table-body-cell-no'
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
columnWidthResizeOption: {
|
|
|
// default false
|
|
|
enable: true,
|
|
|
// column resize min width
|
|
|
minWidth: 50
|
|
|
},
|
|
|
- showEmpty: true,
|
|
|
- disableSelectedRowKeys: [],
|
|
|
- selectedRowKeys: [],
|
|
|
- productType: [],
|
|
|
- queryParam: { // 查询条件
|
|
|
- productBrandType: undefined,
|
|
|
- productBrandSn: undefined,
|
|
|
- productTypeSn1: undefined,
|
|
|
- productTypeSn2: undefined,
|
|
|
- productTypeSn3: undefined
|
|
|
+ cellSpanOption: {
|
|
|
+ bodyCellSpan: this.bodyCellSpan
|
|
|
},
|
|
|
- dealerSn: undefined
|
|
|
+ showEmpty: true,
|
|
|
+ checkedDealerSn: []
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- checkboxOption () {
|
|
|
- return {
|
|
|
- disableSelectedRowKeys: this.disableSelectedRowKeys,
|
|
|
- selectedRowKeys: this.selectedRowKeys,
|
|
|
- // 行选择改变事件
|
|
|
- selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
|
|
|
- this.selectedRowChange({ row, isSelected, selectedRowKeys })
|
|
|
- },
|
|
|
- // 全选改变事件
|
|
|
- selectedAllChange: ({ isSelected, selectedRowKeys }) => {
|
|
|
- this.selectedAllChange({ isSelected, selectedRowKeys })
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
columns () {
|
|
|
+ const _this = this
|
|
|
+ // 差价归属
|
|
|
+ const jcgsFormat = function (record, data, h) {
|
|
|
+ const colors = { 'ASSIGN': '#00aaff', 'SUPERIORS': '#ff0000', 'HEAD': '#55aa7f' }
|
|
|
+ return (
|
|
|
+ data.sort((a, b) => b.rebateParentType.localeCompare(a.rebateParentType)).map(item => {
|
|
|
+ return (
|
|
|
+ <a-tag style="margin:5px;" color={colors[item.rebateParentType]}>{item.parentDealer.dealerName}{Number(item.allotRate * 100).toFixed(2) + '%'}</a-tag>
|
|
|
+ )
|
|
|
+ })
|
|
|
+ )
|
|
|
+ }
|
|
|
+ // 操作按钮
|
|
|
+ const actionFormat = function (record, data, h) {
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ class="button-info"
|
|
|
+ onClick={() => _this.handleEdit(record)}
|
|
|
+ >编辑</a-button>
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ class="button-error"
|
|
|
+ onClick={() => _this.handleDel(record)}
|
|
|
+ >删除</a-button>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
const arr = [
|
|
|
- // { title: '序号', field: 'no', key: 'a', width: 60, align: 'center', operationColumn: false },
|
|
|
- { title: '', field: '', key: 'acheck', width: 40, type: 'checkbox', align: 'center' },
|
|
|
+ { title: '序号', field: 'no', key: 'a', width: 60, align: 'center', operationColumn: false },
|
|
|
{ title: '品牌', field: 'productBrandName', key: 'b', width: 100, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
|
|
|
{ title: '一级分类', field: 'productTypeName1', key: 'e', width: 180, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
|
|
|
{ title: '二级分类', field: 'productTypeName2', width: 180, key: 'i', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
|
|
|
- { title: '三级分类', field: 'productTypeName3', width: 180, key: 'm', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } }
|
|
|
+ { title: '三级分类', field: 'productTypeName3', width: 180, key: 'm', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
|
|
|
+ { title: '上级经销商', field: 'superDealerName', width: 180, key: 'h', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
|
|
|
+ { title: '差价归属方', field: 'rebateDealerList', width: 180, key: 'k', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return jcgsFormat(row, row[column.field], h) } },
|
|
|
+ { title: '操作', field: 'action', width: 100, key: 's', align: 'center', fixed: 'right', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return actionFormat(row, row[column.field], h) } }
|
|
|
]
|
|
|
return arr
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- // 查询品类列表
|
|
|
- handleSearch () {
|
|
|
- if (this.detailData && this.detailData.upsPriceLevel && this.detailData.upsDealerSn) {
|
|
|
- this.searchTable()
|
|
|
- } else {
|
|
|
- this.$message.info('请选择上级经销商及其价格级别')
|
|
|
- }
|
|
|
- },
|
|
|
- // 产品分类 change
|
|
|
- changeProductType (val, opt) {
|
|
|
- this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
|
|
|
- this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
|
|
|
- this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
|
|
|
- },
|
|
|
- // 重置查询筛选表单
|
|
|
- resetSearchForm () {
|
|
|
- this.queryParam.productBrandType = undefined
|
|
|
- this.queryParam.productBrandSn = undefined
|
|
|
- this.queryParam.productTypeSn1 = undefined
|
|
|
- this.queryParam.productTypeSn2 = undefined
|
|
|
- this.queryParam.productTypeSn3 = undefined
|
|
|
- this.productType = []
|
|
|
- this.dataSource = []
|
|
|
- this.clearSelectTable()
|
|
|
- this.handleSearch()
|
|
|
- },
|
|
|
- // 清空选项
|
|
|
- clearSelectTable () {
|
|
|
- this.selectedRowKeys = []
|
|
|
- },
|
|
|
- // 选择单元格
|
|
|
- selectedRowChange ({ row, isSelected, selectedRowKeys }) {
|
|
|
- // console.log(row, isSelected, selectedRowKeys);
|
|
|
- this.selectedRowKeys = selectedRowKeys
|
|
|
- },
|
|
|
- // 全选行
|
|
|
- selectedAllChange ({ isSelected, selectedRowKeys }) {
|
|
|
- // console.log(isSelected, selectedRowKeys)
|
|
|
- this.selectedRowKeys = selectedRowKeys
|
|
|
- },
|
|
|
- // 获取已选数据
|
|
|
- getChooseData () {
|
|
|
- const result = []
|
|
|
- if (this.selectedRowKeys.length) {
|
|
|
- const rows = this.dataSource.filter(item => this.selectedRowKeys.includes(item.id))
|
|
|
- if (rows) {
|
|
|
- rows.map(item => {
|
|
|
- result.push({
|
|
|
- dealerSn: item.dealerSn,
|
|
|
- priceLevel: item.priceLevel,
|
|
|
- parentScopeSn: item.dealerScopeSn,
|
|
|
- productBrandSn: item.productBrandSn,
|
|
|
- productTypeSn1: item.productTypeSn1,
|
|
|
- productTypeSn2: item.productTypeSn2,
|
|
|
- productTypeSn3: item.productTypeSn3
|
|
|
- })
|
|
|
- })
|
|
|
+ bodyCellSpan ({ row, column, rowIndex }) {
|
|
|
+ if (column.field === 'superDealerName' || column.field === 'rebateDealerList' || column.field === 'action') {
|
|
|
+ if (row.rowspan) {
|
|
|
+ return {
|
|
|
+ rowspan: row.rowspan,
|
|
|
+ colspan: 1
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return {
|
|
|
+ rowspan: 0,
|
|
|
+ colspan: 0
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- console.log(result)
|
|
|
- return result
|
|
|
},
|
|
|
- async searchTable () {
|
|
|
- this.selectedRowKeys = []
|
|
|
- this.disableSelectedRowKeys = []
|
|
|
+ async searchTable (queryParam) {
|
|
|
this.dataSource = []
|
|
|
+ this.list = []
|
|
|
this.disabled = true
|
|
|
this.spinning = true
|
|
|
- const params = { ...this.detailData }
|
|
|
- params.dealerScope = { dealerSn: this.dealerSn, ...this.queryParam }
|
|
|
- console.log(params)
|
|
|
// 品类列表
|
|
|
- const listData = await dealerUpsPlQuery(params).then(res => res.data)
|
|
|
+ let listData = await dealerUpsList(queryParam).then(res => res.data)
|
|
|
+ this.$emit('loaded', listData)
|
|
|
this.dataSource = listData
|
|
|
+ if (!listData) {
|
|
|
+ listData = []
|
|
|
+ }
|
|
|
// 格式化数据
|
|
|
- this.dataSource.map((item, i) => {
|
|
|
- item.no = i + 1
|
|
|
+ let ret = []
|
|
|
+ let no = 0
|
|
|
+ listData.map((item, i) => {
|
|
|
+ const sub = item.rebateScopeList || [{ productBrandName: null, productTypeName1: null, productTypeName2: null, productTypeName3: null }]
|
|
|
+ const sup = item.rebateDealerList.find(b => b.rebateParentType == 'SUPERIORS')
|
|
|
+ this.checkedDealerSn.push(sup)
|
|
|
+ const rebateDealerList = item.rebateDealerList
|
|
|
+ sub.map((a, j) => {
|
|
|
+ if (j == 0) {
|
|
|
+ a.rowspan = sub.length
|
|
|
+ }
|
|
|
+ a.dealerUpsSn = item.dealerUpsSn
|
|
|
+ a.dealerSn = item.dealerSn
|
|
|
+ a.no = no + j + 1
|
|
|
+ a.sup = sup
|
|
|
+ a.superDealerName = sup.parentDealer.dealerName
|
|
|
+ a.rebateDealerList = rebateDealerList
|
|
|
+ })
|
|
|
+ no = no + sub.length
|
|
|
+ ret = ret.concat(sub)
|
|
|
})
|
|
|
- this.showEmpty = this.dataSource.length <= 0
|
|
|
+ console.log(ret)
|
|
|
+ this.list = ret
|
|
|
+ this.showEmpty = this.list.length <= 0
|
|
|
this.tableHeight = (this.showEmpty ? 0 : this.maxHeight) + 'px'
|
|
|
this.spinning = false
|
|
|
this.disabled = false
|
|
|
},
|
|
|
- pageInit (detailData, dealerSn) {
|
|
|
- this.detailData = detailData
|
|
|
- this.dealerSn = dealerSn
|
|
|
+ handleEdit (record) {
|
|
|
+ const row = this.dataSource.find(item => item.dealerUpsSn == record.dealerUpsSn && item.dealerSn == record.dealerSn)
|
|
|
+ this.$emit('edit', row)
|
|
|
+ },
|
|
|
+ handleDel (record) {
|
|
|
+ const _this = this
|
|
|
+ console.log(record)
|
|
|
+ this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '差价设置删除后,该商户关联的上级经销商和差价设置将同步解除,确定删除吗?',
|
|
|
+ centered: true,
|
|
|
+ closable: true,
|
|
|
+ onOk () {
|
|
|
+ _this.spinning = true
|
|
|
+ dealerUpsDelete({ dealerUpsSn: record.dealerUpsSn }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.$emit('del')
|
|
|
+ }
|
|
|
+ _this.spinning = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ pageInit (queryParam) {
|
|
|
// 获取列表
|
|
|
- this.resetSearchForm()
|
|
|
+ this.searchTable(queryParam)
|
|
|
}
|
|
|
}
|
|
|
}
|