|
|
@ -170,7 +170,12 @@ |
|
|
|
/> |
|
|
|
/> |
|
|
|
<span class="ml-10">元</span> |
|
|
|
<span class="ml-10">元</span> |
|
|
|
</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 :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> |
|
|
@ -206,7 +211,6 @@ |
|
|
|
<span class="ml-10">千克 (Kg)</span> |
|
|
|
<span class="ml-10">千克 (Kg)</span> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<!-- 商品详情 --> |
|
|
|
<!-- 商品详情 --> |
|
|
|
<div class="tab-pane" v-show="tabKey == 2"> |
|
|
|
<div class="tab-pane" v-show="tabKey == 2"> |
|
|
@ -276,11 +280,8 @@ |
|
|
|
<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 |
|
|
|
<span class="city-name" v-for="(city, cidx) in province.citys" :key="cidx" |
|
|
|
class="city-name" |
|
|
|
>{{ city.name }}{{ province.citys.length > cidx + 1 ? '、' : '' }}</span |
|
|
|
v-for="(city, cidx) in province.citys" |
|
|
|
|
|
|
|
:key="cidx" |
|
|
|
|
|
|
|
>{{ city.name }}{{ province.citys.length > cidx + 1 ? '、' : '' }}</span |
|
|
|
|
|
|
|
> |
|
|
|
> |
|
|
|
<span>)</span> |
|
|
|
<span>)</span> |
|
|
|
</template> |
|
|
|
</template> |
|
|
@ -293,7 +294,9 @@ |
|
|
|
</p> |
|
|
|
</p> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</a-table> |
|
|
|
</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> |
|
|
|
</a-form-item> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
@ -439,7 +442,7 @@ import Region from '@/common/model/Region' |
|
|
|
const defaultItem = { |
|
|
|
const defaultItem = { |
|
|
|
key: 0, |
|
|
|
key: 0, |
|
|
|
region: [], |
|
|
|
region: [], |
|
|
|
region_text: [] |
|
|
|
region_text: [], |
|
|
|
} |
|
|
|
} |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
name: 'Update', |
|
|
|
name: 'Update', |
|
|
@ -451,9 +454,9 @@ export default { |
|
|
|
InputNumberGroup, |
|
|
|
InputNumberGroup, |
|
|
|
MultiSpec, |
|
|
|
MultiSpec, |
|
|
|
AreasModal, |
|
|
|
AreasModal, |
|
|
|
Region |
|
|
|
Region, |
|
|
|
}, |
|
|
|
}, |
|
|
|
data () { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
// 默认的标签索引 |
|
|
|
// 默认的标签索引 |
|
|
|
tabKey: 0, |
|
|
|
tabKey: 0, |
|
|
@ -484,37 +487,37 @@ 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, |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
beforeDestroy () { |
|
|
|
beforeDestroy() { |
|
|
|
// 销毁商品详情 |
|
|
|
// 销毁商品详情 |
|
|
|
GoodsModel.formData.goods = {} |
|
|
|
GoodsModel.formData.goods = {} |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
showEdit (goodsId) { |
|
|
|
showEdit(goodsId) { |
|
|
|
// 记录商品ID |
|
|
|
// 记录商品ID |
|
|
|
this.goodsId = goodsId |
|
|
|
this.visible = true |
|
|
|
this.initData() |
|
|
|
this.goodsId = goodsId |
|
|
|
this.getDataList() |
|
|
|
this.initData() |
|
|
|
// 城市总数 |
|
|
|
this.getDataList() |
|
|
|
Region.getCitysCount().then((count) => { |
|
|
|
// 城市总数 |
|
|
|
this.citysCount = count |
|
|
|
Region.getCitysCount().then((count) => { |
|
|
|
}) |
|
|
|
this.citysCount = count |
|
|
|
this.visible = true |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 关闭对话框事件 |
|
|
|
// 关闭对话框事件 |
|
|
|
handleCancel () { |
|
|
|
handleCancel() { |
|
|
|
this.visible = false |
|
|
|
this.visible = false |
|
|
|
this.form.resetFields() |
|
|
|
this.form.resetFields() |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 初始化数据 |
|
|
|
// 初始化数据 |
|
|
|
initData (goodsId) { |
|
|
|
initData(goodsId) { |
|
|
|
// 获取form所需的数据 |
|
|
|
// 获取form所需的数据 |
|
|
|
this.isLoading = true |
|
|
|
this.isLoading = true |
|
|
|
GoodsModel.getFromData(this.goodsId).then(() => { |
|
|
|
GoodsModel.getFromData(this.goodsId).then(() => { |
|
|
@ -535,7 +538,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 手动强制更新页面 |
|
|
|
// 手动强制更新页面 |
|
|
|
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 |
|
|
@ -546,12 +549,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 |
|
|
@ -559,7 +562,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 刷新服务与承诺列表 |
|
|
|
// 刷新服务与承诺列表 |
|
|
|
onReloadServiceList () { |
|
|
|
onReloadServiceList() { |
|
|
|
this.isLoading = true |
|
|
|
this.isLoading = true |
|
|
|
GoodsModel.getServiceList().then(() => { |
|
|
|
GoodsModel.getServiceList().then(() => { |
|
|
|
this.isLoading = false |
|
|
|
this.isLoading = false |
|
|
@ -567,25 +570,25 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 刷新配送模板列表 |
|
|
|
// 刷新配送模板列表 |
|
|
|
onReloadDeliveryList () { |
|
|
|
onReloadDeliveryList() { |
|
|
|
this.isLoading = true |
|
|
|
this.isLoading = true |
|
|
|
GoodsModel.getDeliveryList().then(() => { |
|
|
|
GoodsModel.getDeliveryList().then(() => { |
|
|
|
this.isLoading = false |
|
|
|
this.isLoading = false |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 获取商品列表 |
|
|
|
// 获取商品列表 |
|
|
|
getDataList () { |
|
|
|
getDataList() { |
|
|
|
return GoodsApi.list().then((result) => { |
|
|
|
return GoodsApi.list().then((result) => { |
|
|
|
this.checkList = result.data.list.data |
|
|
|
this.checkList = result.data.list.data |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 确认按钮 |
|
|
|
// 确认按钮 |
|
|
|
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选项卡 |
|
|
@ -609,13 +612,12 @@ export default { |
|
|
|
// 提交到后端api |
|
|
|
// 提交到后端api |
|
|
|
values.rules = ruleList |
|
|
|
values.rules = ruleList |
|
|
|
this.onFormSubmit(values) |
|
|
|
this.onFormSubmit(values) |
|
|
|
this.handleCancel() |
|
|
|
|
|
|
|
return true |
|
|
|
return true |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 定位到错误的tab选项卡 |
|
|
|
// 定位到错误的tab选项卡 |
|
|
|
onTargetTabError (errors) { |
|
|
|
onTargetTabError(errors) { |
|
|
|
// 表单字段与tabKey对应关系 |
|
|
|
// 表单字段与tabKey对应关系 |
|
|
|
// 只需要必填字段就可 |
|
|
|
// 只需要必填字段就可 |
|
|
|
const tabsFieldsMap = [ |
|
|
|
const tabsFieldsMap = [ |
|
|
@ -628,11 +630,11 @@ export default { |
|
|
|
'is_ind_delivery_type', |
|
|
|
'is_ind_delivery_type', |
|
|
|
'delivery_type', |
|
|
|
'delivery_type', |
|
|
|
'is_brand', |
|
|
|
'is_brand', |
|
|
|
'is_in_store' |
|
|
|
'is_in_store', |
|
|
|
], |
|
|
|
], |
|
|
|
['spec_type', 'goods_price', 'is_restrict', 'restrict_total', 'restrict_single', 'cost_price'], |
|
|
|
['spec_type', 'goods_price', 'is_restrict', 'restrict_total', 'restrict_single', 'cost_price'], |
|
|
|
['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) { |
|
|
@ -644,17 +646,17 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 提交到后端api |
|
|
|
// 提交到后端api |
|
|
|
onFormSubmit (values) { |
|
|
|
onFormSubmit(values) { |
|
|
|
this.isLoading = true |
|
|
|
this.isLoading = true |
|
|
|
this.isBtnLoading = true |
|
|
|
this.isBtnLoading = true |
|
|
|
GoodsApi.edit({ goodsId: this.goodsId, form: values }) |
|
|
|
GoodsApi.edit({ goodsId: this.goodsId, form: values }) |
|
|
|
.then((result) => { |
|
|
|
.then((result) => { |
|
|
|
// 显示提示信息 |
|
|
|
// 显示提示信息 |
|
|
|
this.$message.success(result.message, 1.5) |
|
|
|
this.$message.success(result.message, 1.5) |
|
|
|
// // 跳转到列表页 |
|
|
|
this.$emit('refresh') |
|
|
|
// setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
// this.$router.push('./index') |
|
|
|
this.handleCancel() |
|
|
|
// }, 1500) |
|
|
|
}, 500) |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
.catch(() => { |
|
|
|
this.isBtnLoading = false |
|
|
|
this.isBtnLoading = false |
|
|
@ -663,7 +665,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 新增记录 |
|
|
|
// 新增记录 |
|
|
|
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集) |
|
|
@ -677,7 +679,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 编辑记录 |
|
|
|
// 编辑记录 |
|
|
|
handleEdit (index, item) { |
|
|
|
handleEdit(index, item) { |
|
|
|
// 排除的城市id集(已存在的城市id集) |
|
|
|
// 排除的城市id集(已存在的城市id集) |
|
|
|
const excludedCityIds = this.getExcludedCityIds() |
|
|
|
const excludedCityIds = this.getExcludedCityIds() |
|
|
|
// 显示选择地区对话框 |
|
|
|
// 显示选择地区对话框 |
|
|
@ -685,9 +687,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 |
|
|
@ -697,7 +699,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) => { |
|
|
@ -709,22 +711,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> |
|
|
|