instrument-details.vue 18 KB

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