order.vue 14 KB

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