|
|
@ -53,26 +53,20 @@ |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
|
|
|
|
|
|
|
|
<a-form-item label="是否大牌正品" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
|
|
<a-form-item label="是否大牌正品" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
|
|
<a-radio-group |
|
|
|
<a-radio-group v-decorator="['is_brand', { initialValue: 0, rules: [{ required: true }] }]"> |
|
|
|
v-decorator="['is_brand', { initialValue: 0, rules: [{ required: true }] }]" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<a-radio :value="0">否</a-radio> |
|
|
|
<a-radio :value="0">否</a-radio> |
|
|
|
<a-radio :value="1">是</a-radio> |
|
|
|
<a-radio :value="1">是</a-radio> |
|
|
|
</a-radio-group> |
|
|
|
</a-radio-group> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
|
|
|
|
|
|
|
|
<a-form-item label="是否新品首发" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
|
|
<a-form-item label="是否新品首发" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
|
|
<a-radio-group |
|
|
|
<a-radio-group v-decorator="['is_new', { initialValue: 0, rules: [{ required: true }] }]"> |
|
|
|
v-decorator="['is_new', { initialValue: 0, rules: [{ required: true }] }]" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<a-radio :value="0">否</a-radio> |
|
|
|
<a-radio :value="0">否</a-radio> |
|
|
|
<a-radio :value="1">是</a-radio> |
|
|
|
<a-radio :value="1">是</a-radio> |
|
|
|
</a-radio-group> |
|
|
|
</a-radio-group> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="是否店内" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
|
|
<a-form-item label="是否店内" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
|
|
<a-radio-group |
|
|
|
<a-radio-group v-decorator="['is_in_store', { initialValue: 0, rules: [{ required: true }] }]"> |
|
|
|
v-decorator="['is_in_store', { initialValue: 0, rules: [{ required: true }] }]" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<a-radio :value="0">否</a-radio> |
|
|
|
<a-radio :value="0">否</a-radio> |
|
|
|
<a-radio :value="1">是</a-radio> |
|
|
|
<a-radio :value="1">是</a-radio> |
|
|
|
</a-radio-group> |
|
|
|
</a-radio-group> |
|
|
@ -106,8 +100,14 @@ |
|
|
|
<div v-show="form.getFieldValue('is_ind_delivery_type')"> |
|
|
|
<div v-show="form.getFieldValue('is_ind_delivery_type')"> |
|
|
|
<a-form-item extra="需在 [设置 - 配送方式] 中,开启支持的配送方式才可生效"> |
|
|
|
<a-form-item extra="需在 [设置 - 配送方式] 中,开启支持的配送方式才可生效"> |
|
|
|
<a-checkbox-group |
|
|
|
<a-checkbox-group |
|
|
|
:options="[{ label: '快递配送', value: 10 }, { label: '上门自提', value: 20 }]" |
|
|
|
:options="[ |
|
|
|
v-decorator="['delivery_type', { initialValue: [10, 20], rules: [{ required: true, message: '配送方式至少选择一个' }] }]" |
|
|
|
{ label: '快递配送', value: 10 }, |
|
|
|
|
|
|
|
{ label: '上门自提', value: 20 }, |
|
|
|
|
|
|
|
]" |
|
|
|
|
|
|
|
v-decorator="[ |
|
|
|
|
|
|
|
'delivery_type', |
|
|
|
|
|
|
|
{ initialValue: [10, 20], rules: [{ required: true, message: '配送方式至少选择一个' }] }, |
|
|
|
|
|
|
|
]" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -127,29 +127,22 @@ |
|
|
|
v-for="(item, index) in formData.deliveryList" |
|
|
|
v-for="(item, index) in formData.deliveryList" |
|
|
|
:key="index" |
|
|
|
:key="index" |
|
|
|
:value="item.delivery_id" |
|
|
|
:value="item.delivery_id" |
|
|
|
>{{ item.name }}</a-select-option> |
|
|
|
>{{ item.name }}</a-select-option |
|
|
|
|
|
|
|
> |
|
|
|
</a-select> |
|
|
|
</a-select> |
|
|
|
<div class="form-item-help"> |
|
|
|
<div class="form-item-help"> |
|
|
|
<router-link |
|
|
|
<router-link target="_blank" :to="{ path: '/setting/delivery/template/create' }">新增模板</router-link> |
|
|
|
target="_blank" |
|
|
|
|
|
|
|
:to="{ path: '/setting/delivery/template/create' }" |
|
|
|
|
|
|
|
>新增模板</router-link> |
|
|
|
|
|
|
|
<a href="javascript:;" @click="onReloadDeliveryList">刷新</a> |
|
|
|
<a href="javascript:;" @click="onReloadDeliveryList">刷新</a> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="商品状态" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
|
|
<a-form-item label="商品状态" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
|
|
<a-radio-group |
|
|
|
<a-radio-group v-decorator="['status', { initialValue: 10, rules: [{ required: true }] }]"> |
|
|
|
v-decorator="['status', { initialValue: 10, rules: [{ required: true }] }]" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<a-radio :value="10">上架</a-radio> |
|
|
|
<a-radio :value="10">上架</a-radio> |
|
|
|
<a-radio :value="20">下架</a-radio> |
|
|
|
<a-radio :value="20">下架</a-radio> |
|
|
|
</a-radio-group> |
|
|
|
</a-radio-group> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="商品排序" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="数字越小越靠前"> |
|
|
|
<a-form-item label="商品排序" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="数字越小越靠前"> |
|
|
|
<a-input-number |
|
|
|
<a-input-number :min="0" v-decorator="['sort', { initialValue: 100, rules: [{ required: true }] }]" /> |
|
|
|
:min="0" |
|
|
|
|
|
|
|
v-decorator="['sort', { initialValue: 100, rules: [{ required: true }] }]" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
@ -179,16 +172,14 @@ |
|
|
|
<a-input-number |
|
|
|
<a-input-number |
|
|
|
:min="0.01" |
|
|
|
:min="0.01" |
|
|
|
:precision="2" |
|
|
|
:precision="2" |
|
|
|
v-decorator="['goods_price', { initialValue: 1, rules: [{ required: true, message: '请输入商品价格' }] }]" |
|
|
|
v-decorator="[ |
|
|
|
|
|
|
|
'goods_price', |
|
|
|
|
|
|
|
{ initialValue: 1, rules: [{ required: true, message: '请输入商品价格' }] }, |
|
|
|
|
|
|
|
]" |
|
|
|
/> |
|
|
|
/> |
|
|
|
<span class="ml-10">元</span> |
|
|
|
<span class="ml-10">元</span> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item |
|
|
|
<a-form-item label="成本价" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="成本价仅用于商品页展示"> |
|
|
|
label="成本价" |
|
|
|
|
|
|
|
:labelCol="labelCol" |
|
|
|
|
|
|
|
:wrapperCol="wrapperCol" |
|
|
|
|
|
|
|
extra="成本价仅用于商品页展示" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<a-input-number :min="0" :precision="2" v-decorator="['cost_price']" /> |
|
|
|
<a-input-number :min="0" :precision="2" v-decorator="['cost_price']" /> |
|
|
|
<span class="ml-10">元</span> |
|
|
|
<span class="ml-10">元</span> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
@ -201,7 +192,10 @@ |
|
|
|
<a-input-number |
|
|
|
<a-input-number |
|
|
|
:min="0" |
|
|
|
:min="0" |
|
|
|
:precision="0" |
|
|
|
:precision="0" |
|
|
|
v-decorator="['stock_num', { initialValue: 100, rules: [{ required: true, message: '请输入库存数量' }] }]" |
|
|
|
v-decorator="[ |
|
|
|
|
|
|
|
'stock_num', |
|
|
|
|
|
|
|
{ initialValue: 100, rules: [{ required: true, message: '请输入库存数量' }] }, |
|
|
|
|
|
|
|
]" |
|
|
|
/> |
|
|
|
/> |
|
|
|
<span class="ml-10">件</span> |
|
|
|
<span class="ml-10">件</span> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
@ -213,15 +207,16 @@ |
|
|
|
> |
|
|
|
> |
|
|
|
<a-input-number |
|
|
|
<a-input-number |
|
|
|
:min="0" |
|
|
|
:min="0" |
|
|
|
v-decorator="['goods_weight', { initialValue: 0, rules: [{ required: true, message: '请输入库存数量' }] }]" |
|
|
|
v-decorator="[ |
|
|
|
|
|
|
|
'goods_weight', |
|
|
|
|
|
|
|
{ initialValue: 0, rules: [{ required: true, message: '请输入库存数量' }] }, |
|
|
|
|
|
|
|
]" |
|
|
|
/> |
|
|
|
/> |
|
|
|
<span class="ml-10">千克 (Kg)</span> |
|
|
|
<span class="ml-10">千克 (Kg)</span> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<a-form-item label="库存计算方式" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
|
|
<a-form-item label="库存计算方式" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
|
|
<a-radio-group |
|
|
|
<a-radio-group v-decorator="['deduct_stock_type', { initialValue: 10, rules: [{ required: true }] }]"> |
|
|
|
v-decorator="['deduct_stock_type', { initialValue: 10, rules: [{ required: true }] }]" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<a-radio :value="10">下单减库存</a-radio> |
|
|
|
<a-radio :value="10">下单减库存</a-radio> |
|
|
|
<a-radio :value="20">付款减库存</a-radio> |
|
|
|
<a-radio :value="20">付款减库存</a-radio> |
|
|
|
</a-radio-group> |
|
|
|
</a-radio-group> |
|
|
@ -265,9 +260,7 @@ |
|
|
|
<!-- 商品详情 --> |
|
|
|
<!-- 商品详情 --> |
|
|
|
<div class="tab-pane" v-show="tabKey == 2"> |
|
|
|
<div class="tab-pane" v-show="tabKey == 2"> |
|
|
|
<a-form-item label="商品详情" :labelCol="labelCol" :wrapperCol="{ span: 16 }"> |
|
|
|
<a-form-item label="商品详情" :labelCol="labelCol" :wrapperCol="{ span: 16 }"> |
|
|
|
<Ueditor |
|
|
|
<Ueditor v-decorator="['content', { rules: [{ required: true, message: '商品详情不能为空' }] }]" /> |
|
|
|
v-decorator="['content', { rules: [{ required: true, message: '商品详情不能为空' }] }]" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
@ -304,11 +297,9 @@ |
|
|
|
v-decorator="['serviceIds', { initialValue: formData.defaultServiceIds }]" |
|
|
|
v-decorator="['serviceIds', { initialValue: formData.defaultServiceIds }]" |
|
|
|
placeholder="请选择服务与承诺" |
|
|
|
placeholder="请选择服务与承诺" |
|
|
|
> |
|
|
|
> |
|
|
|
<a-select-option |
|
|
|
<a-select-option v-for="(item, index) in formData.serviceList" :key="index" :value="item.service_id">{{ |
|
|
|
v-for="(item, index) in formData.serviceList" |
|
|
|
item.name |
|
|
|
:key="index" |
|
|
|
}}</a-select-option> |
|
|
|
:value="item.service_id" |
|
|
|
|
|
|
|
>{{ item.name }}</a-select-option> |
|
|
|
|
|
|
|
</a-select> |
|
|
|
</a-select> |
|
|
|
<div class="form-item-help"> |
|
|
|
<div class="form-item-help"> |
|
|
|
<router-link target="_blank" :to="{ path: '/goods/service/index' }">去新增</router-link> |
|
|
|
<router-link target="_blank" :to="{ path: '/goods/service/index' }">去新增</router-link> |
|
|
@ -323,7 +314,41 @@ |
|
|
|
> |
|
|
|
> |
|
|
|
<a-input-number v-decorator="['sales_initial', { initialValue: 0 }]" /> |
|
|
|
<a-input-number v-decorator="['sales_initial', { initialValue: 0 }]" /> |
|
|
|
</a-form-item> |
|
|
|
</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 |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<!-- 销售区域 --> |
|
|
|
|
|
|
|
<template slot="region_text" slot-scope="text, item, index"> |
|
|
|
|
|
|
|
<p class="content"> |
|
|
|
|
|
|
|
<span v-for="(province, pidx) in text" :key="pidx"> |
|
|
|
|
|
|
|
<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>)</span> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
<span>{{ ' ' }}</span> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</p> |
|
|
|
|
|
|
|
<p class="operation"> |
|
|
|
|
|
|
|
<a href="javascript:void(0);" class="edit" @click="handleEdit(index, item)">编辑</a> |
|
|
|
|
|
|
|
<a href="javascript:void(0);" class="delete" @click="handleDelete(index)">删除</a> |
|
|
|
|
|
|
|
</p> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</a-table> |
|
|
|
|
|
|
|
<a-button icon="environment" v-if="ruleList.length == 0" @click="handleAdd">点击添加销售区域</a-button> |
|
|
|
|
|
|
|
</a-form-item> |
|
|
|
|
|
|
|
</div> |
|
|
|
<div v-show="$module('market-points')"> |
|
|
|
<div v-show="$module('market-points')"> |
|
|
|
<a-divider orientation="left">积分设置</a-divider> |
|
|
|
<a-divider orientation="left">积分设置</a-divider> |
|
|
|
<a-form-item |
|
|
|
<a-form-item |
|
|
@ -332,9 +357,7 @@ |
|
|
|
:wrapperCol="wrapperCol" |
|
|
|
:wrapperCol="wrapperCol" |
|
|
|
extra="开启后用户购买此商品将获得积分" |
|
|
|
extra="开启后用户购买此商品将获得积分" |
|
|
|
> |
|
|
|
> |
|
|
|
<a-radio-group |
|
|
|
<a-radio-group v-decorator="['is_points_gift', { initialValue: 1, rules: [{ required: true }] }]"> |
|
|
|
v-decorator="['is_points_gift', { initialValue: 1, rules: [{ required: true }] }]" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<a-radio :value="1">开启</a-radio> |
|
|
|
<a-radio :value="1">开启</a-radio> |
|
|
|
<a-radio :value="0">关闭</a-radio> |
|
|
|
<a-radio :value="0">关闭</a-radio> |
|
|
|
</a-radio-group> |
|
|
|
</a-radio-group> |
|
|
@ -345,9 +368,7 @@ |
|
|
|
:wrapperCol="wrapperCol" |
|
|
|
:wrapperCol="wrapperCol" |
|
|
|
extra="开启后用户购买此商品可以使用积分进行抵扣" |
|
|
|
extra="开启后用户购买此商品可以使用积分进行抵扣" |
|
|
|
> |
|
|
|
> |
|
|
|
<a-radio-group |
|
|
|
<a-radio-group v-decorator="['is_points_discount', { initialValue: 1, rules: [{ required: true }] }]"> |
|
|
|
v-decorator="['is_points_discount', { initialValue: 1, rules: [{ required: true }] }]" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<a-radio :value="1">开启</a-radio> |
|
|
|
<a-radio :value="1">开启</a-radio> |
|
|
|
<a-radio :value="0">关闭</a-radio> |
|
|
|
<a-radio :value="0">关闭</a-radio> |
|
|
|
</a-radio-group> |
|
|
|
</a-radio-group> |
|
|
@ -390,17 +411,20 @@ |
|
|
|
:addonBefore="item.name" |
|
|
|
:addonBefore="item.name" |
|
|
|
addonAfter="折" |
|
|
|
addonAfter="折" |
|
|
|
:inputProps="{ min: 0, max: 9.9 }" |
|
|
|
:inputProps="{ min: 0, max: 9.9 }" |
|
|
|
v-decorator="[`alone_grade_equity[grade_id:${item.grade_id}]`, { |
|
|
|
v-decorator="[ |
|
|
|
initialValue: formData.defaultUserGradeValue[item.grade_id], rules: [{ required: true, message: '折扣率不能为空' }] |
|
|
|
`alone_grade_equity[grade_id:${item.grade_id}]`, |
|
|
|
}]" |
|
|
|
{ |
|
|
|
|
|
|
|
initialValue: formData.defaultUserGradeValue[item.grade_id], |
|
|
|
|
|
|
|
rules: [{ required: true, message: '折扣率不能为空' }], |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
]" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-item-help"> |
|
|
|
<div class="form-item-help"> |
|
|
|
<p |
|
|
|
<p class="extra" v-if="form.getFieldValue('is_alone_grade')"> |
|
|
|
class="extra" |
|
|
|
单独折扣:折扣率范围0.0-9.9,例如: 9.8代表98折,0代表不折扣 |
|
|
|
v-if="form.getFieldValue('is_alone_grade')" |
|
|
|
</p> |
|
|
|
>单独折扣:折扣率范围0.0-9.9,例如: 9.8代表98折,0代表不折扣</p> |
|
|
|
|
|
|
|
<p class="extra" v-else>默认折扣:默认为用户所属会员等级的折扣率</p> |
|
|
|
<p class="extra" v-else>默认折扣:默认为用户所属会员等级的折扣率</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
@ -450,6 +474,7 @@ |
|
|
|
<a-button type="primary" html-type="submit" :loading="isBtnLoading">提交</a-button> |
|
|
|
<a-button type="primary" html-type="submit" :loading="isBtnLoading">提交</a-button> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
</a-form> |
|
|
|
</a-form> |
|
|
|
|
|
|
|
<AreasModal ref="AreasModal" @handleSubmit="handleAreaSubmit" /> |
|
|
|
</a-spin> |
|
|
|
</a-spin> |
|
|
|
</a-card> |
|
|
|
</a-card> |
|
|
|
</template> |
|
|
|
</template> |
|
|
@ -459,7 +484,12 @@ import * as GoodsApi from '@/api/goods' |
|
|
|
import { SelectImage, SelectVideo, Ueditor, InputNumberGroup } from '@/components' |
|
|
|
import { SelectImage, SelectVideo, Ueditor, InputNumberGroup } from '@/components' |
|
|
|
import GoodsModel from '@/common/model/goods/Index' |
|
|
|
import GoodsModel from '@/common/model/goods/Index' |
|
|
|
import { GoodsType, MultiSpec } from './modules' |
|
|
|
import { GoodsType, MultiSpec } from './modules' |
|
|
|
|
|
|
|
import { AreasModal } from '@/components/Modal' |
|
|
|
|
|
|
|
const defaultItem = { |
|
|
|
|
|
|
|
key: 0, |
|
|
|
|
|
|
|
region: [], |
|
|
|
|
|
|
|
region_text: [], |
|
|
|
|
|
|
|
} |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
components: { |
|
|
|
GoodsType, |
|
|
|
GoodsType, |
|
|
@ -467,7 +497,8 @@ export default { |
|
|
|
SelectVideo, |
|
|
|
SelectVideo, |
|
|
|
Ueditor, |
|
|
|
Ueditor, |
|
|
|
InputNumberGroup, |
|
|
|
InputNumberGroup, |
|
|
|
MultiSpec |
|
|
|
MultiSpec, |
|
|
|
|
|
|
|
AreasModal, |
|
|
|
}, |
|
|
|
}, |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
@ -483,26 +514,39 @@ export default { |
|
|
|
// 当前表单元素 |
|
|
|
// 当前表单元素 |
|
|
|
form: this.$form.createForm(this), |
|
|
|
form: this.$form.createForm(this), |
|
|
|
// 表单数据 |
|
|
|
// 表单数据 |
|
|
|
formData: GoodsModel.formData |
|
|
|
formData: GoodsModel.formData, |
|
|
|
|
|
|
|
checkList: [], |
|
|
|
|
|
|
|
// 销售区域 |
|
|
|
|
|
|
|
ruleList: [], |
|
|
|
|
|
|
|
// 销售区域表头 |
|
|
|
|
|
|
|
columns: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
title: '销售区域', |
|
|
|
|
|
|
|
dataIndex: 'region_text', |
|
|
|
|
|
|
|
width: '400px', |
|
|
|
|
|
|
|
scopedSlots: { customRender: 'region_text' }, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
// 城市总数 |
|
|
|
|
|
|
|
citysCount: null, |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 初始化数据 |
|
|
|
// 初始化数据 |
|
|
|
created() { |
|
|
|
created() { |
|
|
|
this.isLoading = true |
|
|
|
this.isLoading = true |
|
|
|
// 获取form所需的数据 |
|
|
|
// 获取form所需的数据 |
|
|
|
GoodsModel.getFromData() |
|
|
|
GoodsModel.getFromData().then(() => { |
|
|
|
.then(() => { |
|
|
|
|
|
|
|
this.isLoading = false |
|
|
|
this.isLoading = false |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
|
|
|
|
|
|
|
|
// 手动强制更新页面 |
|
|
|
// 手动强制更新页面 |
|
|
|
onForceUpdate(bool = false) { |
|
|
|
onForceUpdate(bool = false) { |
|
|
|
this.$forceUpdate() |
|
|
|
this.$forceUpdate() |
|
|
|
// bool为true时再执行一次 $forceUpdate, 特殊情况下需执行两次,原因如下: |
|
|
|
// bool为true时再执行一次 $forceUpdate, 特殊情况下需执行两次,原因如下: |
|
|
|
// 第一次执行 $forceUpdate时, 新元素绑定v-decorator无法获取到form.getFieldValue |
|
|
|
// 第一次执行 $forceUpdate时, 新元素绑定v-decorator无法获取到form.getFieldValue |
|
|
|
bool && setTimeout(() => { |
|
|
|
bool && |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
this.$forceUpdate() |
|
|
|
this.$forceUpdate() |
|
|
|
}, 10) |
|
|
|
}, 10) |
|
|
|
}, |
|
|
|
}, |
|
|
@ -540,7 +584,9 @@ export default { |
|
|
|
handleSubmit(e) { |
|
|
|
handleSubmit(e) { |
|
|
|
e.preventDefault() |
|
|
|
e.preventDefault() |
|
|
|
// 表单验证 |
|
|
|
// 表单验证 |
|
|
|
const { form: { validateFields } } = this |
|
|
|
const { |
|
|
|
|
|
|
|
form: { validateFields }, ruleList |
|
|
|
|
|
|
|
} = this |
|
|
|
validateFields((errors, values) => { |
|
|
|
validateFields((errors, values) => { |
|
|
|
// 定位到错误的tab选项卡 |
|
|
|
// 定位到错误的tab选项卡 |
|
|
|
if (errors) { |
|
|
|
if (errors) { |
|
|
@ -557,8 +603,9 @@ export default { |
|
|
|
// 记录多规格数据 |
|
|
|
// 记录多规格数据 |
|
|
|
values.specData = MultiSpec.getFromSpecData() |
|
|
|
values.specData = MultiSpec.getFromSpecData() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
values.rules = ruleList |
|
|
|
// 整理商品分类ID集 |
|
|
|
// 整理商品分类ID集 |
|
|
|
values.categoryIds = values.categorys.map(item => item.value) |
|
|
|
values.categoryIds = values.categorys.map((item) => item.value) |
|
|
|
delete values.categorys |
|
|
|
delete values.categorys |
|
|
|
// 提交到后端api |
|
|
|
// 提交到后端api |
|
|
|
this.onFormSubmit(values) |
|
|
|
this.onFormSubmit(values) |
|
|
@ -574,7 +621,7 @@ export default { |
|
|
|
['goods_type', 'goods_name', 'categorys', 'imagesIds', 'delivery_id', 'is_ind_delivery_type', 'delivery_type'], |
|
|
|
['goods_type', 'goods_name', 'categorys', 'imagesIds', 'delivery_id', 'is_ind_delivery_type', 'delivery_type'], |
|
|
|
['spec_type', 'goods_price', 'is_restrict', 'restrict_total', 'restrict_single'], |
|
|
|
['spec_type', 'goods_price', 'is_restrict', 'restrict_total', 'restrict_single'], |
|
|
|
['content'], |
|
|
|
['content'], |
|
|
|
['alone_grade_equity', 'first_money', 'second_money', 'third_money'] |
|
|
|
['alone_grade_equity', 'first_money', 'second_money', 'third_money'], |
|
|
|
] |
|
|
|
] |
|
|
|
const field = Object.keys(errors).shift() |
|
|
|
const field = Object.keys(errors).shift() |
|
|
|
for (const key in tabsFieldsMap) { |
|
|
|
for (const key in tabsFieldsMap) { |
|
|
@ -590,7 +637,7 @@ export default { |
|
|
|
this.isLoading = true |
|
|
|
this.isLoading = true |
|
|
|
this.isBtnLoading = true |
|
|
|
this.isBtnLoading = true |
|
|
|
GoodsApi.add({ form: values }) |
|
|
|
GoodsApi.add({ form: values }) |
|
|
|
.then(result => { |
|
|
|
.then((result) => { |
|
|
|
// 显示提示信息 |
|
|
|
// 显示提示信息 |
|
|
|
this.$message.success(result.message, 1.5) |
|
|
|
this.$message.success(result.message, 1.5) |
|
|
|
// 跳转到列表页 |
|
|
|
// 跳转到列表页 |
|
|
@ -601,13 +648,89 @@ export default { |
|
|
|
.catch(() => { |
|
|
|
.catch(() => { |
|
|
|
this.isBtnLoading = false |
|
|
|
this.isBtnLoading = false |
|
|
|
}) |
|
|
|
}) |
|
|
|
.finally(() => this.isLoading = false) |
|
|
|
.finally(() => (this.isLoading = false)) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 新增记录 |
|
|
|
|
|
|
|
handleAdd() { |
|
|
|
|
|
|
|
const index = this.ruleList.length |
|
|
|
|
|
|
|
const newItem = { ...defaultItem, key: index } |
|
|
|
|
|
|
|
// 排除的城市id集(已存在的城市id集) |
|
|
|
|
|
|
|
const excludedCityIds = this.getExcludedCityIds() |
|
|
|
|
|
|
|
if (excludedCityIds.length === this.citysCount) { |
|
|
|
|
|
|
|
this.$message.error('已选择了所有的区域', 0.8) |
|
|
|
|
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 显示选择地区对话框 |
|
|
|
|
|
|
|
this.handleAreasModal('add', index, newItem, excludedCityIds) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 编辑记录 |
|
|
|
|
|
|
|
handleEdit(index, item) { |
|
|
|
|
|
|
|
// 排除的城市id集(已存在的城市id集) |
|
|
|
|
|
|
|
const excludedCityIds = this.getExcludedCityIds() |
|
|
|
|
|
|
|
// 显示选择地区对话框 |
|
|
|
|
|
|
|
this.handleAreasModal('edit', index, item, excludedCityIds) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 选择地区后的回调 |
|
|
|
|
|
|
|
handleAreaSubmit(result) { |
|
|
|
|
|
|
|
const { |
|
|
|
|
|
|
|
custom: { scene, item }, |
|
|
|
|
|
|
|
} = result |
|
|
|
|
|
|
|
item.region = result.selectedCityIds |
|
|
|
|
|
|
|
item.region_text = result.selectedText |
|
|
|
|
|
|
|
if (scene === 'add') { |
|
|
|
|
|
|
|
this.ruleList.push(item) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 排除的城市id集(已存在的城市id集) |
|
|
|
|
|
|
|
getExcludedCityIds() { |
|
|
|
|
|
|
|
const excludedCityIds = [] |
|
|
|
|
|
|
|
this.ruleList.forEach((item) => { |
|
|
|
|
|
|
|
item.region.forEach((cityId) => { |
|
|
|
|
|
|
|
excludedCityIds.push(cityId) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return excludedCityIds |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 显示选择地区对话框 |
|
|
|
|
|
|
|
handleAreasModal(scene, index, item, excludedCityIds) { |
|
|
|
|
|
|
|
this.$refs.AreasModal.handle({ scene, index, item }, item.region, excludedCityIds) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 删除记录 |
|
|
|
|
|
|
|
handleDelete(index) { |
|
|
|
|
|
|
|
const app = this |
|
|
|
|
|
|
|
const modal = this.$confirm({ |
|
|
|
|
|
|
|
title: '您确定要删除该记录吗?', |
|
|
|
|
|
|
|
onOk() { |
|
|
|
|
|
|
|
app.ruleList.splice(index, 1) |
|
|
|
|
|
|
|
modal.destroy() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
<style lang="less" scoped> |
|
|
|
<style lang="less" scoped> |
|
|
|
@import './style.less'; |
|
|
|
@import './style.less'; |
|
|
|
|
|
|
|
.table-rules { |
|
|
|
|
|
|
|
.operation { |
|
|
|
|
|
|
|
text-align: right; |
|
|
|
|
|
|
|
a { |
|
|
|
|
|
|
|
font-size: @font-size-base; |
|
|
|
|
|
|
|
margin-left: 6px; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.content { |
|
|
|
|
|
|
|
color: #505050; |
|
|
|
|
|
|
|
white-space: normal; |
|
|
|
|
|
|
|
.city-name { |
|
|
|
|
|
|
|
font-size: 12.5px; |
|
|
|
|
|
|
|
color: #7b7b7b; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |
|
|
|