order-detail.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <view class="bt" style="padding-bottom: 150rpx;">
  3. <view class="plr-36 ptb-30 bb flex">
  4. <view class="flex1 flex-middle">
  5. <text class="bold">{{info.car_name}}</text>
  6. <view class="mlr-15" style="width: 1rpx;height: 29rpx ;background: #bbb;"></view>
  7. <text>{{info.appointment_time_text?info.appointment_time_text:'立即出发'}}</text>
  8. </view>
  9. <view class="">
  10. {{info.status_text}}
  11. </view>
  12. </view>
  13. <view class="plr-32 ptb-25">
  14. <view class="flex1 flex-middle">
  15. <view class="center" style="width: 100rpx;">
  16. <view class="" style="width: 28rpx;height: 28rpx;background: #6340FF;border-radius: 50%;"></view>
  17. </view>
  18. <view class="ml-30 bold">
  19. {{info.start}}
  20. </view>
  21. </view>
  22. <view class="flex1 flex-middle mt-20">
  23. <view class="center" style="width: 100rpx;">
  24. 起点
  25. </view>
  26. <view class="ml-30">
  27. {{info.start_address}}
  28. </view>
  29. </view>
  30. </view>
  31. <view class="plr-32 ptb-25" v-for="(item,i) in info.shaddress" :key="i">
  32. <view class="flex1 flex-middle">
  33. <view class="center" style="width: 100rpx;">
  34. <view class="" style="width: 28rpx;height: 28rpx;background: #EA0000;border-radius: 50%;"></view>
  35. </view>
  36. <view class="ml-30 bold">
  37. {{item.end}}
  38. </view>
  39. </view>
  40. <view class="flex1 flex-middle mt-15">
  41. <view class="center" style="width: 100rpx;">
  42. {{i==info.shaddress.length-1?'终点站':'中途站'}}
  43. </view>
  44. <view class="ml-30 u-flex-1 flex">
  45. <view class="mr-20">
  46. {{item.end_address}}
  47. </view>
  48. <view class="img center">
  49. <image @click="toMap(item.end_latitude,item.end_longitude)" src="../../static/order-map.png" mode="" class="mr-20"></image>
  50. <image @click="toTel(item.mobile)" v-if="item.mobile" src="../../static/order-phone.png" mode=""></image>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="plr-36 bb ptb-30">
  56. <view class="flex1 flex-middle">
  57. <view class="">
  58. 跟车人数:
  59. </view>
  60. <view class="">
  61. {{info.people_num}}人
  62. </view>
  63. </view>
  64. <view class="flex1 mt-20" v-if="info.demand_text">
  65. <view class="">
  66. 额外需求:
  67. </view>
  68. <view class="u-flex-1">
  69. {{info.demand_text}}
  70. </view>
  71. </view>
  72. <view class="flex1 mt-20">
  73. <view class="">
  74. 订单备注:
  75. </view>
  76. <view class="u-flex-1">
  77. {{info.remark?info.remark:'无'}}
  78. </view>
  79. </view>
  80. </view>
  81. <view class="plr-36 ptb-30">
  82. <view class="bold">
  83. 订单信息
  84. </view>
  85. <view class="mt-20">
  86. 订单号:{{info.out_trade_no}}
  87. </view>
  88. <view class="mt-20">
  89. 下单时间:{{info.createtime}}
  90. </view>
  91. <view class="mt-20">
  92. 订单总价:¥{{info.order_price}}
  93. </view>
  94. <view class="mt-20">
  95. 支付方式:{{info.pay_method==1?'在线支付':'货到付款'}}
  96. </view>
  97. <view class="mt-20">
  98. 订单里程:约{{info.distance}}千米
  99. </view>
  100. <view class="mt-20" v-if="info.platform_service_fee!=0">
  101. 服务费:{{info.platform_service_fee}}元
  102. </view>
  103. </view>
  104. <!-- status -1=已取消,0=呼叫中,1=已接单,2=进行中,3=待支付,
  105. 4=司机已到达,5=预约单待司机出发,99=已完成' -->
  106. <view class="fixed-bottom pd-36">
  107. <u-button @click="takeOrder" type="primary" v-if="info.status==0">立即接单</u-button>
  108. <u-button @click="onOrigin" type="primary" v-if="info.status==1">确认我已到达</u-button>
  109. <u-button @click="toDestination" type="primary" v-if="info.status==4">开始行程</u-button>
  110. <u-button @click="toPay" type="primary" v-if="info.status==2">确认货物已到达</u-button>
  111. <u-button @click="startGo" type="primary" v-if="info.status==5">开始出发</u-button>
  112. <u-button @click="toHome" type="primary" v-if="info.status==-1">订单已取消,重新接单</u-button>
  113. <u-button @click="toHome" type="primary" v-if="info.status==99">订单已完成,重新接单</u-button>
  114. <u-button @click="toPay1" type="primary" v-if="info.status==3">确认货到付款</u-button>
  115. </view>
  116. </view>
  117. </template>
  118. <script>
  119. export default {
  120. data() {
  121. return {
  122. id: '',
  123. info: {},
  124. timer:null,
  125. arr:[0,1,4,5]
  126. }
  127. },
  128. onLoad(option) {
  129. this.id = option.id
  130. this.init()
  131. },
  132. onShow(){
  133. this.init()
  134. },
  135. onHide() {
  136. clearInterval(this.timer)
  137. this.timer=null
  138. },
  139. onUnload() {
  140. clearInterval(this.timer)
  141. this.timer=null
  142. },
  143. methods: {
  144. init() {
  145. this.$http('/addons/ddrive/hyorder/info', {
  146. order_id: this.id
  147. }, "POST").then(data => {
  148. this.info = data
  149. uni.setNavigationBarTitle({
  150. title:data.status_text
  151. })
  152. if(!this.timer&&this.arr.includes(this.info.status*1)){
  153. this.timer = setInterval(()=>{
  154. if(!this.arr.includes(this.info.status*1)){
  155. clearInterval(this.timer)
  156. this.timer=null
  157. }else{
  158. this.init()
  159. }
  160. },1000)
  161. }
  162. })
  163. },
  164. // 抢单
  165. takeOrder() {
  166. this.$http('/addons/ddrive/hyorder/tasking', {
  167. order_id: this.info.id
  168. }, "POST").then(() => {
  169. uni.showToast({
  170. title: '接单成功'
  171. })
  172. this.init()
  173. })
  174. },
  175. // 预约单开始出发
  176. startGo() {
  177. this.$http('/addons/ddrive/hyorder/set_out', {
  178. order_id: this.info.id
  179. }, "POST").then(() => {
  180. this.init()
  181. })
  182. },
  183. // 到达起点
  184. onOrigin() {
  185. this.$http('/addons/ddrive/hyorder/reach', {
  186. order_id: this.info.id
  187. }, "POST").then(() => {
  188. this.init()
  189. })
  190. },
  191. // 开始行程
  192. toDestination() {
  193. this.$http('/addons/ddrive/hyorder/start', {
  194. order_id: this.info.id
  195. }, "POST").then(() => {
  196. this.init()
  197. })
  198. },
  199. // 确认订单
  200. toPay() {
  201. this.$http('/addons/ddrive/hyorder/done', {
  202. order_id: this.info.id
  203. }, "POST").then(() => {
  204. console.log(this.info.pay_method);
  205. if(this.info.pay_method==1){
  206. this.init()
  207. }else{
  208. uni.navigateTo({
  209. url:'/pages/huoyun/pay?id='+this.id
  210. })
  211. }
  212. })
  213. },
  214. toPay1(){
  215. uni.navigateTo({
  216. url:'/pages/huoyun/pay?id='+this.id
  217. })
  218. },
  219. toHome(){
  220. uni.switchTab({
  221. url:'/pages/home/index'
  222. })
  223. },
  224. toTel(tel){
  225. uni.makePhoneCall({
  226. phoneNumber: tel //仅为示例
  227. });
  228. },
  229. toMap(lat,long){
  230. uni.getSystemInfo({
  231. success(res) {
  232. console.log(res.platform);
  233. if(res.platform=='android'){
  234. plus.runtime.openURL("androidamap://navi?sourceApplication=ddcar&lat="+lat+"&lon="+long+"&dev=0&style=2")
  235. }else if(res.platform=='ios'){
  236. plus.runtime.openURL("iosamap://navi?sourceApplication=ddcar&lat="+lat+"&lon="+long+"&dev=0&style=2")
  237. }
  238. }
  239. })
  240. }
  241. }
  242. }
  243. </script>
  244. <style lang="scss" scoped>
  245. /deep/.u-btn--primary {
  246. background: $blue !important;
  247. }
  248. .img {
  249. image {
  250. width: 54rpx;
  251. height: 54rpx;
  252. }
  253. }
  254. </style>