This commit is contained in:
2025-09-11 17:43:46 +08:00
parent 699df9534d
commit c9b171d3af
6 changed files with 1953 additions and 2 deletions

View File

@@ -0,0 +1,292 @@
<template>
<el-dialog
width="80%"
title="开通VIP"
:close-on-click-modal="false"
:visible.sync="visible"
@close="handlereset"
>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="120px"
>
<div style="overflow: hidden;">
<el-form-item
style="width: 50%;float: left;"
label="手机号/邮箱:"
prop="userKey"
class="form_item"
>
<div style="display: flex;align-items: center;">
<el-autocomplete
size="small"
style="width: 100%;"
v-model="dataForm.userKey"
:fetch-suggestions="loadAll"
placeholder="请输入手机号/邮箱"
@select="handleSelect"
>
<template #default="{ item }">
<div class="custom-item">
<span>{{ item.tel ? item.tel : item.email }}</span>
<span style="color: gray; margin-left: 10px;" v-if="item.name"
>({{ item.name }})</span
>
</div>
</template>
</el-autocomplete>
</div>
</el-form-item>
<el-form-item
label="账户余额"
v-if="dataForm.userKey"
style="width: 50%;float: left;"
>
天医币&nbsp<em
style="font-style: normal; font-size: 16px; color: #17B3A3;"
>{{ dataForm.peanutCoin }}</em
>
&nbsp &nbsp积分&nbsp<em
style="font-style: normal; font-size: 16px; color: #17B3A3;"
>{{ dataForm.jf }}</em
>
</el-form-item>
</div>
<el-form-item label="VIP类型" prop="type" class="type_block">
<el-radio-group v-model="dataForm.type" size="mini">
<el-radio
style="margin-right: 10px;"
v-for="(option, index) in typeList"
:key="index"
:label="option.value"
>
{{ option.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="VIP年限" prop="year" class="year_block">
<el-radio-group v-model="dataForm.year" size="mini">
<el-radio
v-for="(option, index) in yearList"
:key="index"
:label="option.value"
>
{{ option.label }}
</el-radio>
</el-radio-group>
<span class="qita"
>其他<el-input v-model="dataForm.day"></el-input>&nbsp&nbsp天</span
>
</el-form-item>
<el-form-item label="预计费用" class="price_block">
<span style=" color: #f56c6c;">{{ dataForm.price }}</span>
</el-form-item>
<el-form-item label="抵扣天医币" class="coin_block">
<div> <el-input
style="width: 300px;"
v-model="dataForm.value"
placeholder="请输入需要抵扣的天医币"
>
</el-input></div>
</el-form-item>
<el-form-item label="抵扣积分" class="coin_block">
<div> <el-input
style="width: 300px;"
v-model="dataForm.value"
placeholder="请输入需要抵扣的天医币"
>
</el-input></div>
</el-form-item>
<el-form-item label="开通说明">
<el-input
type="textarea"
rows="5"
v-model="dataForm.remark"
placeholder="开通说明"
>
</el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="handlereset">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
import global from "../../common/common.vue"; //引入共用组间
export default {
data() {
return {
baseUrl: global.baseUrl,
visible: false,
dataForm: {
id: 0,
name: "",
tel: "",
email: "",
peanutCoin: "",
type: "", //vip类型
year: "",
day: "",
remark: "",
price: "0"
},
peanutCoin: 0, //天医币和积分总和判断是否为0
dataRule: {
type: [
{
required: true,
message: "类型不能为空",
trigger: "blur"
}
],
year: [
{
required: true,
message: "年限不能为空",
trigger: "blur"
}
]
},
typeList: [
{ value: "1", label: "医学超v" },
{ value: "4", label: "中医学" },
{ value: "9", label: "中西汇通学" },
{ value: "5", label: "针灸学" },
{ value: "6", label: "肿瘤学" },
{ value: "2", label: "国学与心理学超v" },
{ value: "7", label: "国学" },
{ value: "8", label: "心理学" }
],
yearList: [
{ value: "1", label: "1年" },
{ value: "3", label: "3年" },
{ value: "4", label: "4年" }
]
};
},
methods: {
init(data) {
this.visible = true;
this.dataForm.userKey = data.tel || data.email;
this.dataForm.userId = data.id;
this.dataForm.name = data.name;
this.dataForm.tel = data.tel;
this.dataForm.email = data.email;
this.dataForm.peanutCoin = data.peanutCoin;
this.dataForm.jf = data.jf;
},
handleSelect(data) {
console.log("data at line 161:", data);
this.dataForm.userKey = data.tel || data.email;
this.dataForm.userId = data.id;
this.dataForm.name = data.name;
this.dataForm.tel = data.tel;
this.dataForm.email = data.email;
this.dataForm.peanutCoin = data.peanutCoin;
this.dataForm.jf = data.jf;
},
loadAll(queryString, cb) {
this.dataForm.userId = "";
this.dataForm.userName = "";
if (queryString == "") {
return false;
}
this.$http({
// url: this.$http.adornUrl('/book/user/list'),
url: this.$http.adornUrl("/book/user/getUserList"),
method: "post",
data: this.$http.adornData({
page: 1,
limit: 9999,
key: queryString
})
}).then(({ data }) => {
if (data && data.code === 0) {
var arr = data.user.records;
console.log("arr at line 467:", arr);
cb(arr);
} else {
cb([]);
}
});
},
//表单提交
dataFormSubmit() {},
//取消
handlereset() {
this.visible = false;
}
}
};
</script>
<style lang="less" scoped>
.year_block {
/deep/.el-form-item__content {
display: flex;
align-items: center;
}
/deep/.el-radio {
margin-left: 0;
margin-right: 0;
}
/deep/.el-radio__label {
padding-left: 3px;
padding-right: 30px;
}
.qita {
display: flex;
align-items: center;
font-size: 12px;
/deep/.el-input {
width: 60px;
.el-input__inner {
height: 30px;
line-height: 30px;
}
}
}
}
.price_block {
/deep/.el-form-item__content {
display: flex;
align-items: center;
}
/deep/.el-checkbox-group {
margin-left: 30px;
}
/deep/.el-checkbox {
padding-top: 5px;
margin-left: 20px;
margin-right: 10px;
}
/deep/.el-input {
width: 130px;
}
}
.type_block {
/deep/.el-radio {
margin-left: 0;
margin-right: 0;
}
/deep/.el-radio__label {
padding-left: 3px;
padding-right: 25px;
}
}
</style>