instrument-details.vue 18 KB

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