packageList.vue 12 KB

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