|
@@ -64,15 +64,15 @@
|
|
|
</div>
|
|
|
<!-- 操作按钮 -->
|
|
|
<div class="table-operator">
|
|
|
- <a-button id="permissionSetting-brand" type="primary" class="button-error" @click="choosePModal('brand')">选择产品品牌</a-button>
|
|
|
- <a-button id="permissionSetting-type" type="primary" class="button-info" @click="choosePModal('type')">选择产品分类</a-button>
|
|
|
- <a-button id="permissionSetting-product" type="primary" class="button-success" @click="choosePModal('product')">选择产品</a-button>
|
|
|
+ <a-button id="permissionSetting-brand" type="primary" class="button-error" @click="choosePModal('BRAND')">选择产品品牌</a-button>
|
|
|
+ <a-button id="permissionSetting-type" type="primary" class="button-info" @click="choosePModal('CATEGORY')">选择产品分类</a-button>
|
|
|
+ <a-button id="permissionSetting-product" type="primary" class="button-success" @click="choosePModal('PRODUCT')">选择产品</a-button>
|
|
|
</div>
|
|
|
<!-- 列表 -->
|
|
|
<a-table
|
|
|
class="sTable"
|
|
|
ref="table"
|
|
|
- size="default"
|
|
|
+ size="small"
|
|
|
:rowKey="(record) => record.id"
|
|
|
:columns="columns"
|
|
|
:data-source="loadData"
|
|
@@ -91,7 +91,7 @@
|
|
|
<!-- 选择产品分类 -->
|
|
|
<chooseTypeModal :openModal="openTypeModal" :chooseData="chooseType" @close="openTypeModal=false" @ok="handleTypeOk" />
|
|
|
<!-- 选择产品 -->
|
|
|
- <chooseProductsModal :openModal="openProductsModal" :chooseData="chooseProducts" @close="openProductsModal=false" @ok="handleProductsOk" />
|
|
|
+ <chooseProductsModal type="dealership" :openModal="openProductsModal" :chooseData="chooseProducts" @close="openProductsModal=false" @ok="handleProductsOk" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -102,7 +102,7 @@ import ChooseBrandModal from '@/views/common/chooseBrandModal.vue'
|
|
|
import ChooseTypeModal from '@/views/common/chooseTypeModal.vue'
|
|
|
import { productBrandQuery } from '@/api/productBrand'
|
|
|
import { productTypeQuery } from '@/api/productType'
|
|
|
-import { dealerScopeList, dealerScopeSave, dealerScopeDel } from '@/api/dealerScope'
|
|
|
+import { dealerScopeList, dealerScopeSave, dealerScopeDel, dealerScopeQueryList } from '@/api/dealerScope'
|
|
|
export default {
|
|
|
components: { STable, VSelect, ChooseProductsModal, ChooseBrandModal, ChooseTypeModal },
|
|
|
data () {
|
|
@@ -123,28 +123,12 @@ export default {
|
|
|
columns: [
|
|
|
{ title: '序号', dataIndex: 'no', width: 80, align: 'center' },
|
|
|
{ title: '添加时间', dataIndex: 'createDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '类型', dataIndex: 'productBrandName', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '类型名称', dataIndex: 'origCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品名称', dataIndex: 'name', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品编码', dataIndex: 'code', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '类型', dataIndex: 'type', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '类型名称', dataIndex: 'goodsName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '产品名称', dataIndex: 'product.name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '产品编码', dataIndex: 'product.code', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
|
|
|
],
|
|
|
- // 加载数据方法 必须为 Promise 对象
|
|
|
- // loadData: parameter => {
|
|
|
- // this.disabled = true
|
|
|
- // if (this.tableHeight == 0) {
|
|
|
- // this.tableHeight = window.innerHeight - 380
|
|
|
- // }
|
|
|
- // return dealerScopeList(Object.assign(parameter, this.queryParam, { dealerSn: this.$route.params.sn })).then(res => {
|
|
|
- // const data = res.data
|
|
|
- // const no = (data.pageNo - 1) * data.pageSize
|
|
|
- // for (var i = 0; i < data.list.length; i++) {
|
|
|
- // data.list[i].no = no + i + 1
|
|
|
- // }
|
|
|
- // this.disabled = false
|
|
|
- // return data
|
|
|
- // })
|
|
|
- // },
|
|
|
loadData: [],
|
|
|
pageNo: 1, // 分页页码
|
|
|
pageSize: 10, // 分页 每页多少条
|
|
@@ -187,6 +171,8 @@ export default {
|
|
|
const no = (data.pageNo - 1) * data.pageSize
|
|
|
for (var i = 0; i < data.list.length; i++) {
|
|
|
data.list[i].no = no + i + 1
|
|
|
+ const goodsType = data.list[i].goodsType
|
|
|
+ data.list[i].type = goodsType == 'PRODUCT' ? '产品' : goodsType == 'BRAND' ? '品牌' : goodsType == 'CATEGORY' ? '分类' : '--'
|
|
|
}
|
|
|
this.loadData = data.list
|
|
|
this.disabled = false
|
|
@@ -213,90 +199,93 @@ export default {
|
|
|
const productList = []
|
|
|
const brandList = []
|
|
|
const typeList = []
|
|
|
- // this.loadData.map(item => {
|
|
|
- // if (item.goodsType == 'PRODUCT') {
|
|
|
- // productList.push(item)
|
|
|
- // } else if (item.goodsType == 'BRAND') {
|
|
|
- // brandList.push(item)
|
|
|
- // } else if ((item.goodsType == 'TYPE_1') || (item.goodsType == 'TYPE_2') || (item.goodsType == 'TYPE_3')) {
|
|
|
- // typeList.push(item)
|
|
|
- // }
|
|
|
- // })
|
|
|
- if (type == 'product') { // 选择产品
|
|
|
- this.chooseProducts = productList
|
|
|
- this.openProductsModal = true
|
|
|
- } else if (type == 'brand') { // 选择品牌
|
|
|
- this.chooseBrand = brandList
|
|
|
- this.openBrandModal = true
|
|
|
- } else if (type == 'type') { // 选择分类
|
|
|
- this.chooseType = typeList
|
|
|
- this.openTypeModal = true
|
|
|
- }
|
|
|
+ dealerScopeQueryList({ dealerSn: this.$route.params.sn, goodsType: type }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ const data = res.data
|
|
|
+ data.map(item => {
|
|
|
+ if (item.goodsType == 'PRODUCT') {
|
|
|
+ productList.push(item)
|
|
|
+ } else if (item.goodsType == 'BRAND') {
|
|
|
+ brandList.push(item)
|
|
|
+ } else if (item.goodsType == 'CATEGORY') {
|
|
|
+ typeList.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log('chanp', productList)
|
|
|
+ console.log('pinpai', brandList)
|
|
|
+ console.log('fenlei', typeList)
|
|
|
+ if (type == 'PRODUCT') { // 选择产品
|
|
|
+ this.chooseProducts = productList
|
|
|
+ this.openProductsModal = true
|
|
|
+ } else if (type == 'BRAND') { // 选择品牌
|
|
|
+ this.chooseBrand = brandList
|
|
|
+ this.openBrandModal = true
|
|
|
+ } else if (type == 'CATEGORY') { // 选择分类
|
|
|
+ this.chooseType = typeList
|
|
|
+ this.openTypeModal = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
// 品牌
|
|
|
handleBrandOk (obj) {
|
|
|
console.log(obj, '---------------品牌')
|
|
|
this.chooseBrand = obj
|
|
|
- this.changeData('brand')
|
|
|
+ this.changeData('BRAND')
|
|
|
},
|
|
|
// 产品
|
|
|
handleProductsOk (obj) {
|
|
|
console.log(obj, '---------------产品')
|
|
|
this.chooseProducts = obj
|
|
|
- this.changeData('product')
|
|
|
+ this.changeData('PRODUCT')
|
|
|
},
|
|
|
// 分类
|
|
|
handleTypeOk (obj) {
|
|
|
console.log(obj, '---------------分类')
|
|
|
this.chooseType = obj
|
|
|
- this.changeData('type')
|
|
|
+ this.changeData('CATEGORY')
|
|
|
},
|
|
|
changeData (type) {
|
|
|
const _this = this
|
|
|
- if (type == 'product') { // 选择产品
|
|
|
+ if (type == 'PRODUCT') { // 选择产品
|
|
|
if (_this.chooseProducts.length > 0) {
|
|
|
+ const snList = []
|
|
|
_this.chooseProducts.map(item => {
|
|
|
- item.goodsType = 'PRODUCT'
|
|
|
- item.goodsTypeName = '产品'
|
|
|
- item.goodsName = item.name
|
|
|
- item.goodsSn = item.productSn
|
|
|
- item.goodsCode = item.code
|
|
|
- delete item.id
|
|
|
+ const productSn = item.productSn ? item.productSn : item.product.productSn ? item.product.productSn : ''
|
|
|
+ snList.push(productSn)
|
|
|
})
|
|
|
- this.setData(_this.chooseProducts)
|
|
|
+ this.setData(snList, type)
|
|
|
}
|
|
|
- } else if (type == 'brand') { // 选择品牌
|
|
|
+ } else if (type == 'BRAND') { // 选择品牌
|
|
|
if (_this.chooseBrand.length > 0) {
|
|
|
+ const snList = []
|
|
|
_this.chooseBrand.map(item => {
|
|
|
- item.goodsType = 'BRAND'
|
|
|
- item.goodsTypeName = '品牌'
|
|
|
- item.goodsName = item.brandName
|
|
|
- item.goodsSn = item.brandSn
|
|
|
- delete item.id
|
|
|
+ snList.push(item.brandSn)
|
|
|
})
|
|
|
- this.setData(_this.chooseBrand)
|
|
|
+ this.setData(snList, type)
|
|
|
}
|
|
|
- } else if (type == 'type') { // 选择分类
|
|
|
+ } else if (type == 'CATEGORY') { // 选择分类
|
|
|
if (_this.chooseType.length > 0) {
|
|
|
+ const snList = []
|
|
|
_this.chooseType.map(item => {
|
|
|
- item.goodsType = 'TYPE_' + item.productTypeLevel
|
|
|
- item.goodsTypeName = (item.productTypeLevel == 1 ? '一级' : item.productTypeLevel == 2 ? '二级' : item.productTypeLevel == 3 ? '三级' : '') + '分类'
|
|
|
- item.goodsName = item.productTypeName
|
|
|
- item.goodsSn = item.productTypeSn
|
|
|
- delete item.id
|
|
|
+ snList.push(item.productTypeSn)
|
|
|
})
|
|
|
- this.setData(_this.chooseType)
|
|
|
+ this.setData(snList, type)
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
// 添加经销权
|
|
|
- setData (data) {
|
|
|
+ setData (snList, type) {
|
|
|
const _this = this
|
|
|
const params = {
|
|
|
- dealerSn: _this.$route.params.sn
|
|
|
+ dealerSn: _this.$route.params.sn,
|
|
|
+ goodsType: type,
|
|
|
+ goodsSnList: snList
|
|
|
}
|
|
|
+ console.log('传参-------------', snList)
|
|
|
dealerScopeSave(params).then(res => {
|
|
|
- if (res.data == 200) {
|
|
|
+ if (res.status == 200) {
|
|
|
+ console.log('----------chenggong')
|
|
|
_this.$message.success(res.message)
|
|
|
_this.getProductList(1)
|
|
|
}
|