合并shuai分支 优化正则校验以及商品发布中样式 ,后续会优化商品发布中规格问题
commit
8a2a946bc1
|
@ -3,4 +3,7 @@
|
||||||
<component name="JavaScriptSettings">
|
<component name="JavaScriptSettings">
|
||||||
<option name="languageLevel" value="ES6" />
|
<option name="languageLevel" value="ES6" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="WebPackConfiguration">
|
||||||
|
<option name="mode" value="DISABLED" />
|
||||||
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -57,3 +57,34 @@ export const URL =
|
||||||
|
|
||||||
// 固话
|
// 固话
|
||||||
export const TEL = /0\d{2,3}-\d{7,8}/
|
export const TEL = /0\d{2,3}-\d{7,8}/
|
||||||
|
|
||||||
|
|
||||||
|
// 正整数
|
||||||
|
export const INTEGER = {
|
||||||
|
pattern: /^[0-9]\d*$/,
|
||||||
|
message:'请输入正整数'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const VARCHAR5 = {
|
||||||
|
pattern:/^.{1,5}$/,
|
||||||
|
message:'长度应该限制在1-5个字符'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const VARCHAR20 = {
|
||||||
|
pattern:/^.{1,20}$/,
|
||||||
|
message:'长度应该限制在1-20个字符'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const VARCHAR255 = {
|
||||||
|
pattern:/^.{1,255}$/,
|
||||||
|
message:'超出最大长度限制'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const URL200 = {
|
||||||
|
pattern:/[a-zA-z]+\:\/\/[^\s]{1,190}/,
|
||||||
|
message:'请输入长度不超过200的URL地址'
|
||||||
|
}
|
||||||
|
export const REQUIRED = {
|
||||||
|
required: true,
|
||||||
|
message:'请填写参数'
|
||||||
|
}
|
||||||
|
|
|
@ -57,6 +57,9 @@ import {
|
||||||
updateGoodsUnit,
|
updateGoodsUnit,
|
||||||
delGoodsUnit
|
delGoodsUnit
|
||||||
} from "@/api/index";
|
} from "@/api/index";
|
||||||
|
|
||||||
|
import {regular} from "@/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "goods-unit",
|
name: "goods-unit",
|
||||||
data() {
|
data() {
|
||||||
|
@ -79,12 +82,9 @@ export default {
|
||||||
// 表单验证规则
|
// 表单验证规则
|
||||||
formValidate: {
|
formValidate: {
|
||||||
name: [
|
name: [
|
||||||
{
|
regular.REQUIRED,
|
||||||
required: true,
|
regular.VARCHAR5
|
||||||
message: "请输入计量单位",
|
]
|
||||||
trigger: "blur",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
submitLoading: false, // 添加或编辑提交状态
|
submitLoading: false, // 添加或编辑提交状态
|
||||||
selectList: [], // 多选数据
|
selectList: [], // 多选数据
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<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="品牌名称">
|
<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>
|
</Form-item>
|
||||||
<Button @click="handleSearch" type="primary">搜索</Button>
|
<Button @click="handleSearch" type="primary">搜索</Button>
|
||||||
</Form>
|
</Form>
|
||||||
|
@ -12,14 +13,15 @@
|
||||||
</Row>
|
</Row>
|
||||||
<Table :loading="loading" border :columns="columns" :data="data" ref="table"></Table>
|
<Table :loading="loading" border :columns="columns" :data="data" ref="table"></Table>
|
||||||
<Row type="flex" justify="end" class="mt_10">
|
<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"
|
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage"
|
||||||
show-total show-elevator show-sizer></Page>
|
@on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small"
|
||||||
|
show-total show-elevator show-sizer></Page>
|
||||||
</Row>
|
</Row>
|
||||||
</Card>
|
</Card>
|
||||||
<Modal :title="modalTitle" v-model="modalVisible" :mask-closable="false" :width="500">
|
<Modal :title="modalTitle" v-model="modalVisible" :mask-closable="false" :width="500">
|
||||||
<Form ref="form" :model="form" :label-width="100" :rules="formValidate">
|
<Form ref="form" :model="form" :label-width="100" :rules="formValidate">
|
||||||
<FormItem label="品牌名称" prop="name">
|
<FormItem label="品牌名称" prop="name">
|
||||||
<Input v-model="form.name" clearable style="width: 100%" />
|
<Input v-model="form.name" clearable style="width: 100%"/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="品牌图标" prop="logo">
|
<FormItem label="品牌图标" prop="logo">
|
||||||
<upload-pic-input v-model="form.logo" style="width: 100%"></upload-pic-input>
|
<upload-pic-input v-model="form.logo" style="width: 100%"></upload-pic-input>
|
||||||
|
@ -43,6 +45,8 @@ import {
|
||||||
} from "@/api/goods";
|
} from "@/api/goods";
|
||||||
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: "brand",
|
name: "brand",
|
||||||
components: {
|
components: {
|
||||||
|
@ -68,7 +72,16 @@ export default {
|
||||||
deleteFlag: "",
|
deleteFlag: "",
|
||||||
},
|
},
|
||||||
// 表单验证规则
|
// 表单验证规则
|
||||||
formValidate: {},
|
formValidate: {
|
||||||
|
name: [
|
||||||
|
regular.REQUIRED,
|
||||||
|
regular.VARCHAR20
|
||||||
|
],
|
||||||
|
logo: [
|
||||||
|
regular.REQUIRED,
|
||||||
|
regular.URL200
|
||||||
|
],
|
||||||
|
},
|
||||||
submitLoading: false, // 添加或编辑提交状态
|
submitLoading: false, // 添加或编辑提交状态
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
|
@ -104,9 +117,9 @@ export default {
|
||||||
align: "left",
|
align: "left",
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
if (params.row.deleteFlag == 0) {
|
if (params.row.deleteFlag == 0) {
|
||||||
return h("Tag", {props: {color: "green",},},"启用");
|
return h("Tag", {props: {color: "green",},}, "启用");
|
||||||
} else if (params.row.deleteFlag == 1) {
|
} else if (params.row.deleteFlag == 1) {
|
||||||
return h("Tag", {props: {color: "volcano",},},"禁用");
|
return h("Tag", {props: {color: "volcano",},}, "禁用");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
filters: [
|
filters: [
|
||||||
|
@ -323,7 +336,7 @@ export default {
|
||||||
content: "您确认要启用品牌 " + v.name + " ?",
|
content: "您确认要启用品牌 " + v.name + " ?",
|
||||||
loading: true,
|
loading: true,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
disableBrand(v.id, { disable: false }).then((res) => {
|
disableBrand(v.id, {disable: false}).then((res) => {
|
||||||
this.$Modal.remove();
|
this.$Modal.remove();
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success("操作成功");
|
this.$Message.success("操作成功");
|
||||||
|
@ -340,7 +353,7 @@ export default {
|
||||||
content: "您确认要禁用品牌 " + v.name + " ?",
|
content: "您确认要禁用品牌 " + v.name + " ?",
|
||||||
loading: true,
|
loading: true,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
disableBrand(v.id, { disable: true }).then((res) => {
|
disableBrand(v.id, {disable: true}).then((res) => {
|
||||||
this.$Modal.remove();
|
this.$Modal.remove();
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success("操作成功");
|
this.$Message.success("操作成功");
|
||||||
|
|
|
@ -171,9 +171,17 @@ export default {
|
||||||
// 表单验证规则
|
// 表单验证规则
|
||||||
formValidate: {
|
formValidate: {
|
||||||
commissionRate: [
|
commissionRate: [
|
||||||
{ required: true, message: "请填写佣金比例" },
|
regular.REQUIRED,
|
||||||
{ pattern: regular.Integer, message: "佣金比例不能为负" },
|
regular.INTEGER
|
||||||
],
|
],
|
||||||
|
name:[
|
||||||
|
regular.REQUIRED,
|
||||||
|
regular.VARCHAR20,
|
||||||
|
],
|
||||||
|
sortOrder:[
|
||||||
|
regular.REQUIRED,
|
||||||
|
regular.INTEGER
|
||||||
|
]
|
||||||
},
|
},
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
|
@ -475,4 +483,4 @@ export default {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -56,7 +56,8 @@
|
||||||
:mask-closable="false"
|
:mask-closable="false"
|
||||||
:width="500"
|
:width="500"
|
||||||
>
|
>
|
||||||
<Form ref="form" :model="form" :label-width="100">
|
<Form ref="form" :model="form" :label-width="100"
|
||||||
|
:rules="formValidate">
|
||||||
<FormItem label="规格名称" prop="specName">
|
<FormItem label="规格名称" prop="specName">
|
||||||
<Input v-model="form.specName" maxlength="30" clearable style="width: 100%"/>
|
<Input v-model="form.specName" maxlength="30" clearable style="width: 100%"/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
@ -92,6 +93,7 @@ import {
|
||||||
delSpec
|
delSpec
|
||||||
} from "@/api/goods";
|
} from "@/api/goods";
|
||||||
|
|
||||||
|
import {regular} from "@/utils";
|
||||||
export default {
|
export default {
|
||||||
name: "spec",
|
name: "spec",
|
||||||
components: {},
|
components: {},
|
||||||
|
@ -108,6 +110,17 @@ export default {
|
||||||
sort: "createTime", // 默认排序字段
|
sort: "createTime", // 默认排序字段
|
||||||
order: "asc", // 默认排序方式
|
order: "asc", // 默认排序方式
|
||||||
},
|
},
|
||||||
|
// 表单验证规则
|
||||||
|
formValidate: {
|
||||||
|
specName: [
|
||||||
|
regular.REQUIRED,
|
||||||
|
regular.VARCHAR20
|
||||||
|
],
|
||||||
|
specValue: [
|
||||||
|
regular.REQUIRED,
|
||||||
|
regular.VARCHAR255
|
||||||
|
],
|
||||||
|
},
|
||||||
form: {
|
form: {
|
||||||
// 添加或编辑表单对象初始化数据
|
// 添加或编辑表单对象初始化数据
|
||||||
specName: "",
|
specName: "",
|
||||||
|
@ -280,6 +293,7 @@ export default {
|
||||||
this.modalType = 0;
|
this.modalType = 0;
|
||||||
this.modalTitle = "添加";
|
this.modalTitle = "添加";
|
||||||
this.$refs.form.resetFields();
|
this.$refs.form.resetFields();
|
||||||
|
this.specValue = '';
|
||||||
delete this.form.id;
|
delete this.form.id;
|
||||||
this.modalVisible = true;
|
this.modalVisible = true;
|
||||||
},
|
},
|
||||||
|
|
|
@ -63,7 +63,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
handleSubmit, // 验证规则
|
handleSubmit, // 验证规则
|
||||||
|
|
||||||
picModelFlag: false, // 预览图片显隐
|
picModelFlag: false, // 预览图片显隐
|
||||||
formValidate: { // 表单数据
|
formValidate: { // 表单数据
|
||||||
buyerSideLogo: "",
|
buyerSideLogo: "",
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
<template>
|
||||||
|
<div class="layout">
|
||||||
|
<Form ref="formValidate" :label-width="150" label-position="right" :model="formValidate" :rules="ruleValidate">
|
||||||
|
<FormItem label="云IM地址" prop="httpUrl">
|
||||||
|
<Input v-model="formValidate.httpUrl"/>
|
||||||
|
</FormItem>
|
||||||
|
<FormItem label="平台ID" class="label-item" prop="tenantId">
|
||||||
|
<Input v-model="formValidate.tenantId"/>
|
||||||
|
</FormItem>
|
||||||
|
<div class="label-btns">
|
||||||
|
<Button type="primary" @click="submit('formValidate')">保存</Button>
|
||||||
|
</div>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import {setSetting} from "@/api/index";
|
||||||
|
import {handleSubmit} from "./validate";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
ruleValidate: {}, // 验证规则
|
||||||
|
formValidate: { // 表单数据
|
||||||
|
httpUrl: "",
|
||||||
|
tenantId: ""
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
props: ["res", "type"],
|
||||||
|
created() {
|
||||||
|
this.init();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 保存
|
||||||
|
submit(name) {
|
||||||
|
let that = this;
|
||||||
|
if (handleSubmit(that, name)) {
|
||||||
|
this.setupSetting()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 保存设置
|
||||||
|
setupSetting() {
|
||||||
|
setSetting(this.type, this.formValidate).then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
this.$Message.success("保存成功!");
|
||||||
|
} else {
|
||||||
|
this.$Message.error("保存失败!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 实例化数据
|
||||||
|
init() {
|
||||||
|
this.res = JSON.parse(this.res);
|
||||||
|
|
||||||
|
this.$set(this, "formValidate", {...this.res});
|
||||||
|
Object.keys(this.formValidate).forEach((item) => {
|
||||||
|
this.ruleValidate[item] = [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请填写必填项",
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@import "./style.scss";
|
||||||
|
|
||||||
|
.label-item {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/ .ivu-input {
|
||||||
|
width: 300px !important;
|
||||||
|
margin: 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ivu-input-wrapper {
|
||||||
|
width: 300px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -57,6 +57,11 @@ export default {
|
||||||
type: "SMS_SETTING",
|
type: "SMS_SETTING",
|
||||||
name: "阿里短信配置",
|
name: "阿里短信配置",
|
||||||
},
|
},
|
||||||
|
//阿里短信配置
|
||||||
|
{
|
||||||
|
type: "IM_SETTING",
|
||||||
|
name: "客服设置",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
authLogin: [
|
authLogin: [
|
||||||
// 微信设置
|
// 微信设置
|
||||||
|
|
|
@ -5,6 +5,7 @@ import POINT_SETTING from "./setting/POINT_SETTING";
|
||||||
import KUAIDI_SETTING from "./setting/KUAIDI_SETTING";
|
import KUAIDI_SETTING from "./setting/KUAIDI_SETTING";
|
||||||
import OSS_SETTING from "./setting/OSS_SETTING";
|
import OSS_SETTING from "./setting/OSS_SETTING";
|
||||||
import SMS_SETTING from "./setting/SMS_SETTING";
|
import SMS_SETTING from "./setting/SMS_SETTING";
|
||||||
|
import IM_SETTING from "./setting/IM_SETTING";
|
||||||
import WITHDRAWAL_SETTING from "./setting/WITHDRAWAL_SETTING";
|
import WITHDRAWAL_SETTING from "./setting/WITHDRAWAL_SETTING";
|
||||||
import ALIPAY_PAYMENT from "./pay/ALIPAY_PAYMENT";
|
import ALIPAY_PAYMENT from "./pay/ALIPAY_PAYMENT";
|
||||||
import WECHAT_PAYMENT from "./pay/WECHAT_PAYMENT";
|
import WECHAT_PAYMENT from "./pay/WECHAT_PAYMENT";
|
||||||
|
@ -20,6 +21,7 @@ export default {
|
||||||
KUAIDI_SETTING,
|
KUAIDI_SETTING,
|
||||||
OSS_SETTING,
|
OSS_SETTING,
|
||||||
SMS_SETTING,
|
SMS_SETTING,
|
||||||
|
IM_SETTING,
|
||||||
WITHDRAWAL_SETTING,
|
WITHDRAWAL_SETTING,
|
||||||
PAYMENT_SUPPORT,
|
PAYMENT_SUPPORT,
|
||||||
WECHAT_PAYMENT,
|
WECHAT_PAYMENT,
|
||||||
|
|
|
@ -76,7 +76,15 @@
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.sku-val{
|
||||||
|
justify-content: flex-start;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
>.sku-item-content-val{
|
||||||
|
|
||||||
|
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
div.base-info-item {
|
div.base-info-item {
|
||||||
h4 {
|
h4 {
|
||||||
|
@ -104,15 +112,23 @@ div.base-info-item {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
|
|
||||||
.sku-item-content {
|
.sku-item-content {
|
||||||
|
margin: 20px 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
width: 100% !important;
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
justify-content: center;
|
justify-content: flex-start;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
>.ivu-card-body{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.sku-item-content-name {
|
.sku-item-content-name {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
|
justify-content: flex-start;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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">
|
||||||
|
@ -89,43 +83,46 @@
|
||||||
<div class="layout" style="width: 100%">
|
<div class="layout" style="width: 100%">
|
||||||
<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">
|
<Button type="primary" slot="extra" @click="handleCloseSkuItem($index)">
|
||||||
|
删除规格
|
||||||
|
</Button>
|
||||||
|
<FormItem label="规格名" :prop="'item.'+$index+'.name'" :rules="baseInfoFormRule.name"
|
||||||
|
class="sku-item-content-val flex">
|
||||||
<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">
|
||||||
</AutoComplete>
|
</AutoComplete>
|
||||||
<Button type="error" style="margin-left: 10px" @click="handleCloseSkuItem($index)">删除
|
|
||||||
</Button>
|
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="规格值:" prop="sku">
|
<div class="flex sku-val">
|
||||||
<!--规格值文本列表-->
|
<!--规格值文本列表-->
|
||||||
<div v-for="(val, index) in item.spec_values" :key="index"
|
<FormItem v-for="(val, index) in item.spec_values" :key="index"
|
||||||
style="padding: 0px 20px 10px 0px; float: left">
|
class="sku-item-content-val flex" label="规格项" :prop="'spec_values.'+index"
|
||||||
<div>
|
:rules="[regular.REQUIRED, regular.VARCHAR60]">
|
||||||
<AutoComplete style="width: 150px; float: left" v-model="val.value" :maxlength="30"
|
<AutoComplete v-model="val.value" style="width: 150px" :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="primary" size="small" style="margin-left: 10px"
|
||||||
@click="handleCloseSkuValue(item, index)">
|
@click="handleCloseSkuValue(item, index)">
|
||||||
删除
|
删除
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</FormItem>
|
||||||
</div>
|
|
||||||
<div style="float: left">
|
</div>
|
||||||
<Button @click="addSpec($index, item)">添加规格值</Button>
|
<div>
|
||||||
</div>
|
<Button @click="addSpec($index, item)">添加规格值</Button>
|
||||||
</FormItem>
|
</div>
|
||||||
</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">
|
||||||
|
@ -166,7 +163,7 @@
|
||||||
<img v-if="previewPicture !== ''" :src="previewPicture" />
|
<img v-if="previewPicture !== ''" :src="previewPicture" />
|
||||||
</div>
|
</div>
|
||||||
<Divider />
|
<Divider />
|
||||||
<vuedraggable :list="selectedSku.images" :animation="200" style="display:inline-block;">
|
<vuedraggable :list="selectedSku.images" :animation="200" style="display:inline-block;">
|
||||||
<div class="sku-upload-list" v-for="(img, __index) in selectedSku.images" :key="__index">
|
<div class="sku-upload-list" v-for="(img, __index) in selectedSku.images" :key="__index">
|
||||||
<template>
|
<template>
|
||||||
<img :src="img.url" />
|
<img :src="img.url" />
|
||||||
|
@ -213,12 +210,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 }}
|
||||||
|
@ -305,6 +296,7 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
||||||
// 表单验证项,商品价格
|
// 表单验证项,商品价格
|
||||||
const checkPrice = (rule, value, callback) => {
|
const checkPrice = (rule, value, callback) => {
|
||||||
if (!value && value !== 0) {
|
if (!value && value !== 0) {
|
||||||
|
@ -326,6 +318,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();
|
||||||
}
|
}
|
||||||
|
@ -343,6 +337,7 @@ export default {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
|
regular,
|
||||||
accessToken: "", //令牌token
|
accessToken: "", //令牌token
|
||||||
goodsParams: "",
|
goodsParams: "",
|
||||||
categoryId: "", // 商品分类第三级id
|
categoryId: "", // 商品分类第三级id
|
||||||
|
@ -365,8 +360,6 @@ export default {
|
||||||
/** 发布商品基本参数 */
|
/** 发布商品基本参数 */
|
||||||
baseInfoForm: {
|
baseInfoForm: {
|
||||||
salesModel: "RETAIL",
|
salesModel: "RETAIL",
|
||||||
/** 商品重量 */
|
|
||||||
weight: "",
|
|
||||||
/** 商品相册列表 */
|
/** 商品相册列表 */
|
||||||
goodsGalleryFiles: [],
|
goodsGalleryFiles: [],
|
||||||
/** 是否立即发布 true 立即发布 false 放入仓库 */
|
/** 是否立即发布 true 立即发布 false 放入仓库 */
|
||||||
|
@ -421,37 +414,13 @@ export default {
|
||||||
/** 存储未通过校验的单元格位置 */
|
/** 存储未通过校验的单元格位置 */
|
||||||
validateError: [],
|
validateError: [],
|
||||||
baseInfoFormRule: {
|
baseInfoFormRule: {
|
||||||
goodsName: [
|
goodsName: [regular.REQUIRED, regular.WHITE_SPACE, regular.VARCHAR60],
|
||||||
{ required: true, message: "请输入商品名称" },
|
price: [regular.REQUIRED, { validator: checkPrice }],
|
||||||
{
|
sellingPoint: [regular.REQUIRED, regular.VARCHAR60],
|
||||||
whitespace: true,
|
|
||||||
message: "商品名称不可为纯空格",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
min: 3,
|
|
||||||
max: 60,
|
|
||||||
message: "长度在 3 到 60 个字符",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
sn: [
|
|
||||||
{ required: true, message: "请输入商品编号" },
|
|
||||||
{ validator: checkSn },
|
|
||||||
],
|
|
||||||
price: [
|
|
||||||
{ required: true, message: "请输入商品价格" },
|
|
||||||
{ validator: checkPrice },
|
|
||||||
],
|
|
||||||
cost: [
|
|
||||||
{ required: true, message: "请输入市场价格" },
|
|
||||||
{ validator: checkPrice },
|
|
||||||
],
|
|
||||||
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: [],
|
||||||
|
@ -507,9 +476,9 @@ export default {
|
||||||
paramName: "",
|
paramName: "",
|
||||||
paramValue: "",
|
paramValue: "",
|
||||||
isIndex: "",
|
isIndex: "",
|
||||||
required: "",
|
// required: "",
|
||||||
paramId: "",
|
paramId: "",
|
||||||
sort: ""
|
sort: "",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
this.baseInfoForm.goodsParamsDTOList[groupIndex].goodsParamsItemDTOList[
|
this.baseInfoForm.goodsParamsDTOList[groupIndex].goodsParamsItemDTOList[
|
||||||
|
@ -518,9 +487,9 @@ export default {
|
||||||
paramName: params.paramName,
|
paramName: params.paramName,
|
||||||
paramValue: value,
|
paramValue: value,
|
||||||
isIndex: params.isIndex,
|
isIndex: params.isIndex,
|
||||||
required: params.required,
|
// required: params.required,
|
||||||
paramId: params.id,
|
paramId: params.id,
|
||||||
sort: params.sort
|
sort: params.sort,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
// 编辑sku图片
|
// 编辑sku图片
|
||||||
|
@ -900,11 +869,11 @@ export default {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.baseInfoForm.goodsType != "VIRTUAL_GOODS"
|
this.baseInfoForm.goodsType != "VIRTUAL_GOODS"
|
||||||
? pushData.push({
|
? pushData.push({
|
||||||
title: "重量",
|
title: "重量",
|
||||||
slot: "weight",
|
slot: "weight",
|
||||||
})
|
})
|
||||||
: "";
|
: "";
|
||||||
pushData.push(
|
pushData.push(
|
||||||
{
|
{
|
||||||
|
@ -949,7 +918,7 @@ export default {
|
||||||
cloneTemp.splice(0, 1);
|
cloneTemp.splice(0, 1);
|
||||||
result = this.specIterator(result, cloneTemp);
|
result = this.specIterator(result, cloneTemp);
|
||||||
this.skuTableData = result;
|
this.skuTableData = result;
|
||||||
console.log(this.skuTableData)
|
console.log(this.skuTableData);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
@ -999,7 +968,6 @@ 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 +1033,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 +1106,8 @@ export default {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.submitLoading = false;
|
this.submitLoading = false;
|
||||||
|
|
||||||
|
this.$Message.error("还有必填项未做处理,请检查表单");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -1232,4 +1206,4 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import "./addGoods.scss";
|
@import "./addGoods.scss";
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue