修复管理端积分商品问题

master
paulGao 2021-12-23 17:11:30 +08:00
parent d762d18c7b
commit 1e408eb8ae
6 changed files with 378 additions and 202 deletions

View File

@ -224,7 +224,7 @@ export default {
count: 1, // count: 1, //
imgIndex: 0, // imgIndex: 0, //
currentSelceted: [], // sku currentSelceted: [], // sku
imgList: [{url:''}], // imgList: [{ url: "" }], //
skuDetail: this.detail.data, // sku skuDetail: this.detail.data, // sku
goodsSpecList: this.detail.specs, // spec goodsSpecList: this.detail.specs, // spec
promotionMap: { promotionMap: {

View File

@ -239,7 +239,7 @@ export const updatePointsGoods = params => {
}; };
// 修改积分商品状态 // 修改积分商品状态
export const editPointsGoodsStatus = (id, params) => { export const editPointsGoodsStatus = (id, params) => {
return putRequest(`/promotion/pointsGoods/${id}`, params); return putRequest(`/promotion/pointsGoods/status/${id}`, params);
}; };
// 删除积分商品 // 删除积分商品
export const deletePointsGoodsStatus = id => { export const deletePointsGoodsStatus = id => {

View File

@ -165,7 +165,7 @@
</FormItem> </FormItem>
<div> <div>
<Button @click="$router.push({ name: 'fullCut' })">返回</Button> <Button @click="$router.push({ name: 'full-discount' })">返回</Button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -15,14 +15,14 @@
<div>{{ form.goodsSku.storeName }}</div> <div>{{ form.goodsSku.storeName }}</div>
</FormItem> </FormItem>
<FormItem label="商品价格"> <FormItem label="商品价格">
<div>{{ form.goodsSku.price | unitPrice('¥') }}</div> <div>{{ form.goodsSku.price | unitPrice("¥") }}</div>
</FormItem> </FormItem>
<FormItem label="库存"> <FormItem label="库存">
<div>{{ form.goodsSku.quantity }}</div> <div>{{ form.goodsSku.quantity }}</div>
</FormItem> </FormItem>
<FormItem label="结算价格" prop="settlementPrice"> <FormItem label="结算价格" prop="settlementPrice">
<Input <Input
type="num" type="number"
v-model="form.settlementPrice" v-model="form.settlementPrice"
placeholder="请填写结算价格" placeholder="请填写结算价格"
clearable clearable
@ -32,19 +32,16 @@
<FormItem label="分类" prop="pointsGoodsCategoryId"> <FormItem label="分类" prop="pointsGoodsCategoryId">
<Select <Select
v-model="form.pointsGoodsCategoryId" v-model="form.pointsGoodsCategoryId"
label-in-value="true" :label-in-value="true"
@on-change=" @on-change="
(val) => { (val) => {
changeCategory(val, index); changeCategory(val, index);
} }
" "
> >
<Option <Option v-for="item in categoryList" :value="item.id" :key="item.id">{{
v-for="item in categoryList" item.name
:value="item.id" }}</Option>
:key="item.id"
>{{ item.name }}</Option
>
</Select> </Select>
</FormItem> </FormItem>
<FormItem label="活动库存" prop="activeStock"> <FormItem label="活动库存" prop="activeStock">
@ -65,36 +62,21 @@
style="width: 260px" style="width: 260px"
/> />
</FormItem> </FormItem>
<FormItem label="活动开始时间" prop="startTime"> <FormItem label="活动开始时间">
<DatePicker <DatePicker
type="datetime" type="datetimerange"
v-model="form.startTime" v-model="form.rangeTime"
format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss"
:options="options"
placeholder="请选择" placeholder="请选择"
clearable
style="width: 200px"
>
</DatePicker>
-
<DatePicker
type="datetime"
v-model="form.endTime"
format="yyyy-MM-dd HH:mm:ss"
:options="options" :options="options"
placeholder="请选择" style="width: 260px"
clearable
style="width: 200px"
> >
</DatePicker> </DatePicker>
</FormItem> </FormItem>
</div> </div>
<div class="footer"> <div class="footer">
<Button @click="closeCurrentPage" style="margin-right: 5px">返回</Button> <Button @click="closeCurrentPage" style="margin-right: 5px">返回</Button>
<Button <Button type="primary" :loading="submitLoading" @click="handleSubmit"
type="primary"
:loading="submitLoading"
@click="handleSubmit"
>保存</Button >保存</Button
> >
</div> </div>
@ -134,11 +116,13 @@ export default {
submitLoading: false, // submitLoading: false, //
formRule: { formRule: {
settlementPrice: [{ required: true, message: "请填写结算价格" }], settlementPrice: [{ required: true, message: "请填写结算价格" }],
pointsGoodsCategoryId: [ pointsGoodsCategoryId: [{ required: true, message: "请选择积分商品分类" }],
{ required: true, message: "请选择积分商品分类" },
],
points: [{ required: true, message: "请填写兑换积分" }], points: [{ required: true, message: "请填写兑换积分" }],
startTime: [{ required: true, message: "请填写活动开始时间" }], },
options: {
disabledDate(date) {
return date && date.valueOf() < Date.now() - 86400000;
},
}, },
}; };
}, },
@ -153,9 +137,7 @@ export default {
// //
closeCurrentPage() { closeCurrentPage() {
this.$store.commit("removeTag", "edit-points-goods"); this.$store.commit("removeTag", "edit-points-goods");
localStorage.pageOpenedList = JSON.stringify( localStorage.pageOpenedList = JSON.stringify(this.$store.state.app.pageOpenedList);
this.$store.state.app.pageOpenedList
);
this.$router.go(-1); this.$router.go(-1);
}, },
// //
@ -164,6 +146,10 @@ export default {
if (res.success) { if (res.success) {
let data = res.result; let data = res.result;
this.form = data; this.form = data;
data.rangeTime = [];
if (data.startTime && data.endTime) {
data.rangeTime.push(new Date(data.startTime), new Date(data.endTime));
}
} }
}); });
}, },
@ -176,12 +162,8 @@ export default {
handleSubmit() { handleSubmit() {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
const start = this.$options.filters.unixToDate( const start = this.$options.filters.unixToDate(this.form.rangeTime[0] / 1000);
this.form.startTime / 1000 const end = this.$options.filters.unixToDate(this.form.rangeTime[1] / 1000);
);
const end = this.$options.filters.unixToDate(
this.form.endTime / 1000
);
this.form.startTime = start; this.form.startTime = start;
this.form.endTime = end; this.form.endTime = end;
this.submitLoading = true; this.submitLoading = true;

View File

@ -105,7 +105,7 @@
</template> </template>
<template slot-scope="{ row }" slot="action"> <template slot-scope="{ row }" slot="action">
<Button <Button
v-if="row.promotionStatus == 'NEW'" v-if="row.promotionStatus !== 'START'"
type="info" type="info"
size="small" size="small"
@click="edit(row.id)" @click="edit(row.id)"
@ -113,7 +113,7 @@
>编辑</Button >编辑</Button
> >
<Button <Button
v-if="row.promotionStatus == 'START'" v-if="row.promotionStatus === 'START' || row.promotionStatus === 'NEW'"
type="warning" type="warning"
size="small" size="small"
@click="statusChanged(row.id, 'CLOSE')" @click="statusChanged(row.id, 'CLOSE')"
@ -121,14 +121,12 @@
>关闭</Button >关闭</Button
> >
<Button <Button
v-if="row.promotionStatus == 'CLOSE'" v-if="row.promotionStatus === 'CLOSE'"
type="warning" type="error"
size="small" size="small"
@click="statusChanged(row.id, 'START')" @click="close(row.id)"
style="margin-right: 5px" >删除</Button
>开启</Button
> >
<Button type="error" size="small" @click="close(row.id)"></Button>
</template> </template>
</Table> </Table>
<Row type="flex" justify="end" class="mt_10"> <Row type="flex" justify="end" class="mt_10">

View File

@ -1,29 +1,57 @@
<template> <template>
<div> <div>
<div class="content-goods-publish"> <div class="content-goods-publish">
<Form ref="baseInfoForm" :model="baseInfoForm" :label-width="120" :rules="baseInfoFormRule"> <Form
ref="baseInfoForm"
:model="baseInfoForm"
:label-width="120"
:rules="baseInfoFormRule"
>
<div class="base-info-item"> <div class="base-info-item">
<h4>基本信息</h4> <h4>基本信息</h4>
<div class="form-item-view"> <div class="form-item-view">
<FormItem label="商品分类"> <FormItem label="商品分类">
<span class="goods-category-name">{{ this.baseInfoForm.categoryName[0] }}</span> <span class="goods-category-name">{{
this.baseInfoForm.categoryName[0]
}}</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 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"> <FormItem label="商品价格" prop="price">
<Input type="text" v-model="baseInfoForm.price" placeholder="商品价格" clearable style="width: 260px" /> <Input
type="text"
v-model="baseInfoForm.price"
placeholder="商品价格"
clearable
style="width: 260px"
/>
</FormItem> </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>
<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" :value="item.id" :key="item.id" :label="item.name"></Option> <Option
v-for="item in brandList"
:value="item.id"
:key="item.id"
:label="item.name"
></Option>
</Select> </Select>
</FormItem> </FormItem>
</div> </div>
@ -31,17 +59,27 @@
<div class="form-item-view"> <div class="form-item-view">
<FormItem class="form-item-view-el" label="计量单位" prop="goodsUnit"> <FormItem class="form-item-view-el" label="计量单位" prop="goodsUnit">
<Select v-model="baseInfoForm.goodsUnit" style="width: 100px"> <Select v-model="baseInfoForm.goodsUnit" style="width: 100px">
<Option v-for="(unit,i) in goodsUnitList" :key="i" :value="unit">{{ unit }} <Option v-for="(unit, i) in goodsUnitList" :key="i" :value="unit"
>{{ unit }}
</Option> </Option>
</Select> </Select>
</FormItem> </FormItem>
<FormItem class="form-item-view-el" label="销售模式" prop="salesModel"> <FormItem class="form-item-view-el" label="销售模式" prop="salesModel">
<RadioGroup type="button" v-if="baseInfoForm.goodsType!='VIRTUAL_GOODS'" button-style="solid" <RadioGroup
v-model="baseInfoForm.salesModel"> type="button"
v-if="baseInfoForm.goodsType != 'VIRTUAL_GOODS'"
button-style="solid"
v-model="baseInfoForm.salesModel"
>
<Radio title="零售型" label="RETAIL">零售型</Radio> <Radio title="零售型" label="RETAIL">零售型</Radio>
<Radio title="批发型" label="WHOLESALE">批发型</Radio> <Radio title="批发型" label="WHOLESALE">批发型</Radio>
</RadioGroup> </RadioGroup>
<RadioGroup type="button" v-else button-style="solid" v-model="baseInfoForm.salesModel"> <RadioGroup
type="button"
v-else
button-style="solid"
v-model="baseInfoForm.salesModel"
>
<Radio title="零售型" label="RETAIL"> <Radio title="零售型" label="RETAIL">
<span>虚拟型</span> <span>虚拟型</span>
</Radio> </Radio>
@ -50,34 +88,64 @@
</div> </div>
<h4>商品规格及图片</h4> <h4>商品规格及图片</h4>
<div class="form-item-view"> <div class="form-item-view">
<FormItem class="form-item-view-el required" label="商品图片" prop="goodsGalleryFiles"> <FormItem
<div style="display:flex;flex-wrap:flex-start;"> class="form-item-view-el required"
label="商品图片"
prop="goodsGalleryFiles"
>
<div style="display: flex; flex-wrap: flex-start">
<vuedraggable :list="baseInfoForm.goodsGalleryFiles" :animation="200"> <vuedraggable :list="baseInfoForm.goodsGalleryFiles" :animation="200">
<div class="demo-upload-list" v-for="(item, __index) in baseInfoForm.goodsGalleryFiles" <div
:key="__index"> class="demo-upload-list"
v-for="(item, __index) in baseInfoForm.goodsGalleryFiles"
:key="__index"
>
<template> <template>
<img :src="item.url" /> <img :src="item.url" />
<div class="demo-upload-list-cover"> <div class="demo-upload-list-cover">
<div> <div>
<Icon type="md-search" size="30" @click.native="handleViewGoodsPicture(item.url)"></Icon> <Icon
<Icon type="md-trash" size="30" @click.native="handleRemoveGoodsPicture(item)"></Icon> type="md-search"
size="30"
@click.native="handleViewGoodsPicture(item.url)"
></Icon>
<Icon
type="md-trash"
size="30"
@click.native="handleRemoveGoodsPicture(item)"
></Icon>
</div> </div>
</div> </div>
</template> </template>
</div> </div>
</vuedraggable> </vuedraggable>
<Upload ref="upload" :show-upload-list="false" :on-success="handleSuccessGoodsPicture" <Upload
:format="['jpg', 'jpeg', 'png']" :on-format-error="handleFormatError" ref="upload"
:on-exceeded-size="handleMaxSize" :max-size="1024" :before-upload="handleBeforeUploadGoodsPicture" :show-upload-list="false"
multiple type="drag" :action="uploadFileUrl" :headers="{...accessToken}" style="margin-left:10px"> :on-success="handleSuccessGoodsPicture"
:format="['jpg', 'jpeg', 'png']"
:on-format-error="handleFormatError"
:on-exceeded-size="handleMaxSize"
:max-size="1024"
:before-upload="handleBeforeUploadGoodsPicture"
multiple
type="drag"
:action="uploadFileUrl"
:headers="{ ...accessToken }"
style="margin-left: 10px"
>
<div style="width: 148px; height: 148px; line-height: 148px"> <div style="width: 148px; height: 148px; line-height: 148px">
<Icon type="md-add" size="20"></Icon> <Icon type="md-add" size="20"></Icon>
</div> </div>
</Upload> </Upload>
</div> </div>
<Modal title="View Image" v-model="goodsPictureVisible"> <Modal title="View Image" v-model="goodsPictureVisible">
<img :src="previewGoodsPicture" v-if="goodsPictureVisible" style="width: 100%" /> <img
:src="previewGoodsPicture"
v-if="goodsPictureVisible"
style="width: 100%"
/>
</Modal> </Modal>
</FormItem> </FormItem>
<div class="layout" style="width: 100%"> <div class="layout" style="width: 100%">
@ -86,38 +154,65 @@
自定义规格项 自定义规格项
<div slot="content"> <div slot="content">
<Form> <Form>
<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">
<Button type="primary" slot="extra" @click="handleCloseSkuItem($index)"> <Button
type="primary"
slot="extra"
@click="handleCloseSkuItem($index)"
>
删除规格 删除规格
</Button> </Button>
<div> <div>
<FormItem label="规格名" class="sku-item-content-val flex"> <FormItem label="规格名" class="sku-item-content-val flex">
<AutoComplete style="width: 150px" v-model="item.name" :maxlength="30" <AutoComplete
placeholder="请输入规格项名称" :filter-method="filterMethod" :data="skuData" style="width: 150px"
@on-change="editSkuItem"> v-model="item.name"
:maxlength="30"
placeholder="请输入规格项名称"
:filter-method="filterMethod"
:data="skuData"
@on-change="editSkuItem"
>
</AutoComplete> </AutoComplete>
</FormItem> </FormItem>
</div> </div>
<div class="flex sku-val"> <div class="flex sku-val">
<Form :model="item" class="flex"> <Form :model="item" class="flex">
<!--规格值文本列表--> <!--规格值文本列表-->
<FormItem v-for="(val, index) in item.spec_values" :key="index" <FormItem
class="sku-item-content-val flex" label="规格项" :prop="'spec_values.'+index+'.value'" v-for="(val, index) in item.spec_values"
:rules="[regular.REQUIRED, regular.VARCHAR60]"> :key="index"
<AutoComplete v-model="val.value" style="width: 150px" :maxlength="30" class="sku-item-content-val flex"
placeholder="请输入规格项" :filter-method="filterMethod" :data="skuVal" label="规格项"
:prop="'spec_values.' + index + '.value'"
:rules="[regular.REQUIRED, regular.VARCHAR60]"
>
<AutoComplete
v-model="val.value"
style="width: 150px"
:maxlength="30"
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="primary" size="small" style="margin-left: 10px" <Button
@click="handleCloseSkuValue(item, index)"> type="primary"
size="small"
style="margin-left: 10px"
@click="handleCloseSkuValue(item, index)"
>
删除 删除
</Button> </Button>
</FormItem> </FormItem>
</Form> </Form>
</div> </div>
<div> <div>
<Button @click="addSpec($index, item)">添加规格值</Button> <Button @click="addSpec($index, item)">添加规格值</Button>
@ -125,7 +220,13 @@
</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">
@ -133,55 +234,116 @@
<div slot="content"> <div slot="content">
<div slot="content"> <div slot="content">
<!-- #TODO 此处有待优化 --> <!-- #TODO 此处有待优化 -->
<Table class="mt_10" :columns="skuTableColumn" :data="skuTableData" style=" <Table
class="mt_10"
:columns="skuTableColumn"
:data="skuTableData"
style="
width: 100%; width: 100%;
.ivu-table-overflowX { .ivu-table-overflowX {
overflow-x: hidden; overflow-x: hidden;
} }
"> "
>
<template slot-scope="{ row }" slot="sn"> <template slot-scope="{ row }" slot="sn">
<Input clearable v-model="row.sn" placeholder="请输入货号" <Input
@on-change="updateSkuTable(row, 'sn')" /> clearable
v-model="row.sn"
placeholder="请输入货号"
@on-change="updateSkuTable(row, 'sn')"
/>
</template> </template>
<div slot-scope="{ row }" slot="weight" v-if="baseInfoForm.goodsType!='VIRTUAL_GOODS'"> <div
<Input clearable v-model="row.weight" placeholder="请输入重量" slot-scope="{ row }"
@on-change="updateSkuTable(row, 'weight')" /> slot="weight"
v-if="baseInfoForm.goodsType != 'VIRTUAL_GOODS'"
>
<Input
clearable
v-model="row.weight"
placeholder="请输入重量"
@on-change="updateSkuTable(row, 'weight')"
/>
</div> </div>
<template slot-scope="{ row }" slot="quantity"> <template slot-scope="{ row }" slot="quantity">
<Input clearable v-model="row.quantity" placeholder="请输入库存" <Input
@on-change="updateSkuTable(row, 'quantity')" /> </template> clearable
v-model="row.quantity"
placeholder="请输入库存"
@on-change="updateSkuTable(row, 'quantity')"
/>
</template>
<template slot-scope="{ row }" slot="cost"> <template slot-scope="{ row }" slot="cost">
<Input clearable v-model="row.cost" placeholder="请输入成本价" <Input
@on-change="updateSkuTable(row, 'cost')" /> clearable
v-model="row.cost"
placeholder="请输入成本价"
@on-change="updateSkuTable(row, 'cost')"
/>
</template> </template>
<template slot-scope="{ row }" slot="price"> <template slot-scope="{ row }" slot="price">
<Input clearable v-model="row.price" placeholder="请输入价格" <Input
@on-change="updateSkuTable(row, 'price')" /> clearable
v-model="row.price"
placeholder="请输入价格"
@on-change="updateSkuTable(row, 'price')"
/>
</template> </template>
<template slot-scope="{ row }" slot="images"> <template slot-scope="{ row }" slot="images">
<Button @click="editSkuPicture(row)"></Button> <Button @click="editSkuPicture(row)"></Button>
<Modal v-model="showSkuPicture" :styles="{ top: '30px' }" class-name="sku-preview-modal" <Modal
title="编辑图片" ok-text="结束编辑" @on-ok="updateSkuPicture()" cancel-text="取消"> v-model="showSkuPicture"
:styles="{ top: '30px' }"
class-name="sku-preview-modal"
title="编辑图片"
ok-text="结束编辑"
@on-ok="updateSkuPicture()"
cancel-text="取消"
>
<div class="preview-picture"> <div class="preview-picture">
<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
<div class="sku-upload-list" v-for="(img, __index) in selectedSku.images" :key="__index"> :list="selectedSku.images"
:animation="200"
style="display: inline-block"
>
<div
class="sku-upload-list"
v-for="(img, __index) in selectedSku.images"
:key="__index"
>
<template> <template>
<img :src="img.url" /> <img :src="img.url" />
<div class="sku-upload-list-cover"> <div class="sku-upload-list-cover">
<Icon type="md-search" @click="handleView(img.url)"></Icon> <Icon
<Icon type="md-trash" @click="handleRemove(img, __index)"></Icon> type="md-search"
@click="handleView(img.url)"
></Icon>
<Icon
type="md-trash"
@click="handleRemove(img, __index)"
></Icon>
</div> </div>
</template> </template>
</div> </div>
</vuedraggable> </vuedraggable>
<Upload ref="uploadSku" :show-upload-list="false" :on-success="handleSuccess" <Upload
:format="['jpg', 'jpeg', 'png']" :on-format-error="handleFormatError" ref="uploadSku"
:on-exceeded-size="handleMaxSize" :max-size="1024" :before-upload="handleBeforeUpload" :show-upload-list="false"
multiple type="drag" :action="uploadFileUrl" :headers="{...accessToken}" :on-success="handleSuccess"
style="display: inline-block; width: 58px"> :format="['jpg', 'jpeg', 'png']"
:on-format-error="handleFormatError"
:on-exceeded-size="handleMaxSize"
:max-size="1024"
:before-upload="handleBeforeUpload"
multiple
type="drag"
:action="uploadFileUrl"
:headers="{ ...accessToken }"
style="display: inline-block; width: 58px"
>
<div> <div>
<Icon type="ios-camera" size="55"></Icon> <Icon type="ios-camera" size="55"></Icon>
</div> </div>
@ -199,8 +361,15 @@
<div class="form-item-view"> <div class="form-item-view">
<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" style="text-align:left;" :data="shopCategory" show-checkbox <Tree
@on-select-change="selectTree" @on-check-change="changeSelect" :check-strictly="false"></Tree> ref="tree"
style="text-align: left"
:data="shopCategory"
show-checkbox
@on-select-change="selectTree"
@on-check-change="changeSelect"
:check-strictly="false"
></Tree>
</FormItem> </FormItem>
</div> </div>
<FormItem class="form-item-view-el" label="商品描述" prop="intro"> <FormItem class="form-item-view-el" label="商品描述" prop="intro">
@ -210,12 +379,16 @@
<editor eid="mobileIntro" v-model="baseInfoForm.mobileIntro"></editor> <editor eid="mobileIntro" v-model="baseInfoForm.mobileIntro"></editor>
</FormItem> </FormItem>
</div> </div>
<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="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 }}
</Option> </Option>
</Select> </Select>
</FormItem> </FormItem>
@ -223,7 +396,11 @@
<h4>其他信息</h4> <h4>其他信息</h4>
<div class="form-item-view"> <div class="form-item-view">
<FormItem class="form-item-view-el" label="商品发布" prop="release"> <FormItem class="form-item-view-el" label="商品发布" prop="release">
<RadioGroup type="button" button-style="solid" v-model="baseInfoForm.release"> <RadioGroup
type="button"
button-style="solid"
v-model="baseInfoForm.release"
>
<Radio title="立即发布" :label="1"> <Radio title="立即发布" :label="1">
<span>立即发布</span> <span>立即发布</span>
</Radio> </Radio>
@ -233,7 +410,11 @@
</RadioGroup> </RadioGroup>
</FormItem> </FormItem>
<FormItem class="form-item-view-el" label="商品推荐" prop="skuList"> <FormItem class="form-item-view-el" label="商品推荐" prop="skuList">
<RadioGroup type="button" button-style="solid" v-model="baseInfoForm.recommend"> <RadioGroup
type="button"
button-style="solid"
v-model="baseInfoForm.recommend"
>
<Radio title="推荐" :label="1"> <Radio title="推荐" :label="1">
<span>推荐</span> <span>推荐</span>
</Radio> </Radio>
@ -244,17 +425,43 @@
</FormItem> </FormItem>
</div> </div>
<div class="form-item-view-bottom"> <div class="form-item-view-bottom">
<Collapse v-model="params_panel" v-for="(paramsGroup,groupIndex) in goodsParams" <Collapse
:title="paramsGroup.groupName" class="mb_10" style="text-align: left" :key="paramsGroup.groupName"> v-model="params_panel"
v-for="(paramsGroup, groupIndex) in goodsParams"
:title="paramsGroup.groupName"
class="mb_10"
style="text-align: left"
:key="paramsGroup.groupName"
>
<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
:label="`${params.paramName}`"> v-for="(params, paramsIndex) in paramsGroup.params"
<Select v-model="params.paramValue" placeholder="请选择" style="width: 200px" clearable :key="paramsIndex"
@on-change="selectParams(paramsGroup,groupIndex,params,paramsIndex,params.paramValue)"> :label="`${params.paramName}`"
<Option v-for="option in params.options.split(',')" :label="option" :value="option" >
:key="option"></Option> <Select
v-model="params.paramValue"
placeholder="请选择"
style="width: 200px"
clearable
@on-change="
selectParams(
paramsGroup,
groupIndex,
params,
paramsIndex,
params.paramValue
)
"
>
<Option
v-for="option in params.options.split(',')"
:label="option"
:value="option"
:key="option"
></Option>
</Select> </Select>
</FormItem> </FormItem>
</p> </p>
@ -268,7 +475,11 @@
<!-- 底部按钮 --> <!-- 底部按钮 -->
<div class="footer"> <div class="footer">
<ButtonGroup> <ButtonGroup>
<Button type="primary" @click="pre" v-if="!$route.query.id && !$route.query.draftId"> <Button
type="primary"
@click="pre"
v-if="!$route.query.id && !$route.query.draftId"
>上一步
</Button> </Button>
<Button type="primary" @click="save" :loading="submitLoading"> <Button type="primary" @click="save" :loading="submitLoading">
{{ this.$route.query.id ? "保存" : "保存商品" }} {{ this.$route.query.id ? "保存" : "保存商品" }}
@ -446,9 +657,6 @@ export default {
}; };
}, },
methods: { methods: {
changeSku(val){
console.warn(val)
},
/** /**
* 选择参数 * 选择参数
* @paramsGroup 参数分组 * @paramsGroup 参数分组
@ -466,15 +674,14 @@ export default {
}; };
} }
//id //id
this.baseInfoForm.goodsParamsDTOList[groupIndex].groupId = this.baseInfoForm.goodsParamsDTOList[groupIndex].groupId = paramsGroup.groupId;
paramsGroup.groupId; this.baseInfoForm.goodsParamsDTOList[groupIndex].groupName = paramsGroup.groupName;
this.baseInfoForm.goodsParamsDTOList[groupIndex].groupName =
paramsGroup.groupName;
// //
if ( if (
!this.baseInfoForm.goodsParamsDTOList[groupIndex] !this.baseInfoForm.goodsParamsDTOList[groupIndex].goodsParamsItemDTOList[
.goodsParamsItemDTOList[paramsIndex] paramsIndex
]
) { ) {
this.baseInfoForm.goodsParamsDTOList[groupIndex].goodsParamsItemDTOList[ this.baseInfoForm.goodsParamsDTOList[groupIndex].goodsParamsItemDTOList[
paramsIndex paramsIndex
@ -517,9 +724,7 @@ export default {
}, },
// //
handleRemove(item, index) { handleRemove(item, index) {
this.selectedSku.images = this.selectedSku.images.filter( this.selectedSku.images = this.selectedSku.images.filter((i) => i.url !== item.url);
(i) => i.url !== item.url
);
if (this.selectedSku.images.length > 0 && index === 0) { if (this.selectedSku.images.length > 0 && index === 0) {
this.previewPicture = this.selectedSku.images[0].url; this.previewPicture = this.selectedSku.images[0].url;
} else if (this.selectedSku.images.length < 0) { } else if (this.selectedSku.images.length < 0) {
@ -533,8 +738,9 @@ export default {
}, },
// //
handleRemoveGoodsPicture(file) { handleRemoveGoodsPicture(file) {
this.baseInfoForm.goodsGalleryFiles = this.baseInfoForm.goodsGalleryFiles = this.baseInfoForm.goodsGalleryFiles.filter(
this.baseInfoForm.goodsGalleryFiles.filter((i) => i.url !== file.url); (i) => i.url !== file.url
);
}, },
// sku // sku
updateSkuPicture() { updateSkuPicture() {
@ -589,8 +795,7 @@ export default {
// sku // sku
handleBeforeUpload(file) { handleBeforeUpload(file) {
const check = const check =
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;
@ -599,11 +804,9 @@ export default {
/** 查询商品品牌列表 */ /** 查询商品品牌列表 */
getGoodsBrandList() { getGoodsBrandList() {
API_GOODS.getCategoryBrandListDataSeller(this.categoryId).then( API_GOODS.getCategoryBrandListDataSeller(this.categoryId).then((response) => {
(response) => {
this.brandList = response; this.brandList = response;
} });
);
}, },
// //
GET_GoodsUnit() { GET_GoodsUnit() {
@ -657,11 +860,12 @@ export default {
response.result.goodsGalleryList && response.result.goodsGalleryList &&
response.result.goodsGalleryList.length > 0 response.result.goodsGalleryList.length > 0
) { ) {
this.baseInfoForm.goodsGalleryFiles = this.baseInfoForm.goodsGalleryFiles = response.result.goodsGalleryList.map(
response.result.goodsGalleryList.map((i) => { (i) => {
let files = { url: i }; let files = { url: i };
return files; return files;
}); }
);
} }
this.Get_SkuInfoByCategory(this.categoryId); this.Get_SkuInfoByCategory(this.categoryId);
@ -738,8 +942,7 @@ export default {
/** 根据当前分类id查询商品应包含的参数 */ /** 根据当前分类id查询商品应包含的参数 */
GET_GoodsParams() { GET_GoodsParams() {
API_GOODS.getCategoryParamsListDataSeller(this.categoryId).then( API_GOODS.getCategoryParamsListDataSeller(this.categoryId).then((response) => {
(response) => {
if (!response || response.length <= 0) { if (!response || response.length <= 0) {
return; return;
} }
@ -771,8 +974,7 @@ export default {
} else { } else {
this.baseInfoForm.goodsParamsDTOList = []; this.baseInfoForm.goodsParamsDTOList = [];
} }
} });
);
}, },
/** 添加规格项 */ /** 添加规格项 */
addSkuItem() { addSkuItem() {
@ -869,7 +1071,7 @@ export default {
let pushData = []; let pushData = [];
// //
this.skuInfo.forEach((sku) => { this.skuInfo.forEach((sku) => {
!sku.name ? sku.name = "规格名" : '' !sku.name ? (sku.name = "规格名") : "";
// //
let columnName = sku.name; let columnName = sku.name;
pushData.push({ pushData.push({
@ -1055,10 +1257,7 @@ export default {
this.$refs["baseInfoForm"].validate((valid) => { this.$refs["baseInfoForm"].validate((valid) => {
if (valid) { if (valid) {
let submit = JSON.parse(JSON.stringify(this.baseInfoForm)); let submit = JSON.parse(JSON.stringify(this.baseInfoForm));
if ( if (submit.goodsGalleryFiles && submit.goodsGalleryFiles.length <= 0) {
submit.goodsGalleryFiles &&
submit.goodsGalleryFiles.length <= 0
) {
this.submitLoading = false; this.submitLoading = false;
this.$Message.error("请上传商品图片"); this.$Message.error("请上传商品图片");
return; return;
@ -1082,17 +1281,13 @@ export default {
}); });
if (submit.goodsGalleryFiles.length > 0) { if (submit.goodsGalleryFiles.length > 0) {
submit.goodsGalleryList = submit.goodsGalleryFiles.map( submit.goodsGalleryList = submit.goodsGalleryFiles.map((i) => i.url);
(i) => i.url
);
} }
/** 参数校验 **/ /** 参数校验 **/
/* Object.keys(submit.goodsParamsList).forEach((item) => { /* Object.keys(submit.goodsParamsList).forEach((item) => {
});*/ });*/
submit.release ? (submit.release = true) : (submit.release = false); submit.release ? (submit.release = true) : (submit.release = false);
submit.recommend submit.recommend ? (submit.recommend = true) : (submit.recommend = false);
? (submit.recommend = true)
: (submit.recommend = false);
if (this.goodsId) { if (this.goodsId) {
API_GOODS.editGoods(this.goodsId, submit).then((res) => { API_GOODS.editGoods(this.goodsId, submit).then((res) => {
@ -1125,8 +1320,9 @@ export default {
saveToDraft() { saveToDraft() {
this.baseInfoForm.skuList = this.skuTableData; this.baseInfoForm.skuList = this.skuTableData;
if (this.baseInfoForm.goodsGalleryFiles.length > 0) { if (this.baseInfoForm.goodsGalleryFiles.length > 0) {
this.baseInfoForm.goodsGalleryList = this.baseInfoForm.goodsGalleryList = this.baseInfoForm.goodsGalleryFiles.map(
this.baseInfoForm.goodsGalleryFiles.map((i) => i.url); (i) => i.url
);
} }
this.baseInfoForm.categoryName = []; this.baseInfoForm.categoryName = [];
this.baseInfoForm.saveType = "TEMPLATE"; this.baseInfoForm.saveType = "TEMPLATE";