hy-item.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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_text}}</view>
  8. <view v-if="type==3" class="size-30 bg-blue white ptb-18 plr-28">{{item.type==1?'即时单-':'预约单-'}}{{item.status_text}}</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.order_price}}</view>
  14. </view>
  15. <!-- 起始点 -->
  16. <view class="pt-35 pl-40 pr-28" @click="toDetail(item.id)">
  17. <view class="flex">
  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 v-if="item.is_transport==1">
  32. <image src="../../static/hy-banyun.png" style="width: 64rpx;height: 35rpx;" mode=""></image>
  33. <view class="blue size-26">需搬运</view>
  34. </view>
  35. </view>
  36. <view class="w100 flex_r" style="height: 46rpx;">
  37. </view>
  38. <view class="flex flex-bottom mb-40" v-for="(items,index) in item.shaddress" :key="index">
  39. <view class="flex_l u-flex-1 over-hidden" >
  40. <view class="flex flex-column">
  41. <view class="bg-red radius mt-10" style="width: 28rpx;height: 28rpx;"></view>
  42. <view class="size-28 mt-16">终点</view>
  43. </view>
  44. <view class="flex1 flex-column ml-40 u-flex-1 over-hidden">
  45. <view class="flex">
  46. <view class="bold u-flex-1">{{items.end}}</view>
  47. <view class="ml-15 mr-12 gray-1" v-if="index==(item.shaddress.length-1)"> 全程{{item.distance}}km </view>
  48. </view>
  49. <view class="u-line-1 size-28 mt-12">{{items.end_address}}</view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="bt size-28 ptb-20">
  54. <view class="pb-10" v-if="item.demand_text">额外需求:{{item.demand_text}}</view>
  55. <view class="flex">
  56. <view>备注:{{item.remark?item.remark:'无'}}</view>
  57. <view>跟车{{item.people_num}}人</view>
  58. </view>
  59. </view>
  60. </view>
  61. <!-- 按钮 -->
  62. <view v-if="type==1||type==2" class="flex size-32 bold white w100" style="height: 96rpx;">
  63. <view @click="clickButton(item.id,item.status)" class="u-flex-1 bg-blue center h100">{{type==1?'抢单':item.status==5?'开始出发':'查看详情'}}</view>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. // import { formatTime } from '../common/utils.js'
  69. //代驾 -2=已超时,-1=已取消,0=呼叫中,1=已接单,2=进行中,3=待支付,4=司机已到达,5=预约单待司机出发,99=已完成
  70. export default {
  71. props: {
  72. type: {
  73. type: String, // 1 首页 2 订单(1245) 3 历史订单 (3 99)
  74. },
  75. item: {
  76. type: Object
  77. }
  78. },
  79. data() {
  80. return {
  81. };
  82. },
  83. methods: {
  84. toDetail(id) {
  85. uni.navigateTo({
  86. url: '/pages/huoyun/order-detail?id=' + id
  87. })
  88. },
  89. clickButton(id, status) {
  90. if (this.type == 1) {
  91. //首页抢单
  92. this.$http('/addons/ddrive/hyorder/tasking', {
  93. order_id: id
  94. }, "POST").then(() => {
  95. uni.showToast({
  96. title: '抢单成功'
  97. })
  98. setTimeout(() => {
  99. this.toDetail(id)
  100. }, 200)
  101. })
  102. } else if (this.type == 2) {
  103. if (status == 5) {
  104. //订单——已接单——开始出发
  105. this.$http('/addons/ddrive/hyorder/set_out', {
  106. order_id: id
  107. }, "POST").then(() => {
  108. setTimeout(() => {
  109. this.toDetail(id)
  110. }, 200)
  111. })
  112. } else {
  113. //订单——查看详情
  114. this.toDetail(id)
  115. }
  116. }
  117. }
  118. }
  119. }
  120. </script>
  121. <style lang="scss">
  122. </style>