storeProductPackage.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  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://kntobs.jnmyunl.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 pays" @click.stop="showpop(item)">
  61. 绑定用户
  62. </view> -->
  63. <view class="btn pay" @click.stop="showDetail(item)">
  64. 查看详情
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </mescroll-body>
  72. <view>
  73. <u-popup :show="popshow" @close="close" :closeOnClickOverlay='true'>
  74. <view class="popbox">
  75. <view class="pop-tit">
  76. <view class="poptitle">选择用户</view>
  77. <u-icon name="close" size="24" @click="close"></u-icon>
  78. </view>
  79. <view class="popsh">
  80. <u-search :showAction="true" actionText="搜索" placeholder="输入手机号搜索"
  81. :animation="true" v-model="keyword" @search='searchkey(value)' @custom='searchkey(value)'></u-search>
  82. </view>
  83. <view class="poplist">
  84. <view class="list-box" v-for="(item,index) in phoneUser" :key="index">
  85. <view class="tit">{{item.name}}</view>
  86. <view class="send" @click="sendpop(item.id)">发送</view>
  87. </view>
  88. </view>
  89. </view>
  90. </u-popup>
  91. </view>
  92. </view>
  93. </template>
  94. <script>
  95. import {getStoreProductPackage,sendPackage,getPackagCateList} from '@/api/storeProductPackage.js'
  96. import {sendCoupon,searchUser} from '@/api/coupon'
  97. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  98. export default {
  99. mixins: [MescrollMixin],
  100. data() {
  101. return {
  102. displayMore:false,
  103. displayText:"点击查看方案明细",
  104. cates:[],
  105. cateId:0,
  106. searchKey:"",
  107. mescroll:null,
  108. downOption: { //下拉刷新
  109. use:true,
  110. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  111. },
  112. // 上拉加载的配置
  113. upOption: {
  114. onScroll:true,
  115. use: true, // 是否启用上拉加载; 默认true
  116. auto: false,
  117. page: {
  118. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  119. size: 10 // 每页数据的数量,默认10
  120. },
  121. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  122. empty: {
  123. icon:'https://kntobs.jnmyunl.com/shop/images/no_data.png',
  124. tip: '暂无数据'
  125. }
  126. },
  127. // 列表数据
  128. dataList: [],
  129. popshow:false,
  130. keyword:'',
  131. detailsid:{},
  132. CompanyUserInfo:{},
  133. user:{},
  134. phoneUser:{}
  135. };
  136. },
  137. onLoad(options) {
  138. var that=this;
  139. uni.$on('refreshOrder', () => {
  140. that.mescroll.resetUpScroll()
  141. })
  142. this.companyId=options.companyId;
  143. this.companyUserId=options.companyUserId;
  144. // this.cates=this.utils.getDict("storeProductPackageCate");
  145. this.CompanyUserInfo=uni.getStorageSync('CompanyUserInfo');
  146. this.user=uni.getStorageSync('userInfo');
  147. this.getPackagCateList()
  148. },
  149. onUnload() {
  150. uni.$off('refreshOrder')
  151. },
  152. methods: {
  153. getPackagCateList(type){
  154. var data={
  155. companyUserToken:uni.getStorageSync('CompanyUserToken'),
  156. appId:wx.getAccountInfoSync().miniProgram.appId
  157. }
  158. var that=this;
  159. getPackagCateList(data).then(
  160. res => {
  161. if(res.code==200&&res.data&&res.data.length>0){
  162. this.cates=res.data;
  163. this.cateId = res.data[0].dictValue;
  164. this.mescroll&&this.mescroll.resetUpScroll()
  165. }else {
  166. this.cateId = 0
  167. this.dataList = []
  168. }
  169. },
  170. err => {
  171. }
  172. );
  173. },
  174. searchkey(value){
  175. console.log(this.keyword);
  176. searchUser({value:this.keyword}).then(res=>{
  177. if(res.code==200){
  178. this.phoneUser=res.rows
  179. console.log(res)
  180. }else{
  181. uni.showToast({
  182. icon:'none',
  183. title: res.msg,
  184. });
  185. }
  186. })
  187. },
  188. close(){
  189. this.popshow=false
  190. },
  191. show(item){
  192. uni.navigateTo({
  193. url: '../couponDetails?id=' +item.id
  194. })
  195. },
  196. sendpop(id){
  197. this.sendCoupon(id)
  198. },
  199. sendCoupon(id){
  200. const data={
  201. packageId:this.detailsid.packageId,
  202. companyUserId:this.CompanyUserInfo.userId,
  203. companyId:this.CompanyUserInfo.companyId,
  204. setSendUserId:this.user.userId,
  205. userId:id,
  206. companyUserToken:uni.getStorageSync('CompanyUserToken')
  207. }
  208. sendPackage(data).then(res=>{
  209. if(res.code==200){
  210. uni.showToast({
  211. icon:'none',
  212. title: '发送成功!',
  213. });
  214. }else{
  215. uni.showToast({
  216. icon:'none',
  217. title: res.msg,
  218. });
  219. }
  220. })
  221. },
  222. showpop(item){
  223. this.popshow=true
  224. this.detailsid=item
  225. console.log(item)
  226. },
  227. showMore(item){
  228. if(item.displayMore==1){
  229. item.displayMore=0
  230. }
  231. else{
  232. item.displayMore=1
  233. }
  234. item.displayText=item.displayMore==1?'收起':'点击查看方案明细'
  235. },
  236. choseCate(item){
  237. this.cateId = item.dictValue;
  238. this.mescroll.resetUpScroll()
  239. },
  240. goSearch(e) {
  241. this.searchKey=e.detail.value;
  242. this.mescroll.resetUpScroll()
  243. },
  244. mescrollInit(mescroll) {
  245. this.mescroll = mescroll;
  246. },
  247. /*下拉刷新的回调 */
  248. downCallback(mescroll) {
  249. mescroll.resetUpScroll()
  250. },
  251. upCallback(page) {
  252. if(!this.cateId){
  253. this.dataList = []
  254. this.mescroll.endBySize(0, 0);
  255. return
  256. }
  257. //联网加载数据
  258. var that = this;
  259. var data = {
  260. cateId:this.cateId,
  261. title:this.searchKey,
  262. companyId:this.companyId,
  263. page: page.num,
  264. pageSize: page.size
  265. };
  266. getStoreProductPackage(data).then(res => {
  267. if(res.code==200){
  268. //设置列表数据
  269. res.data.list.forEach(function(element) {
  270. element.displayMore=0
  271. element.displayText='点击查看方案明细'
  272. });
  273. if (page.num == 1) {
  274. that.dataList = res.data.list;
  275. } else {
  276. that.dataList = that.dataList.concat(res.data.list);
  277. }
  278. that.dataList.forEach(function(value, index, arr) {
  279. });
  280. that.mescroll.endBySize(res.data.list.length, res.data.total);
  281. }else{
  282. uni.showToast({
  283. icon:'none',
  284. title: "请求失败",
  285. });
  286. that.dataList = null;
  287. that.mescroll.endErr();
  288. }
  289. });
  290. },
  291. showDetail(item) {
  292. uni.navigateTo({
  293. url: './storeProductPackageDetails?packageId=' + item.packageId+"&companyId="+this.companyId+"&companyUserId="+this.companyUserId
  294. })
  295. },
  296. }
  297. }
  298. </script>
  299. <style lang="scss">
  300. .popbox{
  301. padding: 20rpx;
  302. height: 400rpx;
  303. .poplist{
  304. margin-top: 20rpx;
  305. .list-box{
  306. display: flex;
  307. justify-content: space-between;
  308. align-items: center;
  309. .tit{
  310. font-size:24rpx;
  311. color: #666;
  312. }
  313. .send{
  314. width: 122rpx;
  315. height: 50rpx;
  316. line-height: 50rpx;
  317. font-size: 26upx;
  318. font-family: PingFang SC;
  319. font-weight: 500;
  320. text-align: center;
  321. border-radius: 32upx;
  322. margin-left: 15upx;
  323. border: 1px solid #2BC7B9;
  324. color: #2BC7B9;
  325. }
  326. }
  327. }
  328. }
  329. .pop-tit{
  330. display: flex;
  331. padding: 20rpx;
  332. .poptitle{
  333. flex: 1;
  334. text-align: center;
  335. }
  336. }
  337. .top-fixed{
  338. width: 100%;
  339. position: fixed;
  340. top: 0;
  341. left: 0;
  342. z-index: 10;
  343. .search-cont{
  344. padding: 16upx 30upx;
  345. background-color: #FFFFFF;
  346. display:flex;
  347. align-items: center;
  348. justify-content: space-between;
  349. .inner{
  350. box-sizing: border-box;
  351. width: 100%;
  352. height: 72upx;
  353. background: #F7F7F7;
  354. border-radius: 36upx;
  355. display: flex;
  356. align-items: center;
  357. padding: 0 30upx;
  358. .icon-search{
  359. width: 28upx;
  360. height: 28upx;
  361. margin-right: 20upx;
  362. }
  363. input{
  364. height: 60upx;
  365. line-height: 60upx;
  366. flex: 1;
  367. }
  368. }
  369. }
  370. .cate-list{
  371. box-sizing: border-box;
  372. background: #fff;
  373. padding: 10upx 27upx;
  374. height: 100upx;
  375. .inner{
  376. display: flex;
  377. }
  378. .item{
  379. flex-shrink: 0;
  380. padding: 0 24upx;
  381. height: 64upx;
  382. line-height: 64upx;
  383. font-size: 28upx;
  384. font-family: PingFang SC;
  385. font-weight: 500;
  386. color: #2BC7B9;
  387. background: #F5FFFE;
  388. border: 1px solid #8AD5CE;
  389. border-radius: 32upx;
  390. margin: 0 20upx 20upx 0;
  391. &.active{
  392. color: #FFFFFF;
  393. background: #2BC7B9;
  394. border: 1px solid #2BC7B9;
  395. }
  396. }
  397. }
  398. }
  399. .order-list{
  400. padding: 20upx;
  401. .item{
  402. background: #FFFFFF;
  403. border-radius: 16upx;
  404. padding: 0 30upx;
  405. margin-bottom: 20upx;
  406. .ordersn-box{
  407. display: flex;
  408. align-items: center;
  409. justify-content: space-between;
  410. padding: 34upx 0 20upx;
  411. .title{
  412. font-size: 28upx;
  413. font-family: PingFang SC;
  414. font-weight: 500;
  415. color: #111111;
  416. }
  417. // .num{
  418. // font-size: 26upx;
  419. // font-family: PingFang SC;
  420. // font-weight: 500;
  421. // color: #999999;
  422. // line-height: 1;
  423. // }
  424. .status-box{
  425. display: flex;
  426. align-items: center;
  427. .recom-box{
  428. width: 108upx;
  429. height: 30upx;
  430. line-height: 30upx;
  431. text-align: left;
  432. padding-left: 8upx;
  433. font-size: 22upx;
  434. font-family: PingFang SC;
  435. font-weight: 500;
  436. color: #FFFFFF;
  437. background-image: url(https://kntobs.jnmyunl.com/shop/images/recom.png);
  438. background-repeat: no-repeat;
  439. background-size: 100% 100%;
  440. margin-right: 8upx;
  441. }
  442. .text{
  443. font-size: 28upx;
  444. font-family: PingFang SC;
  445. font-weight: 500;
  446. line-height: 1;
  447. &.success{
  448. color: #2BC7B9;
  449. }
  450. &.black{
  451. color: #111111;
  452. }
  453. &.info{
  454. color: #999999;
  455. }
  456. }
  457. }
  458. }
  459. .drug-list{
  460. .drug-item{
  461. padding: 30upx 0;
  462. border-bottom: 1px soli #F0F0F0;
  463. display: flex;
  464. align-items: center;
  465. .img-box{
  466. width: 160upx;
  467. height: 160upx;
  468. margin-right: 30upx;
  469. flex-shrink: 0;
  470. image{
  471. width: 100%;
  472. height: 100%;
  473. }
  474. }
  475. .drug-info{
  476. width: calc(100% - 190upx);
  477. height: 160upx;
  478. display: flex;
  479. flex-direction: column;
  480. justify-content: space-between;
  481. .name-box{
  482. font-size: 28upx;
  483. font-family: PingFang SC;
  484. font-weight: 500;
  485. color: #111111;
  486. line-height: 40upx;
  487. .tag{
  488. display: inline-block;
  489. padding: 0 6upx;
  490. height: 30upx;
  491. background: linear-gradient(90deg, #66b2ef 0%, #2BC7B9 100%);
  492. border-radius: 4upx;
  493. margin-right: 10upx;
  494. font-size: 22upx;
  495. font-family: PingFang SC;
  496. font-weight: bold;
  497. color: #FFFFFF;
  498. line-height: 30upx;
  499. float: left;
  500. margin-top: 7upx;
  501. }
  502. }
  503. .spec{
  504. font-size: 24upx;
  505. font-family: PingFang SC;
  506. font-weight: 500;
  507. color: #999999;
  508. line-height: 1;
  509. margin-top: 10upx;
  510. }
  511. .num-box{
  512. display: flex;
  513. align-items: center;
  514. justify-content: space-between;
  515. .price{
  516. display: flex;
  517. align-items: flex-end;
  518. .unit{
  519. font-size: 24upx;
  520. font-family: PingFang SC;
  521. font-weight: 500;
  522. color: #111111;
  523. line-height: 1.2;
  524. margin-right: 4upx;
  525. }
  526. .num{
  527. font-size: 32upx;
  528. font-family: PingFang SC;
  529. font-weight: 500;
  530. color: #111111;
  531. line-height: 1;
  532. }
  533. }
  534. .amount{
  535. font-size: 24upx;
  536. font-family: PingFang SC;
  537. font-weight: 500;
  538. color: #999999;
  539. line-height: 1;
  540. }
  541. }
  542. }
  543. }
  544. .show{
  545. visibility: flex;
  546. }
  547. .hide{
  548. display: none;
  549. }
  550. .display-more{
  551. font-size: 24upx;
  552. font-family: PingFang SC;
  553. font-weight: 500;
  554. color: #999999;
  555. display: flex;
  556. align-items: center;
  557. justify-content: center;
  558. }
  559. .bottom-box{
  560. height: 110upx;
  561. display: flex;
  562. align-items: center;
  563. justify-content: space-between;
  564. .amount-paid{
  565. display: flex;
  566. align-items: center;
  567. .label{
  568. font-size: 24upx;
  569. font-family: PingFang SC;
  570. font-weight: 500;
  571. color: #999999;
  572. line-height: 1;
  573. }
  574. .price-box{
  575. display: flex;
  576. align-items: flex-end;
  577. .unit{
  578. font-size: 24upx;
  579. font-family: PingFang SC;
  580. font-weight: 500;
  581. color: #FF6633;
  582. line-height: 1.2;
  583. margin-right: 4upx;
  584. }
  585. .num{
  586. font-size: 32upx;
  587. font-family: PingFang SC;
  588. font-weight: bold;
  589. color: #FF6633;
  590. line-height: 1;
  591. }
  592. }
  593. }
  594. .btn-box{
  595. box-sizing: border-box;
  596. display: flex;
  597. align-items: center;
  598. .btn{
  599. width: 155upx;
  600. height: 64upx;
  601. line-height: 64upx;
  602. font-size: 26upx;
  603. font-family: PingFang SC;
  604. font-weight: 500;
  605. text-align: center;
  606. border-radius: 32upx;
  607. margin-left: 15upx;
  608. &:first-child{
  609. margin-left: 0;
  610. }
  611. &.cancel{
  612. border: 1px solid #DDDDDD;
  613. color: #666666;
  614. }
  615. &.pay{
  616. background: #2BC7B9;
  617. color: #FFFFFF;
  618. position: relative;
  619. .share{
  620. display: inline-block;
  621. position: absolute;
  622. top: 0;
  623. left: 0;
  624. width: 100%;
  625. height: 100%rpx;
  626. opacity: 0;
  627. }
  628. }
  629. &.pays{
  630. border:2rpx solid #2BC7B9;
  631. color: #2BC7B9;
  632. position: relative;
  633. .share{
  634. display: inline-block;
  635. position: absolute;
  636. top: 0;
  637. left: 0;
  638. width: 100%;
  639. height: 100%rpx;
  640. opacity: 0;
  641. }
  642. }
  643. }
  644. }
  645. }
  646. }
  647. }
  648. }
  649. </style>