|
|
|
@ -169,11 +169,13 @@ |
|
|
|
|
v-for="(item, index) in formData.deliveryList" |
|
|
|
|
:key="index" |
|
|
|
|
:value="item.delivery_id" |
|
|
|
|
>{{ item.name }}</a-select-option |
|
|
|
|
>{{ item.name }}</a-select-option |
|
|
|
|
> |
|
|
|
|
</a-select> |
|
|
|
|
<div class="form-item-help"> |
|
|
|
|
<router-link target="_blank" :to="{ path: '/setting/delivery/template/create' }">新增模板</router-link> |
|
|
|
|
<router-link target="_blank" :to="{ path: '/setting/delivery/template/create' }" |
|
|
|
|
>新增模板</router-link |
|
|
|
|
> |
|
|
|
|
<a href="javascript:;" @click="onReloadDeliveryList">刷新</a> |
|
|
|
|
</div> |
|
|
|
|
</a-form-item> |
|
|
|
@ -230,7 +232,12 @@ |
|
|
|
|
/> |
|
|
|
|
<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.01" :precision="2" v-decorator="['cost_price']" /> |
|
|
|
|
<span class="ml-10">元</span> |
|
|
|
|
</a-form-item> |
|
|
|
@ -363,9 +370,12 @@ |
|
|
|
|
v-decorator="['serviceIds']" |
|
|
|
|
placeholder="请选择服务与承诺" |
|
|
|
|
> |
|
|
|
|
<a-select-option v-for="(item, index) in formData.serviceList" :key="index" :value="item.service_id">{{ |
|
|
|
|
item.name |
|
|
|
|
}}</a-select-option> |
|
|
|
|
<a-select-option |
|
|
|
|
v-for="(item, index) in formData.serviceList" |
|
|
|
|
:key="index" |
|
|
|
|
:value="item.service_id" |
|
|
|
|
>{{ item.name }}</a-select-option |
|
|
|
|
> |
|
|
|
|
</a-select> |
|
|
|
|
<div class="form-item-help"> |
|
|
|
|
<router-link target="_blank" :to="{ path: '/goods/service/index' }">去新增</router-link> |
|
|
|
@ -398,24 +408,29 @@ |
|
|
|
|
<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> |
|
|
|
|
</span> |
|
|
|
|
</p> |
|
|
|
|
<p class="operation" style="text-align: right;"> |
|
|
|
|
<p class="operation" style="text-align: right"> |
|
|
|
|
<a href="javascript:void(0);" class="edit" @click="handleEdit(index, item)">编辑</a> |
|
|
|
|
<a href="javascript:void(0);" style="margin-left: 6px;" class="delete" @click="handleDelete(index)">删除</a> |
|
|
|
|
<a |
|
|
|
|
href="javascript:void(0);" |
|
|
|
|
style="margin-left: 6px" |
|
|
|
|
class="delete" |
|
|
|
|
@click="handleDelete(index)" |
|
|
|
|
>删除</a |
|
|
|
|
> |
|
|
|
|
</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 v-show="$module('market-points')"> |
|
|
|
@ -543,7 +558,7 @@ |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</a-form> |
|
|
|
|
<AreasModal ref="AreasModal" @handleSubmit="handleAreaSubmit" :loading="isBtnLoading"/> |
|
|
|
|
<AreasModal ref="AreasModal" @handleSubmit="handleAreaSubmit" :loading="isBtnLoading" /> |
|
|
|
|
</a-spin> |
|
|
|
|
</a-card> |
|
|
|
|
</a-modal> |
|
|
|
@ -560,7 +575,7 @@ import { AreasModal } from '@/components/Modal' |
|
|
|
|
const defaultItem = { |
|
|
|
|
key: 0, |
|
|
|
|
region: [], |
|
|
|
|
region_text: [] |
|
|
|
|
region_text: [], |
|
|
|
|
} |
|
|
|
|
export default { |
|
|
|
|
components: { |
|
|
|
@ -570,12 +585,12 @@ export default { |
|
|
|
|
Ueditor, |
|
|
|
|
InputNumberGroup, |
|
|
|
|
MultiSpec, |
|
|
|
|
AreasModal |
|
|
|
|
AreasModal, |
|
|
|
|
}, |
|
|
|
|
props: { |
|
|
|
|
// 分类列表 |
|
|
|
|
}, |
|
|
|
|
data () { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
categoryList: [], |
|
|
|
|
// 对话框标题 |
|
|
|
@ -608,15 +623,15 @@ export default { |
|
|
|
|
title: '销售区域', |
|
|
|
|
dataIndex: 'region_text', |
|
|
|
|
width: '400px', |
|
|
|
|
scopedSlots: { customRender: 'region_text' } |
|
|
|
|
} |
|
|
|
|
scopedSlots: { customRender: 'region_text' }, |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
// 城市总数 |
|
|
|
|
citysCount: null |
|
|
|
|
citysCount: null, |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
initData (goodsId) { |
|
|
|
|
initData(goodsId) { |
|
|
|
|
GoodsModel.formData.goods = {} |
|
|
|
|
this.visible = true |
|
|
|
|
// 记录商品ID |
|
|
|
@ -640,7 +655,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 手动强制更新页面 |
|
|
|
|
onForceUpdate (bool = false) { |
|
|
|
|
onForceUpdate(bool = false) { |
|
|
|
|
this.$forceUpdate() |
|
|
|
|
// bool为true时再执行一次 $forceUpdate, 特殊情况下需执行两次,原因如下: |
|
|
|
|
// 第一次执行 $forceUpdate时, 新元素绑定v-decorator无法获取到form.getFieldValue |
|
|
|
@ -651,12 +666,12 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 切换tab选项卡 |
|
|
|
|
handleTabs (key) { |
|
|
|
|
handleTabs(key) { |
|
|
|
|
this.tabKey = key |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 刷新分类列表 |
|
|
|
|
onReloadCategoryList () { |
|
|
|
|
onReloadCategoryList() { |
|
|
|
|
this.isLoading = true |
|
|
|
|
GoodsModel.getCategoryList().then(() => { |
|
|
|
|
this.isLoading = false |
|
|
|
@ -664,7 +679,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 刷新服务与承诺列表 |
|
|
|
|
onReloadServiceList () { |
|
|
|
|
onReloadServiceList() { |
|
|
|
|
this.isLoading = true |
|
|
|
|
GoodsModel.getServiceList().then(() => { |
|
|
|
|
this.isLoading = false |
|
|
|
@ -672,24 +687,24 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 刷新配送模板列表 |
|
|
|
|
onReloadDeliveryList () { |
|
|
|
|
onReloadDeliveryList() { |
|
|
|
|
this.isLoading = true |
|
|
|
|
GoodsModel.getDeliveryList().then(() => { |
|
|
|
|
this.isLoading = false |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 关闭对话框事件 |
|
|
|
|
handleCancel () { |
|
|
|
|
handleCancel() { |
|
|
|
|
this.visible = false |
|
|
|
|
this.form.resetFields() |
|
|
|
|
}, |
|
|
|
|
// 确认按钮 |
|
|
|
|
handleSubmit (e) { |
|
|
|
|
handleSubmit(e) { |
|
|
|
|
e.preventDefault() |
|
|
|
|
// 表单验证 |
|
|
|
|
const { |
|
|
|
|
form: { validateFields }, |
|
|
|
|
ruleList |
|
|
|
|
ruleList, |
|
|
|
|
} = this |
|
|
|
|
validateFields((errors, values) => { |
|
|
|
|
// 定位到错误的tab选项卡 |
|
|
|
@ -718,7 +733,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 定位到错误的tab选项卡 |
|
|
|
|
onTargetTabError (errors) { |
|
|
|
|
onTargetTabError(errors) { |
|
|
|
|
// 表单字段与tabKey对应关系 |
|
|
|
|
// 只需要必填字段就可 |
|
|
|
|
const tabsFieldsMap = [ |
|
|
|
@ -731,11 +746,11 @@ export default { |
|
|
|
|
'is_ind_delivery_type', |
|
|
|
|
'delivery_type', |
|
|
|
|
'is_brand', |
|
|
|
|
'is_in_store' |
|
|
|
|
'is_in_store', |
|
|
|
|
], |
|
|
|
|
['spec_type', 'goods_price', 'is_restrict', 'restrict_total', 'restrict_single', 'cost_price'], |
|
|
|
|
['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() |
|
|
|
|
for (const key in tabsFieldsMap) { |
|
|
|
@ -747,14 +762,14 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 提交到后端api |
|
|
|
|
onFormSubmit (values) { |
|
|
|
|
onFormSubmit(values) { |
|
|
|
|
this.isLoading = true |
|
|
|
|
this.isBtnLoading = true |
|
|
|
|
GoodsApi.edit({ goodsId: this.goodsId, form: values }) |
|
|
|
|
.then((result) => { |
|
|
|
|
// 显示提示信息 |
|
|
|
|
this.$message.success(result.message, 1.5) |
|
|
|
|
this.$emit('refresh'); |
|
|
|
|
this.$emit('refresh') |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.handleCancel() |
|
|
|
|
}, 500) |
|
|
|
@ -765,7 +780,7 @@ export default { |
|
|
|
|
.finally(() => (this.isLoading = false)) |
|
|
|
|
}, |
|
|
|
|
// 新增记录 |
|
|
|
|
handleAdd () { |
|
|
|
|
handleAdd() { |
|
|
|
|
const index = this.ruleList.length |
|
|
|
|
const newItem = { ...defaultItem, key: index } |
|
|
|
|
// 排除的城市id集(已存在的城市id集) |
|
|
|
@ -779,7 +794,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 编辑记录 |
|
|
|
|
handleEdit (index, item) { |
|
|
|
|
handleEdit(index, item) { |
|
|
|
|
// 排除的城市id集(已存在的城市id集) |
|
|
|
|
const excludedCityIds = this.getExcludedCityIds() |
|
|
|
|
// 显示选择地区对话框 |
|
|
|
@ -787,9 +802,9 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 选择地区后的回调 |
|
|
|
|
handleAreaSubmit (result) { |
|
|
|
|
handleAreaSubmit(result) { |
|
|
|
|
const { |
|
|
|
|
custom: { scene, item } |
|
|
|
|
custom: { scene, item }, |
|
|
|
|
} = result |
|
|
|
|
item.region = result.selectedCityIds |
|
|
|
|
item.region_text = result.selectedText |
|
|
|
@ -799,7 +814,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 排除的城市id集(已存在的城市id集) |
|
|
|
|
getExcludedCityIds () { |
|
|
|
|
getExcludedCityIds() { |
|
|
|
|
const excludedCityIds = [] |
|
|
|
|
this.ruleList.forEach((item) => { |
|
|
|
|
item.region.forEach((cityId) => { |
|
|
|
@ -810,21 +825,21 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 显示选择地区对话框 |
|
|
|
|
handleAreasModal (scene, index, item, excludedCityIds) { |
|
|
|
|
handleAreasModal(scene, index, item, excludedCityIds) { |
|
|
|
|
this.$refs.AreasModal.handle({ scene, index, item }, item.region, excludedCityIds) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 删除记录 |
|
|
|
|
handleDelete (index) { |
|
|
|
|
handleDelete(index) { |
|
|
|
|
const app = this |
|
|
|
|
const modal = this.$confirm({ |
|
|
|
|
title: '您确定要删除该记录吗?', |
|
|
|
|
onOk () { |
|
|
|
|
onOk() { |
|
|
|
|
app.ruleList.splice(index, 1) |
|
|
|
|
modal.destroy() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|