bindEnterprise.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <div class="mobile-fix-content mobile-center">
  3. <div class="block-wrap seek-operation">
  4. <p><i></i>所属企业已开店</p>
  5. <div class="search-wrap">
  6. <span>企业全称:</span>
  7. <input type="text" class="form-control" v-model="keyword" placeholder="请输入企业全称" @keyup.13="onSearchEnterprise">
  8. <i class="inline-block" @click="onSearchEnterprise">检测</i>
  9. </div>
  10. <div class="result">
  11. <template v-if="showSearchResultStatus === 1">
  12. <p><span class="title inline-block">管理员:</span><span class="content inline-block">{{enInfo.name}}</span></p>
  13. <p><span class="title inline-block">营业执照号:</span><span class="content inline-block">{{enInfo.businessCode}}</span></p>
  14. </template>
  15. <template v-if="showSearchResultStatus === 2">
  16. <p class="no-open">{{enName}}<span>(未开店)</span></p>
  17. </template>
  18. </div>
  19. </div>
  20. <div class="operation" v-show="showSearchResultStatus !== 0">
  21. <template v-if="showSearchResultStatus === 1">
  22. <a @click="bindEnterprise">申请绑定</a>
  23. <p>管理员审核通过后成功绑定</p>
  24. </template>
  25. <template v-if="showSearchResultStatus === 2">
  26. <a>开设新店铺</a>
  27. </template>
  28. </div>
  29. <remind-box :title="remindText" :timeoutCount="remindTimerCount"></remind-box>
  30. </div>
  31. </template>
  32. <script>
  33. import { RemindBox } from '~components/mobile/common'
  34. export default {
  35. layout: 'mobile',
  36. middleware: 'authenticated',
  37. data () {
  38. return {
  39. keyword: '',
  40. enInfo: {},
  41. remindText: '',
  42. remindTimerCount: 0,
  43. enName: '',
  44. showSearchResultStatus: 0
  45. }
  46. },
  47. components: {
  48. RemindBox
  49. },
  50. methods: {
  51. onSearchEnterprise: function () {
  52. if (this.keyword) {
  53. this.$http.get('/basic/enterprise/findByName/' + encodeURIComponent(this.keyword)).then(response => {
  54. if (response.data) {
  55. this.enInfo = response.data
  56. this.showSearchResultStatus = 1
  57. } else {
  58. this.enName = this.keyword
  59. this.showSearchResultStatus = 2
  60. }
  61. })
  62. }
  63. },
  64. bindEnterprise: function () {
  65. this.$http.get('/basic/enterprise/applyUserSpace', {params: {phone: this.user.data.userTel, enName: this.enInfo.name, businessCode: this.enInfo.businessCode}})
  66. .then(response => {
  67. if (response.data.data === 'success') {
  68. this.keyword = ''
  69. this.showSearchResultStatus = 0
  70. this.setRemindText('绑定申请提交成功!审批结果将以短信通知,请保持手机通畅。')
  71. } else {
  72. this.setRemindText(response.data.data)
  73. }
  74. }, err => {
  75. console.log(err)
  76. this.setRemindText('系统错误')
  77. })
  78. },
  79. setRemindText: function (str) {
  80. this.remindText = str
  81. this.remindTimerCount++
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss" scoped>
  87. @import '~assets/scss/mobileCenter';
  88. $input-height: .58rem;
  89. $base-color: #3f84f6;
  90. .mobile-center {
  91. .seek-operation {
  92. height: auto;
  93. padding-bottom: .59rem;
  94. }
  95. .search-wrap {
  96. padding-top: .48rem;
  97. padding-left: .12rem;
  98. span {
  99. font-size: .28rem;
  100. color: $base-color;
  101. }
  102. input {
  103. width: 4.2rem;
  104. height: $input-height;
  105. font-size: .23rem;
  106. border: 1px solid $base-color;
  107. border-radius: 0;
  108. border-bottom-left-radius: .14rem;
  109. border-top-left-radius: .14rem;
  110. }
  111. i {
  112. width: .85rem;
  113. height: $input-height;
  114. line-height: $input-height;
  115. text-align: center;
  116. color: #fff;
  117. font-size: .26rem;
  118. margin-left: -.01rem;
  119. background: $base-color;
  120. font-style: normal;
  121. vertical-align: baseline;
  122. margin-top: .01rem;
  123. border-bottom-right-radius: .14rem;
  124. border-top-right-radius: .14rem;
  125. }
  126. }
  127. .result {
  128. color: $base-color;
  129. font-size: .28rem;
  130. margin-top: .52rem;
  131. p {
  132. padding-left: 1rem;
  133. .title {
  134. width: 1.68rem;
  135. text-align: right;
  136. vertical-align: top;
  137. }
  138. .content {
  139. color: rgba(102, 102, 102, .89);
  140. margin-left: .4rem;
  141. width: 3.5rem;
  142. word-break: break-all;
  143. }
  144. }
  145. .no-open {
  146. text-align: center;
  147. color: rgba(102, 102, 102, .89);
  148. span {
  149. color: rgba(255, 0, 0, .89);
  150. }
  151. }
  152. }
  153. .operation {
  154. text-align: center;
  155. font-size: .32rem;
  156. a {
  157. display: block;
  158. width: 6.59rem;
  159. height: .77rem;
  160. line-height: .77rem;
  161. text-align: center;
  162. color: #fff;
  163. background: $base-color;
  164. margin: .58rem auto .27rem;
  165. border-radius: .08rem;
  166. }
  167. span {
  168. color: rgba(51, 51, 51, .89);
  169. }
  170. }
  171. }
  172. </style>