|
@@ -94,7 +94,7 @@
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- 供应商添加品牌的对话框 -->
|
|
<!-- 供应商添加品牌的对话框 -->
|
|
- <el-dialog title="添加代理品牌" :visible.sync="showDialog" width="width" @closed="dialogClosed">
|
|
|
|
|
|
+ <el-dialog :title="dialogTitleText" :visible.sync="showDialog" width="width" @closed="dialogClosed">
|
|
<el-form ref="formData2Ref" :model="formData2" label-width="120px" :rules="formDataRules">
|
|
<el-form ref="formData2Ref" :model="formData2" label-width="120px" :rules="formDataRules">
|
|
|
|
|
|
<el-form-item label="选择品牌:" prop="brandId">
|
|
<el-form-item label="选择品牌:" prop="brandId">
|
|
@@ -103,6 +103,7 @@
|
|
placeholder="请选择品牌"
|
|
placeholder="请选择品牌"
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
filterable
|
|
filterable
|
|
|
|
+ :disabled="isBinded"
|
|
@change="handleBrandChange"
|
|
@change="handleBrandChange"
|
|
>
|
|
>
|
|
<el-option v-for="item in brandListCopy" :key="item.id" :label="item.name" :value="item.id" />
|
|
<el-option v-for="item in brandListCopy" :key="item.id" :label="item.name" :value="item.id" />
|
|
@@ -220,6 +221,7 @@ export default {
|
|
}
|
|
}
|
|
return {
|
|
return {
|
|
id: '',
|
|
id: '',
|
|
|
|
+ dialogTitle: '新增',
|
|
isCheckout: true,
|
|
isCheckout: true,
|
|
isLoading: false,
|
|
isLoading: false,
|
|
dialogLoading: false,
|
|
dialogLoading: false,
|
|
@@ -228,6 +230,8 @@ export default {
|
|
selectedShopType: 1,
|
|
selectedShopType: 1,
|
|
currentIndex: '',
|
|
currentIndex: '',
|
|
prevBrandId: '',
|
|
prevBrandId: '',
|
|
|
|
+ existProductBrandIds: '',
|
|
|
|
+ isBinded: false,
|
|
// 表单1
|
|
// 表单1
|
|
formData1: {
|
|
formData1: {
|
|
shopType: 1, // 供应商类型
|
|
shopType: 1, // 供应商类型
|
|
@@ -287,6 +291,9 @@ export default {
|
|
return this.brandList.filter(item => {
|
|
return this.brandList.filter(item => {
|
|
return !this.excludeBrandList.includes(item.id)
|
|
return !this.excludeBrandList.includes(item.id)
|
|
})
|
|
})
|
|
|
|
+ },
|
|
|
|
+ dialogTitleText() {
|
|
|
|
+ return `${this.dialogTitle}代理品牌`
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -318,6 +325,8 @@ export default {
|
|
this.selectedShopType = res.data.shopType
|
|
this.selectedShopType = res.data.shopType
|
|
this.getBrandList(this.selectedShopType)
|
|
this.getBrandList(this.selectedShopType)
|
|
this.setFormData(res.data)
|
|
this.setFormData(res.data)
|
|
|
|
+ this.existProductBrandIds = res.data.existProductBrandIds.split(',')
|
|
|
|
+ console.log(this.existProductBrandIds)
|
|
}).finally(() => {
|
|
}).finally(() => {
|
|
this.isLoading = false
|
|
this.isLoading = false
|
|
})
|
|
})
|
|
@@ -455,6 +464,7 @@ export default {
|
|
},
|
|
},
|
|
// 添加品牌对话框
|
|
// 添加品牌对话框
|
|
handleShowDialog() {
|
|
handleShowDialog() {
|
|
|
|
+ this.dialogTitle = '新增'
|
|
this.showDialog = true
|
|
this.showDialog = true
|
|
this.resetFormData2()
|
|
this.resetFormData2()
|
|
},
|
|
},
|
|
@@ -489,14 +499,24 @@ export default {
|
|
this.showDialog = false
|
|
this.showDialog = false
|
|
const h = this.$createElement
|
|
const h = this.$createElement
|
|
this.$notify.success({
|
|
this.$notify.success({
|
|
- title: '新增品牌',
|
|
|
|
- message: h('i', { style: 'color: #333' }, `新增品牌:"${shopInfo.brandName}"`),
|
|
|
|
|
|
+ title: `${this.dialogTitle}品牌`,
|
|
|
|
+ message: h('i', { style: 'color: #333' }, `${this.dialogTitle}品牌:"${shopInfo.brandName}"`),
|
|
duration: 2000
|
|
duration: 2000
|
|
})
|
|
})
|
|
})
|
|
})
|
|
},
|
|
},
|
|
// 移除品牌
|
|
// 移除品牌
|
|
handleRemove(index) {
|
|
handleRemove(index) {
|
|
|
|
+ // 如果该品牌已绑定商品,则不能删除
|
|
|
|
+ if (this.existProductBrandIds.includes(this.supplierBrands[index].brandId.toString())) {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: `该品牌已绑定供应商商品,无法进行删除`,
|
|
|
|
+ type: 'warning',
|
|
|
|
+ duration: 1000
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
const pop = this.supplierBrands.splice(index, 1)[0]
|
|
const pop = this.supplierBrands.splice(index, 1)[0]
|
|
this.removeExcludeBrand(pop.brandId)
|
|
this.removeExcludeBrand(pop.brandId)
|
|
const h = this.$createElement
|
|
const h = this.$createElement
|
|
@@ -508,8 +528,13 @@ export default {
|
|
},
|
|
},
|
|
// 修改品牌
|
|
// 修改品牌
|
|
handleShowInfo(index) {
|
|
handleShowInfo(index) {
|
|
|
|
+ // 如果该品牌已绑定商品,则不能修改品牌
|
|
|
|
+ if (this.existProductBrandIds.includes(this.supplierBrands[index].brandId.toString())) {
|
|
|
|
+ this.isBinded = true
|
|
|
|
+ }
|
|
|
|
+ this.dialogTitle = '修改'
|
|
this.currentIndex = index
|
|
this.currentIndex = index
|
|
- this.formData2 = this.supplierBrands[index]
|
|
|
|
|
|
+ this.formData2 = this.clone(this.supplierBrands[index])
|
|
this.prevBrandId = this.supplierBrands[index].brandId // 保存当前的品牌id
|
|
this.prevBrandId = this.supplierBrands[index].brandId // 保存当前的品牌id
|
|
this.fileList2 = [{ name: '', url: this.formData2.brandAuthLogo }]
|
|
this.fileList2 = [{ name: '', url: this.formData2.brandAuthLogo }]
|
|
this.fileList3 = [{ name: '', url: this.formData2.statementImage }]
|
|
this.fileList3 = [{ name: '', url: this.formData2.statementImage }]
|
|
@@ -523,6 +548,8 @@ export default {
|
|
this.addExcludeBrand(this.prevBrandId)
|
|
this.addExcludeBrand(this.prevBrandId)
|
|
this.prevBrandId = ''
|
|
this.prevBrandId = ''
|
|
}
|
|
}
|
|
|
|
+ this.isBinded = false
|
|
|
|
+ this.dialogTitle = '新增'
|
|
this.resetFormData2()
|
|
this.resetFormData2()
|
|
},
|
|
},
|
|
// 声明类型切换
|
|
// 声明类型切换
|