query.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <view id="myApp">
  3. <view class="header">
  4. <img src="@/static/img/apply.png" >
  5. </view>
  6. <view class="information" v-if="type == 1">
  7. <form name="myform">
  8. <view class="input">
  9. <view class="img">
  10. <img src="@/static/img/icon-2.png" >
  11. </view>
  12. <input type="text" v-model="name" placeholder="请输入会员姓名" />
  13. </view>
  14. <view class="input">
  15. <view class="img">
  16. <img src="@/static/img/icon-1.png" >
  17. </view>
  18. <input type="text" v-model="idcard" placeholder="请输入会员身份证号" />
  19. </view>
  20. <view class="button" @click="submit">
  21. 立即查询
  22. </view>
  23. </form>
  24. </view>
  25. <view class="information" v-else>
  26. <form name="myform">
  27. <view class="input">
  28. <view class="img">
  29. <img src="@/static/img/icon-2.png" >
  30. </view>
  31. <input type="text" v-model="name" placeholder="请输入企业名称" />
  32. </view>
  33. <view class="button" @click="submit">
  34. 立即查询
  35. </view>
  36. </form>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import { query } from '../../api/apply.js'
  42. import { mapMutations } from 'vuex';
  43. export default {
  44. data() {
  45. return {
  46. name: '',
  47. idcard: '',
  48. type: ''
  49. }
  50. },
  51. onLoad(options) {
  52. this.type = options.type
  53. },
  54. methods: {
  55. ...mapMutations('user', ['setInformation']),
  56. submit() {
  57. const obj = this
  58. const data = obj.type == 1 ? { name: this.name, idcard: this.idcard }: { name: this.name }
  59. query(data,obj.type).then(res => {
  60. obj.setInformation(res.data.data)
  61. uni.navigateTo({
  62. url: '/pages/apply/success?type='+this.type
  63. })
  64. }).catch(res => {
  65. console.log(res)
  66. })
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. body {
  73. margin: 0;
  74. background-color: #f3f3f3;
  75. }
  76. .header img{
  77. width: 100%;
  78. }
  79. .information {
  80. padding: 10px 0;
  81. background-color: #fff;
  82. width: 95%;
  83. margin: 15px auto;
  84. border-radius: 10px;
  85. }
  86. .information .input{
  87. padding: 10px;
  88. padding-bottom: 10px;
  89. padding-top: 30px;
  90. margin: auto auto;
  91. text-align: center;
  92. width: 90%;
  93. border-bottom: solid 1px #d8d8d8;
  94. display: flex;
  95. }
  96. .information .input .img{
  97. width: 30px;
  98. margin: auto 0;
  99. margin-right: 5px;
  100. }
  101. .information .input .img img{
  102. height: 20px;
  103. margin: auto 0;
  104. }
  105. .information .input input{
  106. text-align: left;
  107. font-size: 15px;
  108. width: 90%;
  109. border: 0;
  110. height: 20px;
  111. padding-bottom: 0;
  112. }
  113. .button {
  114. margin: 30px auto;
  115. text-align: center;
  116. font-size: 15px;
  117. color: #fff;
  118. background-color: #3b66f5;
  119. border-radius: 30px;
  120. padding: 10px;
  121. width: 70%;
  122. }
  123. </style>