orderStatus.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  1. <template>
  2. <view class="container-view">
  3. <view class="time-info">
  4. <view>
  5. <view v-if="orderInfo.pay_status!=2">
  6. <view v-if="orderInfo.pay_status == 0">待支付</view>
  7. <view v-else-if="orderInfo.pay_status == 1">支付中</view>
  8. <view v-else-if="orderInfo.pay_status == 3">支付失败</view>
  9. <view v-else-if="orderInfo.pay_status == 4">支付取消</view>
  10. <view v-else-if="orderInfo.pay_status == 5">线下待审核</view>
  11. <view v-else-if="orderInfo.pay_status == 6">线下审核拒绝</view>
  12. </view>
  13. <view v-if="orderInfo.order_status == 1">
  14. {{orderInfo.return_type == 1?('请于'+tools.formatTimeSecond(orderInfo.hire_begin_time)+'到门店取车'):('将于'+tools.formatTimeSecond(orderInfo.hire_begin_time)+'送车上门')}}
  15. </view>
  16. <view v-else-if="orderInfo.order_status == 2">请上传车辆图片激活车辆</view>
  17. <view v-else-if="orderInfo.order_status == 3" class="blue-text">使用中...</view>
  18. <view v-else-if="orderInfo.order_status == 4" class="red-text">已逾期</view>
  19. <view v-else-if="orderInfo.order_status == 5">待门店确认</view>
  20. <view v-else-if="orderInfo.order_status == 6">还车中,等待门店取车</view>
  21. <view v-else-if="orderInfo.order_status == 7">已完成</view>
  22. <view v-else-if="orderInfo.order_status == 8||orderInfo.order_status == 9">已取消</view>
  23. </view>
  24. <view class="time-money">
  25. <view class="flex-row flex-between">
  26. <view class="money-item">
  27. <view :class="orderInfo.order_status == 4?'red-status':''">
  28. {{orderInfo.hire_duration_time.day > 0 ? orderInfo.hire_duration_time.day :'' }}<text
  29. v-if="orderInfo.hire_duration_time.day>0">日</text>{{orderInfo.hire_duration_time.hour > 0 ? orderInfo.hire_duration_time.hour :'' }}<text
  30. v-if="orderInfo.hire_duration_time.hour>0">小时</text>{{orderInfo.hire_duration_time.minute > 0 ? orderInfo.hire_duration_time.minute :'' }}<text
  31. v-if="orderInfo.hire_duration_time.minute>0">分</text>
  32. </view>
  33. <view v-if="(orderInfo.order_status == 2&&orderInfo.hire_type==2) || orderInfo.order_status == 3">租期剩余</view>
  34. <view v-else-if="orderInfo.order_status == 4" class="red-status">逾期时长</view>
  35. <view v-else>租借周期</view>
  36. <!-- <view
  37. v-if="(orderInfo.order_status != 2&&orderInfo.hire_type==1) && orderInfo.order_status != 3 && orderInfo.order_status != 4">
  38. 租借周期</view> -->
  39. </view>
  40. <view class="money-item">
  41. <view :class="orderInfo.order_status == 4?'red-status':''">
  42. {{orderInfo.order_status == 4?tools.toFix(over_fee/100):tools.toFix(orderInfo.hire_money / 100)}}<text>元</text>
  43. </view>
  44. <view v-if="orderInfo.order_status == 4" class="red-status">逾期金额</view>
  45. <view v-else>订单金额</view>
  46. </view>
  47. <view @tap="bindExpanded">
  48. <text>{{isExpanded?'收起':'展开'}}</text>
  49. <img
  50. :src="isExpanded?'https://qiniu.bms16.com/FvRah8ro91B_TUVEmInBq6n69W2f':'https://qiniu.bms16.com/FtbxPP0aXYG8hyJTEJfNTXa_Puuc'" />
  51. </view>
  52. </view>
  53. <view v-if="isExpanded" class="dashed-border"></view>
  54. <view v-if="isExpanded">
  55. <view class="big-text">订单信息</view>
  56. <view class="sn-content flex-row flex-between">
  57. <view class="sn-title">订单编号</view>
  58. <view class="sn-text" >{{orderInfo.sub_sn}}</view>
  59. </view>
  60. <view class="sn-content flex-row flex-between">
  61. <view class="sn-title">下单时间</view>
  62. <view class="sn-text">{{tools.formatTime(orderInfo.ctime)}}</view>
  63. </view>
  64. <view class="sn-content flex-row flex-between">
  65. <view class="sn-title">支付时间</view>
  66. <view class="sn-text">{{tools.formatTime(orderInfo.pay_time)}}</view>
  67. </view>
  68. <view class="sn-content flex-row flex-between">
  69. <view class="sn-title">支付方式</view>
  70. <view v-if="orderInfo.pay_type == 0" class="sn-text">微信支付</view>
  71. <view v-if="orderInfo.pay_type == 1" class="sn-text">线下支付</view>
  72. <view v-if="orderInfo.pay_type == 2" class="sn-text">支付宝支付</view>
  73. <view v-if="orderInfo.pay_type == 9" class="sn-text">钱包余额支付</view>
  74. </view>
  75. <view class="sn-content flex-row flex-between">
  76. <view class="sn-title">租车金额</view>
  77. <view class="sn-text">$ {{tools.toFix(orderInfo.hire_money/1000)}}</view>
  78. </view>
  79. <view class="sn-content flex-row flex-between">
  80. <view class="sn-title">租车押金</view>
  81. <view class="sn-text"><text class="grey-text">订单结束后随时退</text> $ {{tools.toFix(orderInfo.deposit/1000)}}</view>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. <view class="car-info">
  87. <view class="flex-row flex-between" style="margin-bottom: 40rpx;">
  88. <text>自行去门店取还</text>
  89. <text class="distance-num">100m</text>
  90. </view>
  91. <view class="flex-row store-img-view">
  92. <img src="https://qiniu.bms16.com/FrwDlFZdSMiBgqnqDjB19PiDUmuu" alt="">
  93. <view style="width: 100%;margin-left: 24rpx;">
  94. <view class="store-name">小众租车深圳店</view>
  95. <view class="store-name-address">西丽留仙洞留仙村路97号</view>
  96. <view class="flex-row flex-between align-center">
  97. <view class="flex-row time-style align-center">
  98. <img style="width: 40rpx;height: 40rpx;" src="https://qiniu.bms16.com/Fp-G1pdXxnTV-G3qFbgS453AuqcU" alt="">
  99. <text>10:00-22:00</text>
  100. </view>
  101. <img style="width: 112rpx;height: 64rpx;" src="https://qiniu.bms16.com/Fts38M35doVjK09GfOza5qD-wwkK" alt="">
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. <view class="car-info">
  107. <view>车辆信息</view>
  108. <view class="car-top flex-row flex-between">
  109. <view class="top-flex">
  110. <view>智能电动摩托车智驾</view>
  111. <view>续航{{orderInfo.endurance}}|重量{{orderInfo.weight}}</view>
  112. </view>
  113. <img src="https://qiniu.bms16.com/FhEvnKUckAHPtWaC04mi2s53IEVj" alt="">
  114. </view>
  115. <view class="exchange-info">
  116. <view class="flex-row flex-between">
  117. <view class="exchange-info-title flex-row align-center">
  118. <img style="width: 40rpx;height: 40rpx;" src="https://qiniu.bms16.com/Fj_ifr41AqH2PijZBdOBa3SCxADg" alt="">
  119. <text style="margin-left: 16rpx;">换电信息</text>
  120. </view>
  121. <view @tap="navToExchange" class="flex-row" style="margin-bottom: 28rpx;">
  122. <view class="exchange-button">共3次</view>
  123. <image src="https://qiniu.bms16.com/FpIN7AVzFU75slFlX-SIdnSEmn1k" style="width: 28rpx;height: 28rpx;" />
  124. </view>
  125. </view>
  126. <view class="exchange-content">本单可享3次免费换电数,超出后需单独支付</view>
  127. <view class="exchange-content">自费换电:S1/次</view>
  128. <!-- <view class="exchange-content">本单您可享受{{orderInfo.gift_exchange_num}}次免费换电,
  129. 当前免费换电剩余{{(orderInfo.gift_exchange_num - orderInfo.used_exchange_num) > 0 ? (orderInfo.gift_exchange_num - orderInfo.used_exchange_num) : '0' }}次,超出后需要单独支付换电费用
  130. </view> -->
  131. </view>
  132. </view>
  133. <view v-if="orderInfo.hire_begin_time!=0&&orderInfo.hire_end_time!=0" class="return-info">
  134. <view class="return-top flex-row flex-between">
  135. <view>取还时间</view>
  136. <view>
  137. 共3天{{orderInfo.hire_return_time.day > 0 ? orderInfo.hire_return_time.day :'' }}<text
  138. v-if="orderInfo.hire_return_time.day>0">日</text>{{orderInfo.hire_return_time.hour > 0 ? orderInfo.hire_return_time.hour :'' }}<text
  139. v-if="orderInfo.hire_return_time.hour>0">小时</text>{{orderInfo.hire_return_time.minute > 0 ? orderInfo.hire_return_time.minute :'' }}<text
  140. v-if="orderInfo.hire_return_time.minute>0">分</text>
  141. </view>
  142. </view>
  143. <view class="return-bottom flex-row">
  144. <view>3.8-20:00</view>
  145. <img src="https://qiniu.bms16.com/FoXmBbj7YGWmjyeuVEY35nzieqnx" />
  146. <view>3.8-20:00</view>
  147. <!-- <view>{{tools.formatTimeDate(orderInfo.hire_begin_time)}}</view>
  148. <img src="https://qiniu.bms16.com/FoXmBbj7YGWmjyeuVEY35nzieqnx" />
  149. <view>{{tools.formatTimeDate(orderInfo.hire_end_time)}}</view> -->
  150. </view>
  151. </view>
  152. <view v-if="orderInfo.order_status==2||orderInfo.order_status==3||orderInfo.order_status==4"
  153. class="overdue-info">
  154. <view>逾期规则</view>
  155. <view class="overdue-one">
  156. <view>1. 逾期后还可用车吗?</view>
  157. <view>如果逾期将触发智能锁车逻辑,可能导致您无法正常用车,请及时续费或联系商家处理。</view>
  158. </view>
  159. <view class="overdue-two">
  160. <view>2. 逾期费计算标准是什么?</view>
  161. <view>小时租逾期费=每小时费用*逾期小时;当日还/日/周/月/季租逾期费=每天费用*逾期天数;如果不满1小时按1小时算,不满1天按1天算,最终收取的逾期费以门店确认的费用为准</view>
  162. </view>
  163. <view class="overdue-thr">
  164. <view>3. 逾期后续租如何收费?</view>
  165. <view>逾期后及时续租不收取逾期费,逾期时长将从续租订单的用车时间中抵扣</view>
  166. </view>
  167. </view>
  168. <!-- 考虑为空的情况 -->
  169. <view class="payment-info flex-row flex-between">
  170. <view v-if="orderInfo.order_status == 1" class="flex-row"> <!-- 待取车 -->
  171. <view class="cancel" @tap="clickCancel">结束订单</view>
  172. <view @tap="callStorePhone" class="deposit-btn w_224">联系门店</view>
  173. <view @tap="navToScan" class="sesame-btn w_288">扫码绑定</view>
  174. </view>
  175. <view v-else-if="orderInfo.order_status == 3||orderInfo.order_status == 4" class="flex-row"> <!-- 使用中 -->
  176. <view @tap="callStorePhone" class="cancel">联系门店</view>
  177. <view @tap="tapReturnCar" class="deposit-btn w_254">到店还车</view>
  178. <view @tap="bindRenew" class="sesame-btn w_224">续租</view>
  179. </view>
  180. <view v-else-if="orderInfo.order_status == 5||orderInfo.order_status == 6" @tap="callStorePhone" class="pay-btn">
  181. 联系门店</view> <!-- 待门店确认||还车中,等待门店取车 -->
  182. <view v-else-if="orderInfo.order_status == 7" @tap="callStorePhone" class="pay-btn">联系门店</view> <!--车辆已归还 已完成 -->
  183. </view>
  184. <view v-if="isShowCancel" class="cancel-b">
  185. <view class="cancel-box">
  186. <view class="cancel-title flex-row flex-between">
  187. <view>选择取消原因</view>
  188. <view @tap="isShowCancel = false" style="font-size: 60rpx;">×</view>
  189. </view>
  190. <view @tap="bindCancel" data-status="1" class="cancel-item flex-row flex-between">
  191. <view>行程变更无需用车</view>
  192. <img
  193. :src="reason == 1?'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq':'https://qiniu.bms16.com/Fh0JH6_QbiXYmVy7FNYnDkVIGvLC'" />
  194. </view>
  195. <view @tap="bindCancel" data-status="2" class="cancel-item flex-row flex-between">
  196. <view>修改订单信息</view>
  197. <img
  198. :src="reason == 2?'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq':'https://qiniu.bms16.com/Fh0JH6_QbiXYmVy7FNYnDkVIGvLC'" />
  199. </view>
  200. <view @tap="bindCancel" data-status="3" class="cancel-item flex-row flex-between">
  201. <view>不想要了</view>
  202. <img
  203. :src="reason == 3?'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq':'https://qiniu.bms16.com/Fh0JH6_QbiXYmVy7FNYnDkVIGvLC'" />
  204. </view>
  205. </view>
  206. </view>
  207. <returnCar :isShowReturnCar="isShowReturnCar" @closeShowReturnCarBtn="()=>isShowReturnCar=false" @navStoreBtn="navStoreBtn" @immediatelyReturnBtn="immediatelyReturnBtn"/>
  208. <PayTypeModel @closeShow="()=>isShowToBuy=false" @payToOrder="payToOrder" :free_price="totalPrice" :isShowToBuy="isShowToBuy"/>
  209. </view>
  210. </template>
  211. <script module="tools" lang="wxs" src="@/pages/common/wxs/tools.wxs"></script>
  212. <script module="tools" lang="sjs" src="@/pages/common/wxs/tools.sjs"></script>
  213. <script>
  214. var config = require('../../common/config.js');
  215. var common = require('../../common/common.js');
  216. var http = require('../../common/http.js');
  217. var storage = require('../../common/storage.js');
  218. var user = require('../../common/user.js');
  219. var appWhiteListFilter = require('../../common/appWhiteListFilter.js');
  220. import allPrice from '@/component/allPrice/allPrice';
  221. import ReturnCar from '@/component/returnCar/returnCar';
  222. import PayTypeModel from '@/component/payTypeModel/payTypeModel';
  223. export default {
  224. components: {
  225. allPrice,
  226. ReturnCar,
  227. PayTypeModel
  228. },
  229. data() {
  230. return {
  231. return_imgs: {},
  232. charge_standard: {},
  233. isShowCancel: false,
  234. order_sn: '',
  235. reason: 0,
  236. orderInfo: {},
  237. shop_image: [],
  238. isExpanded: false,
  239. isShowPrice: false,
  240. timer: '',
  241. isSelectStatus: 1,
  242. price_list: [], //车辆价格 hire_duration_unit 1 日 4 小时 6 周
  243. insurance_status: 0,
  244. over_fee:0,//逾期金额
  245. plate_number: '',
  246. isScanCondeRentalCar: '',
  247. isShowReturnCar:false,
  248. isShowToBuy:false,
  249. totalPrice:0, //逾期支付金额
  250. };
  251. },
  252. /**
  253. * 生命周期函数--监听页面加载
  254. */
  255. onLoad: function(options) {
  256. this.sub_sn = options.sub_sn || ''
  257. this.bindOrderInfo()
  258. },
  259. /**
  260. * 生命周期函数--监听页面显示
  261. */
  262. onShow: function() {
  263. },
  264. onUnload: function () {
  265. },
  266. computed: {},
  267. methods: {
  268. bindOrderInfo() {
  269. const me = this
  270. http.postApi(config.API_FLK_ORDER_INFO, {
  271. sub_sn: me.sub_sn,
  272. }, (resp) => {
  273. if (resp.data.code === 200) {
  274. me.orderInfo = resp.data.data.order_info
  275. // 取还时间展示
  276. me.orderInfo.hire_return_time = common.getTimeToDay(Math.ceil(me.orderInfo.hire_end_time - me.orderInfo.hire_begin_time)/60)
  277. // 剩余租期判断
  278. if((me.orderInfo.hire_type==2&&me.orderInfo.order_status==2)||me.orderInfo.order_status==3){
  279. me.orderInfo.hire_duration_time = common.getTimeToDay(Math.ceil(me.orderInfo.hire_end_time-(Math.floor(new Date()) / 1000))/60)
  280. }else{
  281. if(me.orderInfo.order_status==4){
  282. me.orderInfo.hire_duration_time = common.getTimeToDay(Math.ceil(Math.floor(new Date()) / 1000-me.orderInfo.hire_end_time)/60)
  283. }else{
  284. me.orderInfo.hire_duration_time = me.orderInfo.hire_return_time
  285. }
  286. }
  287. } else {
  288. // 默认返回上一个页面再提示报错
  289. uni.navigateBack({
  290. delta: 1
  291. })
  292. common.simpleToast(resp.data.msg)
  293. }
  294. })
  295. },
  296. navStoreBtn(){
  297. const {
  298. latitude,
  299. longitude,
  300. address,
  301. shop_name
  302. } = this.orderInfo
  303. uni.openLocation({
  304. latitude: latitude - 0,
  305. longitude: longitude - 0,
  306. scale: 15,
  307. name: shop_name,
  308. address: address,
  309. success: function(res) {}
  310. });
  311. },
  312. tapReturnCar(){
  313. this.setData({
  314. isShowReturnCar:true
  315. })
  316. },
  317. immediatelyReturnBtn(){
  318. //到店还车 判断逾期状态 如果逾期要交逾期费用 跳转到上传车辆图片再支付逾期费用还车
  319. const isOverdue=this.orderInfo.order_status==4
  320. const {car_sn,shop_id,overdue_money}=this.orderInfo
  321. const returnCarParams={car_sn,shop_id,overdue_money,isReturnCar:true,}
  322. if(isOverdue){
  323. this.setData({
  324. totalPrice:overdue_money,
  325. isShowToBuy:true
  326. })
  327. }else{
  328. //提交还车图片
  329. uni.navigateTo({
  330. url: '/pages/activation/activation?isReturnCar=' + true +'&car_sn='+car_sn +'&shop_id=' + shop_id,
  331. });
  332. }
  333. },
  334. callStorePhone(){
  335. const phone =this.orderInfo.link_phone
  336. common.callPhone(this,phone)
  337. },
  338. clickCancel() {
  339. const me = this
  340. uni.showModal({
  341. title: '取消订单',
  342. content: '您是否需要取消该订单',
  343. confirmText: '是',
  344. confirmColor: '#0074FF',
  345. cancelText: '否',
  346. cancelColor: '#191D23',
  347. success: function(res) {
  348. if (res.confirm) {
  349. me.isShowCancel = true
  350. }
  351. }
  352. });
  353. },
  354. bindCancel(e) {
  355. const me = this
  356. me.reason = e.currentTarget.dataset.status;
  357. me.cancel = true
  358. common.loading()
  359. setTimeout(function() {
  360. http.postApi(config.API_DAYHIRE_HIRE_CANCEL_ORDER, {
  361. order_sn: me.order_sn
  362. }, (resp) => {
  363. if (resp.data.code === 200) {
  364. uni.hideLoading()
  365. common.simpleToast('取消成功')
  366. setTimeout(()=> {
  367. me.bindOrderInfo()
  368. }, 500);
  369. } else{
  370. common.simpleToast('订单取消失败')
  371. }
  372. me.reason = 0
  373. me.isShowCancel = false
  374. })
  375. }, 600);
  376. },
  377. bindToNav() {
  378. console.log(111);
  379. const {
  380. address,
  381. latitude,
  382. longitude,
  383. shop_name
  384. } = this.shopInfo
  385. uni.openLocation({
  386. latitude: latitude - 0,
  387. longitude: longitude - 0,
  388. scale: 15,
  389. name: shop_name,
  390. address: address,
  391. success: function(res) {},
  392. })
  393. },
  394. bindToHome() {
  395. uni.reLaunch({
  396. url: '/pages/index/index',
  397. success: function(res) {},
  398. fail: function(res) {},
  399. complete: function(res) {}
  400. });
  401. },
  402. callPhone() {
  403. const me = this
  404. const phone = me.shopInfo.link_phone
  405. uni.showModal({
  406. content: `您是否要拨打电话${phone}?`,
  407. confirmText: '确定',
  408. success: (res) => {
  409. if (res.confirm) {
  410. uni.makePhoneCall({
  411. phoneNumber: phone,
  412. success() {},
  413. fail() {}
  414. })
  415. }
  416. },
  417. fail: (res) => {}
  418. })
  419. },
  420. bindRenew() {
  421. this.isReturnHome = false
  422. let isRenew = true
  423. uni.navigateTo({
  424. url: '/pages/carIntroduce/carIntroduce?plate_number=' + this.orderInfo.license_plate_number +
  425. '&isRenew=' + isRenew +
  426. '&order_sn=' + this.order_sn,
  427. success: function(res) {},
  428. fail: function(res) {},
  429. complete: function(res) {}
  430. });
  431. },
  432. bindBattery() {
  433. this.isReturnHome = false
  434. uni.navigateTo({
  435. url: '/pages/battery/battery?plate_number=' + this.orderInfo.license_plate_number,
  436. success: function(res) {},
  437. fail: function(res) {},
  438. complete: function(res) {}
  439. });
  440. },
  441. bindExpanded() {
  442. this.isExpanded = !this.isExpanded
  443. },
  444. navToInput() {
  445. this.isReturnHome = false
  446. uni.navigateTo({
  447. url: '/pages/inputLicensePlate/inputLicensePlate?order_sn=' + this.orderInfo.order_sn,
  448. success: function(res) {},
  449. fail: function(res) {},
  450. complete: function(res) {}
  451. });
  452. },
  453. // 激活车辆
  454. navToActive() {
  455. this.isReturnHome = false
  456. const me = this
  457. if (this.orderInfo.hire_type == 1) { // 预约
  458. if(me.isScanCondeRentalCar) {
  459. uni.scanCode({
  460. onlyFromCamera: true,
  461. success: function (res) {
  462. me.loadScanCode(res.result)
  463. },
  464. fail: function (res) { },
  465. complete: function (res) { },
  466. })
  467. } else {
  468. uni.navigateTo({
  469. url: '/pages/inputLicensePlate/inputLicensePlate?order_sn=' + this.order_sn +'&order_model_id='+this.orderInfo.model_id,
  470. success: function(res) {},
  471. fail: function(res) {},
  472. complete: function(res) {}
  473. });
  474. }
  475. } else { // 非预约
  476. const isJumpReturn = false
  477. uni.navigateTo({
  478. url: '/pages/activation/activation?order_sn=' + this.order_sn + '&plate_number=' + this
  479. .orderInfo.license_plate_number +'&isJumpReturn=' + isJumpReturn,
  480. success: function(res) {},
  481. fail: function(res) {},
  482. complete: function(res) {}
  483. });
  484. }
  485. },
  486. loadScanCode(battery_sn) {
  487. const pData = {
  488. longitude: this.longitude,
  489. latitude: this.latitude,
  490. battery_sn: battery_sn
  491. }
  492. const me = this
  493. http.postApi(config.API_DAYHIRE_CAR_CAR_INFO, pData, (resp) => {
  494. uni.hideLoading()
  495. if (resp.data.code === 200) {
  496. const timestamp = Date.now(); // 获取当前时间戳(毫秒)
  497. const isOffline = (Math.floor(timestamp / 1000) - resp.data.data.last_comm_time) > 1800
  498. me.plate_number = resp.data.data.license_plate_number
  499. if (resp.data.data.last_comm_time === 0 || isOffline) {
  500. common.simpleToast('此车辆已离线,请选择其他车辆')
  501. } else {
  502. let carInfo = JSON.stringify(resp.data.data)
  503. const car_model = resp.data.data.model_info.car_model
  504. const model_images = resp.data.data.model_info.model_images.split(',')
  505. const return_imgs = resp.data.data.return_imgs
  506. var model_id = resp.data.data.model_info.model_id
  507. if (resp.data.data.has_owner) { //车辆正在被使用
  508. if (resp.data.data.is_mine) { //是本人在使用
  509. wx.showModal({
  510. title: '提示',
  511. content: '已有正在使用的车辆,是否跳转至车辆详情页?',
  512. cancelText: '取消',
  513. confirmText: '确定',
  514. success: function(res) {
  515. this.isReturnHome = false
  516. uni.navigateTo({
  517. url: '/pages/battery/battery?plate_number=' +
  518. this.plate_number
  519. });
  520. },
  521. fail: function(res) {},
  522. complete: function(res) {},
  523. })
  524. } else {
  525. common.simpleToast('此车辆正在被使用')
  526. }
  527. } else {
  528. if (me.order_sn&&me.order_sn != '') {
  529. if (this.orderInfo.model_id != model_id) { // 预租车型与之前预约车型不一致
  530. common.simpleToast('与预约车型不符')
  531. } else {
  532. this.isReturnHome = false
  533. uni.navigateTo({
  534. url: '/pages/activation/activation?plate_number=' +
  535. this.plate_number + '&order_sn=' + this.order_sn +
  536. '&car_model=' + car_model + '&model_image=' +
  537. model_images[0] + '&return_imgs=' + JSON.stringify(
  538. return_imgs),
  539. fail() {}
  540. })
  541. }
  542. } else {
  543. this.isReturnHome = false
  544. uni.navigateTo({
  545. url: '/pages/carIntroduce/carIntroduce?carInfo=' +
  546. encodeURIComponent(carInfo) + '&plate_number=' + this.plate_number,
  547. fail() {}
  548. })
  549. }
  550. }
  551. }
  552. } else {
  553. common.simpleToast(resp.data.msg)
  554. }
  555. })
  556. },
  557. bindToPay() {
  558. const me = this
  559. //#ifdef MP-ALIPAY
  560. const _from = 'ali'
  561. const _pay_type = 2
  562. //#endif
  563. //#ifdef MP-WEIXIN
  564. const _from = 'wx'
  565. const _pay_type = 0
  566. //#endif
  567. http.postApi(config.API_DAYHIRE_HIRE_CONTINUE_PAY, {
  568. order_sn: me.order_sn,
  569. from: _from,
  570. pay_type: _pay_type
  571. }, (resp) => {
  572. common.loading()
  573. if (resp.data.code === 200) {
  574. uni.hideLoading()
  575. //#ifdef MP-ALIPAY
  576. my.tradePay({
  577. tradeNO: resp.data.data.trade_no,
  578. success: function(res) {
  579. if (res.resultCode == 9000) {
  580. common.simpleToast('支付成功');
  581. }
  582. setTimeout(function() {
  583. me.bindOrderInfo()
  584. }, 1000)
  585. },
  586. fail: function(res) {
  587. common.simpleToast('支付失败,请重试')
  588. },
  589. })
  590. //#endif
  591. //#ifdef MP-WEIXIN
  592. var payParams = JSON.parse(resp.data.data.payParams);
  593. user.wxPay(me.order_sn, payParams, function(isSuccess) {
  594. if (isSuccess) {
  595. common.simpleToast('支付成功')
  596. setTimeout(function() {
  597. me.bindOrderInfo()
  598. }, 1000)
  599. } else {
  600. common.simpleToast('支付失败,请重试')
  601. }
  602. });
  603. //#endif
  604. } else {
  605. uni.hideLoading()
  606. common.simpleToast(resp.data.msg)
  607. }
  608. })
  609. },
  610. // 计算拖车说明收费价格
  611. calculateFare(distance, charge_list) {
  612. let fare = 0
  613. if (distance <= charge_list.start_mil) {
  614. fare = charge_list.start_price / 100
  615. } else {
  616. // actual_start_mil:实际距离单位米
  617. // over_start_price:向上取整的公里数*超出首公里的费用
  618. var actual_start_mil = distance - charge_list.start_mil
  619. var over_start_price = (Math.ceil(actual_start_mil / charge_list.step_mil)) * charge_list.step_price
  620. fare = (charge_list.start_price + over_start_price) / 100
  621. }
  622. const fareArray = fare.toFixed(2).split('.'); //将价格拆分为整数部分和小数部分
  623. const price_list = {
  624. start_mil: (charge_list.start_mil / 1000).toFixed(2),
  625. start_price: (charge_list.start_price / 100).toFixed(2),
  626. step_mil: (charge_list.step_mil / 1000).toFixed(2),
  627. step_price: (charge_list.step_price / 100).toFixed(2),
  628. actual_start_mil: actual_start_mil ? (actual_start_mil / 1000).toFixed(2) : 0,
  629. over_start_price: over_start_price ? (over_start_price / 100).toFixed(2) : 0,
  630. fare: fare.toFixed(2), // 保留两位小数
  631. fareArray: fareArray //将价格拆分为整数部分和小数部分
  632. }
  633. return price_list
  634. },
  635. bindChangeStatus(e) {
  636. const {
  637. status,
  638. unit
  639. } = e.currentTarget.dataset
  640. this.setData({
  641. isSelectStatus: unit,
  642. selectIndex: status
  643. })
  644. // this.bindDuration()
  645. },
  646. //计算价格
  647. // bindDuration(){
  648. // const me = this
  649. // var _insurance_price //保险金
  650. // const unit_price=(me.price_list[0].hire_price/100) * me.leaseTime //租金
  651. // // insurance_setting 保险
  652. // if (me.insurance_setting!=null) { // 有保险的时候
  653. // // isSelectDeposit==0为免押 isOpenNoDeposit为是否成功开通免押 total_money为总金额
  654. // // unit_price 租金 insurance_setting.price 保险金 deposit 押金
  655. // if (me.duration_unit == 4) { // 时
  656. // _insurance_price = (me.insurance_setting.price - 0) * 1
  657. // } else if(me.duration_unit == 6) { // 周
  658. // _insurance_price = (me.insurance_setting.price - 0) * 7 * me.leaseTime
  659. // } else { //天
  660. // _insurance_price = (me.insurance_setting.price - 0) * me.leaseTime
  661. // }
  662. // } else { // 无保险
  663. // _insurance_price = 0
  664. // }
  665. // if (me.isOpenNoDeposit) {
  666. // // 金额=(周期数*周期价格)+保险金
  667. // me.amount = ((me.leaseTime * me.price_list[0].hire_price -0) + (_insurance_price - 0)) / 100
  668. // } else {
  669. // // 金额=(周期数*周期价格)+押金+保险金
  670. // me.amount = ((me.leaseTime * me.price_list[0].hire_price -0) + (me.modelInfo.deposit -0) + (_insurance_price - 0)) / 100
  671. // }
  672. // },
  673. loadEnd() {
  674. this.bindOrderInfo()
  675. },
  676. navToExchange(){
  677. console.log('跳转换电记录');
  678. uni.navigateTo({
  679. url: '/pages/exchangeRecord/exchangeRecord'+
  680. '?order_sn=' + this.orderInfo.order_sn
  681. })
  682. }
  683. }
  684. };
  685. </script>
  686. <style>
  687. @import './orderStatus.css';
  688. </style>