index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <view class="content" v-if="isShow">
  3. <!-- 搜索框 -->
  4. <view class="input-box">
  5. <image src="/static/policy/u377.png" alt="" />
  6. <input
  7. type="text"
  8. placeholder="请输入关键词搜索"
  9. @confirm="searchCompany"
  10. v-model="searchVal"
  11. />
  12. </view>
  13. <view class="companys">
  14. <view>推荐企业</view>
  15. <view
  16. class="company"
  17. v-for="(company, index) in companyList"
  18. :key="index"
  19. @tap="toDetail(company.id)"
  20. >
  21. <view class="title">
  22. <view class="logo">
  23. <image
  24. :src="'https://kiq.xazhima.com' + company.pic_url"
  25. alt=""
  26. class="logo-img"
  27. mode="aspectFit"
  28. />
  29. </view>
  30. <view class="name">
  31. {{ company.name }}
  32. </view>
  33. </view>
  34. <view class="info">
  35. <view class="view">
  36. <view class="info_t">法定代表人</view>
  37. <view class="name">
  38. {{ company.representative }}
  39. </view>
  40. </view>
  41. <view class="line"></view>
  42. <view class="view">
  43. <view class="info_t">注册资本</view>
  44. {{ company.capital }}
  45. </view>
  46. <view class="line"></view>
  47. <view class="view">
  48. <view class="info_t">成立日期</view>
  49. {{ company.found_date }}
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import md5 from "@/common/md5.js";
  58. export default {
  59. data() {
  60. return {
  61. companyList: [],
  62. isShow: false,
  63. searchVal: "",
  64. // new Array(5).fill({
  65. // logo: "/static/enterprise/logo.png",
  66. // name: "康拓科技有限责任公司",
  67. // info: {
  68. // person: "马须伦",
  69. // money: "1,776,759.3万(元)",
  70. // time: "1995-03-25",
  71. // },
  72. // })
  73. };
  74. },
  75. onLoad() {
  76. this.getCompany();
  77. },
  78. methods: {
  79. toDetail(index) {
  80. uni.navigateTo({
  81. url: "/pages/enterprise/enterprise_detail?id=" + index,
  82. });
  83. },
  84. getCompany() {
  85. let md5Sign = md5(
  86. "method=" +
  87. "common" +
  88. "&timestamp=" +
  89. getApp().globalData.globalTimestamp +
  90. "&secret=" +
  91. getApp().globalData.secret
  92. );
  93. let url =
  94. getApp().globalData.shareUrl +
  95. "api/api.php" +
  96. "?method=common&source=company&action=list&timestamp=" +
  97. getApp().globalData.globalTimestamp +
  98. "&sign=" +
  99. md5Sign;
  100. let postData = {
  101. page: 1,
  102. page_size: 15,
  103. };
  104. uni.request({
  105. url: url,
  106. method: "POST",
  107. header: {
  108. "content-type": "application/x-www-form-urlencoded",
  109. },
  110. data: postData,
  111. success: (res) => {
  112. if (res.data.code === 200) {
  113. let list = res.data.data.list;
  114. list.forEach((e, i) => {
  115. let {
  116. pic_url,
  117. name,
  118. representative,
  119. capital,
  120. found_date,
  121. id,
  122. } = e;
  123. list[i] = {
  124. pic_url,
  125. name,
  126. representative,
  127. capital,
  128. found_date,
  129. id,
  130. };
  131. });
  132. this.companyList = list;
  133. this.isShow = true;
  134. }
  135. },
  136. fail: () => {
  137. console.log("连接失败");
  138. },
  139. });
  140. },
  141. searchCompany() {
  142. let md5Sign = md5(
  143. "method=" +
  144. "common" +
  145. "&timestamp=" +
  146. getApp().globalData.globalTimestamp +
  147. "&secret=" +
  148. getApp().globalData.secret
  149. );
  150. let url =
  151. getApp().globalData.shareUrl +
  152. "api/api.php" +
  153. "?method=common&source=company&action=list&timestamp=" +
  154. getApp().globalData.globalTimestamp +
  155. "&sign=" +
  156. md5Sign;
  157. uni.request({
  158. url: url,
  159. method: "POST",
  160. header: {
  161. "content-type": "application/x-www-form-urlencoded",
  162. },
  163. data: {
  164. ss_name: this.searchVal, //1.省 2.市 3.区 4.新城
  165. },
  166. success: (res) => {
  167. if (res.data.code === 200) {
  168. let list = res.data.data.list;
  169. console.log(list);
  170. list.forEach((e, i) => {
  171. let {
  172. pic_url,
  173. name,
  174. representative,
  175. capital,
  176. found_date,
  177. id,
  178. } = e;
  179. list[i] = {
  180. pic_url,
  181. name,
  182. representative,
  183. capital,
  184. found_date,
  185. id,
  186. };
  187. });
  188. this.companyList = list;
  189. }
  190. },
  191. fail: () => {
  192. console.log("连接失败");
  193. },
  194. });
  195. },
  196. },
  197. };
  198. </script>
  199. <style lang="scss">
  200. .content {
  201. font-size: 30rpx;
  202. .input-box {
  203. width: 100%;
  204. height: 100rpx;
  205. background-color: #02a7f0;
  206. display: flex;
  207. justify-content: center;
  208. align-items: center;
  209. position: relative;
  210. image {
  211. position: absolute;
  212. left: 72rpx;
  213. width: 40rpx;
  214. height: 40rpx;
  215. }
  216. input {
  217. background-color: #ffffff;
  218. width: 90%;
  219. height: 70%;
  220. border-radius: 50rpx;
  221. padding: 3rpx;
  222. font-size: 26rpx;
  223. padding-left: 80rpx;
  224. box-sizing: border-box;
  225. }
  226. }
  227. .companys {
  228. margin-top: 3%;
  229. padding: 0 4%;
  230. .company {
  231. border-radius: 20rpx;
  232. box-shadow: rgba(0, 0, 0, 0.35) 0rpx 5rpx 15rpx;
  233. padding: 2%;
  234. margin: 2% 0;
  235. .title {
  236. display: flex;
  237. align-items: center;
  238. .logo {
  239. margin-right: 30rpx;
  240. width: 100rpx;
  241. height: 100rpx;
  242. display: flex;
  243. justify-content: center;
  244. align-items: center;
  245. overflow: hidden;
  246. .logo-img {
  247. max-width: 100%;
  248. }
  249. }
  250. }
  251. .line {
  252. width: 3rpx;
  253. height: 70rpx;
  254. background: rgb(175, 186, 197);
  255. }
  256. .info {
  257. font-size: 19rpx;
  258. font-weight: 100;
  259. display: flex;
  260. text-align: center;
  261. justify-content: space-between;
  262. align-items: center;
  263. padding: 0 2%;
  264. margin-top: 2%;
  265. .view {
  266. margin-top: 2%;
  267. .name {
  268. color: #02a7f0;
  269. }
  270. .info_t {
  271. margin-bottom: 10rpx;
  272. font-size: 25rpx;
  273. }
  274. }
  275. }
  276. }
  277. }
  278. }
  279. </style>