cooperativeEnterprise.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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. <u-image :src="item.logoUrl" width="112" height="112" border-radius="10">
  47. <view slot="error">
  48. <u-image src="../../static/img/default-company.jpg" width="112" height="112" border-radius="10"/>
  49. </view>
  50. </u-image>
  51. </view>
  52. <view class="info">
  53. <view>{{ item.companyName }}</view>
  54. <view class="company">
  55. <!-- <view class="icon"><u-icon name="star-fill" color="#EF651F"/>{{ item.star }}</view> -->
  56. <view>{{ getCompanyScopeName(item.scope) }} · {{ getCompanyTradeName(item.trade) }}</view>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="enterprose-list-content-item-right">
  61. <u-icon name="arrow-right" color="#d2d3d5"/>
  62. </view>
  63. </view>
  64. </view>
  65. </z-paging>
  66. <u-toast ref="uToast" />
  67. </view>
  68. </template>
  69. <script>
  70. export default {
  71. data() {
  72. return {
  73. // 搜索关键词
  74. keyword: '',
  75. // 选中类型
  76. tradeType: '',
  77. // tab
  78. tabList: [
  79. {
  80. value: '',
  81. name: '全部'
  82. }
  83. ],
  84. // tab选中项
  85. tabCur: 0,
  86. // 公司列表
  87. companyList: [],
  88. // 企业规模
  89. companyScopeList: [],
  90. // 企业类型
  91. companyTradeList: []
  92. }
  93. },
  94. onShow() {
  95. this.getDict('company_scope');
  96. this.getDict('company_trade');
  97. },
  98. methods: {
  99. /**
  100. * 获取企业列表
  101. * @param { Number } pageNum
  102. * @param { Number } pageSize
  103. * @param { String } companyName
  104. * @param { String } trade
  105. */
  106. getList(pageNum, pageSize, companyName, trade) {
  107. this.$u.api.company.getCompanyList({
  108. pageNum,
  109. pageSize,
  110. companyName,
  111. trade
  112. }).then(res => {
  113. if (res.code === 200) {
  114. this.$refs.paging.complete(res.data.rows)
  115. } else {
  116. this.$refs.uToast.show({
  117. title: res.msg,
  118. type: 'error'
  119. })
  120. this.$refs.paging.complete([])
  121. }
  122. }).catch(err => {
  123. this.$refs.uToast.show({
  124. title: '系统异常!',
  125. type: 'error'
  126. })
  127. this.$refs.paging.complete([])
  128. })
  129. },
  130. /**
  131. * 获取字典
  132. * company_scope 公司规模
  133. * company_trade 公司类型
  134. */
  135. getDict(key) {
  136. this.$u.api.getDictdataUrl({
  137. key: key
  138. }).then(res => {
  139. if (res.code === 200) {
  140. if (key === 'company_scope') {
  141. this.companyScopeList = res.data
  142. } else if (key === 'company_trade') {
  143. this.companyTradeList = res.data;
  144. this.tabList = res.data.map(item => {
  145. return {
  146. ...item,
  147. name: item.label,
  148. value: item.text
  149. }
  150. })
  151. this.tabList.unshift({
  152. value: '',
  153. name: '全部'
  154. })
  155. }
  156. }
  157. })
  158. },
  159. /**
  160. * @param {Object} val
  161. */
  162. getCompanyScopeName(val) {
  163. let name;
  164. this.companyScopeList.forEach(item => {
  165. if (Number(item.text) === Number(val)) {
  166. name = item.label
  167. }
  168. })
  169. return name;
  170. },
  171. /**
  172. * @param {Object} val
  173. */
  174. getCompanyTradeName(val) {
  175. let name;
  176. this.companyTradeList.forEach(item => {
  177. if (Number(item.text) === Number(val)) {
  178. name = item.label
  179. }
  180. })
  181. return name;
  182. },
  183. /**
  184. * @param { String } value
  185. */
  186. searchKeyword(value) {
  187. this.getList(1, 10, this.keyword, this.tradeType)
  188. },
  189. /**
  190. * tab切换
  191. */
  192. tabChange(val) {
  193. this.tabCur = val
  194. this.tabList.forEach((item, index) => {
  195. if (index === val) {
  196. this.tradeType = item.value
  197. }
  198. })
  199. this.getList(1, 10, this.keyword, this.tradeType)
  200. },
  201. /**
  202. * @param {String} url
  203. * @param {Object} params
  204. */
  205. jumpPage(url, params) {
  206. this.$u.route({
  207. url: url,
  208. params: params
  209. })
  210. },
  211. /**
  212. * 列表加载触发
  213. */
  214. queryList(pageNo, pageSize) {
  215. this.getList(pageNo, pageSize, this.keyword, this.tradeType)
  216. }
  217. }
  218. }
  219. </script>
  220. <style lang="scss" scoped>
  221. @import './cooperativeEnterprise.scss';
  222. </style>