orderStatus.vue 34 KB

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