rechargeIndex.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <view>
  3. <ujp-navbar title="帮人充值" :isBack="isBack" :customBack="customBack">
  4. </ujp-navbar>
  5. <view class="item1 item" @click="gotoUrl('pages/user/rechargeSubmit')">
  6. <img src="@/assets/img/byphone/iconPark-copy-link.svg">
  7. 发卡
  8. </view>
  9. <view class="item2 item" @click="gotoUrl('pages/user/rechargeByPhone')" >
  10. <img src="@/assets/img/byphone/iconPark-wallet.svg">
  11. 充值
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import * as Pay from '@/apis/weixin.js'
  17. import {
  18. checkPhone
  19. } from '@/utils'
  20. import {
  21. wxPayJs
  22. } from '@/utils/wxpay'
  23. import * as API from '@/apis/index.js'
  24. export default {
  25. data() {
  26. return {
  27. isReady:false,
  28. customStyle: {
  29. background: '#1677ff'
  30. },
  31. detail:{},
  32. isBack:false,
  33. chargingMarketingId:'',
  34. selectItem:{},
  35. list:[5,10,20,50,100,200],
  36. amount:5,
  37. phone:"",
  38. }
  39. },
  40. onLoad(op){
  41. if(op.site){
  42. this.isBack=true;
  43. }
  44. },
  45. onReady() {
  46. },
  47. methods: {
  48. customBack(){
  49. uni.reLaunch({
  50. url: '/pages/user/index'
  51. })
  52. },
  53. toRefundList() {
  54. uni.navigateTo({
  55. url: '/pages/user/rechargeListByPhone'
  56. })
  57. },
  58. submit(){
  59. var checkPhoneResult = checkPhone(this.phone);
  60. if ( checkPhoneResult !== true) {
  61. uni.showToast({
  62. title: checkPhoneResult,
  63. })
  64. return;
  65. }
  66. uni.showLoading({
  67. title: "加载中",
  68. mask: true,
  69. })
  70. Pay.wxJsapiPayByPhone({
  71. openId:this.carhelp.getOpenId(),
  72. phone:this.phone,
  73. amount:this.amount
  74. }).then((response) => {
  75. if(!response.result){
  76. uni.showToast({
  77. title: response.message
  78. })
  79. return
  80. }
  81. var data = response.data
  82. uni.hideLoading()
  83. console.log("Pay+"+new Date().getTime())
  84. wxPayJs(data);
  85. }).catch(error => {
  86. uni.showToast({
  87. title: error
  88. })
  89. })
  90. },
  91. },onShow(){
  92. if(this.isReady){
  93. }
  94. }
  95. }
  96. </script>
  97. <style>
  98. page{
  99. background-color: #f7f7f7;
  100. }
  101. </style>
  102. <style lang="scss" scoped>
  103. .item{
  104. margin: 32rpx;
  105. border-radius: 8px;
  106. font-size: 80rpx;
  107. color: rgba(255, 255, 255, 1);
  108. padding: 88rpx 0;
  109. display: flex;
  110. align-items: center;
  111. justify-content: center;
  112. img{
  113. width: 104rpx;
  114. height:104rpx;
  115. }
  116. }
  117. .item1{
  118. background: linear-gradient(180deg, rgba(31,85,255,1) 0%,rgba(39,171,255,1) 100%);
  119. }
  120. .item2{
  121. background: linear-gradient(-0.11deg, rgba(79,226,157,1) 0.3%,rgba(0,173,222,1) 101.1%);
  122. }
  123. </style>