|
|
<template>
|
|
|
<div>
|
|
|
<Form ref="product" :model="product" :label-width="70" :rules="ruleValidate">
|
|
|
|
|
|
<Row>
|
|
|
<div class="create-group">
|
|
|
<span class="create-group-indicator"></span>
|
...
|
...
|
@@ -10,78 +9,36 @@ |
|
|
</div>
|
|
|
</Row>
|
|
|
|
|
|
<Row>
|
|
|
<Col>
|
|
|
<div class="create-item-title">商品基本信息</div>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
<Row> <div class="create-item-title">商品基本信息</div> </Row>
|
|
|
|
|
|
<Row>
|
|
|
<div class="ivu-form-item ivu-form-item-required">
|
|
|
<label class="ivu-form-item-label" style="width: 100px;">品牌</label>
|
|
|
<div style="float: left; line-height: 1; padding: 10px 12px 10px 0; box-sizing: border-box;">
|
|
|
<span>{{product.brandName}}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</Row>
|
|
|
<Form-item label="品牌"> <span>{{product.brandName}}</span> </Form-item>
|
|
|
|
|
|
<Row>
|
|
|
<div class="ivu-form-item ivu-form-item-required">
|
|
|
<label class="ivu-form-item-label" style="width: 100px;">类目</label>
|
|
|
<span style="float: left; line-height: 1; padding: 10px 12px 10px 0; box-sizing: border-box;">
|
|
|
<span>{{sortName}}</span>
|
|
|
</span>
|
|
|
</div>
|
|
|
</Row>
|
|
|
<Form-item label="类目"> <span>{{sortName}}</span> </Form-item>
|
|
|
|
|
|
<Row>
|
|
|
<Col span="8">
|
|
|
<Form-item label="商品名称" prop="productName">
|
|
|
<Input v-model="product.productName" placeholder="请输入..."/>
|
|
|
</Form-item>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
<Form-item label="商品名称" prop="productName">
|
|
|
<Input v-model="product.productName" placeholder="请输入..." style="width: 400px;"/>
|
|
|
</Form-item>
|
|
|
|
|
|
<Row>
|
|
|
<Col span="8">
|
|
|
<Form-item label="商品卖点">
|
|
|
<Input v-model="product.phrase" type="textarea" :rows="4" placeholder="请输入..."/>
|
|
|
</Form-item>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
<Form-item label="商品卖点">
|
|
|
<Input v-model="product.phrase" type="textarea" :rows="4" placeholder="请输入..." style="width: 400px;"/>
|
|
|
</Form-item>
|
|
|
|
|
|
<Row>
|
|
|
<Col span="8">
|
|
|
<Form-item label="商家商品编码" prop="factoryCode">
|
|
|
<Input v-model="product.factoryCode" placeholder="请输入..."/>
|
|
|
</Form-item>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
<Form-item label="商家商品编码" prop="factoryCode">
|
|
|
<Input v-model="product.factoryCode" placeholder="请输入..." style="width: 400px;"/>
|
|
|
</Form-item>
|
|
|
|
|
|
<Row>
|
|
|
<Col span="8">
|
|
|
<Form-item label="货品年" prop="goodsYears">
|
|
|
<Date-picker :value="product.goodsYears" @on-change="clickGoodsYear" type="year" placeholder="选择年" style="width: 200px">
|
|
|
</Date-picker>
|
|
|
</Form-item>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
<Form-item label="货品年" prop="goodsYears">
|
|
|
<Date-picker :value="product.goodsYears" @on-change="clickGoodsYear" type="year" placeholder="选择年" style="width: 400px">
|
|
|
</Date-picker>
|
|
|
</Form-item>
|
|
|
|
|
|
<Row>
|
|
|
<Col span="8">
|
|
|
<Form-item label="货品季" prop="goodsSeason">
|
|
|
<SelectSeason v-model="product.goodsSeason"></SelectSeason>
|
|
|
</Form-item>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
<Form-item label="货品季" prop="goodsSeason">
|
|
|
<SelectSeason v-model="product.goodsSeason"></SelectSeason>
|
|
|
</Form-item>
|
|
|
|
|
|
<Row>
|
|
|
<Col span="8">
|
|
|
<Form-item label="上市日期" prop="expectSaleTimeStr">
|
|
|
<Date-picker :value="product.expectSaleTimeStr" @on-change="clickSaleDate" type="date" placeholder="选择日期" style="width: 200px"></Date-picker>
|
|
|
</Form-item>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
<Form-item label="上市日期" prop="expectSaleTimeStr">
|
|
|
<Date-picker :value="product.expectSaleTimeStr" @on-change="clickSaleDate" type="date" placeholder="选择日期" style="width: 400px"></Date-picker>
|
|
|
</Form-item>
|
|
|
|
|
|
<Form-item label="性别" prop="gender">
|
|
|
<RadioGender v-model="product.gender"></RadioGender>
|
...
|
...
|
@@ -91,20 +48,16 @@ |
|
|
<RadioSeason v-model="product.seasons"></RadioSeason>
|
|
|
</Form-item>
|
|
|
|
|
|
|
|
|
<Form-item label="年龄层" prop="ageLevel">
|
|
|
<CheckboxAge v-model="product.ageLevel"></CheckboxAge>
|
|
|
</Form-item>
|
|
|
|
|
|
<Row>
|
|
|
<Col>
|
|
|
<div class="create-item-title">商品规格
|
|
|
<span class="create-group-sub-title">(颜色名称只能填写中文,最多5个汉字。款型编码和条码只能填写英文和数字,不区分大小写)</span>
|
|
|
</div>
|
|
|
</Col>
|
|
|
<div class="create-item-title">商品规格
|
|
|
<span class="create-group-sub-title">(颜色名称只能填写中文,最多5个汉字。款型编码和条码只能填写英文和数字,不区分大小写)</span>
|
|
|
</div>
|
|
|
</Row>
|
|
|
|
|
|
|
|
|
<Form-item label="颜色" prop="selectColor">
|
|
|
<CheckboxColor v-model="product.selectColor" @on-add="addColor" @on-remove="removeColor"></CheckboxColor>
|
|
|
</Form-item>
|
...
|
...
|
@@ -113,45 +66,25 @@ |
|
|
<CheckboxSize v-model="product.selectSize" :sort-id="product.smallSortId" @on-add="addSize" @on-remove="removeSize"></CheckboxSize>
|
|
|
</Form-item>
|
|
|
|
|
|
<Row>
|
|
|
<Form-item >
|
|
|
<Table ref="sellerGoods" :context="self" :data="table.data" :columns="table.columns" stripe border></Table>
|
|
|
</Form-item>
|
|
|
</Row>
|
|
|
|
|
|
<Row>
|
|
|
<Col>
|
|
|
<div class="create-item-title">商品价格</div>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
|
|
|
<Row>
|
|
|
<Col span="8">
|
|
|
<Form-item label="吊牌价" prop="retailPrice">
|
|
|
<Input v-model="product.retailPrice" :number="true" placeholder="请输入..."/>
|
|
|
</Form-item>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
<Form-item >
|
|
|
<TableCreateGoodSize ref="sellerGoods" v-model="table.data"></TableCreateGoodSize>
|
|
|
</Form-item>
|
|
|
|
|
|
<Row> <div class="create-item-title">商品价格</div> </Row>
|
|
|
|
|
|
<Row>
|
|
|
<Col span="8">
|
|
|
<Form-item label="销售价" prop="salesPrice">
|
|
|
<Input v-model="product.salesPrice" :number="true" placeholder="请输入..."/>
|
|
|
</Form-item>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
<Form-item label="吊牌价" prop="retailPrice">
|
|
|
<Input v-model="product.retailPrice" :number="true" placeholder="请输入..." style="width: 400px;"/>
|
|
|
</Form-item>
|
|
|
|
|
|
<Form-item label="销售价" prop="salesPrice">
|
|
|
<Input v-model="product.salesPrice" :number="true" placeholder="请输入..." style="width: 400px;"/>
|
|
|
</Form-item>
|
|
|
</Form>
|
|
|
|
|
|
<Row>
|
|
|
<Col>
|
|
|
<div style="text-align: center">
|
|
|
<Button type="primary" @click="nextStep(1)" size="large">下一步</Button>
|
|
|
<Button type="primary" @click="nextStep(0)" size="large">保存并退出</Button>
|
|
|
</div>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
<div style="text-align: center">
|
|
|
<Button type="primary" @click="nextStep(1)" size="large">下一步</Button>
|
|
|
<Button type="primary" @click="nextStep(0)" size="large">保存并退出</Button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
...
|
...
|
@@ -163,6 +96,7 @@ import {CheckboxAge, CheckboxColor, CheckboxSize} from 'components/checkbox'; |
|
|
import {RadioSeason, RadioGender} from 'components/radio';
|
|
|
import {SelectSeason} from 'components/select';
|
|
|
import {ExamplePop} from 'components/pop';
|
|
|
import {TableCreateGoodSize} from 'components/table';
|
|
|
|
|
|
const makeColor = () => {
|
|
|
return {
|
...
|
...
|
@@ -238,128 +172,6 @@ export default { |
|
|
self: this,
|
|
|
colors: [],
|
|
|
table: {
|
|
|
columns: [
|
|
|
{
|
|
|
title: '色系名称',
|
|
|
key: 'goodsName',
|
|
|
render(row, col, index) {
|
|
|
return `<div v-if="isExist(${index})">
|
|
|
<p>{{table.data[${index}].goodsName.name}}</p>
|
|
|
<Radio :value="table.data[${index}].goodsName.isDefault"
|
|
|
@on-change="clickDefault(${index})">主推</Radio>
|
|
|
</div>`;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
title: '颜色展示名称',
|
|
|
key: 'factoryGoodsName',
|
|
|
render(row, col, index) {
|
|
|
return `<div v-if="isExist(${index})">
|
|
|
<i-input
|
|
|
v-model="row.factoryGoodsName"
|
|
|
:placeholder="row.goodsName.name">
|
|
|
</i-input>
|
|
|
</div>`;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
title: '色卡图片',
|
|
|
key: 'goodsColorImage',
|
|
|
width: 170,
|
|
|
render(row, col, index) {
|
|
|
return `<div
|
|
|
:class="{'upload-item': true ,
|
|
|
'upload-item-error':
|
|
|
row.goodsColorImage.showValidate && row.goodsColorImage.validate}"
|
|
|
>
|
|
|
<div class="upload-item-img">
|
|
|
<img v-if="row.goodsColorImage.value"
|
|
|
:src="row.goodsColorImage.value" alt="" width="120px" height="122px">
|
|
|
</div>
|
|
|
<div>
|
|
|
<file-upload :id="{index: ${index}}"
|
|
|
@on-success="uploadSuccess"
|
|
|
@on-error="uploadError"></file-upload>
|
|
|
<example-pop></example-pop>
|
|
|
</div>
|
|
|
<div v-if="row.goodsColorImage.showValidate && row.goodsColorImage.validate"
|
|
|
class="upload-item-tip">
|
|
|
必须上传图片
|
|
|
</div>
|
|
|
</div>`;
|
|
|
},
|
|
|
renderHeader(col, index) {
|
|
|
return `<span class="table-header">${col.title}</span>`;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
title: '款型编码',
|
|
|
key: 'factoryCode',
|
|
|
render(row, col, index) {
|
|
|
return `<div v-if="isExist(${index})">
|
|
|
<i-input
|
|
|
v-model="row.factoryCode"
|
|
|
placeholder="请输入..." >
|
|
|
</i-input>
|
|
|
</div>`;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
title: '尺码',
|
|
|
key: 'sizeId',
|
|
|
width: 80,
|
|
|
render(row, col, index) {
|
|
|
return `<div class="size-id">
|
|
|
<div v-for="size in row.sizeId" class="row-span">
|
|
|
{{size.name}}
|
|
|
</div>
|
|
|
</div>`;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
title: '商品条码',
|
|
|
key: 'sizeCode',
|
|
|
render(row, col, index) {
|
|
|
return `<div class='size-code'>
|
|
|
<div v-for="size,i in row.sizeCode" class="row-span">
|
|
|
<div style="position: relative">
|
|
|
<div :class="{'size-code-error': size.validate && !size.name}">
|
|
|
<i-input
|
|
|
v-model="size.name"
|
|
|
:disabled="!row.operator[i].value"
|
|
|
placeholder="请输入..."
|
|
|
/>
|
|
|
</div>
|
|
|
<div class="size-code-tip" v-if="size.validate && !size.name">
|
|
|
不能为空
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>`;
|
|
|
},
|
|
|
renderHeader(col, index) {
|
|
|
return `<span class="table-header">${col.title}</span>`;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
title: '操作',
|
|
|
key: 'operator',
|
|
|
width: 100,
|
|
|
render(row, col, index) {
|
|
|
return `<template v-if="isExist(${index})">
|
|
|
<div class="size-operator">
|
|
|
<div v-for="op,i in row.operator" class="row-span">
|
|
|
<i-button v-if="row.operator[i].value"
|
|
|
type="warning"
|
|
|
@click="clickOperator(row, i)">禁用</i-button>
|
|
|
<i-button v-else type="primary"
|
|
|
@click="clickOperator(row, i)">启用</i-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>`;
|
|
|
}
|
|
|
}
|
|
|
],
|
|
|
data: [],
|
|
|
selectedSizes: [],
|
|
|
selectedColors: [],
|
...
|
...
|
@@ -449,7 +261,7 @@ export default { |
|
|
this.beforeSubmit();
|
|
|
return api.saveBaseProductInfo(this.product);
|
|
|
}, () => {
|
|
|
this.$Message.error('表单验证失败!');
|
|
|
this.$Message.error('请填写必填项!');
|
|
|
});
|
|
|
},
|
|
|
nextStep: function(go) {
|
...
|
...
|
@@ -489,31 +301,6 @@ export default { |
|
|
saveAndQuit: function() {
|
|
|
this.$router.push({name: 'product.offsale'});
|
|
|
},
|
|
|
clickDefault: function(index) {
|
|
|
this.refreshTable();
|
|
|
let color = this.table.data[index];
|
|
|
|
|
|
|
|
|
color.goodsName.isDefault = true;
|
|
|
this.table.data.forEach((c) => {
|
|
|
if (c.colorId !== color.colorId) {
|
|
|
c.goodsName.isDefault = false;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
clickOperator: function(row, itemIndex) {
|
|
|
this.refreshTable();
|
|
|
row.operator[itemIndex].value = row.operator[itemIndex].value ? false : true;
|
|
|
|
|
|
if (row.operator[itemIndex].value) {
|
|
|
row.sizeCode[itemIndex].name = '';
|
|
|
row.sizeCode[itemIndex].validate = true;
|
|
|
} else {
|
|
|
row.sizeCode[itemIndex].name = '';
|
|
|
row.sizeCode[itemIndex].validate = false;
|
|
|
}
|
|
|
|
|
|
},
|
|
|
clickGoodsYear: function(value) {
|
|
|
this.product.goodsYears = value;
|
|
|
},
|
...
|
...
|
@@ -535,22 +322,6 @@ export default { |
|
|
|
|
|
_.first(this.table.data).goodsName.isDefault = true;
|
|
|
},
|
|
|
changeFactoryGoodsName: function(row, index) {
|
|
|
this.table.data[index].factoryGoodsName = row.factoryGoodsName;
|
|
|
},
|
|
|
changeFactoryCode: function(row, index) {
|
|
|
this.table.data[index].factoryCode = row.factoryCode;
|
|
|
},
|
|
|
changeSizeCode: function(row, rowIndex, sizeIndex) {
|
|
|
this.table.data[rowIndex].sizeCode[sizeIndex].name = row.sizeCode[sizeIndex].name;
|
|
|
|
|
|
this.table.data[rowIndex].sizeCode[sizeIndex].validate = true;
|
|
|
if (this.table.data[rowIndex].sizeCode[sizeIndex].name) {
|
|
|
this.table.data[rowIndex].sizeCode[sizeIndex].showValidate = false;
|
|
|
} else {
|
|
|
this.table.data[rowIndex].sizeCode[sizeIndex].showValidate = true;
|
|
|
}
|
|
|
},
|
|
|
addColor: function(color) {
|
|
|
this.refreshTable();
|
|
|
this.addColorData(color);
|
...
|
...
|
@@ -646,33 +417,11 @@ export default { |
|
|
});
|
|
|
|
|
|
color.operator.push({
|
|
|
value: true
|
|
|
value: false
|
|
|
});
|
|
|
},
|
|
|
isExist: function(index) {
|
|
|
let row = this.table.data[index];
|
|
|
|
|
|
if (row) {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
},
|
|
|
uploadSuccess: function(attach, files) {
|
|
|
this.refreshTable();
|
|
|
this.table.data[attach.index].goodsColorImage.value = files[0];
|
|
|
|
|
|
this.table.data[attach.index].goodsColorImage.validate = true;
|
|
|
if (this.table.data[attach.index].goodsColorImage.value) {
|
|
|
this.table.data[attach.index].goodsColorImage.showValidate = false;
|
|
|
} else {
|
|
|
this.table.data[attach.index].goodsColorImage.showValidate = true;
|
|
|
}
|
|
|
},
|
|
|
refreshTable() {
|
|
|
this.table.data = this.$refs.sellerGoods.rebuildData;
|
|
|
},
|
|
|
uploadError: function(attach, err) {
|
|
|
this.$refs.sellerGoods.syncData();
|
|
|
},
|
|
|
validateOtherProps: function() {
|
|
|
return new Promise((resolve, reject) => {
|
...
|
...
|
@@ -782,124 +531,12 @@ export default { |
|
|
SelectSeason,
|
|
|
CheckboxColor,
|
|
|
CheckboxSize,
|
|
|
ExamplePop
|
|
|
ExamplePop,
|
|
|
TableCreateGoodSize
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
@mixin row-span{
|
|
|
min-height: 30px;
|
|
|
|
|
|
.row-span {
|
|
|
min-height: 30px;
|
|
|
border-bottom: 1px solid #e3e8ee;
|
|
|
padding-top: 20px ;
|
|
|
padding-bottom: 20px ;
|
|
|
margin-left: -18px;
|
|
|
margin-right: -18px;
|
|
|
padding-left: 18px ;
|
|
|
padding-right: 18px ;
|
|
|
|
|
|
&:last-child {
|
|
|
border-bottom: none;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.squre {
|
|
|
display: inline-block;
|
|
|
height: 30px;
|
|
|
margin-right: 10px;
|
|
|
cursor: pointer;
|
|
|
border: 1px solid white;
|
|
|
}
|
|
|
|
|
|
.squre-selected {
|
|
|
border: 1px solid black;
|
|
|
}
|
|
|
|
|
|
.squre-disabled {
|
|
|
color: gray;
|
|
|
opacity: 0.5;
|
|
|
cursor: not-allowed;
|
|
|
border: 1px solid gray;
|
|
|
}
|
|
|
|
|
|
.squre-color {
|
|
|
display: inline-block;
|
|
|
height: 28px;
|
|
|
width: 28px;
|
|
|
}
|
|
|
|
|
|
.squre-name {
|
|
|
display: inline-block;
|
|
|
height: 30px;
|
|
|
line-height: 30px;
|
|
|
vertical-align: top;
|
|
|
}
|
|
|
|
|
|
.size-code {
|
|
|
@include row-span;
|
|
|
|
|
|
&-error {
|
|
|
border: 1px solid #f30;
|
|
|
}
|
|
|
|
|
|
&-tip {
|
|
|
position: absolute;
|
|
|
line-height: 1;
|
|
|
padding-top: 6px;
|
|
|
color: #f30;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.size-id {
|
|
|
@include row-span;
|
|
|
text-align: center;
|
|
|
}
|
|
|
|
|
|
.size-operator {
|
|
|
@include row-span;
|
|
|
text-align: center;
|
|
|
}
|
|
|
|
|
|
.upload-item {
|
|
|
display: inline-block;
|
|
|
height: 220px;
|
|
|
width: 130px;
|
|
|
text-align: center;
|
|
|
margin: 30px 0;
|
|
|
}
|
|
|
|
|
|
.upload-item-error {
|
|
|
border: 1px solid #f30;
|
|
|
}
|
|
|
|
|
|
.upload-item-tip {
|
|
|
padding-top: 6px;
|
|
|
color: #f30;
|
|
|
top: 100%;
|
|
|
}
|
|
|
|
|
|
.upload-item-img {
|
|
|
display: inline-block;
|
|
|
height: 126px;
|
|
|
width: 124px;
|
|
|
border: 2px solid #e8e8e8;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
|
|
|
.table-header {
|
|
|
&:after {
|
|
|
content: '*';
|
|
|
display: inline-block;
|
|
|
margin-left: 4px;
|
|
|
line-height: 1;
|
|
|
font-family: SimSun;
|
|
|
font-size: 12px;
|
|
|
color: #f30;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
</style> |
...
|
...
|
|