|
|
@@ -1,7 +1,27 @@
|
|
|
<template>
|
|
|
<el-main>
|
|
|
<el-row class="movie-list">
|
|
|
- <el-col :md="8" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
+ <el-col :md="6">
|
|
|
+ <el-card class="box-card">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span>我的小会员</span>
|
|
|
+ </div>
|
|
|
+ <div v-if="myVip !== null" class="text item">
|
|
|
+ <el-row v-if="!myVip.isVip">
|
|
|
+ 您当前还不是小会员, <el-button type="text" @click="showPlanDialog">成为小会员</el-button>
|
|
|
+ </el-row>
|
|
|
+ <el-row v-else>
|
|
|
+ <el-row v-if="myVip.expired">
|
|
|
+ 您的小会员已过期, <el-button type="text" @click="showPlanDialog">续费小会员</el-button>
|
|
|
+ </el-row>
|
|
|
+ <el-row v-else>
|
|
|
+ 您的小会员还有 <span style="color: red">{{ myVip.expireIn }}</span> 天到期, <el-button type="text" @click="showPlanDialog">续费小会员</el-button>
|
|
|
+ </el-row>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ <el-col :md="6" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
<el-card class="box-card">
|
|
|
<div slot="header" class="clearfix">
|
|
|
<span>我的钱包</span>
|
|
|
@@ -15,7 +35,7 @@
|
|
|
</div>
|
|
|
</el-card>
|
|
|
</el-col>
|
|
|
- <el-col :md="16" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
+ <el-col :md="12" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
<el-card class="box-card">
|
|
|
<div slot="header" class="clearfix">
|
|
|
<span>我的账单</span>
|
|
|
@@ -116,11 +136,36 @@
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ title="小会员计划"
|
|
|
+ append-to-body
|
|
|
+ :visible.sync="planDialog"
|
|
|
+ width="50%"
|
|
|
+ center
|
|
|
+ >
|
|
|
+ <el-form ref="form" :model="planForm">
|
|
|
+ <el-form-item>
|
|
|
+ <el-radio-group v-for="(item, index) in vipPlans" :key="index" v-model="planForm.planId">
|
|
|
+ <el-radio style="margin-right: 5px" :label="item.planId" border>
|
|
|
+ {{ item.name }} (<span style="color: red">¥{{ item.price }}</span> 元)
|
|
|
+ </el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="buy"
|
|
|
+ >购买</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-dialog>
|
|
|
</el-main>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { chargeWallet, getWallet, getWalletBill } from '@/api/mall'
|
|
|
+import { getMyVip, getVipPlans, vip } from '@/api/account'
|
|
|
|
|
|
export default {
|
|
|
name: 'MyWallet',
|
|
|
@@ -144,7 +189,15 @@ export default {
|
|
|
},
|
|
|
wallet: {
|
|
|
balance: '0.00'
|
|
|
- }
|
|
|
+ },
|
|
|
+ // 小会员
|
|
|
+ planDialog: false,
|
|
|
+ vipPlans: [],
|
|
|
+ planForm: {
|
|
|
+ planId: null,
|
|
|
+ quantity: null
|
|
|
+ },
|
|
|
+ myVip: null
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
@@ -155,6 +208,12 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+ getMyVip().then(resp => {
|
|
|
+ if (resp.code === 0) {
|
|
|
+ this.myVip = resp.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
this.getBillRecord()
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -209,6 +268,31 @@ export default {
|
|
|
},
|
|
|
handleDetail(index, row) {
|
|
|
this.$message.info('账单详情')
|
|
|
+ },
|
|
|
+ showPlanDialog() {
|
|
|
+ this.planDialog = true
|
|
|
+ getVipPlans().then(resp => {
|
|
|
+ if (resp.code === 0) {
|
|
|
+ this.vipPlans = resp.data
|
|
|
+ console.log(this.vipPlans)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ buy() {
|
|
|
+ this.planDialog = false
|
|
|
+ vip(this.planForm).then(resp => {
|
|
|
+ if (resp.code === 0) {
|
|
|
+ this.$notify.info({
|
|
|
+ message: '小会员已开通',
|
|
|
+ duration: 3000
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$notify.error({
|
|
|
+ message: resp.msg,
|
|
|
+ duration: 3000
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|