detail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <div class="content" v-if="isShow">
  3. <div class="title">
  4. <div class="logo">
  5. <img :src="shareBaseUrl + info.pic_url" alt="" class="logo-img" />
  6. </div>
  7. <div class="name">
  8. {{ info.name || "-" }}
  9. </div>
  10. </div>
  11. <div class="enterprise-item-box">
  12. <div
  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. </div>
  21. </div>
  22. <div class="baseInfo" v-if="active === 0">
  23. <div class="card-title">{{ model.title }}</div>
  24. <div class="item-list">
  25. <div v-for="(item, idx) in model.item" :key="idx" class="term">
  26. <div class="term-name">{{ item.name }}:</div>
  27. <div class="term-value-group" v-if="item.name !== '网址'">
  28. <p v-for="(value, idx) in item.value" :key="idx" class="term-value-item" :class="{ blue: item.name === '电话' }" @click="callPhone">
  29. {{ value || "-" }}
  30. </p>
  31. </div>
  32. <div class="term-value-group" v-else style="flex-direction: row; align-items: center;padding-left: 10px;">
  33. <div class="flex_i">
  34. <div>
  35. {{ item.value[0] || "-" }}
  36. </div>
  37. <div
  38. v-if="item.value[0]"
  39. class="copy"
  40. @click="copy(item.value[0])"
  41. style="color: #02a7f0; margin-left: 7px"
  42. >复制</div
  43. >
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. <div v-else-if="active === 1" class="proInfo">
  50. <div class="products">
  51. <div class="product" v-for="(item, idx) in productList" :key="idx" @click="goProductDetail(item.id,item.pic_url)">
  52. <div class="img">
  53. <img :src="item.pic_url" />
  54. </div>
  55. <div class="name">{{ item.name || "-" }}</div>
  56. </div>
  57. </div>
  58. <div v-if="productList.length === 0" class="products">
  59. <img src="../../assets/default.png" alt="" />
  60. <div style="margin: 0 auto">暂无产品信息</div>
  61. </div>
  62. </div>
  63. </div>
  64. </template>
  65. <script>
  66. export default {
  67. components: {
  68. },
  69. data() {
  70. return {
  71. titleList: ["基本信息", "产品信息"],
  72. active: 0,
  73. info: {},
  74. model: {},
  75. productList: [],
  76. isShow: false,
  77. infoObj: {},
  78. pageId:'',
  79. shareBaseUrl:"https://kiq.xazhima.com/",
  80. companyLogo:'',
  81. companyName:''
  82. };
  83. },
  84. computed: {},
  85. watch: {},
  86. methods: {
  87. callPhone(value) {
  88. },
  89. change(idx) {
  90. this.active = idx;
  91. },
  92. goProductDetail(id,imgUrl){
  93. this.$router.push({ path: '/company/productDetail', query: { id: id, imgUrl: imgUrl, logo:this.companyLogo, name:this.companyName }})
  94. },
  95. getCompanyInfo(id) {
  96. let that = this;
  97. that.$api.totalApi.byIdApi(id,'common','company','info_by_id',0).then(res=>{
  98. if (res.data.code === 200) {
  99. this.infoObj = res.data.data;
  100. let {
  101. name,
  102. pic_url,
  103. representative,
  104. found_date,
  105. capital,
  106. code,
  107. industry_name,
  108. park_name,
  109. work_address,
  110. rigiser_address,
  111. web_url,
  112. phone,
  113. work_range,
  114. } = res.data.data;
  115. this.info = {
  116. name,
  117. pic_url,
  118. representative,
  119. found_date,
  120. capital,
  121. code,
  122. industry_name,
  123. park_name,
  124. work_address,
  125. rigiser_address,
  126. web_url,
  127. phone,
  128. work_range,
  129. };
  130. this.info.capital = this.info.capital + '万元'
  131. this.model = {
  132. title: "",
  133. item: [
  134. {
  135. name: "法定代表人",
  136. value: [this.info.representative],
  137. },
  138. {
  139. name: "成立日期",
  140. value: [this.info.found_date],
  141. },
  142. {
  143. name: "注册资本",
  144. value: [this.info.capital],
  145. },
  146. {
  147. name: "统一社会信用代码",
  148. value: [this.info.code],
  149. },
  150. {
  151. name: "所属行业",
  152. value: [this.info.industry_name],
  153. },
  154. {
  155. name: "所属园区",
  156. value: [this.info.park_name],
  157. },
  158. {
  159. name: "经营范围",
  160. value: [this.info.work_range],
  161. },
  162. {
  163. name: "地址",
  164. value: [this.info.rigiser_address],
  165. },
  166. {
  167. name: "网址",
  168. value: [this.info.web_url],
  169. },
  170. {
  171. name: "电话",
  172. value: [this.info.phone],
  173. },
  174. ],
  175. };
  176. this.companyLogo = this.info.pic_url ? this.shareBaseUrl + this.info.pic_url : require('../../assets/default.png');
  177. this.companyName = this.info.name;
  178. this.isShow = true;
  179. }
  180. })
  181. },
  182. getProductInfo(id) {
  183. let that = this;
  184. that.$api.totalApi.byIdApi(id,'common','company_product','list',1).then(res=>{
  185. if (res.data.code === 200) {
  186. let list = res.data.data.list;
  187. list.forEach((e, i) => {
  188. e.pic_url = e.pic_url ? this.shareBaseUrl + e.pic_url : require('../../assets/default.png')
  189. });
  190. this.productList = list;
  191. console.log(this.productList);
  192. }
  193. })
  194. },
  195. },
  196. //生命周期 - 创建完成(可以访问当前this实例)
  197. created() {
  198. },
  199. //生命周期 - 挂载完成(可以访问DOM元素)
  200. mounted() {
  201. this.getCompanyInfo(this.$route.query.id)
  202. this.getProductInfo(this.$route.query.id)
  203. },
  204. }
  205. </script>
  206. <style scoped>
  207. .content {
  208. padding: 4%;
  209. font-size: 16px;
  210. }
  211. .blue {
  212. color: #02a7f0;
  213. }
  214. .title {
  215. display: flex;
  216. align-items: center;
  217. border-radius: 5px;
  218. margin-bottom: 25px;
  219. box-shadow: rgba(0, 0, 0, 0.35) 0 3px 7px;
  220. height: 75px;
  221. padding: 0 10px;
  222. }
  223. .logo {
  224. width: 75px;
  225. height: 50px;
  226. }
  227. .logo-img {
  228. max-width: 100%;
  229. max-height: 100%;
  230. }
  231. .name{
  232. /*margin-left: 15px;*/
  233. }
  234. .baseInfo {
  235. margin-bottom: 25px;
  236. }
  237. .card-title {
  238. padding: 10px 10px 0 10px;
  239. font-weight: 600;
  240. }
  241. .item-list {
  242. margin-left: 10px;
  243. display: flex;
  244. flex-direction: column;
  245. }
  246. .term {
  247. display: flex;
  248. }
  249. .term-name {
  250. font-size: 14px;
  251. width: 35%;
  252. display: flex;
  253. margin: 10px;
  254. color: #7f7f7f;
  255. }
  256. .term-value-group {
  257. flex: 1;
  258. display: flex;
  259. flex-direction: column;
  260. font-size: 14px;
  261. }
  262. .term-value-item {
  263. margin: 10px;
  264. text-align: left;
  265. }
  266. .flex_i {
  267. display: flex;
  268. flex-flow: row;
  269. justify-content: space-around;
  270. }
  271. .proInfo {
  272. font-size:15px;
  273. }
  274. .products {
  275. width: 93%;
  276. display: flex;
  277. padding: 4%;
  278. flex-wrap: wrap;
  279. }
  280. .product {
  281. margin: 2%;
  282. padding: 2%;
  283. border-radius: 15px;
  284. box-shadow: rgba(0, 0, 0, 0.35) 0 3px 7px;
  285. width: 40%;
  286. height: 110px;
  287. display: flex;
  288. flex-flow: column;
  289. justify-content: space-between;
  290. align-items: center;
  291. }
  292. .img {
  293. width: 90px;
  294. /*height: 100px;*/
  295. }
  296. .img img {
  297. width: 100%;
  298. height: 90%;
  299. }
  300. .enterprise-item-box {
  301. display: flex;
  302. justify-content: space-evenly;
  303. margin: 0 5px;
  304. margin-top: 5px;
  305. }
  306. .enterprise-item-name {
  307. padding-bottom: 5px;
  308. font-size: 14px;
  309. }
  310. .active {
  311. font-weight: 600;
  312. border-bottom: 3px solid #02a7f0;
  313. }
  314. .margin-bottom-80 {
  315. margin-bottom: 40px;
  316. }
  317. </style>