feat: 虚拟商品

fix-0609-xwk
向文可 3 years ago
parent 24ba936ab2
commit 57e44a6d6a

@ -112,6 +112,18 @@ const actions = {
if (data.limit === 0) { if (data.limit === 0) {
delete data.singleBuyLimit; delete data.singleBuyLimit;
} }
data.virtualProductModifyDTOList = [
...data.fileList.map((item) => {
return {
shipType: 1,
shipContent: item,
};
}),
{
shipType: 2,
shipContent: data.autoSend,
},
];
let res = await save(data); let res = await save(data);
if (res) { if (res) {
ElMessage.success('保存成功'); ElMessage.success('保存成功');

@ -17,7 +17,7 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="商品类型" prop="productType"> <el-form-item label="商品类型" prop="productType">
<el-radio-group v-model="form.productType" :opts="opts.type" /> <el-radio-group v-model="form.productType" :disabled="!!form.id" :opts="opts.type" />
</el-form-item> </el-form-item>
<el-form-item label="商品名称" prop="name"> <el-form-item label="商品名称" prop="name">
<el-input v-model="form.name" maxlength="50" /> <el-input v-model="form.name" maxlength="50" />
@ -36,12 +36,7 @@
<el-radio-group v-model="form.postage" :opts="opts.postage" /> <el-radio-group v-model="form.postage" :opts="opts.postage" />
<el-input-number v-show="form.postage === 0" v-model="form.remoteAreaPostage" :min="0" /> <el-input-number v-show="form.postage === 0" v-model="form.remoteAreaPostage" :min="0" />
</el-form-item> </el-form-item>
<el-form-item <el-form-item v-if="form.productType === 2" label="自动发货内容" prop="virtualProductModifyDTOList">
v-if="form.productType === 2"
label="自动发货内容"
prop="virtualProductModifyDTOList"
required="true"
>
<el-upload-file <el-upload-file
v-model="form.fileList" v-model="form.fileList"
config-id="product" config-id="product"
@ -132,6 +127,10 @@
if (id && id !== state.form.id) { if (id && id !== state.form.id) {
let res = await store.dispatch('product/detail', id); let res = await store.dispatch('product/detail', id);
res.pictureList = res.pictureList || [res.mainPicture]; res.pictureList = res.pictureList || [res.mainPicture];
res.fileList = res.virtualProductVOList
?.filter((item) => item.shipType === 1)
.map((item) => item.shipContent);
res.autoSend = res.virtualProductVOList?.find((item) => item.shipType === 2)?.shipContent;
Object.assign(state.form, res); Object.assign(state.form, res);
} }
}; };

@ -1,7 +1,7 @@
<template> <template>
<div v-loading="loading" class="step-container"> <div v-loading="loading" class="step-container">
<el-scrollbar class="step-content"> <el-scrollbar class="step-content">
<el-form> <el-form v-if="form.productType === 1">
<el-form-item label="属性规格"> <el-form-item label="属性规格">
<el-input v-model="skuName" placeholder="如:尺寸、颜色等" style="width: 200px"> <el-input v-model="skuName" placeholder="如:尺寸、颜色等" style="width: 200px">
<template #append> <template #append>
@ -64,16 +64,14 @@
</el-table-column> </el-table-column>
<el-table-column align="center" header-align="center" label="增减库存" prop="stockChange" width="160px"> <el-table-column align="center" header-align="center" label="增减库存" prop="stockChange" width="160px">
<template #default="{ row }"> <template #default="{ row }">
<el-input-number v-model="row.stockChange" @change="handleStockChange(row)" /> <el-input-number v-if="row.id" v-model="row.stockChange" @change="handleStockChange(row)" />
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="改后库存" prop="stockAfter" width="160px">
<template #default="{ row }">
{{ row.id ? stockAfter : row.stock }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
align="center"
header-align="center"
label="改后库存"
prop="stockAfter"
width="160px"
/>
<el-table-column <el-table-column
align="center" align="center"
header-align="center" header-align="center"

@ -24,8 +24,9 @@ export default (configEnv) => {
// target: 'http://192.168.10.5:4500', // 高玉 // target: 'http://192.168.10.5:4500', // 高玉
// target: 'http://192.168.10.67:8090', // 罗战 // target: 'http://192.168.10.67:8090', // 罗战
// target: 'http://192.168.10.93:8090', // 周渺 // target: 'http://192.168.10.93:8090', // 周渺
target: 'http://192.168.10.124:8090', // 舒梦娇
// target: 'https://k8s-horse-gateway.mashibing.cn/', // 测试地址 // target: 'https://k8s-horse-gateway.mashibing.cn/', // 测试地址
target: 'https://you-gateway.mashibing.com', // 生产环境 // target: 'https://you-gateway.mashibing.com', // 生产环境
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''), rewrite: (path) => path.replace(/^\/api/, ''),
}, },

Loading…
Cancel
Save