index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. // var a = [];
  24. // console.log(Object.keys(a).length);
  25. // setTimeout(() =>{
  26. // if(JSON.stringify(options) == "{}"){
  27. // Toast("无参数传入")
  28. // }else{
  29. // options = JSON.stringify(options)
  30. // Toast(options)
  31. // }
  32. // })
  33. //Toast("该用户未暂未录入充值系统...")
  34. // let userId ='0001T110000000002HBL',
  35. // var a = {
  36. // money:0.01,
  37. // channelId:null,
  38. // userId:'0001T110000000002HBL',
  39. // scene:3,
  40. // openid:null
  41. // }
  42. // var options = {}
  43. // options = a
  44. // console.log(JSON.parse(stringify(options)))
  45. // console.log(options)
  46. if(JSON.stringify(options) !="{}"){
  47. //app或扫码进入
  48. //console.log("app进入")
  49. options = JSON.stringify(options)
  50. const data = JSON.parse(options)
  51. if(data){
  52. this.data={
  53. money:data.money,
  54. channelId:data.channelId,
  55. userId:data.userId,
  56. scene:data.scene,
  57. openid:null,
  58. }
  59. uni.redirectTo({
  60. url: `../order/index?params=${JSON.stringify(data)}`
  61. });
  62. }
  63. }else{
  64. this.state = true
  65. //微信小程序历史记录进入
  66. //console.log("微信小程序历史记录进入")
  67. this.data={
  68. money:null,
  69. channelId:null,
  70. userId:null,
  71. scene:2
  72. }
  73. }
  74. },
  75. methods: {
  76. amount(){
  77. let parmas = {
  78. money:this.data.money,
  79. channelId:this.data.channelId,
  80. userId:this.data.userId,
  81. scene:this.data.scene
  82. }
  83. if(this.data.money){
  84. //console.log("app或扫码进入 -->授权页")
  85. uni.navigateTo({
  86. url: `../login/index?params=${JSON.stringify(parmas)}`
  87. });
  88. }else{
  89. //console.log("微信小程序历史记录进入 -->就选择充值金额页")
  90. uni.navigateTo({
  91. url: `../amount/index?params=${JSON.stringify(parmas)}`
  92. });
  93. }
  94. }
  95. }
  96. }
  97. </script>
  98. <style lang="scss" scoped>
  99. .mianBox{
  100. height: 100%;
  101. width: 100%;
  102. color: #000;
  103. padding-top: 20px;
  104. box-sizing: border-box;
  105. .contentBox{
  106. width: 100%;
  107. height: auto;
  108. padding: 15px 20px;
  109. box-sizing: border-box;
  110. overflow: hidden;
  111. .amount{
  112. position: absolute;
  113. width: 100%;
  114. padding: 15px 20px;
  115. box-sizing: border-box;
  116. image{
  117. width:100%;
  118. height:auto
  119. }
  120. .amount_txt{
  121. margin-top:30px;
  122. position: absolute;
  123. left:26%;
  124. color:#fff;
  125. }
  126. // .amount_txt1{
  127. // margin-top:18px;
  128. // }
  129. // .amount_txt2{
  130. // margin-top:45px;
  131. // }
  132. // .van-col{
  133. // padding: 7px 0;
  134. // }
  135. }
  136. }
  137. }
  138. </style>