enterprise_detail.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  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>
  38. <div class="flex_i">
  39. <div class="">
  40. {{ item.value[0] }}
  41. </div>
  42. <div class="copy" @click="copy(item.value[0])">复制</div>
  43. </p>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view v-else-if="active === 1" class="proInfo">
  49. <view class="products">
  50. <view class="product" @click="toDetail(id)" v-for="(item,idx) in productList" :key="idx">
  51. <view class="img">
  52. <image :src="'https://kiq.xazhima.com' + item.pic_url"></image>
  53. </view>
  54. <view class="name">{{item.name}}</view>
  55. </view>
  56. </view>
  57. </view>
  58. <view style="width: 100%">
  59. <footer-share
  60. style="width: 100%"
  61. :isCollection="true"
  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. };
  82. },
  83. onLoad(option) {
  84. let id = option.id;
  85. this.getCompanyInfo(id);
  86. this.getProductInfo(id);
  87. },
  88. methods: {
  89. collectionPage() {
  90. console.log("已收藏");
  91. },
  92. sharePage() {
  93. console.log("分享");
  94. uni.showShareMenu({
  95. title: "园区XXX",
  96. path: "pages/park/park_detail",
  97. success(res) {
  98. console.log(res);
  99. },
  100. });
  101. },
  102. change(idx) {
  103. this.active = idx;
  104. },
  105. toDetail(index) {
  106. uni.navigateTo({
  107. url: "/pages/enterprise/product_detail?id=" + index,
  108. });
  109. },
  110. getCompanyInfo(id) {
  111. let md5Sign = md5(
  112. "method=" +
  113. "common" +
  114. "&timestamp=" +
  115. getApp().globalData.globalTimestamp +
  116. "&secret=" +
  117. getApp().globalData.secret
  118. );
  119. let url =
  120. getApp().globalData.shareUrl +
  121. "api/api.php" +
  122. "?method=common&source=company&action=info_by_id&timestamp=" +
  123. getApp().globalData.globalTimestamp +
  124. "&sign=" +
  125. md5Sign;
  126. uni.request({
  127. url: url,
  128. method: "POST",
  129. header: {
  130. "content-type": "application/x-www-form-urlencoded",
  131. },
  132. data: { id },
  133. success: (res) => {
  134. if (res.data.code === 200) {
  135. let {
  136. name,
  137. pic_url,
  138. representative,
  139. found_date,
  140. capital,
  141. code,
  142. industry_name,
  143. park_name,
  144. work_address,
  145. rigiser_address,
  146. web_url,
  147. phone,
  148. work_range,
  149. } = res.data.data;
  150. this.info = {
  151. name,
  152. pic_url,
  153. representative,
  154. found_date,
  155. capital,
  156. code,
  157. industry_name,
  158. park_name,
  159. work_address,
  160. rigiser_address,
  161. web_url,
  162. phone,
  163. work_range,
  164. };
  165. this.model = {
  166. title: this.info.name,
  167. item: [
  168. {
  169. name: "法定代表人",
  170. value: [this.info.representative],
  171. },
  172. {
  173. name: "成立日期",
  174. value: [this.info.found_date],
  175. },
  176. {
  177. name: "注册资本",
  178. value: [this.info.capital],
  179. },
  180. {
  181. name: "统一社会信用代码",
  182. value: [this.info.code],
  183. },
  184. {
  185. name: "所属行业",
  186. value: [this.info.industry_name],
  187. },
  188. {
  189. name: "所属园区",
  190. value: [this.info.park_name],
  191. },
  192. {
  193. name: "经营范围",
  194. value: [this.info.work_range],
  195. },
  196. {
  197. name: "地址",
  198. value: [this.info.rigiser_address],
  199. },
  200. {
  201. name: "网址",
  202. value: [this.info.web_url],
  203. },
  204. {
  205. name: "电话",
  206. value: [this.info.phone],
  207. },
  208. ],
  209. };
  210. this.isShow = true;
  211. }
  212. },
  213. fail: () => {
  214. console.log("连接失败");
  215. },
  216. });
  217. },
  218. getProductInfo(id) {
  219. let md5Sign = md5(
  220. "method=" +
  221. "common" +
  222. "&timestamp=" +
  223. getApp().globalData.globalTimestamp +
  224. "&secret=" +
  225. getApp().globalData.secret
  226. );
  227. let url =
  228. getApp().globalData.shareUrl +
  229. "api/api.php" +
  230. "?method=common&action=list&source=company_product&timestamp=" +
  231. getApp().globalData.globalTimestamp +
  232. "&sign=" +
  233. md5Sign;
  234. uni.request({
  235. url: url,
  236. method: "POST",
  237. header: {
  238. "content-type": "application/x-www-form-urlencoded",
  239. },
  240. data: {
  241. s_company_id: id,
  242. },
  243. success: (res) => {
  244. if (res.data.code === 200) {
  245. this.productList = res.data.data.list;
  246. console.log(this.productList);
  247. }
  248. },
  249. fail: () => {
  250. console.log("连接失败");
  251. },
  252. });
  253. },
  254. copy(data) {
  255. uni.setClipboardData({
  256. data,
  257. success: function () {
  258. console.log("复制成功");
  259. },
  260. });
  261. },
  262. },
  263. };
  264. </script>
  265. <style lang="scss" scoped>
  266. .content {
  267. padding: 4%;
  268. font-size: 30rpx;
  269. .blue {
  270. color: #02a7f0;
  271. }
  272. .title {
  273. display: flex;
  274. align-items: center;
  275. border-radius: 10rpx;
  276. margin-bottom: 50rpx;
  277. box-shadow: rgba(0, 0, 0, 0.35) 0rpx 5rpx 15rpx;
  278. .logo {
  279. image {
  280. width: 200rpx;
  281. height: 100rpx;
  282. margin: 0 30rpx;
  283. }
  284. }
  285. }
  286. .baseInfo {
  287. margin-bottom: 50rpx;
  288. .card-title {
  289. padding: 20rpx 20rpx 0rpx 20rpx;
  290. font-weight: 600;
  291. }
  292. .item-list {
  293. margin-left: 20rpx;
  294. display: flex;
  295. flex-direction: column;
  296. .term {
  297. display: flex;
  298. .term-name {
  299. font-size: 27rpx;
  300. width: 30%;
  301. display: flex;
  302. margin: 20rpx;
  303. color: #7f7f7f;
  304. }
  305. .term-value-group {
  306. flex: 1;
  307. display: flex;
  308. flex-direction: column;
  309. font-size: 27rpx;
  310. .term-value-item {
  311. margin: 20rpx;
  312. }
  313. .flex_i {
  314. display: flex;
  315. flex-flow: row;
  316. justify-content: space-around;
  317. }
  318. }
  319. }
  320. }
  321. }
  322. .proInfo {
  323. font-size: 25rpx;
  324. .products {
  325. width: 100%;
  326. display: flex;
  327. padding: 4%;
  328. flex-wrap: wrap;
  329. .product {
  330. margin: 2%;
  331. padding: 2%;
  332. border-radius: 30rpx;
  333. box-shadow: rgba(0, 0, 0, 0.35) 0rpx 5rpx 15rpx;
  334. width: 40%;
  335. height: 100px;
  336. display: flex;
  337. flex-flow: column;
  338. justify-content: space-between;
  339. align-items: center;
  340. .img {
  341. width: 200rpx;
  342. height: 200rpx;
  343. image {
  344. width: 200rpx;
  345. height: 200rpx;
  346. }
  347. }
  348. }
  349. }
  350. }
  351. .enterprise-item-box {
  352. display: flex;
  353. justify-content: space-evenly;
  354. margin: 0 20rpx;
  355. margin-top: 10rpx;
  356. .enterprise-item-name {
  357. padding-bottom: 10rpx;
  358. font-size: 27rpx;
  359. }
  360. .active {
  361. font-weight: 600;
  362. border-bottom: 7rpx solid #02a7f0;
  363. }
  364. }
  365. }
  366. .margin-bottom-80 {
  367. margin-bottom: 80rpx;
  368. }
  369. </style>