|
@@ -14,7 +14,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="balance-amount" v-if="userInfo && userInfo.walletEnabled">
|
|
<div class="balance-amount" v-if="userInfo && userInfo.walletEnabled">
|
|
|
- <div class="label" v-if="$store.state.review">绿洲石余额</div>
|
|
|
|
|
|
|
+ <div class="label" v-if="$store.state.review">绿魔币余额</div>
|
|
|
<div class="label" v-else>账户余额(元)</div>
|
|
<div class="label" v-else>账户余额(元)</div>
|
|
|
<div class="value">
|
|
<div class="value">
|
|
|
<span class="number"> {{ Number(userBalance.balance || 0).toFixed(2) }}</span>
|
|
<span class="number"> {{ Number(userBalance.balance || 0).toFixed(2) }}</span>
|
|
@@ -25,7 +25,10 @@
|
|
|
>
|
|
>
|
|
|
提现
|
|
提现
|
|
|
</button>
|
|
</button>
|
|
|
- <button class="btn-recharge" @click="showRechargeDialog = true" v-if="enableRecharge">充值</button>
|
|
|
|
|
|
|
+ <button class="btn-recharge" @click="showIapRechargeDialog = true" v-if="enableRecharge && iosReview">
|
|
|
|
|
+ 充值
|
|
|
|
|
+ </button>
|
|
|
|
|
+ <button class="btn-recharge" @click="showRechargeDialog = true" v-else-if="enableRecharge">充值</button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="cell-group" v-if="!$store.state.review">
|
|
<div class="cell-group" v-if="!$store.state.review">
|
|
@@ -140,12 +143,56 @@
|
|
|
</van-button>
|
|
</van-button>
|
|
|
</div>
|
|
</div>
|
|
|
</van-action-sheet>
|
|
</van-action-sheet>
|
|
|
|
|
+
|
|
|
|
|
+ <van-action-sheet v-model:show="showIapRechargeDialog" :closeable="false" class="recharge-dialog">
|
|
|
|
|
+ <div class="title">
|
|
|
|
|
+ <div class="text">充值</div>
|
|
|
|
|
+ <div class="close" @click="showIapRechargeDialog = false">
|
|
|
|
|
+ <img src="@assets/icon_dialog_close.png" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="content">
|
|
|
|
|
+ <div class="iap-row">
|
|
|
|
|
+ <div class="iap-item" :class="{ active: iapId === '68' }" @click="iapId = '68'">
|
|
|
|
|
+ <div class="name">68绿魔币</div>
|
|
|
|
|
+ <div class="price">¥68</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="iap-item" :class="{ active: iapId === '108' }" @click="iapId = '108'">
|
|
|
|
|
+ <div class="name">108绿魔币</div>
|
|
|
|
|
+ <div class="price">¥108</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="iap-item" :class="{ active: iapId === '198' }" @click="iapId = '198'">
|
|
|
|
|
+ <div class="name">198绿魔币</div>
|
|
|
|
|
+ <div class="price">¥198</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="iap-row">
|
|
|
|
|
+ <div class="iap-item" :class="{ active: iapId === '288' }" @click="iapId = '288'">
|
|
|
|
|
+ <div class="name">288绿魔币</div>
|
|
|
|
|
+ <div class="price">¥288</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="iap-item" :class="{ active: iapId === '588' }" @click="iapId = '588'">
|
|
|
|
|
+ <div class="name">588绿魔币</div>
|
|
|
|
|
+ <div class="price">¥588</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="iap-item" :class="{ active: iapId === '988' }" @click="iapId = '988'">
|
|
|
|
|
+ <div class="name">998绿魔币</div>
|
|
|
|
|
+ <div class="price">¥998</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="btn-wrapper">
|
|
|
|
|
+ <van-button type="primary" :color="$colors.prim" round block class="btn-recharge" @click="iapRecharge">
|
|
|
|
|
+ 确认
|
|
|
|
|
+ </van-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </van-action-sheet>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
|
import PayMethodPick from '@/components/PayMethodPick';
|
|
import PayMethodPick from '@/components/PayMethodPick';
|
|
|
import resolveUrl from 'resolve-url';
|
|
import resolveUrl from 'resolve-url';
|
|
|
-import { mapState } from 'vuex';
|
|
|
|
|
|
|
+import { mapGetters, mapState } from 'vuex';
|
|
|
export default {
|
|
export default {
|
|
|
components: { PayMethodPick },
|
|
components: { PayMethodPick },
|
|
|
data() {
|
|
data() {
|
|
@@ -161,10 +208,13 @@ export default {
|
|
|
payMethod: null,
|
|
payMethod: null,
|
|
|
showWithdrawDialog: false,
|
|
showWithdrawDialog: false,
|
|
|
enableRecharge: false,
|
|
enableRecharge: false,
|
|
|
- enableWithdraw: false
|
|
|
|
|
|
|
+ enableWithdraw: false,
|
|
|
|
|
+ showIapRechargeDialog: false,
|
|
|
|
|
+ iapId: '68'
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
|
|
+ this.emitter.on('iapEvent', this.iapEvent);
|
|
|
this.$http
|
|
this.$http
|
|
|
.get('/sysConfig/get/min_recharge_amount,max_recharge_amount,enable_recharge,enable_withdraw')
|
|
.get('/sysConfig/get/min_recharge_amount,max_recharge_amount,enable_recharge,enable_withdraw')
|
|
|
.then(res => {
|
|
.then(res => {
|
|
@@ -176,8 +226,12 @@ export default {
|
|
|
this.$store.dispatch('getBankCard');
|
|
this.$store.dispatch('getBankCard');
|
|
|
this.getBalance();
|
|
this.getBalance();
|
|
|
},
|
|
},
|
|
|
|
|
+ beforeUnmount() {
|
|
|
|
|
+ this.emitter.off('iapEvent', this.iapEvent);
|
|
|
|
|
+ },
|
|
|
computed: {
|
|
computed: {
|
|
|
- ...mapState(['bankCard', 'userInfo'])
|
|
|
|
|
|
|
+ ...mapState(['bankCard', 'userInfo', 'review']),
|
|
|
|
|
+ ...mapGetters(['iosReview', 'androidReview'])
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
getBalance() {
|
|
getBalance() {
|
|
@@ -301,6 +355,44 @@ export default {
|
|
|
},
|
|
},
|
|
|
all() {
|
|
all() {
|
|
|
console.log('111');
|
|
console.log('111');
|
|
|
|
|
+ },
|
|
|
|
|
+ iapEvent(e) {
|
|
|
|
|
+ console.log(e);
|
|
|
|
|
+ switch (e.event) {
|
|
|
|
|
+ case 'initiated':
|
|
|
|
|
+ this.$toast.loading({
|
|
|
|
|
+ duration: 0,
|
|
|
|
|
+ forbidClick: true,
|
|
|
|
|
+ message: '加载中'
|
|
|
|
|
+ });
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'finished':
|
|
|
|
|
+ //this.$toast.clear();
|
|
|
|
|
+ this.$http
|
|
|
|
|
+ .post('/userBalance/iap', {
|
|
|
|
|
+ receiptData: e.product.transaction.appStoreReceipt
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(res => {
|
|
|
|
|
+ this.getBalance();
|
|
|
|
|
+ this.$toast.clear();
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(e => {
|
|
|
|
|
+ console.log(e);
|
|
|
|
|
+ this.$toast.clear();
|
|
|
|
|
+ });
|
|
|
|
|
+ console.log(e.product.transaction.appStoreReceipt);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'cancelled':
|
|
|
|
|
+ this.$toast.clear();
|
|
|
|
|
+ this.orderId = null;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ iapRecharge() {
|
|
|
|
|
+ if (window.store) {
|
|
|
|
|
+ window.store.order(this.iapId);
|
|
|
|
|
+ }
|
|
|
|
|
+ this.showIapRechargeDialog = false;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -769,6 +861,41 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ .iap-row {
|
|
|
|
|
+ .flex();
|
|
|
|
|
+ padding: 0 15px;
|
|
|
|
|
+ margin-top: 15px;
|
|
|
|
|
+ .iap-item {
|
|
|
|
|
+ flex-basis: 0;
|
|
|
|
|
+ flex-grow: 1;
|
|
|
|
|
+ height: 50px;
|
|
|
|
|
+ border-radius: 8px;
|
|
|
|
|
+ background-color: @bg3;
|
|
|
|
|
+ color: @text1;
|
|
|
|
|
+ .flex-col();
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ margin-left: 15px;
|
|
|
|
|
+ .name {
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ }
|
|
|
|
|
+ .price {
|
|
|
|
|
+ margin-top: 2px;
|
|
|
|
|
+ font-size: 13px;
|
|
|
|
|
+ color: @text3;
|
|
|
|
|
+ }
|
|
|
|
|
+ &:first-child {
|
|
|
|
|
+ margin-left: 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ &.active {
|
|
|
|
|
+ background: @prim;
|
|
|
|
|
+ color: white;
|
|
|
|
|
+ .price {
|
|
|
|
|
+ color: rgba(255, 255, 255, 0.5);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
::v-deep(.van-cell__title) {
|
|
::v-deep(.van-cell__title) {
|
|
|
font-weight: bold;
|
|
font-weight: bold;
|