|
|
|
@ -152,7 +152,9 @@ |
|
|
|
|
:isSpecLocked="formData.goods.isSpecLocked" |
|
|
|
|
:defaultSpecList="formData.goods.specList" |
|
|
|
|
:defaultSkuList="formData.goods.skuList" |
|
|
|
|
:channel="formData.goods.channel" |
|
|
|
|
:checkList="checkList" |
|
|
|
|
:source="1" |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
<!-- 单规格的表单内容 --> |
|
|
|
@ -170,7 +172,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" :precision="2" v-decorator="['cost_price']" /> |
|
|
|
|
<span class="ml-10">元</span> |
|
|
|
|
</a-form-item> |
|
|
|
@ -206,7 +213,6 @@ |
|
|
|
|
<span class="ml-10">千克 (Kg)</span> |
|
|
|
|
</a-form-item> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
<!-- 商品详情 --> |
|
|
|
|
<div class="tab-pane" v-show="tabKey == 2"> |
|
|
|
@ -276,10 +282,7 @@ |
|
|
|
|
<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" |
|
|
|
|
<span class="city-name" v-for="(city, cidx) in province.citys" :key="cidx" |
|
|
|
|
>{{ city.name }}{{ province.citys.length > cidx + 1 ? '、' : '' }}</span |
|
|
|
|
> |
|
|
|
|
<span>)</span> |
|
|
|
@ -293,7 +296,9 @@ |
|
|
|
|
</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> |
|
|
|
|
|
|
|
|
@ -439,7 +444,7 @@ import Region from '@/common/model/Region' |
|
|
|
|
const defaultItem = { |
|
|
|
|
key: 0, |
|
|
|
|
region: [], |
|
|
|
|
region_text: [] |
|
|
|
|
region_text: [], |
|
|
|
|
} |
|
|
|
|
export default { |
|
|
|
|
name: 'Update', |
|
|
|
@ -451,7 +456,7 @@ export default { |
|
|
|
|
InputNumberGroup, |
|
|
|
|
MultiSpec, |
|
|
|
|
AreasModal, |
|
|
|
|
Region |
|
|
|
|
Region, |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
@ -484,11 +489,11 @@ export default { |
|
|
|
|
title: '销售区域', |
|
|
|
|
dataIndex: 'region_text', |
|
|
|
|
width: '400px', |
|
|
|
|
scopedSlots: { customRender: 'region_text' } |
|
|
|
|
} |
|
|
|
|
scopedSlots: { customRender: 'region_text' }, |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
// 城市总数 |
|
|
|
|
citysCount: null |
|
|
|
|
citysCount: null, |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -499,6 +504,7 @@ export default { |
|
|
|
|
methods: { |
|
|
|
|
showEdit(goodsId) { |
|
|
|
|
// 记录商品ID |
|
|
|
|
this.visible = true |
|
|
|
|
this.goodsId = goodsId |
|
|
|
|
this.initData() |
|
|
|
|
this.getDataList() |
|
|
|
@ -506,7 +512,6 @@ export default { |
|
|
|
|
Region.getCitysCount().then((count) => { |
|
|
|
|
this.citysCount = count |
|
|
|
|
}) |
|
|
|
|
this.visible = true |
|
|
|
|
}, |
|
|
|
|
// 关闭对话框事件 |
|
|
|
|
handleCancel() { |
|
|
|
@ -516,8 +521,10 @@ export default { |
|
|
|
|
// 初始化数据 |
|
|
|
|
initData(goodsId) { |
|
|
|
|
// 获取form所需的数据 |
|
|
|
|
GoodsModel.formData.goods = {} |
|
|
|
|
this.isLoading = true |
|
|
|
|
GoodsModel.getFromData(this.goodsId).then(() => { |
|
|
|
|
this.formData.goods.goods_images=[] |
|
|
|
|
// 商品表单数据 |
|
|
|
|
if (!isEmptyObject(this.form.getFieldsValue())) { |
|
|
|
|
// 第一次赋值 |
|
|
|
@ -525,8 +532,10 @@ export default { |
|
|
|
|
// 第二次赋值 (适用于动态渲染的form-item) |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.form.setFieldsValue(GoodsModel.getFieldsValue2()) |
|
|
|
|
|
|
|
|
|
this.ruleList = this.formData.goods.rules ? this.formData.goods.rules : [] |
|
|
|
|
this.onForceUpdate() |
|
|
|
|
this.$forceUpdate() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
// this.ruleList = record.rule.map((item, index) => { return { ...item, key: index } }) |
|
|
|
@ -585,7 +594,7 @@ export default { |
|
|
|
|
// 表单验证 |
|
|
|
|
const { |
|
|
|
|
form: { validateFields }, |
|
|
|
|
ruleList |
|
|
|
|
ruleList, |
|
|
|
|
} = this |
|
|
|
|
validateFields((errors, values) => { |
|
|
|
|
// 定位到错误的tab选项卡 |
|
|
|
@ -609,7 +618,6 @@ export default { |
|
|
|
|
// 提交到后端api |
|
|
|
|
values.rules = ruleList |
|
|
|
|
this.onFormSubmit(values) |
|
|
|
|
this.handleCancel() |
|
|
|
|
return true |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
@ -628,11 +636,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) { |
|
|
|
@ -651,10 +659,10 @@ export default { |
|
|
|
|
.then((result) => { |
|
|
|
|
// 显示提示信息 |
|
|
|
|
this.$message.success(result.message, 1.5) |
|
|
|
|
// // 跳转到列表页 |
|
|
|
|
// setTimeout(() => { |
|
|
|
|
// this.$router.push('./index') |
|
|
|
|
// }, 1500) |
|
|
|
|
this.$emit('refresh') |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.handleCancel() |
|
|
|
|
}, 500) |
|
|
|
|
}) |
|
|
|
|
.catch(() => { |
|
|
|
|
this.isBtnLoading = false |
|
|
|
@ -687,7 +695,7 @@ export default { |
|
|
|
|
// 选择地区后的回调 |
|
|
|
|
handleAreaSubmit(result) { |
|
|
|
|
const { |
|
|
|
|
custom: { scene, item } |
|
|
|
|
custom: { scene, item }, |
|
|
|
|
} = result |
|
|
|
|
item.region = result.selectedCityIds |
|
|
|
|
item.region_text = result.selectedText |
|
|
|
@ -721,10 +729,10 @@ export default { |
|
|
|
|
onOk() { |
|
|
|
|
app.ruleList.splice(index, 1) |
|
|
|
|
modal.destroy() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
<style lang="less" scoped> |
|
|
|
|