update:修改经营品类为联级菜单
This commit is contained in:
parent
179ed1f0bd
commit
389e2ca762
@ -155,3 +155,13 @@ export function updateUserInfo(data){
|
|||||||
data: data,
|
data: data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
//查询分类列表
|
||||||
|
export function getStoreCategories(){
|
||||||
|
return request({
|
||||||
|
url: URL.shop.merch.category,
|
||||||
|
method: 'get',
|
||||||
|
params:{
|
||||||
|
category_is_enable:1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -449,6 +449,7 @@ let url = {
|
|||||||
merchApproval: api_url + '/admin/shop/merch/approval',
|
merchApproval: api_url + '/admin/shop/merch/approval',
|
||||||
//更新商家信息
|
//更新商家信息
|
||||||
update:api_url + '/admin/shop/merch/update',
|
update:api_url + '/admin/shop/merch/update',
|
||||||
|
category:api_url + '/admin/shop/shop-base-store-category/categoryTree',
|
||||||
// 发起合同签署
|
// 发起合同签署
|
||||||
createByFile: api_url + '/admin/shop/esign/sign-flow/create-by-file',
|
createByFile: api_url + '/admin/shop/esign/sign-flow/create-by-file',
|
||||||
//查看商家签署合同
|
//查看商家签署合同
|
||||||
|
|||||||
@ -46,20 +46,16 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="__('经营分类')" prop="store_category_id">
|
<el-form-item :label="__('经营品类')">
|
||||||
<el-select
|
<el-cascader
|
||||||
v-model.trim="form.store_category_id"
|
v-model="cascaderValue"
|
||||||
clearable
|
:options="cascaderOptions"
|
||||||
:placeholder="__('经营分类')"
|
placeholder="请选择经营品类"
|
||||||
:style="{ width: '48%' }"
|
:show-all-levels="false"
|
||||||
>
|
@change="handleChangeBizCategory"
|
||||||
<el-option
|
clearable
|
||||||
v-for="item in classifyData"
|
:disabled="isReadonly"
|
||||||
:key="item.store_category_id"
|
|
||||||
:label="item.store_category_name"
|
|
||||||
:value="item.store_category_id"
|
|
||||||
/>
|
/>
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="__('分账比例')" prop="split_ratio">
|
<el-form-item :label="__('分账比例')" prop="split_ratio">
|
||||||
<el-input v-model.trim="form.split_ratio" :placeholder="__('比例在70%-99%之间')" clearable />
|
<el-input v-model.trim="form.split_ratio" :placeholder="__('比例在70%-99%之间')" clearable />
|
||||||
@ -143,7 +139,9 @@ import { translateTitle as __ } from '@/utils/i18n'
|
|||||||
import { doEdit, FindStoreLevel, storeSetUp } from '@/api/store/base'
|
import { doEdit, FindStoreLevel, storeSetUp } from '@/api/store/base'
|
||||||
import { GetStoreClassify } from '@/api/base/store/category'
|
import { GetStoreClassify } from '@/api/base/store/category'
|
||||||
import { getList as getSubsite } from '@/api/plantform/subsite'
|
import { getList as getSubsite } from '@/api/plantform/subsite'
|
||||||
|
import {
|
||||||
|
getStoreCategories
|
||||||
|
} from '@/api/shopAudit/shopAudit'
|
||||||
export default {
|
export default {
|
||||||
name: 'StoreBaseEdit',
|
name: 'StoreBaseEdit',
|
||||||
|
|
||||||
@ -152,6 +150,8 @@ export default {
|
|||||||
options: [],
|
options: [],
|
||||||
classifyData: [],
|
classifyData: [],
|
||||||
siteOptions: [],
|
siteOptions: [],
|
||||||
|
cascaderValue: [], // 级联选择器专用绑定值(数组类型)
|
||||||
|
cascaderOptions: [],
|
||||||
form: {
|
form: {
|
||||||
store_is_open: 0,
|
store_is_open: 0,
|
||||||
store_is_selfsupport: 1,
|
store_is_selfsupport: 1,
|
||||||
@ -278,9 +278,20 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
async fetchdataGetStoreClassify() {
|
async fetchdataGetStoreClassify() {
|
||||||
await GetStoreClassify().then((res) => {
|
try {
|
||||||
this.classifyData = res.data
|
const res = await getStoreCategories();
|
||||||
})
|
if (res.status === 200 && res.data) {
|
||||||
|
this.classifyData = res.data;
|
||||||
|
// 关键:将分类数据格式化为级联选择器需要的结构
|
||||||
|
this.cascaderOptions = this.transformStoreCategories(res.data);
|
||||||
|
console.log("级联分类数据源:", this.cascaderOptions);
|
||||||
|
} else {
|
||||||
|
this.$baseMessage("获取经营品类失败", "error");
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
this.$baseMessage("获取经营品类异常", "error");
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async getSubsiteList() {
|
async getSubsiteList() {
|
||||||
let param = {
|
let param = {
|
||||||
@ -295,13 +306,31 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
showEdit(row) {
|
showEdit(row) {
|
||||||
|
this.cascaderValue = [];
|
||||||
if (!row) {
|
if (!row) {
|
||||||
this.title = this.__('新增')
|
// 新增:清空表单,设置标题
|
||||||
|
this.title = this.__('新增');
|
||||||
|
this.form = {
|
||||||
|
store_is_open: 0,
|
||||||
|
store_is_selfsupport: 1,
|
||||||
|
store_type: 1,
|
||||||
|
store_o2o_flag: 0,
|
||||||
|
subsite_id: 0,
|
||||||
|
split_ratio: 0,
|
||||||
|
store_category_id: 0,
|
||||||
|
store_2nd_category_id:0,
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
this.title = this.__('编辑')
|
this.title = this.__('编辑');
|
||||||
this.form = Object.assign({}, row)
|
this.form = Object.assign({}, row);
|
||||||
|
if (row.store_category_id && row.store_2nd_category_id) {
|
||||||
|
this.cascaderValue = [
|
||||||
|
row.store_category_id, // 一级分类ID
|
||||||
|
row.store_2nd_category_id // 二级分类ID
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.dialogFormVisible = true
|
this.dialogFormVisible = true;
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
this.form = {
|
this.form = {
|
||||||
@ -313,6 +342,30 @@ export default {
|
|||||||
this.$refs['form'].resetFields()
|
this.$refs['form'].resetFields()
|
||||||
this.dialogFormVisible = false
|
this.dialogFormVisible = false
|
||||||
},
|
},
|
||||||
|
transformStoreCategories(data) {
|
||||||
|
return data.map(item => ({
|
||||||
|
value: item.store_category_id,
|
||||||
|
label: item.store_category_name,
|
||||||
|
children: item.children ? [
|
||||||
|
// 添加一个与一级目录同名的选项
|
||||||
|
{
|
||||||
|
value: item.store_category_id,
|
||||||
|
label: item.store_category_name
|
||||||
|
},
|
||||||
|
...item.children.map(child => ({
|
||||||
|
value: child.store_category_id,
|
||||||
|
label: child.store_category_name
|
||||||
|
}))
|
||||||
|
] : []
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
handleChangeBizCategory(value) {
|
||||||
|
if (value && value.length === 2) {
|
||||||
|
const [bizCategoryId, bizSecondCategoryId] = value;
|
||||||
|
this.form.store_category_id = bizCategoryId;
|
||||||
|
this.form.store_2nd_category_id = bizSecondCategoryId;
|
||||||
|
}
|
||||||
|
},
|
||||||
save() {
|
save() {
|
||||||
this.$refs['form'].validate(async (valid) => {
|
this.$refs['form'].validate(async (valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
|||||||
@ -43,26 +43,15 @@
|
|||||||
|
|
||||||
<div class="item-block" style="margin-left: 30px;">
|
<div class="item-block" style="margin-left: 30px;">
|
||||||
<div class="item-lable">经营品类</div>
|
<div class="item-lable">经营品类</div>
|
||||||
<!-- <el-input
|
<el-cascader
|
||||||
class="item-input"
|
v-model="cascaderValue"
|
||||||
v-model="form.biz_category"
|
:options="cascaderOptions"
|
||||||
clearable
|
placeholder="请选择经营品类"
|
||||||
:disabled="isReadonly"
|
:show-all-levels="false"
|
||||||
/> -->
|
@change="handleChangeBizCategory"
|
||||||
<el-select
|
clearable
|
||||||
v-model.trim="form.biz_category"
|
:disabled="isReadonly"
|
||||||
clearable
|
/>
|
||||||
:placeholder="__('经营分类')"
|
|
||||||
:style="{ width: '48%' }"
|
|
||||||
:disabled="isReadonly"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in classifyData"
|
|
||||||
:key="item.store_category_id"
|
|
||||||
:label="item.store_category_name"
|
|
||||||
:value="item.store_category_id"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-info">
|
<div class="item-info">
|
||||||
@ -1034,6 +1023,7 @@ import {
|
|||||||
createSubAccount,
|
createSubAccount,
|
||||||
checkShopName,
|
checkShopName,
|
||||||
updateUserInfo,
|
updateUserInfo,
|
||||||
|
getStoreCategories
|
||||||
} from '@/api/shopAudit/shopAudit'
|
} from '@/api/shopAudit/shopAudit'
|
||||||
import { GetStoreClassify } from '@/api/base/store/category'
|
import { GetStoreClassify } from '@/api/base/store/category'
|
||||||
import { batchNoApi, imgOcrResultApi } from "@/api/upload";
|
import { batchNoApi, imgOcrResultApi } from "@/api/upload";
|
||||||
@ -1081,6 +1071,8 @@ export default {
|
|||||||
formConfig: JSON.parse(JSON.stringify(config)),
|
formConfig: JSON.parse(JSON.stringify(config)),
|
||||||
cityData: JSON.parse(JSON.stringify(city.cityData)),
|
cityData: JSON.parse(JSON.stringify(city.cityData)),
|
||||||
classifyData: [],
|
classifyData: [],
|
||||||
|
cascaderValue: [], // 级联选择器专用绑定值(数组类型)
|
||||||
|
cascaderOptions: [],
|
||||||
form: {
|
form: {
|
||||||
id:'',
|
id:'',
|
||||||
login_mobile: '66',
|
login_mobile: '66',
|
||||||
@ -1338,9 +1330,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.uploadParams.authorization = getToken()
|
this.uploadParams.authorization = getToken();
|
||||||
this.fetchdataGetStoreClassify()
|
|
||||||
console.log(this.uploadParams)
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async getMerchDetail() {
|
async getMerchDetail() {
|
||||||
@ -1384,6 +1374,13 @@ export default {
|
|||||||
|
|
||||||
this.showLoading = false
|
this.showLoading = false
|
||||||
await this.getCategoryList();
|
await this.getCategoryList();
|
||||||
|
if (this.form.biz_category && this.form.biz_second_category) {
|
||||||
|
this.cascaderValue = [
|
||||||
|
this.form.biz_category, // 一级分类ID
|
||||||
|
this.form.biz_second_category // 二级分类ID
|
||||||
|
];
|
||||||
|
console.log("级联回显值:", this.cascaderValue);
|
||||||
|
}
|
||||||
const areaData = await getAreaJSON()
|
const areaData = await getAreaJSON()
|
||||||
|
|
||||||
if(this.form.store_district){
|
if(this.form.store_district){
|
||||||
@ -1490,6 +1487,30 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
transformStoreCategories(data) {
|
||||||
|
return data.map(item => ({
|
||||||
|
value: item.store_category_id,
|
||||||
|
label: item.store_category_name,
|
||||||
|
children: item.children ? [
|
||||||
|
// 添加一个与一级目录同名的选项
|
||||||
|
{
|
||||||
|
value: item.store_category_id,
|
||||||
|
label: `${item.store_category_name} 到账比例(${item.split_ratio}%)`
|
||||||
|
},
|
||||||
|
...item.children.map(child => ({
|
||||||
|
value: child.store_category_id,
|
||||||
|
label: `${child.store_category_name} 到账比例(${child.split_ratio}%)`
|
||||||
|
}))
|
||||||
|
] : []
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
handleChangeBizCategory(value) {
|
||||||
|
if (value && value.length === 2) {
|
||||||
|
const [bizCategoryId, bizSecondCategoryId] = value;
|
||||||
|
this.form.biz_category = bizCategoryId;
|
||||||
|
this.form.biz_second_category = bizSecondCategoryId;
|
||||||
|
}
|
||||||
|
},
|
||||||
formatAreaData(data){
|
formatAreaData(data){
|
||||||
let provinces = []
|
let provinces = []
|
||||||
data.forEach((item) => {
|
data.forEach((item) => {
|
||||||
@ -1535,15 +1556,18 @@ export default {
|
|||||||
const parts = url.split('/')
|
const parts = url.split('/')
|
||||||
return parts[parts.length - 1] || 'contract.pdf'
|
return parts[parts.length - 1] || 'contract.pdf'
|
||||||
},
|
},
|
||||||
async getCategoryList(){
|
async getCategoryList() {
|
||||||
let res = await GetCategoryList();
|
try {
|
||||||
|
const res = await getStoreCategories();
|
||||||
if(res && res.status == 200){
|
if (res.code === 0 && res.status === 200) {
|
||||||
|
this.cascaderOptions = this.transformStoreCategories(res.data);
|
||||||
let name = this.findCategoryName(res.data,this.form.biz_category);
|
console.log("分类列表加载完成:", this.cascaderOptions);
|
||||||
if(name){
|
} else {
|
||||||
this.form.biz_category = name
|
this.$message.warning("获取分类列表异常");
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
this.$message.error("获取店铺分类失败");
|
||||||
|
console.error(err);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
findCategoryName(categories, targetId) {
|
findCategoryName(categories, targetId) {
|
||||||
@ -1857,11 +1881,6 @@ export default {
|
|||||||
console.log(this.form.province_nmae)
|
console.log(this.form.province_nmae)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async fetchdataGetStoreClassify() {
|
|
||||||
await GetStoreClassify().then((res) => {
|
|
||||||
this.classifyData = res.data
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handerChangeCity(e){
|
handerChangeCity(e){
|
||||||
this.provinceData = [];
|
this.provinceData = [];
|
||||||
this.provinceCode = ""
|
this.provinceCode = ""
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user