packageDetails.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  1. <template>
  2. <view class="content">
  3. <!-- <view class="img-box" @click="showImg()">
  4. <image :src="item.imgUrl"></image>
  5. </view> -->
  6. <view class="cont-box">
  7. <view class="goods-banner" @click="showImg()">
  8. <swiper
  9. class="swiper"
  10. :indicator-dots="false"
  11. :circular="true"
  12. :autoplay="true"
  13. :interval="3000"
  14. :duration="1000"
  15. indicator-color="rgba(255, 255, 255, 0.6)"
  16. indicator-active-color="#ffffff"
  17. @change="swiperChange"
  18. >
  19. <swiper-item class="swiper-item" v-for="(item,index) in imgs" :key="index">
  20. <image :src="item" mode="aspectFit"></image>
  21. </swiper-item>
  22. </swiper>
  23. <!-- 数量 -->
  24. <view class="num-box">{{ activeImg }}/{{ imgs.length }}</view>
  25. </view>
  26. <view class="package-box">
  27. <view class="title">{{item.packageName}}</view>
  28. <view class="desc">
  29. <view class="cycle" v-if="item.cycle>0">服务周期{{item.cycle}}天</view>
  30. <view class="duration" v-if="item.duration>0">签约时长{{item.duration}}天</view>
  31. </view>
  32. <view class="num-box">
  33. <view class="price-box">
  34. <view class="price" v-if="item!=null">¥{{item.price.toFixed(2)}}元/日</view>
  35. <view class="price" v-if="item!=null&&item.packageSubType==1">咨询包</view>
  36. <view class="price" v-if="item!=null&&item.packageSubType==2">治疗包</view>
  37. <view class="price" v-if="item!=null&&item.packageSubType==3">产品包</view>
  38. </view>
  39. <view class="count">{{item.sales}}人已购</view>
  40. </view>
  41. </view>
  42. <view class="drug-box" v-if="products.length>0 ">
  43. <view class="title-box">
  44. <view class="line"></view>
  45. <view class="title">产品列表</view>
  46. </view>
  47. <view class="drug-list" >
  48. <view v-for="(product,index) in products" class="drug-item" >
  49. <view class="drug" v-if="displayMore==0?index<2:true" >
  50. <view class="img-box">
  51. <image :src="product.image" mode="aspectFill"></image>
  52. </view>
  53. <view class="drug-info" >
  54. <view>
  55. <view class="name-box ellipsis2">
  56. {{product.productName}}
  57. </view>
  58. <view class="spec">{{product.sku}}</view>
  59. </view>
  60. <view class="num-box">
  61. <view class="use">
  62. {{product.usageMethod}}
  63. </view>
  64. <view class="price">
  65. <!-- <text class="unit">¥</text>
  66. <text class="num">{{product.price.toFixed(2)}}</text> -->
  67. </view>
  68. <!-- <view class="amount">x{{product.count}}</view> -->
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <view v-if="products.length>2" class="display-more" @click="showMore()" >{{displayText}}</view>
  75. </view>
  76. <view class="desc-box" v-if="describe.use!=null">
  77. <view class="title-box">
  78. <view class="line"></view>
  79. <view class="title">疗程</view>
  80. </view>
  81. <view class="desc" v-if="describe!=null" v-html="describe.use">
  82. </view>
  83. </view>
  84. <view class="desc-box" v-if="item.indication!=null">
  85. <view class="title-box">
  86. <view class="line"></view>
  87. <view class="title">功能主治</view>
  88. </view>
  89. <view class="desc" v-if="item!=null" v-html="item.indication">
  90. </view>
  91. </view>
  92. <view class="desc-box" v-if="describe.usageMethod!=null">
  93. <view class="title-box">
  94. <view class="line"></view>
  95. <view class="title">服用/使用方式</view>
  96. </view>
  97. <view class="desc" v-html="describe.usageMethod">
  98. </view>
  99. </view>
  100. <view class="desc-box" v-if="describe.forPeople!=null">
  101. <view class="title-box">
  102. <view class="line"></view>
  103. <view class="title">适宜人群</view>
  104. </view>
  105. <view class="desc" v-html="describe.forPeople">
  106. </view>
  107. </view>
  108. <view class="desc-box" v-if="describe.tabooPeople!=null">
  109. <view class="title-box">
  110. <view class="line"></view>
  111. <view class="title">禁忌人群</view>
  112. </view>
  113. <view class="desc" v-html="describe.tabooPeople">
  114. </view>
  115. </view>
  116. <view class="desc-box" v-if="item.explain!=null">
  117. <view class="title-box">
  118. <view class="line"></view>
  119. <view class="title">方解/搭配优势</view>
  120. </view>
  121. <view class="desc" v-html="item.explain">
  122. </view>
  123. </view>
  124. <view class="desc-box">
  125. <view class="title-box">
  126. <view class="line"></view>
  127. <view class="title">疗法详情</view>
  128. </view>
  129. <view class="desc" v-html="item.desc">
  130. </view>
  131. </view>
  132. </view>
  133. <view class="btn-foot">
  134. <view class="p-price-box">
  135. <view class="p-name">¥</view>
  136. <view class="p-price" v-if="item!=null">{{item.totalPrice.toFixed(2)}}</view>
  137. </view>
  138. <view class="btn-box">
  139. <view class="btn buy" >
  140. 分享
  141. <button class="contact-btn" data-name="shareBtn" open-type="share">分享</button>
  142. </view>
  143. </view>
  144. </view>
  145. </view>
  146. </template>
  147. <script>
  148. import {getPackageById,getPackageDoctorList} from '@/api/package.js'
  149. export default {
  150. data() {
  151. return {
  152. displayText:"查看更多",
  153. displayMore:0,
  154. imgs:[],
  155. activeImg: 1,
  156. doctorShow:false,
  157. doctors:[],
  158. products:[],
  159. packageId:null,
  160. item:{},
  161. describe:null,
  162. doctorId:null,
  163. doctorPageNum:1,
  164. doctorLastPage:false,
  165. doctorTotal:0
  166. };
  167. },
  168. onLoad(option) {
  169. this.packageId=option.packageId;
  170. this.companyId=uni.getStorageSync('companyId');
  171. this.companyUserId=uni.getStorageSync('companyUserId');
  172. },
  173. onShow() {
  174. this.getPackageById();
  175. this.getPackageDoctorList();
  176. },
  177. onShareAppMessage(res) {
  178. return {
  179. title: this.item.packageName,
  180. path: '/pages_index/packageDetails?packageId='+this.packageId+"&companyId="+this.companyId+"&companyUserId="+this.companyUserId,
  181. imageUrl: this.item.imgUrl //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  182. }
  183. },
  184. methods:{
  185. showMore(){
  186. this.displayMore=this.displayMore==1?0:1;
  187. this.displayText=this.displayMore==1?'收起':'查看更多'
  188. console.log(this.displayText)
  189. },
  190. swiperChange(event) {
  191. this.activeImg = event.detail.current + 1
  192. },
  193. handleDoctorClick(item){
  194. this.doctorShow=false;
  195. this.doctorId=item.doctorId
  196. uni.navigateTo({
  197. url:"/pages_index/packageForm?packageId="+this.packageId+"&doctorId="+this.doctorId
  198. })
  199. },
  200. lower(event) {
  201. if(this.doctorTotal>this.doctors.length){
  202. this.doctorPageNum++;
  203. this.getPackageDoctorList();
  204. }
  205. },
  206. doctorOpen(){
  207. this.doctorShow=true;
  208. },
  209. doctorClose(){
  210. this.doctorShow=false;
  211. },
  212. showImg() {
  213. //预览图片
  214. uni.previewImage({
  215. urls: this.imgs,
  216. current: this.imgs[0]
  217. });
  218. },
  219. getPackageDoctorList(){
  220. if(this.doctorLastPage){
  221. return;
  222. }
  223. var data = {
  224. packageId:this.packageId,
  225. pageNum: this.doctorPageNum,
  226. pageSize: 10
  227. };
  228. var that=this;
  229. getPackageDoctorList(data).then(
  230. res => {
  231. if(res.code==200){
  232. //设置列表数据
  233. if (this.doctorPageNum == 0) {
  234. that.doctors = res.data.list;
  235. } else {
  236. that.doctors = that.doctors.concat(res.data.list);
  237. }
  238. this.doctorLastPage=res.data.isLastPage;
  239. this.doctorTotal=res.data.total
  240. console.log(that.doctors)
  241. }else{
  242. uni.showToast({
  243. icon:'none',
  244. title: "请求失败",
  245. });
  246. }
  247. },
  248. rej => {}
  249. );
  250. },
  251. getPackageById(){
  252. let data = {packageId:this.packageId};
  253. getPackageById(data).then(
  254. res => {
  255. if(res.code==200){
  256. this.item=res.data;
  257. if(res.data.images!=null){
  258. this.imgs=res.data.images.split(",")
  259. }
  260. else{
  261. this.activeImg=0;
  262. }
  263. this.describe=JSON.parse(this.item.describeJson);
  264. if(this.item.productJson!=null){
  265. this.products=JSON.parse(this.item.productJson);
  266. }
  267. console.log(this.imgs)
  268. }else{
  269. uni.showToast({
  270. icon:'none',
  271. title: "请求失败",
  272. });
  273. }
  274. },
  275. rej => {}
  276. );
  277. },
  278. }
  279. }
  280. </script>
  281. <style lang="scss">
  282. page{
  283. height: 100%;
  284. }
  285. .content{
  286. height: 100%;
  287. display: flex;
  288. flex-direction: column;
  289. .cont-box{
  290. padding-bottom: 121rpx;
  291. .package-box{
  292. background-color: #fff;
  293. padding: 20rpx;
  294. width: 100%;
  295. display: flex;
  296. flex-direction: column;
  297. align-items: flex-start;
  298. justify-content: flex-start;
  299. .title{
  300. font-weight: bold;
  301. font-size: 34upx;
  302. font-family: PingFang SC;
  303. color: #111;
  304. }
  305. .desc{
  306. margin-top: 15rpx;
  307. display: flex;
  308. align-items: flex-start;
  309. justify-content: flex-start;
  310. .cycle{
  311. background-color: #eee;
  312. border-radius: 30rpx;
  313. padding: 5rpx 15rpx;
  314. font-size: 26upx;
  315. font-family: PingFang SC;
  316. color: #C39A58;
  317. }
  318. .duration{
  319. margin-left: 10rpx;
  320. background-color: #eee;
  321. border-radius: 30rpx;
  322. padding: 5rpx 15rpx;
  323. font-size: 26upx;
  324. font-family: PingFang SC;
  325. color: #C39A58;
  326. }
  327. }
  328. .num-box{
  329. margin-top: 15rpx;
  330. flex: 1;
  331. display: flex;
  332. align-items: flex-end;
  333. justify-content: space-between;
  334. width: 100%;
  335. .price-box{
  336. display: flex;
  337. align-items: center;
  338. justify-content: flex-start;
  339. .price{
  340. margin-right: 10rpx;
  341. padding: 5rpx 10rpx;
  342. background-color: #C39A58;
  343. border-radius: 30rpx;
  344. font-size: 20upx;
  345. font-family: PingFang SC;
  346. color: #ffffff;
  347. }
  348. }
  349. .count{
  350. font-size: 24upx;
  351. font-family: PingFang SC;
  352. color: #333333;
  353. }
  354. }
  355. }
  356. .desc-box{
  357. background-color: #fff;
  358. padding: 20rpx;
  359. margin-top: 10rpx;
  360. .title-box{
  361. display: flex;
  362. flex-direction: row;
  363. align-items: center;
  364. justify-content: flex-start;
  365. .title{
  366. font-size: 32upx;
  367. font-family: PingFang SC;
  368. font-weight: bold;
  369. color: #111111;
  370. }
  371. .line{
  372. margin-right: 15rpx;
  373. height: 30rpx;
  374. width: 6rpx;
  375. background-color: #C39A58;
  376. }
  377. }
  378. .desc{
  379. margin-top: 15rpx;
  380. font-size: 28upx;
  381. font-family: PingFang SC;
  382. color: #9a9a9c;
  383. }
  384. }
  385. .drug-box{
  386. background-color: #fff;
  387. padding: 20rpx;
  388. margin-top: 10rpx;
  389. .title-box{
  390. display: flex;
  391. flex-direction: row;
  392. align-items: center;
  393. justify-content: flex-start;
  394. .title{
  395. font-size: 32upx;
  396. font-family: PingFang SC;
  397. font-weight: bold;
  398. color: #111111;
  399. }
  400. .line{
  401. margin-right: 15rpx;
  402. height: 30rpx;
  403. width: 6rpx;
  404. background-color: #C39A58;
  405. }
  406. }
  407. .drug-list{
  408. margin-top: 15rpx;
  409. .drug-item{
  410. .drug{
  411. padding-bottom: 15upx;
  412. border-bottom: 1px soli #F0F0F0;
  413. display: flex;
  414. align-items: center;
  415. .img-box{
  416. width: 160upx;
  417. height: 160upx;
  418. margin-right: 30upx;
  419. flex-shrink: 0;
  420. image{
  421. width: 100%;
  422. height: 100%;
  423. }
  424. }
  425. .drug-info{
  426. width: calc(100% - 190upx);
  427. height: 160upx;
  428. display: flex;
  429. flex-direction: column;
  430. justify-content: space-between;
  431. .name-box{
  432. font-size: 28upx;
  433. font-family: PingFang SC;
  434. font-weight: 500;
  435. color: #111111;
  436. line-height: 40upx;
  437. .tag{
  438. display: inline-block;
  439. padding: 0 6upx;
  440. height: 30upx;
  441. background: linear-gradient(90deg, #2BC7B9 0%, #2BC7A4 100%);
  442. border-radius: 4upx;
  443. margin-right: 10upx;
  444. font-size: 22upx;
  445. font-family: PingFang SC;
  446. font-weight: bold;
  447. color: #FFFFFF;
  448. line-height: 30upx;
  449. float: left;
  450. margin-top: 7upx;
  451. }
  452. }
  453. .spec{
  454. font-size: 24upx;
  455. font-family: PingFang SC;
  456. font-weight: 500;
  457. color: #999999;
  458. line-height: 1;
  459. margin-top: 10upx;
  460. }
  461. .num-box{
  462. display: flex;
  463. align-items: center;
  464. justify-content: space-between;
  465. .price{
  466. display: flex;
  467. align-items: flex-end;
  468. .unit{
  469. font-size: 24upx;
  470. font-family: PingFang SC;
  471. font-weight: 500;
  472. color: #111111;
  473. line-height: 1.2;
  474. margin-right: 4upx;
  475. }
  476. .num{
  477. font-size: 32upx;
  478. font-family: PingFang SC;
  479. font-weight: 500;
  480. color: #111111;
  481. line-height: 1;
  482. }
  483. }
  484. .use{
  485. font-size: 24upx;
  486. font-family: PingFang SC;
  487. color: #999999;
  488. }
  489. .amount{
  490. font-size: 24upx;
  491. font-family: PingFang SC;
  492. font-weight: 500;
  493. color: #999999;
  494. line-height: 1;
  495. }
  496. }
  497. }
  498. }
  499. }
  500. }
  501. .display-more{
  502. font-size: 24upx;
  503. font-family: PingFang SC;
  504. font-weight: 500;
  505. color: #999999;
  506. display: flex;
  507. align-items: center;
  508. justify-content: center;
  509. }
  510. }
  511. }
  512. }
  513. .btn-foot{
  514. box-sizing: border-box;
  515. width: 100%;
  516. height: 121upx;
  517. background: #FFFFFF;
  518. padding: 0 32upx 0 28upx;
  519. display: flex;
  520. align-items: center;
  521. justify-content: space-between;
  522. position: fixed;
  523. left: 0;
  524. bottom: 0;
  525. z-index: 99;
  526. .p-price-box{
  527. display: flex;
  528. align-items: center;
  529. .p-name{
  530. font-size: 28upx;
  531. font-family: PingFang SC;
  532. font-weight: 500;
  533. color: #FF6633;
  534. }
  535. .p-price{
  536. margin-left: 10rpx;
  537. color: #FF6633;
  538. font-size: 32upx;
  539. font-family: PingFang SC;
  540. font-weight: bold;
  541. }
  542. }
  543. .btn-box{
  544. display: flex;
  545. align-items: center;
  546. .btn{
  547. width: 200upx;
  548. height: 88upx;
  549. line-height: 88upx;
  550. text-align: center;
  551. border-radius: 44upx;
  552. margin-left: 20upx;
  553. font-size: 30upx;
  554. font-family: PingFang SC;
  555. font-weight: bold;
  556. color: #FFFFFF;
  557. &:first-child{
  558. margin-left: 0;
  559. }
  560. &.buy{
  561. background: #C39A58;
  562. }
  563. .contact-btn{
  564. display: inline-block;
  565. position: absolute;
  566. top: 0;
  567. left: 0;
  568. width: 100%;
  569. height: 100%;
  570. opacity: 0;
  571. z-index: 9999;
  572. }
  573. }
  574. }
  575. }
  576. .doctors{
  577. overflow-y: auto;
  578. padding: 20rpx;
  579. height: 650rpx;
  580. width: 100%;
  581. display: flex;
  582. flex-direction: column;
  583. align-items: flex-start;
  584. justify-content: flex-start;
  585. box-sizing: border-box;
  586. .scroll-list{
  587. height: 650upx;
  588. }
  589. .doctor{
  590. width: 100%;
  591. margin-bottom: 15rpx;
  592. background: #f9f8fe;
  593. padding: 20rpx;
  594. display: flex;
  595. flex-direction: column;
  596. align-items: flex-start;
  597. justify-content: flex-start;
  598. &:last-child{
  599. margin-bottom: 0rpx;
  600. }
  601. .item{
  602. width: 100%;
  603. display: flex;
  604. align-items: center;
  605. justify-content: space-between;
  606. .left{
  607. flex: 1;
  608. width: 100%;
  609. display: flex;
  610. align-items: flex-start;
  611. justify-content: flex-start;
  612. .doc-img{
  613. width:80rpx;
  614. height:80rpx;
  615. border-radius: 50%;
  616. }
  617. .right{
  618. width: calc(100% - 100rpx);
  619. margin-left: 20rpx;
  620. display: flex;
  621. flex-direction: column;
  622. align-items: flex-start;
  623. justify-content: flex-start;
  624. .doc-box{
  625. display: flex;
  626. align-items: center;
  627. justify-content: space-between;
  628. .doc-name{
  629. font-size: 28upx;
  630. font-family: PingFang SC;
  631. font-weight: bold;
  632. color: #111111;
  633. }
  634. .doc-position{
  635. margin-left: 50rpx;
  636. font-size: 26upx;
  637. font-family: PingFang SC;
  638. color: #2d2b36;
  639. }
  640. }
  641. .hospital{
  642. margin-top: 10rpx;
  643. font-size: 24upx;
  644. font-family: PingFang SC;
  645. color: #9a9a9c;
  646. }
  647. }
  648. }
  649. .btn{
  650. padding: 10rpx 30rpx;
  651. text-align: center;
  652. border-radius: 30upx;
  653. font-size: 28upx;
  654. font-family: PingFang SC;
  655. color: #C39A58;
  656. border:1rpx solid #C39A58;
  657. }
  658. }
  659. }
  660. }
  661. .goods-banner{
  662. height: 756upx;
  663. background-color: #FFFFFF;
  664. position: relative;
  665. .swiper-item{
  666. box-sizing: border-box;
  667. }
  668. .swiper,
  669. .swiper-item,
  670. .swiper-item image{
  671. width: 100%;
  672. height: 100%;
  673. }
  674. .num-box{
  675. width: 80upx;
  676. height: 44upx;
  677. line-height: 44upx;
  678. text-align: center;
  679. font-size: 24upx;
  680. font-family: PingFang SC;
  681. font-weight: 500;
  682. color: #FFFFFF;
  683. background: rgba(0, 0, 0, .3);
  684. border-radius: 22upx;
  685. position: absolute;
  686. right: 30upx;
  687. bottom: 30upx;
  688. z-index: 10;
  689. }
  690. }
  691. </style>