index.vue 2.7 KB

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