storeProductPackage.vue 15 KB

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