appointment.vue 11 KB

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