index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <div class="is-open-store">
  3. <div class="search-content">企业全称:<input type="text" class="form-control" v-model="keyword" placeholder="请输入企业全称" @keyup.13="onSearchEnterprise"><span @click="onSearchEnterprise">检测</span></div>
  4. <div class="result-content" v-if="showSearchResultStatus == 1">
  5. <p v-text="enInfo.name"></p>
  6. <div class="result-text">
  7. <span>管理员</span>
  8. <span v-text="enInfo.adminName"></span>
  9. </div>
  10. <div class="result-text">
  11. <span>营业执照号</span>
  12. <span v-text="enInfo.businessCode"></span>
  13. </div>
  14. </div>
  15. <p class="no-result-content" v-if="showSearchResultStatus == 2">
  16. {{enName}} <span>(未开店)</span>
  17. </p>
  18. </div>
  19. </template>
  20. <script>
  21. export default {
  22. layout: 'none',
  23. data () {
  24. return {
  25. // 0=>初始状态,1=>有搜索结果,2=>搜索结果为空
  26. showSearchResultStatus: 0,
  27. keyword: '',
  28. enName: '',
  29. enInfo: {}
  30. }
  31. },
  32. methods: {
  33. onSearchEnterprise: function () {
  34. if (this.keyword) {
  35. this.$http.get('/basic/enterprise/findByName/' + encodeURIComponent(this.keyword)).then(response => {
  36. if (response.data) {
  37. this.enInfo = response.data
  38. this.showSearchResultStatus = 1
  39. } else {
  40. this.enName = this.keyword
  41. this.showSearchResultStatus = 2
  42. }
  43. }, err => {
  44. console.log(err)
  45. this.$message.error('系统错误')
  46. })
  47. }
  48. }
  49. }
  50. }
  51. </script>
  52. <style lang="scss" scoped>
  53. .is-open-store {
  54. margin-top: 50px;
  55. > p {
  56. font-weight: bold;
  57. font-size: 18px;
  58. margin: 26px 0;
  59. text-align: center;
  60. }
  61. .search-content {
  62. text-align: center;
  63. input {
  64. width: 290px;
  65. display: inline-block;
  66. height: 30px;
  67. border: {
  68. top-left-radius: 3px;
  69. bottom-left-radius: 3px;
  70. top-right-radius: 0;
  71. bottom-right-radius: 0;
  72. }
  73. border-top-left-radius: 3px;
  74. border-bottom-left-radius: 3px;
  75. border: 1px solid #cdcdcd;
  76. margin-left: 10px;
  77. }
  78. span {
  79. display: inline-block;
  80. width: 87px;
  81. height: 30px;
  82. line-height: 31px;
  83. text-align: center;
  84. color: #fff;
  85. background: #5078cb;
  86. margin-left: -1px;
  87. border-top-right-radius: 3px;
  88. border-bottom-right-radius: 3px;
  89. cursor: pointer;
  90. }
  91. }
  92. .result-content {
  93. text-align: center;
  94. p {
  95. height: 41px;
  96. line-height: 41px;
  97. font-size: 16px;
  98. font-weight: bold;
  99. margin: 24px auto 0;
  100. width: 376px;
  101. border-bottom: 1px solid #e6e5e4;
  102. padding-left: 8px;
  103. }
  104. .result-text {
  105. padding-left: 8px;
  106. span {
  107. &:first-child {
  108. display: inline-block;
  109. width: 111px;
  110. color: #666;
  111. }
  112. }
  113. &:first-of-type {
  114. margin: 15px 0 21px 0;
  115. }
  116. }
  117. > a {
  118. display: inline-block;
  119. width: 201px;
  120. height: 40px;
  121. line-height: 40px;
  122. text-align: center;
  123. border-radius: 3px;
  124. background: #5078cb;
  125. color: #fff;
  126. margin: 37px 0 16px 130px;
  127. }
  128. .result-remind {
  129. margin: 0 0 18px 146px;
  130. color: #666;
  131. }
  132. }
  133. .no-result-content {
  134. font-size: 16px;
  135. text-align: center;
  136. span {
  137. color: #f00707;
  138. font-weight: normal;
  139. }
  140. }
  141. }
  142. </style>