instrument-details.vue 16 KB

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