|
@@ -11,7 +11,8 @@
|
|
|
<view v-else-if="orderInfo.pay_status == 6">线下审核拒绝</view>
|
|
|
</view>
|
|
|
<view v-if="orderInfo.order_status == 1">
|
|
|
- {{orderInfo.return_type == 1?('请于'+tools.formatTimeSecond(orderInfo.hire_begin_time)+'到门店取车'):('将于'+tools.formatTimeSecond(orderInfo.hire_begin_time)+'送车上门')}}
|
|
|
+ <!-- {{('请于'+tools.formatTimeSecond(orderInfo.hire_begin_time)+'到门店取车')}} -->
|
|
|
+ 待取车
|
|
|
</view>
|
|
|
<view v-else-if="orderInfo.order_status == 2">请上传车辆图片激活车辆</view>
|
|
|
<view v-else-if="orderInfo.order_status == 3" class="blue-text">使用中...</view>
|
|
@@ -21,6 +22,7 @@
|
|
|
<view v-else-if="orderInfo.order_status == 7">已完成</view>
|
|
|
<view v-else-if="orderInfo.order_status == 8||orderInfo.order_status == 9">已取消</view>
|
|
|
</view>
|
|
|
+
|
|
|
<view class="time-money">
|
|
|
<view class="flex-row flex-between">
|
|
|
<view class="money-item">
|
|
@@ -79,7 +81,8 @@
|
|
|
<view class="sn-content flex-row flex-between">
|
|
|
<view class="sn-title">租车押金</view>
|
|
|
<view class="sn-text"><text class="grey-text">订单结束后随时退</text> $
|
|
|
- {{tools.toFix(orderInfo.deposit/1000)}}</view>
|
|
|
+ {{tools.toFix(orderInfo.deposit/1000)}}
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -95,10 +98,10 @@
|
|
|
<view class="store-name">{{orderInfo.shop_name}}</view>
|
|
|
<view class="store-name-address">{{orderInfo.address}}</view>
|
|
|
<view class="flex-row flex-between align-center">
|
|
|
- <view class="flex-row time-style align-center">
|
|
|
- <img style="width: 40rpx;height: 40rpx;"
|
|
|
+ <view class="flex-row time-style align-center">
|
|
|
+ <img v-if="orderInfo.work_begin_time && orderInfo.work_end_time" style="width: 40rpx;height: 40rpx;"
|
|
|
src="https://qiniu.bms16.com/Fp-G1pdXxnTV-G3qFbgS453AuqcU" alt="">
|
|
|
- <text>10:00-22:00</text>
|
|
|
+ <text v-if="orderInfo.work_begin_time && orderInfo.work_end_time">{{orderInfo.work_begin_time}}-{{orderInfo.work_end_time}}</text>
|
|
|
</view>
|
|
|
<img @click="navToCabinet" style="width: 112rpx;height: 64rpx;"
|
|
|
src="https://qiniu.bms16.com/Fts38M35doVjK09GfOza5qD-wwkK" alt="">
|
|
@@ -134,21 +137,22 @@
|
|
|
</view> -->
|
|
|
<!-- </view> -->
|
|
|
</view>
|
|
|
-
|
|
|
+
|
|
|
<view v-if="orderInfo.hire_begin_time!=0&&orderInfo.hire_end_time!=0" class="return-info">
|
|
|
<view class="return-top flex-row flex-between">
|
|
|
<view>取还时间</view>
|
|
|
<view>
|
|
|
- 共3天{{orderInfo.hire_return_time.day > 0 ? orderInfo.hire_return_time.day :'' }}<text
|
|
|
+ <!-- 共3天{{orderInfo.hire_return_time.day > 0 ? orderInfo.hire_return_time.day :'' }}<text
|
|
|
v-if="orderInfo.hire_return_time.day>0">日</text>{{orderInfo.hire_return_time.hour > 0 ? orderInfo.hire_return_time.hour :'' }}<text
|
|
|
v-if="orderInfo.hire_return_time.hour>0">小时</text>{{orderInfo.hire_return_time.minute > 0 ? orderInfo.hire_return_time.minute :'' }}<text
|
|
|
- v-if="orderInfo.hire_return_time.minute>0">分</text>
|
|
|
+ v-if="orderInfo.hire_return_time.minute>0">分</text> -->
|
|
|
+ 共{{hireDurationUnitsFn(orderInfo.total_hire_time,orderInfo.hire_duration_unit)}}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="return-bottom flex-row">
|
|
|
- <view>3.8-20:00</view>
|
|
|
+ <view>{{orderInfo.hire_begin_time}}</view>
|
|
|
<img src="https://qiniu.bms16.com/FoXmBbj7YGWmjyeuVEY35nzieqnx" />
|
|
|
- <view>3.8-20:00</view>
|
|
|
+ <view>{{orderInfo.hire_end_time}}</view>
|
|
|
<!-- <view>{{tools.formatTimeDate(orderInfo.hire_begin_time)}}</view>
|
|
|
<img src="https://qiniu.bms16.com/FoXmBbj7YGWmjyeuVEY35nzieqnx" />
|
|
|
<view>{{tools.formatTimeDate(orderInfo.hire_end_time)}}</view> -->
|
|
@@ -172,11 +176,17 @@
|
|
|
</view>
|
|
|
<!-- 考虑为空的情况 -->
|
|
|
<view class="payment-info flex-row flex-between">
|
|
|
+ <view v-if="orderInfo.order_status == 1 || orderInfo.pay_status == 5" class="cancel" @tap="clickCancel">结束订单</view>
|
|
|
<view v-if="orderInfo.order_status == 1" class="flex-row"> <!-- 待取车 -->
|
|
|
- <view class="cancel" @tap="clickCancel">结束订单</view>
|
|
|
<view @tap="callStorePhone" class="deposit-btn w_224">联系门店</view>
|
|
|
<view @tap="navToScan" class="sesame-btn w_288">扫码绑定</view>
|
|
|
</view>
|
|
|
+
|
|
|
+ <view v-if="orderInfo.order_status == 2" class="flex-row"> <!-- 待取车 -->
|
|
|
+ <view @tap="callStorePhone" class="deposit-btn w_224">联系门店</view>
|
|
|
+ <view @tap="navToScan" class="sesame-btn w_288">去上传</view>
|
|
|
+ </view>
|
|
|
+
|
|
|
<view v-else-if="orderInfo.order_status == 3||orderInfo.order_status == 4" class="flex-row"> <!-- 使用中 -->
|
|
|
<view @tap="callStorePhone" class="cancel">联系门店</view>
|
|
|
<view @tap="tapReturnCar" class="deposit-btn w_254">到店还车</view>
|
|
@@ -214,6 +224,9 @@
|
|
|
</view>
|
|
|
<returnCar :isShowReturnCar="isShowReturnCar" @closeShowReturnCarBtn="()=>isShowReturnCar=false"
|
|
|
@navStoreBtn="navStoreBtn" @immediatelyReturnBtn="immediatelyReturnBtn" />
|
|
|
+
|
|
|
+ <carPlan @payToOrder='payReturn' v-if="showCarPlan" @changeSelectType="changeSelectType" @closeShowMore="showCarPlan = false" :params="params" :selectType="selectType"/>
|
|
|
+
|
|
|
<PayTypeModel @closeShow="()=>isShowToBuy=false" @payToOrder="payToOrder" :free_price="totalPrice"
|
|
|
:isShowToBuy="isShowToBuy" />
|
|
|
</view>
|
|
@@ -221,23 +234,35 @@
|
|
|
<script module="tools" lang="wxs" src="@/pages/common/wxs/tools.wxs"></script>
|
|
|
<script module="tools" lang="sjs" src="@/pages/common/wxs/tools.sjs"></script>
|
|
|
<script>
|
|
|
+ var config_gyq = require('../../common/config_gyq.js');
|
|
|
var config = require('../../common/config.js');
|
|
|
+ var request = require('../../common/request');
|
|
|
var common = require('../../common/common.js');
|
|
|
var http = require('../../common/http.js');
|
|
|
var storage = require('../../common/storage.js');
|
|
|
var user = require('../../common/user.js');
|
|
|
+ //
|
|
|
+ import {getRemainingTime} from '@/utils/util';
|
|
|
var appWhiteListFilter = require('../../common/appWhiteListFilter.js');
|
|
|
import allPrice from '@/component/allPrice/allPrice';
|
|
|
import ReturnCar from '@/component/returnCar/returnCar';
|
|
|
+ import carPlan from '@/component/carPlan/carPlan';
|
|
|
import PayTypeModel from '@/component/payTypeModel/payTypeModel';
|
|
|
+ import dayjs from 'dayjs'
|
|
|
+ import duration from 'dayjs/plugin/duration'
|
|
|
+ dayjs.extend(duration);
|
|
|
export default {
|
|
|
components: {
|
|
|
allPrice,
|
|
|
ReturnCar,
|
|
|
- PayTypeModel
|
|
|
+ PayTypeModel,
|
|
|
+ carPlan
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ select_type:'',
|
|
|
+ car_detail:{},
|
|
|
+ showCarPlan:false,
|
|
|
return_imgs: {},
|
|
|
charge_standard: {},
|
|
|
isShowCancel: false,
|
|
@@ -277,6 +302,54 @@
|
|
|
computed: {},
|
|
|
|
|
|
methods: {
|
|
|
+
|
|
|
+ async loadCarInfo(model_id) {
|
|
|
+ const me = this
|
|
|
+ http.postApi(config.API_FLK_INDEX_CAR_MODEL_DETAIL, {
|
|
|
+ model_id,
|
|
|
+ }, (resp) => {
|
|
|
+ if (resp.data.code === 200) {
|
|
|
+ const pData={
|
|
|
+ ...this.car_detail,
|
|
|
+ price:this.price
|
|
|
+ }
|
|
|
+ me.setData({
|
|
|
+ car_detail:resp.data.data,
|
|
|
+ params:{
|
|
|
+ order_sn:this.orderInfo.order_sn,
|
|
|
+ ...resp.data.data,
|
|
|
+ price:(resp.data.data.rental_setting[0].hire_price/100).toFixed(2)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log('车辆信息')
|
|
|
+ console.log(resp.data.data)
|
|
|
+ } else {
|
|
|
+ common.simpleToast(resp.data.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ changeSelectType(select_type,price){
|
|
|
+ this.setData({
|
|
|
+ selectType: select_type,
|
|
|
+ price:(price/100).toFixed(2)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async navToScan(){
|
|
|
+ let car_sn = this.orderInfo.car_sn || ''
|
|
|
+ if(!car_sn){
|
|
|
+ let res = await uni.scanCode({
|
|
|
+ onlyFromCamera: true,
|
|
|
+ scanType: [],
|
|
|
+ });
|
|
|
+ if(res[0]) return
|
|
|
+ car_sn = res[1].result
|
|
|
+ }
|
|
|
+ uni.navigateTo({
|
|
|
+ url:`/pages/activation/activation?model_id=${this.orderInfo.model_id}&sub_sn=${this.sub_sn}&car_sn=${car_sn}`
|
|
|
+ })
|
|
|
+ // let {data} = await request.postApi(config.API_CAR_ASSIGNMENT,{sub_sn:this.sub_sn,car_sn:res[1].result})
|
|
|
+ },
|
|
|
|
|
|
navToCabinet() {
|
|
|
const {
|
|
@@ -294,492 +367,523 @@
|
|
|
address: address,
|
|
|
success: function(res) {}
|
|
|
});
|
|
|
- },
|
|
|
- hireDurationUnitFn(type) {
|
|
|
- if (type == 1) {
|
|
|
- return '天'
|
|
|
- } else if (type == 2) {
|
|
|
- return '月'
|
|
|
- } else if (type == 3) {
|
|
|
- return '年'
|
|
|
- } else if (type == 4) {
|
|
|
- return '小时'
|
|
|
- } else if (type == 5) {
|
|
|
- return '分钟'
|
|
|
- } else if (type == 6) {
|
|
|
- return '周'
|
|
|
- } else if (type == 7) {
|
|
|
- return '季'
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- async bindOrderInfo() {
|
|
|
- let res = await uni.getLocation()
|
|
|
- const me = this
|
|
|
- http.postApi(config.API_FLK_ORDER_INFO, {
|
|
|
- sub_sn: me.sub_sn,
|
|
|
- latitude: res[1].latitude,
|
|
|
- longitude: res[1].longitude,
|
|
|
- }, (resp) => {
|
|
|
- if (resp.data.code === 200) {
|
|
|
- me.orderInfo = resp.data.data.order_info
|
|
|
+ },
|
|
|
+
|
|
|
+ hireDurationUnitFn(type) {
|
|
|
+ if (type == 1) {
|
|
|
+ return '天'
|
|
|
+ } else if (type == 2) {
|
|
|
+ return '月'
|
|
|
+ } else if (type == 3) {
|
|
|
+ return '年'
|
|
|
+ } else if (type == 4) {
|
|
|
+ return '小时'
|
|
|
+ } else if (type == 5) {
|
|
|
+ return '分钟'
|
|
|
+ } else if (type == 6) {
|
|
|
+ return '周'
|
|
|
+ } else if (type == 7) {
|
|
|
+ return '季'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ hireDurationUnitsFn(time,type) {
|
|
|
+
|
|
|
+ if (type == 1) {
|
|
|
+ return Math.ceil(time / 60 / 60 / 24) + '天'
|
|
|
+ } else if (type == 2) {
|
|
|
+ return Math.ceil(time / 60 / 60 / 24 / 30) + '月'
|
|
|
+ } else if (type == 3) {
|
|
|
+ return Math.ceil(time / 60 / 60 / 24 / 30 / 365) + '年'
|
|
|
+ } else if (type == 4) {
|
|
|
+ return Math.ceil(time / 60 / 60) + '小时'
|
|
|
+ } else if (type == 5) {
|
|
|
+ return Math.ceil(time / 60) + '分钟'
|
|
|
+ } else if (type == 6) {
|
|
|
+ return Math.ceil(time / 60 / 60 / 24 / 7) + '周'
|
|
|
+ } else if (type == 7) {
|
|
|
+ return Math.ceil(time / 60 / 60 / 24 / 30 / 3) + '季'
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- let distance = common.getFlatternDistance(res[1].longitude, res[1].latitude, me
|
|
|
- .orderInfo.longitude, me.orderInfo.latitude)
|
|
|
- resp.data.data.order_info.distance = distance
|
|
|
- // 取还时间展示
|
|
|
- me.orderInfo.hire_return_time = common.getTimeToDay(Math.ceil(me.orderInfo
|
|
|
- .hire_end_time - me.orderInfo.hire_begin_time) / 60)
|
|
|
- // 剩余租期判断
|
|
|
- if ((me.orderInfo.hire_type == 2 && me.orderInfo.order_status == 2) || me
|
|
|
- .orderInfo.order_status == 3) {
|
|
|
- me.orderInfo.hire_duration_time = common.getTimeToDay(Math.ceil(me
|
|
|
- .orderInfo.hire_end_time - (Math.floor(new Date()) / 1000)) /
|
|
|
- 60)
|
|
|
- } else {
|
|
|
- if (me.orderInfo.order_status == 4) {
|
|
|
- me.orderInfo.hire_duration_time = common.getTimeToDay(Math.ceil(Math
|
|
|
- .floor(new Date()) / 1000 - me.orderInfo.hire_end_time) /
|
|
|
- 60)
|
|
|
- } else {
|
|
|
- me.orderInfo.hire_duration_time = me.orderInfo.hire_return_time
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 默认返回上一个页面再提示报错
|
|
|
- uni.navigateBack({
|
|
|
- delta: 1
|
|
|
- })
|
|
|
- common.simpleToast(resp.data.msg)
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- navStoreBtn() {
|
|
|
- const {
|
|
|
- latitude,
|
|
|
- longitude,
|
|
|
- address,
|
|
|
- shop_name
|
|
|
- } = this.orderInfo
|
|
|
- uni.openLocation({
|
|
|
- latitude: latitude - 0,
|
|
|
- longitude: longitude - 0,
|
|
|
- scale: 15,
|
|
|
- name: shop_name,
|
|
|
- address: address,
|
|
|
- success: function(res) {}
|
|
|
- });
|
|
|
- },
|
|
|
- tapReturnCar() {
|
|
|
- this.setData({
|
|
|
- isShowReturnCar: true
|
|
|
- })
|
|
|
- },
|
|
|
- immediatelyReturnBtn() {
|
|
|
- //到店还车 判断逾期状态 如果逾期要交逾期费用 跳转到上传车辆图片再支付逾期费用还车
|
|
|
- const isOverdue = this.orderInfo.order_status == 4
|
|
|
- const {
|
|
|
- car_sn,
|
|
|
- shop_id,
|
|
|
- overdue_money
|
|
|
- } = this.orderInfo
|
|
|
- const returnCarParams = {
|
|
|
- car_sn,
|
|
|
- shop_id,
|
|
|
- overdue_money,
|
|
|
- isReturnCar: true,
|
|
|
- }
|
|
|
- if (isOverdue) {
|
|
|
- this.setData({
|
|
|
- totalPrice: overdue_money,
|
|
|
- isShowToBuy: true
|
|
|
- })
|
|
|
+ async bindOrderInfo() {
|
|
|
+ let res = await uni.getLocation()
|
|
|
+ const me = this
|
|
|
+ http.postApi(config.API_FLK_ORDER_INFO, {
|
|
|
+ sub_sn: me.sub_sn,
|
|
|
+ latitude: res[1].latitude,
|
|
|
+ longitude: res[1].longitude,
|
|
|
+ }, (resp) => {
|
|
|
+ if (resp.data.code === 200) {
|
|
|
+ me.orderInfo = resp.data.data.order_info
|
|
|
+ //
|
|
|
+ if(resp.data.data.order_info.model_id){
|
|
|
+ me.loadCarInfo(resp.data.data.order_info.model_id)
|
|
|
+ }
|
|
|
+ let distance = common.getFlatternDistance(res[1].longitude, res[1].latitude, me
|
|
|
+ .orderInfo.longitude, me.orderInfo.latitude)
|
|
|
+ resp.data.data.order_info.distance = distance
|
|
|
+ // 取还时间展示
|
|
|
+ // me.orderInfo.hire_return_time = common.getTimeToDay(Math.ceil(me.orderInfo
|
|
|
+ // .hire_end_time - me.orderInfo.hire_begin_time) / 60)
|
|
|
+
|
|
|
+ me.orderInfo.hire_return_time = getRemainingTime(me.orderInfo.hire_begin_time,me.orderInfo.hire_end_time)
|
|
|
+ me.orderInfo.hire_begin_time = dayjs(me.orderInfo.hire_begin_time * 1000).format('YY/MM/DD')
|
|
|
+ me.orderInfo.hire_end_time = dayjs(me.orderInfo.hire_end_time * 1000).format('YY/MM/DD')
|
|
|
+
|
|
|
+ // 剩余租期判断
|
|
|
+ if ((me.orderInfo.hire_type == 2 && me.orderInfo.order_status == 2) || me
|
|
|
+ .orderInfo.order_status == 3) {
|
|
|
+ me.orderInfo.hire_duration_time = common.getTimeToDay(Math.ceil(me
|
|
|
+ .orderInfo.hire_end_time - (Math.floor(new Date()) / 1000)) /
|
|
|
+ 60)
|
|
|
+ } else {
|
|
|
+ if (me.orderInfo.order_status == 4) {
|
|
|
+ me.orderInfo.hire_duration_time = common.getTimeToDay(Math.ceil(Math
|
|
|
+ .floor(new Date()) / 1000 - me.orderInfo.hire_end_time) /
|
|
|
+ 60)
|
|
|
} else {
|
|
|
- //提交还车图片
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/activation/activation?isReturnCar=' + true + '&car_sn=' + car_sn +
|
|
|
- '&shop_id=' + shop_id,
|
|
|
- });
|
|
|
+ me.orderInfo.hire_duration_time = me.orderInfo.hire_return_time
|
|
|
}
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 默认返回上一个页面再提示报错
|
|
|
+ uni.navigateBack({
|
|
|
+ delta: 1
|
|
|
+ })
|
|
|
+ common.simpleToast(resp.data.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ navStoreBtn() {
|
|
|
+ const {
|
|
|
+ latitude,
|
|
|
+ longitude,
|
|
|
+ address,
|
|
|
+ shop_name
|
|
|
+ } = this.orderInfo
|
|
|
+ uni.openLocation({
|
|
|
+ latitude: latitude - 0,
|
|
|
+ longitude: longitude - 0,
|
|
|
+ scale: 15,
|
|
|
+ name: shop_name,
|
|
|
+ address: address,
|
|
|
+ success: function(res) {}
|
|
|
+ });
|
|
|
+ },
|
|
|
+ tapReturnCar() {
|
|
|
+ this.setData({
|
|
|
+ isShowReturnCar: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ immediatelyReturnBtn() {
|
|
|
+ //到店还车 判断逾期状态 如果逾期要交逾期费用 跳转到上传车辆图片再支付逾期费用还车
|
|
|
+ const isOverdue = this.orderInfo.order_status == 4
|
|
|
+ const {
|
|
|
+ car_sn,
|
|
|
+ shop_id,
|
|
|
+ overdue_money
|
|
|
+ } = this.orderInfo
|
|
|
+ const returnCarParams = {
|
|
|
+ car_sn,
|
|
|
+ shop_id,
|
|
|
+ overdue_money,
|
|
|
+ isReturnCar: true,
|
|
|
+ }
|
|
|
+ if (isOverdue) {
|
|
|
+ this.setData({
|
|
|
+ totalPrice: overdue_money,
|
|
|
+ isShowToBuy: true
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ //提交还车图片
|
|
|
+ uni.navigateTo({
|
|
|
+ url:`/pages/activation/activation?isReturnCar=true,model_id=${this.orderInfo.model_id}&sub_sn=${this.sub_sn}&car_sn=${this.orderInfo.car_sn}`
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- },
|
|
|
- callStorePhone() {
|
|
|
- const phone = this.orderInfo.link_phone
|
|
|
- common.callPhone(this, phone)
|
|
|
- },
|
|
|
- clickCancel() {
|
|
|
- const me = this
|
|
|
- uni.showModal({
|
|
|
- title: '取消订单',
|
|
|
- content: '您是否需要取消该订单',
|
|
|
- confirmText: '是',
|
|
|
- confirmColor: '#0074FF',
|
|
|
- cancelText: '否',
|
|
|
- cancelColor: '#191D23',
|
|
|
- success: function(res) {
|
|
|
- if (res.confirm) {
|
|
|
- me.isShowCancel = true
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
+ },
|
|
|
+ callStorePhone() {
|
|
|
+ const phone = this.orderInfo.link_phone
|
|
|
+ common.callPhone(phone)
|
|
|
+ },
|
|
|
+ async clickCancel() {
|
|
|
+ const me = this
|
|
|
+ let res = await uni.showModal({
|
|
|
+ title: '取消订单',
|
|
|
+ content: '您是否需要取消该订单',
|
|
|
+ confirmText: '是',
|
|
|
+ confirmColor: '#0074FF',
|
|
|
+ cancelText: '否',
|
|
|
+ cancelColor: '#191D23',
|
|
|
+ });
|
|
|
+ if (res[1].confirm) {
|
|
|
+ let {data} = await request.postApi(config.API_FLK_ORDER_CANCEL_PAY,{sub_sn:this.sub_sn})
|
|
|
+ if(data.code == 200){
|
|
|
+ common.simpleToast(data.msg)
|
|
|
+ this.bindOrderInfo()
|
|
|
+ }else{
|
|
|
+ common.simpleToast(data.msg)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- bindCancel(e) {
|
|
|
- const me = this
|
|
|
- me.reason = e.currentTarget.dataset.status;
|
|
|
- me.cancel = true
|
|
|
- common.loading()
|
|
|
- setTimeout(function() {
|
|
|
- http.postApi(config.API_DAYHIRE_HIRE_CANCEL_ORDER, {
|
|
|
- order_sn: me.order_sn
|
|
|
- }, (resp) => {
|
|
|
- if (resp.data.code === 200) {
|
|
|
- uni.hideLoading()
|
|
|
- common.simpleToast('取消成功')
|
|
|
- setTimeout(() => {
|
|
|
- me.bindOrderInfo()
|
|
|
- }, 500);
|
|
|
- } else {
|
|
|
- common.simpleToast('订单取消失败')
|
|
|
- }
|
|
|
- me.reason = 0
|
|
|
- me.isShowCancel = false
|
|
|
- })
|
|
|
- }, 600);
|
|
|
- },
|
|
|
+ bindCancel(e) {
|
|
|
+ const me = this
|
|
|
+ me.reason = e.currentTarget.dataset.status;
|
|
|
+ me.cancel = true
|
|
|
+ common.loading()
|
|
|
+ setTimeout(function() {
|
|
|
+ http.postApi(config.API_DAYHIRE_HIRE_CANCEL_ORDER, {
|
|
|
+ order_sn: me.order_sn
|
|
|
+ }, (resp) => {
|
|
|
+ if (resp.data.code === 200) {
|
|
|
+ uni.hideLoading()
|
|
|
+ common.simpleToast('取消成功')
|
|
|
+ setTimeout(() => {
|
|
|
+ me.bindOrderInfo()
|
|
|
+ }, 500);
|
|
|
+ } else {
|
|
|
+ common.simpleToast('订单取消失败')
|
|
|
+ }
|
|
|
+ me.reason = 0
|
|
|
+ me.isShowCancel = false
|
|
|
+ })
|
|
|
+ }, 600);
|
|
|
+ },
|
|
|
|
|
|
- bindToNav() {
|
|
|
- console.log(111);
|
|
|
- const {
|
|
|
- address,
|
|
|
- latitude,
|
|
|
- longitude,
|
|
|
- shop_name
|
|
|
- } = this.shopInfo
|
|
|
- uni.openLocation({
|
|
|
- latitude: latitude - 0,
|
|
|
- longitude: longitude - 0,
|
|
|
- scale: 15,
|
|
|
- name: shop_name,
|
|
|
- address: address,
|
|
|
- success: function(res) {},
|
|
|
- })
|
|
|
- },
|
|
|
+ bindToNav() {
|
|
|
+ console.log(111);
|
|
|
+ const {
|
|
|
+ address,
|
|
|
+ latitude,
|
|
|
+ longitude,
|
|
|
+ shop_name
|
|
|
+ } = this.shopInfo
|
|
|
+ uni.openLocation({
|
|
|
+ latitude: latitude - 0,
|
|
|
+ longitude: longitude - 0,
|
|
|
+ scale: 15,
|
|
|
+ name: shop_name,
|
|
|
+ address: address,
|
|
|
+ success: function(res) {},
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
- bindToHome() {
|
|
|
- uni.reLaunch({
|
|
|
- url: '/pages/index/index',
|
|
|
- success: function(res) {},
|
|
|
- fail: function(res) {},
|
|
|
- complete: function(res) {}
|
|
|
- });
|
|
|
- },
|
|
|
+ bindToHome() {
|
|
|
+ uni.reLaunch({
|
|
|
+ url: '/pages/index/index',
|
|
|
+ success: function(res) {},
|
|
|
+ fail: function(res) {},
|
|
|
+ complete: function(res) {}
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- callPhone() {
|
|
|
- const me = this
|
|
|
- const phone = me.shopInfo.link_phone
|
|
|
- uni.showModal({
|
|
|
- content: `您是否要拨打电话${phone}?`,
|
|
|
- confirmText: '确定',
|
|
|
- success: (res) => {
|
|
|
- if (res.confirm) {
|
|
|
- uni.makePhoneCall({
|
|
|
- phoneNumber: phone,
|
|
|
- success() {},
|
|
|
- fail() {}
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- fail: (res) => {}
|
|
|
+ callPhone() {
|
|
|
+ const me = this
|
|
|
+ const phone = me.shopInfo.link_phone
|
|
|
+ uni.showModal({
|
|
|
+ content: `您是否要拨打电话${phone}?`,
|
|
|
+ confirmText: '确定',
|
|
|
+ success: (res) => {
|
|
|
+ if (res.confirm) {
|
|
|
+ uni.makePhoneCall({
|
|
|
+ phoneNumber: phone,
|
|
|
+ success() {},
|
|
|
+ fail() {}
|
|
|
})
|
|
|
- },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: (res) => {}
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
- bindRenew() {
|
|
|
- this.isReturnHome = false
|
|
|
- let isRenew = true
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/carIntroduce/carIntroduce?plate_number=' + this.orderInfo
|
|
|
- .license_plate_number +
|
|
|
- '&isRenew=' + isRenew +
|
|
|
- '&order_sn=' + this.order_sn,
|
|
|
- success: function(res) {},
|
|
|
- fail: function(res) {},
|
|
|
- complete: function(res) {}
|
|
|
- });
|
|
|
- },
|
|
|
+ bindRenew() {
|
|
|
+ this.showCarPlan = true
|
|
|
+ // this.isReturnHome = false
|
|
|
+ // let isRenew = true
|
|
|
+ // uni.navigateTo({
|
|
|
+ // url: '/pages/carIntroduce/carIntroduce?plate_number=' + this.orderInfo
|
|
|
+ // .license_plate_number +
|
|
|
+ // '&isRenew=' + isRenew +
|
|
|
+ // '&order_sn=' + this.order_sn,
|
|
|
+ // success: function(res) {},
|
|
|
+ // fail: function(res) {},
|
|
|
+ // complete: function(res) {}
|
|
|
+ // });
|
|
|
+ },
|
|
|
|
|
|
- bindBattery() {
|
|
|
- this.isReturnHome = false
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/battery/battery?plate_number=' + this.orderInfo.license_plate_number,
|
|
|
- success: function(res) {},
|
|
|
- fail: function(res) {},
|
|
|
- complete: function(res) {}
|
|
|
- });
|
|
|
- },
|
|
|
+ bindBattery() {
|
|
|
+ this.isReturnHome = false
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/battery/battery?plate_number=' + this.orderInfo.license_plate_number,
|
|
|
+ success: function(res) {},
|
|
|
+ fail: function(res) {},
|
|
|
+ complete: function(res) {}
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ bindExpanded() {
|
|
|
+ this.isExpanded = !this.isExpanded
|
|
|
+ },
|
|
|
|
|
|
- bindExpanded() {
|
|
|
- this.isExpanded = !this.isExpanded
|
|
|
- },
|
|
|
+ navToInput() {
|
|
|
+ this.isReturnHome = false
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/inputLicensePlate/inputLicensePlate?order_sn=' + this.orderInfo
|
|
|
+ .order_sn,
|
|
|
+ success: function(res) {},
|
|
|
+ fail: function(res) {},
|
|
|
+ complete: function(res) {}
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- navToInput() {
|
|
|
- this.isReturnHome = false
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/inputLicensePlate/inputLicensePlate?order_sn=' + this.orderInfo
|
|
|
- .order_sn,
|
|
|
- success: function(res) {},
|
|
|
- fail: function(res) {},
|
|
|
- complete: function(res) {}
|
|
|
- });
|
|
|
- },
|
|
|
+ // 激活车辆
|
|
|
+ navToActive() {
|
|
|
+ this.isReturnHome = false
|
|
|
+ const me = this
|
|
|
+ if (this.orderInfo.hire_type == 1) { // 预约
|
|
|
+ if (me.isScanCondeRentalCar) {
|
|
|
+ uni.scanCode({
|
|
|
+ onlyFromCamera: true,
|
|
|
+ success: function(res) {
|
|
|
+ me.loadScanCode(res.result)
|
|
|
+ },
|
|
|
+ fail: function(res) {},
|
|
|
+ complete: function(res) {},
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/inputLicensePlate/inputLicensePlate?order_sn=' + this
|
|
|
+ .order_sn + '&order_model_id=' + this.orderInfo.model_id,
|
|
|
+ success: function(res) {},
|
|
|
+ fail: function(res) {},
|
|
|
+ complete: function(res) {}
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else { // 非预约
|
|
|
+ const isJumpReturn = false
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/activation/activation?order_sn=' + this.order_sn +
|
|
|
+ '&plate_number=' + this
|
|
|
+ .orderInfo.license_plate_number + '&isJumpReturn=' + isJumpReturn,
|
|
|
+ success: function(res) {},
|
|
|
+ fail: function(res) {},
|
|
|
+ complete: function(res) {}
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- // 激活车辆
|
|
|
- navToActive() {
|
|
|
- this.isReturnHome = false
|
|
|
- const me = this
|
|
|
- if (this.orderInfo.hire_type == 1) { // 预约
|
|
|
- if (me.isScanCondeRentalCar) {
|
|
|
- uni.scanCode({
|
|
|
- onlyFromCamera: true,
|
|
|
+ loadScanCode(battery_sn) {
|
|
|
+ const pData = {
|
|
|
+ longitude: this.longitude,
|
|
|
+ latitude: this.latitude,
|
|
|
+ battery_sn: battery_sn
|
|
|
+ }
|
|
|
+ const me = this
|
|
|
+ http.postApi(config.API_DAYHIRE_CAR_CAR_INFO, pData, (resp) => {
|
|
|
+ uni.hideLoading()
|
|
|
+ if (resp.data.code === 200) {
|
|
|
+ const timestamp = Date.now(); // 获取当前时间戳(毫秒)
|
|
|
+ const isOffline = (Math.floor(timestamp / 1000) - resp.data.data
|
|
|
+ .last_comm_time) > 1800
|
|
|
+ me.plate_number = resp.data.data.license_plate_number
|
|
|
+ if (resp.data.data.last_comm_time === 0 || isOffline) {
|
|
|
+ common.simpleToast('此车辆已离线,请选择其他车辆')
|
|
|
+ } else {
|
|
|
+ let carInfo = JSON.stringify(resp.data.data)
|
|
|
+ const car_model = resp.data.data.model_info.car_model
|
|
|
+ const model_images = resp.data.data.model_info.model_images.split(',')
|
|
|
+ const return_imgs = resp.data.data.return_imgs
|
|
|
+ var model_id = resp.data.data.model_info.model_id
|
|
|
+ if (resp.data.data.has_owner) { //车辆正在被使用
|
|
|
+ if (resp.data.data.is_mine) { //是本人在使用
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '已有正在使用的车辆,是否跳转至车辆详情页?',
|
|
|
+ cancelText: '取消',
|
|
|
+ confirmText: '确定',
|
|
|
success: function(res) {
|
|
|
- me.loadScanCode(res.result)
|
|
|
+ this.isReturnHome = false
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/battery/battery?plate_number=' +
|
|
|
+ this.plate_number
|
|
|
+ });
|
|
|
},
|
|
|
fail: function(res) {},
|
|
|
complete: function(res) {},
|
|
|
})
|
|
|
} else {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/inputLicensePlate/inputLicensePlate?order_sn=' + this
|
|
|
- .order_sn + '&order_model_id=' + this.orderInfo.model_id,
|
|
|
- success: function(res) {},
|
|
|
- fail: function(res) {},
|
|
|
- complete: function(res) {}
|
|
|
- });
|
|
|
+ common.simpleToast('此车辆正在被使用')
|
|
|
}
|
|
|
- } else { // 非预约
|
|
|
- const isJumpReturn = false
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/activation/activation?order_sn=' + this.order_sn +
|
|
|
- '&plate_number=' + this
|
|
|
- .orderInfo.license_plate_number + '&isJumpReturn=' + isJumpReturn,
|
|
|
- success: function(res) {},
|
|
|
- fail: function(res) {},
|
|
|
- complete: function(res) {}
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- loadScanCode(battery_sn) {
|
|
|
- const pData = {
|
|
|
- longitude: this.longitude,
|
|
|
- latitude: this.latitude,
|
|
|
- battery_sn: battery_sn
|
|
|
- }
|
|
|
- const me = this
|
|
|
- http.postApi(config.API_DAYHIRE_CAR_CAR_INFO, pData, (resp) => {
|
|
|
- uni.hideLoading()
|
|
|
- if (resp.data.code === 200) {
|
|
|
- const timestamp = Date.now(); // 获取当前时间戳(毫秒)
|
|
|
- const isOffline = (Math.floor(timestamp / 1000) - resp.data.data
|
|
|
- .last_comm_time) > 1800
|
|
|
- me.plate_number = resp.data.data.license_plate_number
|
|
|
- if (resp.data.data.last_comm_time === 0 || isOffline) {
|
|
|
- common.simpleToast('此车辆已离线,请选择其他车辆')
|
|
|
+ } else {
|
|
|
+ if (me.order_sn && me.order_sn != '') {
|
|
|
+ if (this.orderInfo.model_id != model_id) { // 预租车型与之前预约车型不一致
|
|
|
+ common.simpleToast('与预约车型不符')
|
|
|
} else {
|
|
|
- let carInfo = JSON.stringify(resp.data.data)
|
|
|
- const car_model = resp.data.data.model_info.car_model
|
|
|
- const model_images = resp.data.data.model_info.model_images.split(',')
|
|
|
- const return_imgs = resp.data.data.return_imgs
|
|
|
- var model_id = resp.data.data.model_info.model_id
|
|
|
- if (resp.data.data.has_owner) { //车辆正在被使用
|
|
|
- if (resp.data.data.is_mine) { //是本人在使用
|
|
|
- wx.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '已有正在使用的车辆,是否跳转至车辆详情页?',
|
|
|
- cancelText: '取消',
|
|
|
- confirmText: '确定',
|
|
|
- success: function(res) {
|
|
|
- this.isReturnHome = false
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/battery/battery?plate_number=' +
|
|
|
- this.plate_number
|
|
|
- });
|
|
|
- },
|
|
|
- fail: function(res) {},
|
|
|
- complete: function(res) {},
|
|
|
- })
|
|
|
- } else {
|
|
|
- common.simpleToast('此车辆正在被使用')
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (me.order_sn && me.order_sn != '') {
|
|
|
- if (this.orderInfo.model_id != model_id) { // 预租车型与之前预约车型不一致
|
|
|
- common.simpleToast('与预约车型不符')
|
|
|
- } else {
|
|
|
- this.isReturnHome = false
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/activation/activation?plate_number=' +
|
|
|
- this.plate_number + '&order_sn=' + this
|
|
|
- .order_sn +
|
|
|
- '&car_model=' + car_model + '&model_image=' +
|
|
|
- model_images[0] + '&return_imgs=' + JSON
|
|
|
- .stringify(
|
|
|
- return_imgs),
|
|
|
- fail() {}
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
- this.isReturnHome = false
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/carIntroduce/carIntroduce?carInfo=' +
|
|
|
- encodeURIComponent(carInfo) + '&plate_number=' +
|
|
|
- this.plate_number,
|
|
|
- fail() {}
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
+ this.isReturnHome = false
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/activation/activation?plate_number=' +
|
|
|
+ this.plate_number + '&order_sn=' + this
|
|
|
+ .order_sn +
|
|
|
+ '&car_model=' + car_model + '&model_image=' +
|
|
|
+ model_images[0] + '&return_imgs=' + JSON
|
|
|
+ .stringify(
|
|
|
+ return_imgs),
|
|
|
+ fail() {}
|
|
|
+ })
|
|
|
}
|
|
|
- } else {
|
|
|
- common.simpleToast(resp.data.msg)
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
|
|
|
- bindToPay() {
|
|
|
- const me = this
|
|
|
- //#ifdef MP-ALIPAY
|
|
|
- const _from = 'ali'
|
|
|
- const _pay_type = 2
|
|
|
- //#endif
|
|
|
- //#ifdef MP-WEIXIN
|
|
|
- const _from = 'wx'
|
|
|
- const _pay_type = 0
|
|
|
- //#endif
|
|
|
- http.postApi(config.API_DAYHIRE_HIRE_CONTINUE_PAY, {
|
|
|
- order_sn: me.order_sn,
|
|
|
- from: _from,
|
|
|
- pay_type: _pay_type
|
|
|
- }, (resp) => {
|
|
|
- common.loading()
|
|
|
- if (resp.data.code === 200) {
|
|
|
- uni.hideLoading()
|
|
|
- //#ifdef MP-ALIPAY
|
|
|
- my.tradePay({
|
|
|
- tradeNO: resp.data.data.trade_no,
|
|
|
- success: function(res) {
|
|
|
- if (res.resultCode == 9000) {
|
|
|
- common.simpleToast('支付成功');
|
|
|
- }
|
|
|
- setTimeout(function() {
|
|
|
- me.bindOrderInfo()
|
|
|
- }, 1000)
|
|
|
- },
|
|
|
- fail: function(res) {
|
|
|
- common.simpleToast('支付失败,请重试')
|
|
|
- },
|
|
|
- })
|
|
|
- //#endif
|
|
|
- //#ifdef MP-WEIXIN
|
|
|
- var payParams = JSON.parse(resp.data.data.payParams);
|
|
|
- user.wxPay(me.order_sn, payParams, function(isSuccess) {
|
|
|
- if (isSuccess) {
|
|
|
- common.simpleToast('支付成功')
|
|
|
- setTimeout(function() {
|
|
|
- me.bindOrderInfo()
|
|
|
- }, 1000)
|
|
|
- } else {
|
|
|
- common.simpleToast('支付失败,请重试')
|
|
|
- }
|
|
|
- });
|
|
|
- //#endif
|
|
|
} else {
|
|
|
- uni.hideLoading()
|
|
|
- common.simpleToast(resp.data.msg)
|
|
|
+ this.isReturnHome = false
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/carIntroduce/carIntroduce?carInfo=' +
|
|
|
+ encodeURIComponent(carInfo) + '&plate_number=' +
|
|
|
+ this.plate_number,
|
|
|
+ fail() {}
|
|
|
+ })
|
|
|
}
|
|
|
- })
|
|
|
- },
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ common.simpleToast(resp.data.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
- // 计算拖车说明收费价格
|
|
|
- calculateFare(distance, charge_list) {
|
|
|
- let fare = 0
|
|
|
- if (distance <= charge_list.start_mil) {
|
|
|
- fare = charge_list.start_price / 100
|
|
|
+ bindToPay() {
|
|
|
+ const me = this
|
|
|
+ //#ifdef MP-ALIPAY
|
|
|
+ const _from = 'ali'
|
|
|
+ const _pay_type = 2
|
|
|
+ //#endif
|
|
|
+ //#ifdef MP-WEIXIN
|
|
|
+ const _from = 'wx'
|
|
|
+ const _pay_type = 0
|
|
|
+ //#endif
|
|
|
+ http.postApi(config.API_DAYHIRE_HIRE_CONTINUE_PAY, {
|
|
|
+ order_sn: me.order_sn,
|
|
|
+ from: _from,
|
|
|
+ pay_type: _pay_type
|
|
|
+ }, (resp) => {
|
|
|
+ common.loading()
|
|
|
+ if (resp.data.code === 200) {
|
|
|
+ uni.hideLoading()
|
|
|
+ //#ifdef MP-ALIPAY
|
|
|
+ my.tradePay({
|
|
|
+ tradeNO: resp.data.data.trade_no,
|
|
|
+ success: function(res) {
|
|
|
+ if (res.resultCode == 9000) {
|
|
|
+ common.simpleToast('支付成功');
|
|
|
+ }
|
|
|
+ setTimeout(function() {
|
|
|
+ me.bindOrderInfo()
|
|
|
+ }, 1000)
|
|
|
+ },
|
|
|
+ fail: function(res) {
|
|
|
+ common.simpleToast('支付失败,请重试')
|
|
|
+ },
|
|
|
+ })
|
|
|
+ //#endif
|
|
|
+ //#ifdef MP-WEIXIN
|
|
|
+ var payParams = JSON.parse(resp.data.data.payParams);
|
|
|
+ user.wxPay(me.order_sn, payParams, function(isSuccess) {
|
|
|
+ if (isSuccess) {
|
|
|
+ common.simpleToast('支付成功')
|
|
|
+ setTimeout(function() {
|
|
|
+ me.bindOrderInfo()
|
|
|
+ }, 1000)
|
|
|
} else {
|
|
|
- // actual_start_mil:实际距离单位米
|
|
|
- // over_start_price:向上取整的公里数*超出首公里的费用
|
|
|
- var actual_start_mil = distance - charge_list.start_mil
|
|
|
- var over_start_price = (Math.ceil(actual_start_mil / charge_list.step_mil)) * charge_list
|
|
|
- .step_price
|
|
|
- fare = (charge_list.start_price + over_start_price) / 100
|
|
|
- }
|
|
|
- const fareArray = fare.toFixed(2).split('.'); //将价格拆分为整数部分和小数部分
|
|
|
- const price_list = {
|
|
|
- start_mil: (charge_list.start_mil / 1000).toFixed(2),
|
|
|
- start_price: (charge_list.start_price / 100).toFixed(2),
|
|
|
- step_mil: (charge_list.step_mil / 1000).toFixed(2),
|
|
|
- step_price: (charge_list.step_price / 100).toFixed(2),
|
|
|
- actual_start_mil: actual_start_mil ? (actual_start_mil / 1000).toFixed(2) : 0,
|
|
|
- over_start_price: over_start_price ? (over_start_price / 100).toFixed(2) : 0,
|
|
|
- fare: fare.toFixed(2), // 保留两位小数
|
|
|
- fareArray: fareArray //将价格拆分为整数部分和小数部分
|
|
|
+ common.simpleToast('支付失败,请重试')
|
|
|
}
|
|
|
- return price_list
|
|
|
- },
|
|
|
+ });
|
|
|
+ //#endif
|
|
|
+ } else {
|
|
|
+ uni.hideLoading()
|
|
|
+ common.simpleToast(resp.data.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
- bindChangeStatus(e) {
|
|
|
- const {
|
|
|
- status,
|
|
|
- unit
|
|
|
- } = e.currentTarget.dataset
|
|
|
- this.setData({
|
|
|
- isSelectStatus: unit,
|
|
|
- selectIndex: status
|
|
|
- })
|
|
|
- // this.bindDuration()
|
|
|
- },
|
|
|
+ // 计算拖车说明收费价格
|
|
|
+ calculateFare(distance, charge_list) {
|
|
|
+ let fare = 0
|
|
|
+ if (distance <= charge_list.start_mil) {
|
|
|
+ fare = charge_list.start_price / 100
|
|
|
+ } else {
|
|
|
+ // actual_start_mil:实际距离单位米
|
|
|
+ // over_start_price:向上取整的公里数*超出首公里的费用
|
|
|
+ var actual_start_mil = distance - charge_list.start_mil
|
|
|
+ var over_start_price = (Math.ceil(actual_start_mil / charge_list.step_mil)) * charge_list
|
|
|
+ .step_price
|
|
|
+ fare = (charge_list.start_price + over_start_price) / 100
|
|
|
+ }
|
|
|
+ const fareArray = fare.toFixed(2).split('.'); //将价格拆分为整数部分和小数部分
|
|
|
+ const price_list = {
|
|
|
+ start_mil: (charge_list.start_mil / 1000).toFixed(2),
|
|
|
+ start_price: (charge_list.start_price / 100).toFixed(2),
|
|
|
+ step_mil: (charge_list.step_mil / 1000).toFixed(2),
|
|
|
+ step_price: (charge_list.step_price / 100).toFixed(2),
|
|
|
+ actual_start_mil: actual_start_mil ? (actual_start_mil / 1000).toFixed(2) : 0,
|
|
|
+ over_start_price: over_start_price ? (over_start_price / 100).toFixed(2) : 0,
|
|
|
+ fare: fare.toFixed(2), // 保留两位小数
|
|
|
+ fareArray: fareArray //将价格拆分为整数部分和小数部分
|
|
|
+ }
|
|
|
+ return price_list
|
|
|
+ },
|
|
|
|
|
|
- //计算价格
|
|
|
- // bindDuration(){
|
|
|
- // const me = this
|
|
|
- // var _insurance_price //保险金
|
|
|
- // const unit_price=(me.price_list[0].hire_price/100) * me.leaseTime //租金
|
|
|
- // // insurance_setting 保险
|
|
|
- // if (me.insurance_setting!=null) { // 有保险的时候
|
|
|
- // // isSelectDeposit==0为免押 isOpenNoDeposit为是否成功开通免押 total_money为总金额
|
|
|
- // // unit_price 租金 insurance_setting.price 保险金 deposit 押金
|
|
|
- // if (me.duration_unit == 4) { // 时
|
|
|
- // _insurance_price = (me.insurance_setting.price - 0) * 1
|
|
|
- // } else if(me.duration_unit == 6) { // 周
|
|
|
- // _insurance_price = (me.insurance_setting.price - 0) * 7 * me.leaseTime
|
|
|
- // } else { //天
|
|
|
- // _insurance_price = (me.insurance_setting.price - 0) * me.leaseTime
|
|
|
- // }
|
|
|
- // } else { // 无保险
|
|
|
- // _insurance_price = 0
|
|
|
- // }
|
|
|
+ bindChangeStatus(e) {
|
|
|
+ const {
|
|
|
+ status,
|
|
|
+ unit
|
|
|
+ } = e.currentTarget.dataset
|
|
|
+ this.setData({
|
|
|
+ isSelectStatus: unit,
|
|
|
+ selectIndex: status
|
|
|
+ })
|
|
|
+ // this.bindDuration()
|
|
|
+ },
|
|
|
|
|
|
- // if (me.isOpenNoDeposit) {
|
|
|
- // // 金额=(周期数*周期价格)+保险金
|
|
|
- // me.amount = ((me.leaseTime * me.price_list[0].hire_price -0) + (_insurance_price - 0)) / 100
|
|
|
- // } else {
|
|
|
- // // 金额=(周期数*周期价格)+押金+保险金
|
|
|
- // me.amount = ((me.leaseTime * me.price_list[0].hire_price -0) + (me.modelInfo.deposit -0) + (_insurance_price - 0)) / 100
|
|
|
- // }
|
|
|
- // },
|
|
|
+ //计算价格
|
|
|
+ // bindDuration(){
|
|
|
+ // const me = this
|
|
|
+ // var _insurance_price //保险金
|
|
|
+ // const unit_price=(me.price_list[0].hire_price/100) * me.leaseTime //租金
|
|
|
+ // // insurance_setting 保险
|
|
|
+ // if (me.insurance_setting!=null) { // 有保险的时候
|
|
|
+ // // isSelectDeposit==0为免押 isOpenNoDeposit为是否成功开通免押 total_money为总金额
|
|
|
+ // // unit_price 租金 insurance_setting.price 保险金 deposit 押金
|
|
|
+ // if (me.duration_unit == 4) { // 时
|
|
|
+ // _insurance_price = (me.insurance_setting.price - 0) * 1
|
|
|
+ // } else if(me.duration_unit == 6) { // 周
|
|
|
+ // _insurance_price = (me.insurance_setting.price - 0) * 7 * me.leaseTime
|
|
|
+ // } else { //天
|
|
|
+ // _insurance_price = (me.insurance_setting.price - 0) * me.leaseTime
|
|
|
+ // }
|
|
|
+ // } else { // 无保险
|
|
|
+ // _insurance_price = 0
|
|
|
+ // }
|
|
|
|
|
|
- loadEnd() {
|
|
|
- this.bindOrderInfo()
|
|
|
- },
|
|
|
- navToExchange() {
|
|
|
- console.log('跳转换电记录');
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/exchangeRecord/exchangeRecord' +
|
|
|
- '?order_sn=' + this.orderInfo.order_sn
|
|
|
- })
|
|
|
- }
|
|
|
+ // if (me.isOpenNoDeposit) {
|
|
|
+ // // 金额=(周期数*周期价格)+保险金
|
|
|
+ // me.amount = ((me.leaseTime * me.price_list[0].hire_price -0) + (_insurance_price - 0)) / 100
|
|
|
+ // } else {
|
|
|
+ // // 金额=(周期数*周期价格)+押金+保险金
|
|
|
+ // me.amount = ((me.leaseTime * me.price_list[0].hire_price -0) + (me.modelInfo.deposit -0) + (_insurance_price - 0)) / 100
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+
|
|
|
+ loadEnd() {
|
|
|
+ this.bindOrderInfo()
|
|
|
+ },
|
|
|
+ navToExchange() {
|
|
|
+ console.log('跳转换电记录');
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/exchangeRecord/exchangeRecord' +
|
|
|
+ '?order_sn=' + this.orderInfo.order_sn
|
|
|
+ })
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
<style>
|