instrument-details.vue 15 KB

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