1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093 |
- <template>
- <view class="container-view">
- <view class="car-info">
- <view class="car-top flex-row flex-between">
- <view class="top-flex">
- <view>{{modelInfo.car_model}}</view>
- <view>续航{{modelInfo.endurance}}|重量{{modelInfo.weight}}</view>
- <view class="config-list-view">
- <view :class="service_list.length>4?'config-list-view-1 flex-row':'flex-row'">
- <view class="service_name-tab" v-for=" (item,indexs) in service_list" :key="indexs">
- {{item.service_name}}
- </view>
- </view>
- </view>
- </view>
- <img style="width: 160rpx;height: 160rpx;" :src="modelInfo.model_images[0]" />
- </view>
- <view class="take-car-time flex-row flex-between">
- <view class="flex-row">
- <img style="width: 40rpx;height: 40rpx;" src="https://qiniu.bms16.com/FrUjLnCOIJiIRQvYgAsgPnlD0bvG"
- alt="">
- <view style="margin-left: 16rpx;">取车时间</view>
- </view>
- <view @tap="tapSelectTime" class="flex-row">
- <view style="color: #0074FF;margin-right: 4rpx;" class="">{{takeCar}}</view>
- <img style="width: 28rpx;height: 28rpx;" src="https://qiniu.bms16.com/FpbKGisSPfL9r8a7QkZCYXolhu1Y"
- alt="">
- </view>
- </view>
- <!-- <view class="car-bottom flex-row flex-between">
- <view class="flex-row">
- <view>{{takeCar}}</view>
- <img src="https://qiniu.bms16.com/FoXmBbj7YGWmjyeuVEY35nzieqnx" />
- <view>{{returnCar}}</view>
- </view>
- <view>共{{leaseTime+rentalUnit}}</view>
- </view> -->
- </view>
- <view class="plan-info">
- <view>选择租车方案</view>
- <view class="plan-type">
- <view :class="price_list.length>3 ? 'plan-type-1 flex-row' :'flex-row' ">
- <view @tap="bindChangeStatus" :data-status="indexs" :data-unit="items.hire_duration_unit"
- :data-price="items.hire_price"
- :class="isSelectStatus == items.hire_duration_unit?'selectedPtype':'selectptype'"
- :style="{ 'min-width': (tools.toFixLength(items.hire_price/100) <=3 ? '176rpx' : ((tools.toFixLength(items.hire_price/100)*25.8+130))) + 'rpx' }"
- v-for=" (items,indexs) in price_list" :key="indexs">
- <view class="ptype-title" v-if="items.hire_duration_unit==1">日租</view>
- <view class="ptype-title" v-if="items.hire_duration_unit==4">时租</view>
- <view class="ptype-title" v-if="items.hire_duration_unit==6">周租</view>
- <view class="ptype-title" v-if="items.hire_duration_unit==2">月租</view>
- <view class="ptype-title" v-if="items.hire_duration_unit==7">季租</view>
- <view
- :class="isSelectStatus == items.hire_duration_unit?'ptyped-text flex-row':'ptype-text flex-row'">
- <text style="font-size: 40rpx;">¥</text>
- <text> {{tools.toFix(items.hire_price/100)}}</text>
- </view>
- </view>
- </view>
- </view>
- <view class="plan-time flex-row flex-between">
- <view>租车时长</view>
- <view class="quantity-count flex-row">
- <view class="total-time flex-row">
- 共
- <view style="font-weight: 600;margin: 0 10rpx;">{{tools.countToDay(count,isSelectStatus)}}
- </view>
- <text v-if="isSelectStatus==4">小时</text>
- <text v-else>天</text>
- </view>
- <view @tap.stop.prevent="bindMinus"><img class="count-btn fbtn"
- src="https://qiniu.bms16.com/Fm-SCbzVeVHgQK920bmWNvnJnL32" /></view>
- <input @input="bindInput" v-if="showInput" @blur="bindBlur" type="number" :value="count" />
- <view @tap.stop.prevent="bindAdd"><img class="count-btn sbtn"
- src="https://qiniu.bms16.com/FsO-2adBjkUkmk4ENuQco-aK7IyY" /></view>
- </view>
- </view>
- </view>
- <view class="method-info">
- <view class="flex-row flex-between">
- <view style="font_40">取还方式</view>
- <!-- <view style="background: #EEF6FF;border-radius: 26rpx;" class="flex-row">
- <view @tap="clickSelectMethod" data-status="1" :class="return_type == 1?'to-store selected-tab':'to-store'">自行到店</view>
- <view @tap="clickSelectMethod" data-status="2" :class="return_type == 2?'to-door selected-tab':'to-door'">送车上门</view>
- </view> 注释原因:送车上门费用未开发-->
- </view>
- <view class="flex-row shop-view">
- <view style="width: 100%;margin-bottom: 24rpx;" class="flex-row flex-between">
- <view class="flex-row">
- <img style="width: 40rpx;height: 40rpx;"
- :src="return_type == 1?'https://qiniu.bms16.com/FpuR_O5a3b-z_X-HXlybF0oUzcZ4':'https://qiniu.bms16.com/Fol9Qf61SZjBupc7wp6rGGf02xl3'"
- alt="">
- <view v-if="return_type == 1" style="margin-left: 16rpx;">自行去门店取还</view>
- <view v-if="return_type == 2" style="margin-left: 16rpx;">商家送车上门</view>
- </view>
- <view v-if="return_type == 1">门店距离您 <text style="color: #0074FF;">{{distance}}</text> </view>
- <view v-if="return_type == 2">取车点距离您 <text style="color: #0074FF;">{{distance}}</text> </view>
- </view>
- <view @tap="bindToNav" class="shop-bg flex-row flex-between">
- <view class="shop-name-view">
- <view class="shop-name">{{shopInfo.shop_name}}</view>
- <view class="shop-address">{{shopInfo.address}}</view>
- </view>
- <view class="nav-btn flex-row">
- <img style="width: 48rpx;height: 48rpx;" src="https://zxappfile.bms16.com/zx_admin/cab_nav.png"
- alt="">
- <view style="margin-top: 12rpx;font-size: 24rpx;">导航</view>
- </view>
- </view>
- <!-- <view class="home-second flex-row flex-between">
- <view>送车距离:</view>
- <view>{{distance}}</view>
- </view> -->
- </view>
- <!-- <view v-if="returnType.length == 2" class="flex-row flex-around">
- <view @tap="clickSelectMethod" data-status="1" :class="return_type == 1?'selected-item':'select-item'">
- 自行取还
- <view :class="return_type == 1?'selected-border':'select-border'"></view>
- </view>
- <view @tap="clickSelectMethod" data-status="2" :class="return_type == 2?'selected-item':'select-item'">
- 送车上门
- <view :class="return_type == 2?'selected-border':'select-border'"></view>
- </view>
- </view>
- <view v-else class="flex-row flex-around">
- <view @tap="clickNotShow" data-status="1" :class="return_type == 1?'selected-item':'select-item'">
- 自行取还
- <view :class="return_type == 1?'selected-border':'select-border'"></view>
- </view>
- <view @tap="clickNotShow" data-status="2" :class="return_type == 2?'selected-item':'select-item'">
- 送车上门
- <view :class="return_type == 2?'selected-border':'select-border'"></view>
- </view>
- </view>
- <view v-if="return_type == 1" class="method-bottom flex-row">
- <img src="https://qiniu.bms16.com/FicUzQgPOVgDC9Mu4QCAA2c-VGBb" />
- <view style="width: 75%;">
- <view class="bottom-center flex-row flex-between">
- <view class="center-text">
- <view>{{shopInfo.shop_name}}</view>
- <view>{{shopInfo.address}}</view>
- </view>
- <view @tap="bindToNav" class="bottom-bottom flex-row flex-column" style="align-items: center;">
- <img src="https://qiniu.bms16.com/FqCVS_ihJb8IuxeJNGaqC6NKhYMY" />
- <view>{{distance}}</view>
- </view>
- </view>
- <view class="ctime flex-row" style="align-items: center;">
- <img src="https://qiniu.bms16.com/FlGVpR2fdrD1GfeHfDgt-dUMgkOq" />
- {{shopInfo.work_begin_time +'-'+ shopInfo.work_end_time}}
- </view>
- </view>
- </view>
- <view v-if="return_type == 2" class="home-delivery">
- <view class="home-first flex-row flex-between">
- <view class="first-text">
- <view>{{shopInfo.shop_name}}</view>
- <view>{{shopInfo.address}}</view>
- </view>
- <view @tap="bindToNav" class="bottom-bottom flex-row flex-column" style="align-items: center;">
- <img src="https://qiniu.bms16.com/FqCVS_ihJb8IuxeJNGaqC6NKhYMY" />
- <view>{{distance}}</view>
- </view>
- </view>
- <view class="home-second flex-row flex-between">
- <view>送车距离</view>
- <view>{{distance}}</view>
- </view>
- </view>
- -->
- </view>
- <view class="deposit-info">
- <view>车辆押金</view>
- <!-- #ifdef MP-ALIPAY-->
- <view v-if="freeze_is_open==1" @tap="clickSelectDeposit" data-status="1" :class="is_freeze == 1?'selected-deposit':'select-deposit'"
- style="margin-bottom: 24rpx;">
- <view class="deposit-item flex-row" style="align-items: center;">
- <img class="select-img"
- :src="is_freeze==1?'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq':'https://qiniu.bms16.com/FkmDjxBNZhFGFU5inza2usdtDlX8'" />
- <view>支付宝芝麻信用</view>
- </view>
- <view :class="is_freeze == 1?'blue-text':'black-text'" style="font-size: 32rpx;">免押</view>
- </view>
- <!-- #endif -->
- <view @tap="clickSelectDeposit" data-status="0" :class="is_freeze == 0?'selected-deposit':'select-deposit'">
- <view class="deposit-item flex-row">
- <img class="select-img"
- :src="is_freeze==0?'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq':'https://qiniu.bms16.com/FkmDjxBNZhFGFU5inza2usdtDlX8'" />
- <!-- <view>押金租借<text>|还车后退还</text></view> -->
- <view>押金租借</view>
- </view>
- <view :class="is_freeze == 0?'blue-text':'black-text'" style="font-size: 36rpx;">
- ¥{{modelInfo.deposit / 100}}</view>
- </view>
- </view>
- <!-- <view class="change-info">
- <view class="change-title flex-row flex-between">
- <view>关于车辆换电</view>
- </view>
- <view class="change-border">
- <view class="flex-row flex-between" style="margin-bottom: 20rpx;">
- <view class="change-top flex-row ">
- <img src="https://qiniu.bms16.com/FjJ70vT8ydLEGfeABSFYWFe-zosV" />
- <text style="margin-right: 16rpx;">免费换电次数</text><text class="change-num" style="margin: 0 4rpx;">2</text><text class="change-num">次/日</text>
- </view>
- <view class="change-bottom">共<text>4</text>次</view>
- </view>
- <view class="change-dec">本单可享4次免费换电数,超出后需要单独支付换电费用</view>
- </view>
- </view> -->
- <view v-if="insurance_setting != null" class="ride-info">
- <view class="guarantee-title flex-row flex-between">
- <view>骑行保障服务</view>
- <view @tap="clickShowInsuranceDesc">保障须知</view>
- </view>
- <view class="ride-border">
- <view class="ride-top flex-row flex-between">
- <view class="top-left">
- <img src="https://qiniu.bms16.com/FnFvHiZzSKIve3qMEvtTuvtwgRch" />
- <text class="content-top">{{insurance_setting.insurance_name}}</text>
- </view>
- <view class="top-right">¥{{insurance_setting.price / 100}}/天</view>
- </view>
- <view class="dashed-border" style="margin-top: 20rpx;"></view>
- <view v-for="(item,index) in insurance_setting.detail" :key="index">
- <view class="ride-tab">
- <view class="tab-item flex-row flex-between">
- <view class="tab-title">{{item.info}}</view>
- <view class="tab-price">{{item.money / 100}}元</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view v-if="cancel_setting.length != 0" class="remove-info">
- <view>预约取消政策</view>
- <view class="remove-title flex-row">
- <view>预约取消时间</view>
- <view>扣费标准</view>
- </view>
- <view v-for="(item,index) in cancel_setting" :key="index" class="remove-text flex-row">
- <view>支付超过{{item.hour}}小时</view>
- <view v-if="item.percent != 0">扣除{{item.percent}}%租金总金额</view>
- <view v-else>免费取消</view>
- </view>
- </view>
- <!-- <view class="assort-info">
- <view>配套服务</view>
- <view class="assort-box flex-row">
- <view v-for="(item,index) in service_list" :key="item.service_id" class="assort-text"
- :class="{'even-item': index % 2 !== 0, 'odd-item': index % 2 === 0}">
- {{item.service_name}}
- </view>
- </view>
- </view> -->
- <view class="pay-type flex-row flex-between">
- <view class="pay-type-tital">支付方式</view>
- <view v-if="wallet_money >= (amount * 100)" class="pay-type-item">
- <img src="https://qiniu.bms16.com/Fu_XFiEYY1jhmBVtNVF7fVEiqai0" style="width: 40rpx;height: 40rpx;" />
- <view style="padding-left: 10rpx;">钱包支付(¥{{tools.toFix( wallet_money / 100)}})</view>
- </view>
- <view v-else class="pay-type-item">
- <!-- #ifdef MP-WEIXIN -->
- <img src="https://qiniu.bms16.com/FnGjQsTOIaEgJsnxfCA8Z89WZdth" style="width: 40rpx;height: 40rpx;" />
- <view style="padding-left: 10rpx;">微信支付</view>
- <!-- #endif -->
- <!-- #ifdef MP-ALIPAY -->
- <img src="https://qiniu.bms16.com/Fk4YmG_RbdH0LNo1s8qHKDtpCTXl" style="width: 40rpx;height: 40rpx;" />
- <view style="padding-left: 10rpx;">支付宝支付</view>
- <!-- #endif -->
- </view>
- </view>
- <view style="height: 224rpx;"></view>
- <view v-if="!isShowDetail" class="payment-info">
- <!-- <view class="payment-top">
- <img :src="isArgee?'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq':'https://qiniu.bms16.com/FkmDjxBNZhFGFU5inza2usdtDlX8'" />
- 已阅读并同意
- <text>《小众电动车租赁用户协议》</text>
- </view> -->
- <!-- <view class="payment-top" v-for="(item, index) in contractInfo" :key="index">
- <view @tap="bindContractInfo" :data-contractid="item.contract_id" style="display: inline-block">
- <img :src="
- contract_id!=0 && isAgree
- ? 'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq'
- : 'https://qiniu.bms16.com/Fh0JH6_QbiXYmVy7FNYnDkVIGvLC'" />
- </view>
- <view @tap="bindContractInfo" :data-contractid="item.contract_id"
- style="display: inline-block; margin-left: 10rpx">已阅读并同意</view>
- <view @tap="bindContractTo" style="display: inline-block; color: #0074FF"
- :data-contractid="item.contract_id">
- 《{{ item.main_title }}》
- </view>
- </view> -->
- <view class="payment-bottom flex-row flex-between">
- <view class="bottom-left flex-row">
- <allPrice :amount="amount"></allPrice>
- <view @tap="bindDetail" class="all-money">明细<img
- src="https://qiniu.bms16.com/Fvl1d-AWRvwY_ehNrw7bMZOK6LBZ" /></view>
- </view>
- <view @tap="navToPage">{{is_freeze==0?'立即支付':'支付·授权免押'}}</view>
- </view>
- </view>
- <view v-else class="show-detail">
- <view class="detail-info">
- <view class="pay-money">
- <view class="flex-row flex-between" style="margin-bottom: 46rpx;">
- <view>价格明细</view>
- <view>
- <image style="width: 32rpx;height: 32rpx;" @tap="isShowDetail = false"
- src="https://qiniu.bms16.com/FtoTEHOJiUf_gjPCJGGHMsAtHI5M" />
- </view>
- </view>
- <view class="flex-row flex-between" style="margin-bottom: 44rpx;">
- <view>车辆租金</view>
- <view>
- <!-- ¥{{(leaseTime * price_list[0].hire_price) /100}} -->
- ¥{{(price/100)+'x'+count}}
- <text v-if="isSelectStatus==4">时</text>
- <text v-if="isSelectStatus==1">天</text>
- <text v-if="isSelectStatus==6">周</text>
- <text v-if="isSelectStatus==2">月</text>
- <text v-if="isSelectStatus==7">季</text>
- </view>
- </view>
- <view v-if="freeze_is_open==0||(freeze_is_open==1&&is_freeze==0)" class="flex-row flex-between"
- :style="insurance_setting!=null&&insurance_setting.price-0!=0?'margin-bottom: 44rpx;':''">
- <view>车辆押金</view>
- <view>¥{{modelInfo.deposit /100}}</view>
- </view>
- <view v-if="insurance_setting!=null&&insurance_setting.price-0!=0" class="flex-row flex-between"
- style="margin-bottom: 44rpx;">
- <view>骑行保障服务</view>
- <view v-if="isSelectStatus==4">{{'¥'+tools.toFix(insurance_setting.price / 100)+'x1天'}}</view>
- <view v-if="isSelectStatus==1">{{'¥'+tools.toFix(insurance_setting.price / 100)+'x'+count+'天'}}
- </view>
- <view v-if="isSelectStatus==6">
- {{'¥'+tools.toFix(insurance_setting.price / 100)+'x'+count*7+'天'}}
- </view>
- <view v-if="isSelectStatus==2">
- {{'¥'+tools.toFix(insurance_setting.price / 100)+'x'+count*30+'天'}}
- </view>
- <view v-if="isSelectStatus==7">
- {{'¥'+tools.toFix(insurance_setting.price / 100)+'x'+count*90+'天'}}
- </view>
- </view>
- <view class="detail-money flex-row" style="padding-bottom: 44rpx;">
- <view>支付金额</view>
- <allPrice :amount="amount"></allPrice>
- </view>
- </view>
- <view class="second">
- <!-- <view class="payment-top" v-for="(item, index) in contractInfo" :key="index">
- <view @tap="bindContractInfo" :data-contractid="item.contract_id" style="display: inline-block">
- <img :src="
- contract_id!=0 && isAgree
- ? 'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq'
- : 'https://qiniu.bms16.com/Fh0JH6_QbiXYmVy7FNYnDkVIGvLC'" />
- </view>
- <view @tap="bindContractInfo" :data-contractid="item.contract_id"
- style="display: inline-block; margin-left: 10rpx">已阅读并同意</view>
- <view @tap="bindContractTo" style="display: inline-block; color: #0074FF"
- :data-contractid="item.contract_id">
- 《{{ item.main_title }}》
- </view>
- </view> -->
- <view class="payment-bottom flex-row flex-between">
- <view class="bottom-left flex-row">
- <allPrice :amount="amount"></allPrice>
- <view @tap="isShowDetail = false" class="all-money">明细<img
- src="https://qiniu.bms16.com/FkzZI0r5jO-c2JRahNkZW2pHb9dR" /></view>
- </view>
- <view @tap="navToPage">{{is_freeze==0?'立即支付':'支付·授权免押'}}</view>
- </view>
- </view>
- </view>
- </view>
- <calendar ref="calendar" :showPopup.sync="isShowCalendar" @valuesUpdated="handleValuesUpdated"
- @close="() => isShowCalendar = false" />
- </view>
- </template>
- <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 = require('../../common/config.js');
- 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 allPrice from '@/component/allPrice/allPrice';
- import calendar from '@/component/smartCalendar';
- import {
- MAX_LIMITS
- } from '@/common/constant.js';
- export default {
- components: {
- allPrice,
- calendar
- },
- data() {
- return {
- takeCar: '',
- returnCar: '',
- leaseTime: '',
- // rentalUnit: '',
- startDate: '',
- desc_city: '',
- modelId: '',
- modelInfo: {},
- shopInfo: {},
- service_list: [],
- cancel_setting: [],
- return_type: 1,
- is_freeze: 0,//是否选择免押 1是 0否
- freeze_is_open: 0,
- distance: '',
- longitude: '',
- latitude: '',
- isSelectGuarantee: 0,
- isArgee: false,
- from: '',
- duration_unit: '',
- free_order_no: '', // 免押订单号
- contract_id: 0,
- contractInfo: [],
- insurance_setting: null,
- isAgree: false,
- amount: '',
- price_list: [],
- order_sn: '',
- out_request_no: '',
- isOpenNoDeposit: false, // 是否去开通免押
- noDepositStatusTimer: null,
- pay_type: 0,
- out_request_no: '',
- wallet_money: 0, // 用户钱包余额信息
- returnType: [], // 数组
- isShowDetail: false,
- isSelectStatus: 4,
- count: 1,
- isShowCalendar: false, //选择预约订单时间
- showInput: true,
- userInfo: {
- is_auth: 0,
- status: 0
- },
- };
- }
- /**
- * 生命周期函数--监听页面加载
- */
- ,
- onLoad: function(options) {
- //#ifdef MP-WEIXIN
- this.is_freeze = 0
- //#endif
- this.setData({
- takeCar: options.takeCar || '',
- returnCar: options.returnCar || '',
- leaseTime: options.leaseTime || '',
- isSelectStatus: options.duration_unit || ''
- })
- this.modelId = options.modelId || ''
- this.longitude = options.longitude || ''
- this.latitude = options.latitude || ''
- this.desc_city = options.desc_city || ''
- this.startDate = options.startDate || ''
- // if (this.rentalUnit == '小时') {
- // this.duration_unit = 4
- // } else if (this.rentalUnit == '天') {
- // this.duration_unit = 1
- // } else if (this.rentalUnit == '周') {
- // this.duration_unit = 6
- // }
- this.loadCarInfo()
- this.loadContractTitles();
- this.walletInfo()
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function() {
- let pages = getCurrentPages();
- let currPage = pages[pages.length - 1];
- let isAgree = currPage.isAgree
- if (isAgree) {
- this.setData({
- isAgree: isAgree
- });
- }
- var userInfo = storage.getUserInfoData()
- if (userInfo) this.userInfo = userInfo.userInfo
- },
- computed: {
- serviceListLength() {
- return this.service_list.length;
- }
- },
- methods: {
- clickShowInsuranceDesc() {
- uni.navigateTo({
- url: '/pages/webContent/webContent?webContent=' + this.insurance_setting.illustrate +
- '&title=' + '保险须知',
- success: function(res) {},
- fail: function(res) {},
- complete: function(res) {},
- })
- },
- bindToNav() {
- 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) {},
- })
- },
- loadCarInfo() {
- const me = this
- common.loading()
- http.postApi(config.API_DAYHIRE_CAR_MODEL_INFO, {
- model_id: me.modelId,
- longitude: me.longitude,
- latitude: me.latitude,
- }, (resp) => {
- if (resp.data.code === 200) {
- uni.hideLoading()
- me.freeze_is_open = resp.data.data.freeze_is_open //门店是1否0开启免押配置
- //#ifdef MP-ALIPAY
- me.is_freeze = resp.data.data.freeze_is_open==0?0:1
- //#endif
- me.modelInfo = resp.data.data.model_info
- me.shopInfo = resp.data.data.shop_info
- me.cancel_setting = resp.data.data.cancel_setting
- me.distance = common.formatDistance(me.shopInfo.distance - 0)
- me.modelInfo.endurance = common.formatDistance(me.modelInfo.endurance - 0)
- me.modelInfo.weight = common.formatWeight(me.modelInfo.weight - 0)
- me.service_list = resp.data.data.service_list
- me.insurance_setting = resp.data.data.insurance_setting
- me.returnType = resp.data.data.return_type
- me.return_type = resp.data.data.return_type[0]
- me.modelInfo.model_images = me.modelInfo.model_images.split(',')
- if (resp.data.data.price_list && Array.isArray(resp.data.data.price_list)) {
- me.price_list = resp.data.data.price_list
- resp.data.data.price_list.forEach(i => {
- if (i.hire_duration_unit == me.isSelectStatus) {
- me.setData({price:i.hire_price})
- // me.price = i.hire_price
- }
- })
- }
- me.bindDuration()
- } else {
- uni.hideLoading()
- common.simpleToast(resp.data.msg)
- }
- })
- },
- getServiceStyle(index) {
- if (index % 2 === 0) {
- return {
- borderRadius: '16rpx 0 0 16rpx'
- };
- } else {
- return {
- borderRadius: '0 16rpx 16rpx 0'
- };
- }
- },
- clickSelectMethod(e) {
- const status = e.currentTarget.dataset.status
- this.setData({
- return_type: status
- })
- },
- clickSelectDeposit(e) {
- const me = this
- const status = e.currentTarget.dataset.status
- me.setData({
- is_freeze: status
- })
- me.bindDuration()
- },
- clickSelectGuarantee(e) {
- const status = e.currentTarget.dataset.status
- this.setData({
- isSelectGuarantee: status
- })
- },
- navToPage(e) {
- const me = this
- if (this.userInfo.is_auth - 0 == 1 && this.userInfo.status - 0 != 2) {
- uni.showModal({
- title: '身份认证提示',
- content: '尚未完成身份认证,是否进行身份认证?',
- cancelText: '取消',
- confirmText: '确定',
- success: function(res) {
- if (res.confirm) {
- me.loadFaceToken()
- }
- },
- fail: function(res) {},
- complete: function(res) {},
- })
- return
- }
- // if (this.contractInfo.length > 0 && (!this.isAgree || this.contract_id == 0)) {
- // // if (有合同&&(没查看合同||没勾选同意)) {
- // common.simpleToast('请查阅合同')
- // return
- // }
- const isBuyModel= storage.getIsBuyModel()
- if(isBuyModel){//TODO
- common.simpleToast('您已有租车订单,请先完成订单')
- return
- }
- // if(storage.setIsBuyModel)
- //#ifdef MP-ALIPAY
- this.bindToPayAli()
- //#endif
- //#ifdef MP-WEIXIN
- this.bindToPayWx()
- //#endif
- },
-
- loadFaceToken() {
- const me = this
- http.postApi(config.API_USER_FACE_TOKEN, {}, (resp) => {
- if (resp.data.code === 200) {
- me.face_token = resp.data.data.token
- me.face_key = resp.data.data.key
- uni.navigateTo({
- url: '/pages/livenessView/livenessView?face_token=' + me.face_token +
- '&face_key=' + this.face_key,
- success: function(res) {},
- fail: function(res) {},
- complete: function(res) {},
- })
- } else {
- common.simpleToast(resp.data.msg)
- }
- })
- },
- bindToPayAli() {
- const me = this
- me.from = 'ali'
- const money = me.amount * 100
- // 默认钱包余额不够支付走支付宝(2)否则走钱包余额类型9
- me.pay_type = me.wallet_money < money ? '2' : '9'
- if (me.freeze_is_open == 1 && me.is_freeze == 1) { // 等于0表开启免押
- if (me.isOpenNoDeposit) {
- me.bindToPay()
- return
- }
- http.postApi(config.API_ALI_FREEZE, {
- model_id: me.modelInfo.model_id
- }, (resp) => {
- const params = resp.data.data.params
- my.tradePay({
- orderStr: params,
- success: (res) => {
- if (res.resultCode == 9000) {
- me.out_request_no = resp.data.data.request_no
- me.isOpenNoDeposit = true //开通成功后 不显示去开通免押金
- me.bindDuration()
- // me.amount = ((me.leaseTime * me.price_list[0].hire_price) + (me.insurance_setting!=null?(me.insurance_setting.price - 0):0)) / 100
- me.queryNoDepositStatus(me.out_request_no)
- } else {
- my.alert({
- content: '未成功开通免押金,需支付全部押金',
- });
- me.is_freeze = 0
- me.bindDuration()
- me.bindToPay()
- }
- },
- fail: (res) => {
- my.alert({
- content: '未成功开通免押金!',
- });
- }
- })
- })
- } else {
- me.bindToPay()
- }
- },
- bindToPayWx() {
- this.from = 'wx'
- this.free_order_no = ''
- const money = this.amount * 100
- // 默认钱包余额不够支付走微信(0)否则走钱包余额类型9
- this.pay_type = this.wallet_money < money ? '0' : '9'
- this.bindToPay()
- },
- bindToPay() {
- const me = this
- if (me.pay_type == '9' && me.wallet_money >= (me.amount * 100)) {
- uni.showModal({
- title: '支付提示',
- content: '确认使用钱包余额进行支付吗?',
- cancelText: '取消',
- confirmText: '确定',
- success: function(res) {
- if (res.confirm) {
- me.payMoney()
- } else if (res.cancel) {
- common.simpleToast('支付取消')
- return
- }
- },
- fail: function(res) {
- common.simpleToast(res.data.msg)
- },
- complete: function(res) {},
- })
- } else {
- me.payMoney()
- }
- },
- payMoney() {
- const me = this
- const begin_time = Math.floor(Date.parse(me.startDate + ':00') / 1000);
- http.postApi(config.API_DAYHIRE_HIRE_PREDETERMINE, {
- model_id: me.modelId,
- hire_duration: me.count, // 周期
- hire_duration_unit: me.isSelectStatus, // 周期单位
- begin_time: begin_time,
- from: me.from,
- return_type: me.return_type,
- free_order_no: me.free_order_no,
- pay_type: me.pay_type,
- city: me.desc_city,
- address: me.shopInfo.address,
- longitude: me.longitude,
- latitude: me.latitude,
- }, (resp) => {
- common.loading()
- if (resp.data.code === 200) {
- uni.hideLoading()
- me.order_sn = resp.data.data.order_sn;
- if (me.pay_type == '9') {
- common.simpleToast('支付成功')
- setTimeout(function() {
- uni.navigateTo({
- url: '/pages/orderStatus/orderStatus?order_sn=' + me.order_sn,
- success: function(res) {},
- fail: function(res) {},
- complete: function(res) {},
- })
- }, 500)
- } else {
- //#ifdef MP-ALIPAY
- my.tradePay({
- tradeNO: resp.data.data.trade_no,
- success: function(res) {
- if (res.resultCode == 9000) {
- common.simpleToast('支付成功');
- }
- setTimeout(function() {
- uni.navigateTo({
- url: '/pages/orderStatus/orderStatus?order_sn=' +
- me.order_sn + '&longitude=' + me
- .longitude + '&latitude=' + me
- .latitude,
- success: function(res) {},
- fail: function(res) {},
- complete: function(res) {}
- });
- }, 1000);
- },
- fail: function(res) {
- uni.navigateTo({
- url: '/pages/orderStatus/orderStatus?order_sn=' + me
- .order_sn + '&longitude=' + me.longitude +
- '&latitude=' + me.latitude,
- success: function(res) {},
- fail: function(res) {},
- complete: function(res) {}
- });
- },
- })
- //#endif
- //#ifdef MP-WEIXIN
- var payParams = JSON.parse(resp.data.data.payParams);
- user.wxPay(me.order_sn, payParams, function(isSuccess) {
- if (isSuccess) {
- common.simpleToast('支付成功')
- // // 跳转激活车辆
- // uni.navigateTo({
- // url: '/pages/inputLicensePlate/inputLicensePlate?order_sn=' + me.order_sn +'&order_model_id='+me.modelId,
- // success: function(res) {},
- // fail: function(res) {},
- // complete: function(res) {}
- // })
- setTimeout(function() {
- uni.navigateTo({
- url: '/pages/orderStatus/orderStatus?order_sn=' +
- me.order_sn + '&longitude=' + me
- .longitude +
- '&latitude=' + me.latitude,
- success: function(res) {},
- fail: function(res) {},
- complete: function(res) {}
- });
- }, 1000)
- } else {
- uni.navigateTo({
- url: '/pages/orderStatus/orderStatus?order_sn=' + me
- .order_sn +
- '&longitude=' + me.longitude + '&latitude=' + me
- .latitude,
- success: function(res) {},
- fail: function(res) {},
- complete: function(res) {}
- });
- }
- });
- //#endif
- }
- } else {
- uni.hideLoading()
- common.simpleToast(resp.data.msg)
- }
- })
- },
- queryNoDepositStatus(_out_request_no) {
- const me = this
- me.clearNoDepositStatusTimer();
- me.noDepositStatusTimer = setInterval(function() {
- http.postApi(
- config.API_ALI_FREEZE_STATUS, {
- model_id: me.modelInfo.model_id,
- out_request_no: _out_request_no
- },
- function(resp) {
- uni.hideLoading();
- if (resp.data.code === 200) {
- const {
- status
- } = resp.data.data
- if (status === 2) {
- common.simpleToast('开通免押金成功,正在前往租赁车辆~');
- me.clearNoDepositStatusTimer();
- setTimeout(function() {
- me.free_order_no = _out_request_no
- me.bindToPay()
- }, 1500);
- } else if (status === 1 || status === 0) {
- common.simpleToast('查询免押金开通状态中,请稍后~');
- }
- } else {
- common.simpleToast(resp.data.msg);
- me.clearNoDepositStatusTimer();
- }
- }
- );
- }, 1000)
- },
- // 清空查询免押金状态
- clearNoDepositStatusTimer: function() {
- if (this.noDepositStatusTimer == null) {
- return;
- }
- clearInterval(this.noDepositStatusTimer);
- this.noDepositStatusTimer = null;
- },
- bindContractInfo(e) {
- // if (!this.isAgree && this.contract_id == 0) {
- // common.simpleToast('请先点击阅读租赁合同');
- // return;
- // }
- const contract_id = e.currentTarget.dataset.contractid;
- if (this.contract_id == contract_id) {
- this.setData({
- contract_id: 0,
- });
- } else {
- this.setData({
- contract_id: contract_id
- });
- }
- },
- loadContractTitles() {
- const accountInfo = uni.getAccountInfoSync();
- const me = this;
- http.postApi(
- config.API_CONTRACT_TITLE, {
- appid: accountInfo.miniProgram.appId
- },
- function(resp) {
- if (resp.data.code === 200) {
- const contractInfo = resp.data.data.contractInfo;
- me.setData({
- contractInfo: contractInfo
- });
- }
- }
- );
- },
- bindContractTo(e) {
- const contract_id = e.currentTarget.dataset.contractid;
- this.setData({
- contract_id: contract_id
- });
- uni.navigateTo({
- url: '/pages/contract/contract?contract_id=' + contract_id,
- success: function(res) {},
- fail: function(res) {},
- complete: function(res) {}
- });
- },
- clickNotShow() {
- common.simpleToast('门店未开通,不可自选');
- },
- walletInfo() {
- const me = this
- http.postApi(config.API_DAYHIRE_USER_WALLET_INFO, {}, function(resp) {
- if (resp.data.code === 200) {
- me.wallet_money = resp.data.data.balance // 用户钱包余额信息,用于展示用户钱包余额信息。
- } else {
- common.simpleToast(resp.data.msg)
- }
- })
- },
- bindDetail() {
- this.isShowDetail = true
- },
- //计算价格
- bindDuration() {
- const me = this
- var _insurance_price //保险金
- const unit_price = (me.price / 100) * me.count //租金
- // insurance_setting 保险
- if (me.insurance_setting != null) { // 有保险的时候
- // isSelectDeposit==0为免押 isOpenNoDeposit为是否成功开通免押 total_money为总金额
- // unit_price 租金 insurance_setting.price 保险金 deposit 押金
- if (me.isSelectStatus == 4) { // 时
- _insurance_price = (me.insurance_setting.price - 0) * 1
- } else if (me.isSelectStatus == 6) { // 周
- _insurance_price = (me.insurance_setting.price - 0) * 7 * me.count
- } else if (me.isSelectStatus == 1) { //天
- _insurance_price = (me.insurance_setting.price - 0) * me.count
- } else if (me.isSelectStatus == 2) { //月
- _insurance_price = (me.insurance_setting.price - 0) * 30 * me.count
- } else if (me.isSelectStatus == 7) { //季
- _insurance_price = (me.insurance_setting.price - 0) * 90 * me.count
- }
- } else { // 无保险
- _insurance_price = 0
- }
- if (me.freeze_is_open == 1 &&( me.isOpenNoDeposit || me.is_freeze == 1)) {
- // 金额=(周期数*周期价格)+保险金
- me.amount = ((me.count * me.price - 0) + (_insurance_price - 0)) / 100
- } else {
- // 金额=(周期数*周期价格)+押金+保险金
- me.amount = ((me.count * me.price - 0) + (me.modelInfo.deposit - 0) + (_insurance_price - 0)) / 100
- }
- },
- bindChangeStatus(e) {
- const {
- status,
- unit,
- price
- } = e.currentTarget.dataset
- this.setData({
- isSelectStatus: unit,
- selectIndex: status,
- price: price,
- count: 1
- })
- this.bindDuration()
- },
- bindMinus() {
- if (this.count > 1) {
- this.setData({
- count: this.count - 1
- });
- }
- this.bindDuration()
- },
- blurHandle() {
- this.showInput = false
- this.$nextTick(() => {
- this.showInput = true
- })
- },
- bindInput(e) {
- // let count = Number(e.detail.value)
- // this.setData({
- // count: count,
- // })
- const num = e.detail.value
- this.bindTipCount(num)
- this.bindDuration()
- },
- bindBlur(e) {
- const count = e.detail.value
- this.bindTipCount(count)
- if (count < 1) {
- this.setData({
- count: 1
- })
- }
- this.bindDuration()
- },
- bindAdd() {
- // this.setData({
- // count: this.count + 1
- // });
- const num = this.count - 0 + 1
- this.bindTipCount(num)
- this.bindDuration()
- },
- bindTipCount(num) {
- const limit = MAX_LIMITS[this.isSelectStatus];
- if (limit && num > limit.max) {
- common.simpleToast(limit.message);
- this.setData({
- count: limit.max
- })
- this.blurHandle()
- } else {
- this.setData({
- count: num
- })
- }
- },
- handleValuesUpdated(e) {
- this.takeCar = e.takeCar
- this.returnCar = e.returnCar
- this.leaseTime = e.leaseTime
- this.startDate = e.startDate
- this.isShowCalendar = false;
- },
- tapSelectTime() {
- this.setData({
- isShowCalendar: true
- })
- this.$refs.calendar['leaseType'] = +this.selectType
- this.$nextTick(() => {
- this.$refs.calendar && this.$refs.calendar.setTakeCarData({
- takeCar: this.takeCar,
- dateText: this.startDate.replace('T', ' ')
- })
- })
- },
- }
- };
- </script>
- <style>
- @import './purchaseOrder.css';
- </style>
|