index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. this.$message.error(err.response.data || '系统错误')
  45. })
  46. }
  47. }
  48. }
  49. }
  50. </script>
  51. <style lang="scss" scoped>
  52. .is-open-store {
  53. margin-top: 50px;
  54. > p {
  55. font-weight: bold;
  56. font-size: 18px;
  57. margin: 26px 0;
  58. text-align: center;
  59. }
  60. .search-content {
  61. text-align: center;
  62. input {
  63. width: 290px;
  64. display: inline-block;
  65. height: 30px;
  66. border: {
  67. top-left-radius: 3px;
  68. bottom-left-radius: 3px;
  69. top-right-radius: 0;
  70. bottom-right-radius: 0;
  71. }
  72. border-top-left-radius: 3px;
  73. border-bottom-left-radius: 3px;
  74. border: 1px solid #cdcdcd;
  75. margin-left: 10px;
  76. }
  77. span {
  78. display: inline-block;
  79. width: 87px;
  80. height: 30px;
  81. line-height: 31px;
  82. text-align: center;
  83. color: #fff;
  84. background: #5078cb;
  85. margin-left: -1px;
  86. border-top-right-radius: 3px;
  87. border-bottom-right-radius: 3px;
  88. cursor: pointer;
  89. }
  90. }
  91. .result-content {
  92. text-align: center;
  93. p {
  94. height: 41px;
  95. line-height: 41px;
  96. font-size: 16px;
  97. font-weight: bold;
  98. margin: 24px auto 0;
  99. width: 376px;
  100. border-bottom: 1px solid #e6e5e4;
  101. padding-left: 8px;
  102. }
  103. .result-text {
  104. padding-left: 8px;
  105. span {
  106. &:first-child {
  107. display: inline-block;
  108. width: 111px;
  109. color: #666;
  110. }
  111. }
  112. &:first-of-type {
  113. margin: 15px 0 21px 0;
  114. }
  115. }
  116. > a {
  117. display: inline-block;
  118. width: 201px;
  119. height: 40px;
  120. line-height: 40px;
  121. text-align: center;
  122. border-radius: 3px;
  123. background: #5078cb;
  124. color: #fff;
  125. margin: 37px 0 16px 130px;
  126. }
  127. .result-remind {
  128. margin: 0 0 18px 146px;
  129. color: #666;
  130. }
  131. }
  132. .no-result-content {
  133. font-size: 16px;
  134. text-align: center;
  135. span {
  136. color: #f00707;
  137. font-weight: normal;
  138. }
  139. }
  140. }
  141. </style>