orderStatus.vue 35 KB

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