order.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. <template>
  2. <view class="">
  3. <u-sticky bgColor="#fff">
  4. <view class="tab">
  5. <u-tabs :list="list1" :activeStyle="{color: '#1E9F6A'}" lineColor="#1E9F6A" lineWidth="50"
  6. :scrollable="false" @click="clickTab" :current="current"></u-tabs>
  7. </view>
  8. </u-sticky>
  9. <!-- <view class="list" @click="goOrderDetail">
  10. <view class="list-top">
  11. <view class="">
  12. 订单号xxxxx
  13. </view>
  14. <view class="">
  15. 待付款
  16. </view>
  17. </view>
  18. <view class="" style="margin: 20rpx 0;">
  19. 套餐名称xxxx
  20. </view>
  21. <view class="">
  22. 出行日期:2022.5.1
  23. </view>
  24. <view class="amount">
  25. <view class="">
  26. 数量 : 1
  27. </view>
  28. <view class="">
  29. <view class="">
  30. ¥xx
  31. </view>
  32. </view>
  33. </view>
  34. <view class="list-bottom">
  35. <view class="">
  36. 出行人
  37. </view>
  38. <view class="">
  39. 去支付
  40. </view>
  41. <view class="" @click="goaggMes">
  42. 集合信息
  43. </view>
  44. </view>
  45. </view> -->
  46. <view class="list" v-for="(item,index) in orderList" :key="index" @click="goOrderDetail(item.id)"
  47. v-if="state!=5">
  48. <view class="list-top">
  49. <view class="flexall">
  50. 订单号 {{item.code}}
  51. <view style="padding-left: 5rpx;" @click.stop="copyCode(item.code)">
  52. <u-icon name="file-text"></u-icon>
  53. </view>
  54. </view>
  55. <view class="">
  56. <!-- 待付款 -->{{item.status_text}}
  57. </view>
  58. </view>
  59. <view class="listcenter">
  60. <view class="l">
  61. <view class="" style="font-size: 36rpx;font-weight: 600;color: #333333;">
  62. {{item.good_name}}
  63. </view>
  64. <view class="" style="margin: 28rpx 0 20rpx;">
  65. 日期:{{item.start_at.slice(0,10)}} ~ {{item.end_at.slice(0,10)}}
  66. </view>
  67. <view class="">
  68. 数量 : {{item.number}}
  69. </view>
  70. </view>
  71. <view class="r">
  72. <view class="">
  73. <image :src="item.cover_picture"></image>
  74. </view>
  75. <view class="">
  76. 订单金额
  77. </view>
  78. <view class="" style="font-size: 36rpx;font-weight: 600;color: #333333;">
  79. ¥{{item.amount}}
  80. </view>
  81. </view>
  82. </view>
  83. <view class="list-bottom">
  84. <view class="list-bottom-item" v-if="item.status==4||item.status==5||item.status==3"
  85. @click.stop="buyAgin(item.good_id)">
  86. <image src="../../static/orderListicon/notepad@2x.png" mode="aspectFill"></image>
  87. <text class="">
  88. 再次预订
  89. </text>
  90. </view>
  91. <view class="list-bottom-item" v-if="item.status==1" @click.stop="goPay(item.id)">
  92. <image src="../../static/orderListicon/notepad@2x.png" mode="aspectFill"></image>
  93. <text class="">
  94. 去支付
  95. </text>
  96. </view>
  97. <view class="list-bottom-item" v-if="item.status==2&&item.refund_status==0"
  98. @click.stop="goAfterSale(item)">
  99. <image src="../../static/orderListicon/notepad@2x.png" mode="aspectFill"></image>
  100. <text class="">
  101. 申请退款
  102. </text>
  103. </view>
  104. <view class="list-bottom-item" v-if="item.status==2&&item.refund_status!==0">
  105. <image src="../../static/orderListicon/notepad@2x.png" mode="aspectFill"></image>
  106. <text class="">
  107. 已申请退款
  108. </text>
  109. </view>
  110. <view class="line" v-if="item.status==1||item.status==2">
  111. </view>
  112. <view class="list-bottom-item" @click.stop="goguide(item)" v-if="item.status==1||item.status==2">
  113. <image src="../../static/orderListicon/bookmark@2x(1).png" mode="heightFix"></image>
  114. <text class="">
  115. 专属森林向导
  116. </text>
  117. </view>
  118. </view>
  119. </view>
  120. <view class="list" v-for="(item,index) in orderList" :key="index" @click.stop="orderSaleDetail(item.id)"
  121. v-if="state==5">
  122. <view class="list-top">
  123. <view class="flexall">
  124. 订单号 {{item.order.code}}
  125. <view style="padding-left: 5rpx;" @click.stop="copyCode(item.code)">
  126. <u-icon name="file-text"></u-icon>
  127. </view>
  128. </view>
  129. <view class="">
  130. <!-- 待付款 -->{{item.status_text}}
  131. </view>
  132. </view>
  133. <view class="listcenter">
  134. <view class="l">
  135. <view class="" style="font-size: 36rpx;font-weight: 600;color: #333333;">
  136. {{item.order.good_name}}
  137. </view>
  138. <view class="" style="margin: 28rpx 0 20rpx;">
  139. 日期:{{item.order.start_at.slice(0,10)}} ~ {{item.order.end_at.slice(0,10)}}
  140. </view>
  141. <view class="">
  142. 数量 : {{item.order.number}}
  143. </view>
  144. </view>
  145. <view class="r">
  146. <view class="">
  147. <image :src="item.order.cover_picture"></image>
  148. </view>
  149. <view class="">
  150. 订单金额
  151. </view>
  152. <view class="" style="font-size: 36rpx;font-weight: 600;color: #333333;">
  153. ¥{{item.order.amount}}
  154. </view>
  155. </view>
  156. </view>
  157. <view class="list-bottom">
  158. <view class="list-bottom-item" @click.stop="orderSaleDetail(item.id)">
  159. <image src="../../static/orderListicon/notepad@2x.png" mode="aspectFill"></image>
  160. <text class="">
  161. 售后详情
  162. </text>
  163. </view>
  164. </view>
  165. </view>
  166. <view style="margin-top:140rpx;" v-if="orderList.length==0">
  167. <u-loadmore v-if="orderList.length==0" :status="nomore" fontSize="30" :line="true" nomoreText="暂无订单" />
  168. </view>
  169. <!-- <view class="list" v-if="state==2 || state==0?true:false" @click="goOrderDetail1">
  170. <view class="list-top">
  171. <view class="">
  172. 订单号 RYX202213582
  173. </view>
  174. <view class="">
  175. 待出行
  176. </view>
  177. </view>
  178. <view class="listcenter">
  179. <view class="l">
  180. <view class="" style="font-size: 36rpx;font-weight: 600;color: #333333;">
  181. 夕阳红康养团7日游
  182. </view>
  183. <view class="" style="margin: 28rpx 0 20rpx;">
  184. 日期:2022-04-25 ~ 2022-05-01
  185. </view>
  186. <view class="">
  187. 数量 : 1
  188. </view>
  189. </view>
  190. <view class="r">
  191. <view class="">
  192. <image src="https://t38.9026.com/uploads/golf/images/2022-05-31/20220531601652.png" mode="widthFix"></image>
  193. </view>
  194. <view class="">
  195. 订单金额
  196. </view>
  197. <view class="" style="font-size: 36rpx;font-weight: 600;color: #333333;">
  198. ¥1690
  199. </view>
  200. </view>
  201. </view>
  202. <view class="list-bottom">
  203. <view class="list-bottom-item" @click="goafter">
  204. <image src="../../static/orderListicon/login@2x.png" mode="heightFix"></image>
  205. <text class="">
  206. 申请退款
  207. </text>
  208. </view>
  209. <view class="line">
  210. </view>
  211. <view class="list-bottom-item" @click="goguide">
  212. <image src="../../static/orderListicon/bookmark@2x(1).png" mode="heightFix"></image>
  213. <text class="">
  214. 专属森林向导
  215. </text>
  216. </view>
  217. </view>
  218. </view>
  219. <view class="list" v-if="state==3 || state==0?true:false" >
  220. <view class="list-top">
  221. <view class="">
  222. 订单号 RYX202213582
  223. </view>
  224. <view class="">
  225. 已完成
  226. </view>
  227. </view>
  228. <view class="listcenter">
  229. <view class="l">
  230. <view class="" style="font-size: 36rpx;font-weight: 600;color: #333333;">
  231. 夕阳红康养团7日游
  232. </view>
  233. <view class="" style="margin: 28rpx 0 20rpx;">
  234. 日期:2022-04-25 ~ 2022-05-01
  235. </view>
  236. <view class="">
  237. 数量 : 1
  238. </view>
  239. </view>
  240. <view class="r">
  241. <view class="">
  242. <image src="https://t38.9026.com/uploads/golf/images/2022-05-31/20220531601652.png" mode="widthFix"></image>
  243. </view>
  244. <view class="">
  245. 订单金额
  246. </view>
  247. <view class="" style="font-size: 36rpx;font-weight: 600;color: #333333;">
  248. ¥1690
  249. </view>
  250. </view>
  251. </view>
  252. <view class="list-bottoms">
  253. <image src="../../static/orderListicon/notes-edit-add@2x.png" mode="heightFix"></image>
  254. <text class="">
  255. 再次预定
  256. </text>
  257. </view>
  258. </view>
  259. <view class="list" v-if="state==4 || state==0?true:false" @click="goOrderAfterSale">
  260. <view class="list-top">
  261. <view class="">
  262. 订单号 RYX202213582
  263. </view>
  264. <view class="">
  265. 待退款
  266. </view>
  267. </view>
  268. <view class="listcenter">
  269. <view class="l">
  270. <view class="" style="font-size: 36rpx;font-weight: 600;color: #333333;">
  271. 夕阳红康养团7日游
  272. </view>
  273. <view class="" style="margin: 28rpx 0 20rpx;">
  274. 日期:2022-04-25 ~ 2022-05-01
  275. </view>
  276. <view class="">
  277. 数量 : 1
  278. </view>
  279. </view>
  280. <view class="r">
  281. <view class="">
  282. <image src="https://t38.9026.com/uploads/golf/images/2022-05-31/20220531601652.png" mode="widthFix"></image>
  283. </view>
  284. <view class="">
  285. 订单金额
  286. </view>
  287. <view class="" style="font-size: 36rpx;font-weight: 600;color: #333333;">
  288. ¥1690
  289. </view>
  290. </view>
  291. </view>
  292. <view class="list-bottoms">
  293. <image src="../../static/orderListicon/notes-edit-add@2x.png" mode="heightFix"></image>
  294. <text class="">
  295. 售后详情
  296. </text>
  297. </view>
  298. </view>
  299. <view class="list" v-if="state==4 || state==0?true:false" @click="goOrderAfterSale1">
  300. <view class="list-top">
  301. <view class="">
  302. 订单号 RYX202213582
  303. </view>
  304. <view class="">
  305. 已退款
  306. </view>
  307. </view>
  308. <view class="listcenter">
  309. <view class="l">
  310. <view class="" style="font-size: 36rpx;font-weight: 600;color: #333333;">
  311. 夕阳红康养团7日游
  312. </view>
  313. <view class="" style="margin: 28rpx 0 20rpx;">
  314. 日期:2022-04-25 ~ 2022-05-01
  315. </view>
  316. <view class="">
  317. 数量 : 1
  318. </view>
  319. </view>
  320. <view class="r">
  321. <view class="">
  322. <image src="https://t38.9026.com/uploads/golf/images/2022-05-31/20220531601652.png" mode="widthFix"></image>
  323. </view>
  324. <view class="">
  325. 订单金额
  326. </view>
  327. <view class="" style="font-size: 36rpx;font-weight: 600;color: #333333;">
  328. ¥1690
  329. </view>
  330. </view>
  331. </view>
  332. <view class="list-bottoms">
  333. <image src="../../static/orderListicon/notes-edit-add@2x.png" mode="heightFix"></image>
  334. <text class="">
  335. 售后详情
  336. </text>
  337. </view>
  338. </view> -->
  339. <!-- <view v-show="nomore&&orderList.length>0" class="more"><text>暂无更多</text></view> -->
  340. <view class="" style="padding-top: 100rpx;width: 100%;"></view>
  341. </view>
  342. </template>
  343. <script>
  344. export default {
  345. data() {
  346. return {
  347. list1: [
  348. {
  349. name: '全部'
  350. },
  351. {
  352. name: '待付款'
  353. },
  354. {
  355. name: '待出行'
  356. },
  357. {
  358. name: '已完成'
  359. },
  360. {
  361. name: '售后'
  362. },
  363. ],
  364. // 订单状态(0全部 1待付款 2待出行 3已完成 4售后)
  365. state: 0,
  366. // 订单列表
  367. orderList: [],
  368. page: 1,
  369. nomore: false,
  370. current: 0
  371. }
  372. },
  373. onLoad(o) {
  374. if (o.state) {
  375. this.state = o.state
  376. if (this.state == 0) {
  377. this.current = 0
  378. } else if (this.state == 1) {
  379. this.current = 1
  380. } else if (this.state == 2) {
  381. this.current = 2
  382. } else if (this.state == 3) {
  383. this.current = 3
  384. }
  385. }
  386. this.init()
  387. },
  388. // 下拉到底部后加载新数据
  389. onReachBottom() {
  390. //判断下一页是否存在数据,不存在将显示暂无数据等提示语
  391. if (this.orderList.length >= this.page * 10) {
  392. this.page++; //页数加一
  393. this.init(); //回调接口
  394. } else {
  395. this.nomore = true
  396. }
  397. },
  398. onShow() {
  399. let token = uni.getStorageSync("token")
  400. if (!token) {
  401. //未登录
  402. uni.showToast({
  403. title: "请先登录",
  404. icon: 'none'
  405. })
  406. setTimeout(() => {
  407. uni.navigateTo({
  408. url: "/pages/login"
  409. })
  410. }, 1500)
  411. return false
  412. }
  413. this.initvist()
  414. },
  415. methods: {
  416. initvist() {
  417. let curPage = getCurrentPages();
  418. let route = curPage[curPage.length - 1].route; //获取当前页面的路由
  419. let code = uni.getStorageSync("code")
  420. let obj = {
  421. page: route,
  422. code: code
  423. }
  424. if (code) {
  425. uni.$u.http.post('/api/visit/add', obj, {
  426. custom: {
  427. auth: true
  428. }
  429. }).then((res) => {}).catch((err) => {})
  430. }
  431. },
  432. init() {
  433. this.$showLoadding("加载中")
  434. let obj = {
  435. status: this.state,
  436. page: this.page,
  437. per_page: 10
  438. }
  439. uni.$u.http.post('/api/order/list', obj, {
  440. custom: {
  441. auth: true
  442. }
  443. }).then((res) => {
  444. uni.hideLoading()
  445. if (res.data) {
  446. res.data.forEach(item => {
  447. this.orderList.push(item)
  448. })
  449. } else {
  450. this.nomore = true
  451. }
  452. }).catch((err) => {
  453. this.$toast(err.message)
  454. })
  455. },
  456. initAferSale() {
  457. this.$showLoadding("加载中")
  458. let obj = {
  459. status: 0,
  460. page: this.page,
  461. per_page: 10
  462. }
  463. uni.$u.http.post('/api/refund/list', obj, {
  464. custom: {
  465. auth: true
  466. }
  467. }).then((res) => {
  468. uni.hideLoading()
  469. if (res.data) {
  470. res.data.forEach(item => {
  471. this.orderList.push(item)
  472. })
  473. } else {
  474. this.nomore = true
  475. }
  476. }).catch((err) => {
  477. this.$toast(err.message)
  478. })
  479. },
  480. copyCode(code) {
  481. uni.setClipboardData({
  482. data: code,
  483. success: function() {
  484. // this.$toast("复制成功")
  485. }
  486. });
  487. },
  488. orderSaleDetail(id) {
  489. uni.navigateTo({
  490. url: "/pages/order/orderAfterSale?id=" + id
  491. })
  492. },
  493. clickTab(item) {
  494. console.log('item', item);
  495. if (item.index == 0) {
  496. this.state = 0
  497. this.orderList = []
  498. this.page = 1
  499. this.nomore = false
  500. this.init()
  501. } else if (item.index == 1) {
  502. this.state = 1
  503. this.orderList = []
  504. this.page = 1
  505. this.nomore = false
  506. this.init()
  507. } else if (item.index == 2) {
  508. this.state = 2
  509. this.orderList = []
  510. this.page = 1
  511. this.nomore = false
  512. this.init()
  513. } else if (item.index == 3) {
  514. this.state = 3
  515. this.orderList = []
  516. this.page = 1
  517. this.nomore = false
  518. this.init()
  519. } else if (item.index == 4) {
  520. this.state = 5
  521. this.orderList = []
  522. this.page = 1
  523. this.nomore = false
  524. this.initAferSale()
  525. }
  526. },
  527. getAfterSale() {
  528. this.$showLoadding("加载中")
  529. uni.$u.http.post('/api/refund/list', {
  530. status: 0,
  531. page: 1,
  532. per_page: 5
  533. }, {
  534. custom: {
  535. auth: true
  536. }
  537. }).then((res) => {
  538. uni.hideLoading()
  539. console.log(res)
  540. this.orderList = res.data
  541. }).catch((err) => {
  542. console.log(err)
  543. })
  544. },
  545. goAfterSale(item) {
  546. uni.navigateTo({
  547. url: "/pages/order/applyAfterSale?obj=" + encodeURIComponent(JSON.stringify(item))
  548. })
  549. },
  550. goPay(id) {
  551. uni.$u.http.post('/api/order/config', {
  552. order_id: id,
  553. }).then(res => {
  554. // console.log(res)
  555. uni.requestPayment({
  556. provider: 'wxpay', //支付类型-固定值
  557. timeStamp: res.timeStamp, // 时间戳(单位:秒)
  558. nonceStr: res.nonceStr, // 随机字符串
  559. package: res.package, // 固定值
  560. signType: res.signType, //固定值
  561. paySign: res.paySign, //签名
  562. success: function(res) {
  563. // console.log('success:' + JSON.stringify(res));
  564. console.log("支付成功");
  565. uni.navigateTo({
  566. url: "/pages/order/successpay?id=" + id
  567. })
  568. },
  569. fail: function(err) {
  570. console.log('fail:' + JSON.stringify(err));
  571. console.log("支付失败");
  572. }
  573. });
  574. }).catch(err => {
  575. console.log(err)
  576. uni.showToast({
  577. icon: "error",
  578. title: err.message,
  579. })
  580. })
  581. },
  582. buyAgin(id) {
  583. uni.navigateTo({
  584. url: "/pages/travel/travelDetails?id=" + id
  585. })
  586. },
  587. // 跳转订单售后详情------待退框
  588. goOrderAfterSale() {
  589. uni.navigateTo({
  590. url: "/pages/order/orderAfterSale?id=0"
  591. })
  592. },
  593. // 跳转订单售后详情------已退框
  594. goOrderAfterSale1() {
  595. uni.navigateTo({
  596. url: "/pages/order/orderAfterSale?id=1"
  597. })
  598. },
  599. // 跳转集合页面
  600. goguide(item) {
  601. console.log(item)
  602. if (item.status == 1) {
  603. uni.showModal({
  604. title: "提示",
  605. content: "订单支付后可进入专属森林向导"
  606. })
  607. return
  608. } else {
  609. uni.navigateTo({
  610. url: "/pages/order/guide?muster=" + encodeURIComponent(JSON.stringify(item.plan))
  611. })
  612. }
  613. },
  614. // 跳转支付订单详情
  615. goOrderDetail(id) {
  616. uni.navigateTo({
  617. url: `/pages/order/orderDetails?id=${id}`
  618. })
  619. },
  620. // 跳转待出行订单详情
  621. goOrderDetail1() {
  622. uni.navigateTo({
  623. url: "/pages/order/orderDetails?id=2"
  624. })
  625. },
  626. // 跳转退款售后
  627. goafter() {
  628. uni.navigateTo({
  629. url: "/pages/order/applyAfterSale"
  630. })
  631. }
  632. }
  633. }
  634. </script>
  635. <style lang="less">
  636. page {
  637. background-color: #F4F4F4;
  638. font-size: 26rpx;
  639. }
  640. .tab {
  641. background-color: #FFFFFF;
  642. }
  643. .list {
  644. box-shadow: 0px 2rpx 4rpx 0px rgba(0, 0, 0, 0.02);
  645. border-radius: 16rpx 16rpx 16rpx 56rpx;
  646. background-color: #FFFFFF;
  647. // padding: 30rpx;
  648. margin: 20rpx 30rpx;
  649. .flexall {
  650. display: flex;
  651. align-items: center;
  652. }
  653. .list-top {
  654. display: flex;
  655. justify-content: space-between;
  656. padding-bottom: 20rpx;
  657. border-bottom: 1px solid #E3E3E3;
  658. padding: 30rpx;
  659. }
  660. .listcenter {
  661. display: flex;
  662. justify-content: space-between;
  663. // margin: 24rpx 0 40rpx;
  664. padding: 30rpx;
  665. .r {
  666. text-align: right;
  667. .image {
  668. // width: 140rpx;
  669. }
  670. image {
  671. width: 140rpx;
  672. height: 84rpx;
  673. border-radius: 6rpx;
  674. }
  675. }
  676. }
  677. .list-bottom {
  678. // background: #FBFBFB;
  679. border-radius: 0px 0px 16rpx 56rpx;
  680. background-color: #FBFBFB;
  681. display: flex;
  682. justify-content: space-between;
  683. align-items: center;
  684. padding: 30rpx 0;
  685. .line {
  686. width: 1px;
  687. height: 24rpx;
  688. background-color: #1E9F6A;
  689. }
  690. .list-bottom-item {
  691. color: #1E9F6A;
  692. text-align: center;
  693. image {
  694. width: 24rpx;
  695. height: 24rpx;
  696. margin-right: 10rpx;
  697. }
  698. flex: 1;
  699. }
  700. }
  701. .list-bottoms {
  702. border-radius: 0px 0px 16rpx 56rpx;
  703. background-color: #FBFBFB;
  704. padding: 30rpx 0;
  705. color: #1E9F6A;
  706. image {
  707. height: 24rpx;
  708. margin-right: 10rpx;
  709. }
  710. text-align: center;
  711. }
  712. }
  713. </style>