分类参数必填校验

This commit is contained in:
chc
2025-03-11 19:09:05 +08:00
parent fb1671d062
commit 11319ba21f

View File

@@ -10,28 +10,27 @@
<div class="form-item-view"> <div class="form-item-view">
<FormItem label="商品分类"> <FormItem label="商品分类">
<span class="goods-category-name">{{ <span class="goods-category-name">{{
this.baseInfoForm.categoryName[0] this.baseInfoForm.categoryName[0]
}}</span> }}</span>
<span> &gt; {{ this.baseInfoForm.categoryName[1] }}</span> <span> &gt; {{ this.baseInfoForm.categoryName[1] }}</span>
<span> &gt; {{ this.baseInfoForm.categoryName[2] }}</span> <span> &gt; {{ this.baseInfoForm.categoryName[2] }}</span>
</FormItem> </FormItem>
<FormItem label="商品名称" prop="goodsName"> <FormItem label="商品名称" prop="goodsName">
<Input v-model="baseInfoForm.goodsName" clearable placeholder="商品名称" style="width: 260px" <Input v-model="baseInfoForm.goodsName" clearable placeholder="商品名称" style="width: 260px" type="text" />
type="text"/>
</FormItem> </FormItem>
<FormItem label="商品价格" prop="price"> <FormItem label="商品价格" prop="price">
<Input v-model="baseInfoForm.price" clearable placeholder="商品价格" style="width: 260px" type="text"/> <Input v-model="baseInfoForm.price" clearable placeholder="商品价格" style="width: 260px" type="text" />
</FormItem> </FormItem>
<FormItem label="商品卖点" prop="sellingPoint"> <FormItem label="商品卖点" prop="sellingPoint">
<Input v-model="baseInfoForm.sellingPoint" :rows="4" style="width: 260px" type="textarea"/> <Input v-model="baseInfoForm.sellingPoint" :rows="4" style="width: 260px" type="textarea" />
</FormItem> </FormItem>
<FormItem label="商品品牌" prop="brandId"> <FormItem label="商品品牌" prop="brandId">
<Select v-model="baseInfoForm.brandId" filterable style="width: 200px"> <Select v-model="baseInfoForm.brandId" filterable style="width: 200px">
<Option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id"></Option> <Option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id"></Option>
</Select> </Select>
<Button class="refresh-icon" icon="md-refresh" shape="circle" type="text" <Button class="refresh-icon" icon="md-refresh" shape="circle" type="text"
@click="refresh('brand')"></Button> @click="refresh('brand')"></Button>
</FormItem> </FormItem>
</div> </div>
<h4>商品交易信息</h4> <h4>商品交易信息</h4>
@@ -42,11 +41,11 @@
</Option> </Option>
</Select> </Select>
<Button class="refresh-icon" icon="md-refresh" shape="circle" type="text" <Button class="refresh-icon" icon="md-refresh" shape="circle" type="text"
@click="refresh('goodsUnit')"></Button> @click="refresh('goodsUnit')"></Button>
</FormItem> </FormItem>
<FormItem class="form-item-view-el" label="销售模式" prop="salesModel"> <FormItem class="form-item-view-el" label="销售模式" prop="salesModel">
<RadioGroup v-if="baseInfoForm.goodsType != 'VIRTUAL_GOODS'" v-model="baseInfoForm.salesModel" <RadioGroup v-if="baseInfoForm.goodsType != 'VIRTUAL_GOODS'" v-model="baseInfoForm.salesModel"
button-style="solid" type="button" @on-change="renderTableData(skuTableData)"> button-style="solid" type="button" @on-change="renderTableData(skuTableData)">
<Radio label="RETAIL" title="零售型">零售型</Radio> <Radio label="RETAIL" title="零售型">零售型</Radio>
<Radio label="WHOLESALE" title="批发型">批发型</Radio> <Radio label="WHOLESALE" title="批发型">批发型</Radio>
</RadioGroup> </RadioGroup>
@@ -57,17 +56,17 @@
</RadioGroup> </RadioGroup>
</FormItem> </FormItem>
<FormItem v-if="baseInfoForm.salesModel == 'WHOLESALE'" class="form-item-view-el" label="销售规则" <FormItem v-if="baseInfoForm.salesModel == 'WHOLESALE'" class="form-item-view-el" label="销售规则"
prop="wholesaleRule"> prop="wholesaleRule">
<div class="form-item-view-wholesale"> <div class="form-item-view-wholesale">
<div> <div>
<Table :columns="wholesaleColumns" :data="wholesaleData" border> <Table :columns="wholesaleColumns" :data="wholesaleData" border>
<template slot="wholesaleNum" slot-scope="{ row, index }"> <template slot="wholesaleNum" slot-scope="{ row, index }">
<div> <div>
<Input v-model="wholesaleData[index].num" min="1" number type="number" <Input v-model="wholesaleData[index].num" min="1" number type="number"
@on-blur="checkWholesaleNum(index)"> @on-blur="checkWholesaleNum(index)">
<span slot="append">{{ <span slot="append">{{
baseInfoForm.goodsUnit || "" baseInfoForm.goodsUnit || ""
}}</span> }}</span>
</Input> </Input>
</div> </div>
</template> </template>
@@ -78,18 +77,18 @@
align-items: center; align-items: center;
"> ">
<Input v-model="wholesaleData[index].price" min="1" number style="width: 190px" type="number" <Input v-model="wholesaleData[index].price" min="1" number style="width: 190px" type="number"
@on-blur="checkWholesalePrice(index)"> @on-blur="checkWholesalePrice(index)">
<span slot="append"></span> <span slot="append"></span>
</Input> </Input>
<Button v-if="index > 0" size="small" style="margin-left: 5px" type="error" <Button v-if="index > 0" size="small" style="margin-left: 5px" type="error"
@click="handleDeleteWholesaleData(index)">删除 @click="handleDeleteWholesaleData(index)">删除
</Button> </Button>
</div> </div>
</template> </template>
</Table> </Table>
<Button v-if="wholesaleData.length < 3" icon="md-add" style="margin-top: 10px" <Button v-if="wholesaleData.length < 3" icon="md-add" style="margin-top: 10px"
@click="handleAddWholesaleData()"> @click="handleAddWholesaleData()">
添加价格区间 添加价格区间
</Button> </Button>
</div> </div>
@@ -105,9 +104,9 @@
<div style="display: flex; flex-wrap: wrap;"> <div style="display: flex; flex-wrap: wrap;">
<vuedraggable :animation="200" :list="baseInfoForm.goodsGalleryFiles"> <vuedraggable :animation="200" :list="baseInfoForm.goodsGalleryFiles">
<div v-for="(item, __index) in baseInfoForm.goodsGalleryFiles" :key="__index" <div v-for="(item, __index) in baseInfoForm.goodsGalleryFiles" :key="__index"
class="demo-upload-list"> class="demo-upload-list">
<template> <template>
<img :src="item"/> <img :src="item" />
<div class="demo-upload-list-cover"> <div class="demo-upload-list-cover">
<div> <div>
<Icon size="30" type="md-search" @click.native="handleViewGoodsPicture(item)"></Icon> <Icon size="30" type="md-search" @click.native="handleViewGoodsPicture(item)"></Icon>
@@ -118,24 +117,24 @@
</div> </div>
</vuedraggable> </vuedraggable>
<!--<Upload ref="upload"--> <!--<Upload ref="upload"-->
<!--:action="uploadFileUrl" :before-upload="handleBeforeUploadGoodsPicture"--> <!--:action="uploadFileUrl" :before-upload="handleBeforeUploadGoodsPicture"-->
<!--:format="['jpg', 'jpeg', 'png', 'webp']"--> <!--:format="['jpg', 'jpeg', 'png', 'webp']"-->
<!--:headers="{ ...accessToken }"--> <!--:headers="{ ...accessToken }"-->
<!--:max-size="2048" :on-error="() => { $Spin.hide(); }" :on-exceeded-size="handleMaxSize"--> <!--:max-size="2048" :on-error="() => { $Spin.hide(); }" :on-exceeded-size="handleMaxSize"-->
<!--:on-format-error="handleFormatError" :on-progress="() => { $Spin.show(); }"--> <!--:on-format-error="handleFormatError" :on-progress="() => { $Spin.show(); }"-->
<!--:on-success="handleSuccessGoodsPicture" :show-upload-list="false" multiple--> <!--:on-success="handleSuccessGoodsPicture" :show-upload-list="false" multiple-->
<!--style="margin-left: 10px"--> <!--style="margin-left: 10px"-->
<!--type="drag">--> <!--type="drag">-->
<!--<div style="width: 148px; height: 148px; line-height: 148px">--> <!--<div style="width: 148px; height: 148px; line-height: 148px">-->
<!--<Icon size="20" type="md-add"></Icon>--> <!--<Icon size="20" type="md-add"></Icon>-->
<!--</div>--> <!--</div>-->
<!--</Upload>--> <!--</Upload>-->
</div> </div>
<div style="width: 100%;display: flex;justify-content: start;margin-top: 10px;"> <div style="width: 100%;display: flex;justify-content: start;margin-top: 10px;">
<Button @click="handleCLickImg('goodsGalleryFiles')" type="primary">上传图片</Button> <Button @click="handleCLickImg('goodsGalleryFiles')" type="primary">上传图片</Button>
</div> </div>
<Modal v-model="goodsPictureVisible" title="View Image"> <Modal v-model="goodsPictureVisible" title="View Image">
<img v-if="goodsPictureVisible" :src="previewGoodsPicture" style="width: 100%"/> <img v-if="goodsPictureVisible" :src="previewGoodsPicture" style="width: 100%" />
</Modal> </Modal>
</FormItem> </FormItem>
<FormItem> <FormItem>
@@ -145,23 +144,20 @@
<div class="goods-video"> <div class="goods-video">
<div v-if="baseInfoForm.goodsVideo"> <div v-if="baseInfoForm.goodsVideo">
<div> <div>
<video :src="baseInfoForm.goodsVideo" class="video" controls style="max-width: 300px;"/> <video :src="baseInfoForm.goodsVideo" class="video" controls style="max-width: 300px;" />
</div> </div>
</div> </div>
<Upload ref="upload" :action="uploadFileUrl" :format="['avi', 'wmv', 'mpeg', 'mp4', 'mov']" <Upload ref="upload" :action="uploadFileUrl" :format="['avi', 'wmv', 'mpeg', 'mp4', 'mov']"
:headers="{ ...accessToken }" :headers="{ ...accessToken }" :max-size="10240" :on-error="() => { loadingVideo = false }"
:max-size="10240" :on-error="() => { loadingVideo = false }" :on-exceeded-size="handleVideoMaxSize" :on-format-error="handleFormatError"
:on-exceeded-size="handleVideoMaxSize" :on-progress="() => { loadingVideo = true }" :on-success="handleSuccessGoodsVideo"
:on-format-error="handleFormatError" :on-progress="() => { loadingVideo = true }" :show-upload-list="false" multiple style="margin-left: 10px" type="drag">
:on-success="handleSuccessGoodsVideo" :show-upload-list="false"
multiple
style="margin-left: 10px" type="drag">
<Button :loading="loadingVideo" icon="ios-cloud-upload-outline" type="text"> <Button :loading="loadingVideo" icon="ios-cloud-upload-outline" type="text">
<span v-if="!loadingVideo"> <span v-if="!loadingVideo">
{{ baseInfoForm.goodsVideo ? "" : "" }}上传视频 {{ baseInfoForm.goodsVideo ? "" : "" }}上传视频
</span> </span>
<span v-else> <span v-else>
正在上传... 正在上传...
</span> </span>
</Button> </Button>
</Upload> </Upload>
@@ -176,19 +172,21 @@
<div v-for="(item, $index) in skuInfo" :key="$index" class="sku-item-content"> <div v-for="(item, $index) in skuInfo" :key="$index" class="sku-item-content">
<Card :bordered="true" class="ivu-card-body"> <Card :bordered="true" class="ivu-card-body">
<a slot="extra" style="margin-left: 6px"> <a slot="extra" style="margin-left: 6px">
<Icon size="20" type="md-trash" @click="handleCloseSkuItem($index, item)"></Icon> <Icon size="20" type="md-trash" @click="handleCloseSkuItem($index, item)"></Icon>
</a> </a>
<div> <div>
<div style="display: flex;margin-bottom: 10px;font-weight: bold">规格项</div> <div style="display: flex;margin-bottom: 10px;font-weight: bold">规格项</div>
<FormItem class="sku-item-content-val flex" label=""> <FormItem class="sku-item-content-val flex" label="">
<div> <div>
<AutoComplete v-model="item.name" :filter-method="filterMethod" <AutoComplete v-model="item.name" :filter-method="filterMethod" :maxlength="30"
:maxlength="30" placeholder="请输入规格项名称" style="width: 150px" placeholder="请输入规格项名称" style="width: 150px" @on-focus="changeSkuItem(item.name)"
@on-focus="changeSkuItem(item.name)" @on-change="editSkuItem(item.name, $index, item)"> @on-change="editSkuItem(item.name, $index, item)">
</AutoComplete> </AutoComplete>
<iSwitch v-if="$index === 0" style="margin-left: 10px" size="small" @on-change="changeSkuOpenImage" v-model="openImage" /><span v-if="$index === 0" style="margin-left: 5px">添加规格图片</span> <iSwitch v-if="$index === 0" style="margin-left: 10px" size="small"
@on-change="changeSkuOpenImage" v-model="openImage" /><span v-if="$index === 0"
style="margin-left: 5px">添加规格图片</span>
</div> </div>
</FormItem> </FormItem>
@@ -198,57 +196,45 @@
<Form :model="item" class="flex"> <Form :model="item" class="flex">
<!--规格值文本列表--> <!--规格值文本列表-->
<FormItem 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 flex" label="" style="line-height: 32px;"> class="sku-item-content-val flex" label="" style="line-height: 32px;">
<div style="display: flex; justify-content: center; align-items: center;"> <div style="display: flex; justify-content: center; align-items: center;">
<AutoComplete ref="input" v-model="val.value" <AutoComplete ref="input" v-model="val.value" :disabled="containsSameSkuItem"
:disabled="containsSameSkuItem" :filter-method="filterMethod" :maxlength="30" placeholder="请输入规格值"
:filter-method="filterMethod" style="width: 180px" @on-focus="changeSkuVals(val, item.name)"
:maxlength="30" placeholder="请输入规格值" style="width: 180px" @on-blur="checkSkuVal(val, $index, item)"
@on-focus="changeSkuVals(val, item.name)" @on-change="skuValueChange(val, index, item)">
@on-blur="checkSkuVal(val, $index, item)"
@on-change="skuValueChange(val, index, item)">
</AutoComplete> </AutoComplete>
<a style="margin-left: 6px" v-if="val.value && val.value !== ''"> <a style="margin-left: 6px" v-if="val.value && val.value !== ''">
<Icon size="15" type="md-trash" @click="handleCloseSkuValue(val, index, item)"></Icon> <Icon size="15" type="md-trash" @click="handleCloseSkuValue(val, index, item)">
</Icon>
</a> </a>
</div> </div>
<div v-if="$index === 0 && openImage" style="margin-top: 10px"> <div v-if="$index === 0 && openImage" style="margin-top: 10px">
<vuedraggable :animation="200" :list="val.images" <vuedraggable :animation="200" :list="val.images">
> <div v-for="(img, __index) in val.images" :key="__index" class="sku-upload-list"
<div v-for="(img, __index) in val.images" :key="__index" style="width: 180px;height: 140px">
class="sku-upload-list"
style="width: 180px;height: 140px">
<template> <template>
<img <img :src="img" style="width: 180px;height: 140px" />
:src="img"
style="width: 180px;height: 140px"
/>
<div class="sku-upload-list-cover"> <div class="sku-upload-list-cover">
<div style="margin-top: 50px" > <div style="margin-top: 50px">
<Icon size="25" type="md-search" @click="handleView(img)"></Icon> <Icon size="25" type="md-search" @click="handleView(img)"></Icon>
<Icon size="25" type="md-trash" @click="handleRemove(val.images, __index)"></Icon> <Icon size="25" type="md-trash" @click="handleRemove(val.images, __index)">
</Icon>
</div> </div>
</div> </div>
</template> </template>
</div> </div>
</vuedraggable> </vuedraggable>
<Upload ref="uploadSku" :action="uploadFileUrl" <Upload ref="uploadSku" :action="uploadFileUrl" v-if="val.images < 1"
v-if="val.images < 1" :before-upload="handleBeforeUpload" :format="['jpg', 'jpeg', 'png', 'webp']"
:before-upload="handleBeforeUpload" :headers="{ ...accessToken }" :max-size="2048" :on-error="() => { $Spin.hide(); }"
:format="['jpg', 'jpeg', 'png', 'webp']" :on-exceeded-size="handleMaxSize" :on-format-error="handleFormatError"
:headers="{ ...accessToken }" :on-progress="() => { $Spin.show(); }" :on-success="(res, file) => {
:max-size="2048" handleSuccess(res, file, val.images)
:on-error="() => { $Spin.hide(); }" }" :show-upload-list="false"
:on-exceeded-size="handleMaxSize" style="width: 180px;height: 140px;margin-right: 10px" type="drag">
:on-format-error="handleFormatError"
:on-progress="() => { $Spin.show(); }"
:on-success="(res, file) => {
handleSuccess(res, file, val.images)
}"
:show-upload-list="false"
style="width: 180px;height: 140px;margin-right: 10px" type="drag">
<div> <div>
<Icon size="136" type="ios-camera"></Icon> <Icon size="136" type="ios-camera"></Icon>
</div> </div>
@@ -256,13 +242,13 @@
</div> </div>
</FormItem> </FormItem>
<FormItem v-if="item.spec_values.length < 10 && item.spec_values.length >= 1 && item.spec_values[0].value !== ''" class="sku-item-content-val flex" label="" style="line-height: 32px;"> <FormItem
<AutoComplete ref="input" v-model="newSkuValues[$index]" v-if="item.spec_values.length < 10 && item.spec_values.length >= 1 && item.spec_values[0].value !== ''"
:disabled="containsSameSkuItem" class="sku-item-content-val flex" label="" style="line-height: 32px;">
:filter-method="filterMethod" <AutoComplete ref="input" v-model="newSkuValues[$index]" :disabled="containsSameSkuItem"
:maxlength="30" placeholder="自定义规格值" style="width: 180px" :filter-method="filterMethod" :maxlength="30" placeholder="自定义规格值"
@on-blur="addSpec($index, item)" style="width: 180px" @on-blur="addSpec($index, item)"
v-on:keyup.native.enter="addSpec($index, item)"> v-on:keyup.native.enter="addSpec($index, item)">
</AutoComplete> </AutoComplete>
</FormItem> </FormItem>
</Form> </Form>
@@ -283,7 +269,7 @@
规格详细 规格详细
<div slot="content"> <div slot="content">
<div v-if="needToloadSku" class="topinfo" @click="handleLoadingSkuData">点击加载sku数据</div> <div v-if="needToloadSku" class="topinfo" @click="handleLoadingSkuData">点击加载sku数据</div>
<div slot="content" :class="needToloadSku ? 'mask': ''"> <div slot="content" :class="needToloadSku ? 'mask' : ''">
<Table :columns="skuTableColumn" :data="skuTableData" class="mt_10" style=" <Table :columns="skuTableColumn" :data="skuTableData" class="mt_10" style="
width: 100%; width: 100%;
.ivu-table-overflowX { .ivu-table-overflowX {
@@ -292,47 +278,47 @@
"> ">
<template slot="sn" slot-scope="{ row }"> <template slot="sn" slot-scope="{ row }">
<Input v-model="row.sn" clearable placeholder="请输入货号" <Input v-model="row.sn" clearable placeholder="请输入货号"
@on-change="updateSkuTable(row, 'sn')"/> @on-change="updateSkuTable(row, 'sn')" />
</template> </template>
<div v-if="baseInfoForm.goodsType !== 'VIRTUAL_GOODS'" slot="weight" slot-scope="{ row }"> <div v-if="baseInfoForm.goodsType !== 'VIRTUAL_GOODS'" slot="weight" slot-scope="{ row }">
<Input v-model="row.weight" clearable placeholder="请输入重量" <Input v-model="row.weight" clearable placeholder="请输入重量"
@on-change="updateSkuTable(row, 'weight')"> @on-change="updateSkuTable(row, 'weight')">
<span slot="append">kg</span> <span slot="append">kg</span>
</Input> </Input>
</div> </div>
<template slot="quantity" slot-scope="{ row }"> <template slot="quantity" slot-scope="{ row }">
<Input v-model="row.quantity" clearable placeholder="请输入库存" <Input v-model="row.quantity" clearable placeholder="请输入库存"
@on-change="updateSkuTable(row, 'quantity')"> @on-change="updateSkuTable(row, 'quantity')">
<span slot="append">{{ <span slot="append">{{
baseInfoForm.goodsUnit || "" baseInfoForm.goodsUnit || ""
}}</span> }}</span>
</Input> </Input>
</template> </template>
<template slot="cost" slot-scope="{ row }"> <template slot="cost" slot-scope="{ row }">
<Input v-model="row.cost" clearable placeholder="请输入成本价" <Input v-model="row.cost" clearable placeholder="请输入成本价"
@on-change="updateSkuTable(row, 'cost')"> @on-change="updateSkuTable(row, 'cost')">
<span slot="append">元</span> <span slot="append">元</span>
</Input> </Input>
</template> </template>
<template slot="price" slot-scope="{ row }"> <template slot="price" slot-scope="{ row }">
<Input v-model="row.price" clearable placeholder="请输入价格" <Input v-model="row.price" clearable placeholder="请输入价格"
@on-change="updateSkuTable(row, 'price')"> @on-change="updateSkuTable(row, 'price')">
<span slot="append">元</span> <span slot="append">元</span>
</Input> </Input>
</template> </template>
<template slot="wholePrice0" slot-scope="{ row }"> <template slot="wholePrice0" slot-scope="{ row }">
<Input v-if="wholesaleData[0]" v-model="wholesaleData[0].price" clearable disabled> <Input v-if="wholesaleData[0]" v-model="wholesaleData[0].price" clearable disabled>
<span slot="append">元</span> <span slot="append">元</span>
</Input> </Input>
</template> </template>
<template slot="wholePrice1" slot-scope="{ row }"> <template slot="wholePrice1" slot-scope="{ row }">
<Input v-if="wholesaleData[1]" v-model="wholesaleData[1].price" clearable disabled> <Input v-if="wholesaleData[1]" v-model="wholesaleData[1].price" clearable disabled>
<span slot="append">元</span> <span slot="append">元</span>
</Input> </Input>
</template> </template>
<template slot="wholePrice2" slot-scope="{ row }"> <template slot="wholePrice2" slot-scope="{ row }">
<Input v-if="wholesaleData[2]" v-model="wholesaleData[2].price" clearable disabled> <Input v-if="wholesaleData[2]" v-model="wholesaleData[2].price" clearable disabled>
<span slot="append">元</span> <span slot="append">元</span>
</Input> </Input>
</template> </template>
</Table> </Table>
@@ -349,7 +335,7 @@
<!-- {{item.url}} --> <!-- {{item.url}} -->
<div v-for="(item, index) in listImages.images" :key="index" style="width:100%;display:flex;"> <div v-for="(item, index) in listImages.images" :key="index" style="width:100%;display:flex;">
<img :src="item.url" style="width:100px;flex:1;margin-top:10px;cursor:pointer;" <img :src="item.url" style="width:100px;flex:1;margin-top:10px;cursor:pointer;"
@click="handleView(item.url)"/> @click="handleView(item.url)" />
</div> </div>
</FormItem> </FormItem>
</div> </div>
@@ -359,16 +345,11 @@
<div class="tree-bar"> <div class="tree-bar">
<FormItem class="form-item-view-el" label="店内分类" prop="shopCategory"> <FormItem class="form-item-view-el" label="店内分类" prop="shopCategory">
<Tree ref="tree" :check-strictly="false" :data="shopCategory" show-checkbox style="text-align: left" <Tree ref="tree" :check-strictly="false" :data="shopCategory" show-checkbox style="text-align: left"
@on-select-change="selectTree" @on-check-change="changeSelect"></Tree> @on-select-change="selectTree" @on-check-change="changeSelect"></Tree>
</FormItem> </FormItem>
</div> </div>
<FormItem class="form-item-view-el" label="PC商品描述" prop="intro" style="width: 100%"> <FormItem class="form-item-view-el" label="PC商品描述" prop="intro" style="width: 100%">
<editor <editor ref="editor" v-model="baseInfoForm.intro" height="800px" openXss></editor>
ref="editor"
v-model="baseInfoForm.intro"
height="800px"
openXss
></editor>
<div class="promise-intro-btn"> <div class="promise-intro-btn">
<Button type="primary" @click="promiseIntroEditor">将PC商品描述同步到移动端描述 <Button type="primary" @click="promiseIntroEditor">将PC商品描述同步到移动端描述
</Button> </Button>
@@ -376,12 +357,7 @@
</FormItem> </FormItem>
<FormItem class="form-item-view-el" label="移动端描述" prop="skuList" style="width: 100%"> <FormItem class="form-item-view-el" label="移动端描述" prop="skuList" style="width: 100%">
<editor <editor ref="introEditor" v-model="baseInfoForm.mobileIntro" height="800px" openXss></editor>
ref="introEditor"
v-model="baseInfoForm.mobileIntro"
height="800px"
openXss
></editor>
</FormItem> </FormItem>
</div> </div>
<div v-if="baseInfoForm.goodsType != 'VIRTUAL_GOODS'"> <div v-if="baseInfoForm.goodsType != 'VIRTUAL_GOODS'">
@@ -393,12 +369,12 @@
</Option> </Option>
</Select> </Select>
<Button class="refresh-icon" icon="md-refresh" shape="circle" type="text" <Button class="refresh-icon" icon="md-refresh" shape="circle" type="text"
@click="refresh('template')"></Button> @click="refresh('template')"></Button>
</FormItem> </FormItem>
<FormItem v-if="baseInfoForm.salesModel == 'WHOLESALE'" class="form-item-view-el" label="商品重量" <FormItem v-if="baseInfoForm.salesModel == 'WHOLESALE'" class="form-item-view-el" label="商品重量"
prop="weight"> prop="weight">
<Input v-model="baseInfoForm.weight" placeholder="请输入商品重量"> <Input v-model="baseInfoForm.weight" placeholder="请输入商品重量">
<span slot="append">kg</span></Input> <span slot="append">kg</span></Input>
</FormItem> </FormItem>
</div> </div>
<h4>其他信息</h4> <h4>其他信息</h4>
@@ -426,24 +402,24 @@
</div> </div>
<div class="form-item-view-bottom"> <div class="form-item-view-bottom">
<Collapse v-for="(paramsGroup, groupIndex) in goodsParams" :key="paramsGroup.groupName" <Collapse v-for="(paramsGroup, groupIndex) in goodsParams" :key="paramsGroup.groupName"
v-model="params_panel" :title="paramsGroup.groupName" class="mb_10" style="text-align: left"> v-model="params_panel" :title="paramsGroup.groupName" class="mb_10" style="text-align: left">
<Panel :name="paramsGroup.groupName"> <Panel :name="paramsGroup.groupName">
{{ paramsGroup.groupName }} {{ paramsGroup.groupName }}
<p slot="content"> <p slot="content">
<FormItem v-for="(params, paramsIndex) in paramsGroup.params" :key="paramsIndex" <FormItem v-for="(paramsItem, paramsIndex) in paramsGroup.params" :key="paramsIndex"
:label="`${params.paramName}`"> :label="`${paramsItem.paramName}`"
<Select v-model="params.paramValue" clearable placeholder="请选择" style="width: 200px" :rules="{ required: paramsItem.required, message: '参数不能为空' }">
@on-change=" <Select v-model="paramsItem.paramValue" clearable placeholder="请选择" style="width: 200px" @on-change="
selectParams( selectParams(
paramsGroup, paramsGroup,
groupIndex, groupIndex,
params, paramsItem,
paramsIndex, paramsIndex,
params.paramValue paramsItem.paramValue
) )
"> ">
<Option v-for="option in params.options.split(',')" :key="option" :label="option" <Option v-for="option in paramsItem.options.split(',')" :key="option" :label="option"
:value="option"> :value="option">
</Option> </Option>
</Select> </Select>
</FormItem> </FormItem>
@@ -476,7 +452,8 @@
<!--<ossManage @callback="callbackSelected" ref="ossManage" />--> <!--<ossManage @callback="callbackSelected" ref="ossManage" />-->
<!--</Modal>--> <!--</Modal>-->
<Modal v-model="picModelFlag" width="1200px" @on-ok="confirmUrls"> <Modal v-model="picModelFlag" width="1200px" @on-ok="confirmUrls">
<ossManage ref="ossManage" :isComponent="true" :initialize="picModelFlag" @callback="callbackSelected" @selected="(list)=>{ selectedImage = list}"/> <ossManage ref="ossManage" :isComponent="true" :initialize="picModelFlag" @callback="callbackSelected"
@selected="(list) => { selectedImage = list }" />
</Modal> </Modal>
</div> </div>
@@ -488,8 +465,8 @@ import cloneObj from "@/utils/index";
import vuedraggable from "vuedraggable"; import vuedraggable from "vuedraggable";
import tinymec from "@/views/lili-components/editor/index.vue"; import tinymec from "@/views/lili-components/editor/index.vue";
import {uploadFile} from "@/libs/axios"; import { uploadFile } from "@/libs/axios";
import {regular} from "@/utils"; import { regular } from "@/utils";
import DPlayer from 'dplayer'; import DPlayer from 'dplayer';
// import ossManage from "@/views/sys/oss-manage/ossManage"; // import ossManage from "@/views/sys/oss-manage/ossManage";
import ossManage from "@/views/shop/ossManages"; import ossManage from "@/views/shop/ossManages";
@@ -657,9 +634,9 @@ export default {
validateError: [], validateError: [],
baseInfoFormRule: { baseInfoFormRule: {
goodsName: [regular.REQUIRED, regular.WHITE_SPACE, regular.VARCHAR60], goodsName: [regular.REQUIRED, regular.WHITE_SPACE, regular.VARCHAR60],
price: [regular.REQUIRED, {validator: checkPrice}], price: [regular.REQUIRED, { validator: checkPrice }],
sellingPoint: [regular.REQUIRED, regular.VARCHAR60], sellingPoint: [regular.REQUIRED, regular.VARCHAR60],
goodsUnit: [{required: true, message: "请选择计量单位"}], goodsUnit: [{ required: true, message: "请选择计量单位" }],
name: [regular.REQUIRED, regular.VARCHAR5], name: [regular.REQUIRED, regular.VARCHAR5],
value: [regular.REQUIRED, regular.VARCHAR60], value: [regular.REQUIRED, regular.VARCHAR60],
templateId: [regular.REQUIRED], templateId: [regular.REQUIRED],
@@ -811,7 +788,7 @@ export default {
) { ) {
this.baseInfoForm.goodsParamsDTOList[groupIndex].goodsParamsItemDTOList[ this.baseInfoForm.goodsParamsDTOList[groupIndex].goodsParamsItemDTOList[
paramsIndex paramsIndex
] = { ] = {
paramName: "", paramName: "",
paramValue: "", paramValue: "",
isIndex: "", isIndex: "",
@@ -822,7 +799,7 @@ export default {
} }
this.baseInfoForm.goodsParamsDTOList[groupIndex].goodsParamsItemDTOList[ this.baseInfoForm.goodsParamsDTOList[groupIndex].goodsParamsItemDTOList[
paramsIndex paramsIndex
] = { ] = {
paramName: params.paramName, paramName: params.paramName,
paramValue: value, paramValue: value,
isIndex: params.isIndex, isIndex: params.isIndex,
@@ -1002,7 +979,7 @@ export default {
this.selectedSku.images !== undefined && this.selectedSku.images !== undefined &&
this.selectedSku.images.length > 5; this.selectedSku.images.length > 5;
if (check) { if (check) {
this.$Notice.warning({title: "图片数量不能大于五张"}); this.$Notice.warning({ title: "图片数量不能大于五张" });
return false; return false;
} }
}, },
@@ -1073,7 +1050,7 @@ export default {
response.result.recommend response.result.recommend
? (response.result.recommend = 1) ? (response.result.recommend = 1)
: (response.result.recommend = 0); : (response.result.recommend = 0);
this.baseInfoForm = {...this.baseInfoForm, ...response.result}; this.baseInfoForm = { ...this.baseInfoForm, ...response.result };
this.baseInfoForm.release = 1; //即使是被放入仓库,修改的时候也会显示会立即发布 this.baseInfoForm.release = 1; //即使是被放入仓库,修改的时候也会显示会立即发布
this.categoryId = response.result.categoryPath.split(",")[2]; this.categoryId = response.result.categoryPath.split(",")[2];
@@ -1121,7 +1098,7 @@ export default {
this.baseInfoForm.categoryPath = cateId.toString(); this.baseInfoForm.categoryPath = cateId.toString();
} }
this.firstData.goodsType && this.firstData.goodsType &&
(this.baseInfoForm.goodsType = this.firstData.goodsType); (this.baseInfoForm.goodsType = this.firstData.goodsType);
/** 查询商品参数 */ /** 查询商品参数 */
this.GET_GoodsParams(); this.GET_GoodsParams();
}, },
@@ -1262,7 +1239,7 @@ export default {
} }
// 写入对象,下标,具体对象 // 写入对象,下标,具体对象
this.$set(this.skuInfo, this.skuInfo.length, { this.$set(this.skuInfo, this.skuInfo.length, {
spec_values: [{name: "", value: "", images: []}], spec_values: [{ name: "", value: "", images: [] }],
name: "", name: "",
}); });
@@ -1832,6 +1809,25 @@ export default {
this.$Message.error("存在重复规格值"); this.$Message.error("存在重复规格值");
return; return;
} }
console.log(this.baseInfoForm.goodsParamsDTOList)
let checkFlag = false;
this.goodsParams.forEach(group => {
group.params.forEach(param => {
if(param.required){
const check = this.baseInfoForm.goodsParamsDTOList.some(paramsGroup =>
paramsGroup.some(paramsItem => paramsItem.paramId === param.id)
);
if(!check){
checkFlag = !check;
}
}
})
})
if(checkFlag){
this.$Message.error("存在未填写的参数项");
return;
}
this.submitLoading = true; this.submitLoading = true;
this.$refs["baseInfoForm"].validate((valid) => { this.$refs["baseInfoForm"].validate((valid) => {
if (valid) { if (valid) {
@@ -1998,7 +1994,7 @@ export default {
API_GOODS.saveDraftGoods(this.baseInfoForm).then((res) => { API_GOODS.saveDraftGoods(this.baseInfoForm).then((res) => {
if (res.success) { if (res.success) {
this.$Message.info("保存成功"); this.$Message.info("保存成功");
this.$router.push({name: "template-goods"}); this.$router.push({ name: "template-goods" });
} }
}); });
}, },
@@ -2068,9 +2064,7 @@ export default {
text-align: left; text-align: left;
} }
#dplayer { #dplayer {}
}
/* .tox-notifications-container{ /* .tox-notifications-container{
display: none !important; display: none !important;