| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <template>
- <view class="content">
- <u-cell-group>
- <u-cell-item icon="integral" title="我的金币" :value="userInfo.money" :arrow="false"></u-cell-item>
- <u-cell-item icon="integral" hover-class="cell-hover-class" title="特惠100金币" :value-style="{'color':'#FFCC00'}" value="¥0.01" :arrow="false" @click="pay(0.01)"></u-cell-item>
- <u-cell-item icon="integral" hover-class="cell-hover-class" title="10金币" :value-style="{'color':'#FFCC00'}" value="¥10" :arrow="false" @click="pay(10)">></u-cell-item>
- <u-cell-item icon="integral" hover-class="cell-hover-class" title="100金币" :value-style="{'color':'#FFCC00'}" value="¥100" :arrow="false" @click="pay(100)"></u-cell-item>
- <u-cell-item icon="integral" hover-class="cell-hover-class" title="200金币" :value-style="{'color':'#FFCC00'}" value="¥200" :arrow="false" @click="pay(200)"></u-cell-item>
- <u-cell-item icon="integral" hover-class="cell-hover-class" title="500金币" :value-style="{'color':'#FFCC00'}" value="¥500" :arrow="false" @click="pay(500)"></u-cell-item>
- </u-cell-group>
-
- </view>
- </template>
- <script>
- import { mapGetters } from 'vuex';
- export default {
- data() {
- return {
- pdfh5: null
- }
- },
- onLoad(option) {
- this.$api.refreshUserInfo()
-
- },
- computed: {...mapGetters(['userInfo'])},
- onShow(){
- },
- methods: {
- pay(money){
- if(uni.getSystemInfoSync().platform== 'ios'){
- uni.showModal({
- title: '提示',
- content: 'IOS用户前往公众号充值',
- showCancel: false
- });
- return
- }
- let that = this;
- let list = []
- list.push({goodsPrice:money,num:1})
- let order = {goodsList:list};
- this.$api.orderSmallCoin(order).then(
- res => {
- let objarr = res.data.data
- wx.requestPayment({
- timeStamp: objarr.timeStamp,
- nonceStr: objarr.nonceStr,
- package: objarr.package,
- signType: objarr.signType,
- paySign: objarr.sign,
- success (result) {
- uni.showModal({
- title: '提示',
- content: '支付成功',
- showCancel: false,
- success: function (resst) {
- if(resst.confirm){
- that.$api.refreshUserInfo()
- }
- }
- });
- },
- fail (err){
- uni.showModal({
- title: '提示',
- content: '支付失败',
- showCancel: false,
- success: function (resst) {
-
- }
- });
- }
- })
- },
- err => {
- console.log(err);
- }
- );
-
- }
-
- }
- }
- </script>
- <style scope>
- .cell-hover-class {
- opacity: 0.5;
- }
- * {
- padding: 0;
- margin: 0;
- }
- html,
- body,
- #app {
- width: 100%;
- height: 100%;
- }
- page{
- height: 100%;
-
- }
- </style>
|