|
@@ -3,9 +3,9 @@
|
|
|
|
|
|
<div class="step-container">
|
|
|
<el-steps :active="step" simple style="margin-top: 20px">
|
|
|
- <el-step title="1.编辑基础信息" ></el-step>
|
|
|
- <el-step title="2.编辑价格库存" ></el-step>
|
|
|
- <el-step title="3.编辑商品详情" ></el-step>
|
|
|
+ <el-step title="1.编辑基础信息"></el-step>
|
|
|
+ <el-step title="2.编辑价格库存"></el-step>
|
|
|
+ <el-step title="3.编辑商品详情"></el-step>
|
|
|
</el-steps>
|
|
|
</div>
|
|
|
|
|
@@ -17,17 +17,12 @@
|
|
|
<el-input v-model="step1Form.goodsName" placeholder="请输入商品名称" maxlength="200" show-word-limit></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="商品描述:" prop="goodsDes">
|
|
|
- <el-input v-model="step1Form.goodsDes" type="textarea" placeholder="请输入商品描述" :autosize="{ minRows: 3, maxRows: 6}" maxlength="100" show-word-limit></el-input>
|
|
|
+ <el-input v-model="step1Form.goodsDes" type="textarea" placeholder="请输入商品描述"
|
|
|
+ :autosize="{ minRows: 3, maxRows: 6 }" maxlength="100" show-word-limit></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="商品主图:" prop="imgUrl">
|
|
|
- <el-upload
|
|
|
- class="avatar-uploader"
|
|
|
- style="height:122px"
|
|
|
- :action="baseURL + 'common/upload'"
|
|
|
- :headers="myHeaders"
|
|
|
- :show-file-list="false"
|
|
|
- :on-success="uploadSuccess"
|
|
|
- :before-upload="beforeUpload">
|
|
|
+ <el-upload class="avatar-uploader" style="height:122px" :action="baseURL + 'common/upload'" :headers="myHeaders"
|
|
|
+ :show-file-list="false" :on-success="uploadSuccess" :before-upload="beforeUpload">
|
|
|
<img v-if="step1Form.imgUrl" :src="step1Form.imgUrl" class="avatar">
|
|
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
</el-upload>
|
|
@@ -36,18 +31,9 @@
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="轮播图:" prop="images">
|
|
|
- <el-upload
|
|
|
- multiple
|
|
|
- :limit="6"
|
|
|
- ref="imageListUpload2"
|
|
|
- class="avatar-uploader2 imageListUpload2"
|
|
|
- style="height: 0;"
|
|
|
- :action="baseURL + 'common/upload'"
|
|
|
- :headers="myHeaders"
|
|
|
- name="file"
|
|
|
- :show-file-list="false"
|
|
|
- :on-success="uploadSuccess2"
|
|
|
- :on-exceed="uploadExceed2"
|
|
|
+ <el-upload multiple :limit="6" ref="imageListUpload2" class="avatar-uploader2 imageListUpload2"
|
|
|
+ style="height: 0;" :action="baseURL + 'common/upload'" :headers="myHeaders" name="file"
|
|
|
+ :show-file-list="false" :on-success="uploadSuccess2" :on-exceed="uploadExceed2"
|
|
|
:before-upload="beforeUpload2">
|
|
|
</el-upload>
|
|
|
<div class="images">
|
|
@@ -78,14 +64,8 @@
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="商品视频:" prop="videoUrl">
|
|
|
- <el-upload
|
|
|
- class="avatar-uploader"
|
|
|
- style="height:122px"
|
|
|
- :action="baseURL + 'common/upload'"
|
|
|
- :headers="myHeaders"
|
|
|
- :show-file-list="false"
|
|
|
- :on-success="uploadSuccess3"
|
|
|
- :before-upload="beforeUpload3">
|
|
|
+ <el-upload class="avatar-uploader" style="height:122px" :action="baseURL + 'common/upload'" :headers="myHeaders"
|
|
|
+ :show-file-list="false" :on-success="uploadSuccess3" :before-upload="beforeUpload3">
|
|
|
<!-- <img v-if="step1Form.videoUrl" :src="step1Form.videoUrl" class="avatar"> -->
|
|
|
<video v-if="step1Form.videoUrl" :src="step1Form.videoUrl" height="120" style="display: block;"></video>
|
|
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
@@ -123,25 +103,15 @@
|
|
|
</el-form-item> -->
|
|
|
|
|
|
<el-form-item label="商品分类:" prop="classify">
|
|
|
- <el-cascader
|
|
|
- placeholder="请选择商品分类"
|
|
|
- :options="classifyList"
|
|
|
- :props="{ value: 'categoryId', label:'name' }"
|
|
|
- v-model="step1Form.classify"
|
|
|
- style="width: 300px"
|
|
|
- @change="changeClassify()"
|
|
|
- filterable
|
|
|
- clearable>
|
|
|
+ <el-cascader placeholder="请选择商品分类" :options="classifyList" :props="{ value: 'categoryId', label: 'name' }"
|
|
|
+ v-model="step1Form.classify" style="width: 300px" @change="changeClassify()" filterable clearable>
|
|
|
</el-cascader>
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="营销活动:" prop="marketing">
|
|
|
- <el-select v-model="step1Form.marketing" placeholder="请选择营销活动" style="width: 300px" clearable :disabled="!step1Form.classify">
|
|
|
- <el-option
|
|
|
- v-for="item in marketingList"
|
|
|
- :key="item.id"
|
|
|
- :label="item.name"
|
|
|
- :value="item.id">
|
|
|
+ <el-select v-model="step1Form.marketing" placeholder="请选择营销活动" style="width: 300px" clearable
|
|
|
+ :disabled="!step1Form.classify">
|
|
|
+ <el-option v-for="item in marketingList" :key="item.id" :label="item.name" :value="item.id">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -183,7 +153,8 @@
|
|
|
</el-col>
|
|
|
<el-col :xs="24" :sm="12" :lg="6">
|
|
|
<el-form-item label="规格值" prop="specValue">
|
|
|
- <el-input v-model="specForm.specValue" placeholder="请输入规格值" :disabled="!step2Form.specType"></el-input>
|
|
|
+ <el-input v-model="specForm.specValue" placeholder="请输入规格值"
|
|
|
+ :disabled="!step2Form.specType"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :xs="24" :sm="12" :lg="6">
|
|
@@ -229,13 +200,8 @@
|
|
|
|
|
|
<el-col :xs="24" :sm="24" :lg="24">
|
|
|
<el-form-item label="规格图片" prop="imgUrl">
|
|
|
- <el-upload
|
|
|
- class="avatar-uploader"
|
|
|
- :action="baseURL + 'common/upload'"
|
|
|
- :headers="myHeaders"
|
|
|
- :show-file-list="false"
|
|
|
- :on-success="uploadSuccess5"
|
|
|
- :before-upload="beforeUpload5">
|
|
|
+ <el-upload class="avatar-uploader" :action="baseURL + 'common/upload'" :headers="myHeaders"
|
|
|
+ :show-file-list="false" :on-success="uploadSuccess5" :before-upload="beforeUpload5">
|
|
|
<img v-if="specForm.imgUrl" :src="specForm.imgUrl" class="avatar">
|
|
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
</el-upload>
|
|
@@ -244,18 +210,14 @@
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
- <div class="addBtn"><el-button type="primary" size="small" @click="addSpec" v-show="step2Form.specType">添加规格</el-button></div>
|
|
|
+ <div class="addBtn"><el-button type="primary" size="small" @click="addSpec"
|
|
|
+ v-show="step2Form.specType">添加规格</el-button></div>
|
|
|
|
|
|
- <el-upload
|
|
|
- class="editSpecimage-uploader"
|
|
|
- style="height: 0;"
|
|
|
- :action="baseURL + 'common/upload'"
|
|
|
- :headers="myHeaders"
|
|
|
- :show-file-list="false"
|
|
|
- :on-success="uploadSuccess6"
|
|
|
- :before-upload="beforeUpload5">
|
|
|
+ <el-upload class="editSpecimage-uploader" style="height: 0;" :action="baseURL + 'common/upload'"
|
|
|
+ :headers="myHeaders" :show-file-list="false" :on-success="uploadSuccess6" :before-upload="beforeUpload5">
|
|
|
</el-upload>
|
|
|
- <el-table :data="specList" element-loading-text="Loading" border fit highlight-current-row stripe style="margin-bottom: 20px" v-show="step2Form.specType">
|
|
|
+ <el-table :data="specList" element-loading-text="Loading" border fit highlight-current-row stripe
|
|
|
+ style="margin-bottom: 20px" v-show="step2Form.specType">
|
|
|
<el-table-column align="center" label="规格名称" prop="name" min-width="120">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input v-model="scope.row.name"></el-input>
|
|
@@ -268,7 +230,8 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="规格图片" prop="imgUrl">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-image style="width: 40px; height: 40px; cursor: pointer;" :src="scope.row.imgUrl" fit="cover" @click="editSpecImage(scope.$index)"></el-image>
|
|
|
+ <el-image style="width: 40px; height: 40px; cursor: pointer;" :src="scope.row.imgUrl" fit="cover"
|
|
|
+ @click="editSpecImage(scope.$index)"></el-image>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="成本价" prop="costPrice" min-width="120">
|
|
@@ -315,7 +278,7 @@
|
|
|
<el-table-column align="center" label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
<!-- <el-button type="text" @click="editExam('theory', scope.row.index)">编辑</el-button> -->
|
|
|
- <el-popconfirm title="确定删除吗?" @onConfirm="deleteSpec(scope.row.index)" >
|
|
|
+ <el-popconfirm title="确定删除吗?" @onConfirm="deleteSpec(scope.row.index)">
|
|
|
<el-button slot="reference" type="text">删除</el-button>
|
|
|
</el-popconfirm>
|
|
|
</template>
|
|
@@ -360,7 +323,8 @@
|
|
|
</el-form-item> -->
|
|
|
<el-form-item label="运费模版:" prop="freight">
|
|
|
<el-select v-model="step2Form.freight" filterable placeholder="请选择运费模版" style="width: 300px">
|
|
|
- <el-option v-for="item in freightList" :key="item.freightTemplateId" :label="item.name" :value="item.freightTemplateId">
|
|
|
+ <el-option v-for="item in freightList" :key="item.freightTemplateId" :label="item.name"
|
|
|
+ :value="item.freightTemplateId">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -378,29 +342,19 @@
|
|
|
<el-form ref="step3Form" :model="step3Form" :rules="step3FormRules" label-width="80px" label-position="top">
|
|
|
<el-form-item label="说明模块" prop="moduleId">
|
|
|
<el-select v-model="step3Form.moduleId" filterable placeholder="请选择说明模块" style="width: 300px">
|
|
|
- <el-option v-for="item in moduleList" :key="item.commonTemplateId" :label="item.name" :value="item.commonTemplateId">
|
|
|
+ <el-option v-for="item in moduleList" :key="item.commonTemplateId" :label="item.name"
|
|
|
+ :value="item.commonTemplateId">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="详情内容" prop="detailContent">
|
|
|
- <el-upload
|
|
|
- ref="imageListUpload"
|
|
|
- class="avatar-uploader2 imageListUpload"
|
|
|
- :action="baseURL + 'common/upload'"
|
|
|
- :headers="myHeaders"
|
|
|
- multiple
|
|
|
- name="file"
|
|
|
- :show-file-list="false"
|
|
|
- :on-success="uploadSuccess4"
|
|
|
- :on-error="uploadError4"
|
|
|
- :before-upload="beforeUpload4">
|
|
|
+ <el-upload ref="imageListUpload" class="avatar-uploader2 imageListUpload" :action="baseURL + 'common/upload'"
|
|
|
+ :headers="myHeaders" multiple name="file" :show-file-list="false" :on-success="uploadSuccess4"
|
|
|
+ :on-error="uploadError4" :before-upload="beforeUpload4">
|
|
|
</el-upload>
|
|
|
<!--富文本编辑器组件-->
|
|
|
<el-row v-loading="quillImgLoading">
|
|
|
- <quill-editor
|
|
|
- v-model="step3Form.detailContent"
|
|
|
- ref="myQuillEditor"
|
|
|
- :options="editorOption">
|
|
|
+ <quill-editor v-model="step3Form.detailContent" ref="myQuillEditor" :options="editorOption">
|
|
|
</quill-editor>
|
|
|
</el-row>
|
|
|
</el-form-item>
|
|
@@ -412,12 +366,9 @@
|
|
|
<div class="footer" :class="classObj">
|
|
|
<el-button @click="changeStep(0)" v-show="step > 0">上一步</el-button>
|
|
|
<el-button @click="changeStep(1)" v-show="step < 2">下一步</el-button>
|
|
|
- <el-button type="primary" @click="clickSubmitForm" :loading="formLoading">{{ formLoading ? '提交中 ...' : '提 交' }}</el-button>
|
|
|
- <el-popconfirm
|
|
|
- title="确定关闭吗?"
|
|
|
- @onConfirm="goBack"
|
|
|
- style="margin-left: 10px;"
|
|
|
- >
|
|
|
+ <el-button type="primary" @click="clickSubmitForm" :loading="formLoading">{{ formLoading ? '提交中 ...' : '提 交'
|
|
|
+ }}</el-button>
|
|
|
+ <el-popconfirm title="确定关闭吗?" @onConfirm="goBack" style="margin-left: 10px;">
|
|
|
<el-button slot="reference">关 闭</el-button>
|
|
|
</el-popconfirm>
|
|
|
</div>
|
|
@@ -438,16 +389,16 @@ import 'quill/dist/quill.bubble.css'
|
|
|
const toolbarOptions = [
|
|
|
['bold', 'italic', 'underline', 'strike'],
|
|
|
['blockquote', 'code-block'],
|
|
|
- [{'header': 1}, {'header': 2}],
|
|
|
- [{'list': 'ordered'}, {'list': 'bullet'}],
|
|
|
- [{'script': 'sub'}, {'script': 'super'}],
|
|
|
- [{'indent': '-1'}, {'indent': '+1'}],
|
|
|
- [{'direction': 'rtl'}],
|
|
|
- [{'size': ['small', false, 'large', 'huge']}],
|
|
|
- [{'header': [1, 2, 3, 4, 5, 6, false]}],
|
|
|
- [{'color': []}, {'background': []}],
|
|
|
- [{'font': []}],
|
|
|
- [{'align': []}],
|
|
|
+ [{ 'header': 1 }, { 'header': 2 }],
|
|
|
+ [{ 'list': 'ordered' }, { 'list': 'bullet' }],
|
|
|
+ [{ 'script': 'sub' }, { 'script': 'super' }],
|
|
|
+ [{ 'indent': '-1' }, { 'indent': '+1' }],
|
|
|
+ [{ 'direction': 'rtl' }],
|
|
|
+ [{ 'size': ['small', false, 'large', 'huge'] }],
|
|
|
+ [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
|
|
|
+ [{ 'color': [] }, { 'background': [] }],
|
|
|
+ [{ 'font': [] }],
|
|
|
+ [{ 'align': [] }],
|
|
|
['link', 'image', 'video'],
|
|
|
// ['clean']
|
|
|
]
|
|
@@ -459,7 +410,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
baseURL: process.env.VUE_APP_BASE_API,
|
|
|
- myHeaders: {'x-token': getToken()},
|
|
|
+ myHeaders: { 'x-token': getToken() },
|
|
|
isEdit: false,
|
|
|
editId: '',
|
|
|
|
|
@@ -592,18 +543,18 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
watch: {
|
|
|
- 'specForm.costPrice': function(){
|
|
|
- if(this.canCompute) {
|
|
|
+ 'specForm.costPrice': function () {
|
|
|
+ if (this.canCompute) {
|
|
|
this.computeShareAmount();
|
|
|
}
|
|
|
},
|
|
|
- 'specForm.price': function(){
|
|
|
+ 'specForm.price': function () {
|
|
|
this.changeGoodsPrice();
|
|
|
- if(this.canCompute) {
|
|
|
+ if (this.canCompute) {
|
|
|
this.computeShareAmount();
|
|
|
}
|
|
|
},
|
|
|
- specList: function() {
|
|
|
+ specList: function () {
|
|
|
this.changeGoodsPrice();
|
|
|
},
|
|
|
},
|
|
@@ -619,10 +570,10 @@ export default {
|
|
|
this.getFreightList();
|
|
|
this.getModuleList();
|
|
|
|
|
|
- if(this.isEdit) {
|
|
|
+ if (this.isEdit) {
|
|
|
this.canCompute = false;
|
|
|
this.getGoodsDetail(id);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
this.canCompute = true;
|
|
|
this.canChangeGoodsPrice = true;
|
|
|
}
|
|
@@ -651,9 +602,9 @@ export default {
|
|
|
this.classifyList.forEach(item => {
|
|
|
classifyList = classifyList.concat(item.children);
|
|
|
})
|
|
|
- if(typeof this.step1Form.classify == 'string') {
|
|
|
+ if (typeof this.step1Form.classify == 'string') {
|
|
|
categoryId = this.step1Form.classify;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
categoryId = this.step1Form.classify[1];
|
|
|
}
|
|
|
let type = classifyList[this.$findElem(classifyList, 'categoryId', categoryId)].workOrderType;
|
|
@@ -715,7 +666,7 @@ export default {
|
|
|
|
|
|
// 获取详情
|
|
|
getGoodsDetail(goodsId) {
|
|
|
- getGoodsDetail({goodsId}).then(res => {
|
|
|
+ getGoodsDetail({ goodsId }).then(res => {
|
|
|
let data = res.data;
|
|
|
this.step1Form = {
|
|
|
goodsName: data.goodsName,
|
|
@@ -744,10 +695,10 @@ export default {
|
|
|
status: data.status,
|
|
|
}
|
|
|
|
|
|
- if(data.hasSpec) {
|
|
|
+ if (data.hasSpec) {
|
|
|
this.specList = data.goodsSpecs;
|
|
|
this.specList = this.listAddIndex(this.specList);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
this.specForm = {
|
|
|
goodsSpecId: data.goodsSpecs[0].goodsSpecId,
|
|
|
name: data.goodsSpecs[0].name,
|
|
@@ -780,10 +731,10 @@ export default {
|
|
|
|
|
|
// 切换步骤
|
|
|
changeStep(type) {
|
|
|
- if(type == 1) {
|
|
|
- this.step ++;
|
|
|
- }else {
|
|
|
- this.step --;
|
|
|
+ if (type == 1) {
|
|
|
+ this.step++;
|
|
|
+ } else {
|
|
|
+ this.step--;
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -802,15 +753,15 @@ export default {
|
|
|
|
|
|
// 切换规格类型
|
|
|
changeSpecType() {
|
|
|
- if(this.specList.length > 0 && !this.step2Form.specType && this.specList[0].name != '默认') {
|
|
|
+ if (this.specList.length > 0 && !this.step2Form.specType && this.specList[0].name != '默认') {
|
|
|
this.$errorMsg('请先删除规格');
|
|
|
this.step2Form.specType = true;
|
|
|
return false;
|
|
|
}
|
|
|
- if(!this.step2Form.specType) {
|
|
|
+ if (!this.step2Form.specType) {
|
|
|
this.specForm.name = '默认';
|
|
|
this.specForm.specValue = '默认';
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
this.specForm.name = '';
|
|
|
this.specForm.specValue = '';
|
|
|
}
|
|
@@ -818,29 +769,29 @@ export default {
|
|
|
|
|
|
// 添加规格
|
|
|
addSpec() {
|
|
|
- if(!this.specForm.name) {
|
|
|
+ if (!this.specForm.name) {
|
|
|
return this.$errorMsg('请填写规格名称');
|
|
|
- } else if(!this.specForm.specValue) {
|
|
|
+ } else if (!this.specForm.specValue) {
|
|
|
return this.$errorMsg('请填写规格值');
|
|
|
- } else if(!this.specForm.costPrice) {
|
|
|
+ } else if (!this.specForm.costPrice) {
|
|
|
return this.$errorMsg('请填写成本价');
|
|
|
- } else if(!this.specForm.price) {
|
|
|
+ } else if (!this.specForm.price) {
|
|
|
return this.$errorMsg('请填写销售价');
|
|
|
- } else if(this.specForm.shareAmount === '') {
|
|
|
+ } else if (this.specForm.shareAmount === '') {
|
|
|
return this.$errorMsg('请填写佣金');
|
|
|
- } else if(this.specForm.shareAmount / this.specForm.price > 0.4) {
|
|
|
+ } else if (this.specForm.shareAmount / this.specForm.price > 0.4) {
|
|
|
return this.$errorMsg('佣金不能超过销售价的40%');
|
|
|
- } else if(this.specForm.innerShareAmount === '') {
|
|
|
+ } else if (this.specForm.innerShareAmount === '') {
|
|
|
return this.$errorMsg('请填写内部佣金');
|
|
|
- } else if(this.specForm.innerShareAmount / this.specForm.price > 0.4) {
|
|
|
+ } else if (this.specForm.innerShareAmount / this.specForm.price > 0.4) {
|
|
|
return this.$errorMsg('内部佣金不能超过销售价的40%');
|
|
|
- } else if(this.specForm.sharePercent === '') {
|
|
|
+ } else if (this.specForm.sharePercent === '') {
|
|
|
return this.$errorMsg('请填写佣金比例');
|
|
|
- } else if(Number(this.specForm.sharePercent) < 0 || Number(this.specForm.sharePercent) > 40) {
|
|
|
+ } else if (Number(this.specForm.sharePercent) < 0 || Number(this.specForm.sharePercent) > 40) {
|
|
|
return this.$errorMsg('佣金比例范围0-40');
|
|
|
- } else if(!this.specForm.stockNum) {
|
|
|
+ } else if (!this.specForm.stockNum) {
|
|
|
return this.$errorMsg('请填写库存');
|
|
|
- } else if(!this.specForm.imgUrl) {
|
|
|
+ } else if (!this.specForm.imgUrl) {
|
|
|
return this.$errorMsg('请上传规格图片');
|
|
|
}
|
|
|
let item = JSON.parse(JSON.stringify(this.specForm));
|
|
@@ -870,15 +821,15 @@ export default {
|
|
|
this.$refs.step3Form.validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.submitForm();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
this.step = 2;
|
|
|
}
|
|
|
})
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
this.step = 1;
|
|
|
}
|
|
|
})
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
this.step = 0;
|
|
|
}
|
|
|
})
|
|
@@ -888,47 +839,47 @@ export default {
|
|
|
submitForm() {
|
|
|
this.formLoading = true;
|
|
|
|
|
|
- if(!this.step2Form.specType) {
|
|
|
- if(!this.specForm.name) {
|
|
|
+ if (!this.step2Form.specType) {
|
|
|
+ if (!this.specForm.name) {
|
|
|
this.formLoading = false;
|
|
|
return this.$errorMsg('请填写规格名称');
|
|
|
- } else if(!this.specForm.specValue) {
|
|
|
+ } else if (!this.specForm.specValue) {
|
|
|
this.formLoading = false;
|
|
|
return this.$errorMsg('请填写规格值');
|
|
|
- } else if(!this.specForm.costPrice) {
|
|
|
+ } else if (!this.specForm.costPrice) {
|
|
|
this.formLoading = false;
|
|
|
return this.$errorMsg('请填写成本价');
|
|
|
- } else if(!this.specForm.price) {
|
|
|
+ } else if (!this.specForm.price) {
|
|
|
this.formLoading = false;
|
|
|
return this.$errorMsg('请填写销售价');
|
|
|
- } else if(this.specForm.shareAmount === '') {
|
|
|
+ } else if (this.specForm.shareAmount === '') {
|
|
|
this.formLoading = false;
|
|
|
return this.$errorMsg('请填写佣金');
|
|
|
- } else if(this.specForm.sharePercent === '') {
|
|
|
+ } else if (this.specForm.sharePercent === '') {
|
|
|
this.formLoading = false;
|
|
|
return this.$errorMsg('请填写佣金比例');
|
|
|
- } else if(this.specForm.shareAmount / this.specForm.price > 0.4) {
|
|
|
+ } else if (this.specForm.shareAmount / this.specForm.price > 0.4) {
|
|
|
this.formLoading = false;
|
|
|
return this.$errorMsg('佣金不能超过销售价的40%');
|
|
|
- } else if(Number(this.specForm.sharePercent) < 0 || Number(this.specForm.sharePercent) > 40) {
|
|
|
+ } else if (Number(this.specForm.sharePercent) < 0 || Number(this.specForm.sharePercent) > 40) {
|
|
|
this.formLoading = false;
|
|
|
return this.$errorMsg('佣金比例范围0-40');
|
|
|
- } else if(this.specForm.innerShareAmount === '') {
|
|
|
+ } else if (this.specForm.innerShareAmount === '') {
|
|
|
this.formLoading = false;
|
|
|
return this.$errorMsg('请填写内部佣金');
|
|
|
- } else if(this.specForm.innerSharePercent === '') {
|
|
|
+ } else if (this.specForm.innerSharePercent === '') {
|
|
|
this.formLoading = false;
|
|
|
return this.$errorMsg('请填写内部佣金比例');
|
|
|
- } else if(this.specForm.innerShareAmount / this.specForm.price > 0.4) {
|
|
|
+ } else if (this.specForm.innerShareAmount / this.specForm.price > 0.4) {
|
|
|
this.formLoading = false;
|
|
|
return this.$errorMsg('内部佣金不能超过销售价的40%');
|
|
|
- } else if(Number(this.specForm.innerSharePercent) < 0 || Number(this.specForm.innerSharePercent) > 40) {
|
|
|
+ } else if (Number(this.specForm.innerSharePercent) < 0 || Number(this.specForm.innerSharePercent) > 40) {
|
|
|
this.formLoading = false;
|
|
|
return this.$errorMsg('内部佣金比例范围0-40');
|
|
|
- } else if(!this.specForm.stockNum) {
|
|
|
+ } else if (!this.specForm.stockNum) {
|
|
|
this.formLoading = false;
|
|
|
return this.$errorMsg('请填写库存');
|
|
|
- } else if(!this.specForm.imgUrl) {
|
|
|
+ } else if (!this.specForm.imgUrl) {
|
|
|
this.formLoading = false;
|
|
|
return this.$errorMsg('请上传规格图片');
|
|
|
}
|
|
@@ -936,25 +887,25 @@ export default {
|
|
|
this.specList.push(item);
|
|
|
this.specList = this.listAddIndex(this.specList);
|
|
|
console.log(this.specList);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
let specList = this.specList;
|
|
|
- for(let i=0; i<specList.length; i++) {
|
|
|
- if(specList[i].shareAmount / specList[i].price > 0.4) {
|
|
|
+ for (let i = 0; i < specList.length; i++) {
|
|
|
+ if (specList[i].shareAmount / specList[i].price > 0.4) {
|
|
|
this.formLoading = false;
|
|
|
this.$errorMsg('单个规格的佣金不能超过销售价的40%');
|
|
|
return;
|
|
|
}
|
|
|
- if(Number(specList[i].sharePercent) < 0 || Number(specList[i].sharePercent) > 40) {
|
|
|
+ if (Number(specList[i].sharePercent) < 0 || Number(specList[i].sharePercent) > 40) {
|
|
|
this.formLoading = false;
|
|
|
this.$errorMsg('单个规格的佣金比例范围在0-40');
|
|
|
return;
|
|
|
}
|
|
|
- if(specList[i].innerShareAmount / specList[i].price > 0.4) {
|
|
|
+ if (specList[i].innerShareAmount / specList[i].price > 0.4) {
|
|
|
this.formLoading = false;
|
|
|
this.$errorMsg('单个规格的佣金不能超过销售价的40%');
|
|
|
return;
|
|
|
}
|
|
|
- if(Number(specList[i].innerSharePercent) < 0 || Number(specList[i].innerSharePercent) > 40) {
|
|
|
+ if (Number(specList[i].innerSharePercent) < 0 || Number(specList[i].innerSharePercent) > 40) {
|
|
|
this.formLoading = false;
|
|
|
this.$errorMsg('单个规格的佣金比例范围在0-40');
|
|
|
return;
|
|
@@ -963,21 +914,21 @@ export default {
|
|
|
}
|
|
|
|
|
|
let images = [];
|
|
|
- for(let i=0; i<this.step1Form.images.length; i++) {
|
|
|
+ for (let i = 0; i < this.step1Form.images.length; i++) {
|
|
|
let obj = {};
|
|
|
obj.id = this.step1Form.images[i].id;
|
|
|
images.push(obj);
|
|
|
}
|
|
|
|
|
|
let categoryId = '';
|
|
|
- if(typeof this.step1Form.classify == 'string') {
|
|
|
+ if (typeof this.step1Form.classify == 'string') {
|
|
|
categoryId = this.step1Form.classify;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
categoryId = this.step1Form.classify[1];
|
|
|
}
|
|
|
|
|
|
let marketingName = '';
|
|
|
- if(this.step1Form.marketing) {
|
|
|
+ if (this.step1Form.marketing) {
|
|
|
marketingName = this.marketingList[this.$findElem(this.marketingList, 'id', this.step1Form.marketing)].name;
|
|
|
}
|
|
|
|
|
@@ -1011,13 +962,13 @@ export default {
|
|
|
}
|
|
|
console.log(params);
|
|
|
|
|
|
- if(this.isEdit) {
|
|
|
+ if (this.isEdit) {
|
|
|
params.goodsId = this.editId;
|
|
|
editGoods(params).then(res => {
|
|
|
this.formLoading = false;
|
|
|
// this.$refs.mainForm.resetFields();
|
|
|
this.$successMsg('编辑成功');
|
|
|
- setTimeout(()=>{
|
|
|
+ setTimeout(() => {
|
|
|
this.goBack();
|
|
|
}, 1000)
|
|
|
}).catch(err => {
|
|
@@ -1028,7 +979,7 @@ export default {
|
|
|
this.formLoading = false;
|
|
|
// this.$refs.mainForm.resetFields();
|
|
|
this.$successMsg('新增成功');
|
|
|
- setTimeout(()=>{
|
|
|
+ setTimeout(() => {
|
|
|
this.goBack();
|
|
|
}, 1000)
|
|
|
}).catch(err => {
|
|
@@ -1111,7 +1062,7 @@ export default {
|
|
|
uploadSuccess4(res, file, fileList) {
|
|
|
console.log(fileList);
|
|
|
fileList.forEach(item => {
|
|
|
- if(this.editorImages.indexOf(item.response.data.url) < 0) {
|
|
|
+ if (this.editorImages.indexOf(item.response.data.url) < 0) {
|
|
|
this.editorImages.push(item.response.data.url);
|
|
|
}
|
|
|
})
|
|
@@ -1144,25 +1095,25 @@ export default {
|
|
|
},
|
|
|
|
|
|
changeGoodsPrice() {
|
|
|
- if(!this.canChangeGoodsPrice) { return false };
|
|
|
- if(!this.step2Form.specType) {
|
|
|
+ if (!this.canChangeGoodsPrice) { return false };
|
|
|
+ if (!this.step2Form.specType) {
|
|
|
this.step2Form.price = this.specForm.price;
|
|
|
// this.$set(this.step2Form, 'price', this.specForm.price);
|
|
|
- }else {
|
|
|
- if(this.specList.length > 0) {
|
|
|
+ } else {
|
|
|
+ if (this.specList.length > 0) {
|
|
|
let allPrice = [];
|
|
|
this.specList.forEach(item => {
|
|
|
allPrice.push(item.price);
|
|
|
})
|
|
|
this.step2Form.price = Math.min(...allPrice);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
this.step2Form.price = '';
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
|
|
|
computeShareAmount() {
|
|
|
- this.specForm.shareAmount = (this.specForm.price*100 - this.specForm.costPrice*100) / 100;
|
|
|
+ this.specForm.shareAmount = (this.specForm.price * 100 - this.specForm.costPrice * 100) / 100;
|
|
|
},
|
|
|
|
|
|
// 轮播图 - 点击上传图片
|
|
@@ -1173,11 +1124,11 @@ export default {
|
|
|
|
|
|
// 轮播图 - 上传成功
|
|
|
uploadSuccess2(res, file) {
|
|
|
- if(this.uploadImageId) {
|
|
|
+ if (this.uploadImageId) {
|
|
|
let index = this.$findElem(this.step1Form.images, 'id', this.uploadImageId);
|
|
|
this.$set(this.step1Form.images, index, res.data);
|
|
|
- }else {
|
|
|
- if(this.step1Form.images.length >= 6) {
|
|
|
+ } else {
|
|
|
+ if (this.step1Form.images.length >= 6) {
|
|
|
return this.$errorMsg('最多上传6张轮播图');
|
|
|
}
|
|
|
this.step1Form.images.push(res.data);
|
|
@@ -1206,26 +1157,26 @@ export default {
|
|
|
|
|
|
// 轮播图 - 向前移动
|
|
|
moveForward(index) {
|
|
|
- if(index != 0) {
|
|
|
+ if (index != 0) {
|
|
|
let arr = this.step1Form.images;
|
|
|
let thisItem = arr[index];
|
|
|
let targetItem = arr[index - 1];
|
|
|
this.$set(this.step1Form.images, index, targetItem);
|
|
|
this.$set(this.step1Form.images, index - 1, thisItem);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
this.$errorMsg('已经最前,无法前移');
|
|
|
}
|
|
|
},
|
|
|
|
|
|
// 轮播图 - 向后移动
|
|
|
moveBack(index) {
|
|
|
- if(index+1 < this.step1Form.images.length) {
|
|
|
+ if (index + 1 < this.step1Form.images.length) {
|
|
|
let arr = this.step1Form.images;
|
|
|
let thisItem = arr[index];
|
|
|
let targetItem = arr[index + 1];
|
|
|
this.$set(this.step1Form.images, index, targetItem);
|
|
|
this.$set(this.step1Form.images, index + 1, thisItem);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
this.$errorMsg('已经最后,无法后移');
|
|
|
}
|
|
|
},
|
|
@@ -1248,170 +1199,196 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
- .step-container {
|
|
|
- padding: 0 10%;
|
|
|
+.step-container {
|
|
|
+ padding: 0 10%;
|
|
|
+}
|
|
|
+
|
|
|
+.form-container {
|
|
|
+ margin-top: 40px;
|
|
|
+ padding: 0 10%;
|
|
|
+
|
|
|
+ .title {
|
|
|
+ font-size: 16px;
|
|
|
+ margin-bottom: 30px;
|
|
|
+ padding-left: 10px;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+
|
|
|
+ .tips {
|
|
|
+ margin-top: 10px;
|
|
|
+
|
|
|
+ span {
|
|
|
+ display: inline-block;
|
|
|
+ width: 300px;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 32px;
|
|
|
+ background: #ffefef;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #f66460;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .tips2 {
|
|
|
+ font-size: 12px;
|
|
|
+ color: #999999;
|
|
|
+ line-height: 30px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .container {
|
|
|
+ padding: 10px 20px 0;
|
|
|
+ background: #f5f5f5;
|
|
|
+ border-radius: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .addBtn {
|
|
|
+ padding: 10px 0;
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+@media only screen and (max-width: 1200px) {
|
|
|
.form-container {
|
|
|
- margin-top: 40px;
|
|
|
padding: 0 10%;
|
|
|
- .title {
|
|
|
- font-size: 16px;
|
|
|
- margin-bottom: 30px;
|
|
|
- padding-left: 10px;
|
|
|
- font-weight: bold;
|
|
|
- }
|
|
|
- .tips {
|
|
|
- margin-top: 10px;
|
|
|
- span {
|
|
|
- display: inline-block;
|
|
|
- width: 300px;
|
|
|
- text-align: center;
|
|
|
- line-height: 32px;
|
|
|
- background: #ffefef;
|
|
|
- font-size: 14px;
|
|
|
- color: #f66460;
|
|
|
- }
|
|
|
- }
|
|
|
- .tips2 {
|
|
|
- font-size: 12px;
|
|
|
- color: #999999;
|
|
|
- line-height: 30px;
|
|
|
- }
|
|
|
- .container {
|
|
|
- padding: 10px 20px 0;
|
|
|
- background: #f5f5f5;
|
|
|
- border-radius: 10px;
|
|
|
- }
|
|
|
- .addBtn {
|
|
|
- padding: 10px 0;
|
|
|
- }
|
|
|
}
|
|
|
- @media only screen and (max-width: 1200px) {
|
|
|
- .form-container {
|
|
|
- padding: 0 10%;
|
|
|
- }
|
|
|
+}
|
|
|
+
|
|
|
+@media only screen and (max-width: 768px) {
|
|
|
+ .step-container {
|
|
|
+ padding: 0;
|
|
|
}
|
|
|
- @media only screen and (max-width: 768px) {
|
|
|
- .step-container {
|
|
|
- padding: 0;
|
|
|
- }
|
|
|
- .form-container {
|
|
|
- padding: 0 5%;
|
|
|
- }
|
|
|
+
|
|
|
+ .form-container {
|
|
|
+ padding: 0 5%;
|
|
|
}
|
|
|
+}
|
|
|
</style>
|
|
|
|
|
|
<style lang="scss">
|
|
|
- // 图片墙
|
|
|
- .el-upload-list--picture-card .el-upload-list__item {
|
|
|
- width: 100px;
|
|
|
- height: 100px;
|
|
|
- }
|
|
|
- .el-upload--picture-card {
|
|
|
+// 图片墙
|
|
|
+.el-upload-list--picture-card .el-upload-list__item {
|
|
|
+ width: 100px;
|
|
|
+ height: 100px;
|
|
|
+}
|
|
|
+
|
|
|
+.el-upload--picture-card {
|
|
|
+ width: 100px;
|
|
|
+ height: 100px;
|
|
|
+ line-height: 100px;
|
|
|
+
|
|
|
+ .avatar-uploader-icon {
|
|
|
+ font-size: 28px;
|
|
|
+ color: #8c939d;
|
|
|
width: 100px;
|
|
|
height: 100px;
|
|
|
line-height: 100px;
|
|
|
- .avatar-uploader-icon {
|
|
|
- font-size: 28px;
|
|
|
- color: #8c939d;
|
|
|
- width: 100px;
|
|
|
- height: 100px;
|
|
|
- line-height: 100px;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
+ text-align: center;
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- .el-input.small input {
|
|
|
- width: 300px;
|
|
|
- }
|
|
|
+.el-input.small input {
|
|
|
+ width: 300px;
|
|
|
+}
|
|
|
|
|
|
- .avatar-uploader2 {
|
|
|
- height: 0;
|
|
|
- }
|
|
|
+.avatar-uploader2 {
|
|
|
+ height: 0;
|
|
|
+}
|
|
|
|
|
|
- .container {
|
|
|
- .el-form-item__label {
|
|
|
- padding-bottom: 0;
|
|
|
- }
|
|
|
- .el-form-item {
|
|
|
- margin-bottom: 5px;
|
|
|
- }
|
|
|
+.container {
|
|
|
+ .el-form-item__label {
|
|
|
+ padding-bottom: 0;
|
|
|
}
|
|
|
- .ql-editor{
|
|
|
- min-height:300px;
|
|
|
+
|
|
|
+ .el-form-item {
|
|
|
+ margin-bottom: 5px;
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+.ql-editor {
|
|
|
+ min-height: 300px;
|
|
|
+}
|
|
|
</style>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
- .images {
|
|
|
+.images {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+
|
|
|
+ .item {
|
|
|
display: flex;
|
|
|
- flex-wrap: wrap;
|
|
|
- .item {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
- width: 120px;
|
|
|
- margin-right: 20px;
|
|
|
- margin-bottom: 20px;
|
|
|
- .img {
|
|
|
- border: 1px dashed #eaeaea;
|
|
|
- border-radius: 5px;
|
|
|
- overflow: hidden;
|
|
|
- position: relative;
|
|
|
- .el-image {
|
|
|
- display: block;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ width: 120px;
|
|
|
+ margin-right: 20px;
|
|
|
+ margin-bottom: 20px;
|
|
|
+
|
|
|
+ .img {
|
|
|
+ border: 1px dashed #eaeaea;
|
|
|
+ border-radius: 5px;
|
|
|
+ overflow: hidden;
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ .el-image {
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+
|
|
|
+ .mask {
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ top: 0;
|
|
|
+ width: 120px;
|
|
|
+ height: 120px;
|
|
|
+ background: rgba($color: #000000, $alpha: 0.5);
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ flex-direction: column;
|
|
|
+ opacity: 0;
|
|
|
+
|
|
|
+ &:hover {
|
|
|
+ opacity: 1;
|
|
|
}
|
|
|
- .mask {
|
|
|
- position: absolute;
|
|
|
- left: 0;
|
|
|
- top: 0;
|
|
|
- width: 120px;
|
|
|
- height: 120px;
|
|
|
- background: rgba($color: #000000, $alpha: 0.5);
|
|
|
+
|
|
|
+ .row {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
- flex-direction: column;
|
|
|
- opacity: 0;
|
|
|
- &:hover {
|
|
|
- opacity: 1;
|
|
|
- }
|
|
|
- .row {
|
|
|
+
|
|
|
+ .it {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
- .it {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- cursor: pointer;
|
|
|
- margin: 5px;
|
|
|
- i {
|
|
|
- font-size: 20px;
|
|
|
- color: #ffffff;
|
|
|
- }
|
|
|
- span {
|
|
|
- font-size: 14px;
|
|
|
- color: #ffffff;
|
|
|
- }
|
|
|
+ cursor: pointer;
|
|
|
+ margin: 5px;
|
|
|
+
|
|
|
+ i {
|
|
|
+ font-size: 20px;
|
|
|
+ color: #ffffff;
|
|
|
+ }
|
|
|
+
|
|
|
+ span {
|
|
|
+ font-size: 14px;
|
|
|
+ color: #ffffff;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .add {
|
|
|
- border: 1px dashed #eaeaea;
|
|
|
- border-radius: 5px;
|
|
|
- cursor: pointer;
|
|
|
- .avatar-uploader-icon {
|
|
|
- width: 120px;
|
|
|
- height: 120px;
|
|
|
- line-height: 120px;
|
|
|
- }
|
|
|
- &:hover {
|
|
|
- border: 1px dashed #66b1ff;
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ .add {
|
|
|
+ border: 1px dashed #eaeaea;
|
|
|
+ border-radius: 5px;
|
|
|
+ cursor: pointer;
|
|
|
+
|
|
|
+ .avatar-uploader-icon {
|
|
|
+ width: 120px;
|
|
|
+ height: 120px;
|
|
|
+ line-height: 120px;
|
|
|
+ }
|
|
|
+
|
|
|
+ &:hover {
|
|
|
+ border: 1px dashed #66b1ff;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+}
|
|
|
</style>
|