main
fanfan 2 months ago
parent d2448ac16a
commit afc45a6415
  1. 15
      src/components/Modal/GoodsModal/GoodsModal.vue
  2. 237
      src/views/dataCenter/goods/Create.vue
  3. 10
      src/views/dataCenter/goods/Index.vue
  4. 8
      src/views/dataCenter/goods/Update.vue
  5. 277
      src/views/dataCenter/goods/modules/Update.vue

@ -2,7 +2,7 @@
<a-modal
class="noborder"
:title="title"
:width="900"
:width="1050"
:visible="visible"
:isLoading="isLoading"
:maskClosable="false"
@ -23,6 +23,9 @@
allowClear
v-decorator="['categoryId', { initialValue: 0 }]"
></a-tree-select>
</a-form-item>
<a-form-item label="商品编码">
<a-input v-decorator="['goodsNo']" placeholder="请输入商品编码" />
</a-form-item>
<a-form-item class="search-btn">
<a-button type="primary" icon="search" html-type="submit">搜索</a-button>
@ -52,9 +55,12 @@
:subTitleColor="true"
/>
</template>
<span slot="spec_type" slot-scope="text">
<span slot="item_1" slot-scope="item">
<p class="twoline-hide" style="width: 40px">
{{ item.spec_type == 10 ? '单规格' : '多规格' }}
</p>
<p class="twoline-hide" style="width: 40px">
{{ text == 10 ? '单规格' : '多规格' }}
{{ item.spu_id>0? '已组合' : '未组合' }}
</p>
</span>
<span slot="specific_value" slot-scope="text">
@ -88,8 +94,7 @@ const columns = [
},
{
title: '规格类型',
dataIndex: 'spec_type',
scopedSlots: { customRender: 'spec_type' },
scopedSlots: { customRender: 'item_1' },
},
{
title: '商品价格',

@ -13,32 +13,63 @@
<!-- 基本信息 -->
<div class="tab-pane" v-show="tabKey == 0">
<a-form-item label="商品类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
<GoodsType v-decorator="['goods_type', { initialValue: 10, rules: [{ required: true }] }]" @change="onForceUpdate(true)" />
<GoodsType
v-decorator="['goods_type', { initialValue: 10, rules: [{ required: true }] }]"
@change="onForceUpdate(true)"
/>
</a-form-item>
<a-form-item label="商品SKU" :labelCol="labelCol" :wrapperCol="wrapperCol">
<div style=" display: flex;align-items: center;width:100%">
<a-input style="width:242px" placeholder="输入商品SKU" v-decorator="['goods_no', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]" />
<div class="action-item" style="margin-left:15px">
<div style="display: flex; align-items: center; width: 100%">
<a-input
style="width: 242px"
placeholder="输入商品SKU"
v-decorator="['goods_no', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]"
/>
<div class="action-item" style="margin-left: 15px">
<a-button type="primary" @click="handInfo">一键获取</a-button>
</div>
</div>
</a-form-item>
<a-form-item label="商品名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入商品名称" v-decorator="['goods_name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]" />
<a-input
placeholder="请输入商品名称"
v-decorator="['goods_name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]"
/>
</a-form-item>
<a-form-item label="商品型号" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入商品型号" v-decorator="['cmmdty_model', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]" />
<a-input
placeholder="请输入商品型号"
v-decorator="['cmmdty_model', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]"
/>
</a-form-item>
<a-form-item label="商品分类" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-tree-select placeholder="请选择商品分类" :dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }" :treeData="formData.categoryList" treeCheckable treeCheckStrictly allowClear
v-decorator="['categorys', { rules: [{ required: true, message: '请至少选择1个商品分类' }] }]"></a-tree-select>
<a-tree-select
placeholder="请选择商品分类"
:dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }"
:treeData="formData.categoryList"
treeCheckable
treeCheckStrictly
allowClear
v-decorator="['categorys', { rules: [{ required: true, message: '请至少选择1个商品分类' }] }]"
></a-tree-select>
<div class="form-item-help">
<router-link target="_blank" :to="{ path: '/goods/category/index' }">去新增</router-link>
<a href="javascript:;" @click="onReloadCategoryList">刷新</a>
</div>
</a-form-item>
<a-form-item label="商品图片" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="建议尺寸:750*750像素, 最多上传10张, 可拖拽图片调整顺序, 第1张将作为商品首图">
<SelectImage ref="childComponent" :source='1' multiple :maxNum="10" v-decorator="['imagesIds', { rules: [{ required: true, message: '请至少上传1张商品图片' }] }]" />
<a-form-item
label="商品图片"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="建议尺寸:750*750像素, 最多上传10张, 可拖拽图片调整顺序, 第1张将作为商品首图"
>
<SelectImage
ref="childComponent"
:source="1"
multiple
:maxNum="10"
v-decorator="['imagesIds', { rules: [{ required: true, message: '请至少上传1张商品图片' }] }]"
/>
</a-form-item>
<!-- <a-form-item label="是否大牌正品" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group
@ -122,11 +153,13 @@
</a-form-item> -->
<a-form-item label="商品来源" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['goods_source', { initialValue: 0, rules: [{ required: true }] }]">
<!-- <a-radio value="JD">京东</a-radio>
<a-radio value="SN">苏宁</a-radio> -->
<a-radio value="GC">工厂</a-radio>
<a-radio value="CC">仓储</a-radio>
<a-radio value="ZC">自采</a-radio>
<a-radio value="JD">京东</a-radio>
<a-radio value="SN">苏宁</a-radio>
<a-radio value="TM">天猫</a-radio>
<a-radio value="PF">批发平台</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="发货时效" :labelCol="labelCol" :wrapperCol="wrapperCol">
@ -180,7 +213,10 @@
<!-- 规格/库存 -->
<div class="tab-pane" v-show="tabKey == 1">
<a-form-item label="规格类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['spec_type', { initialValue: 10, rules: [{ required: true }] }]" @change="onForceUpdate()">
<a-radio-group
v-decorator="['spec_type', { initialValue: 10, rules: [{ required: true }] }]"
@change="onForceUpdate()"
>
<a-radio :value="10">单规格</a-radio>
<!-- <a-radio :value="20" :disabled="true">多规格</a-radio> -->
</a-radio-group>
@ -194,29 +230,55 @@
</div>
<!-- 单规格的表单内容 -->
<div v-show="form.getFieldValue('spec_type') == 10">
<a-form-item label="商品价格" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="商品的实际购买金额,最低0.01">
<a-input-number :min="0.01" :precision="2" v-decorator="[
<a-form-item
label="商品价格"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="商品的实际购买金额,最低0.01"
>
<a-input-number
:min="0.01"
:precision="2"
v-decorator="[
'goods_price',
{ initialValue: 1, rules: [{ required: true, message: '请输入商品价格' }] },
]" />
]"
/>
<span class="ml-10"></span>
</a-form-item>
<a-form-item label="行情价" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="行情价仅用于商品页展示">
<a-input-number :min="0" :precision="2" v-decorator="['cost_price']" />
<span class="ml-10"></span>
</a-form-item>
<a-form-item label="当前库存数量" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="商品的实际库存数量,为0时用户无法下单">
<a-input-number :min="0" :precision="0" v-decorator="[
<a-form-item
label="当前库存数量"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="商品的实际库存数量,为0时用户无法下单"
>
<a-input-number
:min="0"
:precision="0"
v-decorator="[
'stock_num',
{ initialValue: 100, rules: [{ required: true, message: '请输入库存数量' }] },
]" />
]"
/>
<span class="ml-10"></span>
</a-form-item>
<a-form-item label="商品重量" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="商品的实际重量,用于计算运费">
<a-input-number :min="0" v-decorator="[
<a-form-item
label="商品重量"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="商品的实际重量,用于计算运费"
>
<a-input-number
:min="0"
v-decorator="[
'goods_weight',
{ initialValue: 0, rules: [{ required: true, message: '请输入库存数量' }] },
]" />
]"
/>
<span class="ml-10">千克 (Kg)</span>
</a-form-item>
</div>
@ -273,17 +335,37 @@
<!-- 更多设置 -->
<div class="tab-pane" v-show="tabKey == 3">
<a-form-item label="主图视频" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="建议视频宽高比19:9,建议时长8-45秒">
<a-form-item
label="主图视频"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="建议视频宽高比19:9,建议时长8-45秒"
>
<SelectVideo :multiple="false" v-decorator="['video_id']" />
</a-form-item>
<a-form-item label="视频封面" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="建议尺寸:750像素*750像素">
<a-form-item
label="视频封面"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="建议尺寸:750像素*750像素"
>
<SelectImage :multiple="false" v-decorator="['video_cover_id']" />
</a-form-item>
<a-form-item label="商品卖点" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="一句话简述,例如:此款商品美观大方 性价比较高 不容错过">
<a-form-item
label="商品卖点"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="一句话简述,例如:此款商品美观大方 性价比较高 不容错过"
>
<a-input placeholder="请输入商品卖点" v-decorator="['selling_point']" />
</a-form-item>
<a-form-item label="服务与承诺" :labelCol="labelCol" :wrapperCol="wrapperCol" style="display: none">
<a-select v-if="formData.serviceList" mode="multiple" v-decorator="['serviceIds', { initialValue: formData.defaultServiceIds }]" placeholder="请选择服务与承诺">
<a-select
v-if="formData.serviceList"
mode="multiple"
v-decorator="['serviceIds', { initialValue: formData.defaultServiceIds }]"
placeholder="请选择服务与承诺"
>
<a-select-option v-for="(item, index) in formData.serviceList" :key="index" :value="item.service_id">{{
item.name
}}</a-select-option>
@ -293,14 +375,26 @@
<a href="javascript:;" @click="onReloadServiceList">刷新</a>
</div>
</a-form-item>
<a-form-item label="初始销量" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="用户端展示的销量 = 初始销量 + 实际销量">
<a-form-item
label="初始销量"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="用户端展示的销量 = 初始销量 + 实际销量"
>
<a-input-number v-decorator="['sales_initial', { initialValue: 0 }]" />
</a-form-item>
<div>
<a-divider orientation="left">销售区域</a-divider>
<a-form-item label="销售区域" :labelCol="labelCol" :wrapperCol="{ span: 15 }">
<a-table v-show="ruleList.length" class="table-rules" :columns="columns" :dataSource="ruleList" :pagination="false" bordered>
<a-form-item label="销售区域" :labelCol="labelCol" extra="默认是全国,指定供货区域请点击添加销售区域" :wrapperCol="{ span: 15 }">
<a-table
v-show="ruleList.length"
class="table-rules"
:columns="columns"
:dataSource="ruleList"
:pagination="false"
bordered
>
<!-- 销售区域 -->
<template slot="region_text" slot-scope="text, item, index">
<p class="content">
@ -308,7 +402,9 @@
<span>{{ province.name }}</span>
<template v-if="province.citys.length">
<span>(</span>
<span class="city-name" v-for="(city, cidx) in province.citys" :key="cidx">{{ city.name }}{{ province.citys.length > cidx + 1 ? '、' : '' }}</span>
<span class="city-name" v-for="(city, cidx) in province.citys" :key="cidx"
>{{ city.name }}{{ province.citys.length > cidx + 1 ? '、' : '' }}</span
>
<span>)</span>
</template>
<span>{{ ' ' }}</span>
@ -326,13 +422,23 @@
<div style="display: none">
<a-divider orientation="left">积分设置</a-divider>
<a-form-item label="积分赠送" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="开启后用户购买此商品将获得积分">
<a-form-item
label="积分赠送"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="开启后用户购买此商品将获得积分"
>
<a-radio-group v-decorator="['is_points_gift', { initialValue: 1, rules: [{ required: true }] }]">
<a-radio :value="1">开启</a-radio>
<a-radio :value="0">关闭</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="积分抵扣" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="开启后用户购买此商品可以使用积分进行抵扣">
<a-form-item
label="积分抵扣"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="开启后用户购买此商品可以使用积分进行抵扣"
>
<a-radio-group v-decorator="['is_points_discount', { initialValue: 1, rules: [{ required: true }] }]">
<a-radio :value="1">开启</a-radio>
<a-radio :value="0">关闭</a-radio>
@ -342,27 +448,48 @@
<div style="display: none">
<a-divider orientation="left">会员折扣设置</a-divider>
<a-form-item label="会员折扣" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="开启后会员折扣,会员购买此商品可以享受会员等级折扣价">
<a-radio-group v-decorator="['is_enable_grade', { initialValue: 1, rules: [{ required: true }] }]" @change="onForceUpdate(true)">
<a-form-item
label="会员折扣"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="开启后会员折扣,会员购买此商品可以享受会员等级折扣价"
>
<a-radio-group
v-decorator="['is_enable_grade', { initialValue: 1, rules: [{ required: true }] }]"
@change="onForceUpdate(true)"
>
<a-radio :value="1">开启</a-radio>
<a-radio :value="0">关闭</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item v-if="form.getFieldValue('is_enable_grade')" label="会员折扣设置" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['is_alone_grade', { initialValue: 0, rules: [{ required: true }] }]" @change="onForceUpdate(true)">
<a-form-item
v-if="form.getFieldValue('is_enable_grade')"
label="会员折扣设置"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
>
<a-radio-group
v-decorator="['is_alone_grade', { initialValue: 0, rules: [{ required: true }] }]"
@change="onForceUpdate(true)"
>
<a-radio :value="0">默认等级折扣</a-radio>
<a-radio :value="1">单独设置折扣</a-radio>
</a-radio-group>
<!-- 会员等级列表 -->
<div v-if="form.getFieldValue('is_alone_grade')">
<a-form-item v-for="item in formData.userGradeList" :key="item.grade_id">
<InputNumberGroup :addonBefore="item.name" addonAfter="折" :inputProps="{ min: 0, max: 9.9 }" v-decorator="[
<InputNumberGroup
:addonBefore="item.name"
addonAfter="折"
:inputProps="{ min: 0, max: 9.9 }"
v-decorator="[
`alone_grade_equity[grade_id:${item.grade_id}]`,
{
initialValue: formData.defaultUserGradeValue[item.grade_id],
rules: [{ required: true, message: '折扣率不能为空' }],
},
]" />
]"
/>
</a-form-item>
</div>
<div class="form-item-help">
@ -377,7 +504,10 @@
<div style="display: none">
<a-divider orientation="left">分销设置</a-divider>
<a-form-item label="分销佣金" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['is_ind_dealer', { initialValue: 0, rules: [{ required: true }] }]" @change="onForceUpdate(true)">
<a-radio-group
v-decorator="['is_ind_dealer', { initialValue: 0, rules: [{ required: true }] }]"
@change="onForceUpdate(true)"
>
<a-radio :value="0">系统默认</a-radio>
<a-radio :value="1">单独设置</a-radio>
</a-radio-group>
@ -385,15 +515,27 @@
<p class="extra">若使用分销功能必须在 [分销中心 - 分销设置] 中开启</p>
</div>
</a-form-item>
<a-form-item v-if="form.getFieldValue('is_ind_dealer')" label="分销佣金类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['dealer_money_type', { initialValue: 10, rules: [{ required: true }] }]" @change="onForceUpdate(true)">
<a-form-item
v-if="form.getFieldValue('is_ind_dealer')"
label="分销佣金类型"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
>
<a-radio-group
v-decorator="['dealer_money_type', { initialValue: 10, rules: [{ required: true }] }]"
@change="onForceUpdate(true)"
>
<a-radio :value="10">百分比</a-radio>
<a-radio :value="20">固定金额</a-radio>
</a-radio-group>
<!-- 分销等级列表 -->
<a-form-item v-for="(item, index) in formData.dealer.levelList" :key="index">
<InputNumberGroup :addonBefore="item.name" :addonAfter="form.getFieldValue('dealer_money_type') == 10 ? '%' : '元'" :inputProps="{ min: 0, precision: 2 }"
v-decorator="[item.value, { rules: [{ required: true, message: '佣金不能为空' }] }]" />
<InputNumberGroup
:addonBefore="item.name"
:addonAfter="form.getFieldValue('dealer_money_type') == 10 ? '%' : '元'"
:inputProps="{ min: 0, precision: 2 }"
v-decorator="[item.value, { rules: [{ required: true, message: '佣金不能为空' }] }]"
/>
</a-form-item>
</a-form-item>
</div>
@ -508,17 +650,18 @@ export default {
const goods_no = form.getFieldValue('goods_no')
if (goods_no) {
let param = {
sku: goods_no
sku: goods_no,
}
this.isLoading = true
GoodsApi.getCollector(param).then((result) => {
GoodsApi.getCollector(param)
.then((result) => {
this.$refs.childComponent.selectedItems = result.data.goods_images
let obj = {
goods_name: result.data.name,
content: result.data.content,
goods_price: result.data.proxyPrice,
imagesIds:result.data.goods_images,
goods_images:result.data.goods_images,
imagesIds: result.data.goods_images,
goods_images: result.data.goods_images,
}
this.form.setFieldsValue(obj)
this.isLoading = false

@ -345,9 +345,12 @@
<span slot="profit_rate" slot-scope="text, item">
<p>{{ text > 0 ? Number(text) + '%' : 0 }}</p>
</span>
<span slot="spec_type" slot-scope="text">
<span slot="item_1" slot-scope="item">
<p class="twoline-hide" style="width: 40px">
{{ text == 10 ? '单规格' : '多规格' }}
{{ item.spec_type == 10 ? '单规格' : '多规格' }}
</p>
<p class="twoline-hide" style="width: 40px">
{{ item.spu_id>0? '已组合' : '未组合' }}
</p>
</span>
<!-- 商品池 -->
@ -418,8 +421,7 @@ const columns = [
{
title: '规格类型',
width: '90px',
dataIndex: 'spec_type',
scopedSlots: { customRender: 'spec_type' },
scopedSlots: { customRender: 'item_1' },
},
{
title: '行情价',

@ -153,11 +153,13 @@
</a-form-item> -->
<a-form-item label="商品来源" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['goods_source', { initialValue: 0, rules: [{ required: true }] }]">
<!-- <a-radio value="JD">京东</a-radio>
<a-radio value="SN">苏宁</a-radio> -->
<a-radio value="GC">工厂</a-radio>
<a-radio value="CC">仓储</a-radio>
<a-radio value="ZC">自采</a-radio>
<a-radio value="JD">京东</a-radio>
<a-radio value="SN">苏宁</a-radio>
<a-radio value="TM">天猫</a-radio>
<a-radio value="PF">批发平台</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="发货时效" :labelCol="labelCol" :wrapperCol="wrapperCol">
@ -393,7 +395,7 @@
<div>
<a-divider orientation="left">销售区域</a-divider>
<a-form-item label="销售区域" :labelCol="labelCol" :wrapperCol="{ span: 15 }">
<a-form-item label="销售区域" :labelCol="labelCol" extra="默认是全国,指定供货区域请点击添加销售区域" :wrapperCol="{ span: 15 }">
<a-table
v-show="ruleList.length"
class="table-rules"

@ -1,5 +1,14 @@
<template>
<a-modal title="编辑商品" width="90%" :visible="visible" :confirmLoading="confirmLoading" :maskClosable="false" :destroyOnClose="true" @ok="handleSubmit" @cancel="handleCancel">
<a-modal
title="编辑商品"
width="90%"
:visible="visible"
:confirmLoading="confirmLoading"
:maskClosable="false"
:destroyOnClose="true"
@ok="handleSubmit"
@cancel="handleCancel"
>
<a-card :bordered="false">
<div class="card-title">商品编辑</div>
<a-spin :spinning="isLoading">
@ -14,33 +23,66 @@
<!-- 基本信息 -->
<div class="tab-pane" v-show="tabKey == 0">
<a-form-item label="商品类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
<GoodsType :onlyShowChecked="true" v-decorator="['goods_type', { rules: [{ required: true }] }]" @change="onForceUpdate(true)" />
<GoodsType
:onlyShowChecked="true"
v-decorator="['goods_type', { rules: [{ required: true }] }]"
@change="onForceUpdate(true)"
/>
</a-form-item>
<a-form-item label="商品SKU" :labelCol="labelCol" :wrapperCol="wrapperCol">
<div style=" display: flex;align-items: center;width:100%">
<a-input style="width:242px" placeholder="输入商品SKU" v-decorator="['goods_no', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]" />
<div class="action-item" style="margin-left:15px">
<div style="display: flex; align-items: center; width: 100%">
<a-input
style="width: 242px"
placeholder="输入商品SKU"
v-decorator="['goods_no', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]"
/>
<div class="action-item" style="margin-left: 15px">
<a-button type="primary" @click="handInfo">一键获取</a-button>
</div>
</div>
</a-form-item>
<a-form-item label="商品名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入商品名称" v-decorator="['goods_name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]" />
<a-input
placeholder="请输入商品名称"
v-decorator="['goods_name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]"
/>
</a-form-item>
<a-form-item label="商品型号" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入商品型号" v-decorator="['cmmdty_model', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]" />
<a-input
placeholder="请输入商品型号"
v-decorator="['cmmdty_model', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]"
/>
</a-form-item>
<a-form-item label="商品分类" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-tree-select placeholder="请选择商品分类" :dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }" :treeData="formData.categoryList" treeCheckable treeCheckStrictly allowClear
v-decorator="['categorys', { rules: [{ required: true, message: '请至少选择1个商品分类' }] }]"></a-tree-select>
<a-tree-select
placeholder="请选择商品分类"
:dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }"
:treeData="formData.categoryList"
treeCheckable
treeCheckStrictly
allowClear
v-decorator="['categorys', { rules: [{ required: true, message: '请至少选择1个商品分类' }] }]"
></a-tree-select>
<div class="form-item-help">
<router-link target="_blank" :to="{ path: '/goods/category/index' }">去新增</router-link>
<a href="javascript:;" @click="onReloadCategoryList">刷新</a>
</div>
</a-form-item>
<a-form-item label="商品图片" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="建议尺寸:750*750像素, 最多上传10张, 可拖拽图片调整顺序, 第1张将作为商品首图">
<SelectImage ref="childComponent" :source='1' multiple :maxNum="10" :defaultList="formData.goods.goods_images" v-decorator="['imagesIds', { rules: [{ required: true, message: '请至少上传1张商品图片' }] }]" />
<a-form-item
label="商品图片"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="建议尺寸:750*750像素, 最多上传10张, 可拖拽图片调整顺序, 第1张将作为商品首图"
>
<SelectImage
ref="childComponent"
:source="1"
multiple
:maxNum="10"
:defaultList="formData.goods.goods_images"
v-decorator="['imagesIds', { rules: [{ required: true, message: '请至少上传1张商品图片' }] }]"
/>
</a-form-item>
<a-form-item label="热卖指数" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="热卖指数" v-decorator="['remaizhishu']" />
@ -48,11 +90,13 @@
<a-form-item label="商品来源" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['goods_source', { initialValue: 0, rules: [{ required: true }] }]">
<!-- <a-radio value="JD">京东</a-radio>
<a-radio value="SN">苏宁</a-radio> -->
<a-radio value="GC">工厂</a-radio>
<a-radio value="CC">仓储</a-radio>
<a-radio value="ZC">自采</a-radio>
<a-radio value="JD">京东</a-radio>
<a-radio value="SN">苏宁</a-radio>
<a-radio value="TM">天猫</a-radio>
<a-radio value="PF">批发平台</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="发货时效" :labelCol="labelCol" :wrapperCol="wrapperCol">
@ -106,7 +150,10 @@
<!-- 规格/库存 -->
<div class="tab-pane" v-show="tabKey == 1">
<a-form-item label="规格类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['spec_type', { initialValue: 10, rules: [{ required: true }] }]" @change="onForceUpdate()">
<a-radio-group
v-decorator="['spec_type', { initialValue: 10, rules: [{ required: true }] }]"
@change="onForceUpdate()"
>
<a-radio :value="10" :disabled="formData.goods.isSpecLocked">单规格</a-radio>
<a-radio :value="20" :disabled="formData.goods.isSpecLocked">多规格</a-radio>
</a-radio-group>
@ -119,31 +166,69 @@
</a-form-item>
<!-- 多规格的表单内容 -->
<div v-if="form.getFieldValue('spec_type') == 20">
<MultiSpec ref="MultiSpec" :isSpecLocked="formData.goods.isSpecLocked" :defaultSpecList="formData.goods.specList" :defaultSkuList="formData.goods.skuList" :channel="formData.goods.channel" :checkList="checkList"
:source="1" />
<MultiSpec
ref="MultiSpec"
:isSpecLocked="formData.goods.isSpecLocked"
:defaultSpecList="formData.goods.specList"
:defaultSkuList="formData.goods.skuList"
:channel="formData.goods.channel"
:checkList="checkList"
:source="1"
/>
</div>
<!-- 单规格的表单内容 -->
<div v-if="form.getFieldValue('spec_type') == 10">
<a-form-item label="商品价格" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="商品的实际购买金额,最低0.01">
<a-input-number :min="0.01" :precision="2" v-decorator="['goods_price', { rules: [{ required: true, message: '请输入商品价格' }] }]" />
<a-form-item
label="商品价格"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="商品的实际购买金额,最低0.01"
>
<a-input-number
:min="0.01"
:precision="2"
v-decorator="['goods_price', { rules: [{ required: true, message: '请输入商品价格' }] }]"
/>
<span class="ml-10"></span>
</a-form-item>
<a-form-item label="行情价" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="行情价仅用于商品页展示">
<a-form-item
label="行情价"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="行情价仅用于商品页展示"
>
<a-input-number :min="0" :precision="2" v-decorator="['cost_price']" />
<span class="ml-10"></span>
</a-form-item>
<a-form-item label="当前库存数量" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="商品的实际库存数量,为0时用户无法下单">
<a-input-number :min="0" :precision="0" v-decorator="[
<a-form-item
label="当前库存数量"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="商品的实际库存数量,为0时用户无法下单"
>
<a-input-number
:min="0"
:precision="0"
v-decorator="[
'stock_num',
{ initialValue: 100, rules: [{ required: true, message: '请输入库存数量' }] },
]" />
]"
/>
<span class="ml-10"></span>
</a-form-item>
<a-form-item label="商品重量" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="商品的实际重量,用于计算运费">
<a-input-number :min="0" v-decorator="[
<a-form-item
label="商品重量"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="商品的实际重量,用于计算运费"
>
<a-input-number
:min="0"
v-decorator="[
'goods_weight',
{ initialValue: 0, rules: [{ required: true, message: '请输入库存数量' }] },
]" />
]"
/>
<span class="ml-10">千克 (Kg)</span>
</a-form-item>
</div>
@ -157,23 +242,58 @@
<!-- 更多设置 -->
<div class="tab-pane" v-show="tabKey == 3">
<a-form-item label="主图视频" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="建议视频宽高比19:9,建议时长8-45秒">
<SelectVideo :multiple="false" :defaultList="formData.goods.video ? [formData.goods.video] : []" v-decorator="['video_id']" />
</a-form-item>
<a-form-item label="视频封面" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="建议尺寸:750像素*750像素">
<SelectImage :multiple="false" :defaultList="formData.goods.videoCover ? [formData.goods.videoCover] : []" v-decorator="['video_cover_id']" />
</a-form-item>
<a-form-item label="商品卖点" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="一句话简述,例如:此款商品美观大方 性价比较高 不容错过">
<a-form-item
label="主图视频"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="建议视频宽高比19:9,建议时长8-45秒"
>
<SelectVideo
:multiple="false"
:defaultList="formData.goods.video ? [formData.goods.video] : []"
v-decorator="['video_id']"
/>
</a-form-item>
<a-form-item
label="视频封面"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="建议尺寸:750像素*750像素"
>
<SelectImage
:multiple="false"
:defaultList="formData.goods.videoCover ? [formData.goods.videoCover] : []"
v-decorator="['video_cover_id']"
/>
</a-form-item>
<a-form-item
label="商品卖点"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="一句话简述,例如:此款商品美观大方 性价比较高 不容错过"
>
<a-input placeholder="请输入商品卖点" v-decorator="['selling_point']" />
</a-form-item>
<a-form-item label="初始销量" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="用户端展示的销量 = 初始销量 + 实际销量">
<a-form-item
label="初始销量"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="用户端展示的销量 = 初始销量 + 实际销量"
>
<a-input-number v-decorator="['sales_initial', { initialValue: 0 }]" />
</a-form-item>
<div>
<a-divider orientation="left">销售区域</a-divider>
<a-form-item label="销售区域" :labelCol="labelCol" :wrapperCol="{ span: 15 }">
<a-table v-show="ruleList.length" class="table-rules" :columns="columns" :dataSource="ruleList" :pagination="false" bordered>
<a-form-item label="销售区域" :labelCol="labelCol" extra="默认是全国,指定供货区域请点击添加销售区域" :wrapperCol="{ span: 15 }">
<a-table
v-show="ruleList.length"
class="table-rules"
:columns="columns"
:dataSource="ruleList"
:pagination="false"
bordered
>
<!-- 销售区域 -->
<template slot="region_text" slot-scope="text, item, index">
<p class="content">
@ -181,7 +301,9 @@
<span>{{ province.name }}</span>
<template v-if="province.citys.length">
<span>(</span>
<span class="city-name" v-for="(city, cidx) in province.citys" :key="cidx">{{ city.name }}{{ province.citys.length > cidx + 1 ? '、' : '' }}</span>
<span class="city-name" v-for="(city, cidx) in province.citys" :key="cidx"
>{{ city.name }}{{ province.citys.length > cidx + 1 ? '、' : '' }}</span
>
<span>)</span>
</template>
<span>{{ ' ' }}</span>
@ -193,19 +315,31 @@
</p>
</template>
</a-table>
<a-button icon="environment" v-if="ruleList.length == 0" @click="handleAdd">点击添加销售区域</a-button>
<a-button icon="environment" v-if="ruleList.length == 0" @click="handleAdd"
>点击添加销售区域</a-button
>
</a-form-item>
</div>
<div style="display: none">
<a-divider orientation="left">积分设置</a-divider>
<a-form-item label="积分赠送" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="开启后用户购买此商品将获得积分">
<a-form-item
label="积分赠送"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="开启后用户购买此商品将获得积分"
>
<a-radio-group v-decorator="['is_points_gift', { initialValue: 1, rules: [{ required: true }] }]">
<a-radio :value="1">开启</a-radio>
<a-radio :value="0">关闭</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="积分抵扣" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="开启后用户购买此商品可以使用积分进行抵扣">
<a-form-item
label="积分抵扣"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="开启后用户购买此商品可以使用积分进行抵扣"
>
<a-radio-group v-decorator="['is_points_discount', { initialValue: 1, rules: [{ required: true }] }]">
<a-radio :value="1">开启</a-radio>
<a-radio :value="0">关闭</a-radio>
@ -215,27 +349,48 @@
<div style="display: none">
<a-divider orientation="left">会员折扣设置</a-divider>
<a-form-item label="会员折扣" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="开启后会员折扣,会员购买此商品可以享受会员等级折扣价">
<a-radio-group v-decorator="['is_enable_grade', { initialValue: 1, rules: [{ required: true }] }]" @change="onForceUpdate(true)">
<a-form-item
label="会员折扣"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="开启后会员折扣,会员购买此商品可以享受会员等级折扣价"
>
<a-radio-group
v-decorator="['is_enable_grade', { initialValue: 1, rules: [{ required: true }] }]"
@change="onForceUpdate(true)"
>
<a-radio :value="1">开启</a-radio>
<a-radio :value="0">关闭</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item v-show="form.getFieldValue('is_enable_grade')" label="会员折扣设置" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['is_alone_grade', { initialValue: 0, rules: [{ required: true }] }]" @change="onForceUpdate(true)">
<a-form-item
v-show="form.getFieldValue('is_enable_grade')"
label="会员折扣设置"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
>
<a-radio-group
v-decorator="['is_alone_grade', { initialValue: 0, rules: [{ required: true }] }]"
@change="onForceUpdate(true)"
>
<a-radio :value="0">默认等级折扣</a-radio>
<a-radio :value="1">单独设置折扣</a-radio>
</a-radio-group>
<!-- 会员等级列表 -->
<div v-show="form.getFieldValue('is_alone_grade')">
<a-form-item v-for="item in formData.userGradeList" :key="item.grade_id">
<InputNumberGroup :addonBefore="item.name" addonAfter="折" :inputProps="{ min: 0, max: 9.9 }" v-decorator="[
<InputNumberGroup
:addonBefore="item.name"
addonAfter="折"
:inputProps="{ min: 0, max: 9.9 }"
v-decorator="[
`alone_grade_equity[grade_id:${item.grade_id}]`,
{
initialValue: formData.defaultUserGradeValue[item.grade_id],
rules: [{ required: true, message: '折扣率不能为空' }],
},
]" />
]"
/>
</a-form-item>
</div>
<div class="form-item-help">
@ -250,7 +405,10 @@
<div style="display: none">
<a-divider orientation="left">分销设置</a-divider>
<a-form-item label="分销佣金" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['is_ind_dealer', { initialValue: 0, rules: [{ required: true }] }]" @change="onForceUpdate(true)">
<a-radio-group
v-decorator="['is_ind_dealer', { initialValue: 0, rules: [{ required: true }] }]"
@change="onForceUpdate(true)"
>
<a-radio :value="0">系统默认</a-radio>
<a-radio :value="1">单独设置</a-radio>
</a-radio-group>
@ -258,15 +416,27 @@
<p class="extra">若使用分销功能必须在 [分销中心 - 分销设置] 中开启</p>
</div>
</a-form-item>
<a-form-item v-show="form.getFieldValue('is_ind_dealer')" label="分销佣金类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['dealer_money_type', { initialValue: 10, rules: [{ required: true }] }]" @change="onForceUpdate(true)">
<a-form-item
v-show="form.getFieldValue('is_ind_dealer')"
label="分销佣金类型"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
>
<a-radio-group
v-decorator="['dealer_money_type', { initialValue: 10, rules: [{ required: true }] }]"
@change="onForceUpdate(true)"
>
<a-radio :value="10">百分比</a-radio>
<a-radio :value="20">固定金额</a-radio>
</a-radio-group>
<!-- 分销等级列表 -->
<a-form-item v-for="(item, index) in formData.dealer.levelList" :key="index">
<InputNumberGroup :addonBefore="item.name" :addonAfter="form.getFieldValue('dealer_money_type') == 10 ? '%' : '元'" :inputProps="{ min: 0, precision: 2 }"
v-decorator="[item.value, { rules: [{ required: true, message: '佣金不能为空' }] }]" />
<InputNumberGroup
:addonBefore="item.name"
:addonAfter="form.getFieldValue('dealer_money_type') == 10 ? '%' : '元'"
:inputProps="{ min: 0, precision: 2 }"
v-decorator="[item.value, { rules: [{ required: true, message: '佣金不能为空' }] }]"
/>
</a-form-item>
</a-form-item>
</div>
@ -357,11 +527,12 @@ export default {
this.formData.goods.goods_no = goods_no
if (goods_no) {
let param = {
sku: goods_no
sku: goods_no,
}
this.isLoading = true
GoodsApi.getCollector(param).then((result) => {
this.formData.goods.imagesIds=result.data.goods_images
GoodsApi.getCollector(param)
.then((result) => {
this.formData.goods.imagesIds = result.data.goods_images
this.formData.goods.goods_images = result.data.goods_images
this.$refs.childComponent.selectedItems = result.data.goods_images
this.formData.goods.goods_name = result.data.name

Loading…
Cancel
Save