|
|
|
@ -19,7 +19,8 @@ |
|
|
|
|
class="group-item-delete" |
|
|
|
|
href="javascript:;" |
|
|
|
|
@click="handleDeleteSpecGroup(index)" |
|
|
|
|
>删除规格组</a> |
|
|
|
|
>删除规格组</a |
|
|
|
|
> |
|
|
|
|
</div> |
|
|
|
|
<div class="spec-value clearfix"> |
|
|
|
|
<div class="spec-value-item" v-for="(itm, idx) in item.valueList" :key="idx"> |
|
|
|
@ -39,11 +40,7 @@ |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
<div v-if="!isSpecLocked" class="spec-value-add"> |
|
|
|
|
<a |
|
|
|
|
class="group-item-delete" |
|
|
|
|
href="javascript:;" |
|
|
|
|
@click="handleAddSpecValue(index)" |
|
|
|
|
>新增规格值</a> |
|
|
|
|
<a class="group-item-delete" href="javascript:;" @click="handleAddSpecValue(index)">新增规格值</a> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
@ -53,14 +50,10 @@ |
|
|
|
|
class="spec-group-add-btn" |
|
|
|
|
icon="plus" |
|
|
|
|
@click="handleAddSpecGroup" |
|
|
|
|
>添加规格组</a-button> |
|
|
|
|
</a-form-item> |
|
|
|
|
<a-form-item |
|
|
|
|
v-show="multiSpecData.skuList.length" |
|
|
|
|
label="SKU列表" |
|
|
|
|
:labelCol="labelCol" |
|
|
|
|
:wrapperCol="wrapperCol" |
|
|
|
|
>添加规格组</a-button |
|
|
|
|
> |
|
|
|
|
</a-form-item> |
|
|
|
|
<a-form-item v-show="multiSpecData.skuList.length" label="SKU列表" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
|
|
|
<!-- 批量设置 --> |
|
|
|
|
<div v-if="multiSpecData.skuList.length > 1" class="sku-batch"> |
|
|
|
|
<span class="title">批量设置:</span> |
|
|
|
@ -76,6 +69,12 @@ |
|
|
|
|
:min="0" |
|
|
|
|
:precision="2" |
|
|
|
|
/> |
|
|
|
|
<!-- <a-input-number |
|
|
|
|
v-model="multiSpecData.skuBatchForm.line_price" |
|
|
|
|
placeholder="划线价格" |
|
|
|
|
:min="0" |
|
|
|
|
:precision="2" |
|
|
|
|
/> --> |
|
|
|
|
<a-input-number |
|
|
|
|
v-model="multiSpecData.skuBatchForm.stock_num" |
|
|
|
|
placeholder="库存数量" |
|
|
|
@ -91,6 +90,7 @@ |
|
|
|
|
<a-input v-model="multiSpecData.skuBatchForm.goods_sku_no" placeholder="sku编码" /> |
|
|
|
|
<a-button @click="handleSkuBatch">立即设置</a-button> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<!-- sku列表table --> |
|
|
|
|
<a-table |
|
|
|
|
class="sku-list" |
|
|
|
@ -100,33 +100,42 @@ |
|
|
|
|
:pagination="false" |
|
|
|
|
bordered |
|
|
|
|
> |
|
|
|
|
<!-- 预览图 --> |
|
|
|
|
<template slot="image" slot-scope="text, item"> |
|
|
|
|
<SelectImage |
|
|
|
|
v-model="item.image_id" |
|
|
|
|
:defaultList="(item.image_id > 0 && item.image) ? [item.image] : []" |
|
|
|
|
:width="50" |
|
|
|
|
/> |
|
|
|
|
<template slot="select_goods" slot-scope="text, item"> |
|
|
|
|
<SelectGoods :multiple="false" @change="handleSelectGoods($event, item)" /> |
|
|
|
|
</template> |
|
|
|
|
<!-- 商品名称 --> |
|
|
|
|
<template slot="goods_name" slot-scope="text, item"> |
|
|
|
|
{{ item.goods_name }} |
|
|
|
|
</template> |
|
|
|
|
<!-- 商品价格 --> |
|
|
|
|
<template slot="goods_price" slot-scope="text, item"> |
|
|
|
|
<a-input-number v-model="item.goods_price" size="small" :min="0.01" :precision="2" /> |
|
|
|
|
{{ item.goods_price }} |
|
|
|
|
</template> |
|
|
|
|
<!-- 成本价格 --> |
|
|
|
|
<!-- 成本价 --> |
|
|
|
|
<template slot="cost_price" slot-scope="text, item"> |
|
|
|
|
<a-input-number v-model="item.cost_price" size="small" :min="0" :precision="2" /> |
|
|
|
|
{{ item.cost_price }} |
|
|
|
|
</template> |
|
|
|
|
<!-- 库存数量 --> |
|
|
|
|
<template slot="stock_num" slot-scope="text, item"> |
|
|
|
|
<a-input-number v-model="item.stock_num" size="small" :min="0" :precision="0" /> |
|
|
|
|
{{ item.stock_num }} |
|
|
|
|
</template> |
|
|
|
|
<!-- 商品重量 --> |
|
|
|
|
<template slot="goods_weight" slot-scope="text, item"> |
|
|
|
|
<a-input-number v-model="item.goods_weight" size="small" :min="0" :precision="2" /> |
|
|
|
|
<!-- <a-input-number v-model="item.goods_weight" size="small" :min="0" :precision="2" /> --> |
|
|
|
|
{{ item.goods_weight }} |
|
|
|
|
</template> |
|
|
|
|
<!-- sku编码 --> |
|
|
|
|
<template slot="goods_sku_no" slot-scope="text, item"> |
|
|
|
|
<a-input v-model="item.goods_sku_no" size="small" /> |
|
|
|
|
<!-- <a-input v-model="item.goods_sku_no" size="small" /> --> |
|
|
|
|
{{ item.goods_sku_no }} |
|
|
|
|
</template> |
|
|
|
|
<!-- 操作 --> |
|
|
|
|
<template slot="action" slot-scope="text, item"> |
|
|
|
|
<router-link |
|
|
|
|
v-if="item.goods_id" |
|
|
|
|
:to="{ path: '/goods/update', query: { goodsId: item.goods_id } }" |
|
|
|
|
>去修改</router-link |
|
|
|
|
> |
|
|
|
|
</template> |
|
|
|
|
</a-table> |
|
|
|
|
</a-form-item> |
|
|
|
@ -137,10 +146,13 @@ |
|
|
|
|
import PropTypes from 'ant-design-vue/es/_util/vue-types' |
|
|
|
|
import MultiSpecModel from '@/common/model/goods/MultiSpec' |
|
|
|
|
import { SelectImage } from '@/components' |
|
|
|
|
import SelectGoods from '@/components/SelectGoods/SelectGoods.vue' |
|
|
|
|
import * as GoodsApi from '@/api/goods' |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
components: { |
|
|
|
|
SelectImage |
|
|
|
|
SelectImage, |
|
|
|
|
SelectGoods |
|
|
|
|
}, |
|
|
|
|
props: { |
|
|
|
|
// 默认的规格列表 |
|
|
|
@ -148,7 +160,8 @@ export default { |
|
|
|
|
// 默认的SKU列表 |
|
|
|
|
defaultSkuList: PropTypes.array.def([]), |
|
|
|
|
// 商品规格是否锁定(锁定状态下不允许编辑规格) |
|
|
|
|
isSpecLocked: PropTypes.bool.def(false) |
|
|
|
|
isSpecLocked: PropTypes.bool.def(false), |
|
|
|
|
checkList: PropTypes.array.def([]) |
|
|
|
|
}, |
|
|
|
|
data () { |
|
|
|
|
return { |
|
|
|
@ -164,7 +177,8 @@ export default { |
|
|
|
|
specList: [], |
|
|
|
|
// SKU列表 |
|
|
|
|
skuList: [] |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
visible: false |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
@ -180,7 +194,6 @@ export default { |
|
|
|
|
this.getData() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
|
|
|
|
|
// 获取规格及SKU信息(展示) |
|
|
|
|
getData () { |
|
|
|
|
const { defaultSpecList, defaultSkuList } = this |
|
|
|
@ -270,11 +283,37 @@ export default { |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
showModal () { |
|
|
|
|
this.visible = true |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
async handleSelectGoods (goodsId, item) { |
|
|
|
|
console.log(goodsId, item) |
|
|
|
|
this.getGoodsDetail(goodsId).then(res => { |
|
|
|
|
const sku = res.skuList[0] |
|
|
|
|
item.goods_price = sku.goods_price |
|
|
|
|
item.cost_price = sku.cost_price |
|
|
|
|
item.stock_num = sku.stock_num |
|
|
|
|
item.goods_weight = sku.goods_weight |
|
|
|
|
item.goods_sku_no = sku.goods_sku_no |
|
|
|
|
item.goods_name = res.goods_name |
|
|
|
|
item.goods_id = res.goods_id |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 获取商品详情 |
|
|
|
|
getGoodsDetail (goodsId = null) { |
|
|
|
|
if (!goodsId) return false |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
GoodsApi.detail({ goodsId }) |
|
|
|
|
.then(result => { |
|
|
|
|
resolve(result.data.goodsInfo) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
|
<style lang="less" scoped> |
|
|
|
|
// 商品多规格 |
|
|
|
|