enterprise_detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. <template>
  2. <view class="content" :class="{ 'margin-bottom-80': isMar }" v-if="isShow">
  3. <!-- <view class="title">
  4. <view class="logo">
  5. <image :src="'https://kiq.xazhima.com' + info.pic_url" alt=""></image>
  6. </view>
  7. <view class="name">
  8. {{ info.name }}
  9. </view>
  10. </view> -->
  11. <view class="enterprise-item-box">
  12. <view
  13. v-for="(item, idx) in titleList"
  14. :key="idx"
  15. :class="{ active: active === idx }"
  16. class="enterprise-item-name"
  17. @click="change(idx)"
  18. >
  19. {{ item }}
  20. </view>
  21. </view>
  22. <view class="baseInfo" v-if="active === 0">
  23. <view class="card-title">{{ model.title }}</view>
  24. <view class="item-list">
  25. <view v-for="(item, idx) in model.item" :key="idx" class="term">
  26. <view class="term-name">{{ item.name }}:</view>
  27. <view class="term-value-group" v-if="item.name !== '网址'">
  28. <p
  29. v-for="(value, idx) in item.value"
  30. :key="idx"
  31. class="term-value-item"
  32. :class="{ blue: item.name == '电话' }"
  33. >
  34. {{ value }}
  35. </p>
  36. </view>
  37. <view class="term-value-group" v-else style="flex-direction:row;align-items: center;padding-left: 20rpx;">
  38. <div class="flex_i">
  39. {{ item.value[0] }}
  40. </div>
  41. <div class="copy" @click="copy(item.value[0])" style="color: #02a7f0;margin-left: 15rpx;">复制</div>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <view v-if="active === 1" class="proInfo">
  48. <view class="products">
  49. <view class="product" @click="toDetail(item.id)" v-for="(item,idx) in productList" :key="idx">
  50. <view class="img">
  51. <image :src="'https://kiq.xazhima.com' + item.pic_url"></image>
  52. </view>
  53. <view class="name">{{item.name}}</view>
  54. </view>
  55. </view>
  56. </view>
  57. <view style="width: 100%">
  58. <footer-share
  59. style="width: 100%"
  60. :isCollection="true"
  61. :isCollectedIcon="infoObj.if_collect"
  62. @collectionPages="collectionPage"
  63. @sharePages="sharePage"
  64. ></footer-share>
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. import md5 from "@/common/md5.js";
  70. export default {
  71. data() {
  72. return {
  73. id: "",
  74. scrollTop: 0,
  75. titleList: ["基本信息", "产品信息"],
  76. active: 0,
  77. info: {},
  78. model: {},
  79. productList: [],
  80. isShow: false,
  81. infoObj:{},
  82. };
  83. },
  84. onLoad(option) {
  85. let id = option.id;
  86. this.getCompanyInfo(id);
  87. this.getProductInfo(id);
  88. },
  89. methods: {
  90. change(idx) {
  91. this.active = idx;
  92. },
  93. toDetail(index) {
  94. uni.navigateTo({
  95. url: "/pages/enterprise/product_detail?id=" + index,
  96. });
  97. },
  98. getCompanyInfo(id) {
  99. let md5Sign = md5(
  100. "method=" +
  101. "common" +
  102. "&timestamp=" +
  103. getApp().globalData.globalTimestamp +
  104. "&secret=" +
  105. getApp().globalData.secret
  106. );
  107. let url =
  108. getApp().globalData.shareUrl +
  109. "api/api.php" +
  110. "?method=common&source=company&action=info_by_id&timestamp=" +
  111. getApp().globalData.globalTimestamp +
  112. "&sign=" +
  113. md5Sign;
  114. uni.request({
  115. url: url,
  116. method: "POST",
  117. header: {
  118. "content-type": "application/x-www-form-urlencoded",
  119. },
  120. data: { id },
  121. success: (res) => {
  122. if (res.data.code === 200) {
  123. this.infoObj = res.data.data;
  124. let {
  125. name,
  126. pic_url,
  127. representative,
  128. found_date,
  129. capital,
  130. code,
  131. industry_name,
  132. park_name,
  133. work_address,
  134. rigiser_address,
  135. web_url,
  136. phone,
  137. work_range,
  138. } = res.data.data;
  139. this.info = {
  140. name,
  141. pic_url,
  142. representative,
  143. found_date,
  144. capital,
  145. code,
  146. industry_name,
  147. park_name,
  148. work_address,
  149. rigiser_address,
  150. web_url,
  151. phone,
  152. work_range,
  153. };
  154. this.model = {
  155. title: this.info.name,
  156. item: [
  157. {
  158. name: "法定代表人",
  159. value: [this.info.representative],
  160. },
  161. {
  162. name: "成立日期",
  163. value: [this.info.found_date],
  164. },
  165. {
  166. name: "注册资本",
  167. value: [this.info.capital],
  168. },
  169. {
  170. name: "统一社会信用代码",
  171. value: [this.info.code],
  172. },
  173. {
  174. name: "所属行业",
  175. value: [this.info.industry_name],
  176. },
  177. {
  178. name: "所属园区",
  179. value: [this.info.park_name],
  180. },
  181. {
  182. name: "经营范围",
  183. value: [this.info.work_range],
  184. },
  185. {
  186. name: "地址",
  187. value: [this.info.rigiser_address],
  188. },
  189. {
  190. name: "网址",
  191. value: [this.info.web_url],
  192. },
  193. {
  194. name: "电话",
  195. value: [this.info.phone],
  196. },
  197. ],
  198. };
  199. this.isShow = true;
  200. }
  201. },
  202. fail: () => {
  203. console.log("连接失败");
  204. },
  205. });
  206. },
  207. getProductInfo(id) {
  208. let md5Sign = md5(
  209. "method=" +
  210. "common" +
  211. "&timestamp=" +
  212. getApp().globalData.globalTimestamp +
  213. "&secret=" +
  214. getApp().globalData.secret
  215. );
  216. let url =
  217. getApp().globalData.shareUrl +
  218. "api/api.php" +
  219. "?method=common&action=list&source=company_product&timestamp=" +
  220. getApp().globalData.globalTimestamp +
  221. "&sign=" +
  222. md5Sign;
  223. uni.request({
  224. url: url,
  225. method: "POST",
  226. header: {
  227. "content-type": "application/x-www-form-urlencoded",
  228. },
  229. data: {
  230. s_company_id: id,
  231. },
  232. success: (res) => {
  233. if (res.data.code === 200) {
  234. this.productList = res.data.data.list;
  235. console.log(this.productList);
  236. }
  237. },
  238. fail: () => {
  239. console.log("连接失败");
  240. },
  241. });
  242. },
  243. goAuthPage(){
  244. uni.navigateTo({
  245. url:'../auth/index'
  246. })
  247. },
  248. collectionPage() {
  249. if(!getApp().globalData.user_phone){
  250. this.goAuthPage();
  251. return
  252. }
  253. let md5Sign = md5(
  254. "method=" +
  255. "user" +
  256. "&timestamp=" +
  257. getApp().globalData.globalTimestamp +
  258. "&secret=" +
  259. getApp().globalData.secret
  260. );
  261. let url =
  262. getApp().globalData.shareUrl +
  263. "api/api.php" +
  264. "?method=user&source=company&action=collect_add&timestamp=" +
  265. getApp().globalData.globalTimestamp +
  266. "&sign=" +
  267. md5Sign;
  268. uni.request({
  269. url: url,
  270. method: "POST",
  271. header: {
  272. "content-type": "application/x-www-form-urlencoded",
  273. },
  274. data: {
  275. openId: getApp().globalData.open_id,
  276. source: "company",
  277. source_name: "企业",
  278. source_id: this.infoObj.id,
  279. source_title: this.infoObj.name,
  280. },
  281. success: (res) => {
  282. if (res.data.code === 200) {
  283. res.data.data
  284. ? (this.infoObj.if_collect = true)
  285. : (this.infoObj.if_collect = false);
  286. this.$forceUpdate();
  287. uni.showToast({
  288. duration: 3000,
  289. title: res.data.msg,
  290. icon: "none",
  291. });
  292. }
  293. },
  294. fail: () => {
  295. console.log("连接失败");
  296. },
  297. });
  298. },
  299. shareRequest() {
  300. let md5Sign = md5(
  301. "method=" +
  302. "user" +
  303. "&timestamp=" +
  304. getApp().globalData.globalTimestamp +
  305. "&secret=" +
  306. getApp().globalData.secret
  307. );
  308. let url =
  309. getApp().globalData.shareUrl +
  310. "api/api.php" +
  311. "?method=user&source=company&action=repost&timestamp=" +
  312. getApp().globalData.globalTimestamp +
  313. "&sign=" +
  314. md5Sign;
  315. uni.request({
  316. url: url,
  317. method: "POST",
  318. header: {
  319. "content-type": "application/x-www-form-urlencoded",
  320. },
  321. data: {
  322. openId: getApp().globalData.open_id,
  323. source_id: this.infoObj.id,
  324. source: "company",
  325. },
  326. success: (res) => {
  327. if (res.data.code === 200) {
  328. console.log(res);
  329. }
  330. },
  331. fail: () => {
  332. console.log("连接失败");
  333. },
  334. });
  335. },
  336. sharePage() {
  337. let that = this;
  338. uni.showShareMenu({
  339. title: that.infoObj.title,
  340. path: "pages/enterprise/enterprise_detail?id=" + that.infoObj.id,
  341. success(res) {
  342. that.shareRequest();
  343. },
  344. });
  345. },
  346. copy(data) {
  347. uni.setClipboardData({
  348. data,
  349. success: function () {
  350. console.log("复制成功");
  351. },
  352. });
  353. },
  354. },
  355. };
  356. </script>
  357. <style lang="scss" scoped>
  358. .content {
  359. padding: 4%;
  360. font-size: 30rpx;
  361. .blue {
  362. color: #02a7f0;
  363. }
  364. .title {
  365. display: flex;
  366. align-items: center;
  367. border-radius: 10rpx;
  368. margin-bottom: 50rpx;
  369. box-shadow: rgba(0, 0, 0, 0.35) 0rpx 5rpx 15rpx;
  370. .logo {
  371. image {
  372. width: 200rpx;
  373. height: 100rpx;
  374. margin: 0 30rpx;
  375. }
  376. }
  377. }
  378. .baseInfo {
  379. margin-bottom: 50rpx;
  380. .card-title {
  381. padding: 20rpx 20rpx 0rpx 20rpx;
  382. font-weight: 600;
  383. }
  384. .item-list {
  385. margin-left: 20rpx;
  386. display: flex;
  387. flex-direction: column;
  388. .term {
  389. display: flex;
  390. .term-name {
  391. font-size: 27rpx;
  392. width: 30%;
  393. display: flex;
  394. margin: 20rpx;
  395. color: #7f7f7f;
  396. }
  397. .term-value-group {
  398. flex: 1;
  399. display: flex;
  400. flex-direction: column;
  401. font-size: 27rpx;
  402. .term-value-item {
  403. margin: 20rpx;
  404. }
  405. .flex_i {
  406. display: flex;
  407. flex-flow: row;
  408. justify-content: space-around;
  409. }
  410. }
  411. }
  412. }
  413. }
  414. .proInfo {
  415. font-size: 25rpx;
  416. .products {
  417. width: 100%;
  418. display: flex;
  419. padding: 4%;
  420. flex-wrap: wrap;
  421. .product {
  422. margin: 2%;
  423. padding: 2%;
  424. border-radius: 30rpx;
  425. box-shadow: rgba(0, 0, 0, 0.35) 0rpx 5rpx 15rpx;
  426. width: 40%;
  427. height: 100px;
  428. display: flex;
  429. flex-flow: column;
  430. justify-content: space-between;
  431. align-items: center;
  432. .img {
  433. width: 200rpx;
  434. height: 200rpx;
  435. image {
  436. width: 200rpx;
  437. height: 160rpx;
  438. }
  439. }
  440. }
  441. }
  442. }
  443. .enterprise-item-box {
  444. display: flex;
  445. justify-content: space-evenly;
  446. margin: 0 20rpx;
  447. margin-top: 10rpx;
  448. .enterprise-item-name {
  449. padding-bottom: 10rpx;
  450. font-size: 27rpx;
  451. }
  452. .active {
  453. font-weight: 600;
  454. border-bottom: 7rpx solid #02a7f0;
  455. }
  456. }
  457. }
  458. .margin-bottom-80 {
  459. margin-bottom: 80rpx;
  460. }
  461. </style>