storeProductPackage.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  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. //联网加载数据
  253. var that = this;
  254. var data = {
  255. cateId:this.cateId,
  256. title:this.searchKey,
  257. companyId:this.companyId,
  258. page: page.num,
  259. pageSize: page.size
  260. };
  261. getStoreProductPackage(data).then(res => {
  262. if(res.code==200){
  263. //设置列表数据
  264. res.data.list.forEach(function(element) {
  265. element.displayMore=0
  266. element.displayText='点击查看方案明细'
  267. });
  268. if (page.num == 1) {
  269. that.dataList = res.data.list;
  270. } else {
  271. that.dataList = that.dataList.concat(res.data.list);
  272. }
  273. that.dataList.forEach(function(value, index, arr) {
  274. });
  275. that.mescroll.endBySize(res.data.list.length, res.data.total);
  276. }else{
  277. uni.showToast({
  278. icon:'none',
  279. title: "请求失败",
  280. });
  281. that.dataList = null;
  282. that.mescroll.endErr();
  283. }
  284. });
  285. },
  286. showDetail(item) {
  287. uni.navigateTo({
  288. url: './storeProductPackageDetails?packageId=' + item.packageId+"&companyId="+this.companyId+"&companyUserId="+this.companyUserId
  289. })
  290. },
  291. }
  292. }
  293. </script>
  294. <style lang="scss">
  295. .popbox{
  296. padding: 20rpx;
  297. height: 400rpx;
  298. .poplist{
  299. margin-top: 20rpx;
  300. .list-box{
  301. display: flex;
  302. justify-content: space-between;
  303. align-items: center;
  304. .tit{
  305. font-size:24rpx;
  306. color: #666;
  307. }
  308. .send{
  309. width: 122rpx;
  310. height: 50rpx;
  311. line-height: 50rpx;
  312. font-size: 26upx;
  313. font-family: PingFang SC;
  314. font-weight: 500;
  315. text-align: center;
  316. border-radius: 32upx;
  317. margin-left: 15upx;
  318. border: 1px solid #2BC7B9;
  319. color: #2BC7B9;
  320. }
  321. }
  322. }
  323. }
  324. .pop-tit{
  325. display: flex;
  326. padding: 20rpx;
  327. .poptitle{
  328. flex: 1;
  329. text-align: center;
  330. }
  331. }
  332. .top-fixed{
  333. width: 100%;
  334. position: fixed;
  335. top: 0;
  336. left: 0;
  337. z-index: 10;
  338. .search-cont{
  339. padding: 16upx 30upx;
  340. background-color: #FFFFFF;
  341. display:flex;
  342. align-items: center;
  343. justify-content: space-between;
  344. .inner{
  345. box-sizing: border-box;
  346. width: 100%;
  347. height: 72upx;
  348. background: #F7F7F7;
  349. border-radius: 36upx;
  350. display: flex;
  351. align-items: center;
  352. padding: 0 30upx;
  353. .icon-search{
  354. width: 28upx;
  355. height: 28upx;
  356. margin-right: 20upx;
  357. }
  358. input{
  359. height: 60upx;
  360. line-height: 60upx;
  361. flex: 1;
  362. }
  363. }
  364. }
  365. .cate-list{
  366. box-sizing: border-box;
  367. background: #fff;
  368. padding: 10upx 27upx;
  369. height: 100upx;
  370. .inner{
  371. display: flex;
  372. }
  373. .item{
  374. flex-shrink: 0;
  375. padding: 0 24upx;
  376. height: 64upx;
  377. line-height: 64upx;
  378. font-size: 28upx;
  379. font-family: PingFang SC;
  380. font-weight: 500;
  381. color: #2BC7B9;
  382. background: #F5FFFE;
  383. border: 1px solid #8AD5CE;
  384. border-radius: 32upx;
  385. margin: 0 20upx 20upx 0;
  386. &.active{
  387. color: #FFFFFF;
  388. background: #2BC7B9;
  389. border: 1px solid #2BC7B9;
  390. }
  391. }
  392. }
  393. }
  394. .order-list{
  395. padding: 20upx;
  396. .item{
  397. background: #FFFFFF;
  398. border-radius: 16upx;
  399. padding: 0 30upx;
  400. margin-bottom: 20upx;
  401. .ordersn-box{
  402. display: flex;
  403. align-items: center;
  404. justify-content: space-between;
  405. padding: 34upx 0 20upx;
  406. .title{
  407. font-size: 28upx;
  408. font-family: PingFang SC;
  409. font-weight: 500;
  410. color: #111111;
  411. }
  412. // .num{
  413. // font-size: 26upx;
  414. // font-family: PingFang SC;
  415. // font-weight: 500;
  416. // color: #999999;
  417. // line-height: 1;
  418. // }
  419. .status-box{
  420. display: flex;
  421. align-items: center;
  422. .recom-box{
  423. width: 108upx;
  424. height: 30upx;
  425. line-height: 30upx;
  426. text-align: left;
  427. padding-left: 8upx;
  428. font-size: 22upx;
  429. font-family: PingFang SC;
  430. font-weight: 500;
  431. color: #FFFFFF;
  432. background-image: url(https://kntobs.jnmyunl.com/shop/images/recom.png);
  433. background-repeat: no-repeat;
  434. background-size: 100% 100%;
  435. margin-right: 8upx;
  436. }
  437. .text{
  438. font-size: 28upx;
  439. font-family: PingFang SC;
  440. font-weight: 500;
  441. line-height: 1;
  442. &.success{
  443. color: #2BC7B9;
  444. }
  445. &.black{
  446. color: #111111;
  447. }
  448. &.info{
  449. color: #999999;
  450. }
  451. }
  452. }
  453. }
  454. .drug-list{
  455. .drug-item{
  456. padding: 30upx 0;
  457. border-bottom: 1px soli #F0F0F0;
  458. display: flex;
  459. align-items: center;
  460. .img-box{
  461. width: 160upx;
  462. height: 160upx;
  463. margin-right: 30upx;
  464. flex-shrink: 0;
  465. image{
  466. width: 100%;
  467. height: 100%;
  468. }
  469. }
  470. .drug-info{
  471. width: calc(100% - 190upx);
  472. height: 160upx;
  473. display: flex;
  474. flex-direction: column;
  475. justify-content: space-between;
  476. .name-box{
  477. font-size: 28upx;
  478. font-family: PingFang SC;
  479. font-weight: 500;
  480. color: #111111;
  481. line-height: 40upx;
  482. .tag{
  483. display: inline-block;
  484. padding: 0 6upx;
  485. height: 30upx;
  486. background: linear-gradient(90deg, #66b2ef 0%, #2BC7B9 100%);
  487. border-radius: 4upx;
  488. margin-right: 10upx;
  489. font-size: 22upx;
  490. font-family: PingFang SC;
  491. font-weight: bold;
  492. color: #FFFFFF;
  493. line-height: 30upx;
  494. float: left;
  495. margin-top: 7upx;
  496. }
  497. }
  498. .spec{
  499. font-size: 24upx;
  500. font-family: PingFang SC;
  501. font-weight: 500;
  502. color: #999999;
  503. line-height: 1;
  504. margin-top: 10upx;
  505. }
  506. .num-box{
  507. display: flex;
  508. align-items: center;
  509. justify-content: space-between;
  510. .price{
  511. display: flex;
  512. align-items: flex-end;
  513. .unit{
  514. font-size: 24upx;
  515. font-family: PingFang SC;
  516. font-weight: 500;
  517. color: #111111;
  518. line-height: 1.2;
  519. margin-right: 4upx;
  520. }
  521. .num{
  522. font-size: 32upx;
  523. font-family: PingFang SC;
  524. font-weight: 500;
  525. color: #111111;
  526. line-height: 1;
  527. }
  528. }
  529. .amount{
  530. font-size: 24upx;
  531. font-family: PingFang SC;
  532. font-weight: 500;
  533. color: #999999;
  534. line-height: 1;
  535. }
  536. }
  537. }
  538. }
  539. .show{
  540. visibility: flex;
  541. }
  542. .hide{
  543. display: none;
  544. }
  545. .display-more{
  546. font-size: 24upx;
  547. font-family: PingFang SC;
  548. font-weight: 500;
  549. color: #999999;
  550. display: flex;
  551. align-items: center;
  552. justify-content: center;
  553. }
  554. .bottom-box{
  555. height: 110upx;
  556. display: flex;
  557. align-items: center;
  558. justify-content: space-between;
  559. .amount-paid{
  560. display: flex;
  561. align-items: center;
  562. .label{
  563. font-size: 24upx;
  564. font-family: PingFang SC;
  565. font-weight: 500;
  566. color: #999999;
  567. line-height: 1;
  568. }
  569. .price-box{
  570. display: flex;
  571. align-items: flex-end;
  572. .unit{
  573. font-size: 24upx;
  574. font-family: PingFang SC;
  575. font-weight: 500;
  576. color: #FF6633;
  577. line-height: 1.2;
  578. margin-right: 4upx;
  579. }
  580. .num{
  581. font-size: 32upx;
  582. font-family: PingFang SC;
  583. font-weight: bold;
  584. color: #FF6633;
  585. line-height: 1;
  586. }
  587. }
  588. }
  589. .btn-box{
  590. box-sizing: border-box;
  591. display: flex;
  592. align-items: center;
  593. .btn{
  594. width: 155upx;
  595. height: 64upx;
  596. line-height: 64upx;
  597. font-size: 26upx;
  598. font-family: PingFang SC;
  599. font-weight: 500;
  600. text-align: center;
  601. border-radius: 32upx;
  602. margin-left: 15upx;
  603. &:first-child{
  604. margin-left: 0;
  605. }
  606. &.cancel{
  607. border: 1px solid #DDDDDD;
  608. color: #666666;
  609. }
  610. &.pay{
  611. background: #2BC7B9;
  612. color: #FFFFFF;
  613. position: relative;
  614. .share{
  615. display: inline-block;
  616. position: absolute;
  617. top: 0;
  618. left: 0;
  619. width: 100%;
  620. height: 100%rpx;
  621. opacity: 0;
  622. }
  623. }
  624. &.pays{
  625. border:2rpx solid #2BC7B9;
  626. color: #2BC7B9;
  627. position: relative;
  628. .share{
  629. display: inline-block;
  630. position: absolute;
  631. top: 0;
  632. left: 0;
  633. width: 100%;
  634. height: 100%rpx;
  635. opacity: 0;
  636. }
  637. }
  638. }
  639. }
  640. }
  641. }
  642. }
  643. }
  644. </style>