index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <div class="mianBox" v-if="state">
  3. <van-row class="contentBox">
  4. <van-row @tap="amount()" class="amount">
  5. <image :src="require('../img/recharge.png')" class="amount_img" mode="widthFix" />
  6. <van-col :span="24" class="amount_txt1 amount_txt">充值</van-col>
  7. <!-- <van-col :span="24" class="amount_txt2 amount_txt">对余额进行充值</van-col> -->
  8. </van-row>
  9. <van-toast id="van-toast" />
  10. </van-row>
  11. </div>
  12. </template>
  13. <script>
  14. import Toast from '../../wxcomponents/vant/weapp/dist/toast/toast';
  15. export default {
  16. data() {
  17. return {
  18. state:false,
  19. data:{}
  20. }
  21. },
  22. onLoad(options) {
  23. // 对接app测试代码(yingli)
  24. // let userId ='0001T110000000002HBL'
  25. // var a = {
  26. // money:0.1,
  27. // channelId:null,
  28. // userId:'0001T110000000002HBL',
  29. // scene:3,
  30. // openid:null
  31. // }
  32. // var options = {}
  33. // options = a
  34. if(JSON.stringify(options) !="{}"){
  35. //app或扫码进入
  36. //console.log("app进入")
  37. options = JSON.stringify(options)
  38. const data = JSON.parse(options)
  39. if(data){
  40. this.data={
  41. money:data.money,
  42. channelId:data.channelId,
  43. userId:data.userId,
  44. scene:data.scene,
  45. openid:null,
  46. }
  47. uni.redirectTo({
  48. url: `../order/index?params=${JSON.stringify(data)}`
  49. });
  50. }
  51. }else{
  52. this.state = true
  53. //微信小程序历史记录进入
  54. //console.log("微信小程序历史记录进入")
  55. this.data={
  56. money:null,
  57. channelId:null,
  58. userId:null,
  59. scene:2
  60. }
  61. }
  62. },
  63. methods: {
  64. amount(){
  65. let parmas = {
  66. money:this.data.money,
  67. channelId:this.data.channelId,
  68. userId:this.data.userId,
  69. scene:this.data.scene
  70. }
  71. if(this.data.money){
  72. //console.log("app或扫码进入 -->授权页")
  73. uni.navigateTo({
  74. url: `../login/index?params=${JSON.stringify(parmas)}`
  75. });
  76. }else{
  77. //console.log("微信小程序历史记录进入 -->就选择充值金额页")
  78. uni.navigateTo({
  79. url: `../amount/index?params=${JSON.stringify(parmas)}`
  80. });
  81. }
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss" scoped>
  87. .mianBox{
  88. height: 100%;
  89. width: 100%;
  90. color: #000;
  91. padding-top: 20px;
  92. box-sizing: border-box;
  93. .contentBox{
  94. width: 100%;
  95. height: auto;
  96. padding: 15px 20px;
  97. box-sizing: border-box;
  98. overflow: hidden;
  99. .amount{
  100. position: absolute;
  101. width: 100%;
  102. padding: 15px 20px;
  103. box-sizing: border-box;
  104. image{
  105. width:100%;
  106. height:auto
  107. }
  108. .amount_txt{
  109. margin-top:30px;
  110. position: absolute;
  111. left:26%;
  112. color:#fff;
  113. }
  114. }
  115. }
  116. }
  117. </style>