|
|
@@ -20,6 +20,7 @@
|
|
|
<a-select-option value="10">普通商品</a-select-option>
|
|
|
<a-select-option value="20">赠品</a-select-option>
|
|
|
<a-select-option value="30">搭配套餐商品</a-select-option>
|
|
|
+ <a-select-option value="40">积分兑换商品</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
<a-form-item label="商品名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
|
@@ -77,7 +78,7 @@
|
|
|
v-for="(item, index) in formData.providerList"
|
|
|
:key="index"
|
|
|
:value="item.provider_id"
|
|
|
- >{{ item.provider_name }}</a-select-option
|
|
|
+ >{{ item.provider_name }}</a-select-option
|
|
|
>
|
|
|
</a-select>
|
|
|
<div class="form-item-help">
|
|
|
@@ -119,7 +120,7 @@
|
|
|
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">
|
|
|
@@ -402,31 +403,31 @@ import storage from 'store'
|
|
|
const comboColumns = [
|
|
|
{
|
|
|
title: '商品ID',
|
|
|
- dataIndex: 'goods_id',
|
|
|
+ dataIndex: 'goods_id'
|
|
|
},
|
|
|
{
|
|
|
title: '商品名称',
|
|
|
- dataIndex: 'goods_name',
|
|
|
+ dataIndex: 'goods_name'
|
|
|
},
|
|
|
{
|
|
|
title: '规格名称',
|
|
|
dataIndex: 'goods_props',
|
|
|
- scopedSlots: { customRender: 'goods_props' },
|
|
|
+ scopedSlots: { customRender: 'goods_props' }
|
|
|
},
|
|
|
{
|
|
|
title: '商品SKU',
|
|
|
- dataIndex: 'goods_sku_no',
|
|
|
+ dataIndex: 'goods_sku_no'
|
|
|
},
|
|
|
{
|
|
|
title: '售价',
|
|
|
dataIndex: 'goods_price',
|
|
|
- scopedSlots: { customRender: 'goods_price' },
|
|
|
+ scopedSlots: { customRender: 'goods_price' }
|
|
|
},
|
|
|
{
|
|
|
title: '操作',
|
|
|
dataIndex: 'action',
|
|
|
- scopedSlots: { customRender: 'action' },
|
|
|
- },
|
|
|
+ scopedSlots: { customRender: 'action' }
|
|
|
+ }
|
|
|
]
|
|
|
export default {
|
|
|
components: {
|
|
|
@@ -435,9 +436,9 @@ export default {
|
|
|
InputNumberGroup,
|
|
|
MultiSpec,
|
|
|
SettingGoods,
|
|
|
- SelectRegion,
|
|
|
+ SelectRegion
|
|
|
},
|
|
|
- data() {
|
|
|
+ data () {
|
|
|
return {
|
|
|
// 默认的标签索引
|
|
|
tabKey: 0,
|
|
|
@@ -455,11 +456,11 @@ export default {
|
|
|
comboColumns,
|
|
|
comboData: [],
|
|
|
rebate: 10, // 换算折扣
|
|
|
- priceShow: true,
|
|
|
+ priceShow: true
|
|
|
}
|
|
|
},
|
|
|
// 初始化数据
|
|
|
- created() {
|
|
|
+ created () {
|
|
|
this.isLoading = true
|
|
|
// 获取form所需的数据
|
|
|
GoodsModel.getFromData().then(() => {
|
|
|
@@ -467,13 +468,13 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
methods: {
|
|
|
- changeGoodsSkuNo(e) {
|
|
|
+ changeGoodsSkuNo (e) {
|
|
|
e.target.value = e.target.value.replace(/\s+/g, '')
|
|
|
e.target.value = e.target.value.replace(/[\u4E00-\u9FA5]/g, '')
|
|
|
e.target.value = e.target.value.toUpperCase()
|
|
|
},
|
|
|
// 手动强制更新页面
|
|
|
- onForceUpdate(bool = false) {
|
|
|
+ onForceUpdate (bool = false) {
|
|
|
this.$forceUpdate()
|
|
|
// bool为true时再执行一次 $forceUpdate, 特殊情况下需执行两次,原因如下:
|
|
|
// 第一次执行 $forceUpdate时, 新元素绑定v-decorator无法获取到form.getFieldValue
|
|
|
@@ -484,12 +485,12 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 切换tab选项卡
|
|
|
- handleTabs(key) {
|
|
|
+ handleTabs (key) {
|
|
|
this.tabKey = key
|
|
|
},
|
|
|
|
|
|
// 刷新分类列表
|
|
|
- onReloadCategoryList() {
|
|
|
+ onReloadCategoryList () {
|
|
|
this.isLoading = true
|
|
|
GoodsModel.getCategoryList().then(() => {
|
|
|
this.isLoading = false
|
|
|
@@ -497,7 +498,7 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 刷新服务与承诺列表
|
|
|
- onReloadServiceList() {
|
|
|
+ onReloadServiceList () {
|
|
|
this.isLoading = true
|
|
|
GoodsModel.getServiceList().then(() => {
|
|
|
this.isLoading = false
|
|
|
@@ -505,7 +506,7 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 刷新配送模板列表
|
|
|
- onReloadDeliveryList() {
|
|
|
+ onReloadDeliveryList () {
|
|
|
this.isLoading = true
|
|
|
GoodsModel.getDeliveryList().then(() => {
|
|
|
this.isLoading = false
|
|
|
@@ -513,7 +514,7 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 刷新供应商列表
|
|
|
- onReloadProviderList() {
|
|
|
+ onReloadProviderList () {
|
|
|
this.isLoading = true
|
|
|
GoodsModel.getProviderList().then(() => {
|
|
|
this.isLoading = false
|
|
|
@@ -523,11 +524,11 @@ export default {
|
|
|
/**
|
|
|
* 确认按钮
|
|
|
*/
|
|
|
- handleSubmit(e) {
|
|
|
+ handleSubmit (e) {
|
|
|
e.preventDefault()
|
|
|
// 表单验证
|
|
|
const {
|
|
|
- form: { validateFields },
|
|
|
+ form: { validateFields }
|
|
|
} = this
|
|
|
validateFields((errors, values) => {
|
|
|
// 定位到错误的tab选项卡
|
|
|
@@ -540,11 +541,11 @@ export default {
|
|
|
this.$message.error('请选择套餐搭配的关联商品', 1.5)
|
|
|
return
|
|
|
}
|
|
|
- let comboArr = []
|
|
|
+ const comboArr = []
|
|
|
this.comboData.forEach((item) => {
|
|
|
comboArr.push({
|
|
|
rel_goods_id: item.goods_id,
|
|
|
- rel_goods_sku_id: item.goods_sku_id,
|
|
|
+ rel_goods_sku_id: item.goods_sku_id
|
|
|
})
|
|
|
})
|
|
|
values.packageSkuData = comboArr
|
|
|
@@ -579,7 +580,7 @@ export default {
|
|
|
/**
|
|
|
* 定位到错误的tab选项卡
|
|
|
*/
|
|
|
- onTargetTabError(errors) {
|
|
|
+ onTargetTabError (errors) {
|
|
|
// 表单字段与tabKey对应关系
|
|
|
// 只需要必填字段就可
|
|
|
const tabsFieldsMap = [
|
|
|
@@ -592,11 +593,11 @@ export default {
|
|
|
'unit',
|
|
|
'cascader',
|
|
|
'storage',
|
|
|
- 'supplier',
|
|
|
+ 'supplier'
|
|
|
],
|
|
|
['spec_type', 'goods_price', 'line_price', 'goods_sku_no', 'specs'],
|
|
|
['content'],
|
|
|
- ['alone_grade_equity'],
|
|
|
+ ['alone_grade_equity']
|
|
|
]
|
|
|
const field = Object.keys(errors).shift()
|
|
|
for (const key in tabsFieldsMap) {
|
|
|
@@ -610,17 +611,17 @@ export default {
|
|
|
/**
|
|
|
* 提交到后端api
|
|
|
*/
|
|
|
- onFormSubmit(values) {
|
|
|
- let that = this
|
|
|
+ onFormSubmit (values) {
|
|
|
+ const that = this
|
|
|
if (values.spec_type == 10) {
|
|
|
if (Number(values.goods_weight) > Number(values.goods_gross_weight)) {
|
|
|
that.$message.error('商品净重量不能大于商品毛重量', 2)
|
|
|
return
|
|
|
}
|
|
|
} else {
|
|
|
- let skuList = values.specData.skuList
|
|
|
+ const skuList = values.specData.skuList
|
|
|
for (let i = 0; i < skuList.length; i++) {
|
|
|
- let item = skuList[i]
|
|
|
+ const item = skuList[i]
|
|
|
if (item.image_id == 0) {
|
|
|
that.$message.error('商品规格预览图不能为空', 2)
|
|
|
return
|
|
|
@@ -650,11 +651,11 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
// 添加套餐关联商品
|
|
|
- addComob() {
|
|
|
+ addComob () {
|
|
|
this.$refs.SettingGoods.open(this.comboData)
|
|
|
},
|
|
|
- handleSettingGoods() {
|
|
|
- let selectList = storage.get('selectList')
|
|
|
+ handleSettingGoods () {
|
|
|
+ const selectList = storage.get('selectList')
|
|
|
selectList.forEach((item) => {
|
|
|
this.comboData.push({
|
|
|
goods_id: item.goods_id,
|
|
|
@@ -662,24 +663,24 @@ export default {
|
|
|
goods_sku_no: item.goods_sku_no,
|
|
|
goods_name: item.goods_name,
|
|
|
goods_price: item.goods_price,
|
|
|
- goods_props: item.goods_props,
|
|
|
+ goods_props: item.goods_props
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
// 删除关联商品
|
|
|
- deleteCombo(index) {
|
|
|
+ deleteCombo (index) {
|
|
|
const app = this
|
|
|
const modal = this.$confirm({
|
|
|
title: '提示',
|
|
|
content: '确认删除吗?',
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
- onOk() {
|
|
|
+ onOk () {
|
|
|
app.comboData.splice(index, 1)
|
|
|
- },
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
- changeGoodsPrice(e) {
|
|
|
+ changeGoodsPrice (e) {
|
|
|
if (!e || !this.form.getFieldValue('line_price')) {
|
|
|
this.priceShow = false
|
|
|
this.rebate = 0
|
|
|
@@ -688,7 +689,7 @@ export default {
|
|
|
this.priceShow = true
|
|
|
this.rebate = ((e / Number(this.form.getFieldValue('line_price'))) * 10).toFixed(2)
|
|
|
},
|
|
|
- changeLinePrice(e) {
|
|
|
+ changeLinePrice (e) {
|
|
|
if (!e || !this.form.getFieldValue('goods_price')) {
|
|
|
this.priceShow = false
|
|
|
this.rebate = 0
|
|
|
@@ -698,8 +699,8 @@ export default {
|
|
|
this.priceShow = true
|
|
|
this.rebate = ((Number(this.form.getFieldValue('goods_price')) / e) * 10).toFixed(2)
|
|
|
}
|
|
|
- },
|
|
|
- },
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|