cooperativeEnterprise.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <!-- 企业列表 -->
  2. <template>
  3. <view class="enterprose-list">
  4. <z-paging
  5. ref="paging"
  6. v-model="companyList"
  7. @query="queryList"
  8. >
  9. <!-- 搜索 -->
  10. <view class="enterprose-list-search" slot="top">
  11. <u-search
  12. class="enterprose-list-search-input"
  13. placeholder="请输入关键词"
  14. v-model="keyword"
  15. shape="square"
  16. input-align="center"
  17. :show-action="false"
  18. bg-color="#ffffff"
  19. height="70"
  20. @search="searchKeyword"
  21. @clear="searchKeyword"
  22. />
  23. </view>
  24. <!-- tab -->
  25. <view class="enterprose-list-tab" slot="top">
  26. <u-tabs
  27. :list="tabList"
  28. :is-scroll="true"
  29. :current="tabCur"
  30. height="70"
  31. font-size="28"
  32. inactive-color="#5F5F5F"
  33. @change="tabChange"
  34. />
  35. </view>
  36. <!-- 列表 -->
  37. <view class="enterprose-list-content">
  38. <view
  39. class="enterprose-list-content-item"
  40. v-for="(item, index) in companyList"
  41. :key="index"
  42. @click="jumpPage('/pages/businessDetails/businessDetails', { id: item.id})"
  43. >
  44. <view class="enterprose-list-content-item-left">
  45. <view class="image">
  46. <image :src="item.logoUrl" mode=""></image>
  47. </view>
  48. <view class="info">
  49. <view>{{ item.companyName }}</view>
  50. <view class="company">
  51. <!-- <view class="icon"><u-icon name="star-fill" color="#EF651F"/>{{ item.star }}</view> -->
  52. <view>{{ getCompanyScopeName(item.scope) }} · {{ getCompanyTradeName(item.trade) }}</view>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="enterprose-list-content-item-right">
  57. <u-icon name="arrow-right"/>
  58. </view>
  59. </view>
  60. </view>
  61. </z-paging>
  62. <u-toast ref="uToast" />
  63. </view>
  64. </template>
  65. <script>
  66. export default {
  67. data() {
  68. return {
  69. // 搜索关键词
  70. keyword: '',
  71. // 选中类型
  72. tradeType: '',
  73. // tab
  74. tabList: [],
  75. // tab选中项
  76. tabCur: 0,
  77. // 公司列表
  78. companyList: [],
  79. // 企业规模
  80. companyScopeList: [],
  81. // 企业类型
  82. companyTradeList: []
  83. }
  84. },
  85. onShow() {
  86. this.getDict('company_scope');
  87. this.getDict('company_trade');
  88. },
  89. methods: {
  90. /**
  91. * 获取企业列表
  92. * @param { Number } pageNum
  93. * @param { Number } pageSize
  94. * @param { String } companyName
  95. * @param { String } trade
  96. */
  97. getList(pageNum, pageSize, companyName, trade) {
  98. this.$u.api.company.getCompanyList({
  99. pageNum,
  100. pageSize,
  101. companyName,
  102. trade
  103. }).then(res => {
  104. if (res.code === 200) {
  105. this.$refs.paging.complete(res.data.rows)
  106. } else {
  107. this.$refs.uToast.show({
  108. title: res.msg,
  109. type: 'error'
  110. })
  111. }
  112. }).catch(err => {
  113. this.$refs.uToast.show({
  114. title: '系统异常!',
  115. type: 'error'
  116. })
  117. })
  118. },
  119. /**
  120. * 获取字典
  121. * company_scope 公司规模
  122. * company_trade 公司类型
  123. */
  124. getDict(key) {
  125. this.$u.api.getDictdataUrl({
  126. key: key
  127. }).then(res => {
  128. if (res.code === 200) {
  129. if (key === 'company_scope') {
  130. this.companyScopeList = res.data
  131. } else if (key === 'company_trade') {
  132. this.companyTradeList = res.data;
  133. this.tabList = res.data.map(item => {
  134. return {
  135. ...item,
  136. name: item.label,
  137. value: item.text
  138. }
  139. })
  140. this.tabList.unshift({
  141. value: '',
  142. name: '全部'
  143. })
  144. }
  145. }
  146. })
  147. },
  148. /**
  149. * @param {Object} val
  150. */
  151. getCompanyScopeName(val) {
  152. let name;
  153. this.companyScopeList.forEach(item => {
  154. if (Number(item.text) === Number(val)) {
  155. name = item.label
  156. }
  157. })
  158. return name;
  159. },
  160. /**
  161. * @param {Object} val
  162. */
  163. getCompanyTradeName(val) {
  164. let name;
  165. this.companyTradeList.forEach(item => {
  166. if (Number(item.text) === Number(val)) {
  167. name = item.label
  168. }
  169. })
  170. return name;
  171. },
  172. /**
  173. * @param { String } value
  174. */
  175. searchKeyword(value) {
  176. this.getList(1, 10, this.keyword, this.tradeType)
  177. },
  178. /**
  179. * tab切换
  180. */
  181. tabChange(val) {
  182. this.tabCur = val
  183. this.tabList.forEach((item, index) => {
  184. if (index === val) {
  185. this.tradeType = item.value
  186. }
  187. })
  188. this.getList(1, 10, this.keyword, this.tradeType)
  189. },
  190. /**
  191. * @param {String} url
  192. * @param {Object} params
  193. */
  194. jumpPage(url, params) {
  195. this.$u.route({
  196. url: url,
  197. params: params
  198. })
  199. },
  200. /**
  201. * 列表加载触发
  202. */
  203. queryList(pageNo, pageSize) {
  204. this.getList(pageNo, pageSize, this.keyword, this.tradeType)
  205. }
  206. }
  207. }
  208. </script>
  209. <style lang="scss" scoped>
  210. @import './cooperativeEnterprise.scss';
  211. </style>