|
|
@ -36,7 +36,6 @@ |
|
|
|
:dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }" |
|
|
|
:dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }" |
|
|
|
:treeData="formData.categoryList" |
|
|
|
:treeData="formData.categoryList" |
|
|
|
treeCheckable |
|
|
|
treeCheckable |
|
|
|
treeCheckStrictly |
|
|
|
|
|
|
|
allowClear |
|
|
|
allowClear |
|
|
|
v-decorator="['categorys', { rules: [{ required: true, message: '请至少选择1个商品分类' }] }]" |
|
|
|
v-decorator="['categorys', { rules: [{ required: true, message: '请至少选择1个商品分类' }] }]" |
|
|
|
></a-tree-select> |
|
|
|
></a-tree-select> |
|
|
@ -158,7 +157,7 @@ |
|
|
|
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"> |
|
|
@ -377,8 +376,11 @@ |
|
|
|
<span>{{ province.name }}</span> |
|
|
|
<span>{{ province.name }}</span> |
|
|
|
<template v-if="province.citys.length"> |
|
|
|
<template v-if="province.citys.length"> |
|
|
|
<span>(</span> |
|
|
|
<span>(</span> |
|
|
|
<span class="city-name" v-for="(city, cidx) in province.citys" :key="cidx" |
|
|
|
<span |
|
|
|
>{{ city.name }}{{ province.citys.length > cidx + 1 ? '、' : '' }}</span |
|
|
|
class="city-name" |
|
|
|
|
|
|
|
v-for="(city, cidx) in province.citys" |
|
|
|
|
|
|
|
:key="cidx" |
|
|
|
|
|
|
|
>{{ city.name }}{{ province.citys.length > cidx + 1 ? '、' : '' }}</span |
|
|
|
> |
|
|
|
> |
|
|
|
<span>)</span> |
|
|
|
<span>)</span> |
|
|
|
</template> |
|
|
|
</template> |
|
|
@ -534,7 +536,7 @@ import { AreasModal } from '@/components/Modal' |
|
|
|
const defaultItem = { |
|
|
|
const defaultItem = { |
|
|
|
key: 0, |
|
|
|
key: 0, |
|
|
|
region: [], |
|
|
|
region: [], |
|
|
|
region_text: [], |
|
|
|
region_text: [] |
|
|
|
} |
|
|
|
} |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
components: { |
|
|
@ -544,9 +546,9 @@ export default { |
|
|
|
Ueditor, |
|
|
|
Ueditor, |
|
|
|
InputNumberGroup, |
|
|
|
InputNumberGroup, |
|
|
|
MultiSpec, |
|
|
|
MultiSpec, |
|
|
|
AreasModal, |
|
|
|
AreasModal |
|
|
|
}, |
|
|
|
}, |
|
|
|
data() { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
return { |
|
|
|
// 默认的标签索引 |
|
|
|
// 默认的标签索引 |
|
|
|
tabKey: 0, |
|
|
|
tabKey: 0, |
|
|
@ -570,15 +572,15 @@ export default { |
|
|
|
title: '销售区域', |
|
|
|
title: '销售区域', |
|
|
|
dataIndex: 'region_text', |
|
|
|
dataIndex: 'region_text', |
|
|
|
width: '400px', |
|
|
|
width: '400px', |
|
|
|
scopedSlots: { customRender: 'region_text' }, |
|
|
|
scopedSlots: { customRender: 'region_text' } |
|
|
|
}, |
|
|
|
} |
|
|
|
], |
|
|
|
], |
|
|
|
// 城市总数 |
|
|
|
// 城市总数 |
|
|
|
citysCount: null, |
|
|
|
citysCount: null |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 初始化数据 |
|
|
|
// 初始化数据 |
|
|
|
created() { |
|
|
|
created () { |
|
|
|
this.isLoading = true |
|
|
|
this.isLoading = true |
|
|
|
// 获取form所需的数据 |
|
|
|
// 获取form所需的数据 |
|
|
|
GoodsModel.getFromData().then(() => { |
|
|
|
GoodsModel.getFromData().then(() => { |
|
|
@ -587,7 +589,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
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 |
|
|
@ -598,12 +600,12 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 切换tab选项卡 |
|
|
|
// 切换tab选项卡 |
|
|
|
handleTabs(key) { |
|
|
|
handleTabs (key) { |
|
|
|
this.tabKey = key |
|
|
|
this.tabKey = key |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 刷新分类列表 |
|
|
|
// 刷新分类列表 |
|
|
|
onReloadCategoryList() { |
|
|
|
onReloadCategoryList () { |
|
|
|
this.isLoading = true |
|
|
|
this.isLoading = true |
|
|
|
GoodsModel.getCategoryList().then(() => { |
|
|
|
GoodsModel.getCategoryList().then(() => { |
|
|
|
this.isLoading = false |
|
|
|
this.isLoading = false |
|
|
@ -611,7 +613,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 刷新服务与承诺列表 |
|
|
|
// 刷新服务与承诺列表 |
|
|
|
onReloadServiceList() { |
|
|
|
onReloadServiceList () { |
|
|
|
this.isLoading = true |
|
|
|
this.isLoading = true |
|
|
|
GoodsModel.getServiceList().then(() => { |
|
|
|
GoodsModel.getServiceList().then(() => { |
|
|
|
this.isLoading = false |
|
|
|
this.isLoading = false |
|
|
@ -619,7 +621,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 刷新配送模板列表 |
|
|
|
// 刷新配送模板列表 |
|
|
|
onReloadDeliveryList() { |
|
|
|
onReloadDeliveryList () { |
|
|
|
this.isLoading = true |
|
|
|
this.isLoading = true |
|
|
|
GoodsModel.getDeliveryList().then(() => { |
|
|
|
GoodsModel.getDeliveryList().then(() => { |
|
|
|
this.isLoading = false |
|
|
|
this.isLoading = false |
|
|
@ -627,12 +629,12 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 确认按钮 |
|
|
|
// 确认按钮 |
|
|
|
handleSubmit(e) { |
|
|
|
handleSubmit (e) { |
|
|
|
e.preventDefault() |
|
|
|
e.preventDefault() |
|
|
|
// 表单验证 |
|
|
|
// 表单验证 |
|
|
|
const { |
|
|
|
const { |
|
|
|
form: { validateFields }, |
|
|
|
form: { validateFields }, |
|
|
|
ruleList, |
|
|
|
ruleList |
|
|
|
} = this |
|
|
|
} = this |
|
|
|
validateFields((errors, values) => { |
|
|
|
validateFields((errors, values) => { |
|
|
|
// 定位到错误的tab选项卡 |
|
|
|
// 定位到错误的tab选项卡 |
|
|
@ -661,14 +663,14 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 定位到错误的tab选项卡 |
|
|
|
// 定位到错误的tab选项卡 |
|
|
|
onTargetTabError(errors) { |
|
|
|
onTargetTabError (errors) { |
|
|
|
// 表单字段与tabKey对应关系 |
|
|
|
// 表单字段与tabKey对应关系 |
|
|
|
// 只需要必填字段就可 |
|
|
|
// 只需要必填字段就可 |
|
|
|
const tabsFieldsMap = [ |
|
|
|
const tabsFieldsMap = [ |
|
|
|
['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) { |
|
|
@ -680,7 +682,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 提交到后端api |
|
|
|
// 提交到后端api |
|
|
|
onFormSubmit(values) { |
|
|
|
onFormSubmit (values) { |
|
|
|
this.isLoading = true |
|
|
|
this.isLoading = true |
|
|
|
this.isBtnLoading = true |
|
|
|
this.isBtnLoading = true |
|
|
|
GoodsApi.add({ form: values }) |
|
|
|
GoodsApi.add({ form: values }) |
|
|
@ -698,7 +700,7 @@ export default { |
|
|
|
.finally(() => (this.isLoading = false)) |
|
|
|
.finally(() => (this.isLoading = false)) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 新增记录 |
|
|
|
// 新增记录 |
|
|
|
handleAdd() { |
|
|
|
handleAdd () { |
|
|
|
const index = this.ruleList.length |
|
|
|
const index = this.ruleList.length |
|
|
|
const newItem = { ...defaultItem, key: index } |
|
|
|
const newItem = { ...defaultItem, key: index } |
|
|
|
// 排除的城市id集(已存在的城市id集) |
|
|
|
// 排除的城市id集(已存在的城市id集) |
|
|
@ -712,7 +714,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 编辑记录 |
|
|
|
// 编辑记录 |
|
|
|
handleEdit(index, item) { |
|
|
|
handleEdit (index, item) { |
|
|
|
// 排除的城市id集(已存在的城市id集) |
|
|
|
// 排除的城市id集(已存在的城市id集) |
|
|
|
const excludedCityIds = this.getExcludedCityIds() |
|
|
|
const excludedCityIds = this.getExcludedCityIds() |
|
|
|
// 显示选择地区对话框 |
|
|
|
// 显示选择地区对话框 |
|
|
@ -720,9 +722,9 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 选择地区后的回调 |
|
|
|
// 选择地区后的回调 |
|
|
|
handleAreaSubmit(result) { |
|
|
|
handleAreaSubmit (result) { |
|
|
|
const { |
|
|
|
const { |
|
|
|
custom: { scene, item }, |
|
|
|
custom: { scene, item } |
|
|
|
} = result |
|
|
|
} = result |
|
|
|
item.region = result.selectedCityIds |
|
|
|
item.region = result.selectedCityIds |
|
|
|
item.region_text = result.selectedText |
|
|
|
item.region_text = result.selectedText |
|
|
@ -732,7 +734,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 排除的城市id集(已存在的城市id集) |
|
|
|
// 排除的城市id集(已存在的城市id集) |
|
|
|
getExcludedCityIds() { |
|
|
|
getExcludedCityIds () { |
|
|
|
const excludedCityIds = [] |
|
|
|
const excludedCityIds = [] |
|
|
|
this.ruleList.forEach((item) => { |
|
|
|
this.ruleList.forEach((item) => { |
|
|
|
item.region.forEach((cityId) => { |
|
|
|
item.region.forEach((cityId) => { |
|
|
@ -743,22 +745,22 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 显示选择地区对话框 |
|
|
|
// 显示选择地区对话框 |
|
|
|
handleAreasModal(scene, index, item, excludedCityIds) { |
|
|
|
handleAreasModal (scene, index, item, excludedCityIds) { |
|
|
|
this.$refs.AreasModal.handle({ scene, index, item }, item.region, excludedCityIds) |
|
|
|
this.$refs.AreasModal.handle({ scene, index, item }, item.region, excludedCityIds) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 删除记录 |
|
|
|
// 删除记录 |
|
|
|
handleDelete(index) { |
|
|
|
handleDelete (index) { |
|
|
|
const app = this |
|
|
|
const app = this |
|
|
|
const modal = this.$confirm({ |
|
|
|
const modal = this.$confirm({ |
|
|
|
title: '您确定要删除该记录吗?', |
|
|
|
title: '您确定要删除该记录吗?', |
|
|
|
onOk() { |
|
|
|
onOk () { |
|
|
|
app.ruleList.splice(index, 1) |
|
|
|
app.ruleList.splice(index, 1) |
|
|
|
modal.destroy() |
|
|
|
modal.destroy() |
|
|
|
}, |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
<style lang="less" scoped> |
|
|
|
<style lang="less" scoped> |
|
|
|