order.vue 14 KB

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