storeProductPackage.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. <template>
  2. <view >
  3. <view class="top-fixed">
  4. <view class="search-cont">
  5. <view class="inner">
  6. <image class="icon-search" src="https://hst2-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/search.png" mode=""></image>
  7. <input type="text" @confirm="goSearch" :value="form.title" placeholder="输入套餐名称" placeholder-style="font-size:28rpx;color:#BBBBBB;font-family: PingFang SC;" />
  8. </view>
  9. </view>
  10. <view class="cate-list">
  11. <!-- 关键字列表 -->
  12. <scroll-view scroll-x="true" >
  13. <view class="inner">
  14. <view v-for="(item,index) in cates" :key="index" :class="cateId == item.dictValue?'item active':'item'" @click="choseCate(item)">
  15. {{ item.dictLabel }}
  16. </view>
  17. </view>
  18. </scroll-view>
  19. </view>
  20. </view>
  21. <mescroll-body top="204rpx" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  22. <view class="order-list">
  23. <view v-for="(item,index) in dataList" :key="index" class="item" >
  24. <view class="ordersn-box">
  25. <view class="title">{{item.title}}</view>
  26. </view>
  27. <!-- 药品列表 -->
  28. <view class="drug-list" >
  29. <view v-for="(subItem,subIndex) in item.productList" :key="subIndex" class="drug-item" :class="item.displayMore==0?'hide':'show'">
  30. <view class="img-box">
  31. <image :src="subItem.image" mode="aspectFill"></image>
  32. </view>
  33. <view class="drug-info" >
  34. <view>
  35. <view class="name-box ellipsis2">
  36. {{subItem.productName}}
  37. </view>
  38. <view class="spec">{{subItem.sku}}</view>
  39. </view>
  40. <view class="num-box">
  41. <view class="price">
  42. <text class="unit">¥</text>
  43. <text class="num">{{subItem.price.toFixed(2)}}</text>
  44. </view>
  45. <view class="amount">x{{subItem.count}}</view>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="display-more" @click="showMore(item)" >{{item.displayText}}</view>
  50. <!-- 实付金额、按钮 -->
  51. <view class="bottom-box">
  52. <view class="amount-paid">
  53. <text class="label">套餐价格:</text>
  54. <view class="price-box">
  55. <view class="unit">¥</view>
  56. <view class="num" >{{item.payMoney.toFixed(2)}}</view>
  57. </view>
  58. </view>
  59. <view class="btn-box">
  60. <view class="btn pay" @click.stop="showDetail(item)">
  61. 查看详情
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </mescroll-body>
  69. <ykscreenRecord></ykscreenRecord>
  70. </view>
  71. </template>
  72. <script>
  73. import {getStoreProductPackage} from '@/api/storeProductPackage.js'
  74. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  75. import ykscreenRecord from "@/components/yk-screenRecord/yk-screenRecord.vue"
  76. export default {
  77. mixins: [MescrollMixin],
  78. components:{
  79. ykscreenRecord
  80. },
  81. data() {
  82. return {
  83. displayMore:false,
  84. displayText:"点击查看方案明细",
  85. cates:[],
  86. cateId:0,
  87. searchKey:"",
  88. mescroll:null,
  89. // 上拉加载的配置
  90. upOption: {
  91. onScroll:true,
  92. use: true, // 是否启用上拉加载; 默认true
  93. page: {
  94. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  95. size: 10 // 每页数据的数量,默认10
  96. },
  97. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  98. empty: {
  99. icon:'https://hst2-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/no_data.png',
  100. tip: '暂无数据'
  101. }
  102. },
  103. // 列表数据
  104. dataList: [],
  105. };
  106. },
  107. onLoad(options) {
  108. var that=this;
  109. uni.$on('refreshOrder', () => {
  110. that.mescroll.resetUpScroll()
  111. })
  112. this.companyId=options.companyId;
  113. this.companyUserId=options.companyUserId;
  114. this.cates=this.utils.getDict("storeProductPackageCate");
  115. },
  116. methods: {
  117. showMore(item){
  118. if(item.displayMore==1){
  119. item.displayMore=0
  120. }
  121. else{
  122. item.displayMore=1
  123. }
  124. item.displayText=item.displayMore==1?'收起':'点击查看方案明细'
  125. },
  126. choseCate(item){
  127. this.cateId = item.dictValue;
  128. this.mescroll.resetUpScroll()
  129. },
  130. goSearch(e) {
  131. this.searchKey=e.detail.value;
  132. this.mescroll.resetUpScroll()
  133. },
  134. mescrollInit(mescroll) {
  135. this.mescroll = mescroll;
  136. },
  137. /*下拉刷新的回调 */
  138. downCallback(mescroll) {
  139. mescroll.resetUpScroll()
  140. },
  141. upCallback(page) {
  142. //联网加载数据
  143. var that = this;
  144. var data = {
  145. cateId:this.cateId,
  146. title:this.searchKey,
  147. companyId:this.companyId,
  148. page: page.num,
  149. pageSize: page.size
  150. };
  151. getStoreProductPackage(data).then(res => {
  152. if(res.code==200){
  153. //设置列表数据
  154. res.data.list.forEach(function(element) {
  155. element.displayMore=0
  156. element.displayText='点击查看方案明细'
  157. });
  158. if (page.num == 1) {
  159. that.dataList = res.data.list;
  160. } else {
  161. that.dataList = that.dataList.concat(res.data.list);
  162. }
  163. that.dataList.forEach(function(value, index, arr) {
  164. });
  165. that.mescroll.endBySize(res.data.list.length, res.data.total);
  166. }else{
  167. uni.showToast({
  168. icon:'none',
  169. title: "请求失败",
  170. });
  171. that.dataList = null;
  172. that.mescroll.endErr();
  173. }
  174. });
  175. },
  176. showDetail(item) {
  177. uni.navigateTo({
  178. url: './storeProductPackageDetails?packageId=' + item.packageId+"&companyId="+this.companyId+"&companyUserId="+this.companyUserId
  179. })
  180. },
  181. }
  182. }
  183. </script>
  184. <style lang="scss">
  185. .top-fixed{
  186. width: 100%;
  187. position: fixed;
  188. top: 0;
  189. left: 0;
  190. z-index: 10;
  191. .search-cont{
  192. padding: 16upx 30upx;
  193. background-color: #FFFFFF;
  194. display:flex;
  195. align-items: center;
  196. justify-content: space-between;
  197. .inner{
  198. box-sizing: border-box;
  199. width: 100%;
  200. height: 72upx;
  201. background: #F7F7F7;
  202. border-radius: 36upx;
  203. display: flex;
  204. align-items: center;
  205. padding: 0 30upx;
  206. .icon-search{
  207. width: 28upx;
  208. height: 28upx;
  209. margin-right: 20upx;
  210. }
  211. input{
  212. height: 60upx;
  213. line-height: 60upx;
  214. flex: 1;
  215. }
  216. }
  217. }
  218. .cate-list{
  219. box-sizing: border-box;
  220. background: #fff;
  221. padding: 10upx 27upx;
  222. height: 100upx;
  223. .inner{
  224. display: flex;
  225. }
  226. .item{
  227. flex-shrink: 0;
  228. padding: 0 24upx;
  229. height: 64upx;
  230. line-height: 64upx;
  231. font-size: 28upx;
  232. font-family: PingFang SC;
  233. font-weight: 500;
  234. color: #2BC7B9;
  235. background: #F5FFFE;
  236. border: 1px solid #8AD5CE;
  237. border-radius: 32upx;
  238. margin: 0 20upx 20upx 0;
  239. &.active{
  240. color: #FFFFFF;
  241. background: #2BC7B9;
  242. border: 1px solid #2BC7B9;
  243. }
  244. }
  245. }
  246. }
  247. .order-list{
  248. padding: 20upx;
  249. .item{
  250. background: #FFFFFF;
  251. border-radius: 16upx;
  252. padding: 0 30upx;
  253. margin-bottom: 20upx;
  254. .ordersn-box{
  255. display: flex;
  256. align-items: center;
  257. justify-content: space-between;
  258. padding: 34upx 0 20upx;
  259. .title{
  260. font-size: 28upx;
  261. font-family: PingFang SC;
  262. font-weight: 500;
  263. color: #111111;
  264. }
  265. // .num{
  266. // font-size: 26upx;
  267. // font-family: PingFang SC;
  268. // font-weight: 500;
  269. // color: #999999;
  270. // line-height: 1;
  271. // }
  272. .status-box{
  273. display: flex;
  274. align-items: center;
  275. .recom-box{
  276. width: 108upx;
  277. height: 30upx;
  278. line-height: 30upx;
  279. text-align: left;
  280. padding-left: 8upx;
  281. font-size: 22upx;
  282. font-family: PingFang SC;
  283. font-weight: 500;
  284. color: #FFFFFF;
  285. background-image: url(https://hst2-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/recom.png);
  286. background-repeat: no-repeat;
  287. background-size: 100% 100%;
  288. margin-right: 8upx;
  289. }
  290. .text{
  291. font-size: 28upx;
  292. font-family: PingFang SC;
  293. font-weight: 500;
  294. line-height: 1;
  295. &.success{
  296. color: #2BC7B9;
  297. }
  298. &.black{
  299. color: #111111;
  300. }
  301. &.info{
  302. color: #999999;
  303. }
  304. }
  305. }
  306. }
  307. .drug-list{
  308. .drug-item{
  309. padding: 30upx 0;
  310. border-bottom: 1px soli #F0F0F0;
  311. display: flex;
  312. align-items: center;
  313. .img-box{
  314. width: 160upx;
  315. height: 160upx;
  316. margin-right: 30upx;
  317. flex-shrink: 0;
  318. image{
  319. width: 100%;
  320. height: 100%;
  321. }
  322. }
  323. .drug-info{
  324. width: calc(100% - 190upx);
  325. height: 160upx;
  326. display: flex;
  327. flex-direction: column;
  328. justify-content: space-between;
  329. .name-box{
  330. font-size: 28upx;
  331. font-family: PingFang SC;
  332. font-weight: 500;
  333. color: #111111;
  334. line-height: 40upx;
  335. .tag{
  336. display: inline-block;
  337. padding: 0 6upx;
  338. height: 30upx;
  339. background: linear-gradient(90deg, #66b2ef 0%, #2BC7B9 100%);
  340. border-radius: 4upx;
  341. margin-right: 10upx;
  342. font-size: 22upx;
  343. font-family: PingFang SC;
  344. font-weight: bold;
  345. color: #FFFFFF;
  346. line-height: 30upx;
  347. float: left;
  348. margin-top: 7upx;
  349. }
  350. }
  351. .spec{
  352. font-size: 24upx;
  353. font-family: PingFang SC;
  354. font-weight: 500;
  355. color: #999999;
  356. line-height: 1;
  357. margin-top: 10upx;
  358. }
  359. .num-box{
  360. display: flex;
  361. align-items: center;
  362. justify-content: space-between;
  363. .price{
  364. display: flex;
  365. align-items: flex-end;
  366. .unit{
  367. font-size: 24upx;
  368. font-family: PingFang SC;
  369. font-weight: 500;
  370. color: #111111;
  371. line-height: 1.2;
  372. margin-right: 4upx;
  373. }
  374. .num{
  375. font-size: 32upx;
  376. font-family: PingFang SC;
  377. font-weight: 500;
  378. color: #111111;
  379. line-height: 1;
  380. }
  381. }
  382. .amount{
  383. font-size: 24upx;
  384. font-family: PingFang SC;
  385. font-weight: 500;
  386. color: #999999;
  387. line-height: 1;
  388. }
  389. }
  390. }
  391. }
  392. .show{
  393. visibility: flex;
  394. }
  395. .hide{
  396. display: none;
  397. }
  398. .display-more{
  399. font-size: 24upx;
  400. font-family: PingFang SC;
  401. font-weight: 500;
  402. color: #999999;
  403. display: flex;
  404. align-items: center;
  405. justify-content: center;
  406. }
  407. .bottom-box{
  408. height: 110upx;
  409. display: flex;
  410. align-items: center;
  411. justify-content: space-between;
  412. .amount-paid{
  413. display: flex;
  414. align-items: center;
  415. .label{
  416. font-size: 24upx;
  417. font-family: PingFang SC;
  418. font-weight: 500;
  419. color: #999999;
  420. line-height: 1;
  421. }
  422. .price-box{
  423. display: flex;
  424. align-items: flex-end;
  425. .unit{
  426. font-size: 24upx;
  427. font-family: PingFang SC;
  428. font-weight: 500;
  429. color: #FF6633;
  430. line-height: 1.2;
  431. margin-right: 4upx;
  432. }
  433. .num{
  434. font-size: 32upx;
  435. font-family: PingFang SC;
  436. font-weight: bold;
  437. color: #FF6633;
  438. line-height: 1;
  439. }
  440. }
  441. }
  442. .btn-box{
  443. box-sizing: border-box;
  444. display: flex;
  445. align-items: center;
  446. .btn{
  447. width: 155upx;
  448. height: 64upx;
  449. line-height: 64upx;
  450. font-size: 26upx;
  451. font-family: PingFang SC;
  452. font-weight: 500;
  453. text-align: center;
  454. border-radius: 32upx;
  455. margin-left: 15upx;
  456. &:first-child{
  457. margin-left: 0;
  458. }
  459. &.cancel{
  460. border: 1px solid #DDDDDD;
  461. color: #666666;
  462. }
  463. &.pay{
  464. background: #2BC7B9;
  465. color: #FFFFFF;
  466. position: relative;
  467. .share{
  468. display: inline-block;
  469. position: absolute;
  470. top: 0;
  471. left: 0;
  472. width: 100%;
  473. height: 100%rpx;
  474. opacity: 0;
  475. }
  476. }
  477. }
  478. }
  479. }
  480. }
  481. }
  482. }
  483. </style>