orderStatus.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021
  1. <template>
  2. <view class="container-view">
  3. <view class="time-info">
  4. <navBar bgColor="transparent" left="0"></navBar>
  5. <view>
  6. <view v-if="orderInfo.pay_status!=2">
  7. <view v-if="orderInfo.pay_status == 0">待支付</view>
  8. <view v-else-if="orderInfo.pay_status == 1">支付中</view>
  9. <view v-else-if="orderInfo.pay_status == 3">支付失败</view>
  10. <view v-else-if="orderInfo.pay_status == 4">支付取消</view>
  11. <view v-else-if="orderInfo.pay_status == 5">线下待审核</view>
  12. <view v-else-if="orderInfo.pay_status == 6">线下审核拒绝</view>
  13. </view>
  14. <view class="get-time-view flex-row" v-if="orderInfo.order_status == 1 "><text>请于</text><text class="get-car-time">{{tools.formatTimeSecond( orderInfo.pick_up_time)}}</text><text>到门店取车</text>
  15. </view>
  16. <view v-if="orderInfo.order_status == 2">请上传车辆图片激活车辆</view>
  17. <block v-if="orderInfo.pay_status == 2">
  18. <view v-if="orderInfo.order_status == 3" class="blue-text">使用中...</view>
  19. <view v-if="orderInfo.order_status == 4" class="red-text">已逾期</view>
  20. <view v-if="orderInfo.order_status == 5">待门店确认</view>
  21. <view v-if="orderInfo.order_status == 6">还车中,等待门店取车</view>
  22. <view v-if="orderInfo.order_status == 7">已完成</view>
  23. <view v-if="orderInfo.order_status == 10">已完结</view>
  24. </block>
  25. <view v-if="orderInfo.order_status == 8||orderInfo.order_status == 9">已取消</view>
  26. </view>
  27. <view class="time-money">
  28. <view v-if="orderInfo.order_type != 3" class="flex-row flex-between">
  29. <view class="money-item">
  30. <view :class="orderInfo.order_status == 4?'red-status':''">
  31. <block v-if="orderInfo.hire_duration_time">{{orderInfo.hire_duration_time}}</block>
  32. </view>
  33. <view>{{((orderInfo.order_status == 2&&orderInfo.hire_type==2) || orderInfo.order_status == 3)?'租期剩余':(orderInfo.order_status == 4 ? '逾期时长':'租借周期')}}·<text style="opacity: 0.4;">天</text></view>
  34. <!-- <view v-if="(orderInfo.order_status == 2&&orderInfo.hire_type==2) || orderInfo.order_status == 3">
  35. 租期剩余·天</view>
  36. <view v-else-if="orderInfo.order_status == 4 " class="red-status">逾期时长·天</view>
  37. <view v-else>租借周期·天</view> -->
  38. </view>
  39. <view v-if="orderInfo.order_status != 4" class="money-item">
  40. <view>
  41. {{tools.toFix(orderInfo.hire_money / 100)}}
  42. </view>
  43. <view>订单金额<text style="opacity: 0.4;">·$</text></view>
  44. </view>
  45. <view v-if="orderInfo.order_status == 4" class="money-item">
  46. <view style="color:#F95151" class="red-status">
  47. {{tools.toFix(overdueData.money / 100)}}
  48. </view>
  49. <view style="color:#F95151">逾期金额·$</view>
  50. </view>
  51. <view @tap="bindExpanded">
  52. <text>{{isExpanded?'收起':'展开'}}</text>
  53. <img
  54. :src="isExpanded?'https://qiniu.bms16.com/FvRah8ro91B_TUVEmInBq6n69W2f':'https://qiniu.bms16.com/FtbxPP0aXYG8hyJTEJfNTXa_Puuc'" />
  55. </view>
  56. </view>
  57. <view v-if="orderInfo.order_type == 3" class="flex-row flex-between">
  58. <view class="money-item">
  59. <view></view>
  60. <view>租借周期:购买</view>
  61. </view>
  62. <view class="money-item">
  63. <view :class="orderInfo.order_status == 4?'red-status':''">
  64. {{orderInfo.order_status == 4?tools.toFix(over_fee/100):tools.toFix(orderInfo.money / 100)}}<text>元</text>
  65. </view>
  66. <view>订单金额</view>
  67. </view>
  68. <view @tap="bindExpanded">
  69. <text>{{isExpanded?'收起':'展开'}}</text>
  70. <img
  71. :src="isExpanded?'https://qiniu.bms16.com/FvRah8ro91B_TUVEmInBq6n69W2f':'https://qiniu.bms16.com/FtbxPP0aXYG8hyJTEJfNTXa_Puuc'" />
  72. </view>
  73. </view>
  74. <view v-if="isExpanded" class="dashed-border"></view>
  75. <view v-if="isExpanded">
  76. <view class="big-text">订单信息</view>
  77. <view class="sn-content flex-row flex-between">
  78. <view class="sn-title">订单编号</view>
  79. <view class="sn-text">{{orderInfo.sub_sn}}</view>
  80. </view>
  81. <view class="sn-content flex-row flex-between">
  82. <view class="sn-title">下单时间</view>
  83. <view class="sn-text">{{tools.formatTime(orderInfo.ctime)}}</view>
  84. </view>
  85. <view v-if="orderInfo.pay_time" class="sn-content flex-row flex-between">
  86. <view class="sn-title">支付时间</view>
  87. <view class="sn-text">{{tools.formatTime(orderInfo.pay_time)}}</view>
  88. </view>
  89. <view class="sn-content flex-row flex-between">
  90. <view class="sn-title">支付方式</view>
  91. <view v-if="orderInfo.pay_type == 0" class="sn-text">微信支付</view>
  92. <view v-if="orderInfo.pay_type == 1" class="sn-text">线下支付</view>
  93. <view v-if="orderInfo.pay_type == 2" class="sn-text">支付宝支付</view>
  94. <view v-if="orderInfo.pay_type == 9" class="sn-text">钱包余额支付</view>
  95. </view>
  96. <view v-if="orderInfo.order_type != 3" class="sn-content flex-row flex-between">
  97. <view class="sn-title">租车金额</view>
  98. <view class="sn-text">$ {{tools.toFix(orderInfo.hire_money/1000)}}</view>
  99. </view>
  100. <view v-if="orderInfo.order_type != 3" class="sn-content flex-row flex-between">
  101. <view class="sn-title">租车押金</view>
  102. <view class="sn-text"><text class="grey-text"></text> $
  103. {{tools.toFix(orderInfo.deposit/1000)}}
  104. </view>
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. <view class="car-info">
  110. <view class="flex-row flex-between" style="margin-bottom: 40rpx;">
  111. <text>自行去门店取还</text>
  112. <text class="distance-num">{{orderInfo.distance}}m</text>
  113. </view>
  114. <view class="flex-row store-img-view">
  115. <img src="https://qiniu.bms16.com/FrwDlFZdSMiBgqnqDjB19PiDUmuu" alt="">
  116. <view style="width: calc(100% - 180rpx);margin-left: 24rpx;">
  117. <view class="store-name">{{orderInfo.shop_name}}</view>
  118. <view class="store-name-address">{{orderInfo.address || '未知地址'}}</view>
  119. <view class="flex-row flex-between align-center">
  120. <view class="flex-row time-style align-center">
  121. <img v-if="orderInfo.work_begin_time && orderInfo.work_end_time"
  122. style="width: 40rpx;height: 40rpx;"
  123. src="https://qiniu.bms16.com/Fp-G1pdXxnTV-G3qFbgS453AuqcU" alt="">
  124. <text
  125. v-if="orderInfo.work_begin_time && orderInfo.work_end_time">{{orderInfo.work_begin_time}}-{{orderInfo.work_end_time}}</text>
  126. </view>
  127. <img @click="navToCabinet" style="width: 112rpx;height: 64rpx;"
  128. src="https://qiniu.bms16.com/Fts38M35doVjK09GfOza5qD-wwkK" alt="">
  129. </view>
  130. </view>
  131. </view>
  132. </view>
  133. <view class="car-info">
  134. <view>车辆信息</view>
  135. <view class="car-top flex-row flex-between">
  136. <view>
  137. <view class="top-flex">
  138. <view>{{orderInfo.model_name}}</view>
  139. <view>续航{{(orderInfo.endurance /100).toFixed(0)}}km|重量{{(orderInfo.weight / 1000).toFixed(0)}}kg</view>
  140. </view>
  141. <!-- //配套服务 -->
  142. <view class="serviceList">
  143. <view v-for="(item,index) of orderInfo.service_list" :key="index" class="tag">
  144. {{item}}
  145. </view>
  146. </view>
  147. </view>
  148. <image mode="aspectFill" v-if="orderInfo.model_images" :src="orderInfo.model_images"></image>
  149. <image v-else src="https://qiniu.bms16.com/FhEvnKUckAHPtWaC04mi2s53IEVj" mode=""></image>
  150. </view>
  151. <!-- <view class="exchange-info">
  152. <view class="flex-row flex-between">
  153. <view class="exchange-info-title flex-row align-center">
  154. <img style="width: 40rpx;height: 40rpx;" src="https://qiniu.bms16.com/Fj_ifr41AqH2PijZBdOBa3SCxADg" alt="">
  155. <text style="margin-left: 16rpx;">换电信息</text>
  156. </view>
  157. <view @tap="navToExchange" class="flex-row" style="margin-bottom: 28rpx;">
  158. <view class="exchange-button">共3次</view>
  159. <image src="https://qiniu.bms16.com/FpIN7AVzFU75slFlX-SIdnSEmn1k" style="width: 28rpx;height: 28rpx;" />
  160. </view>
  161. </view>
  162. <view class="exchange-content">本单可享3次免费换电数,超出后需单独支付</view>
  163. <view class="exchange-content">自费换电:S1/次</view> -->
  164. <!-- <view class="exchange-content">本单您可享受{{orderInfo.gift_exchange_num}}次免费换电,
  165. 当前免费换电剩余{{(orderInfo.gift_exchange_num - orderInfo.used_exchange_num) > 0 ? (orderInfo.gift_exchange_num - orderInfo.used_exchange_num) : '0' }}次,超出后需要单独支付换电费用
  166. </view> -->
  167. <!-- </view> -->
  168. </view>
  169. <view v-if="orderInfo.hire_begin_time!=0&&orderInfo.hire_end_time!=0" class="return-info">
  170. <view class="return-top flex-row flex-between">
  171. <view>取还时间</view>
  172. <view>
  173. <!-- 共3天{{orderInfo.hire_return_time.day > 0 ? orderInfo.hire_return_time.day :'' }}<text
  174. v-if="orderInfo.hire_return_time.day>0">日</text>{{orderInfo.hire_return_time.hour > 0 ? orderInfo.hire_return_time.hour :'' }}<text
  175. v-if="orderInfo.hire_return_time.hour>0">小时</text>{{orderInfo.hire_return_time.minute > 0 ? orderInfo.hire_return_time.minute :'' }}<text
  176. v-if="orderInfo.hire_return_time.minute>0">分</text> -->
  177. 共{{hireDurationUnitsFn(orderInfo.total_hire_time,orderInfo.hire_duration_unit)}}
  178. </view>
  179. </view>
  180. <view class="return-bottom flex-row">
  181. <view>{{orderInfo.hire_begin_times}}</view>
  182. <img src="https://qiniu.bms16.com/FoXmBbj7YGWmjyeuVEY35nzieqnx" />
  183. <view>{{orderInfo.hire_end_times}}</view>
  184. <!-- <view>{{tools.formatTimeDate(orderInfo.hire_begin_time)}}</view>
  185. <img src="https://qiniu.bms16.com/FoXmBbj7YGWmjyeuVEY35nzieqnx" />
  186. <view>{{tools.formatTimeDate(orderInfo.hire_end_time)}}</view> -->
  187. </view>
  188. </view>
  189. <view v-if="orderInfo.order_status==2||orderInfo.order_status==3||orderInfo.order_status==4"
  190. class="overdue-info">
  191. <view>逾期规则</view>
  192. <view class="overdue-one">
  193. <view>1. 逾期后还可用车吗?</view>
  194. <view>如果逾期将触发智能锁车逻辑,可能导致您无法正常用车,请及时续费或联系商家处理。</view>
  195. </view>
  196. <view class="overdue-two">
  197. <view>2. 逾期费计算标准是什么?</view>
  198. <view>小时租逾期费=每小时费用*逾期小时;当日还/日/周/月/季租逾期费=每天费用*逾期天数;如果不满1小时按1小时算,不满1天按1天算,最终收取的逾期费以门店确认的费用为准</view>
  199. </view>
  200. <view class="overdue-thr">
  201. <view>3. 逾期后续租如何收费?</view>
  202. <view>逾期后及时续租不收取逾期费,逾期时长将从续租订单的用车时间中抵扣</view>
  203. </view>
  204. </view>
  205. <view class="inset-bottom"></view>
  206. <view class="payment-info flex-row flex-between">
  207. <view>
  208. <view v-if="(orderInfo.order_status == 0 ||orderInfo.order_status == 1 || orderInfo.pay_status == 5 || orderInfo.pay_status == 0) && orderInfo.order_type != 3" class="cancel" @tap="clickCancel">结束订单</view>
  209. </view>
  210. <view class="flex-row">
  211. <view v-if="orderInfo.order_status == 1" @tap="navToScan" class="sesame-btn ">扫码绑定</view>
  212. <view v-if="orderInfo.order_status == 2" @tap="navToScan" class="sesame-btn ">去上传</view>
  213. <view v-if="(orderInfo.order_status == 3||orderInfo.order_status == 4) && orderInfo.order_type != 3 && orderInfo.pay_status != 5" @tap="tapReturnCar" class="deposit-btn">到店还车</view>
  214. <view v-if="(orderInfo.order_status == 3||orderInfo.order_status == 4) && orderInfo.order_type != 3 && orderInfo.pay_status != 5" @tap="bindRenew" class="sesame-btn">续租</view>
  215. <view @tap="callStorePhone" class="deposit-btn ">联系门店</view>
  216. </view>
  217. </view>
  218. <!-- <view class="payment-info flex-row flex-between">
  219. <view v-if="orderInfo.order_status == 1 || orderInfo.pay_status == 5" class="flex-row">
  220. <view v-if="orderInfo.order_type != 3"
  221. class="cancel" @tap="clickCancel">结束订单
  222. </view>
  223. <view @tap="callStorePhone" class="deposit-btn ">联系门店</view>
  224. </view>
  225. <view v-if="orderInfo.order_status == 1" class="flex-row">
  226. <view @tap="callStorePhone" class="deposit-btn ">联系门店</view>
  227. <view @tap="navToScan" class="sesame-btn ">扫码绑定</view>
  228. </view>
  229. <view v-if="orderInfo.order_status == 2" class="flex-row">
  230. <view @tap="callStorePhone" class="deposit-btn ">联系门店</view>
  231. <view @tap="navToScan" class="sesame-btn ">去上传</view>
  232. </view>
  233. <view
  234. v-else-if="(orderInfo.order_status == 3||orderInfo.order_status == 4) && orderInfo.order_type != 3 && orderInfo.pay_status != 5"
  235. class="flex-row">
  236. <view @tap="callStorePhone" class="cancel">联系门店</view>
  237. <view @tap="tapReturnCar" class="deposit-btn">到店还车</view>
  238. <view @tap="bindRenew" class="sesame-btn">续租</view>
  239. </view>
  240. <view v-else-if="orderInfo.order_status == 5||orderInfo.order_status == 6" @tap="callStorePhone"
  241. class="pay-btn">
  242. 联系门店</view>
  243. <view v-else-if="orderInfo.order_status == 7" @tap="callStorePhone" class="pay-btn">联系门店</view>
  244. <view v-if="orderInfo.order_type == 3 && (orderInfo.order_status == 3||orderInfo.order_status == 4)"
  245. @tap="callStorePhone" class="pay-btn">联系门店</view>
  246. </view> -->
  247. <view v-if="isShowCancel" class="cancel-b">
  248. <view class="cancel-box">
  249. <view class="cancel-title flex-row flex-between">
  250. <view>选择取消原因</view>
  251. <view @tap="isShowCancel = false" style="font-size: 60rpx;">×</view>
  252. </view>
  253. <view @click="reason = '行程变更无需用车'" class="cancel-item flex-row flex-between">
  254. <view>行程变更无需用车</view>
  255. <img
  256. :src="reason == '行程变更无需用车'?'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq':'https://qiniu.bms16.com/Fh0JH6_QbiXYmVy7FNYnDkVIGvLC'" />
  257. </view>
  258. <view @click="reason = '修改订单信息'" class="cancel-item flex-row flex-between">
  259. <view>修改订单信息</view>
  260. <img
  261. :src="reason == '修改订单信息'?'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq':'https://qiniu.bms16.com/Fh0JH6_QbiXYmVy7FNYnDkVIGvLC'" />
  262. </view>
  263. <view @click="reason = '不想要了'" class="cancel-item flex-row flex-between">
  264. <view>不想要了</view>
  265. <img
  266. :src="reason == '不想要了'?'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq':'https://qiniu.bms16.com/Fh0JH6_QbiXYmVy7FNYnDkVIGvLC'" />
  267. </view>
  268. <view @click="bindCancel" class="cancel_btn">确认取消</view>
  269. </view>
  270. </view>
  271. <returnCar :isShowReturnCar="isShowReturnCar" @closeShowReturnCarBtn="()=>isShowReturnCar=false"
  272. @navStoreBtn="navStoreBtn" @immediatelyReturnBtn="immediatelyReturnBtn" />
  273. <carPlan @payToOrder='payReturn' v-if="showCarPlan" @changeSelectType="changeSelectType"
  274. @closeShowMore="showCarPlan = false" :params="params" :selectType="selectType" />
  275. <PayTypeModel @closeShow="()=>isShowToBuy=false" @payToOrder="payToOrder" :free_price="totalPrice"
  276. :isShowToBuy="isShowToBuy" />
  277. </view>
  278. </template>
  279. <script module="tools" lang="wxs" src="@/pages/common/wxs/tools.wxs"></script>
  280. <script module="tools" lang="sjs" src="@/pages/common/wxs/tools.sjs"></script>
  281. <script>
  282. var config_gyq = require('../../common/config_gyq.js');
  283. var config = require('../../common/config.js');
  284. var request = require('../../common/request');
  285. var common = require('../../common/common.js');
  286. var http = require('../../common/http.js');
  287. var storage = require('../../common/storage.js');
  288. var user = require('../../common/user.js');
  289. //
  290. import {
  291. getRemainingTime
  292. } from '@/utils/util';
  293. var appWhiteListFilter = require('../../common/appWhiteListFilter.js');
  294. import allPrice from '@/component/allPrice/allPrice';
  295. import ReturnCar from '@/component/returnCar/returnCar';
  296. import carPlan from '@/component/carPlan/carPlan';
  297. import PayTypeModel from '@/component/payTypeModel/payTypeModel';
  298. import dayjs from 'dayjs'
  299. import duration from 'dayjs/plugin/duration'
  300. dayjs.extend(duration);
  301. export default {
  302. components: {
  303. allPrice,
  304. ReturnCar,
  305. PayTypeModel,
  306. carPlan
  307. },
  308. data() {
  309. return {
  310. overdueData: {},
  311. select_type: '',
  312. car_detail: {},
  313. showCarPlan: false,
  314. return_imgs: {},
  315. charge_standard: {},
  316. isShowCancel: false,
  317. order_sn: '',
  318. reason: '行程变更无需用车',
  319. orderInfo: {},
  320. shop_image: [],
  321. isExpanded: false,
  322. isShowPrice: false,
  323. timer: '',
  324. isSelectStatus: 1,
  325. price_list: [], //车辆价格 hire_duration_unit 1 日 4 小时 6 周
  326. insurance_status: 0,
  327. over_fee: 0, //逾期金额
  328. plate_number: '',
  329. isScanCondeRentalCar: '',
  330. isShowReturnCar: false,
  331. isShowToBuy: false,
  332. totalPrice: 0, //逾期支付金额
  333. };
  334. },
  335. /**
  336. * 生命周期函数--监听页面加载
  337. */
  338. onLoad: function(options) {
  339. this.sub_sn = options.sub_sn || ''
  340. this.bindOrderInfo()
  341. },
  342. /**
  343. * 生命周期函数--监听页面显示
  344. */
  345. onShow: function(e) {
  346. if (this.sub_sn && this.orderInfo.sub_sn) {
  347. this.bindOrderInfo()
  348. }
  349. },
  350. onUnload: function() {},
  351. computed: {},
  352. methods: {
  353. payReturn() {},
  354. //逾期费用计算
  355. async overdueMoneyFn(car_sn) {
  356. let {
  357. data
  358. } = await request.postApi(config_gyq.API_FLK_CAR_OVERDUE_MONEY, {
  359. car_sn
  360. })
  361. if (data.code == 200) {
  362. this.overdueData = data.data
  363. } else {
  364. common.simpleToast(data.msg)
  365. }
  366. },
  367. payToOrder() {},
  368. async loadCarInfo(model_id) {
  369. const me = this
  370. http.postApi(config.API_FLK_INDEX_CAR_MODEL_DETAIL, {
  371. model_id,
  372. }, (resp) => {
  373. if (resp.data.code === 200) {
  374. const pData = {
  375. ...this.car_detail,
  376. price: this.price
  377. }
  378. me.setData({
  379. car_detail: resp.data.data,
  380. params: {
  381. order_sn: this.orderInfo.order_sn,
  382. ...resp.data.data,
  383. price: (resp.data.data.rental_setting[0].hire_price / 100).toFixed(2)
  384. }
  385. })
  386. } else {
  387. common.simpleToast(resp.data.msg);
  388. }
  389. })
  390. },
  391. changeSelectType(select_type, price) {
  392. this.setData({
  393. selectType: select_type,
  394. price: (price / 100).toFixed(2)
  395. })
  396. },
  397. async carDetFn(car_sn){
  398. let {data} = await request.postApi(config.API_FLK_CAR_DETAIL, {car_sn})
  399. if (data.code === 200) {
  400. if(data.data.model_id == this.orderInfo.model_id){
  401. return true
  402. }else{
  403. common.simpleToast('车型不匹配!')
  404. return false
  405. }
  406. if(data.data.is_display == 1){
  407. return true
  408. }else{
  409. common.simpleToast('车辆未展示!')
  410. return false
  411. }
  412. } else {
  413. common.simpleToast('请扫描正确的二维码!')
  414. return false
  415. }
  416. return false
  417. },
  418. async navToScan() {
  419. let car_sn = this.orderInfo.car_sn || ''
  420. if (!car_sn) {
  421. let res = await uni.scanCode({
  422. onlyFromCamera: true,
  423. scanType: ['qrCode'],
  424. });
  425. if (res[0]) return
  426. car_sn = res[1].result
  427. if(!await this.carDetFn(car_sn)) return
  428. }
  429. uni.showLoading({
  430. title: '识别中....',
  431. mask: true
  432. })
  433. setTimeout(()=> {
  434. uni.hideLoading();
  435. uni.navigateTo({
  436. url: `/pages/activation/activation?model_id=${this.orderInfo.model_id}&sub_sn=${this.sub_sn}&car_sn=${car_sn}`
  437. })
  438. }, 1000);
  439. },
  440. navToCabinet() {
  441. const {
  442. latitude,
  443. longitude,
  444. cityname,
  445. address,
  446. shop_name
  447. } = this.orderInfo
  448. uni.openLocation({
  449. latitude: latitude - 0,
  450. longitude: longitude - 0,
  451. scale: 15,
  452. name: shop_name,
  453. address: address,
  454. success: function(res) {}
  455. });
  456. },
  457. hireDurationUnitFn(type) {
  458. if (type == 1) {
  459. return '天'
  460. } else if (type == 2) {
  461. return '月'
  462. } else if (type == 3) {
  463. return '年'
  464. } else if (type == 4) {
  465. return '小时'
  466. } else if (type == 5) {
  467. return '分钟'
  468. } else if (type == 6) {
  469. return '周'
  470. } else if (type == 7) {
  471. return '季'
  472. }
  473. },
  474. hireDurationUnitsFn(time, type) {
  475. if (type == 1) {
  476. return Math.ceil(time / 60 / 60 / 24) + '天'
  477. } else if (type == 2) {
  478. return Math.ceil(time / 60 / 60 / 24 / 30) + '月'
  479. } else if (type == 3) {
  480. return Math.ceil(time / 60 / 60 / 24 / 30 / 365) + '年'
  481. } else if (type == 4) {
  482. return Math.ceil(time / 60 / 60) + '小时'
  483. } else if (type == 5) {
  484. return Math.ceil(time / 60) + '分钟'
  485. } else if (type == 6) {
  486. return Math.ceil(time / 60 / 60 / 24 / 7) + '周'
  487. } else if (type == 7) {
  488. return Math.ceil(time / 60 / 60 / 24 / 30 / 3) + '季'
  489. }
  490. },
  491. async bindOrderInfo() {
  492. const me = this
  493. const locationStr = uni.getStorageSync('user_current_location');
  494. // if (locationStr) {
  495. // this.myLocation = locationStr;
  496. // }
  497. http.postApi(config.API_FLK_ORDER_INFO, {
  498. sub_sn: me.sub_sn,
  499. latitude: locationStr.latitude,
  500. longitude: locationStr.longitude,
  501. }, (resp) => {
  502. if (resp.data.code === 200) {
  503. me.orderInfo = resp.data.data.order_info
  504. me.orderInfo.model_images = me.orderInfo.model_images.split(',')[0]
  505. //
  506. if (resp.data.data.order_info.model_id) {
  507. me.loadCarInfo(resp.data.data.order_info.model_id)
  508. }
  509. let distance = common.getFlatternDistance(locationStr.longitude, locationStr.latitude, me
  510. .orderInfo.longitude, me.orderInfo.latitude)
  511. resp.data.data.order_info.distance = distance
  512. // 取还时间展示
  513. // me.orderInfo.hire_return_time = common.getTimeToDay(Math.ceil(me.orderInfo
  514. // .hire_end_time - me.orderInfo.hire_begin_time) / 60)
  515. me.orderInfo.hire_return_time = getRemainingTime(me.orderInfo
  516. .hire_begin_time, me
  517. .orderInfo.hire_end_time)
  518. me.orderInfo.hire_begin_times = me.orderInfo.hire_begin_time ? dayjs(me
  519. .orderInfo
  520. .hire_begin_time * 1000).format(
  521. 'YY-MM-DD') : 0
  522. me.orderInfo.hire_end_times = me.orderInfo.hire_end_time ? dayjs(me
  523. .orderInfo
  524. .hire_end_time * 1000).format(
  525. 'YY-MM-DD') : 0
  526. console.log(me.orderInfo.order_status == 1);
  527. let other_time=0
  528. // 剩余租期判断
  529. if (me.orderInfo.order_status == 1){
  530. me.orderInfo.hire_duration_time=common.countToDay(me.orderInfo.hire_cycle*me.orderInfo.hire_duration,me.orderInfo.hire_duration_unit)
  531. console.log(me.orderInfo.hire_duration_time,'me.orderInfo.hire_duration_time');
  532. }else if((me.orderInfo.hire_type == 2 && me.orderInfo.order_status == 2) ||me.orderInfo.order_status == 3) {
  533. me.orderInfo.hire_duration_time = common.timestampToDays(Math.ceil(me.orderInfo.hire_end_time - Math.floor(new Date()) /1000))
  534. } else {
  535. if (me.orderInfo.order_status == 4) {
  536. me.overdueMoneyFn(me.orderInfo.car_sn)
  537. me.orderInfo.hire_duration_time = common.timestampToDays(Math.ceil(Math.floor(new Date()) / 1000 - me.orderInfo.hire_end_time))
  538. } else {
  539. me.orderInfo.hire_duration_time = common.timestampToDays(Math.ceil(me.orderInfo.hire_begin_time - me.orderInfo.hire_end_time))
  540. }
  541. }
  542. } else {
  543. // 默认返回上一个页面再提示报错
  544. uni.navigateBack({
  545. delta: 1
  546. })
  547. common.simpleToast(resp.data.msg)
  548. }
  549. })
  550. },
  551. navStoreBtn() {
  552. const {
  553. latitude,
  554. longitude,
  555. address,
  556. shop_name
  557. } = this.orderInfo
  558. uni.openLocation({
  559. latitude: latitude - 0,
  560. longitude: longitude - 0,
  561. scale: 15,
  562. name: shop_name,
  563. address: address,
  564. success: function(res) {}
  565. });
  566. },
  567. tapReturnCar() {
  568. this.setData({
  569. isShowReturnCar: true
  570. })
  571. },
  572. immediatelyReturnBtn() {
  573. //到店还车 判断逾期状态 如果逾期要交逾期费用 跳转到上传车辆图片再支付逾期费用还车
  574. const isOverdue = this.orderInfo.order_status == 4
  575. const {
  576. car_sn,
  577. shop_id,
  578. overdue_money
  579. } = this.orderInfo
  580. const returnCarParams = {
  581. car_sn,
  582. shop_id,
  583. overdue_money,
  584. isReturnCar: true,
  585. }
  586. //提交还车图片
  587. uni.navigateTo({
  588. url: `/pages/activation/activation?isReturnCar=true,model_id=${this.orderInfo.model_id}&sub_sn=${this.sub_sn}&car_sn=${this.orderInfo.car_sn}&isOverdue=${isOverdue}&overdueMoney=${this.overdueData.money}&overdueTime=${this.overdueData.time}`
  589. });
  590. // if (isOverdue) {
  591. // this.setData({
  592. // totalPrice: this.overdueData.money,
  593. // isShowToBuy: true
  594. // })
  595. // } else {
  596. // //提交还车图片
  597. // uni.navigateTo({
  598. // url: `/pages/activation/activation?isReturnCar=true,model_id=${this.orderInfo.model_id}&sub_sn=${this.sub_sn}&car_sn=${this.orderInfo.car_sn}&isOverdue=${isOverdue}&overdueMoney=${this.overdueData.money}&overdueTime=${this.overdueData.time}`
  599. // });
  600. // }
  601. },
  602. callStorePhone() {
  603. const phone = this.orderInfo.link_phone
  604. common.callPhone(phone)
  605. },
  606. async clickCancel() {
  607. this.isShowCancel = true
  608. },
  609. async bindCancel() {
  610. const me = this
  611. let res = await uni.showModal({
  612. title: '取消订单',
  613. content: '您是否需要取消该订单',
  614. confirmText: '是',
  615. confirmColor: '#0074FF',
  616. cancelText: '否',
  617. cancelColor: '#191D23',
  618. });
  619. if (res[1].confirm) {
  620. let {
  621. data
  622. } = await request.postApi(config.API_DAYHIRE_HIRE_CANCEL_ORDER, {
  623. sub_sn: this.sub_sn,
  624. remark: this.reason
  625. })
  626. if (data.code == 200) {
  627. common.simpleToast(data.msg)
  628. this.isShowCancel = false
  629. this.bindOrderInfo()
  630. } else {
  631. common.simpleToast(data.msg)
  632. }
  633. }
  634. },
  635. bindToNav() {
  636. console.log(111);
  637. const {
  638. address,
  639. latitude,
  640. longitude,
  641. shop_name
  642. } = this.shopInfo
  643. uni.openLocation({
  644. latitude: latitude - 0,
  645. longitude: longitude - 0,
  646. scale: 15,
  647. name: shop_name,
  648. address: address,
  649. success: function(res) {},
  650. })
  651. },
  652. bindToHome() {
  653. uni.reLaunch({
  654. url: '/pages/index/index',
  655. success: function(res) {},
  656. fail: function(res) {},
  657. complete: function(res) {}
  658. });
  659. },
  660. callPhone() {
  661. const me = this
  662. const phone = me.shopInfo.link_phone
  663. uni.showModal({
  664. content: `您是否要拨打电话${phone}?`,
  665. confirmText: '确定',
  666. success: (res) => {
  667. if (res.confirm) {
  668. uni.makePhoneCall({
  669. phoneNumber: phone,
  670. success() {},
  671. fail() {}
  672. })
  673. }
  674. },
  675. fail: (res) => {}
  676. })
  677. },
  678. bindRenew() {
  679. this.params.overdueData = this.overdueData
  680. this.showCarPlan = true
  681. // this.isReturnHome = false
  682. // let isRenew = true
  683. // uni.navigateTo({
  684. // url: '/pages/carIntroduce/carIntroduce?plate_number=' + this.orderInfo
  685. // .license_plate_number +
  686. // '&isRenew=' + isRenew +
  687. // '&order_sn=' + this.order_sn,
  688. // success: function(res) {},
  689. // fail: function(res) {},
  690. // complete: function(res) {}
  691. // });
  692. },
  693. bindBattery() {
  694. this.isReturnHome = false
  695. uni.navigateTo({
  696. url: '/pages/battery/battery?plate_number=' + this.orderInfo.license_plate_number,
  697. success: function(res) {},
  698. fail: function(res) {},
  699. complete: function(res) {}
  700. });
  701. },
  702. bindExpanded() {
  703. this.isExpanded = !this.isExpanded
  704. },
  705. navToInput() {
  706. this.isReturnHome = false
  707. uni.navigateTo({
  708. url: '/pages/inputLicensePlate/inputLicensePlate?order_sn=' + this.orderInfo
  709. .order_sn,
  710. success: function(res) {},
  711. fail: function(res) {},
  712. complete: function(res) {}
  713. });
  714. },
  715. // 激活车辆
  716. navToActive() {
  717. this.isReturnHome = false
  718. const me = this
  719. if (this.orderInfo.hire_type == 1) { // 预约
  720. if (me.isScanCondeRentalCar) {
  721. uni.scanCode({
  722. onlyFromCamera: true,
  723. success: function(res) {
  724. me.loadScanCode(res.result)
  725. },
  726. fail: function(res) {},
  727. complete: function(res) {},
  728. })
  729. } else {
  730. uni.navigateTo({
  731. url: '/pages/inputLicensePlate/inputLicensePlate?order_sn=' + this
  732. .order_sn + '&order_model_id=' + this.orderInfo.model_id,
  733. success: function(res) {},
  734. fail: function(res) {},
  735. complete: function(res) {}
  736. });
  737. }
  738. } else { // 非预约
  739. const isJumpReturn = false
  740. uni.navigateTo({
  741. url: '/pages/activation/activation?order_sn=' + this.order_sn +
  742. '&plate_number=' + this
  743. .orderInfo.license_plate_number + '&isJumpReturn=' + isJumpReturn,
  744. success: function(res) {},
  745. fail: function(res) {},
  746. complete: function(res) {}
  747. });
  748. }
  749. },
  750. loadScanCode(battery_sn) {
  751. const pData = {
  752. longitude: this.longitude,
  753. latitude: this.latitude,
  754. battery_sn: battery_sn
  755. }
  756. const me = this
  757. http.postApi(config.API_DAYHIRE_CAR_CAR_INFO, pData, (resp) => {
  758. uni.hideLoading()
  759. if (resp.data.code === 200) {
  760. const timestamp = Date.now(); // 获取当前时间戳(毫秒)
  761. const isOffline = (Math.floor(timestamp / 1000) - resp.data.data
  762. .last_comm_time) > 1800
  763. me.plate_number = resp.data.data.license_plate_number
  764. if (resp.data.data.last_comm_time === 0 || isOffline) {
  765. common.simpleToast('此车辆已离线,请选择其他车辆')
  766. } else {
  767. let carInfo = JSON.stringify(resp.data.data)
  768. const car_model = resp.data.data.model_info.car_model
  769. const model_images = resp.data.data.model_info.model_images.split(',')
  770. const return_imgs = resp.data.data.return_imgs
  771. var model_id = resp.data.data.model_info.model_id
  772. if (resp.data.data.has_owner) { //车辆正在被使用
  773. if (resp.data.data.is_mine) { //是本人在使用
  774. wx.showModal({
  775. title: '提示',
  776. content: '已有正在使用的车辆,是否跳转至车辆详情页?',
  777. cancelText: '取消',
  778. confirmText: '确定',
  779. success: function(res) {
  780. this.isReturnHome = false
  781. uni.navigateTo({
  782. url: '/pages/battery/battery?plate_number=' +
  783. this.plate_number
  784. });
  785. },
  786. fail: function(res) {},
  787. complete: function(res) {},
  788. })
  789. } else {
  790. common.simpleToast('此车辆正在被使用')
  791. }
  792. } else {
  793. if (me.order_sn && me.order_sn != '') {
  794. if (this.orderInfo.model_id != model_id) { // 预租车型与之前预约车型不一致
  795. common.simpleToast('与预约车型不符')
  796. } else {
  797. this.isReturnHome = false
  798. uni.navigateTo({
  799. url: '/pages/activation/activation?plate_number=' +
  800. this.plate_number + '&order_sn=' + this
  801. .order_sn +
  802. '&car_model=' + car_model + '&model_image=' +
  803. model_images[0] + '&return_imgs=' + JSON
  804. .stringify(
  805. return_imgs),
  806. fail() {}
  807. })
  808. }
  809. } else {
  810. this.isReturnHome = false
  811. uni.navigateTo({
  812. url: '/pages/carIntroduce/carIntroduce?carInfo=' +
  813. encodeURIComponent(carInfo) + '&plate_number=' +
  814. this.plate_number,
  815. fail() {}
  816. })
  817. }
  818. }
  819. }
  820. } else {
  821. common.simpleToast(resp.data.msg)
  822. }
  823. })
  824. },
  825. bindToPay() {
  826. const me = this
  827. //#ifdef MP-ALIPAY
  828. const _from = 'ali'
  829. const _pay_type = 2
  830. //#endif
  831. //#ifdef MP-WEIXIN
  832. const _from = 'wx'
  833. const _pay_type = 0
  834. //#endif
  835. http.postApi(config.API_DAYHIRE_HIRE_CONTINUE_PAY, {
  836. order_sn: me.order_sn,
  837. from: _from,
  838. pay_type: _pay_type
  839. }, (resp) => {
  840. common.loading()
  841. if (resp.data.code === 200) {
  842. uni.hideLoading()
  843. //#ifdef MP-ALIPAY
  844. my.tradePay({
  845. tradeNO: resp.data.data.trade_no,
  846. success: function(res) {
  847. if (res.resultCode == 9000) {
  848. common.simpleToast('支付成功');
  849. }
  850. setTimeout(function() {
  851. me.bindOrderInfo()
  852. }, 1000)
  853. },
  854. fail: function(res) {
  855. common.simpleToast('支付失败,请重试')
  856. },
  857. })
  858. //#endif
  859. //#ifdef MP-WEIXIN
  860. var payParams = JSON.parse(resp.data.data.payParams);
  861. user.wxPay(me.order_sn, payParams, function(isSuccess) {
  862. if (isSuccess) {
  863. common.simpleToast('支付成功')
  864. setTimeout(function() {
  865. me.bindOrderInfo()
  866. }, 1000)
  867. } else {
  868. common.simpleToast('支付失败,请重试')
  869. }
  870. });
  871. //#endif
  872. } else {
  873. uni.hideLoading()
  874. common.simpleToast(resp.data.msg)
  875. }
  876. })
  877. },
  878. // 计算拖车说明收费价格
  879. calculateFare(distance, charge_list) {
  880. let fare = 0
  881. if (distance <= charge_list.start_mil) {
  882. fare = charge_list.start_price / 100
  883. } else {
  884. // actual_start_mil:实际距离单位米
  885. // over_start_price:向上取整的公里数*超出首公里的费用
  886. var actual_start_mil = distance - charge_list.start_mil
  887. var over_start_price = (Math.ceil(actual_start_mil / charge_list.step_mil)) * charge_list
  888. .step_price
  889. fare = (charge_list.start_price + over_start_price) / 100
  890. }
  891. const fareArray = fare.toFixed(2).split('.'); //将价格拆分为整数部分和小数部分
  892. const price_list = {
  893. start_mil: (charge_list.start_mil / 1000).toFixed(2),
  894. start_price: (charge_list.start_price / 100).toFixed(2),
  895. step_mil: (charge_list.step_mil / 1000).toFixed(2),
  896. step_price: (charge_list.step_price / 100).toFixed(2),
  897. actual_start_mil: actual_start_mil ? (actual_start_mil / 1000).toFixed(2) : 0,
  898. over_start_price: over_start_price ? (over_start_price / 100).toFixed(2) : 0,
  899. fare: fare.toFixed(2), // 保留两位小数
  900. fareArray: fareArray //将价格拆分为整数部分和小数部分
  901. }
  902. return price_list
  903. },
  904. bindChangeStatus(e) {
  905. const {
  906. status,
  907. unit
  908. } = e.currentTarget.dataset
  909. this.setData({
  910. isSelectStatus: unit,
  911. selectIndex: status
  912. })
  913. // this.bindDuration()
  914. },
  915. //计算价格
  916. // bindDuration(){
  917. // const me = this
  918. // var _insurance_price //保险金
  919. // const unit_price=(me.price_list[0].hire_price/100) * me.leaseTime //租金
  920. // // insurance_setting 保险
  921. // if (me.insurance_setting!=null) { // 有保险的时候
  922. // // isSelectDeposit==0为免押 isOpenNoDeposit为是否成功开通免押 total_money为总金额
  923. // // unit_price 租金 insurance_setting.price 保险金 deposit 押金
  924. // if (me.duration_unit == 4) { // 时
  925. // _insurance_price = (me.insurance_setting.price - 0) * 1
  926. // } else if(me.duration_unit == 6) { // 周
  927. // _insurance_price = (me.insurance_setting.price - 0) * 7 * me.leaseTime
  928. // } else { //天
  929. // _insurance_price = (me.insurance_setting.price - 0) * me.leaseTime
  930. // }
  931. // } else { // 无保险
  932. // _insurance_price = 0
  933. // }
  934. // if (me.isOpenNoDeposit) {
  935. // // 金额=(周期数*周期价格)+保险金
  936. // me.amount = ((me.leaseTime * me.price_list[0].hire_price -0) + (_insurance_price - 0)) / 100
  937. // } else {
  938. // // 金额=(周期数*周期价格)+押金+保险金
  939. // me.amount = ((me.leaseTime * me.price_list[0].hire_price -0) + (me.modelInfo.deposit -0) + (_insurance_price - 0)) / 100
  940. // }
  941. // },
  942. loadEnd() {
  943. this.bindOrderInfo()
  944. },
  945. navToExchange() {
  946. console.log('跳转换电记录');
  947. uni.navigateTo({
  948. url: '/pages/exchangeRecord/exchangeRecord' +
  949. '?order_sn=' + this.orderInfo.order_sn
  950. })
  951. }
  952. }
  953. };
  954. </script>
  955. <style>
  956. @import './orderStatus.css';
  957. .cancel_btn {
  958. width: 702rpx;
  959. height: 80rpx;
  960. background: #060809;
  961. border-radius: 40rpx;
  962. font-family: PingFangSC, PingFang SC;
  963. font-weight: 500;
  964. font-size: 32rpx;
  965. color: #FFFFFF;
  966. display: flex;
  967. align-items: center;
  968. justify-content: center;
  969. }
  970. </style>