instrument-details.vue 17 KB

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