商品信息管理页面的功能项对接后台,商品分类设置功能开发(新增,修改)
This commit is contained in:
parent
beb8d79eaa
commit
e3ced12a92
@ -5,5 +5,5 @@ VITE_APP_TITLE = 运营云后台管理系统
|
||||
VITE_APP_ENV = 'development'
|
||||
|
||||
# 开发环境
|
||||
VITE_APP_BASE_API = 'http://192.168.18.99:8080'
|
||||
VITE_APP_BASE_API = 'http://192.168.18.151:8080'
|
||||
VITE_APP_PLATFORM = 'http://localhost:9000/platform'
|
@ -8,6 +8,14 @@ export function getGoodManageInfo(query) {
|
||||
params: query
|
||||
})
|
||||
}
|
||||
// 获取商品列表页顶部tab中的数据
|
||||
export function getGoodManageCount(query) {
|
||||
return request({
|
||||
url: '/goods/goodInfoManage/getGoodManageCount',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 获取商品分类列表
|
||||
export function getGoodType(query) {
|
||||
@ -35,19 +43,18 @@ export function goodEdit(data) {
|
||||
})
|
||||
}
|
||||
// 商品删除
|
||||
export function goodDelete(data) {
|
||||
export function goodDelete(id) {
|
||||
return request({
|
||||
url: '/goods/business/category/remove',
|
||||
method: 'post',
|
||||
data: data
|
||||
url: '/goods/goodInfoManage/deleteGoodInfo/id=' + id,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
// 商品上下架
|
||||
// 商品上架下架
|
||||
export function goodUpAndDown(data) {
|
||||
return request({
|
||||
url: '/goods/goodInfoManage/goodEdit',
|
||||
method: 'post',
|
||||
url: '/goods/goodInfoManage/goodOnSale',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
@ -66,4 +73,22 @@ export function getActiveInfos() {
|
||||
url: '/goods/goodInfoManage/getActiveInfos',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 获取商品分类列表
|
||||
export function getGoodCategoryInfo(query) {
|
||||
return request({
|
||||
url: '/goods/business/category/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
// 新增商品分类
|
||||
export function categoryAdd(data) {
|
||||
return request({
|
||||
url: '/goods/business/category/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
@ -185,6 +185,10 @@ const props = defineProps({
|
||||
type: Function,
|
||||
default: () => "",
|
||||
},
|
||||
rowkey: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits([
|
||||
@ -227,7 +231,7 @@ const handleCurrentChange = (val) => {
|
||||
|
||||
// 多选框变化
|
||||
const handleSelectionChange = (selection) => {
|
||||
const selectedIds = selection.map((row) => row.id);
|
||||
const selectedIds = selection.map((row) => props.rowkey == "" ? row.id : row[props.rowkey]);
|
||||
emit("selection-change", selection, selectedIds);
|
||||
};
|
||||
|
||||
|
@ -12,16 +12,16 @@
|
||||
class="demo-form-inline"
|
||||
:label-width="'auto'"
|
||||
>
|
||||
<el-form-item label="分类名称" prop="categoryName">
|
||||
<el-form-item label="分类名称" prop="name">
|
||||
<el-input
|
||||
v-model="formInline.categoryName"
|
||||
v-model="formInline.name"
|
||||
placeholder="请输入分类名称"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="categoryStatus">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="formInline.categoryStatus"
|
||||
v-model="formInline.status"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
>
|
||||
@ -33,7 +33,7 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<br>
|
||||
<br />
|
||||
<el-form-item
|
||||
label="添加时间"
|
||||
prop="startDate"
|
||||
@ -85,14 +85,12 @@
|
||||
icon="delete"
|
||||
@click="batchDelete"
|
||||
:disabled="btnStatus"
|
||||
style="margin-right: 10px"
|
||||
style="margin-right: 0px"
|
||||
>批量删除</el-button
|
||||
>
|
||||
<router-link to="/goods/addGoods">
|
||||
<el-button type="primary" icon="plus" @click="onSubmit"
|
||||
>添加分类</el-button
|
||||
>
|
||||
</router-link>
|
||||
<el-button type="primary" icon="plus" @click="addCategory"
|
||||
>添加分类</el-button
|
||||
>
|
||||
</div>
|
||||
<tableComponent
|
||||
:table-data="tableData"
|
||||
@ -107,6 +105,7 @@
|
||||
:current-page="formInline.current"
|
||||
:page-size="formInline.size"
|
||||
:showSort="true"
|
||||
:rowkey="'goodId'"
|
||||
>
|
||||
<!-- 自定义-状态 -->
|
||||
<template #goodsUrl="slotProps">
|
||||
@ -120,8 +119,8 @@
|
||||
</template>
|
||||
|
||||
<!-- 自定义-状态 -->
|
||||
<template #categoryStatus="slotProps">
|
||||
<span v-if="slotProps.row.categoryStatus == '已启用'" class="color-green"
|
||||
<template #status="slotProps">
|
||||
<span v-if="slotProps.row.status == 1" class="color-green"
|
||||
>已启用</span
|
||||
>
|
||||
<span v-else class="color-gray">未启用</span>
|
||||
@ -129,72 +128,95 @@
|
||||
|
||||
<!-- 自定义-操作 -->
|
||||
<template #action="slotProps">
|
||||
<el-tooltip effect="dark" placement="bottom-end">
|
||||
<template #content>
|
||||
<div class="custom-tooltip-content">
|
||||
<el-icon
|
||||
class="el-icon-custom"
|
||||
@click="seeDetails(slotProps.row)"
|
||||
>
|
||||
<View />
|
||||
</el-icon>
|
||||
<el-icon
|
||||
class="el-icon-custom"
|
||||
@click="toUpload(slotProps.row)"
|
||||
>
|
||||
<Upload />
|
||||
</el-icon>
|
||||
<el-icon
|
||||
class="el-icon-custom"
|
||||
@click="toDownload(slotProps.row)"
|
||||
>
|
||||
<Download />
|
||||
</el-icon>
|
||||
<el-icon
|
||||
class="el-icon-custom"
|
||||
@click="handleEdit(slotProps.row)"
|
||||
>
|
||||
<Edit />
|
||||
</el-icon>
|
||||
<el-icon
|
||||
class="el-icon-custom"
|
||||
@click="handleDelete(slotProps.row)"
|
||||
>
|
||||
<Delete />
|
||||
</el-icon>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<span class="el-dropdown-link">
|
||||
<el-icon>
|
||||
<More />
|
||||
</el-icon>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
<el-button
|
||||
text
|
||||
v-if="slotProps.row.status == 2"
|
||||
class="el-button-custom"
|
||||
@click="seeDetails(slotProps.row)"
|
||||
>启用</el-button
|
||||
>
|
||||
<el-button
|
||||
text
|
||||
v-if="slotProps.row.status == 1"
|
||||
class="el-button-custom"
|
||||
@click="seeDetails(slotProps.row)"
|
||||
>禁用</el-button
|
||||
>
|
||||
<el-button
|
||||
text
|
||||
class="el-button-custom"
|
||||
@click="handleEdit(slotProps.row)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button
|
||||
text
|
||||
class="el-button-delete"
|
||||
@click="handleDelete(slotProps.row)"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</tableComponent>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 添加分类 -->
|
||||
<el-dialog v-model="dialogFormVisible" :title="dialogTitle" width="500">
|
||||
<el-form
|
||||
:model="dialogForm"
|
||||
:label-width="'80'"
|
||||
:rules="dialogFormRules"
|
||||
ref="dialogRef"
|
||||
>
|
||||
<el-form-item label="分类名称" prop="name">
|
||||
<el-input v-model="dialogForm.name" autocomplete="off" placeholder="请输入分类名称"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="父级分类" prop="parentId">
|
||||
<el-cascader
|
||||
v-model="dialogForm.parentId"
|
||||
:options="goodsOptions"
|
||||
:props="cascaderProps"
|
||||
placeholder="请选择父级分类"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否禁用" prop="status" required>
|
||||
<el-radio-group v-model="dialogForm.status" style="margin-top: -3px">
|
||||
<el-radio value="1" size="large">启用类别</el-radio>
|
||||
<el-radio value="2" size="large">禁用类别</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="onSaveCategory">
|
||||
确认添加
|
||||
</el-button>
|
||||
<el-button @click="cancelDialog">取消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, reactive, computed, onMounted, onBeforeUnmount } from "vue";
|
||||
import tableComponent from "@/components/tableComponent.vue";
|
||||
import Mock from "mockjs";
|
||||
import { getGoodManageInfo } from "@/api/goods/info";
|
||||
import { getGoodCategoryInfo, getGoodType, categoryAdd } from "@/api/goods/info";
|
||||
import { ca } from "element-plus/es/locales.mjs";
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const formInline = reactive({
|
||||
categoryName: "",
|
||||
categoryStatus: "",
|
||||
name: "",
|
||||
status: "",
|
||||
startDate: "",
|
||||
endDate: "",
|
||||
current: 1,
|
||||
size: 10,
|
||||
});
|
||||
const statusList = ref([
|
||||
{ name: "未启用", id: '0'},
|
||||
{ name: "已启用", id: '1' },
|
||||
{ name: "未启用", id: "2" },
|
||||
{ name: "已启用", id: "1" },
|
||||
]);
|
||||
// 禁用开始日期的逻辑(不能晚于已选的结束日期)
|
||||
const disableStartDate = (time) => {
|
||||
@ -215,7 +237,7 @@ const searchForm = ref(null);
|
||||
const onSubmit = () => {
|
||||
console.log("submit!");
|
||||
formInline.current = 1;
|
||||
formInline.categoryStatus = formInline.categoryStatus == undefined ? '' : formInline.categoryStatus;
|
||||
formInline.status = formInline.status == undefined ? "" : formInline.status;
|
||||
console.log(formInline);
|
||||
loadData();
|
||||
};
|
||||
@ -236,10 +258,10 @@ let nowClickRow = ref({});
|
||||
const columns = ref([]);
|
||||
const columns1 = ref([
|
||||
{ prop: "id", label: "ID" },
|
||||
{ prop: "categoryName", label: "类别" },
|
||||
{ prop: "addTime", label: "添加时间" },
|
||||
{ prop: "categoryStatus", label: "状态", slotName: "categoryStatus" },
|
||||
{ prop: "action", label: "操作", slotName: "action" },
|
||||
{ prop: "name", label: "类别" },
|
||||
{ prop: "createTime", label: "添加时间" },
|
||||
{ prop: "status", label: "状态", slotName: "status" },
|
||||
{ prop: "action", label: "操作", slotName: "action", width: 150 },
|
||||
]);
|
||||
|
||||
// 生成食物主题昵称
|
||||
@ -271,9 +293,9 @@ const generateMockData = () => {
|
||||
"list|10": [
|
||||
{
|
||||
"id|+1": 10000,
|
||||
categoryName: '@pick(["种子", "化肥", "农药"])', //分类名称
|
||||
addTime: "@datetime", //添加时间
|
||||
categoryStatus: '@pick(["已启用", "未启用"])', //状态
|
||||
name: '@pick(["种子", "化肥", "农药"])', //分类名称
|
||||
createTime: "@datetime", //添加时间
|
||||
status: "@pick([1, 2])", //状态
|
||||
},
|
||||
],
|
||||
}).list;
|
||||
@ -281,18 +303,18 @@ const generateMockData = () => {
|
||||
// 加载数据
|
||||
const loadData = async () => {
|
||||
tableLoading.value = true;
|
||||
tableData.value = generateMockData();
|
||||
tableTotal.value = tableData.value.length;
|
||||
// try {
|
||||
// let response = await getGoodManageInfo(formInline);
|
||||
// console.log(response);
|
||||
// if (response.code == 200) {
|
||||
// tableData.value = response.data.records;
|
||||
// tableTotal.value = response.data.total;
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.log(error);
|
||||
// }
|
||||
// tableData.value = generateMockData();
|
||||
// tableTotal.value = tableData.value.length;
|
||||
try {
|
||||
let response = await getGoodCategoryInfo(formInline);
|
||||
console.log(response);
|
||||
if (response.code == 200) {
|
||||
tableData.value = response.data.records;
|
||||
tableTotal.value = response.data.total;
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
tableLoading.value = false;
|
||||
};
|
||||
|
||||
@ -319,12 +341,6 @@ const seeDetails = (row) => {
|
||||
nowClickRow.value = row;
|
||||
console.log("要查看详情的行:", row);
|
||||
};
|
||||
const toUpload = () => {
|
||||
console.log("向上移动:");
|
||||
};
|
||||
const toDownload = () => {
|
||||
console.log("向下移动:");
|
||||
};
|
||||
// 编辑操作
|
||||
const handleEdit = (row) => {
|
||||
nowClickRow.value = row;
|
||||
@ -340,6 +356,87 @@ const batchDelete = () => {
|
||||
console.log("要删除的行:", selectedIds.value);
|
||||
};
|
||||
|
||||
const dialogFormVisible = ref(false);
|
||||
const dialogRef = ref(null);
|
||||
const dialogTitle = ref("添加分类");
|
||||
const dialogForm = reactive({
|
||||
type: null, //分类类型归属,类型1->农资交易,2->供应商服务,3->采购商服务,4->土地交易
|
||||
name: "", //分类名字
|
||||
parentId: [], //父级id
|
||||
level: "", //分类层级
|
||||
sort: "", //排序值
|
||||
status: "1", //分类状态(1-启用 2-禁用)
|
||||
});
|
||||
const dialogFormRules = ref({
|
||||
name: [
|
||||
{ required: true, message: "请输入分类名称", trigger: "blur" },
|
||||
{ min: 2, max: 10, message: "长度在 2 到 10 个字符", trigger: "blur" },
|
||||
],
|
||||
parentId: [
|
||||
{ required: true, message: "请选择父级分类", trigger: ["blur", "change"] },
|
||||
],
|
||||
});
|
||||
// 级联选择器配置
|
||||
const cascaderProps = ref({
|
||||
label: "name", // 选项标签字段名
|
||||
value: "id", // 选项值字段名
|
||||
children: "children", // 子选项字段名
|
||||
emitPath: true,
|
||||
expandTrigger: "hover",
|
||||
});
|
||||
const goodsOptions = ref([]);
|
||||
const getGoodTypeList = async () => {
|
||||
try {
|
||||
let response = await getGoodType();
|
||||
console.log(response);
|
||||
if (response.code == 200) {
|
||||
goodsOptions.value = response.data;
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
const onSaveCategory = async () => {
|
||||
console.log("保存分类");
|
||||
console.log(dialogForm);
|
||||
await dialogRef.value.validate(async (valid, fields) => {
|
||||
if (valid) {
|
||||
try {
|
||||
console.log("验证通过!");
|
||||
proxy.$modal.loading("正在添加中...")
|
||||
let param = {...dialogForm};
|
||||
param.parentId = dialogForm.parentId.join(",");
|
||||
let response = await categoryAdd(param);
|
||||
proxy.$modal.closeLoading()
|
||||
if (response.code == 200) {
|
||||
console.log(response);
|
||||
dialogFormVisible.value = false;
|
||||
ElMessage.success(response.msg);
|
||||
loadData();
|
||||
} else {
|
||||
ElMessage.error(response.msg);
|
||||
}
|
||||
} catch (error) {
|
||||
proxy.$modal.closeLoading()
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
// 添加分类
|
||||
const addCategory = () => {
|
||||
console.log("添加分类");
|
||||
dialogFormVisible.value = true;
|
||||
};
|
||||
const EditCategory = () => {
|
||||
console.log("编辑分类");
|
||||
dialogTitle.value = "编辑分类";
|
||||
dialogFormVisible.value = true;
|
||||
};
|
||||
const cancelDialog = () => {
|
||||
console.log("取消");
|
||||
dialogFormVisible.value = false;
|
||||
};
|
||||
|
||||
const titleRef = ref(null);
|
||||
const searchBarRef = ref(null);
|
||||
const tableViewportHeight = ref(0);
|
||||
@ -364,6 +461,7 @@ const calculateTableHeight = () => {
|
||||
onMounted(() => {
|
||||
columns.value = columns1.value;
|
||||
loadData();
|
||||
getGoodTypeList();
|
||||
|
||||
calculateTableHeight();
|
||||
|
||||
|
@ -204,6 +204,7 @@ import myUploadVideo from "@/components/myUploadVideo.vue";
|
||||
import { getGoodType, goodAdd, getActiveInfos } from "@/api/goods/info";
|
||||
import { getRegion } from "@/api/common";
|
||||
import { ElMessage } from "element-plus";
|
||||
import areaList from "./areaList";
|
||||
|
||||
const formRef = ref(null)
|
||||
const formInline = reactive({
|
||||
@ -401,7 +402,7 @@ const rules = reactive({
|
||||
{ required: true, message: '请输入详细地址', trigger: 'blur' }
|
||||
],
|
||||
safeguard: [
|
||||
{
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
console.log(value);
|
||||
if (value.isSelected !== 1) { // 如果值不是 1(未选中)
|
||||
@ -443,46 +444,15 @@ const selectedAddress = ref([]);
|
||||
const detailAddress = ref('');
|
||||
// 级联选择器配置
|
||||
const cascaderProps = ref({
|
||||
value: 'name', // 选项值字段名
|
||||
label: 'name', // 选项标签字段名
|
||||
children: 'children' // 子选项字段名
|
||||
label: 'areaName', // 选项标签字段名
|
||||
value: 'areaCode', // 选项值字段名
|
||||
children: 'areaChildVOS', // 子选项字段名
|
||||
emitPath: true,
|
||||
expandTrigger: 'hover',
|
||||
});
|
||||
// 省市区数据(示例)
|
||||
const addressOptions = ref([
|
||||
{
|
||||
name: '云南省',
|
||||
children: [
|
||||
{
|
||||
name: '昆明市',
|
||||
children: [
|
||||
{ name: '五华区' },
|
||||
{ name: '盘龙区' },
|
||||
{ name: '呈贡区' }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: '曲靖市',
|
||||
children: [
|
||||
{ name: '麒麟区' },
|
||||
{ name: '沾益区' }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: '广东省',
|
||||
children: [
|
||||
{
|
||||
name: '广州市',
|
||||
children: [
|
||||
{ name: '天河区' },
|
||||
{ name: '越秀区' }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
// 其他省份数据...
|
||||
]);
|
||||
const addressOptions = ref([]);
|
||||
addressOptions.value = areaList.data;
|
||||
|
||||
// 保障服务
|
||||
const isSafeguardSelected = computed({
|
||||
@ -608,12 +578,12 @@ const onSubmit = async () => {
|
||||
}
|
||||
params.areaAddress = params.selectedAddress.join(',');
|
||||
|
||||
params.safeguardSelected = formInline.safeguard.isSelected; //保障服务
|
||||
params.discountSettingsSelected = formInline.discountSettings.isSelected; //优惠设置
|
||||
params.discountRebateSelected = formInline.discountRebate.isSelected; //优惠折扣
|
||||
params.safeguardSelected = formInline.safeguard.isSelected; //保障服务
|
||||
params.discountSettingsSelected = formInline.discountSettings.isSelected; //优惠设置
|
||||
params.discountRebateSelected = formInline.discountRebate.isSelected; //优惠折扣
|
||||
|
||||
// 调用接口提交
|
||||
onGoodSave(params)
|
||||
onGoodSave(params)
|
||||
} catch (error) {
|
||||
console.log('验证失败', error)
|
||||
}
|
||||
@ -624,7 +594,7 @@ const onGoodSave = async (params) => {
|
||||
if (response.code === 200) {
|
||||
ElMessage.success("新增成功!");
|
||||
formRef.value.resetFields();
|
||||
} else {
|
||||
} else {
|
||||
ElMessage.error(response.message);
|
||||
}
|
||||
}
|
||||
@ -634,7 +604,7 @@ const getArea = async () => {
|
||||
console.log(res);
|
||||
if (res.code === 200) {
|
||||
addressOptions.value = res.data.list;
|
||||
} else {
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
};
|
||||
@ -648,7 +618,7 @@ const getActiveInfo = async () => {
|
||||
formInline.safeguard.options = [...activeInfoList.value.safeguard.options];
|
||||
formInline.discountSettings.options = [...activeInfoList.value.discountSettings.options];
|
||||
formInline.discountRebate.options = [...activeInfoList.value.discountRebate.options];
|
||||
} else {
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
};
|
||||
|
792
src/views/goods/goodsManage/areaList.js
Normal file
792
src/views/goods/goodsManage/areaList.js
Normal file
@ -0,0 +1,792 @@
|
||||
export default {
|
||||
"code": 200,
|
||||
"msg": null,
|
||||
"data": [
|
||||
{
|
||||
"id": "3",
|
||||
"areaName": "耿马傣族佤族自治县",
|
||||
"parentId": "530900",
|
||||
"areaCode": "530926",
|
||||
"level": 2,
|
||||
"areaChildVOS": [
|
||||
{
|
||||
"id": "4",
|
||||
"areaName": "耿马镇",
|
||||
"parentId": "530926",
|
||||
"areaCode": "530926100",
|
||||
"level": 3,
|
||||
"areaChildVOS": [
|
||||
{
|
||||
"id": "16",
|
||||
"areaName": "甘东社区",
|
||||
"parentId": "530926100",
|
||||
"areaCode": "5309261001",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "17",
|
||||
"areaName": "白马社区",
|
||||
"parentId": "530926100",
|
||||
"areaCode": "5309261002",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "18",
|
||||
"areaName": "白塔社区",
|
||||
"parentId": "530926100",
|
||||
"areaCode": "5309261003",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "19",
|
||||
"areaName": "团结村",
|
||||
"parentId": "530926100",
|
||||
"areaCode": "5309261004",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "20",
|
||||
"areaName": "新城村",
|
||||
"parentId": "530926100",
|
||||
"areaCode": "5309261005",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "21",
|
||||
"areaName": "芒蚌村",
|
||||
"parentId": "530926100",
|
||||
"areaCode": "5309261006",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "22",
|
||||
"areaName": "芒国村",
|
||||
"parentId": "530926100",
|
||||
"areaCode": "5309261007",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "23",
|
||||
"areaName": "复兴村",
|
||||
"parentId": "530926100",
|
||||
"areaCode": "5309261008",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "24",
|
||||
"areaName": "允楞村",
|
||||
"parentId": "530926100",
|
||||
"areaCode": "5309261009",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "25",
|
||||
"areaName": "石灰窑村",
|
||||
"parentId": "530926100",
|
||||
"areaCode": "53092610010",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "26",
|
||||
"areaName": "南木弄村",
|
||||
"parentId": "530926100",
|
||||
"areaCode": "53092610011",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "27",
|
||||
"areaName": "允捧村",
|
||||
"parentId": "530926100",
|
||||
"areaCode": "53092610012",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "28",
|
||||
"areaName": "菜籽地村",
|
||||
"parentId": "530926100",
|
||||
"areaCode": "53092610013",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "29",
|
||||
"areaName": "弄巴村",
|
||||
"parentId": "530926100",
|
||||
"areaCode": "53092610014",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "5",
|
||||
"areaName": "勐永镇",
|
||||
"parentId": "530926",
|
||||
"areaCode": "530926101",
|
||||
"level": 3,
|
||||
"areaChildVOS": [
|
||||
{
|
||||
"id": "30",
|
||||
"areaName": "勐永村",
|
||||
"parentId": "530926101",
|
||||
"areaCode": "5309261011",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "31",
|
||||
"areaName": "新和村",
|
||||
"parentId": "530926101",
|
||||
"areaCode": "5309261012",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "32",
|
||||
"areaName": "芒来村",
|
||||
"parentId": "530926101",
|
||||
"areaCode": "5309261013",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "33",
|
||||
"areaName": "芒佑村",
|
||||
"parentId": "530926101",
|
||||
"areaCode": "5309261014",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "34",
|
||||
"areaName": "芒糯村",
|
||||
"parentId": "530926101",
|
||||
"areaCode": "5309261015",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "35",
|
||||
"areaName": "帮令村",
|
||||
"parentId": "530926101",
|
||||
"areaCode": "5309261016",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "36",
|
||||
"areaName": "香竹林村",
|
||||
"parentId": "530926101",
|
||||
"areaCode": "5309261017",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "37",
|
||||
"areaName": "光木林村",
|
||||
"parentId": "530926101",
|
||||
"areaCode": "5309261018",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "6",
|
||||
"areaName": "勐撒镇",
|
||||
"parentId": "530926",
|
||||
"areaCode": "530926102",
|
||||
"level": 3,
|
||||
"areaChildVOS": [
|
||||
{
|
||||
"id": "38",
|
||||
"areaName": "丙令村",
|
||||
"parentId": "530926102",
|
||||
"areaCode": "5309261021",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "39",
|
||||
"areaName": "芒茂村",
|
||||
"parentId": "530926102",
|
||||
"areaCode": "5309261022",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "40",
|
||||
"areaName": "城子村",
|
||||
"parentId": "530926102",
|
||||
"areaCode": "5309261023",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "41",
|
||||
"areaName": "芒枕村",
|
||||
"parentId": "530926102",
|
||||
"areaCode": "5309261024",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "42",
|
||||
"areaName": "箐门口村",
|
||||
"parentId": "530926102",
|
||||
"areaCode": "5309261025",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "43",
|
||||
"areaName": "班必村",
|
||||
"parentId": "530926102",
|
||||
"areaCode": "5309261026",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "44",
|
||||
"areaName": "翁达村",
|
||||
"parentId": "530926102",
|
||||
"areaCode": "5309261027",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "45",
|
||||
"areaName": "琅琊村",
|
||||
"parentId": "530926102",
|
||||
"areaCode": "5309261028",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "46",
|
||||
"areaName": "户肯村",
|
||||
"parentId": "530926102",
|
||||
"areaCode": "5309261029",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "7",
|
||||
"areaName": "孟定镇",
|
||||
"parentId": "530926",
|
||||
"areaCode": "530926103",
|
||||
"level": 3,
|
||||
"areaChildVOS": [
|
||||
{
|
||||
"id": "47",
|
||||
"areaName": "城关村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261031",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "48",
|
||||
"areaName": "下城村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261032",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "49",
|
||||
"areaName": "罕宏村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261033",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "50",
|
||||
"areaName": "贺海村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261034",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "51",
|
||||
"areaName": "遮哈村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261035",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "52",
|
||||
"areaName": "下坝村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261036",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "53",
|
||||
"areaName": "河西村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261037",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "54",
|
||||
"areaName": "新寨村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261038",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "55",
|
||||
"areaName": "景信村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261039",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "56",
|
||||
"areaName": "糯峨村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261040",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "57",
|
||||
"areaName": "芒美村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261041",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "58",
|
||||
"areaName": "邱山村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261042",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "59",
|
||||
"areaName": "德龙村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261043",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "60",
|
||||
"areaName": "芒撒村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261044",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "61",
|
||||
"areaName": "崇岗村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261045",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "62",
|
||||
"areaName": "芒艾村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261046",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "63",
|
||||
"areaName": "色树坝村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261047",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "64",
|
||||
"areaName": "尖坪村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261048",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "65",
|
||||
"areaName": "山头寨村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261049",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "66",
|
||||
"areaName": "班幸村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261050",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "67",
|
||||
"areaName": "清水河村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261051",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "68",
|
||||
"areaName": "尖山村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261052",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "69",
|
||||
"areaName": "大水井村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261053",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "70",
|
||||
"areaName": "和顺新村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261054",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "71",
|
||||
"areaName": "沙源新村",
|
||||
"parentId": "530926103",
|
||||
"areaCode": "5309261055",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "8",
|
||||
"areaName": "大兴乡",
|
||||
"parentId": "530926",
|
||||
"areaCode": "530926200",
|
||||
"level": 3,
|
||||
"areaChildVOS": [
|
||||
{
|
||||
"id": "72",
|
||||
"areaName": "大兴村",
|
||||
"parentId": "530926200",
|
||||
"areaCode": "5309262001",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "73",
|
||||
"areaName": "岩榴村",
|
||||
"parentId": "530926200",
|
||||
"areaCode": "5309262002",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "74",
|
||||
"areaName": "永胜村",
|
||||
"parentId": "530926200",
|
||||
"areaCode": "5309262003",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "75",
|
||||
"areaName": "户肯村",
|
||||
"parentId": "530926200",
|
||||
"areaCode": "5309262004",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "76",
|
||||
"areaName": "龚家寨村",
|
||||
"parentId": "530926200",
|
||||
"areaCode": "5309262005",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "77",
|
||||
"areaName": "班坝村",
|
||||
"parentId": "530926200",
|
||||
"areaCode": "5309262006",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "9",
|
||||
"areaName": "芒洪拉祜族布朗族乡",
|
||||
"parentId": "530926",
|
||||
"areaCode": "530926201",
|
||||
"level": 3,
|
||||
"areaChildVOS": [
|
||||
{
|
||||
"id": "78",
|
||||
"areaName": "芒洪村",
|
||||
"parentId": "530926201",
|
||||
"areaCode": "5309262011",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "79",
|
||||
"areaName": "科且村",
|
||||
"parentId": "530926201",
|
||||
"areaCode": "5309262012",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "80",
|
||||
"areaName": "安雅村",
|
||||
"parentId": "530926201",
|
||||
"areaCode": "5309262013",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "81",
|
||||
"areaName": "新联村",
|
||||
"parentId": "530926201",
|
||||
"areaCode": "5309262014",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "82",
|
||||
"areaName": "马厂村",
|
||||
"parentId": "530926201",
|
||||
"areaCode": "5309262015",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "10",
|
||||
"areaName": "四排山乡",
|
||||
"parentId": "530926",
|
||||
"areaCode": "530926202",
|
||||
"level": 3,
|
||||
"areaChildVOS": [
|
||||
{
|
||||
"id": "83",
|
||||
"areaName": "老寨村",
|
||||
"parentId": "530926202",
|
||||
"areaCode": "5309262021",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "84",
|
||||
"areaName": "关弄村",
|
||||
"parentId": "530926202",
|
||||
"areaCode": "5309262022",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "85",
|
||||
"areaName": "芒关村",
|
||||
"parentId": "530926202",
|
||||
"areaCode": "5309262023",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "86",
|
||||
"areaName": "芒翁村",
|
||||
"parentId": "530926202",
|
||||
"areaCode": "5309262024",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "87",
|
||||
"areaName": "梁子寨村",
|
||||
"parentId": "530926202",
|
||||
"areaCode": "5309262025",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "88",
|
||||
"areaName": "石佛洞村",
|
||||
"parentId": "530926202",
|
||||
"areaCode": "5309262026",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "89",
|
||||
"areaName": "东坡村",
|
||||
"parentId": "530926202",
|
||||
"areaCode": "5309262027",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "90",
|
||||
"areaName": "班康村",
|
||||
"parentId": "530926202",
|
||||
"areaCode": "5309262028",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "11",
|
||||
"areaName": "贺派乡",
|
||||
"parentId": "530926",
|
||||
"areaCode": "530926203",
|
||||
"level": 3,
|
||||
"areaChildVOS": [
|
||||
{
|
||||
"id": "91",
|
||||
"areaName": "贺派村",
|
||||
"parentId": "530926203",
|
||||
"areaCode": "5309262031",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "92",
|
||||
"areaName": "芒抗村",
|
||||
"parentId": "530926203",
|
||||
"areaCode": "5309262032",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "93",
|
||||
"areaName": "水平村",
|
||||
"parentId": "530926203",
|
||||
"areaCode": "5309262033",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "94",
|
||||
"areaName": "落阳村",
|
||||
"parentId": "530926203",
|
||||
"areaCode": "5309262034",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "95",
|
||||
"areaName": "崩弄村",
|
||||
"parentId": "530926203",
|
||||
"areaCode": "5309262035",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "96",
|
||||
"areaName": "芒底村",
|
||||
"parentId": "530926203",
|
||||
"areaCode": "5309262036",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "97",
|
||||
"areaName": "帮卖村",
|
||||
"parentId": "530926203",
|
||||
"areaCode": "5309262037",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "12",
|
||||
"areaName": "勐简乡",
|
||||
"parentId": "530926",
|
||||
"areaCode": "530926204",
|
||||
"level": 3,
|
||||
"areaChildVOS": [
|
||||
{
|
||||
"id": "98",
|
||||
"areaName": "勐简村",
|
||||
"parentId": "530926204",
|
||||
"areaCode": "5309262041",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "99",
|
||||
"areaName": "班望村",
|
||||
"parentId": "530926204",
|
||||
"areaCode": "5309262042",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "100",
|
||||
"areaName": "迎们寨村",
|
||||
"parentId": "530926204",
|
||||
"areaCode": "5309262043",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "101",
|
||||
"areaName": "大寨村",
|
||||
"parentId": "530926204",
|
||||
"areaCode": "5309262044",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
},
|
||||
{
|
||||
"id": "102",
|
||||
"areaName": "老厂村",
|
||||
"parentId": "530926204",
|
||||
"areaCode": "5309262045",
|
||||
"level": 4,
|
||||
"areaChildVOS": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -205,6 +205,8 @@ import myUploadVideo from "@/components/myUploadVideo.vue";
|
||||
import { getGoodType, goodEdit, getGoodInfo, getActiveInfos } from "@/api/goods/info";
|
||||
import { getRegion } from "@/api/common";
|
||||
import { ElMessage } from "element-plus";
|
||||
import areaList from "./areaList";
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
@ -433,46 +435,15 @@ const selectedAddress = ref([]);
|
||||
const detailAddress = ref('');
|
||||
// 级联选择器配置
|
||||
const cascaderProps = ref({
|
||||
value: 'name', // 选项值字段名
|
||||
label: 'name', // 选项标签字段名
|
||||
children: 'children' // 子选项字段名
|
||||
label: 'areaName', // 选项标签字段名
|
||||
value: 'areaCode', // 选项值字段名
|
||||
children: 'areaChildVOS', // 子选项字段名
|
||||
emitPath: true,
|
||||
expandTrigger: 'hover',
|
||||
});
|
||||
// 省市区数据(示例)
|
||||
const addressOptions = ref([
|
||||
{
|
||||
name: '云南省',
|
||||
children: [
|
||||
{
|
||||
name: '昆明市',
|
||||
children: [
|
||||
{ name: '五华区' },
|
||||
{ name: '盘龙区' },
|
||||
{ name: '呈贡区' }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: '曲靖市',
|
||||
children: [
|
||||
{ name: '麒麟区' },
|
||||
{ name: '沾益区' }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: '广东省',
|
||||
children: [
|
||||
{
|
||||
name: '广州市',
|
||||
children: [
|
||||
{ name: '天河区' },
|
||||
{ name: '越秀区' }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
// 其他省份数据...
|
||||
]);
|
||||
const addressOptions = ref([]);
|
||||
addressOptions.value = areaList.data;
|
||||
|
||||
// 保障服务
|
||||
const isSafeguardSelected = computed({
|
||||
|
@ -7,45 +7,96 @@
|
||||
<div class="search-bar-left">
|
||||
<div class="order-tab" style="margin-top: -10px">
|
||||
<el-tabs v-model="activeCurrent" @tab-click="tabChange">
|
||||
<el-tab-pane v-for="t in bottomList" :key="t.id" :label="t.title + '(' + t.value + ')'" :name="t.id">
|
||||
<el-tab-pane
|
||||
v-for="t in bottomList"
|
||||
:key="t.id"
|
||||
:label="t.title + t.value"
|
||||
:name="t.id"
|
||||
>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<el-form ref="searchForm" :inline="true" :model="formInline" class="demo-form-inline" :label-width="'auto'">
|
||||
<el-form
|
||||
ref="searchForm"
|
||||
:inline="true"
|
||||
:model="formInline"
|
||||
class="demo-form-inline"
|
||||
:label-width="'auto'"
|
||||
>
|
||||
<el-form-item label="商品名称" prop="goodName">
|
||||
<el-input v-model="formInline.goodName" placeholder="请输入商品名称" clearable />
|
||||
<el-input
|
||||
v-model="formInline.goodName"
|
||||
placeholder="请输入商品名称"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品分类" prop="goodCategoryId">
|
||||
<el-select v-model="formInline.goodCategoryId" placeholder="请选择" clearable>
|
||||
<el-form-item
|
||||
label="商品分类"
|
||||
prop="goodCategoryId"
|
||||
class="custom-form-inline"
|
||||
>
|
||||
<!-- <el-select v-model="formInline.goodCategoryId" placeholder="请选择" clearable>
|
||||
<el-option v-for="item in goodsCategoryList" :key="item.id" :value="item.id" :label="item.name" />
|
||||
</el-select>
|
||||
</el-select> -->
|
||||
<el-cascader
|
||||
v-model="formInline.goodCategoryId"
|
||||
:options="goodsOptions"
|
||||
:props="cascaderProps"
|
||||
placeholder="请选择省市区"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品品牌" prop="storeId">
|
||||
<!-- <el-form-item label="商品品牌" prop="storeId">
|
||||
<el-select v-model="formInline.storeId" placeholder="请选择" clearable>
|
||||
<el-option v-for="item in goodsBrandList" :key="item.id" :value="item.id" :label="item.name" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="search-bar-right">
|
||||
<el-button type="primary" icon="Search" @click="onSubmit">查询</el-button>
|
||||
<el-button icon="Refresh" style="margin: 16px 0 0 0" @click="resetForm">重置</el-button>
|
||||
<el-button type="primary" icon="Search" @click="onSubmit"
|
||||
>查询</el-button
|
||||
>
|
||||
<el-button
|
||||
icon="Refresh"
|
||||
style="margin: 16px 0 0 0"
|
||||
@click="resetForm"
|
||||
>重置</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 表格 -->
|
||||
<div class="table-cont" :style="{ height: tableViewportHeight + 'px' }">
|
||||
<div class="table-toolbar">
|
||||
<el-button icon="delete" @click="batchDelete" :disabled="btnStatus"
|
||||
style="margin-right: 10px">批量删除</el-button>
|
||||
<el-button
|
||||
icon="delete"
|
||||
@click="batchDelete"
|
||||
:disabled="btnStatus"
|
||||
style="margin-right: 10px"
|
||||
>批量删除</el-button
|
||||
>
|
||||
<router-link to="/goods/goodsManage/addGoods">
|
||||
<el-button type="primary" icon="plus" @click="onSubmit">新增商品</el-button>
|
||||
<el-button type="primary" icon="plus" @click="onSubmit"
|
||||
>新增商品</el-button
|
||||
>
|
||||
</router-link>
|
||||
</div>
|
||||
<tableComponent :table-data="tableData" :columns="columns" :show-border="false" :show-selection="true"
|
||||
:header-cell-class-name="getHeaderClass" @page-change="handlePaginationChange" :loading="tableLoading"
|
||||
@selection-change="handleSelectionChange" :total="tableTotal" :current-page="formInline.current"
|
||||
:page-size="formInline.size" :showSort="true">
|
||||
<tableComponent
|
||||
:table-data="tableData"
|
||||
:columns="columns"
|
||||
:show-border="false"
|
||||
:show-selection="true"
|
||||
:header-cell-class-name="getHeaderClass"
|
||||
@page-change="handlePaginationChange"
|
||||
:loading="tableLoading"
|
||||
@selection-change="handleSelectionChange"
|
||||
:total="tableTotal"
|
||||
:current-page="formInline.current"
|
||||
:page-size="formInline.size"
|
||||
:showSort="true"
|
||||
:rowkey="'goodId'"
|
||||
>
|
||||
<!-- 自定义-图片 -->
|
||||
<template #goodUrl="slotProps">
|
||||
<div class="table-cell-img-box">
|
||||
@ -54,47 +105,64 @@
|
||||
</template>
|
||||
<!-- 自定义 - 序号 -->
|
||||
<template #sort="slotProps">
|
||||
<span v-if="slotProps.row.goodPrice">¥{{ slotProps.row.goodPrice }}</span>
|
||||
<span v-if="slotProps.row.goodPrice"
|
||||
>¥{{ slotProps.row.goodPrice }}</span
|
||||
>
|
||||
</template>
|
||||
|
||||
<!-- 自定义-状态 -->
|
||||
<template #isListed="slotProps">
|
||||
<span v-if="slotProps.row.isListed == 0" class="color-blue">待上架</span>
|
||||
<span v-else-if="slotProps.row.isListed == 1" class="color-black">已上架</span>
|
||||
<span v-else-if="slotProps.row.isListed == 2" class="color-green">上架</span>
|
||||
<span v-else-if="slotProps.row.isListed == 3" class="color-red">下架</span>
|
||||
<span v-else-if="slotProps.row.isListed == 4" class="color-orange">审核中</span>
|
||||
<span v-if="slotProps.row.isListed == 0" class="color-blue"
|
||||
>待上架</span
|
||||
>
|
||||
<span v-else-if="slotProps.row.isListed == 1" class="color-black"
|
||||
>已上架</span
|
||||
>
|
||||
<span v-else-if="slotProps.row.isListed == 2" class="color-green"
|
||||
>上架</span
|
||||
>
|
||||
<span v-else-if="slotProps.row.isListed == 3" class="color-red"
|
||||
>下架</span
|
||||
>
|
||||
<span v-else-if="slotProps.row.isListed == 4" class="color-orange"
|
||||
>审核中</span
|
||||
>
|
||||
</template>
|
||||
|
||||
<!-- 自定义-操作 -->
|
||||
<template #action="slotProps">
|
||||
<el-tooltip effect="dark" placement="bottom-end">
|
||||
<template #content>
|
||||
<div class="custom-tooltip-content">
|
||||
<el-icon class="el-icon-custom" @click="seeDetails(slotProps.row)">
|
||||
<View />
|
||||
</el-icon>
|
||||
<el-icon class="el-icon-custom" @click="toUpload(slotProps.row)">
|
||||
<Upload />
|
||||
</el-icon>
|
||||
<el-icon class="el-icon-custom" @click="toDownload(slotProps.row)">
|
||||
<Download />
|
||||
</el-icon>
|
||||
<el-icon class="el-icon-custom" @click="handleEdit(slotProps.row)">
|
||||
<Edit />
|
||||
</el-icon>
|
||||
<el-icon class="el-icon-custom" @click="handleDelete(slotProps.row)">
|
||||
<Delete />
|
||||
</el-icon>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<span class="el-dropdown-link">
|
||||
<el-icon>
|
||||
<More />
|
||||
</el-icon>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
<el-button
|
||||
text
|
||||
class="el-button-custom"
|
||||
@click="seeDetails(slotProps.row)"
|
||||
>详情</el-button
|
||||
>
|
||||
<el-button
|
||||
text
|
||||
v-if="slotProps.row.isListed == 0"
|
||||
class="el-button-custom"
|
||||
@click="toUpload(slotProps.row)"
|
||||
>上架</el-button
|
||||
>
|
||||
<el-button
|
||||
text
|
||||
v-if="slotProps.row.isListed == 1"
|
||||
class="el-button-custom"
|
||||
@click="toDownload(slotProps.row)"
|
||||
>下架</el-button
|
||||
>
|
||||
<el-button
|
||||
text
|
||||
class="el-button-custom"
|
||||
@click="handleEdit(slotProps.row)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button
|
||||
text
|
||||
class="el-button-delete"
|
||||
@click="handleDelete(slotProps.row)"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</tableComponent>
|
||||
</div>
|
||||
@ -105,15 +173,22 @@
|
||||
import { ref, reactive, computed, onMounted, onBeforeUnmount } from "vue";
|
||||
import tableComponent from "@/components/tableComponent.vue";
|
||||
import Mock from "mockjs";
|
||||
import { getGoodManageInfo, getGoodType, goodDelete } from "@/api/goods/info";
|
||||
import {
|
||||
getGoodManageInfo,
|
||||
getGoodType,
|
||||
goodDelete,
|
||||
getGoodManageCount,
|
||||
goodUpAndDown,
|
||||
} from "@/api/goods/info";
|
||||
import { id } from "element-plus/es/locales.mjs";
|
||||
import { ElMessage } from 'element-plus'
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
import { ElMessage } from "element-plus";
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const formInline = reactive({
|
||||
goodName: "",
|
||||
goodCategoryId: "",
|
||||
goodCategoryId: [],
|
||||
storeId: "",
|
||||
type: "1",
|
||||
current: 1,
|
||||
@ -143,9 +218,9 @@ const resetForm = () => {
|
||||
|
||||
let activeCurrent = ref("1");
|
||||
let bottomList = reactive([
|
||||
{ title: "全部", id: "1", value: 134 },
|
||||
{ title: "已上架", id: "2", value: 97 },
|
||||
{ title: "已下架", id: "3", value: 37 },
|
||||
{ title: "全部", id: "1", value: "" },
|
||||
{ title: "已上架", id: "2", value: "" },
|
||||
{ title: "已下架", id: "3", value: "" },
|
||||
]);
|
||||
const tabChange = (Event) => {
|
||||
console.log(Event.index);
|
||||
@ -183,7 +258,13 @@ const columns1 = ref([
|
||||
{ prop: "pageView", label: "浏览量" },
|
||||
{ prop: "stock", label: "库存" },
|
||||
{ prop: "isListed", label: "状态", slotName: "isListed" },
|
||||
{ prop: "action", label: "操作", slotName: "action" },
|
||||
{
|
||||
prop: "action",
|
||||
label: "操作",
|
||||
slotName: "action",
|
||||
width: 200,
|
||||
fixed: "right",
|
||||
},
|
||||
]);
|
||||
|
||||
// 生成食物主题昵称
|
||||
@ -224,7 +305,7 @@ const generateMockData = () => {
|
||||
salesVolume: "@integer(1000, 20000)", //销量
|
||||
pageView: Mock.mock("@id").toString().slice(0, 6), //浏览量
|
||||
stock: "@integer(5000, 90000)", //库存
|
||||
isListed: '@pick([0, 1, 2, 3, 4])', //状态
|
||||
isListed: "@pick([0, 1, 2, 3, 4])", //状态
|
||||
ordersNums: "@integer(10, 200)",
|
||||
},
|
||||
],
|
||||
@ -237,9 +318,13 @@ const loadData = async () => {
|
||||
// tableData.value = generateMockData();
|
||||
// tableTotal.value = tableData.value.length;
|
||||
// console.log(tableData.value);
|
||||
|
||||
|
||||
let prams = { ...formInline };
|
||||
prams.goodCategoryId =
|
||||
formInline.goodCategoryId[prams.goodCategoryId.length - 1];
|
||||
|
||||
try {
|
||||
let response = await getGoodManageInfo(formInline);
|
||||
let response = await getGoodManageInfo(prams);
|
||||
console.log(response);
|
||||
if (response.code == 200) {
|
||||
tableData.value = response.data.records;
|
||||
@ -274,11 +359,24 @@ const seeDetails = (row) => {
|
||||
nowClickRow.value = row;
|
||||
console.log("要查看详情的行:", row);
|
||||
};
|
||||
const toUpload = () => {
|
||||
console.log("上架:");
|
||||
const toUpload = async (row) => {
|
||||
console.log("上架:", row);
|
||||
goodsUpAndDown(row.goodId, 2);
|
||||
};
|
||||
const toDownload = () => {
|
||||
console.log("下架:");
|
||||
const toDownload = (row) => {
|
||||
console.log("下架:", row);
|
||||
goodsUpAndDown(row.goodId, 3);
|
||||
};
|
||||
const goodsUpAndDown = async (id, isListed) => {
|
||||
// 2->上架,3->下架
|
||||
let res = await goodUpAndDown({ id: id, isListed: isListed });
|
||||
let text = isListed == 2 ? "上架" : "下架";
|
||||
if (res.code == 200) {
|
||||
ElMessage.success(`${text}成功`);
|
||||
loadData();
|
||||
} else {
|
||||
ElMessage.error(res.msg);
|
||||
}
|
||||
};
|
||||
// 编辑操作
|
||||
const handleEdit = (row) => {
|
||||
@ -287,25 +385,66 @@ const handleEdit = (row) => {
|
||||
// 跳转路由并携带参数,行数据,和query的值edit
|
||||
router.push({
|
||||
path: "/goods/goodsManage/editGoods",
|
||||
query: { goodId: row.goodId }
|
||||
})
|
||||
query: { goodId: row.goodId },
|
||||
});
|
||||
};
|
||||
// 删除操作
|
||||
const handleDelete = (row) => {
|
||||
nowClickRow.value = row;
|
||||
console.log("要删除的行:", row);
|
||||
const handleDelete = async (row) => {
|
||||
deleteGoods(row.goodId)
|
||||
};
|
||||
// 批量删除
|
||||
const batchDelete = async() => {
|
||||
console.log("要删除的行:", selectedIds.value.join(","));
|
||||
ElMessage.success("删除成功");
|
||||
// let res = await goodDelete({id: selectedIds.value});
|
||||
// if (res.code == 200) {
|
||||
// ElMessage.success("删除成功");
|
||||
// loadData();
|
||||
// } else {
|
||||
// ElMessage.error("删除失败");
|
||||
// }
|
||||
const batchDelete = async () => {
|
||||
console.log("要删除的行:", selectedIds.value);
|
||||
deleteGoods(selectedIds.value.join(","))
|
||||
};
|
||||
const deleteGoods = async (param) => {
|
||||
try {
|
||||
tableLoading.value = true;
|
||||
let res = await goodDelete(param);
|
||||
tableLoading.value = false;
|
||||
if (res.code == 200) {
|
||||
ElMessage.success("删除成功");
|
||||
loadData();
|
||||
} else {
|
||||
ElMessage.error(res.msg);
|
||||
}
|
||||
} catch (error) {
|
||||
tableLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 级联选择器配置
|
||||
const cascaderProps = ref({
|
||||
label: "name", // 选项标签字段名
|
||||
value: "id", // 选项值字段名
|
||||
children: "children", // 子选项字段名
|
||||
emitPath: true,
|
||||
expandTrigger: "hover",
|
||||
});
|
||||
const goodsOptions = ref([]);
|
||||
const getGoodTypeList = async () => {
|
||||
try {
|
||||
let response = await getGoodType();
|
||||
console.log(response);
|
||||
if (response.code == 200) {
|
||||
goodsOptions.value = response.data;
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
const getGoodsManageCount = async () => {
|
||||
try {
|
||||
let response = await getGoodManageCount();
|
||||
if (response.code == 200) {
|
||||
bottomList[0].value = `(${response.data?.allGoodCount ?? ""})`;
|
||||
bottomList[1].value = `(${response.data?.alreadyListedCount ?? ""})`;
|
||||
bottomList[2].value = `(${response.data?.removedCount ?? ""})`;
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
const titleRef = ref(null);
|
||||
@ -332,6 +471,8 @@ const calculateTableHeight = () => {
|
||||
onMounted(() => {
|
||||
columns.value = columns1.value;
|
||||
loadData();
|
||||
getGoodTypeList();
|
||||
getGoodsManageCount();
|
||||
|
||||
calculateTableHeight();
|
||||
|
||||
|
@ -100,10 +100,10 @@ const userStore = useUserStore();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
const showType = ref(1);
|
||||
const showType = ref(2);
|
||||
|
||||
const loginForm = ref({
|
||||
username: "admin",
|
||||
username: "super",
|
||||
password: "admin123",
|
||||
rememberMe: false,
|
||||
code: "",
|
||||
|
@ -1,78 +1,90 @@
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import path from 'path'
|
||||
import createVitePlugins from './vite/plugins'
|
||||
import { defineConfig, loadEnv } from "vite";
|
||||
import path from "path";
|
||||
import createVitePlugins from "./vite/plugins";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(({ mode, command }) => {
|
||||
const env = loadEnv(mode, process.cwd())
|
||||
const { VITE_APP_ENV } = env
|
||||
const { VITE_APP_BASE_API } = env
|
||||
const env = loadEnv(mode, process.cwd());
|
||||
const { VITE_APP_ENV } = env;
|
||||
const { VITE_APP_BASE_API } = env;
|
||||
return {
|
||||
// 部署生产环境和开发环境下的URL。
|
||||
// 默认情况下,vite 会假设你的应用是被部署在一个域名的根路径上
|
||||
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
|
||||
base: VITE_APP_ENV === 'production' ? '/' : '/',
|
||||
plugins: createVitePlugins(env, command === 'build'),
|
||||
base: VITE_APP_ENV === "production" ? "/" : "/",
|
||||
plugins: createVitePlugins(env, command === "build"),
|
||||
resolve: {
|
||||
// https://cn.vitejs.dev/config/#resolve-alias
|
||||
alias: {
|
||||
// 设置路径
|
||||
'~': path.resolve(__dirname, './'),
|
||||
"~": path.resolve(__dirname, "./"),
|
||||
// 设置别名
|
||||
'@': path.resolve(__dirname, './src')
|
||||
"@": path.resolve(__dirname, "./src"),
|
||||
},
|
||||
// https://cn.vitejs.dev/config/#resolve-extensions
|
||||
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
|
||||
extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
|
||||
},
|
||||
// 打包配置
|
||||
build: {
|
||||
// https://vite.dev/config/build-options.html
|
||||
sourcemap: command === 'build' ? false : 'inline',
|
||||
outDir: 'dist',
|
||||
assetsDir: 'assets',
|
||||
sourcemap: command === "build" ? false : "inline",
|
||||
outDir: "dist",
|
||||
assetsDir: "assets",
|
||||
chunkSizeWarningLimit: 2000,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
chunkFileNames: 'static/js/[name]-[hash].js',
|
||||
entryFileNames: 'static/js/[name]-[hash].js',
|
||||
assetFileNames: 'static/[ext]/[name]-[hash].[ext]'
|
||||
}
|
||||
}
|
||||
chunkFileNames: "static/js/[name]-[hash].js",
|
||||
entryFileNames: "static/js/[name]-[hash].js",
|
||||
assetFileNames: "static/[ext]/[name]-[hash].[ext]",
|
||||
},
|
||||
},
|
||||
},
|
||||
// vite 相关配置
|
||||
server: {
|
||||
port: 80,
|
||||
host: true,
|
||||
host: '0.0.0.0',
|
||||
open: true,
|
||||
headers: {
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
},
|
||||
proxy: {
|
||||
// https://cn.vitejs.dev/config/#server-proxy
|
||||
'/apis': {
|
||||
target: VITE_APP_BASE_API,
|
||||
changeOrigin: true,
|
||||
rewrite: (p) => p.replace(/^\/apis/, '')
|
||||
rewrite: (path) => path.replace(/^\/apis/, ""),
|
||||
},
|
||||
// springdoc proxy
|
||||
'^/v3/api-docs/(.*)': {
|
||||
"^/v3/api-docs/(.*)": {
|
||||
target: VITE_APP_BASE_API,
|
||||
changeOrigin: true,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
// proxy: {
|
||||
// '/apis': {
|
||||
// target: VITE_APP_BASE_API,
|
||||
// changeOrigin: true,
|
||||
// rewrite: (p) => p.replace(/^\/apis/, '')
|
||||
// },
|
||||
// '^/v3/api-docs/(.*)': {
|
||||
// target: VITE_APP_BASE_API,
|
||||
// changeOrigin: true,
|
||||
// }
|
||||
// }
|
||||
},
|
||||
css: {
|
||||
postcss: {
|
||||
plugins: [
|
||||
{
|
||||
postcssPlugin: 'internal:charset-removal',
|
||||
postcssPlugin: "internal:charset-removal",
|
||||
AtRule: {
|
||||
charset: (atRule) => {
|
||||
if (atRule.name === 'charset') {
|
||||
atRule.remove()
|
||||
if (atRule.name === "charset") {
|
||||
atRule.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user