Merge branch 'liushuai'

大部分为参数校验问题,以及部分商品字段优化
# Conflicts:
#	buyer/src/config/index.js
#	manager/src/config/index.js
#	seller/src/views/goods/goods-seller/draftGoods.vue
This commit is contained in:
Chopper
2021-09-26 16:12:24 +08:00
26 changed files with 401 additions and 157 deletions

View File

@@ -18,10 +18,10 @@
style="width: 200px"
/>
</Form-item>
<Form-item label="商品编号" prop="sn">
<Form-item label="商品编号" prop="id">
<Input
type="text"
v-model="searchForm.sn"
v-model="searchForm.id"
placeholder="请输入商品编号"
clearable
style="width: 200px"
@@ -149,21 +149,10 @@ export default {
},
{
title: "商品编号",
key: "sn",
key: "id",
minWidth: 150,
tooltip: true
},
{
title: "成本价",
key: "price",
width: 130,
render: (h, params) => {
return h(
"div",
this.$options.filters.unitPrice(params.row.cost, "¥")
);
},
},
{
title: "价格",
key: "price",

View File

@@ -18,10 +18,10 @@
style="width: 200px"
/>
</Form-item>
<Form-item label="商品编号" prop="sn">
<Form-item label="商品编号" prop="id">
<Input
type="text"
v-model="searchForm.sn"
v-model="searchForm.id"
placeholder="请输入商品编号"
clearable
style="width: 200px"
@@ -101,21 +101,10 @@
},
{
title: "商品编号",
key: "sn",
key: "id",
minWidth: 100,
tooltip: true
},
{
title: "成本价",
key: "price",
minWidth: 130,
render: (h, params) => {
return h(
"div",
this.$options.filters.unitPrice(params.row.cost, "¥")
);
},
},
{
title: "价格",
key: "price",

View File

@@ -1,9 +1,10 @@
<template>
<div class="search">
<Card>
<Form ref="searchForm" @keydown.enter.native="handleSearch" :model="searchForm" inline :label-width="70" class="search-form">
<Form ref="searchForm" @keydown.enter.native="handleSearch" :model="searchForm" inline :label-width="70"
class="search-form">
<Form-item label="品牌名称">
<Input type="text" v-model="searchForm.name" placeholder="请输入品牌名称" clearable style="width: 200px" />
<Input type="text" v-model="searchForm.name" placeholder="请输入品牌名称" clearable style="width: 200px"/>
</Form-item>
<Button @click="handleSearch" type="primary">搜索</Button>
</Form>
@@ -12,14 +13,15 @@
</Row>
<Table :loading="loading" border :columns="columns" :data="data" ref="table"></Table>
<Row type="flex" justify="end" class="mt_10">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small"
show-total show-elevator show-sizer></Page>
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage"
@on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small"
show-total show-elevator show-sizer></Page>
</Row>
</Card>
<Modal :title="modalTitle" v-model="modalVisible" :mask-closable="false" :width="500">
<Form ref="form" :model="form" :label-width="100" :rules="formValidate">
<FormItem label="品牌名称" prop="name">
<Input v-model="form.name" clearable style="width: 100%" />
<Input v-model="form.name" clearable style="width: 100%"/>
</FormItem>
<FormItem label="品牌图标" prop="logo">
<upload-pic-input v-model="form.logo" style="width: 100%"></upload-pic-input>
@@ -43,6 +45,8 @@ import {
} from "@/api/goods";
import uploadPicInput from "@/views/my-components/lili/upload-pic-input";
import {regular} from "@/utils";
export default {
name: "brand",
components: {
@@ -68,7 +72,16 @@ export default {
deleteFlag: "",
},
// 表单验证规则
formValidate: {},
formValidate: {
name: [
regular.REQUIRED,
regular.VARCHAR20
],
logo: [
regular.REQUIRED,
regular.URL200
],
},
submitLoading: false, // 添加或编辑提交状态
columns: [
{
@@ -104,9 +117,9 @@ export default {
align: "left",
render: (h, params) => {
if (params.row.deleteFlag == 0) {
return h("Tag", {props: {color: "green",},},"启用");
return h("Tag", {props: {color: "green",},}, "启用");
} else if (params.row.deleteFlag == 1) {
return h("Tag", {props: {color: "volcano",},},"禁用");
return h("Tag", {props: {color: "volcano",},}, "禁用");
}
},
filters: [
@@ -323,7 +336,7 @@ export default {
content: "您确认要启用品牌 " + v.name + " ?",
loading: true,
onOk: () => {
disableBrand(v.id, { disable: false }).then((res) => {
disableBrand(v.id, {disable: false}).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
@@ -340,7 +353,7 @@ export default {
content: "您确认要禁用品牌 " + v.name + " ?",
loading: true,
onOk: () => {
disableBrand(v.id, { disable: true }).then((res) => {
disableBrand(v.id, {disable: true}).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");

View File

@@ -171,9 +171,17 @@ export default {
// 表单验证规则
formValidate: {
commissionRate: [
{ required: true, message: "请填写佣金比例" },
{ pattern: regular.Integer, message: "佣金比例不能为负" },
regular.REQUIRED,
regular.INTEGER
],
name:[
regular.REQUIRED,
regular.VARCHAR20,
],
sortOrder:[
regular.REQUIRED,
regular.INTEGER
]
},
columns: [
{
@@ -475,4 +483,4 @@ export default {
min-height: 100vh;
height: auto;
}
</style>
</style>

View File

@@ -35,7 +35,8 @@
<span>
<i-button type="text" @click="handleEditParams(group, param)">编辑</i-button>
<i-button type="text" size="small" style="color: #f56c6c" @click="handleDeleteParam(group, param)">删除</i-button>
<i-button type="text" size="small" style="color: #f56c6c"
@click="handleDeleteParam(group, param)">删除</i-button>
</span>
</div>
</template>
@@ -52,7 +53,7 @@
<Modal :title="modalTitle" v-model="dialogParamsVisible" :mask-closable="false" :width="500">
<Form ref="paramForm" :model="paramForm" :label-width="100" :rules="formValidate">
<FormItem label="参数名称" prop="paramName">
<Input v-model="paramForm.paramName" style="width: 100%" />
<Input v-model="paramForm.paramName" style="width: 100%"/>
</FormItem>
<FormItem label="可选值" prop="options">
<Select
@@ -71,7 +72,7 @@
:key="item"
:label="item"
>
{{item}}
{{ item }}
</Option>
</Select>
</FormItem>
@@ -79,8 +80,8 @@
<Checkbox label=1 v-model="paramForm.required">必填</Checkbox>
<Checkbox label=1 v-model="paramForm.isIndex">可索引</Checkbox>
</FormItem>
<FormItem label="排序" prop="specName3">
<Input type="number" v-model="paramForm.sort" style="width: 100%" />
<FormItem label="排序" prop="sort">
<Input type="number" v-model="paramForm.sort" style="width: 100%"/>
</FormItem>
</Form>
@@ -95,7 +96,7 @@
<Modal :title="modalTitle" v-model="dialogParamsGroupVisible" :mask-closable="false" :width="500">
<Form ref="paramGroupForm" :model="paramGroupForm" :label-width="100" :rules="paramGroupValidate">
<FormItem label="参数名称" prop="groupName">
<Input v-model="paramGroupForm.groupName" style="width: 100%" />
<Input v-model="paramGroupForm.groupName" style="width: 100%"/>
</FormItem>
</Form>
@@ -117,6 +118,9 @@ import {
updateParamsGroup,
deleteParamsGroup,
} from "@/api/goods";
import {regular} from "@/utils";
export default {
name: "categoryParams",
data() {
@@ -136,7 +140,7 @@ export default {
//参数表单
paramForm: {},
/** 参数值 **/
ops:{
ops: {
options: []
},
// 参数表单
@@ -144,13 +148,23 @@ export default {
/** 添加、编辑参数 规格 */
formValidate: {
paramName: [
{ required: true, message: "参数名称不能为空", trigger: "blur" },
regular.REQUIRED,
regular.VARCHAR5
],
options: [
regular.REQUIRED,
regular.VARCHAR255
],
sort: [
regular.REQUIRED,
regular.INTEGER
],
},
/** 参数组*/
paramGroupValidate: {
groupName: [
{ required: true, message: "参数组名称不能为空", trigger: "blur" },
regular.REQUIRED,
regular.VARCHAR5
],
},
};
@@ -185,9 +199,9 @@ export default {
handleEditParams(group, param) {
this.paramForm = {
paramName: param.paramName,
options: param.options.split(","),
required: param.required==1?true:false,
isIndex: param.isIndex==1?true:false,
options: param.options.split(","),
required: param.required == 1 ? true : false,
isIndex: param.isIndex == 1 ? true : false,
groupId: group.groupId,
categoryId: this.categoryId,
sort: param.sort,
@@ -211,12 +225,8 @@ export default {
},
// 添加参数
handleAddParamsGroup() {
this.paramGroupForm = {
};
this.ops = {
};
this.paramGroupForm = {};
this.ops = {};
(this.paramGroupForm.categoryId = this.categoryId), (this.modalType = 0);
this.modalTitle = "添加参数组";
@@ -334,11 +344,12 @@ export default {
},
};
</script>
<style lang="scss" >
<style lang="scss">
.row {
overflow: hidden;
margin: 20px 0;
}
.params {
align-items: center;
display: flex;
@@ -347,6 +358,7 @@ export default {
font-size: 14px;
justify-content: space-between;
}
.ivu-card-head {
background-color: #f5f7fa;
}
@@ -354,6 +366,7 @@ export default {
.ivu-btn {
font-size: 13px;
}
.paramsGroup {
flex-wrap: wrap;
display: flex;

View File

@@ -56,7 +56,8 @@
:mask-closable="false"
:width="500"
>
<Form ref="form" :model="form" :label-width="100">
<Form ref="form" :model="form" :label-width="100"
:rules="formValidate">
<FormItem label="规格名称" prop="specName">
<Input v-model="form.specName" maxlength="30" clearable style="width: 100%"/>
</FormItem>
@@ -92,6 +93,7 @@ import {
delSpec
} from "@/api/goods";
import {regular} from "@/utils";
export default {
name: "spec",
components: {},
@@ -108,6 +110,17 @@ export default {
sort: "createTime", // 默认排序字段
order: "asc", // 默认排序方式
},
// 表单验证规则
formValidate: {
specName: [
regular.REQUIRED,
// regular.VARCHAR20
],
specValue: [
regular.REQUIRED,
regular.VARCHAR255
],
},
form: {
// 添加或编辑表单对象初始化数据
specName: "",
@@ -280,6 +293,7 @@ export default {
this.modalType = 0;
this.modalTitle = "添加";
this.$refs.form.resetFields();
this.specValue = '';
delete this.form.id;
this.modalVisible = true;
},