各种页面校验功能补充优化

This commit is contained in:
Chopper
2021-09-24 18:19:09 +08:00
parent 20042786aa
commit 7ebb5e21d2
13 changed files with 179 additions and 137 deletions

View File

@@ -61,7 +61,8 @@ export const TEL = /0\d{2,3}-\d{7,8}/
// 正整数
export const INTEGER = {
pattern: /^[0-9]\d*$/,
pattern: /^[0-9]\d{0,10}|0$/,
message:'请输入正整数'
}

View File

@@ -107,20 +107,23 @@ export default {
{
title: "库存",
key: "quantity",
minWidth: 80,
},
{
title: "添加时间",
key: "createTime",
width: 170,
minWidth: 100,
},
{
title: "店铺名称",
key: "storeName",
minWidth: 100,
tooltip: true,
},
{
title: "佣金金额",
key: "commission",
minWidth: 100,
sortable: false,
render: (h, params) => {
return h(
@@ -134,7 +137,7 @@ export default {
key: "action",
align: "center",
fixed: "right",
width: 150,
minWidth: 100,
render: (h, params) => {
return h("div", [
h(

View File

@@ -21,7 +21,7 @@
/>
</Form-item>
<Form-item label="店铺名称">
<Select v-model="searchForm.shopId" placeholder="请选择" @on-query-change="searchChange" filterable
<Select v-model="searchForm.storeId" placeholder="请选择" @on-query-change="searchChange" filterable
clearable style="width: 150px">
<Option v-for="item in shopList" :value="item.id" :key="item.id">{{ item.storeName }}</Option>
</Select>
@@ -91,17 +91,19 @@
{
title: "订单编号",
key: "orderSn",
minWidth: 100,
minWidth: 180,
fixed: "left",
tooltip: true
},
{
title: '商品信息',
slot: 'goodsMsg',
minWidth: 120
minWidth: 150
},
{
title: "退款金额",
key: "returnMoney",
minWidth:80,
sortable: false,
render: (h, params) => {
if(params.row.sellBackRebate == null){
@@ -114,23 +116,24 @@
{
title: "分销商",
key: "distributionName",
tooltip: true
tooltip: true,
minWidth:80,
},
{
title: "店铺名称",
key: "storeName",
minWidth:80,
tooltip: true
},
{
title: "状态",
slot: "distributionOrderStatus",
width: 120,
minWidth:80,
},
{
title: "佣金金额",
key: "rebateGrade",
width: 120,
minWidth:80,
sortable: false,
render: (h, params) => {
if(params.row.rebate == null){
@@ -142,9 +145,10 @@
}
},
{
fixed: "right",
title: "创建时间",
key: "createTime",
width: 180,
minWidth:100,
sortable: false,
}
],

View File

@@ -1,20 +1,20 @@
<template>
<div style="background-color: #fff;">
<Form ref="form" :model="form" :label-width="120" style="padding: 10px;">
<Form ref="form" :model="form" :rules="formRule" :label-width="120" style="padding: 10px;">
<Divider orientation="left">分销设置</Divider>
<FormItem label="是否开启分销" prop="distribution">
<FormItem label="是否开启分销" prop="isOpen">
<i-switch size="large" v-model="form.isOpen" :true-value="true" :false-value="false">
<span slot="open">开启</span>
<span slot="close">关闭</span>
</i-switch>
</FormItem>
<FormItem label="分销关系绑定天数" prop="distributionDay">
<InputNumber :min="1" style="width:100px;" v-model="form.distributionDay"></InputNumber>
<InputNumber :min="1" :max="365" style="width:100px;" v-model="form.distributionDay"></InputNumber>
</FormItem>
<FormItem label="分销结算天数" prop="cashDay">
<InputNumber :min="1" style="width:100px;" v-model="form.cashDay"></InputNumber>
<InputNumber :min="1" :max="365" style="width:100px;" v-model="form.cashDay"></InputNumber>
</FormItem>
<FormItem>
<Button type="primary" @click="submit">保存</Button>
@@ -25,15 +25,27 @@
<script>
import { setSetting, getSetting } from "@/api/index";
import { regular } from "@/utils";
export default {
name: "distributionSetting",
data() {
return {
form: {
// 添加或编辑表单对象初始化数据
isOpen: "",
isOpen: true,
distributionDay: 0, //分销关系绑定天数
cashDay: 0, //分销结算天数
},
formRule: {
isOpen: [
regular.REQUIRED
],
distributionDay: [
regular.REQUIRED
],
cashDay: [
regular.REQUIRED
],
}
};
},

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

@@ -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

@@ -114,7 +114,7 @@ export default {
formValidate: {
specName: [
regular.REQUIRED,
regular.VARCHAR20
// regular.VARCHAR20
],
specValue: [
regular.REQUIRED,