refactor: 移除未使用的商品规格相关 API 接口与组件,优化用户管理与物流功能

- 删除了与商品规格相关的 API 接口和组件,简化代码结构。
- 更新用户管理功能,确保表单字段与验证规则一致。
- 优化物流添加与编辑功能,确保请求参数的正确性与一致性。
This commit is contained in:
田香琪
2026-07-16 16:52:55 +08:00
parent 7804d4eba6
commit 7e87214b6d
17 changed files with 555 additions and 396 deletions

View File

@@ -52,19 +52,11 @@ export const saveParameterCategory = (parameter_id, categoryIds) => {
"Content-Type": "application/json" "Content-Type": "application/json"
}) })
} }
//保存获取关联规格
export const saveCategorySpec = (category_id, params) => {
return postRequest(`/goods/categorySpec/${category_id}`, params)
}
//获取所有可用品牌 //获取所有可用品牌
export const getBrandListData = (params) => { export const getBrandListData = (params) => {
return getRequest('/goods/brand/all', params) return getRequest('/goods/brand/all', params)
} }
// 获取所有可用规格
export const getSpecificationList = (params) => {
return getRequest('/goods/spec/all', params)
}
//获取分类列表数据 //获取分类列表数据
export const getAllCategoryList = (parent_id) => { export const getAllCategoryList = (parent_id) => {
@@ -93,11 +85,6 @@ export const disableCategory = (id, type) => {
return putRequest(`/goods/category/disable/${id}`, type) return putRequest(`/goods/category/disable/${id}`, type)
} }
//根据分类id获取关联规格
export const getCategorySpecListData = (category_id, params) => {
return getRequest(`/goods/categorySpec/${category_id}`, params)
}
// 查询某分类下的全部子分类列表 // 查询某分类下的全部子分类列表
export const getGoodsCategory = (parent_id) => { export const getGoodsCategory = (parent_id) => {
return getRequest(`/goods/category/${parent_id}/all-children`) return getRequest(`/goods/category/${parent_id}/all-children`)
@@ -221,12 +208,6 @@ export const deleteParamsGroup = (id, params) => {
return deleteRequest(`/goods/categoryParameters/${id}`, params) return deleteRequest(`/goods/categoryParameters/${id}`, params)
} }
//保存获取关联规格
export const getGoodsSpecInfo = (category_id, params) => {
return getRequest(`/goods/categorySpec/goods/${category_id}`, params)
}
//获取sku列表 //获取sku列表
export const getSkuPage = (params) => { export const getSkuPage = (params) => {
return getRequest(`/goodsSku/getByPage`, params) return getRequest(`/goodsSku/getByPage`, params)

View File

@@ -120,9 +120,37 @@ export const getAllUserData = (params) => {
return getRequest("/passport/user/getAll", params); return getRequest("/passport/user/getAll", params);
}; };
function buildUserRegisterFormBody(params) {
const parts = [];
const appendField = (key, value) => {
if (value === undefined || value === null || value === "") return;
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
};
appendField("username", params.username);
appendField("password", params.password);
appendField("nickName", params.nickName);
appendField("mobile", params.mobile);
appendField("email", params.email);
appendField("avatar", params.avatar);
appendField("description", params.description);
if (params.departmentId !== undefined && params.departmentId !== null && params.departmentId !== "" && params.departmentId !== 0) {
appendField("departmentId", params.departmentId);
}
if (params.isSuper !== undefined && params.isSuper !== null) {
appendField("isSuper", params.isSuper);
}
if (Array.isArray(params.roles)) {
params.roles.forEach((roleId) => appendField("roles", roleId));
}
return parts.join("&");
}
// 添加用户 // 添加用户
export const addUser = (params) => { export const addUser = (params) => {
return postRequest("/passport/user", params); const body = buildUserRegisterFormBody(params);
return postRequest("/passport/user/register", body, {
"Content-Type": "application/x-www-form-urlencoded",
});
}; };
// 编辑管理员自身 // 编辑管理员自身
export const editUser = (params) => { export const editUser = (params) => {

View File

@@ -14,11 +14,28 @@ export const getLogisticsPage = params => {
}; };
// 删除 // 删除
export const delLogistics = id => { export const delLogistics = id => {
return deleteRequest(`/other/logistics/delete/${id}`); return deleteRequest(`/other/logistics/${id}`);
}; };
// 添加 // 添加
function buildLogisticsFormBody(params) {
const parts = [];
const appendField = (key, value) => {
if (value === undefined || value === null || value === "") return;
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
};
appendField("name", params.name);
appendField("code", params.code);
appendField("disabled", params.disabled);
appendField("standBy", params.standBy);
appendField("formItems", params.formItems);
return parts.join("&");
}
export const addLogistics = params => { export const addLogistics = params => {
return postRequest(`/other/logistics/save`,params); const body = buildLogisticsFormBody(params);
return postRequest("/other/logistics", body, {
"Content-Type": "application/x-www-form-urlencoded",
});
}; };
// 通过id查询详情 // 通过id查询详情
export const getLogisticsDetail = id => { export const getLogisticsDetail = id => {

View File

@@ -3,12 +3,12 @@
<el-button @click="handleClickUploadImage">上传图片</el-button> <el-button @click="handleClickUploadImage">上传图片</el-button>
<el-dialog v-model="show" width="850px" title="上传图片" append-to-body :z-index="3500"> <el-dialog v-model="show" width="850px" title="上传图片" append-to-body :z-index="3500">
<div class="import-oss" @click="importOSS">从资源库中导入</div> <div class="import-oss" @click="importOSS">从资源库中导入</div>
<div style="display: flex; flex-wrap: wrap"> <div class="upload-images-wrap">
<vuedraggable <vuedraggable
v-model="images" v-model="images"
:animation="200" :animation="200"
:item-key="draggableItemKey" :item-key="draggableItemKey"
style="display: flex; flex-wrap: wrap" class="upload-images-draggable"
> >
<template #item="{ element, index }"> <template #item="{ element, index }">
<div class="upload-list"> <div class="upload-list">
@@ -212,27 +212,57 @@ export default {
.wrapper { .wrapper {
margin: 10px 0; margin: 10px 0;
} }
$upload-item-size: 150px;
.upload-images-wrap {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
}
.upload-images-draggable {
display: flex;
flex-wrap: wrap;
}
.upload-list { .upload-list {
width: 150px; width: $upload-item-size;
height: 150px; height: $upload-item-size;
text-align: center; text-align: center;
border: 1px solid transparent; border: 1px solid #dcdfe6;
border-radius: 4px; border-radius: 4px;
display: inline-block; display: inline-block;
background: #fff; background: #fff;
position: relative; position: relative;
margin-right: 4px; margin: 0 4px 4px 0;
vertical-align: bottom; overflow: hidden;
flex-shrink: 0;
} }
.upload-box { .upload-box {
margin: 10px 0; width: $upload-item-size;
height: $upload-item-size;
margin: 0 4px 4px 0;
display: inline-block; display: inline-block;
vertical-align: bottom; flex-shrink: 0;
:deep(.el-upload) {
width: $upload-item-size;
height: $upload-item-size;
display: block;
}
:deep(.el-upload-dragger) {
width: $upload-item-size;
height: $upload-item-size;
min-height: $upload-item-size;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
box-sizing: border-box;
}
} }
.upload-trigger { .upload-trigger {
width: 148px; width: 100%;
height: 148px; height: 100%;
line-height: 148px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;

View File

@@ -116,28 +116,6 @@
<el-button type="primary" :loading="submitLoading" @click="saveCategoryBrand">提交</el-button> <el-button type="primary" :loading="submitLoading" @click="saveCategoryBrand">提交</el-button>
</template> </template>
</el-dialog> </el-dialog>
<el-dialog
v-model="modalSpecVisible"
:title="modalSpecTitle"
width="500px"
:close-on-click-modal="false"
>
<el-form ref="specForm" :model="specForm" label-width="100px">
<el-select v-model="specForm.categorySpecs" multiple style="width: 100%">
<el-option
v-for="item in specifications"
:key="item.id"
:label="item.specName"
:value="item.id"
/>
</el-select>
</el-form>
<template #footer>
<el-button @click="modalSpecVisible = false">取消</el-button>
<el-button type="primary" :loading="submitLoading" @click="saveCategorySpec">提交</el-button>
</template>
</el-dialog>
</el-card> </el-card>
</div> </div>
</template> </template>
@@ -148,12 +126,9 @@ import {
disableCategory, disableCategory,
getBrandListData, getBrandListData,
getCategoryBrandListData, getCategoryBrandListData,
getCategorySpecListData,
getCategoryTree, getCategoryTree,
getSpecificationList,
insertCategory, insertCategory,
saveCategoryBrand, saveCategoryBrand,
saveCategorySpec,
updateCategory, updateCategory,
} from "@/api/goods"; } from "@/api/goods";
import uploadPicInput from "@/components/lili/upload-pic-input"; import uploadPicInput from "@/components/lili/upload-pic-input";
@@ -171,18 +146,14 @@ export default {
categoryList: [], categoryList: [],
loading: false, loading: false,
brands: [], brands: [],
specifications: [],
categoryId: "", categoryId: "",
categorySpecs: [],
modalType: 0, modalType: 0,
modalVisible: false, modalVisible: false,
modalBrandVisible: false, modalBrandVisible: false,
modalSpecVisible: false,
modalTitle: "", modalTitle: "",
showParent: false, showParent: false,
parentTitle: "", parentTitle: "",
modalBrandTitle: "", modalBrandTitle: "",
modalSpecTitle: "",
formAdd: { formAdd: {
parentId: "", parentId: "",
name: "", name: "",
@@ -196,9 +167,6 @@ export default {
categoryBrands: [], categoryBrands: [],
}, },
brandWay: [], brandWay: [],
specForm: {
categorySpecs: [],
},
formValidate: { formValidate: {
commissionRate: [regular.REQUIRED, regular.INTEGER], commissionRate: [regular.REQUIRED, regular.INTEGER],
name: [regular.REQUIRED, regular.VARCHAR20], name: [regular.REQUIRED, regular.VARCHAR20],
@@ -245,20 +213,12 @@ export default {
init() { init() {
this.getAllList(); this.getAllList();
this.getBrandList(); this.getBrandList();
this.getSpecList();
}, },
getBrandList() { getBrandList() {
getBrandListData().then((res) => { getBrandListData().then((res) => {
this.brandWay = res; this.brandWay = res;
}); });
}, },
getSpecList() {
getSpecificationList().then((res) => {
if (res.length != 0) {
this.specifications = res.result;
}
});
},
brandOperation(v) { brandOperation(v) {
getCategoryBrandListData(v.id).then((res) => { getCategoryBrandListData(v.id).then((res) => {
this.categoryId = v.id; this.categoryId = v.id;
@@ -267,23 +227,6 @@ export default {
this.modalBrandVisible = true; this.modalBrandVisible = true;
}); });
}, },
specOperation(v) {
getCategorySpecListData(v.id).then((res) => {
this.categoryId = v.id;
this.modalSpecTitle = "规格关联";
this.specForm.categorySpecs = res.map((item) => item.id);
this.modalSpecVisible = true;
});
},
saveCategorySpec() {
saveCategorySpec(this.categoryId, this.specForm).then((res) => {
this.submitLoading = false;
if (res.success) {
ElMessage.success("操作成功");
this.modalSpecVisible = false;
}
});
},
saveCategoryBrand() { saveCategoryBrand() {
saveCategoryBrand(this.categoryId, this.brandForm).then((res) => { saveCategoryBrand(this.categoryId, this.brandForm).then((res) => {
this.submitLoading = false; this.submitLoading = false;

View File

@@ -25,35 +25,37 @@
<el-input-number :min="0" v-model="form.sort" style="width: 520px" /> <el-input-number :min="0" v-model="form.sort" style="width: 520px" />
</el-form-item> </el-form-item>
<el-form-item label="参数值" prop="options"> <el-form-item label="参数值" prop="options">
<el-table :data="form.options" border size="small" style="width: 520px"> <div class="options-editor">
<el-table-column label="参数值" min-width="420"> <el-table :data="form.options" border size="small" style="width: 520px">
<template #default="{ row, $index }"> <el-table-column label="参数值" min-width="420">
<el-input <template #default="{ row, $index }">
v-if="row" <el-input
v-model="form.options[$index].value" v-if="row"
clearable v-model="form.options[$index].value"
@blur="touchOptionsValidate" clearable
/> @blur="touchOptionsValidate"
</template> />
</el-table-column> </template>
<el-table-column label="操作" width="90" align="center"> </el-table-column>
<template #default="{ row, $index }"> <el-table-column label="操作" width="90" align="center">
<a v-if="row" class="link-text" @click="removeOptionRow($index)"> <template #default="{ row, $index }">
删除 <a v-if="row" class="link-text" @click="removeOptionRow($index)">
</a> 删除
</template> </a>
</el-table-column> </template>
</el-table> </el-table-column>
<div style="margin-top: 10px"> </el-table>
<el-button type="primary" @click="addOptionRow">新增</el-button> <div class="options-editor__actions">
<el-button type="primary" @click="addOptionRow">新增</el-button>
</div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="关联分类"> <el-form-item label="关联分类" prop="categoryIds">
<el-button @click="openCategoryModal">选择分类</el-button> <el-button @click="openCategoryModal">选择分类</el-button>
<span v-if="selectedCategoryNamesText" style="margin-left: 10px; color: #999; font-size: 12px"> <span v-if="selectedCategoryNamesText" style="margin-left: 10px; color: #999; font-size: 12px">
{{ selectedCategoryNamesText }}</span> {{ selectedCategoryNamesText }}</span>
<span v-else style="margin-left: 10px; color: #999; font-size: 12px"> <span v-else style="margin-left: 10px; color: #999; font-size: 12px">
已选择{{ selectedCategoryIds.length }}个分类 已选择{{ (form.categoryIds || []).length }}个分类
</span> </span>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@@ -189,6 +191,28 @@ const buildCategoryIdNameMap = (list, map) => {
}); });
}; };
const buildFormState = (source, parameterId) => {
const opts = normalizeOptions(source?.options);
const options = opts.length > 0 ? opts.map((x) => ({ value: x })) : [{ value: "" }];
const categoryList = Array.isArray(source?.categoryParameterList)
? source.categoryParameterList
: [];
const categoryIds = toStringArray(
categoryList.map((x) => x && x.categoryId).filter(Boolean)
);
const formState = {
paramName: source?.paramName || "",
options,
required: normalize01(source?.required, 0),
isIndex: normalize01(source?.isIndex, 0),
sort: Number(source?.sort ?? 0) || 0,
categoryIds,
};
const id = source?.id || parameterId;
if (id) formState.id = id;
return formState;
};
export default { export default {
name: "parameterEdit", name: "parameterEdit",
data() { data() {
@@ -209,6 +233,7 @@ export default {
required: 0, required: 0,
isIndex: 0, isIndex: 0,
sort: 0, sort: 0,
categoryIds: [],
}, },
formValidate: { formValidate: {
paramName: [regular.REQUIRED, regular.VARCHAR5], paramName: [regular.REQUIRED, regular.VARCHAR5],
@@ -216,6 +241,15 @@ export default {
required: [{ required: true, validator: validateRadioRequired("请选择是否必填"), trigger: "change" }], required: [{ required: true, validator: validateRadioRequired("请选择是否必填"), trigger: "change" }],
isIndex: [{ required: true, validator: validateRadioRequired("请选择是否索引"), trigger: "change" }], isIndex: [{ required: true, validator: validateRadioRequired("请选择是否索引"), trigger: "change" }],
sort: [regular.REQUIRED, regular.INTEGER], sort: [regular.REQUIRED, regular.INTEGER],
categoryIds: [
{
type: "array",
required: true,
min: 1,
message: "请选择关联分类",
trigger: "change",
},
],
}, },
}; };
}, },
@@ -262,15 +296,23 @@ export default {
back() { back() {
this.$router.push({ name: "goods-parameter" }); this.$router.push({ name: "goods-parameter" });
}, },
syncCategoryIds(ids) {
const categoryIds = toStringArray(ids);
this.selectedCategoryIds = categoryIds;
if (!this.form) this.form = {};
this.form.categoryIds = categoryIds;
},
touchOptionsValidate() { touchOptionsValidate() {
if (this.$refs.form && this.$refs.form.validateField) { this.$nextTick(() => {
this.$refs.form.validateField("options"); const form = this.$refs.form;
} if (form && typeof form.validateField === "function") {
form.validateField("options", () => {});
}
});
}, },
addOptionRow() { addOptionRow() {
if (!Array.isArray(this.form.options)) this.form.options = []; if (!Array.isArray(this.form.options)) this.form.options = [];
this.form.options.push({ value: "" }); this.form.options.push({ value: "" });
this.touchOptionsValidate();
}, },
removeOptionRow(index) { removeOptionRow(index) {
if (!Array.isArray(this.form.options)) this.form.options = []; if (!Array.isArray(this.form.options)) this.form.options = [];
@@ -290,17 +332,8 @@ export default {
const res = await getGoodsParamsDetail(parameterId).catch(() => null); const res = await getGoodsParamsDetail(parameterId).catch(() => null);
if (!(res && res.success && res.result)) return; if (!(res && res.success && res.result)) return;
const dto = res.result; const dto = res.result;
const opts = normalizeOptions(dto.options); this.form = buildFormState(dto, parameterId);
this.form = { this.selectedCategoryIds = [...this.form.categoryIds];
id: dto.id || parameterId,
paramName: dto.paramName || "",
options: opts.map((x) => ({ value: x })),
required: normalize01(dto.required, 0),
isIndex: normalize01(dto.isIndex, 0),
sort: Number(dto.sort ?? 0) || 0,
};
const list = Array.isArray(dto.categoryParameterList) ? dto.categoryParameterList : [];
this.selectedCategoryIds = toStringArray(list.map((x) => x && x.categoryId).filter(Boolean));
}, },
async openCategoryModal() { async openCategoryModal() {
this.categoryModalVisible = true; this.categoryModalVisible = true;
@@ -320,7 +353,13 @@ export default {
} }
}, },
onCategoryTreeCheckChange(_data, checkedInfo) { onCategoryTreeCheckChange(_data, checkedInfo) {
this.selectedCategoryIds = toStringArray(checkedInfo?.checkedKeys || []); this.syncCategoryIds(checkedInfo?.checkedKeys || []);
this.$nextTick(() => {
const form = this.$refs.form;
if (form && typeof form.validateField === "function") {
form.validateField("categoryIds", () => {});
}
});
}, },
initForm() { initForm() {
if (this.id) { if (this.id) {
@@ -329,15 +368,8 @@ export default {
if (cached) { if (cached) {
try { try {
const row = JSON.parse(cached); const row = JSON.parse(cached);
const opts = normalizeOptions(row.options); this.form = buildFormState(row, row.id);
this.form = { this.selectedCategoryIds = [...this.form.categoryIds];
id: row.id,
paramName: row.paramName || "",
options: opts.map((x) => ({ value: x })),
required: normalize01(row.required, 0),
isIndex: normalize01(row.isIndex, 0),
sort: Number(row.sort ?? 0) || 0,
};
} catch (e) { } catch (e) {
this.modalType = 0; this.modalType = 0;
} }
@@ -348,7 +380,7 @@ export default {
if (!Array.isArray(this.form.options) || this.form.options.length === 0) { if (!Array.isArray(this.form.options) || this.form.options.length === 0) {
this.form.options = [{ value: "" }]; this.form.options = [{ value: "" }];
} }
this.selectedCategoryIds = []; this.syncCategoryIds([]);
} }
}, },
handleSubmit() { handleSubmit() {
@@ -356,7 +388,7 @@ export default {
if (!valid) return; if (!valid) return;
this.submitLoading = true; this.submitLoading = true;
const options = normalizeOptions(this.form.options); const options = normalizeOptions(this.form.options);
const categoryIds = toStringArray(this.selectedCategoryIds); const categoryIds = toStringArray(this.form.categoryIds);
const payload = { const payload = {
...this.form, ...this.form,
options: options.join(","), options: options.join(","),
@@ -404,4 +436,14 @@ export default {
}; };
</script> </script>
<style lang="scss"></style> <style lang="scss">
.options-editor {
display: flex;
flex-direction: column;
width: 520px;
}
.options-editor__actions {
margin-top: 10px;
}
</style>

View File

@@ -44,7 +44,7 @@
<template #default="{ row }"> <template #default="{ row }">
<div v-if="row"> <div v-if="row">
<a class="link-text" @click="goEdit(row)">编辑</a> <a class="link-text" @click="goEdit(row)">编辑</a>
<span class="op-split">|</span>|<span class="op-split">|</span> <span class="op-split">|</span>
<a class="link-text" @click="remove(row)">删除</a> <a class="link-text" @click="remove(row)">删除</a>
</div> </div>
</template> </template>

View File

@@ -137,6 +137,13 @@ export default {
trigger: "blur", trigger: "blur",
}, },
], ],
code: [
{
required: true,
message: "请输入物流公司编码",
trigger: "blur",
},
],
}, },
submitLoading: false, submitLoading: false,
data: [], data: [],
@@ -192,10 +199,12 @@ export default {
if (this.modalTitle === "添加") { if (this.modalTitle === "添加") {
const payload = { const payload = {
...this.form, name: this.form.name,
code: this.form.code,
disabled: this.form.disabled,
standBy: normalizeStandBy(this.form.standBy), standBy: normalizeStandBy(this.form.standBy),
formItems: this.form.formItems,
}; };
delete payload.id;
addLogistics(payload).then((res) => { addLogistics(payload).then((res) => {
this.submitLoading = false; this.submitLoading = false;
if (res.success) { if (res.success) {

View File

@@ -1,20 +1,19 @@
<template> <template>
<div class="wrapper"> <div class="article-page">
<el-row :gutter="10"> <div class="article-page__aside">
<el-col :span="4" style="height: 100%"> <el-card class="article-category">
<el-card class="article-category mr_10"> <el-tree
<el-tree :data="treeData"
:data="treeData" :props="{ label: 'title', children: 'children' }"
:props="{ label: 'title', children: 'children' }" node-key="value"
node-key="value" highlight-current
highlight-current default-expand-all
default-expand-all @node-click="handleCateChange"
@node-click="handleCateChange" />
/> </el-card>
</el-card> </div>
</el-col> <div class="article-page__main">
<el-col :span="20"> <el-card class="article-detail">
<el-card class="article-detail">
<el-form <el-form
ref="searchForm" ref="searchForm"
:model="searchForm" :model="searchForm"
@@ -41,7 +40,8 @@
<el-button v-if="!selected" type="primary" @click="add">添加</el-button> <el-button v-if="!selected" type="primary" @click="add">添加</el-button>
</div> </div>
<el-table ref="table" v-loading="loading" border :data="data" style="width: 100%"> <div class="article-table-wrap">
<el-table ref="table" v-loading="loading" border :data="data" style="width: 100%">
<el-table-column prop="articleCategoryName" label="分类名称" width="150" /> <el-table-column prop="articleCategoryName" label="分类名称" width="150" />
<el-table-column prop="title" label="文章标题" min-width="200" show-overflow-tooltip /> <el-table-column prop="title" label="文章标题" min-width="200" show-overflow-tooltip />
<el-table-column label="是否显示" width="100"> <el-table-column label="是否显示" width="100">
@@ -74,7 +74,8 @@
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
<div class="mt_10" style="display: flex; justify-content: flex-end"> <div class="mt_10" style="display: flex; justify-content: flex-end">
<el-pagination <el-pagination
@@ -89,8 +90,7 @@
/> />
</div> </div>
</el-card> </el-card>
</el-col> </div>
</el-row>
<el-dialog <el-dialog
v-if="!selected" v-if="!selected"
@@ -100,7 +100,7 @@
:close-on-click-modal="false" :close-on-click-modal="false"
destroy-on-close destroy-on-close
> >
<el-form ref="form" :model="form" label-width="100px"> <el-form ref="form" :model="form" label-width="100px" :rules="formValidate">
<el-form-item label="文章标题" prop="title"> <el-form-item label="文章标题" prop="title">
<el-input v-model="form.title" clearable style="width: 40%" /> <el-input v-model="form.title" clearable style="width: 40%" />
</el-form-item> </el-form-item>
@@ -155,6 +155,25 @@ import {
updateArticleStatus, updateArticleStatus,
} from "@/api/pages"; } from "@/api/pages";
import tinymec from "@/components/editor/index.vue"; import tinymec from "@/components/editor/index.vue";
import { regular } from "@/utils";
const validateArticleContent = (rule, value, callback) => {
const html = String(value || "").trim();
if (!html) {
callback(new Error("请填写文章内容"));
return;
}
const text = html
.replace(/<[^>]+>/g, "")
.replace(/&nbsp;/gi, " ")
.trim();
const hasImage = /<img[\s>]/i.test(html);
if (!text && !hasImage) {
callback(new Error("请填写文章内容"));
return;
}
callback();
};
export default { export default {
components: { components: {
@@ -190,6 +209,12 @@ export default {
content: "", content: "",
id: "", id: "",
}, },
formValidate: {
title: [{ required: true, message: "请输入文章标题", trigger: "blur" }],
categoryId: [{ required: true, message: "请选择文章分类", trigger: "change" }],
sort: [regular.REQUIRED, regular.INTEGER],
content: [{ required: true, validator: validateArticleContent, trigger: "change" }],
},
list: [], list: [],
treeValue: "", treeValue: "",
treeData: [], treeData: [],
@@ -213,6 +238,15 @@ export default {
}, },
}, },
methods: { methods: {
getDefaultForm() {
return {
openStatus: false,
title: "",
categoryId: "",
sort: 1,
content: "",
};
},
init() { init() {
this.getDataList(); this.getDataList();
this.getAllList(0); this.getAllList(0);
@@ -224,8 +258,8 @@ export default {
handleCateChange(data) { handleCateChange(data) {
if (!data) return; if (!data) return;
const { value, title } = data; const { value, title } = data;
this.list.push({ value, title }); this.searchForm.categoryId =
this.searchForm.categoryId = value; value === "0" || value === 0 ? "" : value;
this.searchTreeValue = title; this.searchTreeValue = title;
}, },
changeSwitch(v) { changeSwitch(v) {
@@ -308,10 +342,24 @@ export default {
} }
return arr; return arr;
}, },
buildArticleSearchParams() {
const params = { ...this.searchForm };
const categoryId = params.categoryId;
if (
categoryId === "" ||
categoryId === null ||
categoryId === undefined ||
categoryId === 0 ||
categoryId === "0"
) {
delete params.categoryId;
}
return params;
},
getDataList(val) { getDataList(val) {
if (val) this.form = {}; if (val) this.form = {};
this.loading = true; this.loading = true;
getArticle(this.searchForm) getArticle(this.buildArticleSearchParams())
.then((res) => { .then((res) => {
if (res.success) { if (res.success) {
this.total = res.result.total; this.total = res.result.total;
@@ -323,6 +371,9 @@ export default {
}); });
}, },
handleSubmit() { handleSubmit() {
if (this.$refs.editor?.getContent) {
this.form.content = this.$refs.editor.getContent();
}
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
this.submitLoading = true; this.submitLoading = true;
@@ -353,20 +404,17 @@ export default {
this.modalType = 0; this.modalType = 0;
this.modalTitle = "添加文章"; this.modalTitle = "添加文章";
this.treeValue = ""; this.treeValue = "";
this.form = { this.form = this.getDefaultForm();
sort: 1,
content: "",
};
this.$refs.form?.resetFields();
delete this.form.id;
this.modalVisible = true; this.modalVisible = true;
this.$nextTick(() => {
this.$refs.form?.clearValidate?.();
});
}, },
edit(data) { edit(data) {
this.modalType = 1; this.modalType = 1;
this.modalTitle = "编辑文章"; this.modalTitle = "编辑文章";
this.treeValue = ""; this.treeValue = "";
this.form = { content: "" }; this.form = this.getDefaultForm();
this.$refs.form?.resetFields();
seeArticle(data.id).then((res) => { seeArticle(data.id).then((res) => {
if (res.result) { if (res.result) {
this.modalVisible = true; this.modalVisible = true;
@@ -402,3 +450,35 @@ export default {
}, },
}; };
</script> </script>
<style lang="scss" scoped>
.article-page {
display: flex;
gap: 10px;
align-items: flex-start;
width: 100%;
min-width: 0;
}
.article-page__aside {
flex: 0 0 220px;
width: 220px;
min-width: 180px;
max-width: 260px;
}
.article-page__main {
flex: 1;
min-width: 0;
}
.article-category,
.article-detail {
width: 100%;
}
.article-table-wrap {
width: 100%;
overflow-x: auto;
}
</style>

View File

@@ -13,11 +13,11 @@
style="width: 260px" style="width: 260px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="活动时间" class="activity-time-form-item"> <el-form-item label="活动时间" prop="rangeTime" class="activity-time-form-item">
<el-date-picker <el-date-picker
type="datetimerange" type="datetimerange"
:disabled-date="options.disabledDate" :disabled-date="options.disabledDate"
v-model="rangeTime" v-model="form.rangeTime"
format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
start-placeholder="开始时间" start-placeholder="开始时间"
end-placeholder="结束时间" end-placeholder="结束时间"
@@ -184,13 +184,13 @@ export default {
}, },
showCouponSelect: false, showCouponSelect: false,
tempCouponList: [], tempCouponList: [],
rangeTime: "",
checkUserList: false, checkUserList: false,
selectedMember: [], selectedMember: [],
form: { form: {
promotionName: "", promotionName: "",
activityScope: "ALL", activityScope: "ALL",
couponActivityType: "REGISTERED", couponActivityType: "REGISTERED",
rangeTime: null,
startTime: "", startTime: "",
endTime: "", endTime: "",
memberDTOS: [], memberDTOS: [],
@@ -201,7 +201,19 @@ export default {
selectCouponList: [], selectCouponList: [],
formRule: { formRule: {
promotionName: [{ required: true, message: "活动名称不能为空" }], promotionName: [{ required: true, message: "活动名称不能为空" }],
rangeTime: [{ required: true, message: "请选择活动有效期" }], rangeTime: [
{
required: true,
validator: (rule, value, callback) => {
if (!value || !Array.isArray(value) || value.length !== 2 || !value[0] || !value[1]) {
callback(new Error("请选择活动有效期"));
} else {
callback();
}
},
trigger: "change",
},
],
description: [{ required: true, message: "请输入范围描述" }], description: [{ required: true, message: "请输入范围描述" }],
}, },
}; };
@@ -291,49 +303,31 @@ export default {
this.showCouponSelect = true; this.showCouponSelect = true;
}, },
handleSubmit() { handleSubmit() {
if (this.form.couponFrequencyEnum !== "") { if (this.form.couponFrequencyEnum !== "" && this.form.activityScope != "ALL") {
if (this.form.activityScope == "ALL") { this.$Message.info("自动发券只能全用户发送");
this.form.startTime = this.$filters.unixToDate(this.rangeTime[0] / 1000); this.form.couponActivityType = "SPECIFY";
this.form.endTime = this.$filters.unixToDate(this.rangeTime[1] / 1000); this.form.activityScope = "ALL";
return;
}
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (!valid) return;
const params = JSON.parse(JSON.stringify(this.form));
this.submitLoading = true;
delete params.id;
saveActivityCoupon(params).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("优惠券活动创建成功");
this.closeCurrentPage();
}
});
}
});
} else {
this.$Message.info("自动发券只能全用户发送");
this.form.couponActivityType = "SPECIFY";
this.form.activityScope = "ALL";
}
} else {
this.form.startTime = this.$filters.unixToDate(this.rangeTime[0] / 1000);
this.form.endTime = this.$filters.unixToDate(this.rangeTime[1] / 1000);
this.$refs.form.validate((valid) => { this.form.startTime = this.$filters.unixToDate(this.form.rangeTime[0] / 1000);
if (valid) { this.form.endTime = this.$filters.unixToDate(this.form.rangeTime[1] / 1000);
const params = JSON.parse(JSON.stringify(this.form));
this.submitLoading = true; const params = JSON.parse(JSON.stringify(this.form));
delete params.id; delete params.rangeTime;
saveActivityCoupon(params).then((res) => { delete params.id;
this.submitLoading = false; this.submitLoading = true;
if (res.success) { saveActivityCoupon(params).then((res) => {
this.$Message.success("优惠券活动创建成功"); this.submitLoading = false;
this.closeCurrentPage(); if (res.success) {
} this.$Message.success("优惠券活动创建成功");
}); this.closeCurrentPage();
} }
}); });
} });
}, },
closeCurrentPage() { closeCurrentPage() {
this.$store.commit("removeTag", "add-platform-coupon"); this.$store.commit("removeTag", "add-platform-coupon");

View File

@@ -6,7 +6,7 @@
<div class="form-item-view"> <div class="form-item-view">
<h4>商品信息</h4> <h4>商品信息</h4>
<el-form-item label="选择商品" prop="scopeType"> <el-form-item label="选择商品" prop="promotionGoodsList">
<el-button type="primary" @click="openSkuList">选择商品</el-button> <el-button type="primary" @click="openSkuList">选择商品</el-button>
</el-form-item> </el-form-item>
@@ -116,13 +116,30 @@ export default {
modalType: 0, modalType: 0,
form: { form: {
promotionGoodsList: [], promotionGoodsList: [],
rangeTime: [],
}, },
id: this.$route.query.id, id: this.$route.query.id,
submitLoading: false, submitLoading: false,
selectedGoods: [], selectedGoods: [],
promotionGoodsList: [], promotionGoodsList: [],
formRule: { formRule: {
rangeTime: [{ required: true, message: "请选择活动时间" }], promotionGoodsList: [
{
type: "array",
required: true,
min: 1,
message: "请至少选择一个商品",
trigger: "change",
},
],
rangeTime: [
{
type: "array",
required: true,
message: "请选择活动时间",
trigger: "change",
},
],
}, },
options: { options: {
disabledDate(date) { disabledDate(date) {
@@ -140,78 +157,80 @@ export default {
methods: { methods: {
handleSubmit() { handleSubmit() {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (!valid) {
const params = JSON.parse(JSON.stringify(this.form)); return;
if (this.form.rangeTime[0] === "" || this.form.rangeTime[0] === "") {
this.$Message.error("请选择活动时间");
return;
}
params.startTime = this.$filters.unixToDate(
this.form.rangeTime[0] / 1000
);
params.endTime = this.$filters.unixToDate(
this.form.rangeTime[1] / 1000
);
delete params.rangeTime;
let checkResult = true;
if (this.form.promotionGoodsList.length > 0) {
this.form.promotionGoodsList.forEach((res) => {
if (res.stock <= 0 || res.stock > res.quantity) {
checkResult = false;
this.$Message.error("活动库存不能为0且不能超过商品库存");
return;
}
if (!regular.money.test(res.settlementPrice)) {
checkResult = false;
this.$Message.error("结算价格金额格式不正确");
return;
}
if (res.settlementPrice < 0 || res.settlementPrice > res.price) {
checkResult = false;
this.$Message.error("结算价格金额不能为0且不能超过商品价格");
return;
}
if (!regular.money.test(res.highestPrice)) {
checkResult = false;
this.$Message.error("最高可砍金额格式错误");
return;
}
if (res.highestPrice <= 0 || res.highestPrice > res.price) {
checkResult = false;
this.$Message.error("最高可砍金额不能为0且不能超过商品价格");
return;
}
if (!regular.money.test(res.lowestPrice)) {
checkResult = false;
this.$Message.error("最低可砍金额格式错误");
return;
}
if (res.lowestPrice <= 0 || res.lowestPrice > res.price) {
checkResult = false;
this.$Message.error("最低可砍金额不能为0");
return;
}
if (parseInt(res.lowestPrice) > parseInt(res.highestPrice)) {
checkResult = false;
this.$Message.error("最低砍价金额不能大于最高砍价金额");
return;
}
});
}
if (!checkResult) {
return;
}
this.submitLoading = true;
saveKanJiaActivityGoods(params).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("砍价活动修改成功");
this.closeCurrentPage();
}
});
} }
if (!this.form.promotionGoodsList.length) {
this.$Message.warning("请至少选择一个商品");
return;
}
const params = JSON.parse(JSON.stringify(this.form));
const [start, end] = this.form.rangeTime || [];
const startDate = start instanceof Date ? start : new Date(start);
const endDate = end instanceof Date ? end : new Date(end);
params.startTime = this.$filters.unixToDate(startDate.getTime() / 1000);
params.endTime = this.$filters.unixToDate(endDate.getTime() / 1000);
delete params.rangeTime;
let checkResult = true;
this.form.promotionGoodsList.forEach((res) => {
if (res.stock <= 0 || res.stock > res.quantity) {
checkResult = false;
this.$Message.error("活动库存不能为0且不能超过商品库存");
return;
}
if (!regular.money.test(res.settlementPrice)) {
checkResult = false;
this.$Message.error("结算价格金额格式不正确");
return;
}
if (res.settlementPrice < 0 || res.settlementPrice > res.price) {
checkResult = false;
this.$Message.error("结算价格金额不能为0且不能超过商品价格");
return;
}
if (!regular.money.test(res.highestPrice)) {
checkResult = false;
this.$Message.error("最高可砍金额格式错误");
return;
}
if (res.highestPrice <= 0 || res.highestPrice > res.price) {
checkResult = false;
this.$Message.error("最高可砍金额不能为0且不能超过商品价格");
return;
}
if (!regular.money.test(res.lowestPrice)) {
checkResult = false;
this.$Message.error("最低可砍金额格式错误");
return;
}
if (res.lowestPrice <= 0 || res.lowestPrice > res.price) {
checkResult = false;
this.$Message.error("最低可砍金额不能为0");
return;
}
if (parseInt(res.lowestPrice) > parseInt(res.highestPrice)) {
checkResult = false;
this.$Message.error("最低砍价金额不能大于最高砍价金额");
return;
}
});
if (!checkResult) {
return;
}
this.submitLoading = true;
saveKanJiaActivityGoods(params).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success(
this.modalType === 1 ? "砍价活动修改成功" : "砍价活动添加成功"
);
this.closeCurrentPage();
}
});
}); });
}, },
closeCurrentPage() { closeCurrentPage() {
@@ -232,6 +251,15 @@ export default {
}, },
delGoods(index) { delGoods(index) {
this.form.promotionGoodsList.splice(index, 1); this.form.promotionGoodsList.splice(index, 1);
this.touchPromotionGoodsValidate();
},
touchPromotionGoodsValidate() {
this.$nextTick(() => {
const form = this.$refs.form;
if (form && typeof form.validateField === "function") {
form.validateField("promotionGoodsList", () => {});
}
});
}, },
selectedGoodsData(item) { selectedGoodsData(item) {
let list = []; let list = [];
@@ -252,6 +280,7 @@ export default {
}); });
}); });
this.form.promotionGoodsList = list; this.form.promotionGoodsList = list;
this.touchPromotionGoodsValidate();
}, },
}, },
}; };

View File

@@ -62,17 +62,16 @@
style="width: 260px" style="width: 260px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="活动时间" prop="rangeTime"> <el-form-item label="活动时间" prop="rangeTime" class="kanjia-activity-time-form-item">
<el-date-picker <el-date-picker
:disabled="onlyView" :disabled="onlyView"
v-model="form.rangeTime" v-model="form.rangeTime"
type="datetimerange" type="datetimerange"
format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
start-placeholder="开始时间" start-placeholder="开始时间"
end-placeholder="结束时间" end-placeholder="结束时间"
:disabled-date="disabledDate" placeholder="请选择"
style="width: 360px" :disabled-date="options.disabledDate"
/> />
</el-form-item> </el-form-item>
<div> <div>
@@ -154,9 +153,21 @@ export default {
{ required: true, message: "请输入最高可砍金额" }, { required: true, message: "请输入最高可砍金额" },
{ validator: checkHighestPrice }, { validator: checkHighestPrice },
], ],
rangeTime: [{ required: true, message: "请选择活动时间" }], rangeTime: [
{
type: "array",
required: true,
message: "请选择活动时间",
trigger: "change",
},
],
stock: [{ required: true, message: "请输入活动库存" }], stock: [{ required: true, message: "请输入活动库存" }],
}, },
options: {
disabledDate(date) {
return date && date.valueOf() < Date.now() - 86400000;
},
},
}; };
}, },
async mounted() { async mounted() {
@@ -166,9 +177,6 @@ export default {
} }
}, },
methods: { methods: {
disabledDate(date) {
return date && date.getTime() < Date.now() - 86400000;
},
getKanJiaActivityGoods() { getKanJiaActivityGoods() {
getKanJiaActivityGoodsById(this.id).then((res) => { getKanJiaActivityGoodsById(this.id).then((res) => {
this.form = res.result; this.form = res.result;
@@ -177,58 +185,62 @@ export default {
}, },
handleSubmit() { handleSubmit() {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (!valid) {
const params = JSON.parse(JSON.stringify(this.form)); return;
if (!this.form.rangeTime || this.form.rangeTime.length !== 2) {
this.$Message.error("请选择活动时间");
return;
}
params.startTime = this.form.rangeTime[0];
params.endTime = this.form.rangeTime[1];
delete params.rangeTime;
if (params.stock <= 0 || params.stock > params.goodsSku.quantity) {
this.$Message.error("活动库存不能为0且不能超过商品库存");
return;
}
if (!regular.money.test(params.settlementPrice)) {
this.$Message.error("结算价格金额格式不正确");
return;
}
if (params.settlementPrice < 0 || params.settlementPrice > params.price) {
this.$Message.error("结算价格金额不能为0且不能超过商品价格");
return;
}
if (!regular.money.test(params.highestPrice)) {
this.$Message.error("最高可砍金额格式错误");
return;
}
if (params.highestPrice <= 0 || params.highestPrice > params.price) {
this.$Message.error("最高可砍金额不能为0且不能超过商品价格");
return;
}
if (!regular.money.test(params.lowestPrice)) {
this.$Message.error("最低可砍金额格式错误");
return;
}
if (params.lowestPrice <= 0 || params.lowestPrice > params.price) {
this.$Message.error("最低可砍金额不能为0");
return;
}
if (params.lowestPrice > params.highestPrice) {
this.$Message.error("最低砍价金额不能大于最高砍价金额");
return;
}
this.submitLoading = true;
editKanJiaActivityGoods(params).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("砍价活动修改成功");
this.closeCurrentPage();
}
});
} }
const params = JSON.parse(JSON.stringify(this.form));
const [start, end] = this.form.rangeTime || [];
if (!start || !end) {
this.$Message.error("请选择活动时间");
return;
}
const startDate = start instanceof Date ? start : new Date(start);
const endDate = end instanceof Date ? end : new Date(end);
params.startTime = this.$filters.unixToDate(startDate.getTime() / 1000);
params.endTime = this.$filters.unixToDate(endDate.getTime() / 1000);
delete params.rangeTime;
if (params.stock <= 0 || params.stock > params.goodsSku.quantity) {
this.$Message.error("活动库存不能为0且不能超过商品库存");
return;
}
if (!regular.money.test(params.settlementPrice)) {
this.$Message.error("结算价格金额格式不正确");
return;
}
if (params.settlementPrice < 0 || params.settlementPrice > params.price) {
this.$Message.error("结算价格金额不能为0且不能超过商品价格");
return;
}
if (!regular.money.test(params.highestPrice)) {
this.$Message.error("最高可砍金额格式错误");
return;
}
if (params.highestPrice <= 0 || params.highestPrice > params.price) {
this.$Message.error("最高可砍金额不能为0且不能超过商品价格");
return;
}
if (!regular.money.test(params.lowestPrice)) {
this.$Message.error("最低可砍金额格式错误");
return;
}
if (params.lowestPrice <= 0 || params.lowestPrice > params.price) {
this.$Message.error("最低可砍金额不能为0");
return;
}
if (params.lowestPrice > params.highestPrice) {
this.$Message.error("最低砍价金额不能大于最高砍价金额");
return;
}
this.submitLoading = true;
editKanJiaActivityGoods(params).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("砍价活动修改成功");
this.closeCurrentPage();
}
});
}); });
}, },
closeCurrentPage() { closeCurrentPage() {
@@ -252,4 +264,12 @@ h4 {
line-height: 40px; line-height: 40px;
text-align: left; text-align: left;
} }
.kanjia-activity-time-form-item {
:deep(.el-date-editor) {
width: 360px !important;
max-width: 360px;
flex-grow: 0;
}
}
</style> </style>

View File

@@ -370,8 +370,9 @@
:show-close="true" :show-close="true"
> >
<memberLayout <memberLayout
v-if="memberModalFlag"
:selectedMember="true"
@callback="callbackMember" @callback="callbackMember"
class="selectedMember"
ref="memberLayout" ref="memberLayout"
/> />
</el-dialog> </el-dialog>
@@ -566,7 +567,6 @@ export default {
//选择会员 //选择会员
selectMember() { selectMember() {
this.$refs["memberLayout"].selectedMember = true;
this.memberModalFlag = true; this.memberModalFlag = true;
}, },

View File

@@ -44,7 +44,7 @@
<template #default="{ row }"> <template #default="{ row }">
<template v-if="row"> <template v-if="row">
<a class="link-text" @click="edit(row)">编辑</a> <a class="link-text" @click="edit(row)">编辑</a>
<span class="op-split">|</span>|<span class="op-split">|</span> <span class="op-split">|</span>
<a class="link-text" @click="remove(row)">删除</a> <a class="link-text" @click="remove(row)">删除</a>
</template> </template>
</template> </template>

View File

@@ -104,7 +104,7 @@
<el-form-item label="用户名" prop="username"> <el-form-item label="用户名" prop="username">
<el-input v-model="form.username" autocomplete="off" /> <el-input v-model="form.username" autocomplete="off" />
</el-form-item> </el-form-item>
<el-form-item label="昵称" prop="username"> <el-form-item label="昵称" prop="nickName">
<el-input v-model="form.nickName" autocomplete="off" /> <el-input v-model="form.nickName" autocomplete="off" />
</el-form-item> </el-form-item>
<el-form-item v-if="modalType == 0" label="密码" prop="password" :error="errorPass"> <el-form-item v-if="modalType == 0" label="密码" prop="password" :error="errorPass">
@@ -178,9 +178,12 @@ export default {
modalTitle: "", modalTitle: "",
form: { form: {
username: "", username: "",
nickName: "",
password: "",
mobile: "", mobile: "",
email: "", email: "",
sex: "", avatar: "",
description: "",
roles: [], roles: [],
departmentId: 0, departmentId: 0,
departmentTitle: "", departmentTitle: "",
@@ -285,18 +288,30 @@ export default {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
if (this.modalType == 0) { if (this.modalType == 0) {
const params = JSON.parse(JSON.stringify(this.form)); if (this.form.password == "" || this.form.password == undefined) {
delete params.id;
delete params.status;
if (params.password == "" || params.password == undefined) {
this.errorPass = "密码不能为空"; this.errorPass = "密码不能为空";
return; return;
} }
if (params.password.length < 6) { if (this.form.password.length < 6) {
this.errorPass = "密码长度不得少于6位"; this.errorPass = "密码长度不得少于6位";
return; return;
} }
params.password = this.md5(params.password); if (Array.isArray(this.form.roles) && this.form.roles.length > 9) {
ElMessage.warning("角色最多选择9个");
return;
}
const params = {
username: this.form.username,
password: this.form.password,
nickName: this.form.nickName,
mobile: this.form.mobile,
email: this.form.email,
avatar: this.form.avatar,
description: this.form.description,
departmentId: this.form.departmentId,
roles: this.form.roles,
};
this.errorPass = "";
this.submitLoading = true; this.submitLoading = true;
addUser(params).then((res) => { addUser(params).then((res) => {
this.submitLoading = false; this.submitLoading = false;
@@ -325,9 +340,12 @@ export default {
this.modalTitle = "添加用户"; this.modalTitle = "添加用户";
this.form = { this.form = {
username: "", username: "",
nickName: "",
password: "",
mobile: "", mobile: "",
email: "", email: "",
sex: "", avatar: "",
description: "",
roles: [], roles: [],
departmentId: 0, departmentId: 0,
departmentTitle: "", departmentTitle: "",

View File

@@ -67,11 +67,6 @@ export const getCategoryBrandListData = (category_id, params) => {
export const saveCategoryBrand = (category_id, params) => { export const saveCategoryBrand = (category_id, params) => {
return postRequest(`/category/brand/${category_id}`, params); return postRequest(`/category/brand/${category_id}`, params);
}; };
//保存获取关联规格
export const saveCategorySpec = (category_id, params) => {
return postRequest(`/goods/categorySpec/${category_id}`, params);
};
//获取所有可用品牌 //获取所有可用品牌
export const getBrandListData = params => { export const getBrandListData = params => {
return getRequest("/goods/brand/all", params); return getRequest("/goods/brand/all", params);
@@ -115,10 +110,6 @@ export const getSpecListData = params => {
export const insertOrUpdateSpec = params => { export const insertOrUpdateSpec = params => {
return postRequest("/goods/spec/edit", params); return postRequest("/goods/spec/edit", params);
}; };
//根据分类id获取关联规格
export const getCategorySpecListData = (category_id, params) => {
return getRequest(`/goods/categorySpec/${category_id}`, params);
};
//删除gUI个 //删除gUI个
export const delSpec = (id, params) => { export const delSpec = (id, params) => {
return deleteRequest(`/goods/spec/del/${id}`, params); return deleteRequest(`/goods/spec/del/${id}`, params);
@@ -335,11 +326,6 @@ export const getCategoryParamsListDataSeller = (id, params) => {
return getRequest(`/goods/categoryParameters/${id}`, params); return getRequest(`/goods/categoryParameters/${id}`, params);
}; };
//保存获取关联规格
export const getGoodsSpecInfoSeller = (category_id) => {
return getRequest(`/goods/spec/${category_id}`);
};
//批量设置运费模板 //批量设置运费模板
export const batchShipTemplate = params => { export const batchShipTemplate = params => {
return putRequest(`/goods/goods/freight`, params); return putRequest(`/goods/goods/freight`, params);

View File

@@ -1211,8 +1211,6 @@ export default {
this.baseInfoForm.weight = response.result.skuList[0].weight; this.baseInfoForm.weight = response.result.skuList[0].weight;
} }
this.Get_SkuInfoByCategory(this.categoryId);
this.renderGoodsDetailSku(response.result.skuList); this.renderGoodsDetailSku(response.result.skuList);
/** 查询品牌列表 */ /** 查询品牌列表 */
@@ -2000,20 +1998,6 @@ export default {
return generateCombinations(0, []); return generateCombinations(0, []);
}, },
/** 根据分类id获取系统设置规格信息*/
Get_SkuInfoByCategory(categoryId) {
if (categoryId) {
API_GOODS.getGoodsSpecInfoSeller(categoryId).then((res) => {
if (res.length) {
res.forEach((e) => {
this.skuData.push(e.specName);
const vals = e.specValue ? e.specValue.split(",") : [];
this.skuVals.push(Array.from(new Set(vals)));
});
}
});
}
},
// 判断相同数组的值 // 判断相同数组的值
scalarArrayEquals(array1, array2) { scalarArrayEquals(array1, array2) {
return ( return (
@@ -2307,8 +2291,6 @@ export default {
this.GET_GoodsParams(); this.GET_GoodsParams();
/** 查询品牌列表 */ /** 查询品牌列表 */
this.getGoodsBrandList(); this.getGoodsBrandList();
/** 查询分类绑定的规格信息 */
this.Get_SkuInfoByCategory(this.categoryId);
// 获取商品单位 // 获取商品单位
this.GET_GoodsUnit(); this.GET_GoodsUnit();
// 获取当前店铺分类 // 获取当前店铺分类