order-item.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view class="bg-white" style="box-shadow: 0px 0px 13px 0px rgba(18, 0, 98, 0.2);">
  3. <!-- 标题 -->
  4. <view class="flex">
  5. <view class="flex_l">
  6. <view v-if="type==1" class="size-30 bg-blue white ptb-18 plr-28">{{item.type==1?'即时单':'预约单'}}</view>
  7. <view v-if="type==2" class="size-30 bg-blue white ptb-18 plr-28">{{item.type==1?'即时单-':'预约单-'}}{{item.status==5?'已接单':'行程中'}}</view>
  8. <view v-if="type==3" class="size-30 bg-blue white ptb-18 plr-28">{{item.type==1?'即时单-':'预约单-'}}{{item.status==3?'待支付':'已完成'}}</view>
  9. <view class="ml-20" v-if="type!=3&&item.type==1">立即出发</view>
  10. <view class="ml-20 size-28" v-if="type!=3&&item.type==2">{{ item.appointment_time | formatDate }} 出发</view>
  11. <view class="ml-20 red" v-if="type==3&&item.platform_service_fee">服务费:¥{{item.platform_service_fee}}</view>
  12. </view>
  13. <view class="red bold mr-36">¥{{item.estimated_price}}</view>
  14. </view>
  15. <!-- 起始点 -->
  16. <view class="ptb-35 pl-40 pr-28" @click="toDetail(item.id)">
  17. <view class="flex flex-top">
  18. <view class="flex_l u-flex-1 over-hidden">
  19. <view class="flex flex-column">
  20. <view class="bg-purple radius mt-10" style="width: 28rpx;height: 28rpx;"></view>
  21. <view class="size-28 mt-16">起点</view>
  22. </view>
  23. <view class="flex1 flex-column ml-40 u-flex-1 over-hidden">
  24. <view class="flex">
  25. <view class="bold u-flex-1">{{item.start}}</view>
  26. <!-- <view class="gray-1">【距您1.5km】</view> -->
  27. </view>
  28. <view class="u-line-1 size-28 mt-12">{{item.start_address}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="w100 flex_r" style="height: 46rpx;">
  33. </view>
  34. <view class="flex flex-bottom">
  35. <view class="flex_l u-flex-1 over-hidden">
  36. <view class="flex flex-column">
  37. <view class="bg-red radius mt-10" style="width: 28rpx;height: 28rpx;"></view>
  38. <view class="size-28 mt-16">终点</view>
  39. </view>
  40. <view class="flex1 flex-column ml-40 u-flex-1 over-hidden">
  41. <view class="flex">
  42. <view class="bold u-flex-1">{{item.end}}</view>
  43. <view class="ml-15 mr-12 gray-1"> 全程{{(item.distance/1000).toFixed(1)}}km </view>
  44. </view>
  45. <view class="u-line-1 size-28 mt-12">{{item.end_address}}</view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <!-- 按钮 -->
  51. <view v-if="type==1||type==2" class="flex size-32 bold white w100" style="height: 96rpx;">
  52. <!-- <view @click="zhuandan(1)" v-if="type==2&&status==1" class="bg-gray-2 center h100" style="width: 170rpx;">转单</view> -->
  53. <view @click="clickButton(item.id,item.status)" class="u-flex-1 bg-blue center h100">{{type==1?'抢单':item.status==5?'开始出发':'查看详情'}}</view>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. // import { formatTime } from '../common/utils.js'
  59. export default {
  60. props: {
  61. type: {
  62. type: Number, // 1 首页 2 订单(124行程中 5已接单) 3 历史订单 (3待支付 99已完成)
  63. },
  64. item: {
  65. type: Object
  66. }
  67. },
  68. data() {
  69. return {
  70. };
  71. },
  72. methods: {
  73. toDetail(id) {
  74. uni.navigateTo({
  75. url: '/pages/home/detail?id=' + id
  76. })
  77. },
  78. clickButton(id, status) {
  79. if (this.type == 1) {
  80. //首页抢单
  81. this.$http('/addons/ddrive/order/taking', {
  82. order_id: id
  83. }, "POST").then(() => {
  84. uni.showToast({
  85. title: '抢单成功'
  86. })
  87. setTimeout(() => {
  88. this.toDetail(id)
  89. }, 200)
  90. })
  91. } else if (this.type == 2) {
  92. if (status == 5) {
  93. //订单——已接单——开始出发
  94. this.$http('/addons/ddrive/order/set_out', {
  95. order_id: id
  96. }, "POST").then(() => {
  97. setTimeout(() => {
  98. this.toDetail(id)
  99. }, 200)
  100. })
  101. } else {
  102. //订单——查看详情
  103. this.toDetail(id)
  104. }
  105. }
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="scss">
  111. </style>