appointment.vue 12 KB

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