index.vue 6.7 KB

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