storeProductPackage.vue 11 KB

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