cooperativeEnterprise.vue 5.1 KB

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