packageList.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. <template>
  2. <view>
  3. <view class="top-content">
  4. <!-- 搜索框 -->
  5. <view class="search-cont">
  6. <view class="inner">
  7. <image class="icon-search" src="/static/images/icon_search.png" mode=""></image>
  8. <input type="text" v-model="keyword" placeholder="输入健康疗法名称或别名搜索" confirm-type="search" @confirm="doSearch" placeholder-style="font-size:28rpx;color:#BBBBBB;font-family: PingFang SC;" />
  9. </view>
  10. </view>
  11. <view class="cate-list">
  12. <!-- 关键字列表 -->
  13. <scroll-view scroll-x="true" >
  14. <view class="inner">
  15. <view v-for="(item,index) in cates" :key="index" :class="privateType == item.cateCode?'item active':'item'" @click="choseType(item)">
  16. {{ item.cateName }}
  17. </view>
  18. </view>
  19. </scroll-view>
  20. </view>
  21. </view>
  22. <mescroll-body top="192rpx" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  23. <view class="package-list">
  24. <view v-for="(item,index) in dataList" :key="index" class="item" >
  25. <view class="top-box">
  26. <view class="title">{{item.packageName}}</view>
  27. <view class="subtitle">别名:{{item.secondName}}</view>
  28. </view>
  29. <!-- 药品列表 -->
  30. <view class="drug-list" >
  31. <view v-for="(subItem,subIndex) in item.products" :key="subIndex" class="drug-item" :class="item.displayMore==0?'hide':'show'">
  32. <view class="img-box">
  33. <image :src="subItem.image" mode="aspectFill"></image>
  34. </view>
  35. <view class="drug-info" >
  36. <view>
  37. <view class="name-box ellipsis2">
  38. {{subItem.productName}}
  39. </view>
  40. <view class="spec">{{subItem.sku}}</view>
  41. </view>
  42. <view class="num-box">
  43. <view class="price" v-if="subItem.price!=null">
  44. <text class="unit">¥</text>
  45. <text class="num" >{{subItem.price.toFixed(2)}}</text>
  46. </view>
  47. <view class="amount">x{{subItem.count}}</view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="display-more" @click="showMore(item)" >{{item.displayText}}</view>
  52. <!-- 实付金额、按钮 -->
  53. <view class="bottom-box">
  54. <view class="amount-paid">
  55. <text class="label">套餐价格:</text>
  56. <view class="price-box" v-if="item.totalPrice!=null">
  57. <view class="unit">¥</view>
  58. <view class="num" >{{item.totalPrice.toFixed(2)}}</view>
  59. </view>
  60. </view>
  61. <view class="btn-box">
  62. <view class="btn share" @click.stop="doShare(item)">分享</view>
  63. <view class="btn pay" @click.stop="navTo('/pages/company/packageDetails?packageId='+item.packageId)">
  64. 查看详情
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <!-- <view class="package-box" >
  72. <view class="item" @click="navTo('/pages_company/packageDetails?packageId='+item.packageId)" v-for="(item,index) in dataList">
  73. <view class="top">
  74. <image :src="item.imgUrl"></image>
  75. </view>
  76. <view class="bottom">
  77. <view class="title ellipsis2">
  78. {{item.packageName}}
  79. </view>
  80. <view class="price-box">
  81. <view class="price">¥{{item.price.toFixed(2)}}元/日</view>
  82. <view class="count">{{item.sales}}人已购</view>
  83. </view>
  84. </view>
  85. </view>
  86. </view> -->
  87. </mescroll-body>
  88. <!-- 分享弹窗 -->
  89. <u-popup :show="showShare" @close="showShare = false" >
  90. <share-box :shareItem="shareItem" @closeShare='showShare = false' ></share-box>
  91. </u-popup>
  92. </view>
  93. </template>
  94. <script>
  95. import {getConfigByKey} from '@/api/common.js'
  96. import {getPackageList,getPackagCateList} from '@/api/package.js'
  97. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  98. export default {
  99. mixins: [MescrollMixin],
  100. data() {
  101. return {
  102. cates:[],
  103. privateType:0,
  104. keyword: '',
  105. mescroll:null,
  106. downOption: { //下拉刷新
  107. use:true,
  108. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  109. },
  110. upOption: {
  111. onScroll:false,
  112. use: true, // 是否启用上拉加载; 默认true
  113. page: {
  114. pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  115. size: 10 // 每页数据的数量,默认10
  116. },
  117. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  118. textNoMore:"已经到底了",
  119. empty: {
  120. icon:'https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png',
  121. tip: '暂无数据'
  122. }
  123. },
  124. showShare:false,
  125. isH5:false,
  126. shareItem:{ imageUrl:"",title:"",path:""},
  127. dataList: [],
  128. companyId:null,
  129. companyUserId:null,
  130. };
  131. },
  132. onLoad() {
  133. this.companyId=uni.getStorageSync('companyId');
  134. this.companyUserId=uni.getStorageSync('companyUserId');
  135. },
  136. onShow() {
  137. this.getPackagCateList(2);
  138. //#ifdef H5
  139. this.isH5=true;
  140. //#endif
  141. },
  142. methods:{
  143. getPackagCateList(type){
  144. var data={type:type}
  145. getPackagCateList(data).then(
  146. res => {
  147. if(res.code==200){
  148. this.cates=res.data;
  149. }
  150. },
  151. err => {
  152. }
  153. );
  154. },
  155. showMore(item){
  156. item.displayMore=item.displayMore==1?0:1;
  157. item.displayText=item.displayMore==1?'收起':'点击查看方案明细'
  158. },
  159. navTo(url){
  160. uni.navigateTo({
  161. url: url
  162. })
  163. },
  164. doSearch(){
  165. this.mescroll.resetUpScroll()
  166. },
  167. mescrollInit(mescroll) {
  168. this.mescroll = mescroll;
  169. },
  170. /*下拉刷新的回调 */
  171. downCallback(mescroll) {
  172. mescroll.resetUpScroll()
  173. },
  174. upCallback(page) {
  175. //联网加载数据
  176. var that = this;
  177. var data = {
  178. isShow:0,
  179. keyword:this.keyword,
  180. privateType:this.privateType,
  181. pageNum: page.num,
  182. pageSize: page.size
  183. };
  184. getPackageList(data).then(res => {
  185. if(res.code==200){
  186. //设置列表数据
  187. res.data.list.forEach(function(element) {
  188. element.displayMore=0
  189. element.displayText='点击查看方案明细'
  190. if(element.productJson!=null){
  191. element.products=JSON.parse(element.productJson)
  192. }
  193. else{
  194. element.products=[]
  195. }
  196. });
  197. if (page.num == 1) {
  198. that.dataList = res.data.list;
  199. } else {
  200. that.dataList = that.dataList.concat(res.data.list);
  201. }
  202. that.mescroll.endBySize(res.data.list.length, res.data.total);
  203. }else{
  204. uni.showToast({
  205. icon:'none',
  206. title: "请求失败",
  207. });
  208. that.dataList = null;
  209. that.mescroll.endErr();
  210. }
  211. });
  212. },
  213. choseType(item) {
  214. this.privateType = item.cateCode;
  215. this.mescroll.resetUpScroll()
  216. },
  217. doShare(item){
  218. if(this.isH5){
  219. return;
  220. }
  221. this.getConfigByKey(item)
  222. },
  223. getConfigByKey(item){
  224. let param = {key:"app.config"};
  225. getConfigByKey(param).then(
  226. res => {
  227. if(res.code==200){
  228. let data=res.data ? JSON.parse(res.data) : {};
  229. const fsPackage = data.fsPackage&&data.fsPackage.length > 0 ? data.fsPackage[0] : {}
  230. this.getShareItem(item,fsPackage.packageId)
  231. }else{
  232. uni.showToast({
  233. icon:'none',
  234. title: "请求失败",
  235. });
  236. }
  237. },
  238. rej => {}
  239. );
  240. },
  241. getShareItem(item,packageId) {
  242. this.shareItem.title=item.packageName;
  243. this.shareItem.imageUrl=item.imgUrl;
  244. this.shareItem.compressImage = 1
  245. this.shareItem.summary=!this.$isEmpty(item.description)?item.description:"";
  246. let cdn=uni.getStorageSync('h5Path');
  247. if(packageId && packageId == item.packageId) {
  248. this.shareItem.url=cdn+"/pages/store/packageDetails?choose=2&packageId="+item.packageId+"&companyId="+this.companyId+"&companyUserId="+this.companyUserId;
  249. } else {
  250. this.shareItem.url=cdn+"/pages/store/packageDetails?packageId="+item.packageId+"&companyId="+this.companyId+"&companyUserId="+this.companyUserId;
  251. }
  252. this.showShare=true;
  253. }
  254. }
  255. }
  256. </script>
  257. <style lang="scss">
  258. .top-content{
  259. width: 100%;
  260. position: absolute;
  261. top: 0;
  262. left: 0;
  263. z-index: 10;
  264. }
  265. .search-cont{
  266. padding: 16upx 30upx;
  267. background-color: #FFFFFF;
  268. .inner{
  269. box-sizing: border-box;
  270. width: 100%;
  271. height: 72upx;
  272. background: #F7F7F7;
  273. border-radius: 36upx;
  274. display: flex;
  275. align-items: center;
  276. padding: 0 30upx;
  277. .icon-search{
  278. width: 28upx;
  279. height: 28upx;
  280. margin-right: 20upx;
  281. }
  282. input{
  283. height: 60upx;
  284. line-height: 60upx;
  285. flex: 1;
  286. }
  287. }
  288. }
  289. .cate-list{
  290. box-sizing: border-box;
  291. background: #fff;
  292. padding: 10upx 27upx;
  293. height: 100upx;
  294. .inner{
  295. display: flex;
  296. }
  297. .item{
  298. flex-shrink: 0;
  299. padding: 0 24upx;
  300. height: 64upx;
  301. line-height: 64upx;
  302. font-size: 28upx;
  303. font-family: PingFang SC;
  304. font-weight: 500;
  305. color: #FF5C03;
  306. background: #ffffff;
  307. border: 1px solid #FF5C03;
  308. border-radius: 32upx;
  309. margin: 0 20upx 20upx 0;
  310. &.active{
  311. color: #FFFFFF;
  312. background: #FF5C03;
  313. border: 1px solid #FF5C03;
  314. }
  315. }
  316. }
  317. .package-box{
  318. margin-top: 20rpx;
  319. display: flex;
  320. align-items: flex-start;
  321. justify-content: flex-start;
  322. flex-wrap: wrap;
  323. .item{
  324. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  325. background-color: #fff;
  326. width: calc(50% - 20rpx);
  327. border-radius: 15rpx;
  328. margin: 10rpx;
  329. display: flex;
  330. flex-direction: column;
  331. align-items: flex-start;
  332. justify-content: flex-start;
  333. &:last-child{
  334. }
  335. .top{
  336. width:100%;
  337. height:300rpx;
  338. image{
  339. border-radius: 15rpx 15rpx 0rpx 0rpx;
  340. width:100%;
  341. height:300rpx;
  342. }
  343. }
  344. .bottom{
  345. width: 100%;
  346. padding: 15rpx 10rpx;
  347. .title{
  348. font-weight: bold;
  349. font-size: 28upx;
  350. font-family: PingFang SC;
  351. color: #111111;
  352. }
  353. .price-box{
  354. margin-top: 10rpx;
  355. display: flex;
  356. align-items: center;
  357. justify-content: space-between;
  358. width: 100%;
  359. .price{
  360. padding: 5rpx 10rpx;
  361. background-color: #FF5C03;
  362. border-radius: 30rpx;
  363. font-size: 20upx;
  364. font-family: PingFang SC;
  365. color: #ffffff;
  366. }
  367. .count{
  368. font-size: 24upx;
  369. font-family: PingFang SC;
  370. color: #333333;
  371. }
  372. }
  373. }
  374. }
  375. }
  376. .package-list{
  377. padding: 20upx;
  378. .item{
  379. background: #FFFFFF;
  380. border-radius: 16upx;
  381. padding: 0 30upx;
  382. margin-bottom: 20upx;
  383. .top-box{
  384. padding: 34upx 0 20upx;
  385. .title{
  386. font-size: 28upx;
  387. font-family: PingFang SC;
  388. font-weight: 500;
  389. font-weight: bold;
  390. color: #111111;
  391. }
  392. .subtitle{
  393. margin-top: 5rpx;
  394. font-size: 24upx;
  395. font-family: PingFang SC;
  396. font-weight: bold;
  397. color: #111111;
  398. }
  399. }
  400. .drug-list{
  401. .drug-item{
  402. padding-bottom: 30rpx;
  403. border-bottom: 1px soli #F0F0F0;
  404. display: flex;
  405. align-items: center;
  406. .img-box{
  407. width: 160upx;
  408. height: 160upx;
  409. margin-right: 30upx;
  410. flex-shrink: 0;
  411. image{
  412. width: 100%;
  413. height: 100%;
  414. }
  415. }
  416. .drug-info{
  417. width: calc(100% - 190upx);
  418. height: 160upx;
  419. display: flex;
  420. flex-direction: column;
  421. justify-content: space-between;
  422. .name-box{
  423. font-size: 28upx;
  424. font-family: PingFang SC;
  425. font-weight: 500;
  426. color: #111111;
  427. line-height: 40upx;
  428. .tag{
  429. display: inline-block;
  430. padding: 0 6upx;
  431. height: 30upx;
  432. background: linear-gradient(90deg, #C39A58 0%, #C39A58 100%);
  433. border-radius: 4upx;
  434. margin-right: 10upx;
  435. font-size: 22upx;
  436. font-family: PingFang SC;
  437. font-weight: bold;
  438. color: #FFFFFF;
  439. line-height: 30upx;
  440. float: left;
  441. margin-top: 7upx;
  442. }
  443. }
  444. .spec{
  445. font-size: 24upx;
  446. font-family: PingFang SC;
  447. font-weight: 500;
  448. color: #999999;
  449. line-height: 1;
  450. margin-top: 10upx;
  451. }
  452. .num-box{
  453. display: flex;
  454. align-items: center;
  455. justify-content: space-between;
  456. .price{
  457. display: flex;
  458. align-items: flex-end;
  459. .unit{
  460. font-size: 24upx;
  461. font-family: PingFang SC;
  462. font-weight: 500;
  463. color: #111111;
  464. line-height: 1.2;
  465. margin-right: 4upx;
  466. }
  467. .num{
  468. font-size: 32upx;
  469. font-family: PingFang SC;
  470. font-weight: 500;
  471. color: #111111;
  472. line-height: 1;
  473. }
  474. }
  475. .amount{
  476. font-size: 24upx;
  477. font-family: PingFang SC;
  478. font-weight: 500;
  479. color: #999999;
  480. line-height: 1;
  481. }
  482. }
  483. }
  484. }
  485. .show{
  486. visibility: flex;
  487. }
  488. .hide{
  489. display: none;
  490. }
  491. .display-more{
  492. font-size: 24upx;
  493. font-family: PingFang SC;
  494. font-weight: 500;
  495. color: #999999;
  496. display: flex;
  497. align-items: center;
  498. justify-content: center;
  499. }
  500. .bottom-box{
  501. height: 110upx;
  502. display: flex;
  503. align-items: center;
  504. justify-content: space-between;
  505. .amount-paid{
  506. display: flex;
  507. align-items: center;
  508. .label{
  509. font-size: 24upx;
  510. font-family: PingFang SC;
  511. font-weight: 500;
  512. color: #999999;
  513. line-height: 1;
  514. }
  515. .price-box{
  516. display: flex;
  517. align-items: flex-end;
  518. .unit{
  519. font-size: 24upx;
  520. font-family: PingFang SC;
  521. font-weight: 500;
  522. color: #FF6633;
  523. line-height: 1.2;
  524. margin-right: 4upx;
  525. }
  526. .num{
  527. font-size: 32upx;
  528. font-family: PingFang SC;
  529. font-weight: bold;
  530. color: #FF6633;
  531. line-height: 1;
  532. }
  533. }
  534. }
  535. .btn-box{
  536. box-sizing: border-box;
  537. display: flex;
  538. align-items: center;
  539. .btn{
  540. width: 155upx;
  541. height: 64upx;
  542. line-height: 64upx;
  543. font-size: 26upx;
  544. font-family: PingFang SC;
  545. font-weight: 500;
  546. text-align: center;
  547. border-radius: 32upx;
  548. margin-left: 15upx;
  549. &:first-child{
  550. margin-left: 0;
  551. }
  552. &.cancel{
  553. border: 1px solid #DDDDDD;
  554. color: #666666;
  555. }
  556. &.share{
  557. background: #2BC7B9;
  558. color: #FFFFFF;
  559. }
  560. &.pay{
  561. background: #FF5C03;
  562. color: #FFFFFF;
  563. position: relative;
  564. .share{
  565. display: inline-block;
  566. position: absolute;
  567. top: 0;
  568. left: 0;
  569. width: 100%;
  570. height: 100%rpx;
  571. opacity: 0;
  572. }
  573. }
  574. }
  575. }
  576. }
  577. }
  578. }
  579. }
  580. </style>