123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306 |
- <template>
- <view>
- <view class="lz-modal lz-modal-show">
- <view class="lz-modal-dialog">
- <view class="lz-list">
- <view class="lz-list-header" style="display: flex;flex-direction: row;">
- <view>温馨提示</view>
- <view class="iconfont icon-cuo1" @tap="hideAuthVip()"></view>
- </view>
- <view class="lz-list-body">
- <view class="lz-list-item lz-list-item-middle">
- <view class="lz-list-line">
- <view class="ktvip">
- <image src="../static/img/zs.png" mode="" class="ktvip-img"></image>
- <view class="ktvip-flex"><text>请激活VIP</text>(当前科目:{{subject.subject_name}})</view>
- <view class="ktvip-flex">价格:{{subject.price}}</view>
- </view>
-
- <view class="ktvip-b">
-
- <button @tap="$openrul('/pages/my/about?id=1')">联系客服</button>
-
-
- <button open-type="contact">联系客服</button>
-
-
- <button @tap="gobuy" class="ktvip-b-r" v-if="auth != 1">立即购买</button>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="lz-margin--b-md"></view>
- </view>
- </view>
- </view>
- </template>
- <script>
-
- import weichatObj from '@/plugin/jweixin-module/index.js';
-
- import {
- mapState
- } from 'vuex';
- export default {
- name: "auth-vip",
- data() {
- return {
-
- auth: 0,
-
-
- auth: 1,
-
- vipnum: '',
- mode: '',
- }
- },
- computed: {
- ...mapState(['subject', 'userinfo', 'subjectVip']),
- },
- mounted() {
- this.mode = this.$myConfig.mode
-
- this.getSh()
-
- },
- methods: {
- async getSh() {
- let res = await this.$myHttp.get({
- url: this.$myHttp.urlMap.sh,
- data: {},
- needLogin: false,
- })
- if (res.code == 1) {
-
- console.log(res)
- this.auth = res.data.auth
- }
- },
- hideAuthVip() {
- this.$emit('hideAuthVip', false)
- },
- async authVip() {
- let res = await this.$myHttp.post({
- url: this.$myHttp.urlMap.exchangesubject,
- data: {
- code: this.vipnum,
- subject_id: this.subject.id
- },
- needLogin: true
- })
- if (res.code == 1) {
- uni.showToast({
- title: '激活成功',
- icon: 'none',
- duration: 1000
- })
- this.$myUserLogin.getSubvip(this.subject.id)
- this.hideAuthVip()
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none',
- duration: 1000
- })
- }
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- async gobuy() {
- console.log(this.subject)
- let that = this
- var pages = getCurrentPages()
- let currentRoute = pages[pages.length - 1].route;
- let qdata = {
- returnurl: currentRoute,
- pay_type: 'wechat',
- subject_id: this.subject.id,
-
- user_type: 'mini'
-
-
- user_type: 'mp'
-
- }
- let res = await this.$myHttp.post({
- url: this.$myHttp.urlMap.buyJhm,
- data: qdata,
- needLogin: true
- })
- console.log(res)
- if (res.code == 1) {
- let da = res.data
-
- uni.requestPayment({
- provider: 'wxpay',
- timeStamp: da.timeStamp,
- nonceStr: da.nonceStr,
- package: da.package,
- signType: da.signType,
- paySign: da.paySign,
- success: function(res) {
- console.log('success:' + JSON.stringify(res));
- uni.showToast({
- title: '激活成功',
- icon: 'none',
- duration: 1000
- })
- that.$myUserLogin.getSubvip(that.subject.id)
- that.hideAuthVip()
- },
- fail: function(err) {
- console.log('fail:' + JSON.stringify(err));
- }
- });
-
-
-
- WeixinJSBridge.invoke(
- 'getBrandWCPayRequest', {
- "appId": da.appId,
- "timeStamp": da.timeStamp,
- "nonceStr": da.nonceStr,
- "package": da.package,
- "signType": da.signType,
- "paySign": da.paySign
- },
- function(res) {
- if (res.err_msg == "get_brand_wcpay_request:ok") {
-
-
- uni.showToast({
- title: '激活成功',
- icon: 'none',
- duration: 1000
- })
- that.$myUserLogin.getSubvip(that.subject.id)
- that.hideAuthVip()
- }
- });
-
-
-
-
-
-
-
-
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none',
- duration: 1000
- })
- }
- }
- }
- }
- </script>
- <style>
- .ktvip {
- color: #848484;
- font-size: 15px;
- }
- .ktvip-flex {
- width: 84%;
- margin: 0px auto;
- }
- .ktvip-flex text {
- color: #000;
- font-weight: bold;
- }
- .ktvip-img {
- width: 68px;
- height: 68px;
- margin-bottom: 3px;
- }
- .ktvip-b {
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 14px;
- margin: 14px 0;
- }
- .ktvip-b button {
- font-size: 14px;
- margin: 0 8px;
- border: solid 1px #ebebeb;
- }
- .ktvip-b-r {
- font-size: 14px;
- background: #3c7bfc;
- border: solid 1px #3c7bfc !important;
- color: #fff;
- }
- .ktvip-b-r button::after,
- .ktvip-b button::after {
- border: none;
- }
- .index-bm-title {
- width: 86%;
- margin: 12px auto 10px;
- }
- .index-bm-content {
- margin-top: 10px;
- }
- .index-bm-flex {
- display: flex;
- font-size: 15px;
- align-items: center;
- margin-bottom: 8px;
- }
- .index-bm-title input {
- border-radius: 5px;
- border: none;
- padding: 10px;
- flex: 1;
- font-size: 15px;
- color: #000;
- text-align: left;
- border: 1px #eee solid;
- }
- </style>
|