<template>
|
<!--
|
作者:
|
时间:2025-11-18
|
描述:插件中心-VIP专区-设置-基础设置
|
-->
|
<div class="product-add mt30">
|
<!--form表单-->
|
<el-form size="small" ref="form" :model="form" label-width="200px">
|
<el-form-item label="是否开启VIP专区功能">
|
<div>
|
<el-radio v-model="form.is_open" label="1">开启</el-radio>
|
<el-radio v-model="form.is_open" label="0">关闭</el-radio>
|
</div>
|
</el-form-item>
|
<el-form-item label="是否开启级差奖">
|
<div>
|
<el-radio v-model="form.jcaward" label="1">开启</el-radio>
|
<el-radio v-model="form.jcaward" label="0">关闭</el-radio>
|
</div>
|
</el-form-item>
|
<el-form-item label="是否开启平级奖">
|
<div>
|
<el-radio v-model="form.pjaward" label="1">开启</el-radio>
|
<el-radio v-model="form.pjaward" label="0">关闭</el-radio>
|
</div>
|
</el-form-item>
|
<el-form-item label="平级奖励层级" v-if="form.pjaward==1">
|
<div>
|
<el-input v-model="form.pjaward_level" type="number" class="max-w460"></el-input>
|
<div class="tips">默认1级,即只往上找一个平级</div>
|
</div>
|
</el-form-item>
|
<el-form-item label="成为VIP需要购买的商品">
|
<div>
|
<el-row>
|
<el-button type="primary" @click="openProduct">选择商品</el-button>
|
<div v-if="form.product_image && form.product_image.length > 0" class="setting-product d-s-c f-w">
|
<div v-for="(item, index) in form.product_image" :key="index" class="img pr">
|
<a href="javascript:void(0)" class="delete-btn" @click="deleteFunc(index)"><i class="el-icon-error"></i></a>
|
<img :src="item.image" width="100" height="100" />
|
<p class="text-ellipsis">{{ item.product_name }}</p>
|
</div>
|
</div>
|
</el-row>
|
<div class="tips">用户购买指定商品后,即可成为VIP用户</div>
|
</div>
|
</el-form-item>
|
<el-form-item label="直推多少用户享受平台佣金" name="second">
|
<el-input v-model="form.referee_buy_count" type="number" class="max-w460">
|
<template slot="append">人</template>
|
</el-input>
|
<div class="tips">用户直推指定数量的用户后,即可享受平台佣金</div>
|
</el-form-item>
|
|
<el-form-item label="见点奖条件" name="second">
|
<label>推荐VIP会员人数</label>
|
<el-input v-model="form.viewpoint_buy_count" type="number" class="max-w460">
|
<template slot="append">人</template>
|
</el-input>
|
<label>每月复购专区消费</label>
|
<el-input v-model="form.repurchase_consumption" type="number" class="max-w460">
|
<template slot="append">元</template>
|
</el-input>
|
<div class="tips">用户满足条件后,即可享受见点奖</div>
|
</el-form-item>
|
<!--提交-->
|
<div class="common-button-wrapper">
|
<el-button size="small" type="primary" @click="onSubmit" :loading="loading">提交</el-button>
|
</div>
|
</el-form>
|
<!--产品列表弹出层组件-->
|
<Product :isproduct="isproduct" @closeDialog="closeDialogFunc($event)">产品列表弹出层</Product>
|
</div>
|
</template>
|
|
<script>
|
import PlusApi from '@/api/plus/vip.js';
|
import Product from '@/components/product/Product';
|
|
export default {
|
components: {
|
/*产品列表组件*/
|
Product: Product
|
},
|
data() {
|
return {
|
/*form表单数据*/
|
form: {
|
is_open: '0',
|
become__buy_product_ids: [],
|
referee_buy_count: '0',
|
product_image: [],
|
jcaward: '0',
|
pjaward: '0',
|
pjaward_level: '1'
|
},
|
/*是否打开产品弹出层*/
|
isproduct: false,
|
/*是否正在加载*/
|
loading: false
|
};
|
},
|
props: {
|
settingData: Object
|
},
|
created() {
|
this.form = this.settingData.data.basic.values;
|
console.log(this.form)
|
},
|
methods: {
|
/*提交表单*/
|
onSubmit() {
|
let self = this;
|
if (this.form.become__buy_product_ids.length == 0) {
|
this.$message({
|
message: '请选择商品',
|
type: 'warning'
|
});
|
return;
|
}
|
self.loading = true;
|
let params = this.form;
|
PlusApi.basic(params, true)
|
.then(data => {
|
self.loading = false;
|
self.$message({
|
message: '恭喜你,设置成功',
|
type: 'success'
|
});
|
})
|
.catch(error => {
|
self.loading = false;
|
});
|
},
|
|
/*删除商品*/
|
deleteFunc(i) {
|
this.form.become__buy_product_ids.splice(i, 1);
|
this.form.product_image.splice(i, 1);
|
},
|
|
/*产品列表弹出层*/
|
openProduct() {
|
this.isproduct = true;
|
},
|
|
/*关闭弹窗*/
|
closeDialogFunc(e) {
|
this.isproduct = e.openDialog;
|
if (e.type == 'success') {
|
if (this.form.become__buy_product_ids.indexOf(e.params.product_id) == -1) {
|
this.form.become__buy_product_ids.push(e.params.product_id);
|
this.form.product_image.push({ product_id: e.params.product_id, image: e.params.image, product_name: e.params.product_name });
|
} else {
|
this.$message({
|
message: '已选择该商品',
|
type: 'warning'
|
});
|
}
|
}
|
}
|
}
|
};
|
</script>
|
|
<style>
|
.tips {
|
color: #ccc;
|
}
|
|
.setting-product .img {
|
width: 100px;
|
margin-top: 10px;
|
height: 130px;
|
margin-right: 10px;
|
}
|
|
.setting-product .img img {
|
border: 1px solid #eeeeee;
|
}
|
|
.delete-btn {
|
position: absolute;
|
display: block;
|
width: 20px;
|
height: 20px;
|
line-height: 20px;
|
right: -8px;
|
top: -8px;
|
color: red;
|
}
|
</style>
|