packageList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  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://zkzh-2025.oss-cn-beijing.aliyuncs.com/appimgs/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. inquirySelect
  232. uni.$emit("sendIMCts",item);
  233. uni.navigateBack({
  234. delta: 1
  235. });
  236. },
  237. getConfigByKey(item){
  238. let param = {key:"app.config"};
  239. getConfigByKey(param).then(res => {
  240. if(res.code==200){
  241. let data=res.data ? JSON.parse(res.data) : {};
  242. const fsPackage = data.fsPackage&&data.fsPackage.length > 0 ? data.fsPackage[0] : {}
  243. this.getShareItem(item,fsPackage.packageId)
  244. }else{
  245. uni.showToast({
  246. icon:'none',
  247. title: "请求失败",
  248. });
  249. }
  250. },
  251. rej => {}
  252. );
  253. },
  254. getShareItem(item,packageId) {
  255. this.shareItem.title=item.packageName;
  256. this.shareItem.imageUrl=item.imgUrl;
  257. this.shareItem.compressImage = 1;
  258. this.shareItem.isMini=true;
  259. this.shareItem.summary=!this.$isEmpty(item.description)?item.description:"";
  260. let cdn=uni.getStorageSync('h5Path');
  261. if(packageId && packageId == item.packageId) {
  262. this.shareItem.url=cdn+"/pages/store/packageDetails?choose=2&packageId="+item.packageId+"&companyId="+this.companyId+"&companyUserId="+this.companyUserId;
  263. this.shareItem.path="/pages_index/packageDetails?choose=2&packageId="+item.packageId+"&companyId="+this.companyId+"&companyUserId="+this.companyUserId;
  264. } else {
  265. this.shareItem.url=cdn+"/pages/store/packageDetails?packageId="+item.packageId+"&companyId="+this.companyId+"&companyUserId="+this.companyUserId;
  266. this.shareItem.path="/pages_index/packageDetails?packageId="+item.packageId+"&companyId="+this.companyId+"&companyUserId="+this.companyUserId;
  267. }
  268. this.showShare=true;
  269. }
  270. }
  271. }
  272. </script>
  273. <style lang="scss">
  274. .top-content{
  275. width: 100%;
  276. position: absolute;
  277. top: 0;
  278. left: 0;
  279. z-index: 10;
  280. }
  281. .search-cont{
  282. padding: 16upx 30upx;
  283. background-color: #FFFFFF;
  284. .inner{
  285. box-sizing: border-box;
  286. width: 100%;
  287. height: 72upx;
  288. background: #F7F7F7;
  289. border-radius: 36upx;
  290. display: flex;
  291. align-items: center;
  292. padding: 0 30upx;
  293. .icon-search{
  294. width: 28upx;
  295. height: 28upx;
  296. margin-right: 20upx;
  297. }
  298. input{
  299. height: 60upx;
  300. line-height: 60upx;
  301. flex: 1;
  302. }
  303. }
  304. }
  305. .cate-list{
  306. box-sizing: border-box;
  307. background: #fff;
  308. padding: 10upx 27upx;
  309. height: 100upx;
  310. .inner{
  311. display: flex;
  312. }
  313. .item{
  314. flex-shrink: 0;
  315. padding: 0 24upx;
  316. height: 64upx;
  317. line-height: 64upx;
  318. font-size: 28upx;
  319. font-family: PingFang SC;
  320. font-weight: 500;
  321. color: #FF233C;
  322. background: #ffffff;
  323. border: 1px solid #FF233C;
  324. border-radius: 32upx;
  325. margin: 0 20upx 20upx 0;
  326. &.active{
  327. color: #FFFFFF;
  328. background: #FF233C;
  329. border: 1px solid #FF233C;
  330. }
  331. }
  332. }
  333. .package-box{
  334. margin-top: 20rpx;
  335. display: flex;
  336. align-items: flex-start;
  337. justify-content: flex-start;
  338. flex-wrap: wrap;
  339. .item{
  340. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  341. background-color: #fff;
  342. width: calc(50% - 20rpx);
  343. border-radius: 15rpx;
  344. margin: 10rpx;
  345. display: flex;
  346. flex-direction: column;
  347. align-items: flex-start;
  348. justify-content: flex-start;
  349. &:last-child{
  350. }
  351. .top{
  352. width:100%;
  353. height:300rpx;
  354. image{
  355. border-radius: 15rpx 15rpx 0rpx 0rpx;
  356. width:100%;
  357. height:300rpx;
  358. }
  359. }
  360. .bottom{
  361. width: 100%;
  362. padding: 15rpx 10rpx;
  363. .title{
  364. font-weight: bold;
  365. font-size: 28upx;
  366. font-family: PingFang SC;
  367. color: #111111;
  368. }
  369. .price-box{
  370. margin-top: 10rpx;
  371. display: flex;
  372. align-items: center;
  373. justify-content: space-between;
  374. width: 100%;
  375. .price{
  376. padding: 5rpx 10rpx;
  377. background-color: #FF233C;
  378. border-radius: 30rpx;
  379. font-size: 20upx;
  380. font-family: PingFang SC;
  381. color: #ffffff;
  382. }
  383. .count{
  384. font-size: 24upx;
  385. font-family: PingFang SC;
  386. color: #333333;
  387. }
  388. }
  389. }
  390. }
  391. }
  392. .package-list{
  393. padding: 20upx;
  394. .item{
  395. background: #FFFFFF;
  396. border-radius: 16upx;
  397. padding: 0 30upx;
  398. margin-bottom: 20upx;
  399. .top-box{
  400. padding: 34upx 0 20upx;
  401. .title{
  402. font-size: 28upx;
  403. font-family: PingFang SC;
  404. font-weight: 500;
  405. font-weight: bold;
  406. color: #111111;
  407. }
  408. .subtitle{
  409. margin-top: 5rpx;
  410. font-size: 24upx;
  411. font-family: PingFang SC;
  412. font-weight: bold;
  413. color: #111111;
  414. }
  415. }
  416. .drug-list{
  417. .drug-item{
  418. padding-bottom: 30rpx;
  419. border-bottom: 1px soli #F0F0F0;
  420. display: flex;
  421. align-items: center;
  422. .img-box{
  423. width: 160upx;
  424. height: 160upx;
  425. margin-right: 30upx;
  426. flex-shrink: 0;
  427. image{
  428. width: 100%;
  429. height: 100%;
  430. }
  431. }
  432. .drug-info{
  433. width: calc(100% - 190upx);
  434. height: 160upx;
  435. display: flex;
  436. flex-direction: column;
  437. justify-content: space-between;
  438. .name-box{
  439. font-size: 28upx;
  440. font-family: PingFang SC;
  441. font-weight: 500;
  442. color: #111111;
  443. line-height: 40upx;
  444. .tag{
  445. display: inline-block;
  446. padding: 0 6upx;
  447. height: 30upx;
  448. background: linear-gradient(90deg, #FF233C 0%, #FF233C 100%);
  449. border-radius: 4upx;
  450. margin-right: 10upx;
  451. font-size: 22upx;
  452. font-family: PingFang SC;
  453. font-weight: bold;
  454. color: #FFFFFF;
  455. line-height: 30upx;
  456. float: left;
  457. margin-top: 7upx;
  458. }
  459. }
  460. .spec{
  461. font-size: 24upx;
  462. font-family: PingFang SC;
  463. font-weight: 500;
  464. color: #999999;
  465. line-height: 1;
  466. margin-top: 10upx;
  467. }
  468. .num-box{
  469. display: flex;
  470. align-items: center;
  471. justify-content: space-between;
  472. .price{
  473. display: flex;
  474. align-items: flex-end;
  475. .unit{
  476. font-size: 24upx;
  477. font-family: PingFang SC;
  478. font-weight: 500;
  479. color: #111111;
  480. line-height: 1.2;
  481. margin-right: 4upx;
  482. }
  483. .num{
  484. font-size: 32upx;
  485. font-family: PingFang SC;
  486. font-weight: 500;
  487. color: #111111;
  488. line-height: 1;
  489. }
  490. }
  491. .amount{
  492. font-size: 24upx;
  493. font-family: PingFang SC;
  494. font-weight: 500;
  495. color: #999999;
  496. line-height: 1;
  497. }
  498. }
  499. }
  500. }
  501. .show{
  502. visibility: flex;
  503. }
  504. .hide{
  505. display: none;
  506. }
  507. .display-more{
  508. font-size: 24upx;
  509. font-family: PingFang SC;
  510. font-weight: 500;
  511. color: #999999;
  512. display: flex;
  513. align-items: center;
  514. justify-content: center;
  515. }
  516. .bottom-box{
  517. height: 110upx;
  518. display: flex;
  519. align-items: center;
  520. justify-content: space-between;
  521. .amount-paid{
  522. display: flex;
  523. align-items: center;
  524. .label{
  525. font-size: 24upx;
  526. font-family: PingFang SC;
  527. font-weight: 500;
  528. color: #999999;
  529. line-height: 1;
  530. }
  531. .price-box{
  532. display: flex;
  533. align-items: flex-end;
  534. .unit{
  535. font-size: 24upx;
  536. font-family: PingFang SC;
  537. font-weight: 500;
  538. color: #FF6633;
  539. line-height: 1.2;
  540. margin-right: 4upx;
  541. }
  542. .num{
  543. font-size: 32upx;
  544. font-family: PingFang SC;
  545. font-weight: bold;
  546. color: #FF6633;
  547. line-height: 1;
  548. }
  549. }
  550. }
  551. .btn-box{
  552. box-sizing: border-box;
  553. display: flex;
  554. align-items: center;
  555. .btn{
  556. width: 155upx;
  557. height: 64upx;
  558. line-height: 64upx;
  559. font-size: 26upx;
  560. font-family: PingFang SC;
  561. font-weight: 500;
  562. text-align: center;
  563. border-radius: 32upx;
  564. margin-left: 15upx;
  565. &:first-child{
  566. margin-left: 0;
  567. }
  568. &.cancel{
  569. border: 1px solid #DDDDDD;
  570. color: #666666;
  571. }
  572. &.share{
  573. background: #FF233C;
  574. color: #FFFFFF;
  575. }
  576. &.pay{
  577. background: #FF233C;
  578. color: #FFFFFF;
  579. position: relative;
  580. .share{
  581. display: inline-block;
  582. position: absolute;
  583. top: 0;
  584. left: 0;
  585. width: 100%;
  586. height: 100%rpx;
  587. opacity: 0;
  588. }
  589. }
  590. }
  591. }
  592. }
  593. }
  594. }
  595. }
  596. </style>