packageList.vue 15 KB

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