orderStatus.vue 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049
  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">使用中...</view>
  16. <view :class="['get-time-view', 'flex-row', 'red-text']" v-if="orderInfo.order_status == 4">已逾期</view>
  17. <view class="get-time-view flex-row" v-if="orderInfo.order_status == 2">请上传车辆图片激活车辆</view>
  18. <view class="get-time-view flex-row" v-if="orderInfo.order_status == 5">待门店确认</view>
  19. <view class="get-time-view flex-row" v-if="orderInfo.order_status == 6">还车中,等待门店取车</view>
  20. <view class="get-time-view flex-row" v-if="orderInfo.order_status == 7">已完成</view>
  21. <view class="get-time-view flex-row" v-if="orderInfo.order_status == 8||orderInfo.order_status == 9">已取消</view>
  22. <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></view>
  23. <view v-if="orderInfo.order_status == 10">已完结</view>
  24. </block>
  25. </view>
  26. <view class="time-money">
  27. <view v-if="orderInfo.order_type != 3" class="flex-row flex-between">
  28. <view class="money-item">
  29. <view :class="orderInfo.order_status == 4?'red-status':''">
  30. <block v-if="orderInfo.hire_duration_time">{{orderInfo.hire_duration_time}}</block>
  31. <block v-else>{{Number(orderInfo.hire_cycle) * (orderInfo.hire_duration)}}</block>
  32. </view>
  33. <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>
  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 /1000).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 :isBuy='false' @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. import {
  294. MAX_LIMITS,LEASE_TYPE_ARR
  295. } from '@/common/constant.js'
  296. var appWhiteListFilter = require('../../common/appWhiteListFilter.js');
  297. import allPrice from '@/component/allPrice/allPrice';
  298. import ReturnCar from '@/component/returnCar/returnCar';
  299. import carPlan from '@/component/carPlan/carPlan';
  300. import PayTypeModel from '@/component/payTypeModel/payTypeModel';
  301. import dayjs from 'dayjs'
  302. import duration from 'dayjs/plugin/duration'
  303. dayjs.extend(duration);
  304. export default {
  305. components: {
  306. allPrice,
  307. ReturnCar,
  308. PayTypeModel,
  309. carPlan
  310. },
  311. data() {
  312. return {
  313. overdueData: {},
  314. select_type: '',
  315. car_detail: {},
  316. showCarPlan: false,
  317. return_imgs: {},
  318. charge_standard: {},
  319. isShowCancel: false,
  320. order_sn: '',
  321. reason: '行程变更无需用车',
  322. orderInfo: {},
  323. shop_image: [],
  324. isExpanded: false,
  325. isShowPrice: false,
  326. timer: '',
  327. isSelectStatus: 1,
  328. price_list: [], //车辆价格 hire_duration_unit 1 日 4 小时 6 周
  329. insurance_status: 0,
  330. over_fee: 0, //逾期金额
  331. plate_number: '',
  332. isScanCondeRentalCar: '',
  333. isShowReturnCar: false,
  334. isShowToBuy: false,
  335. totalPrice: 0, //逾期支付金额
  336. };
  337. },
  338. /**
  339. * 生命周期函数--监听页面加载
  340. */
  341. onLoad: function(options) {
  342. this.sub_sn = options.sub_sn || ''
  343. this.bindOrderInfo()
  344. },
  345. /**
  346. * 生命周期函数--监听页面显示
  347. */
  348. onShow: function(e) {
  349. if (this.sub_sn && this.orderInfo.sub_sn) {
  350. this.bindOrderInfo()
  351. }
  352. },
  353. onUnload: function() {},
  354. computed: {},
  355. methods: {
  356. leaseUnits(type){
  357. const result = LEASE_TYPE_ARR.find(v => v.value == type);
  358. return result ? result.unit : '';
  359. },
  360. leaseUnitsResult(type) {
  361. const result = LEASE_TYPE_ARR.find(v => v.value == type);
  362. return result ? result.label : '';
  363. },
  364. payReturn() {},
  365. //逾期费用计算
  366. async overdueMoneyFn(car_sn) {
  367. let {
  368. data
  369. } = await request.postApi(config_gyq.API_FLK_CAR_OVERDUE_MONEY, {
  370. car_sn
  371. })
  372. if (data.code == 200) {
  373. this.overdueData = data.data
  374. } else {
  375. common.simpleToast(data.msg)
  376. }
  377. },
  378. payToOrder() {},
  379. async loadCarInfo(model_id) {
  380. const me = this
  381. http.postApi(config.API_FLK_INDEX_CAR_MODEL_DETAIL, {
  382. model_id,
  383. }, (resp) => {
  384. if (resp.data.code === 200) {
  385. const pData = {
  386. ...this.car_detail,
  387. price: this.price
  388. }
  389. me.setData({
  390. car_detail: resp.data.data,
  391. params: {
  392. order_sn: this.orderInfo.order_sn,
  393. ...resp.data.data,
  394. price: (resp.data.data.rental_setting[0].hire_price / 100).toFixed(2)
  395. }
  396. })
  397. } else {
  398. common.simpleToast(resp.data.msg);
  399. }
  400. })
  401. },
  402. changeSelectType(select_type, price) {
  403. this.setData({
  404. selectType: select_type,
  405. price: (price / 100).toFixed(2)
  406. })
  407. },
  408. async carDetFn(car_sn){
  409. let {data} = await request.postApi(config.API_FLK_CAR_DETAIL, {car_sn})
  410. if (data.code === 200) {
  411. if(data.data.model_id == this.orderInfo.model_id){
  412. return true
  413. }else{
  414. common.simpleToast('车型不匹配!')
  415. return false
  416. }
  417. if(data.data.is_hire == 1){
  418. return true
  419. }else{
  420. common.simpleToast('车辆已被租售!')
  421. return false
  422. }
  423. if(data.data.is_display == 1){
  424. return true
  425. }else{
  426. common.simpleToast('车辆未展示!')
  427. return false
  428. }
  429. } else {
  430. common.simpleToast('请扫描正确的二维码!')
  431. return false
  432. }
  433. return false
  434. },
  435. async navToScan() {
  436. let car_sn = this.orderInfo.car_sn || ''
  437. if (!car_sn) {
  438. let res = await uni.scanCode({
  439. onlyFromCamera: true,
  440. scanType: ['qrCode'],
  441. });
  442. if (res[0]) return
  443. car_sn = res[1].result
  444. if(!await this.carDetFn(car_sn)) return
  445. }
  446. uni.showLoading({
  447. title: '识别中....',
  448. mask: true
  449. })
  450. setTimeout(()=> {
  451. uni.hideLoading();
  452. uni.navigateTo({
  453. url: `/pages/activation/activation?model_id=${this.orderInfo.model_id}&sub_sn=${this.sub_sn}&car_sn=${car_sn}`
  454. })
  455. }, 1000);
  456. },
  457. navToCabinet() {
  458. const {
  459. latitude,
  460. longitude,
  461. cityname,
  462. address,
  463. shop_name
  464. } = this.orderInfo
  465. uni.openLocation({
  466. latitude: latitude - 0,
  467. longitude: longitude - 0,
  468. scale: 15,
  469. name: shop_name,
  470. address: address,
  471. success: function(res) {}
  472. });
  473. },
  474. hireDurationUnitFn(type) {
  475. if (type == 1) {
  476. return '天'
  477. } else if (type == 2) {
  478. return '月'
  479. } else if (type == 3) {
  480. return '年'
  481. } else if (type == 4) {
  482. return '小时'
  483. } else if (type == 5) {
  484. return '分钟'
  485. } else if (type == 6) {
  486. return '周'
  487. } else if (type == 7) {
  488. return '季'
  489. }
  490. },
  491. hireDurationUnitsFn(time, type) {
  492. if (type == 1) {
  493. return Math.ceil(time / 60 / 60 / 24)
  494. } else if (type == 2) {
  495. return Math.ceil(time / 60 / 60 / 24 / 30)
  496. } else if (type == 3) {
  497. return Math.ceil(time / 60 / 60 / 24 / 30 / 365)
  498. } else if (type == 4) {
  499. return Math.ceil(time / 60 / 60)
  500. } else if (type == 5) {
  501. return Math.ceil(time / 60)
  502. } else if (type == 6) {
  503. return Math.ceil(time / 60 / 60 / 24 / 7)
  504. } else if (type == 7) {
  505. return Math.ceil(time / 60 / 60 / 24 / 30 / 3)
  506. }
  507. },
  508. async bindOrderInfo() {
  509. const me = this
  510. const locationStr = uni.getStorageSync('user_current_location');
  511. // if (locationStr) {
  512. // this.myLocation = locationStr;
  513. // }
  514. http.postApi(config.API_FLK_ORDER_INFO, {
  515. sub_sn: me.sub_sn,
  516. latitude: locationStr.latitude,
  517. longitude: locationStr.longitude,
  518. }, (resp) => {
  519. if (resp.data.code === 200) {
  520. me.orderInfo = resp.data.data.order_info
  521. me.orderInfo.model_images = me.orderInfo.model_images.split(',')[0]
  522. //
  523. if (resp.data.data.order_info.model_id) {
  524. me.loadCarInfo(resp.data.data.order_info.model_id)
  525. }
  526. let distance = common.getFlatternDistance(locationStr.longitude, locationStr.latitude, me
  527. .orderInfo.longitude, me.orderInfo.latitude)
  528. resp.data.data.order_info.distance = distance
  529. // 取还时间展示
  530. // me.orderInfo.hire_return_time = common.getTimeToDay(Math.ceil(me.orderInfo
  531. // .hire_end_time - me.orderInfo.hire_begin_time) / 60)
  532. me.orderInfo.hire_return_time = getRemainingTime(me.orderInfo
  533. .hire_begin_time, me
  534. .orderInfo.hire_end_time)
  535. me.orderInfo.hire_begin_times = me.orderInfo.hire_begin_time ? dayjs(me
  536. .orderInfo
  537. .hire_begin_time * 1000).format(
  538. 'YY-MM-DD') : 0
  539. me.orderInfo.hire_end_times = me.orderInfo.hire_end_time ? dayjs(me
  540. .orderInfo
  541. .hire_end_time * 1000).format(
  542. 'YY-MM-DD') : 0
  543. console.log(me.orderInfo.order_status == 1);
  544. let other_time=0
  545. // 剩余租期判断
  546. if (me.orderInfo.order_status == 1){
  547. me.orderInfo.hire_duration_time=common.countToDay(me.orderInfo.hire_cycle*me.orderInfo.hire_duration,me.orderInfo.hire_duration_unit)
  548. ;
  549. }else if((me.orderInfo.order_status == 2) ||me.orderInfo.order_status == 3) {
  550. me.orderInfo.hire_duration_time = common.timestampToDays(Math.ceil(me.orderInfo.hire_end_time - Math.floor(new Date()) /1000))
  551. console.log(me.orderInfo.hire_duration_time,'me.orderInfo.hire_duration_time')
  552. } else {
  553. if (me.orderInfo.order_status == 4) {
  554. me.overdueMoneyFn(me.orderInfo.car_sn)
  555. me.orderInfo.hire_duration_time = common.timestampToDays(Math.ceil(Math.floor(new Date()) / 1000 - me.orderInfo.hire_end_time))
  556. } else {
  557. me.orderInfo.hire_duration_time = common.timestampToDays(Math.ceil(me.orderInfo.hire_begin_time - me.orderInfo.hire_end_time))
  558. }
  559. }
  560. } else {
  561. // 默认返回上一个页面再提示报错
  562. uni.navigateBack({
  563. delta: 1
  564. })
  565. common.simpleToast(resp.data.msg)
  566. }
  567. })
  568. },
  569. navStoreBtn() {
  570. const {
  571. latitude,
  572. longitude,
  573. address,
  574. shop_name
  575. } = this.orderInfo
  576. uni.openLocation({
  577. latitude: latitude - 0,
  578. longitude: longitude - 0,
  579. scale: 15,
  580. name: shop_name,
  581. address: address,
  582. success: function(res) {}
  583. });
  584. },
  585. tapReturnCar() {
  586. this.setData({
  587. isShowReturnCar: true
  588. })
  589. },
  590. immediatelyReturnBtn() {
  591. //到店还车 判断逾期状态 如果逾期要交逾期费用 跳转到上传车辆图片再支付逾期费用还车
  592. const isOverdue = this.orderInfo.order_status == 4
  593. const {
  594. car_sn,
  595. shop_id,
  596. overdue_money
  597. } = this.orderInfo
  598. const returnCarParams = {
  599. car_sn,
  600. shop_id,
  601. overdue_money,
  602. isReturnCar: true,
  603. }
  604. //提交还车图片
  605. uni.navigateTo({
  606. 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}`
  607. });
  608. // if (isOverdue) {
  609. // this.setData({
  610. // totalPrice: this.overdueData.money,
  611. // isShowToBuy: true
  612. // })
  613. // } else {
  614. // //提交还车图片
  615. // uni.navigateTo({
  616. // 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}`
  617. // });
  618. // }
  619. },
  620. callStorePhone() {
  621. const phone = this.orderInfo.link_phone
  622. common.callPhone(phone)
  623. },
  624. async clickCancel() {
  625. this.isShowCancel = true
  626. },
  627. async bindCancel() {
  628. const me = this
  629. let res = await uni.showModal({
  630. title: '取消订单',
  631. content: '您是否需要取消该订单',
  632. confirmText: '是',
  633. confirmColor: '#0074FF',
  634. cancelText: '否',
  635. cancelColor: '#191D23',
  636. });
  637. if (res[1].confirm) {
  638. let {
  639. data
  640. } = await request.postApi(config.API_DAYHIRE_HIRE_CANCEL_ORDER, {
  641. sub_sn: this.sub_sn,
  642. remark: this.reason
  643. })
  644. if (data.code == 200) {
  645. common.simpleToast(data.msg)
  646. this.isShowCancel = false
  647. this.bindOrderInfo()
  648. } else {
  649. common.simpleToast(data.msg)
  650. }
  651. }
  652. },
  653. bindToNav() {
  654. console.log(111);
  655. const {
  656. address,
  657. latitude,
  658. longitude,
  659. shop_name
  660. } = this.shopInfo
  661. uni.openLocation({
  662. latitude: latitude - 0,
  663. longitude: longitude - 0,
  664. scale: 15,
  665. name: shop_name,
  666. address: address,
  667. success: function(res) {},
  668. })
  669. },
  670. bindToHome() {
  671. uni.reLaunch({
  672. url: '/pages/index/index',
  673. success: function(res) {},
  674. fail: function(res) {},
  675. complete: function(res) {}
  676. });
  677. },
  678. callPhone() {
  679. const me = this
  680. const phone = me.shopInfo.link_phone
  681. uni.showModal({
  682. content: `您是否要拨打电话${phone}?`,
  683. confirmText: '确定',
  684. success: (res) => {
  685. if (res.confirm) {
  686. uni.makePhoneCall({
  687. phoneNumber: phone,
  688. success() {},
  689. fail() {}
  690. })
  691. }
  692. },
  693. fail: (res) => {}
  694. })
  695. },
  696. bindRenew() {
  697. this.params.overdueData = this.overdueData
  698. this.showCarPlan = true
  699. // this.isReturnHome = false
  700. // let isRenew = true
  701. // uni.navigateTo({
  702. // url: '/pages/carIntroduce/carIntroduce?plate_number=' + this.orderInfo
  703. // .license_plate_number +
  704. // '&isRenew=' + isRenew +
  705. // '&order_sn=' + this.order_sn,
  706. // success: function(res) {},
  707. // fail: function(res) {},
  708. // complete: function(res) {}
  709. // });
  710. },
  711. bindBattery() {
  712. this.isReturnHome = false
  713. uni.navigateTo({
  714. url: '/pages/battery/battery?plate_number=' + this.orderInfo.license_plate_number,
  715. success: function(res) {},
  716. fail: function(res) {},
  717. complete: function(res) {}
  718. });
  719. },
  720. bindExpanded() {
  721. this.isExpanded = !this.isExpanded
  722. },
  723. navToInput() {
  724. this.isReturnHome = false
  725. uni.navigateTo({
  726. url: '/pages/inputLicensePlate/inputLicensePlate?order_sn=' + this.orderInfo
  727. .order_sn,
  728. success: function(res) {},
  729. fail: function(res) {},
  730. complete: function(res) {}
  731. });
  732. },
  733. // 激活车辆
  734. navToActive() {
  735. this.isReturnHome = false
  736. const me = this
  737. if (this.orderInfo.hire_type == 1) { // 预约
  738. if (me.isScanCondeRentalCar) {
  739. uni.scanCode({
  740. onlyFromCamera: true,
  741. success: function(res) {
  742. me.loadScanCode(res.result)
  743. },
  744. fail: function(res) {},
  745. complete: function(res) {},
  746. })
  747. } else {
  748. uni.navigateTo({
  749. url: '/pages/inputLicensePlate/inputLicensePlate?order_sn=' + this
  750. .order_sn + '&order_model_id=' + this.orderInfo.model_id,
  751. success: function(res) {},
  752. fail: function(res) {},
  753. complete: function(res) {}
  754. });
  755. }
  756. } else { // 非预约
  757. const isJumpReturn = false
  758. uni.navigateTo({
  759. url: '/pages/activation/activation?order_sn=' + this.order_sn +
  760. '&plate_number=' + this
  761. .orderInfo.license_plate_number + '&isJumpReturn=' + isJumpReturn,
  762. success: function(res) {},
  763. fail: function(res) {},
  764. complete: function(res) {}
  765. });
  766. }
  767. },
  768. loadScanCode(battery_sn) {
  769. const pData = {
  770. longitude: this.longitude,
  771. latitude: this.latitude,
  772. battery_sn: battery_sn
  773. }
  774. const me = this
  775. http.postApi(config.API_DAYHIRE_CAR_CAR_INFO, pData, (resp) => {
  776. uni.hideLoading()
  777. if (resp.data.code === 200) {
  778. const timestamp = Date.now(); // 获取当前时间戳(毫秒)
  779. const isOffline = (Math.floor(timestamp / 1000) - resp.data.data
  780. .last_comm_time) > 1800
  781. me.plate_number = resp.data.data.license_plate_number
  782. if (resp.data.data.last_comm_time === 0 || isOffline) {
  783. common.simpleToast('此车辆已离线,请选择其他车辆')
  784. } else {
  785. let carInfo = JSON.stringify(resp.data.data)
  786. const car_model = resp.data.data.model_info.car_model
  787. const model_images = resp.data.data.model_info.model_images.split(',')
  788. const return_imgs = resp.data.data.return_imgs
  789. var model_id = resp.data.data.model_info.model_id
  790. if (resp.data.data.has_owner) { //车辆正在被使用
  791. if (resp.data.data.is_mine) { //是本人在使用
  792. wx.showModal({
  793. title: '提示',
  794. content: '已有正在使用的车辆,是否跳转至车辆详情页?',
  795. cancelText: '取消',
  796. confirmText: '确定',
  797. success: function(res) {
  798. this.isReturnHome = false
  799. uni.navigateTo({
  800. url: '/pages/battery/battery?plate_number=' +
  801. this.plate_number
  802. });
  803. },
  804. fail: function(res) {},
  805. complete: function(res) {},
  806. })
  807. } else {
  808. common.simpleToast('此车辆正在被使用')
  809. }
  810. } else {
  811. if (me.order_sn && me.order_sn != '') {
  812. if (this.orderInfo.model_id != model_id) { // 预租车型与之前预约车型不一致
  813. common.simpleToast('与预约车型不符')
  814. } else {
  815. this.isReturnHome = false
  816. uni.navigateTo({
  817. url: '/pages/activation/activation?plate_number=' +
  818. this.plate_number + '&order_sn=' + this
  819. .order_sn +
  820. '&car_model=' + car_model + '&model_image=' +
  821. model_images[0] + '&return_imgs=' + JSON
  822. .stringify(
  823. return_imgs),
  824. fail() {}
  825. })
  826. }
  827. } else {
  828. this.isReturnHome = false
  829. uni.navigateTo({
  830. url: '/pages/carIntroduce/carIntroduce?carInfo=' +
  831. encodeURIComponent(carInfo) + '&plate_number=' +
  832. this.plate_number,
  833. fail() {}
  834. })
  835. }
  836. }
  837. }
  838. } else {
  839. common.simpleToast(resp.data.msg)
  840. }
  841. })
  842. },
  843. bindToPay() {
  844. const me = this
  845. //#ifdef MP-ALIPAY
  846. const _from = 'ali'
  847. const _pay_type = 2
  848. //#endif
  849. //#ifdef MP-WEIXIN
  850. const _from = 'wx'
  851. const _pay_type = 0
  852. //#endif
  853. http.postApi(config.API_DAYHIRE_HIRE_CONTINUE_PAY, {
  854. order_sn: me.order_sn,
  855. from: _from,
  856. pay_type: _pay_type
  857. }, (resp) => {
  858. common.loading()
  859. if (resp.data.code === 200) {
  860. uni.hideLoading()
  861. //#ifdef MP-ALIPAY
  862. my.tradePay({
  863. tradeNO: resp.data.data.trade_no,
  864. success: function(res) {
  865. if (res.resultCode == 9000) {
  866. common.simpleToast('支付成功');
  867. }
  868. setTimeout(function() {
  869. me.bindOrderInfo()
  870. }, 1000)
  871. },
  872. fail: function(res) {
  873. common.simpleToast('支付失败,请重试')
  874. },
  875. })
  876. //#endif
  877. //#ifdef MP-WEIXIN
  878. var payParams = JSON.parse(resp.data.data.payParams);
  879. user.wxPay(me.order_sn, payParams, function(isSuccess) {
  880. if (isSuccess) {
  881. common.simpleToast('支付成功')
  882. setTimeout(function() {
  883. me.bindOrderInfo()
  884. }, 1000)
  885. } else {
  886. common.simpleToast('支付失败,请重试')
  887. }
  888. });
  889. //#endif
  890. } else {
  891. uni.hideLoading()
  892. common.simpleToast(resp.data.msg)
  893. }
  894. })
  895. },
  896. // 计算拖车说明收费价格
  897. calculateFare(distance, charge_list) {
  898. let fare = 0
  899. if (distance <= charge_list.start_mil) {
  900. fare = charge_list.start_price / 100
  901. } else {
  902. // actual_start_mil:实际距离单位米
  903. // over_start_price:向上取整的公里数*超出首公里的费用
  904. var actual_start_mil = distance - charge_list.start_mil
  905. var over_start_price = (Math.ceil(actual_start_mil / charge_list.step_mil)) * charge_list
  906. .step_price
  907. fare = (charge_list.start_price + over_start_price) / 100
  908. }
  909. const fareArray = fare.toFixed(2).split('.'); //将价格拆分为整数部分和小数部分
  910. const price_list = {
  911. start_mil: (charge_list.start_mil / 1000).toFixed(2),
  912. start_price: (charge_list.start_price / 100).toFixed(2),
  913. step_mil: (charge_list.step_mil / 1000).toFixed(2),
  914. step_price: (charge_list.step_price / 100).toFixed(2),
  915. actual_start_mil: actual_start_mil ? (actual_start_mil / 1000).toFixed(2) : 0,
  916. over_start_price: over_start_price ? (over_start_price / 100).toFixed(2) : 0,
  917. fare: fare.toFixed(2), // 保留两位小数
  918. fareArray: fareArray //将价格拆分为整数部分和小数部分
  919. }
  920. return price_list
  921. },
  922. bindChangeStatus(e) {
  923. const {
  924. status,
  925. unit
  926. } = e.currentTarget.dataset
  927. this.setData({
  928. isSelectStatus: unit,
  929. selectIndex: status
  930. })
  931. // this.bindDuration()
  932. },
  933. //计算价格
  934. // bindDuration(){
  935. // const me = this
  936. // var _insurance_price //保险金
  937. // const unit_price=(me.price_list[0].hire_price/100) * me.leaseTime //租金
  938. // // insurance_setting 保险
  939. // if (me.insurance_setting!=null) { // 有保险的时候
  940. // // isSelectDeposit==0为免押 isOpenNoDeposit为是否成功开通免押 total_money为总金额
  941. // // unit_price 租金 insurance_setting.price 保险金 deposit 押金
  942. // if (me.duration_unit == 4) { // 时
  943. // _insurance_price = (me.insurance_setting.price - 0) * 1
  944. // } else if(me.duration_unit == 6) { // 周
  945. // _insurance_price = (me.insurance_setting.price - 0) * 7 * me.leaseTime
  946. // } else { //天
  947. // _insurance_price = (me.insurance_setting.price - 0) * me.leaseTime
  948. // }
  949. // } else { // 无保险
  950. // _insurance_price = 0
  951. // }
  952. // if (me.isOpenNoDeposit) {
  953. // // 金额=(周期数*周期价格)+保险金
  954. // me.amount = ((me.leaseTime * me.price_list[0].hire_price -0) + (_insurance_price - 0)) / 100
  955. // } else {
  956. // // 金额=(周期数*周期价格)+押金+保险金
  957. // me.amount = ((me.leaseTime * me.price_list[0].hire_price -0) + (me.modelInfo.deposit -0) + (_insurance_price - 0)) / 100
  958. // }
  959. // },
  960. loadEnd() {
  961. this.bindOrderInfo()
  962. },
  963. navToExchange() {
  964. console.log('跳转换电记录');
  965. uni.navigateTo({
  966. url: '/pages/exchangeRecord/exchangeRecord' +
  967. '?order_sn=' + this.orderInfo.order_sn
  968. })
  969. }
  970. }
  971. };
  972. </script>
  973. <style>
  974. @import './orderStatus.css';
  975. .cancel_btn {
  976. width: 702rpx;
  977. height: 80rpx;
  978. background: #060809;
  979. border-radius: 40rpx;
  980. font-family: PingFangSC, PingFang SC;
  981. font-weight: 500;
  982. font-size: 32rpx;
  983. color: #FFFFFF;
  984. display: flex;
  985. align-items: center;
  986. justify-content: center;
  987. }
  988. </style>