query.vue 2.0 KB

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