instrument-details.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. <template>
  2. <view class="product">
  3. <custom-p v-if="isHeaderPoduct"
  4. :systeminfo='systeminfo'
  5. :navbar-data='nvabarData'
  6. :headerBtnPosi ="headerBtnPosi"
  7. :headerColor="headerColor"
  8. :type="isShareType"
  9. :page='backPage'>
  10. </custom-p>
  11. <tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading ="true" :loadingType="5"></tui-skeleton>
  12. <view class="container-product tui-skeleton">
  13. <view class="product-top">
  14. <view class="banner-section">
  15. <uni-swiper-dot :info="productImage" :current="current" field="content" :mode="mode" >
  16. <swiper class="banner tui-banner tui-skeleton-rect" @change="swiperChange" :duration='800' :autoplay="false" :circular="true" >
  17. <swiper-item v-for="(item, index) in productImage" :key="index" class="banner-item">
  18. <image :src="item" @click="previewImg(index)" class="product-img" />
  19. </swiper-item>
  20. </swiper>
  21. <view class="swiper__dots-box">
  22. <tui-tag padding="12rpx 24rpx" type="translucent" shape="circleLeft" size="32rpx" :scaleMultiple="0.82" originRight>{{ current + 1 }}/{{ productImage.length }}</tui-tag>
  23. </view>
  24. </uni-swiper-dot>
  25. </view>
  26. <view class="product-parameter" @click="showPopup">
  27. <view class="view">
  28. <text class="title">仪器信息</text>
  29. <text class="iconfont icon-xiangyou"></text>
  30. </view>
  31. </view>
  32. <view class="product-message clearfix">
  33. <view class="msg-pin clearfix" v-for="(label, idx) in firstFloorList" :key="idx">
  34. <view class="label">{{ label.name }}:</view>
  35. <view class="label-li">
  36. <text>{{ label.content ? label.content : '暂无' }}</text>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="product-details">
  42. <view class="navbar">
  43. <view class="nav-item tui-skeleton-fillet" v-for="(tab, index) in crmDetailList" :key="index" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">
  44. <text>{{ tab.name }}</text>
  45. <text class="line"></text>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="product-details service" v-show="tabCurrentIndex == 0">
  50. <view class="content tui-banner product-rich-text tui-skeleton-rect">
  51. <mp-html :content="html" :tag-style="tagStyle" />
  52. </view>
  53. </view>
  54. <view class="product-details service" v-show="tabCurrentIndex == 1">
  55. <view class="content service" v-if="crmDetailList[tabCurrentIndex].content">
  56. {{ crmDetailList[tabCurrentIndex].content ? crmDetailList[tabCurrentIndex].content : '' }}
  57. </view>
  58. <view class="content service">
  59. <view class="content-none">暂无内容</view>
  60. </view>
  61. </view>
  62. <view class="product-details service" v-show="tabCurrentIndex == 2">
  63. <view class="content service" v-if="crmDetailList[tabCurrentIndex].content">
  64. {{ crmDetailList[tabCurrentIndex].content ? crmDetailList[tabCurrentIndex].content : '' }}
  65. </view>
  66. <view class="content service">
  67. <view class="content-none">暂无内容</view>
  68. </view>
  69. </view>
  70. <view class="product-details recommend">
  71. <!-- 相关推荐 -->
  72. <view class="instrument-recommend-cell" v-for="(floor, index) in floorList" :key="index">
  73. <view class="title">
  74. <view class="title-tab">{{ floor.title }}</view>
  75. </view>
  76. <view class="content hot">
  77. <recommend :list="floor.floorData" v-if="isRequest"></recommend>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="product-details contact clearfix">
  82. <!-- 联系 -->
  83. <view class="instrument-contact-title">
  84. <image src="https://static.caimei365.com/app/img/icon/icon-title-bg.png" mode=""></image>
  85. </view>
  86. <view class="instrument-contact-cell">
  87. <view class="cell-icon">
  88. <image src="https://static.caimei365.com/app/img/icon/icon-kefus.png" mode=""></image>
  89. </view>
  90. <view class="cell-text">
  91. <view class="cell-text-p">0755-22907771转806</view>
  92. <view class="cell-text-p">15338851365</view>
  93. </view>
  94. </view>
  95. <view class="instrument-contact-cell">
  96. <view class="cell-icon">
  97. <image src="https://static.caimei365.com/app/img/icon/icon-phone.png" mode=""></image>
  98. </view>
  99. <view class="cell-text">
  100. <view class="cell-text-p">产品设备:18948339365</view>
  101. <view class="cell-text-p">商务合作:17318032647</view>
  102. </view>
  103. </view>
  104. </view>
  105. <!-- 仪器信息 -->
  106. <tui-bottom-popup :radius="true" :show="popupShow" @close="hidePopup()">
  107. <view class="tui-popup-box clearfix">
  108. <view class="title">{{ secondFloorList[0].name }}</view>
  109. <view class="content">
  110. <view class="content-tr" v-for="(item, index) in secondFloorList" :key="index">
  111. <view class="content-td">{{ item.name }}:</view>
  112. <view class="content-th">{{ item.content ? item.content : '暂无' }}</view>
  113. </view>
  114. </view>
  115. <view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom :isIphoneX ? '68rpx' : '0rpx' }">
  116. <view class="tui-flex-1">
  117. <view class="tui-button" @click="hidePopup()">收起</view>
  118. </view>
  119. </view>
  120. </view>
  121. </tui-bottom-popup>
  122. <!-- 侧边 -->
  123. <scroll-top :isScrollTop="isScrollTop" :bottom="200"></scroll-top>
  124. </view>
  125. </view>
  126. </template>
  127. <script>
  128. import { mapState,mapMutations } from 'vuex'
  129. import authorize from '@/common/config/authorize.js'
  130. import customP from '@/components/cm-custom/custom-p.vue' //自定义导航
  131. import recommend from "./components/instrument-recommend" //相关推荐
  132. import wxLogin from "@/common/config/wxLogin.js"
  133. import { productTagStyle } from '@/plugins/mp-html/config.js'
  134. var isPreviewImg;
  135. export default{
  136. components:{
  137. customP,
  138. recommend,
  139. },
  140. data(){
  141. return{
  142. html:'<div style="text-align: center;color:#333333;">暂无内容</div>',
  143. tagStyle: productTagStyle,
  144. disabledTabNavList:[{name:'相关推荐'}],
  145. mode:'round',
  146. iconClass:'icon-aixin',
  147. iconColor:'#ff9100',
  148. specClass: '',//规格弹窗css类,控制开关动画
  149. isBtnType:'',
  150. isRequest:false,
  151. isScrollTop:false,
  152. current:0,
  153. isShareType:'',
  154. isHeaderPoduct:false,
  155. isRecommend:false,
  156. isRarameter:true,
  157. isService:false,
  158. isEvaluate:false,
  159. skeletonShow:true,
  160. tabCurrentIndex:0,
  161. userID:'',
  162. equipmentId:0,
  163. userIdentity:'',//用户类型
  164. productImage:[],
  165. floorList:[],
  166. secondFloorList:[],//仪器信息
  167. firstFloorList:[],//项目基本信息
  168. crmDetailList:[],//项目详情
  169. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  170. systeminfo: this.setSysteminfo(), //获取设备信息
  171. isIphoneX:this.$store.state.isIphoneX,
  172. windowHeight: '',
  173. headerColor:false,
  174. backPage:1,
  175. nvabarData: { //顶部自定义导航
  176. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示
  177. title: '' // 导航栏 中间的标题
  178. },
  179. linkPath:'',
  180. popupShow:false,//参数弹窗
  181. description:''
  182. }
  183. },
  184. computed: {
  185. ...mapState(['hasLogin','isWxAuthorize'])
  186. },
  187. onLoad(option) {
  188. this.equipmentId = option.id;//获取商品ID
  189. this.isShareType = option.type
  190. this.linkPath = option.path
  191. this.isHeaderPoduct = true
  192. if(option.page == 2){
  193. this.backPage = option.page
  194. }
  195. if(this.isShareType =='share'){
  196. wxLogin.wxLoginAuthorize()
  197. }
  198. },
  199. methods:{
  200. initData(){// 初始化商品详情查询
  201. this.ProductService.GetEquipmentDetails({equipmentId:this.equipmentId}).then(response =>{
  202. let data = response.data
  203. let pageMap = data.pageContentMap
  204. this.description = pageMap.description
  205. this.secondFloorList = pageMap.secondFloorList
  206. this.firstFloorList = pageMap.firstFloorList
  207. this.crmDetailList = pageMap.pcDetailList
  208. this.html = this.$api.adaptRichTextImg(this.crmDetailList[0].content)
  209. this.floorList = data.floorList
  210. this.skeletonShow = false
  211. this.productImage=[];
  212. this.productImage.push(data.image);
  213. console.log(this.productImage)
  214. this.isRequest = true
  215. }).catch(error =>{
  216. this.$util.msg(error.msg,2000);
  217. })
  218. },
  219. swiperChange(e) {//顶部商品图片切换
  220. const index = e.detail.current;
  221. this.current = index;
  222. },
  223. previewImg (index) {//顶部商品图片预览
  224. isPreviewImg = true
  225. let previewUrls = this.productImage
  226. uni.previewImage({
  227. current: index, //图片索引
  228. urls: previewUrls, //必须是http图片,本地图片无效
  229. longPressActions:''
  230. })
  231. },
  232. tabClick(index) {//商品详情&&供应商信息tab切换
  233. console.log(index)
  234. this.tabCurrentIndex = index;
  235. switch(index){
  236. case 1:
  237. this.isRarameter = true
  238. break;
  239. case 2:
  240. this.isService = true
  241. break;
  242. case 3:
  243. this.isRecommend = true
  244. break;
  245. }
  246. },
  247. setHeaderBtnPosi(){
  248. // 获得胶囊按钮位置信息
  249. let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
  250. return headerBtnPosi
  251. },
  252. setSysteminfo(){
  253. let systeminfo;
  254. uni.getSystemInfo({ // 获取设备信息
  255. success: (res) => {
  256. systeminfo = res
  257. },
  258. })
  259. return systeminfo
  260. },
  261. showPopup(){
  262. this.popupShow = true
  263. },
  264. hidePopup(){
  265. this.popupShow = false
  266. }
  267. },
  268. onPageScroll(e){//实时获取到滚动的值
  269. if(e.scrollTop>50){
  270. this.headerColor = true
  271. this.nvabarData={
  272. showCapsule: 1,
  273. title: '商品详情',
  274. }
  275. }else{
  276. this.headerColor = false
  277. this.nvabarData={
  278. showCapsule: 1,
  279. title: '',
  280. }
  281. }
  282. if(e.scrollTop>700){
  283. this.isScrollTop = true
  284. }else{
  285. this.isScrollTop = false
  286. }
  287. },
  288. onShareAppMessage(res){//分享转发
  289. if (res.from === 'button') {
  290. // 来自页面内转发按钮
  291. }
  292. return {
  293. title: `${this.description}`,
  294. path: `pages/goods/instrument-details?id=${this.equipmentId}`,
  295. imageUrl:`${this.productImage[0]}`
  296. }
  297. },
  298. onShow() {
  299. this.$api.getStorage().then((resolve) => {
  300. this.userID = resolve.userId ? resolve.userId : '';
  301. this.userIdentity = resolve.userIdentity ? resolve.userIdentity : 3
  302. if (isPreviewImg) {
  303. isPreviewImg = false;
  304. return;
  305. } else {
  306. this.initData();
  307. }
  308. }).catch(error =>{
  309. this.initData();
  310. })
  311. }
  312. }
  313. </script>
  314. <style lang="scss">
  315. page{
  316. background-color: #FFFFFF;
  317. }
  318. .productRemarks{
  319. height: 36rpx;
  320. margin: 8rpx 0;
  321. width: 100%;
  322. float: left;
  323. .text{
  324. display: inline-block;
  325. padding: 0 18rpx;
  326. line-height: 32rpx;
  327. font-size: 20rpx;
  328. color: #FF2A2A;
  329. text-align: center;
  330. border-radius: 4rpx;
  331. background: #FFFFFF;
  332. border: 1px solid #FF2A2A;
  333. float: left;
  334. opacity: 0.8;
  335. }
  336. }
  337. .banner-section{
  338. width: 100%;
  339. height: 750rpx;
  340. position: relative;
  341. }
  342. .banner{
  343. width: 100%;
  344. height: 750rpx;
  345. .product-img{
  346. width: 750rpx;
  347. }
  348. image {
  349. width: 100%;
  350. height: 100%;
  351. }
  352. }
  353. .swiper__dots-box{
  354. position: absolute;
  355. color: #fff;
  356. bottom: 30rpx;
  357. right: 0;
  358. }
  359. .product-message{
  360. width: 100%;
  361. height: auto;
  362. box-sizing: border-box;
  363. padding: 0 24rpx;
  364. margin-top: 24rpx;
  365. .msg-pin{
  366. width: 100%;
  367. height: auto;
  368. margin-bottom: 16rpx;
  369. .label{
  370. float: left;
  371. line-height: 48rpx;
  372. font-size: $font-size-28;
  373. color: #999999;
  374. }
  375. .label-li{
  376. width: 568rpx;
  377. float: left;
  378. line-height: 48rpx;
  379. font-size: $font-size-28;
  380. color: #333333;
  381. margin-left: 10rpx;
  382. }
  383. }
  384. }
  385. .product-parameter{
  386. width: 100%;
  387. height: 90rpx;
  388. padding: 0 24rpx;
  389. box-sizing: border-box;
  390. background-color: #FFFFFF;
  391. position: relative;
  392. display: flex;
  393. margin-top: 24rpx;
  394. .view{
  395. width: 100%;
  396. height: 90rpx;
  397. background-color: #fef6f3;
  398. position: relative;
  399. display: flex;
  400. padding: 0 20rpx;
  401. .title{
  402. line-height: 90rpx;
  403. display: inline-block;
  404. float: left;
  405. font-size: $font-size-28;
  406. color: $color-system;
  407. }
  408. .icon-xiangyou{
  409. line-height: 90rpx;
  410. display: inline-block;
  411. position: absolute;
  412. width: 48rpx;
  413. top: 0;
  414. right: 0;
  415. color: $color-system;
  416. }
  417. }
  418. }
  419. .product-details {
  420. width: 100%;
  421. background: #FFFFFF;
  422. .content{
  423. &.service{
  424. text-align: justify;
  425. font-size: $font-size-26;
  426. color: #666666;
  427. }
  428. .content-none{
  429. width: 100%;
  430. height: 80rpx;
  431. line-height: 80rpx;
  432. font-size: $font-size-26;
  433. color: #999999;
  434. text-align: center;
  435. }
  436. }
  437. &.recommend{
  438. background-color: #F7F7F7;
  439. border-bottom: none;
  440. .title{
  441. .title-tab{
  442. background-color: #F7F7F7;
  443. color: $text-color;
  444. }
  445. }
  446. }
  447. &.contact{
  448. width: 100%;
  449. box-sizing: border-box;
  450. background-color: #FFFFFF;
  451. padding:24rpx;
  452. .instrument-contact-title{
  453. width: 100%;
  454. height: 40rpx;
  455. margin-bottom: 30rpx;
  456. image{
  457. width: 100%;
  458. height: 100%;
  459. display: block;
  460. }
  461. }
  462. .instrument-contact-cell{
  463. width: 100%;
  464. height: 72rpx;
  465. float: left;
  466. box-sizing: border-box;
  467. padding: 0 150rpx;
  468. margin-bottom: 24rpx;
  469. .cell-icon{
  470. width: 72rpx;
  471. height: 72rpx;
  472. float: left;
  473. image{
  474. width: 100%;
  475. height: 100%;
  476. display: block;
  477. }
  478. }
  479. .cell-text{
  480. width: 330rpx;
  481. height: 72rpx;
  482. float: left;
  483. box-sizing: border-box;
  484. padding-left: 15rpx;
  485. .cell-text-p{
  486. width: 100%;
  487. height: 36rpx;
  488. line-height: 36rpx;
  489. font-size: $font-size-24;
  490. color: $text-color;
  491. text-align: left;
  492. float: left;
  493. }
  494. }
  495. }
  496. }
  497. .title{
  498. width: 100%;
  499. box-sizing: border-box;
  500. padding: 0 24rpx;
  501. .title-tab{
  502. width: 100%;
  503. height: 100rpx;
  504. background: #fff;
  505. z-index: 10;
  506. font-size: $font-size-30;
  507. text-align: center;
  508. color: $text-color;
  509. line-height: 100rpx;
  510. font-weight: 600;
  511. }
  512. .title-msg{
  513. width: 100%;
  514. height: 236rpx;
  515. padding: 18rpx;
  516. background-color: rgba(225,86,22, 0.1);
  517. color: $color-system;
  518. box-sizing: border-box;
  519. margin-bottom: 30rpx;
  520. .tit{
  521. line-height: 46rpx;
  522. font-size: $font-size-24;
  523. text-align: left;
  524. }
  525. .txt{
  526. line-height: 38rpx;
  527. font-size: $font-size-20;
  528. text-align: justify;
  529. }
  530. }
  531. }
  532. .navbar {
  533. width: 702rpx;
  534. height: 96rpx;
  535. padding: 0 24rpx;
  536. background: #fff;
  537. z-index: 10;
  538. display: flex;
  539. border-top: 20rpx solid #F7F7F7;
  540. padding-bottom: 20rpx;
  541. &.fixed{
  542. position: fixed;
  543. left: 0;
  544. }
  545. .nav-item {
  546. display: flex;
  547. justify-content: center;
  548. align-items: center;
  549. height: 96rpx;
  550. font-size: $font-size-28;
  551. color: $text-color;
  552. position: relative;
  553. float: left;
  554. position: relative;
  555. padding: 0 15rpx;
  556. margin-right: 20rpx;
  557. .line{
  558. width: 40rpx;
  559. height: 2px;
  560. border-radius: 1px;
  561. background: #FFFFFF;
  562. position: absolute;
  563. bottom: 0;
  564. left: 50%;
  565. margin-left: -20rpx;
  566. }
  567. &.current{
  568. color:$color-system;
  569. font-weight: bold;
  570. .line{
  571. background: $color-system;
  572. }
  573. }
  574. }
  575. }
  576. .content{
  577. width: 100%;
  578. background-color: #FFFFFF;
  579. }
  580. }
  581. .isLower{
  582. width: 100%;
  583. height: 116rpx;
  584. line-height: 116rpx;
  585. text-align: center;
  586. color: #000000;
  587. font-size: $font-size-32;
  588. font-weight: bold;
  589. }
  590. .uni-badge--small {
  591. -webkit-transform: scale(.8);
  592. -ms-transform: scale(.8);
  593. transform: scale(.8);
  594. -webkit-transform-origin: center center;
  595. -ms-transform-origin: center center;
  596. transform-origin: center center;
  597. }
  598. .uni-badge {
  599. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  600. -webkit-box-sizing: border-box;
  601. box-sizing: border-box;
  602. font-size: 12px;
  603. line-height: 1;
  604. display: inline-block;
  605. padding: 3px 6px;
  606. color: #333;
  607. border-radius: 100px;
  608. background-color: #f1f1f1;
  609. }
  610. .uni-badge-error {
  611. color: #fff;
  612. background-color: #dd524d;
  613. }
  614. .tui-popup-box {
  615. position: relative;
  616. box-sizing: border-box;
  617. min-height: 220rpx;
  618. padding:0rpx 55rpx;
  619. .title{
  620. font-size: $font-size-34;
  621. color: $text-color;
  622. line-height: 88rpx;
  623. text-align: center;
  624. float: left;
  625. width: 100%;
  626. height: 88rpx;
  627. }
  628. .content{
  629. width: 100%;
  630. height: auto;
  631. float: left;
  632. .content-tr{
  633. width: 100%;
  634. height: auto;
  635. line-height: 58rpx;
  636. display: flex;
  637. .content-td{
  638. display: flex;
  639. font-size: $font-size-28;
  640. color: #999999;
  641. line-height: 58rpx;
  642. text-align: left;
  643. }
  644. .content-th{
  645. display: flex;
  646. flex: 7;
  647. font-size: $font-size-28;
  648. color: #666666;
  649. line-height: 58rpx;
  650. text-align: left;
  651. padding-left: 20rpx;
  652. box-sizing: border-box;
  653. }
  654. }
  655. }
  656. }
  657. .tui-popup-btn {
  658. width: 100%;
  659. height: auto;
  660. float: left;
  661. margin-top: 24rpx;
  662. .tui-button{
  663. width: 100%;
  664. height: 88rpx;
  665. background: $btn-confirm;
  666. line-height: 88rpx;
  667. text-align: center;
  668. color: #FFFFFF;
  669. font-size: $font-size-28;
  670. border-radius: 44rpx;
  671. }
  672. }
  673. /*富文本样式*/
  674. rich-text.p{
  675. width: 702rpx !important;
  676. padding: 0 24rpx;
  677. text-align: justify;
  678. }
  679. rich-text.img{
  680. width: 100%;
  681. height: auto;
  682. }
  683. </style>