cooperativeEnterprise.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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. {
  76. value: '',
  77. name: '全部'
  78. }
  79. ],
  80. // tab选中项
  81. tabCur: 0,
  82. // 公司列表
  83. companyList: [],
  84. // 企业规模
  85. companyScopeList: [],
  86. // 企业类型
  87. companyTradeList: []
  88. }
  89. },
  90. onShow() {
  91. this.getDict('company_scope');
  92. this.getDict('company_trade');
  93. },
  94. methods: {
  95. /**
  96. * 获取企业列表
  97. * @param { Number } pageNum
  98. * @param { Number } pageSize
  99. * @param { String } companyName
  100. * @param { String } trade
  101. */
  102. getList(pageNum, pageSize, companyName, trade) {
  103. this.$u.api.company.getCompanyList({
  104. pageNum,
  105. pageSize,
  106. companyName,
  107. trade
  108. }).then(res => {
  109. if (res.code === 200) {
  110. this.$refs.paging.complete(res.data.rows)
  111. } else {
  112. this.$refs.uToast.show({
  113. title: res.msg,
  114. type: 'error'
  115. })
  116. this.$refs.paging.complete([])
  117. }
  118. }).catch(err => {
  119. this.$refs.uToast.show({
  120. title: '系统异常!',
  121. type: 'error'
  122. })
  123. this.$refs.paging.complete([])
  124. })
  125. },
  126. /**
  127. * 获取字典
  128. * company_scope 公司规模
  129. * company_trade 公司类型
  130. */
  131. getDict(key) {
  132. this.$u.api.getDictdataUrl({
  133. key: key
  134. }).then(res => {
  135. if (res.code === 200) {
  136. if (key === 'company_scope') {
  137. this.companyScopeList = res.data
  138. } else if (key === 'company_trade') {
  139. this.companyTradeList = res.data;
  140. this.tabList = res.data.map(item => {
  141. return {
  142. ...item,
  143. name: item.label,
  144. value: item.text
  145. }
  146. })
  147. this.tabList.unshift({
  148. value: '',
  149. name: '全部'
  150. })
  151. }
  152. }
  153. })
  154. },
  155. /**
  156. * @param {Object} val
  157. */
  158. getCompanyScopeName(val) {
  159. let name;
  160. this.companyScopeList.forEach(item => {
  161. if (Number(item.text) === Number(val)) {
  162. name = item.label
  163. }
  164. })
  165. return name;
  166. },
  167. /**
  168. * @param {Object} val
  169. */
  170. getCompanyTradeName(val) {
  171. let name;
  172. this.companyTradeList.forEach(item => {
  173. if (Number(item.text) === Number(val)) {
  174. name = item.label
  175. }
  176. })
  177. return name;
  178. },
  179. /**
  180. * @param { String } value
  181. */
  182. searchKeyword(value) {
  183. this.getList(1, 10, this.keyword, this.tradeType)
  184. },
  185. /**
  186. * tab切换
  187. */
  188. tabChange(val) {
  189. this.tabCur = val
  190. this.tabList.forEach((item, index) => {
  191. if (index === val) {
  192. this.tradeType = item.value
  193. }
  194. })
  195. this.getList(1, 10, this.keyword, this.tradeType)
  196. },
  197. /**
  198. * @param {String} url
  199. * @param {Object} params
  200. */
  201. jumpPage(url, params) {
  202. this.$u.route({
  203. url: url,
  204. params: params
  205. })
  206. },
  207. /**
  208. * 列表加载触发
  209. */
  210. queryList(pageNo, pageSize) {
  211. this.getList(pageNo, pageSize, this.keyword, this.tradeType)
  212. }
  213. }
  214. }
  215. </script>
  216. <style lang="scss" scoped>
  217. @import './cooperativeEnterprise.scss';
  218. </style>