appointment.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. <template>
  2. <view class="">
  3. <!-- <view class="">
  4. 我的预约
  5. </view> -->
  6. <view class="navbar flex">
  7. <view class="nav-item" v-for="(navitem,index) in navList" :class="{'action': index == currentIndex}"
  8. @click="navClick(index)">
  9. {{navitem.tit}}
  10. </view>
  11. </view>
  12. <swiper :interval="3000" :duration="1000" :style="{'height': height}" class="swiper-box" @scrolltolower="loadData()">
  13. <swiper-item>
  14. <scroll-view scroll-y="true" :style="{'height': height}">
  15. <empty v-if="navList[currentIndex].loaded === true && navList[currentIndex].list.length === 0">
  16. </empty>
  17. <view class="buy-item" v-for="item in navList[currentIndex].list">
  18. <view class="item-top">
  19. <view class="top-left">
  20. <image src="../../static/icon/mrlogo.png" mode=""></image><text
  21. class="top-name clamp">{{item.order_id}}</text>
  22. </view>
  23. <view class="top-right">
  24. {{item.status | status}}
  25. </view>
  26. </view>
  27. <view class="item-info">
  28. <view class="info-data">
  29. <view class="info-tit">收益:</view>
  30. <view class="info-val">{{item.day}}天/{{item.proportion}}%</view>
  31. </view>
  32. <view class="info-data">
  33. <view class="info-tit">可获通证:</view>
  34. <view class="info-val">{{item.pass}}%</view>
  35. </view>
  36. <view class="info-data" v-if="item.status == 1 || item.status == -1">
  37. <view class="info-tit">是否中奖:</view>
  38. <view class="info-val">{{item.status == 1?'中奖':item.status == -1 ? '未中奖': ''}}</view>
  39. </view>
  40. <view class="info-data">
  41. <view class="info-tit">价值:</view>
  42. <view class="info-val">{{item.price}}</view>
  43. </view>
  44. <view class="upimg" v-if="item.status == 1">
  45. <view class="up-tit">
  46. 打款凭证:
  47. </view>
  48. <view class="img-wrap" v-if="item.pay_evaluation" @click="lookimg(item.pay_evaluation)">
  49. <image :src="item.pay_evaluation" mode=""></image>
  50. </view>
  51. <view class="" style="color: #0F253A;font-weight: bold;font-size: 26rpx;" v-else>
  52. 上传支付凭证
  53. </view>
  54. </view>
  55. <view class="btn-wrap flex" v-if="item.status == 1 || item.status == 2">
  56. <!-- <view class="btn" @click="open(item.id)"> -->
  57. <view class="btn" @click="navto('/pages/purchase/upload?id=' + item.id + '&paytype=' + JSON.stringify(item.touser) )">
  58. 提交凭证
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. <uni-load-more :status="navList[currentIndex].loadingType"></uni-load-more>
  64. </scroll-view>
  65. </swiper-item>
  66. </swiper>
  67. <uni-popup ref="lookimg" type="center">
  68. <view class="pop-wrap" style="position: relative;" >
  69. <movable-area class="popup-box">
  70. <movable-view class="popup-item" :scale="true" direction="all">
  71. <image :src="chooseImg" mode=""></image>
  72. </movable-view>
  73. </movable-area>
  74. <image src="../../static/icon/close.png" mode="" class="close" style="width: 80rpx;height: 80rpx;" @click="closePup"></image>
  75. </view>
  76. </uni-popup>
  77. </view>
  78. </template>
  79. <script>
  80. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  81. import empty from '@/components/empty';
  82. import {
  83. packageMyReserveList, evaluationUpload
  84. } from '@/api/package.js'
  85. import {
  86. tabbar,
  87. tabbar1
  88. } from "@/utils/tabbar.js";
  89. import { upload } from '@/api/user.js';
  90. export default {
  91. components: {
  92. uniLoadMore,
  93. empty
  94. },
  95. filters: {
  96. status(val) {
  97. let str = ''
  98. // 状态:0-预约,1-待支付,2-待审核,3-释放中,4-释放完成,5-重新发放,6-完成,-1-没抢到,-2-审核无效
  99. switch (val) {
  100. case 0:
  101. str = '预约'
  102. break;
  103. case 1:
  104. str = '待支付'
  105. break;
  106. case 2:
  107. str = '待审核'
  108. break;
  109. case 3:
  110. str = '释放中'
  111. break;
  112. case 4:
  113. str = '释放完成'
  114. break;
  115. case 5:
  116. str = '重新发放'
  117. break;
  118. case 6:
  119. str = '完成'
  120. break;
  121. case -1:
  122. str = '没抢到'
  123. break;
  124. case -2:
  125. str = '审核无效'
  126. break;
  127. default:
  128. str = ''
  129. }
  130. return str
  131. }
  132. },
  133. data() {
  134. return {
  135. chooseImg: '',
  136. height: '',
  137. currentIndex: 0,
  138. navList: [{
  139. status: 'today',
  140. tit: '当天预约',
  141. list: [],
  142. page: 1,
  143. limit: 10,
  144. loadingType: 'more',
  145. loaded: false,
  146. },
  147. {
  148. status: 1,
  149. tit: '待支付',
  150. list: [],
  151. page: 1,
  152. limit: 10,
  153. loadingType: 'more',
  154. loaded: false,
  155. },
  156. {
  157. status: '',
  158. tit: '所有预约',
  159. list: [],
  160. page: 1,
  161. limit: 10,
  162. loadingType: 'more',
  163. loaded: false,
  164. }
  165. ],
  166. tabbar: tabbar,
  167. tabbar1: tabbar1,
  168. current: 3,
  169. choose_order: '',
  170. upimg: '',
  171. }
  172. },
  173. onLoad() {
  174. console.log('我的预约')
  175. this.loadData()
  176. },
  177. onReady(res) {
  178. var obj = this;
  179. uni.getSystemInfo({
  180. success: resu => {
  181. const query = uni.createSelectorQuery();
  182. query.select('.swiper-box').boundingClientRect();
  183. query.exec(function(res) {
  184. console.log(res, 'ddddddddddddd');
  185. obj.height = resu.windowHeight - res[0].top + 'px';
  186. console.log('打印页面的剩余高度', obj.height);
  187. });
  188. },
  189. fail: res => {}
  190. });
  191. },
  192. methods: {
  193. lookimg(src) {
  194. console.log(src,'chooseImg++++++')
  195. this.chooseImg = src
  196. this.$refs.lookimg.open()
  197. },
  198. closePup() {
  199. this.chooseImg = ''
  200. this.$refs.lookimg.close()
  201. },
  202. navto(url) {
  203. uni.navigateTo({
  204. url: url
  205. })
  206. },
  207. qx() {
  208. this.upimg = ''
  209. this.choose_order = ''
  210. this.$refs.popup1.close()
  211. },
  212. open(orderId) {
  213. this.choose_order = orderId
  214. this.$refs.popup1.open()
  215. },
  216. imgsub(text) {
  217. console.log('imgsub');
  218. upload({
  219. filename: ''
  220. }).then(data => {
  221. // this.upimg = data[0].url;
  222. this.$set(this,text,data[0].url)
  223. });
  224. },
  225. //提交审核
  226. evaluationUpload() {
  227. let obj = this
  228. evaluationUpload({
  229. pay_evaluation: obj.upimg,
  230. id: obj.choose_order
  231. }).then( res => {
  232. this.qx()
  233. uni.showToast({
  234. title:'提交成功',
  235. duration:2000
  236. });
  237. this.page = 1
  238. this.list = []
  239. this.loadingType = 'more'
  240. this.loadData()
  241. console.log(res,'上传凭证+++++')
  242. })
  243. },
  244. navClick(index) {
  245. this.currentIndex = index
  246. this.loadData('swiper')
  247. },
  248. loadData(text) {
  249. let obj = this
  250. let index = obj.currentIndex
  251. let navItem = obj.navList[index]
  252. if (text == 'swiper' && navItem.loaded) {
  253. return
  254. }
  255. if (navItem.loadingType == 'loading' || navItem.loadingType == 'noMore') {
  256. return
  257. }
  258. navItem.loadingType = 'loading'
  259. if(navItem.status == 1) {
  260. packageMyReserveList({
  261. page: navItem.page,
  262. limit: navItem.limit,
  263. status: 1
  264. }).then(({
  265. data
  266. }) => {
  267. // console.log(res)
  268. navItem.list = navItem.list.concat(data.data)
  269. this.page++
  270. if (data.data.length == navItem.limit) {
  271. navItem.loadingType = 'more'
  272. } else {
  273. navItem.loadingType = 'noMore'
  274. }
  275. obj.$set(navItem, 'loaded', true)
  276. })
  277. }else {
  278. packageMyReserveList({
  279. page: navItem.page,
  280. limit: navItem.limit,
  281. data: navItem.status
  282. }).then(({
  283. data
  284. }) => {
  285. // console.log(res)
  286. navItem.list = navItem.list.concat(data.data)
  287. this.page++
  288. if (data.data.length == navItem.limit) {
  289. navItem.loadingType = 'more'
  290. } else {
  291. navItem.loadingType = 'noMore'
  292. }
  293. obj.$set(navItem, 'loaded', true)
  294. })
  295. }
  296. }
  297. }
  298. }
  299. </script>
  300. <style lang="scss" scoped>
  301. .navbar {
  302. background-color: #fff;
  303. height: 80rpx;
  304. .nav-item {
  305. width: 50%;
  306. text-align: center;
  307. font-size: 30rpx;
  308. font-family: PingFang SC;
  309. font-weight: 500;
  310. color: #333333;
  311. }
  312. .action {
  313. font-weight: bold;
  314. position: relative;
  315. &::after {
  316. content: '';
  317. width: 84rpx;
  318. height: 4rpx;
  319. background: #FF4C4C;
  320. border-radius: 2px;
  321. position: absolute;
  322. bottom: -20rpx;
  323. left: 0;
  324. right: 0;
  325. margin: auto;
  326. }
  327. }
  328. }
  329. .swiper-box {
  330. // background-color: red;
  331. padding-top: 20rpx;
  332. // padding-bottom: 20rpx;
  333. }
  334. .buy-item {
  335. width: 690rpx;
  336. // height: 235rpx;
  337. margin: 0 auto 20rpx;
  338. background: #FFFFFF;
  339. box-shadow: 0px 0px 17rpx 0px rgba(0, 0, 0, 0.05);
  340. border-radius: 20rpx;
  341. padding: 26rpx 30rpx;
  342. .item-top {
  343. display: flex;
  344. justify-content: space-between;
  345. height: 50rpx;
  346. .top-left {
  347. font-size: 34rpx;
  348. font-family: PingFang SC;
  349. font-weight: bold;
  350. color: #0F253A;
  351. line-height: 50rpx;
  352. display: flex;
  353. align-items: center;
  354. image {
  355. width: 48rpx;
  356. height: 46rpx;
  357. }
  358. .top-name {
  359. width: 450rpx;
  360. padding-left: 11rpx;
  361. }
  362. }
  363. .top-right {
  364. line-height: 50rpx;
  365. width: 100rpx;
  366. text-align: right;
  367. font-size: 26rpx;
  368. font-family: PingFang SC;
  369. font-weight: 500;
  370. color: #6D7C88;
  371. }
  372. }
  373. .item-info {
  374. width: 100%;
  375. margin-top: 28rpx;
  376. line-height: 50rpx;
  377. font-size: 26rpx;
  378. font-family: PingFang SC;
  379. display: flex;
  380. flex-wrap: wrap;
  381. .info-data {
  382. width: 50%;
  383. display: flex;
  384. .info-tit {
  385. font-weight: 500;
  386. color: #6D7C88;
  387. }
  388. .info-val {
  389. color: #0F253A;
  390. font-weight: bold;
  391. }
  392. }
  393. .upimg {
  394. padding-top: 10rpx;
  395. display: flex;
  396. .up-tit {
  397. display: inline-block;
  398. font-size: 26rpx;
  399. font-family: PingFang SC;
  400. font-weight: 500;
  401. color: #6D7C88;
  402. }
  403. .img-wrap {
  404. width: 153rpx;
  405. height: 152rpx;
  406. border-radius: 20rpx;
  407. image {
  408. border-radius: 20rpx;
  409. width: 153rpx;
  410. height: 152rpx;
  411. // background-color: red;
  412. }
  413. }
  414. }
  415. .btn-wrap {
  416. padding-top: 20rpx;
  417. width: 100%;
  418. justify-content: flex-end;
  419. .btn {
  420. text-align: center;
  421. width: 144rpx;
  422. line-height: 50rpx;
  423. background: #FFFFFF;
  424. border: 2rpx solid #FF4C4C;
  425. border-radius: 25rpx;
  426. font-size: 26rpx;
  427. font-family: PingFang SC;
  428. font-weight: 500;
  429. color: #FF4C4C;
  430. }
  431. }
  432. }
  433. }
  434. .pop-wrap {
  435. width: 522rpx;
  436. height: 800rpx;
  437. // background-color: red;
  438. }
  439. .popup-box {
  440. width: 522rpx;
  441. height: 800rpx;
  442. border-radius: 20rpx;
  443. position: relative;
  444. overflow: hidden;
  445. background-color: #fff;
  446. .popup-item {
  447. width: 100%;
  448. height: 100%;
  449. image {
  450. width: 100%;
  451. // height: 100%;
  452. }
  453. }
  454. }
  455. .close {
  456. display: block;
  457. width: 40rpx;
  458. height: 40rpx;
  459. border: 50%;
  460. position: absolute;
  461. // background-color: red;
  462. bottom: -100rpx;
  463. left: 0;
  464. right: 0;
  465. margin: 0 auto;
  466. }
  467. </style>