index.vue 6.1 KB

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