修复:总平台商品编辑时 无法编辑星级推荐、商品推荐的问题

This commit is contained in:
wuhui_zzw 2024-04-09 15:55:35 +08:00
parent ca198a4c11
commit c810ab56ef
2 changed files with 45 additions and 24 deletions

View File

@ -929,18 +929,15 @@
</el-row> </el-row>
<!-- 营销设置--> <!-- 营销设置-->
<el-row v-if="currentTab == '4'"> <el-row v-if="currentTab == '4'">
<el-col :span="24">
<el-form-item label="星级推荐:">
<el-rate class="rate_star" v-model="formValidate.star" :colors="colors" style="margin-top: 4px;"></el-rate>
</el-form-item>
</el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="商品推荐:"> <el-form-item label="商品推荐:">
<el-checkbox-group <el-checkbox-group v-model="checkboxGroup" size="small" @change="onChangeGroup">
v-model="checkboxGroup" <el-checkbox v-for="(item, index) in recommend" :key="index" :label="item.value">
size="small"
@change="onChangeGroup"
>
<el-checkbox
v-for="(item, index) in recommend"
:key="index"
:label="item.value"
>
{{ item.name }} {{ item.name }}
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
@ -969,7 +966,6 @@
<span>为0或者空则使用商户默认设置实际支付的金额 * 倍数</span> <span>为0或者空则使用商户默认设置实际支付的金额 * 倍数</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="是否开启礼包:"> <el-form-item label="是否开启礼包:">
<el-radio-group v-model="formValidate.is_gift_bag" :disabled="$route.params.id ? true : false"> <el-radio-group v-model="formValidate.is_gift_bag" :disabled="$route.params.id ? true : false">
@ -1179,7 +1175,7 @@
<el-col v-bind="grid"> <el-col v-bind="grid">
<el-form-item label="排序:"> <el-form-item label="排序:">
<el-input-number <el-input-number
v-model="formValidate.sort" v-model="formValidate.rank"
controls-position="right" controls-position="right"
placeholder="请输入排序" placeholder="请输入排序"
/> />
@ -1439,9 +1435,13 @@ const defaultObj = {
is_batch: 0, // is_batch: 0, //
batch_num: 0, // batch_num: 0, //
batch_unit: '', // batch_unit: '', //
sort: 0, rank: 0,
once_max_count: 0, once_max_count: 0,
is_good: 0, is_good: 0,
is_benefit: 0,
is_hot: 0,
is_best: 0,
is_new: 0,
temp_id: '', temp_id: '',
video_link: '', video_link: '',
guarantee_template_id: '', guarantee_template_id: '',
@ -1492,6 +1492,9 @@ const defaultObj = {
// //
integral_deduction_type: 0, integral_deduction_type: 0,
integral_deduction_money: 0, integral_deduction_money: 0,
//
star: 1,
} }
const objTitle = { const objTitle = {
price: { price: {
@ -1519,7 +1522,13 @@ const objTitle = {
title: '体积(m³)' title: '体积(m³)'
} }
} }
const proOptions = [{name: '店铺推荐', value: 'is_good'}] const proOptions = [
{name: '店铺推荐', value: 'is_good'},
{name: '热门榜单', value: 'is_hot'},
{name: '促销单品', value: 'is_benefit'},
{name: '精品推荐', value: 'is_best'},
{name: '首发新品', value: 'is_new'}
]
export default { export default {
name: 'ProductProductAdd', name: 'ProductProductAdd',
components: { components: {
@ -1536,6 +1545,7 @@ export default {
data() { data() {
const url = SettingMer.https + '/upload/image/0/file?ueditor=1&token=' + getToken() const url = SettingMer.https + '/upload/image/0/file?ueditor=1&token=' + getToken()
return { return {
colors: ['#99A9BF', '#F7BA2A', '#FF9900'],
myConfig: { myConfig: {
autoHeightEnabled: false, // autoHeightEnabled: false, //
initialFrameHeight: 500, // initialFrameHeight: 500, //
@ -2133,9 +2143,11 @@ export default {
this.$store.dispatch('tagsView/updateVisitedView', route) this.$store.dispatch('tagsView/updateVisitedView', route)
}, },
onChangeGroup() { onChangeGroup() {
this.checkboxGroup.includes('is_good') this.checkboxGroup.includes('is_benefit') ? (this.formValidate.is_benefit = 1) : (this.formValidate.is_benefit = 0)
? (this.formValidate.is_good = 1) this.checkboxGroup.includes('is_hot') ? (this.formValidate.is_hot = 1) : (this.formValidate.is_hot = 0)
: (this.formValidate.is_good = 0) this.checkboxGroup.includes('is_best') ? (this.formValidate.is_best = 1) : (this.formValidate.is_best = 0)
this.checkboxGroup.includes('is_new') ? (this.formValidate.is_new = 1) : (this.formValidate.is_new = 0)
this.checkboxGroup.includes('is_good') ? (this.formValidate.is_good = 1) : (this.formValidate.is_good = 0)
}, },
watCh(val) { watCh(val) {
const tmp = {} const tmp = {}
@ -2699,10 +2711,15 @@ export default {
cate_id: info.cate_id, // id cate_id: info.cate_id, // id
mer_cate_id: info.mer_cate_id || [], // id mer_cate_id: info.mer_cate_id || [], // id
unit_name: info.unit_name, unit_name: info.unit_name,
sort: info.sort, rank: info.rank,
once_max_count: info.once_max_count || 1, once_max_count: info.once_max_count || 1,
once_min_count: info.once_min_count || 0, once_min_count: info.once_min_count || 0,
is_good: info.is_good, is_good: info.is_good || 0,
is_benefit: info.is_benefit || 0,
is_hot: info.is_hot || 0,
is_best: info.is_best || 0,
is_new: info.is_new || 0,
star: info.star || 1,
temp_id: info.temp_id, temp_id: info.temp_id,
guarantee_template_id: info.guarantee_template_id ? info.guarantee_template_id : "", guarantee_template_id: info.guarantee_template_id ? info.guarantee_template_id : "",
attr: info.attr, attr: info.attr,
@ -2764,9 +2781,13 @@ export default {
this.ManyAttrValue = info.attrValue; this.ManyAttrValue = info.attrValue;
this.generate(); this.generate();
} }
if (this.formValidate.is_good === 1) {
this.checkboxGroup.push("is_good"); if (this.formValidate.is_benefit === 1) this.checkboxGroup.push("is_benefit");
} if (this.formValidate.is_hot === 1) this.checkboxGroup.push("is_hot");
if (this.formValidate.is_best === 1) this.checkboxGroup.push("is_best");
if (this.formValidate.is_new === 1) this.checkboxGroup.push("is_new");
if (this.formValidate.is_good === 1) this.checkboxGroup.push("is_good");
this.getAttr(); this.getAttr();
this.fullscreenLoading = false; this.fullscreenLoading = false;
}, },

View File

@ -146,7 +146,7 @@
<el-table-column prop="stock" label="商品状态" min-width="90" align="center"> <el-table-column prop="stock" label="商品状态" min-width="90" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="switch-content" v-if="scope.row.mer_id <= 0"> <div class="switch-content" v-if="scope.row.mer_id <= 0">
<el-switch :value="Number(scope.row.us_status) == 1" active-text="上架" inactive-text="下架" @change="changeStatus(scope.row)" /> <el-switch :value="Number(scope.row.is_show) == 1" active-text="上架" inactive-text="下架" @change="changeStatus(scope.row)" />
</div> </div>
<span v-else>{{ scope.row.us_status | productStatusFilter }}</span> <span v-else>{{ scope.row.us_status | productStatusFilter }}</span>
</template> </template>
@ -451,7 +451,7 @@ export default {
// //
changeStatus(row){ changeStatus(row){
// //
let status = Number(row.us_status) == 1 ? 0 : 1; let status = Number(row.is_show) == 1 ? 0 : 1;
// //
changeProductStatus(row.product_id, status).then(({message}) => { changeProductStatus(row.product_id, status).then(({message}) => {
this.$message.success(message) this.$message.success(message)