校验问题处理

master
Chopper 2021-09-26 14:49:19 +08:00
parent 7ebb5e21d2
commit 642536f83e
7 changed files with 83 additions and 84 deletions

View File

@ -24,11 +24,11 @@ export const cashStatusList = [
label:'待处理' label:'待处理'
}, },
{ {
value:'REFUSE', value:'FAIL_AUDITING',
label:'拒绝' label:'拒绝'
}, },
{ {
value:'PASS', value:'VIA_AUDITING',
label:'通过' label:'通过'
} }
] ]
@ -46,4 +46,4 @@ export const orderStatusList = [
value:'COMPLETE_CASH', value:'COMPLETE_CASH',
label:'提现完成' label:'提现完成'
} }
] ]

View File

@ -1,24 +1,27 @@
<template> <template>
<div> <div>
<Card> <Card>
<Row @keydown.enter.native="handleSearch" > <Form ref="searchForm" :model="searchForm" class="search-form">
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form"> <Form-item label="会员名称" class="flex" prop="memberName">
<Form-item label="会员名称"> <Input
<Input class="search-input" v-model="searchForm.memberName"></Input> type="text" v-model="searchForm.memberName"
style="width: 200px"></Input>
</Form-item> </Form-item>
<Form-item label="编号"> <Form-item label="编号" class="flex">
<Input class="search-input" v-model="searchForm.sn"></Input> <Input
type="text" v-model="searchForm.sn"
style="width: 200px"></Input>
</Form-item> </Form-item>
<Form-item label="状态" style="margin-left: -20px"> <Form-item label="状态"
<Select v-model="searchForm.distributionCashStatus" style="width:150px;"> style="width: 200px">
<Select v-model="searchForm.distributionCashStatus" clearable style="width: 150px">
<Option v-for="item in cashStatusList" :value="item.value" :key="item.value">{{ item.label }}</Option> <Option v-for="item in cashStatusList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select> </Select>
</Form-item> </Form-item>
<Form-item style="margin-left:-35px;" class="br"> <Form-item>
<Button @click="handleSearch" type="primary">搜索</Button> <Button @click="handleSearch" type="primary">搜索</Button>
</Form-item> </Form-item>
</Form> </Form>
</Row>
<Table :loading="loading" border :columns="columns" :data="data" ref="table" class="mt_10"></Table> <Table :loading="loading" border :columns="columns" :data="data" ref="table" class="mt_10"></Table>
<Row type="flex" justify="end" class="page padding-row"> <Row type="flex" justify="end" class="page padding-row">
<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>

View File

@ -2,7 +2,7 @@
<div> <div>
<Card> <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="订单编号" prop="orderSn"> <Form-item label="订单编号" prop="orderSn">
<Input <Input
type="text" type="text"
v-model="searchForm.orderSn" v-model="searchForm.orderSn"
@ -86,6 +86,8 @@
searchForm: { // searchForm: { //
pageNumber: 1, // pageNumber: 1, //
pageSize: 10, // pageSize: 10, //
sort:"create_time",
order:"desc"
}, },
columns: [ columns: [
{ {

View File

@ -65,14 +65,14 @@
/> />
</FormItem> </FormItem>
</div> </div>
<FormItem label="分类名称" prop="name"> <FormItem label="分类名称" prop="articleCategoryName">
<Input <Input
v-model="formAdd.articleCategoryName" v-model="formAdd.articleCategoryName"
clearable clearable
style="width: 100%" style="width: 100%"
/> />
</FormItem> </FormItem>
<FormItem label="排序值" prop="sort" style="width: 345px"> <FormItem label="排序值" prop="sort">
<InputNumber v-model="formAdd.sort"></InputNumber> <InputNumber v-model="formAdd.sort"></InputNumber>
</FormItem> </FormItem>
</Form> </Form>
@ -94,7 +94,7 @@ import {
} from "@/api/pages"; } from "@/api/pages";
import TreeTable from "@/views/my-components/tree-table/Table/Table"; import TreeTable from "@/views/my-components/tree-table/Table/Table";
import uploadPicInput from "@/views/my-components/lili/upload-pic-input"; import uploadPicInput from "@/views/my-components/lili/upload-pic-input";
import { regular } from "@/utils";
export default { export default {
name: "lili-components", name: "lili-components",
components: { components: {
@ -119,7 +119,15 @@ export default {
level: 0, level: 0,
}, },
// //
formValidate: {}, formValidate: {
articleCategoryName:[
regular.REQUIRED,
],
sort:[
regular.REQUIRED,
regular.INTEGER
]
},
columns: [ columns: [
{ {
title: "分类名称", title: "分类名称",

View File

@ -3,10 +3,10 @@ var BASE = {
* @description api请求基础路径 * @description api请求基础路径
*/ */
API_DEV: { API_DEV: {
common: "https://common-api.pickmall.cn", common: 'http://192.168.0.100:8890',
buyer: "https://buyer-api.pickmall.cn", buyer: 'http://192.168.0.100:8888',
seller: "https://store-api.pickmall.cn", seller: 'http://192.168.0.100:8889',
manager: "https://admin-api.pickmall.cn" manager: 'http://192.168.0.100:8887'
}, },
API_PROD: { API_PROD: {
common: "https://common-api.pickmall.cn", common: "https://common-api.pickmall.cn",

View File

@ -38,6 +38,8 @@ export default {
// //
pageNumber: 1, // pageNumber: 1, //
pageSize: 10, // pageSize: 10, //
sort:"create_time",
order:"desc"
}, },
columns: [ columns: [
{ {

View File

@ -15,6 +15,9 @@
<Input type="text" v-model="baseInfoForm.goodsName" placeholder="商品名称" clearable style="width: 260px" /> <Input type="text" v-model="baseInfoForm.goodsName" placeholder="商品名称" clearable style="width: 260px" />
</FormItem> </FormItem>
<FormItem label="商品价格" prop="price">
<Input type="text" v-model="baseInfoForm.price" placeholder="商品价格" clearable style="width: 260px" />
</FormItem>
<FormItem label="商品卖点" prop="sellingPoint"> <FormItem label="商品卖点" prop="sellingPoint">
<Input v-model="baseInfoForm.sellingPoint" type="textarea" :rows="4" style="width: 260px" /> <Input v-model="baseInfoForm.sellingPoint" type="textarea" :rows="4" style="width: 260px" />
</FormItem> </FormItem>
@ -47,15 +50,6 @@
</div> </div>
<h4>商品规格及图片</h4> <h4>商品规格及图片</h4>
<div class="form-item-view"> <div class="form-item-view">
<FormItem label="商品编号" prop="sn">
<Input type="text" v-model="baseInfoForm.sn" placeholder="商品编号" clearable style="width: 260px" />
</FormItem>
<FormItem label="商品价格" prop="price">
<Input type="text" v-model="baseInfoForm.price" placeholder="商品价格" clearable style="width: 260px" />
</FormItem>
<FormItem label="市场价格" prop="cost">
<Input type="text" v-model="baseInfoForm.cost" placeholder="市场价格" clearable style="width: 260px" />
</FormItem>
<FormItem class="form-item-view-el required" label="商品图片" prop="goodsGalleryFiles"> <FormItem class="form-item-view-el required" label="商品图片" prop="goodsGalleryFiles">
<div style="display:flex;flex-wrap:flex-start;"> <div style="display:flex;flex-wrap:flex-start;">
<vuedraggable :list="baseInfoForm.goodsGalleryFiles" :animation="200"> <vuedraggable :list="baseInfoForm.goodsGalleryFiles" :animation="200">
@ -86,15 +80,15 @@
<img :src="previewGoodsPicture" v-if="goodsPictureVisible" style="width: 100%" /> <img :src="previewGoodsPicture" v-if="goodsPictureVisible" style="width: 100%" />
</Modal> </Modal>
</FormItem> </FormItem>
<div class="layout" style="width: 100%"> <div class="layout">
<Collapse v-model="open_panel"> <Collapse v-model="open_panel">
<Panel name="1"> <Panel name="1">
规格名称 自定义规格项
<div slot="content" class="sku-item-content"> <div slot="content" >
<Form> <Form>
<div class="sku-item" v-for="(item, $index) in skuInfo" :key="$index"> <div v-for="(item, $index) in skuInfo" :key="$index" class="sku-item-content">
<Card :bordered="true"> <Card :bordered="true" class="ivu-card-body">
<FormItem label="规格名" class="sku-item-content-name"> <FormItem label="规格名" :prop="'item.'+$index+'.name'" :rules="baseInfoFormRule.name" class="sku-item-content-val">
<AutoComplete style="width: 150px" v-model="item.name" :maxlength="30" <AutoComplete style="width: 150px" v-model="item.name" :maxlength="30"
placeholder="请输入规格项名称" :filter-method="filterMethod" :data="skuData" placeholder="请输入规格项名称" :filter-method="filterMethod" :data="skuData"
@on-change="editSkuItem"> @on-change="editSkuItem">
@ -102,30 +96,26 @@
<Button type="error" style="margin-left: 10px" @click="handleCloseSkuItem($index)"> <Button type="error" style="margin-left: 10px" @click="handleCloseSkuItem($index)">
</Button> </Button>
</FormItem> </FormItem>
<FormItem label="规格值:" prop="sku">
<!--规格值文本列表--> <!--规格值文本列表-->
<div v-for="(val, index) in item.spec_values" :key="index" <FormItem v-for="(val, index) in item.spec_values" :key="index" class="sku-item-content-val"
style="padding: 0px 20px 10px 0px; float: left"> label="规格项" :prop="'val.'+index+'.val'" :rules="baseInfoFormRule.value">
<div> <AutoComplete v-model="val.value" style="width: 150px" :maxlength="30"
<AutoComplete style="width: 150px; float: left" v-model="val.value" :maxlength="30" placeholder="请输入规格项" :filter-method="filterMethod" :data="skuVal"
placeholder="请输入规格值名称" :filter-method="filterMethod" :data="skuVal"
@on-focus="changeSkuVals(item.name)" @on-focus="changeSkuVals(item.name)"
@on-change="skuValueChange(val.value, $index, item)"> @on-change="skuValueChange(val.value, $index, item)">
</AutoComplete> </AutoComplete>
<Button type="error" style="margin-left: 10px" <Button type="error" style="margin-left: 10px"
@click="handleCloseSkuValue(item, index)"> @click="handleCloseSkuValue(item, index)">
删除 删除
</Button> </Button>
</div> </FormItem>
</div> <div>
<div style="float: left">
<Button @click="addSpec($index, item)">添加规格值</Button> <Button @click="addSpec($index, item)">添加规格值</Button>
</div> </div>
</FormItem>
</Card> </Card>
</div> </div>
</Form> </Form>
<Button class="add-sku-btn" type="primary" size="small" @click="addSkuItem"></Button> <Button class="add-sku-btn" type="primary" size="small" @click="addSkuItem"></Button>
</div> </div>
</Panel> </Panel>
<Panel name="2"> <Panel name="2">
@ -213,12 +203,6 @@
<div v-if="baseInfoForm.goodsType!='VIRTUAL_GOODS'"> <div v-if="baseInfoForm.goodsType!='VIRTUAL_GOODS'">
<h4>商品物流信息</h4> <h4>商品物流信息</h4>
<div class="form-item-view"> <div class="form-item-view">
<FormItem class="form-item-view-el" label="商品重量" prop="weight">
<Input v-model="baseInfoForm.weight">
<span slot="append">kg</span>
</Input>
</FormItem>
<FormItem class="form-item-view-el" label="物流模板" prop="templateId"> <FormItem class="form-item-view-el" label="物流模板" prop="templateId">
<Select v-model="baseInfoForm.templateId" style="width: 200px"> <Select v-model="baseInfoForm.templateId" style="width: 200px">
<Option v-for="item in logisticsTemplate" :value="item.id" :key="item.id">{{ item.name }} <Option v-for="item in logisticsTemplate" :value="item.id" :key="item.id">{{ item.name }}
@ -326,6 +310,8 @@ export default {
callback(new Error("商品编号不能为空")); callback(new Error("商品编号不能为空"));
} else if (!/^[a-zA-Z0-9_\\-]+$/g.test(value)) { } else if (!/^[a-zA-Z0-9_\\-]+$/g.test(value)) {
callback(new Error("请输入数字、字母、下划线或者中划线")); callback(new Error("请输入数字、字母、下划线或者中划线"));
} else if (value.length>30) {
callback(new Error("商品编号长度不能大于30"));
} else { } else {
callback(); callback();
} }
@ -365,8 +351,6 @@ export default {
/** 发布商品基本参数 */ /** 发布商品基本参数 */
baseInfoForm: { baseInfoForm: {
salesModel: "RETAIL", salesModel: "RETAIL",
/** 商品重量 */
weight: "",
/** 商品相册列表 */ /** 商品相册列表 */
goodsGalleryFiles: [], goodsGalleryFiles: [],
/** 是否立即发布 true 立即发布 false 放入仓库 */ /** 是否立即发布 true 立即发布 false 放入仓库 */
@ -422,36 +406,30 @@ export default {
validateError: [], validateError: [],
baseInfoFormRule: { baseInfoFormRule: {
goodsName: [ goodsName: [
{ required: true, message: "请输入商品名称" }, regular.REQUIRED,
{ regular.WHITE_SPACE,
whitespace: true, regular.VARCHAR60
message: "商品名称不可为纯空格",
},
{
min: 3,
max: 60,
message: "长度在 3 到 60 个字符",
},
], ],
sn: [ price:[
{ required: true, message: "请输入商品编号" }, regular.REQUIRED,
{ validator: checkSn },
],
price: [
{ required: true, message: "请输入商品价格" },
{ validator: checkPrice }, { validator: checkPrice },
], ],
cost: [ sellingPoint: [
{ required: true, message: "请输入市场价格" }, regular.REQUIRED,
{ validator: checkPrice }, regular.VARCHAR60
], ],
weight: [
{ required: true, message: "请输入商品重量" },
{ validator: checkWeight },
],
templateId: [{ required: true, message: "请选择物流模板" }],
sellingPoint: [{ required: true, message: "请输入商品卖点" }],
goodsUnit: [{ required: true, message: "请选择计量单位" }], goodsUnit: [{ required: true, message: "请选择计量单位" }],
name:[
regular.REQUIRED,
regular.VARCHAR5
],
value:[
regular.REQUIRED,
regular.VARCHAR60
],
templateId:[
regular.REQUIRED,
]
}, },
/** 品牌列表 */ /** 品牌列表 */
brandList: [], brandList: [],
@ -999,7 +977,7 @@ export default {
}, },
/** 数据改变之后 抛出数据 */ /** 数据改变之后 抛出数据 */
updateSkuTable(row, item, type = "deafult") { updateSkuTable(row, item, type = "deafult") {
let index = row._index; let index = row._index;
this.baseInfoForm.regeneratorSkuFlag = true; this.baseInfoForm.regeneratorSkuFlag = true;
/** 进行自定义校验 判断是否是数字(小数也能通过)重量 */ /** 进行自定义校验 判断是否是数字(小数也能通过)重量 */
@ -1065,6 +1043,10 @@ export default {
ids += e.id + ","; ids += e.id + ",";
}); });
ids = ids.substring(0, ids.length - 1); ids = ids.substring(0, ids.length - 1);
if(ids.length>100){
this.$Message.error("选择了过多的店铺分类,请谨慎选择");
}
this.baseInfoForm.storeCategoryPath = ids; this.baseInfoForm.storeCategoryPath = ids;
}, },
/** 添加商品 **/ /** 添加商品 **/
@ -1134,6 +1116,8 @@ export default {
} }
} else { } else {
this.submitLoading = false; this.submitLoading = false;
this.$Message.error("还有必填项未做处理,请检查表单");
} }
}); });
}, },
@ -1232,4 +1216,4 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./addGoods.scss"; @import "./addGoods.scss";
</style> </style>