orderStatus.vue 37 KB

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