instrument-details.vue 18 KB

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