storeProductPackage.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  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://jnlzjk-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. </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:'https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/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. console.log("加入",item)
  173. uni.navigateTo({
  174. url: './storeProductPackageDetails?packageId=' + item.packageId+"&companyId="+this.companyId+"&companyUserId="+this.companyUserId
  175. })
  176. },
  177. }
  178. }
  179. </script>
  180. <style lang="scss">
  181. .top-fixed{
  182. width: 100%;
  183. position: fixed;
  184. top: 0;
  185. left: 0;
  186. z-index: 10;
  187. .search-cont{
  188. padding: 16upx 30upx;
  189. background-color: #FFFFFF;
  190. display:flex;
  191. align-items: center;
  192. justify-content: space-between;
  193. .inner{
  194. box-sizing: border-box;
  195. width: 100%;
  196. height: 72upx;
  197. background: #F7F7F7;
  198. border-radius: 36upx;
  199. display: flex;
  200. align-items: center;
  201. padding: 0 30upx;
  202. .icon-search{
  203. width: 28upx;
  204. height: 28upx;
  205. margin-right: 20upx;
  206. }
  207. input{
  208. height: 60upx;
  209. line-height: 60upx;
  210. flex: 1;
  211. }
  212. }
  213. }
  214. .cate-list{
  215. box-sizing: border-box;
  216. background: #fff;
  217. padding: 10upx 27upx;
  218. height: 100upx;
  219. .inner{
  220. display: flex;
  221. }
  222. .item{
  223. flex-shrink: 0;
  224. padding: 0 24upx;
  225. height: 64upx;
  226. line-height: 64upx;
  227. font-size: 28upx;
  228. font-family: PingFang SC;
  229. font-weight: 500;
  230. color: #2BC7B9;
  231. background: #F5FFFE;
  232. border: 1px solid #8AD5CE;
  233. border-radius: 32upx;
  234. margin: 0 20upx 20upx 0;
  235. &.active{
  236. color: #FFFFFF;
  237. background: #2BC7B9;
  238. border: 1px solid #2BC7B9;
  239. }
  240. }
  241. }
  242. }
  243. .order-list{
  244. padding: 20upx;
  245. .item{
  246. background: #FFFFFF;
  247. border-radius: 16upx;
  248. padding: 0 30upx;
  249. margin-bottom: 20upx;
  250. .ordersn-box{
  251. display: flex;
  252. align-items: center;
  253. justify-content: space-between;
  254. padding: 34upx 0 20upx;
  255. .title{
  256. font-size: 28upx;
  257. font-family: PingFang SC;
  258. font-weight: 500;
  259. color: #111111;
  260. }
  261. // .num{
  262. // font-size: 26upx;
  263. // font-family: PingFang SC;
  264. // font-weight: 500;
  265. // color: #999999;
  266. // line-height: 1;
  267. // }
  268. .status-box{
  269. display: flex;
  270. align-items: center;
  271. .recom-box{
  272. width: 108upx;
  273. height: 30upx;
  274. line-height: 30upx;
  275. text-align: left;
  276. padding-left: 8upx;
  277. font-size: 22upx;
  278. font-family: PingFang SC;
  279. font-weight: 500;
  280. color: #FFFFFF;
  281. background-image: url(https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/recom.png);
  282. background-repeat: no-repeat;
  283. background-size: 100% 100%;
  284. margin-right: 8upx;
  285. }
  286. .text{
  287. font-size: 28upx;
  288. font-family: PingFang SC;
  289. font-weight: 500;
  290. line-height: 1;
  291. &.success{
  292. color: #2BC7B9;
  293. }
  294. &.black{
  295. color: #111111;
  296. }
  297. &.info{
  298. color: #999999;
  299. }
  300. }
  301. }
  302. }
  303. .drug-list{
  304. .drug-item{
  305. padding: 30upx 0;
  306. border-bottom: 1px soli #F0F0F0;
  307. display: flex;
  308. align-items: center;
  309. .img-box{
  310. width: 160upx;
  311. height: 160upx;
  312. margin-right: 30upx;
  313. flex-shrink: 0;
  314. image{
  315. width: 100%;
  316. height: 100%;
  317. }
  318. }
  319. .drug-info{
  320. width: calc(100% - 190upx);
  321. height: 160upx;
  322. display: flex;
  323. flex-direction: column;
  324. justify-content: space-between;
  325. .name-box{
  326. font-size: 28upx;
  327. font-family: PingFang SC;
  328. font-weight: 500;
  329. color: #111111;
  330. line-height: 40upx;
  331. .tag{
  332. display: inline-block;
  333. padding: 0 6upx;
  334. height: 30upx;
  335. background: linear-gradient(90deg, #66b2ef 0%, #2BC7B9 100%);
  336. border-radius: 4upx;
  337. margin-right: 10upx;
  338. font-size: 22upx;
  339. font-family: PingFang SC;
  340. font-weight: bold;
  341. color: #FFFFFF;
  342. line-height: 30upx;
  343. float: left;
  344. margin-top: 7upx;
  345. }
  346. }
  347. .spec{
  348. font-size: 24upx;
  349. font-family: PingFang SC;
  350. font-weight: 500;
  351. color: #999999;
  352. line-height: 1;
  353. margin-top: 10upx;
  354. }
  355. .num-box{
  356. display: flex;
  357. align-items: center;
  358. justify-content: space-between;
  359. .price{
  360. display: flex;
  361. align-items: flex-end;
  362. .unit{
  363. font-size: 24upx;
  364. font-family: PingFang SC;
  365. font-weight: 500;
  366. color: #111111;
  367. line-height: 1.2;
  368. margin-right: 4upx;
  369. }
  370. .num{
  371. font-size: 32upx;
  372. font-family: PingFang SC;
  373. font-weight: 500;
  374. color: #111111;
  375. line-height: 1;
  376. }
  377. }
  378. .amount{
  379. font-size: 24upx;
  380. font-family: PingFang SC;
  381. font-weight: 500;
  382. color: #999999;
  383. line-height: 1;
  384. }
  385. }
  386. }
  387. }
  388. .show{
  389. visibility: flex;
  390. }
  391. .hide{
  392. display: none;
  393. }
  394. .display-more{
  395. font-size: 24upx;
  396. font-family: PingFang SC;
  397. font-weight: 500;
  398. color: #999999;
  399. display: flex;
  400. align-items: center;
  401. justify-content: center;
  402. }
  403. .bottom-box{
  404. height: 110upx;
  405. display: flex;
  406. align-items: center;
  407. justify-content: space-between;
  408. .amount-paid{
  409. display: flex;
  410. align-items: center;
  411. .label{
  412. font-size: 24upx;
  413. font-family: PingFang SC;
  414. font-weight: 500;
  415. color: #999999;
  416. line-height: 1;
  417. }
  418. .price-box{
  419. display: flex;
  420. align-items: flex-end;
  421. .unit{
  422. font-size: 24upx;
  423. font-family: PingFang SC;
  424. font-weight: 500;
  425. color: #FF6633;
  426. line-height: 1.2;
  427. margin-right: 4upx;
  428. }
  429. .num{
  430. font-size: 32upx;
  431. font-family: PingFang SC;
  432. font-weight: bold;
  433. color: #FF6633;
  434. line-height: 1;
  435. }
  436. }
  437. }
  438. .btn-box{
  439. box-sizing: border-box;
  440. display: flex;
  441. align-items: center;
  442. .btn{
  443. width: 155upx;
  444. height: 64upx;
  445. line-height: 64upx;
  446. font-size: 26upx;
  447. font-family: PingFang SC;
  448. font-weight: 500;
  449. text-align: center;
  450. border-radius: 32upx;
  451. margin-left: 15upx;
  452. &:first-child{
  453. margin-left: 0;
  454. }
  455. &.cancel{
  456. border: 1px solid #DDDDDD;
  457. color: #666666;
  458. }
  459. &.pay{
  460. background: #2BC7B9;
  461. color: #FFFFFF;
  462. position: relative;
  463. .share{
  464. display: inline-block;
  465. position: absolute;
  466. top: 0;
  467. left: 0;
  468. width: 100%;
  469. height: 100%rpx;
  470. opacity: 0;
  471. }
  472. }
  473. }
  474. }
  475. }
  476. }
  477. }
  478. }
  479. </style>