carIntroduce.vue 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369
  1. <template>
  2. <view class="container-view">
  3. <view class="top-item">
  4. <!-- <img src="https://qiniu.bms16.com/FguJzvAGtd4AdhDKXVLUo7XiMxWQ" /> -->
  5. <img src="https://qiniu.bms16.com/Fsm25CTVUmV99PA24aCWPhQdWME-" />
  6. <view class="top-content">
  7. <view class="content-upper flex-row flex-column">
  8. <view>{{model_info.car_model}}</view>
  9. <view class="plate-number">
  10. <view>{{plate_number}}</view>
  11. </view>
  12. </view>
  13. <view class="content-under flex-row">
  14. <view class="under-left">
  15. <view>{{Math.round(last_endurance/1000)}}<text>km</text></view>
  16. <view><img src="https://qiniu.bms16.com/Fo_kL6otssyN3DTdFOI2mmCaAGyk" /></view>
  17. </view>
  18. <view class="under-right">
  19. <view>{{Math.floor(quantity)}}<text>%</text></view>
  20. <view><img src="https://qiniu.bms16.com/FjlMGKktjlrRk3N_yOExfyzKj9Qj" /></view>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="plan-info">
  26. <view>选择租车方案</view>
  27. <view class="plan-type">
  28. <view class="plan-type-1 flex-row" >
  29. <view @tap="bindChangeStatus" :data-status="indexs" :data-unit="items.hire_duration_unit"
  30. :data-price="items.hire_price"
  31. :class="isSelectStatus == items.hire_duration_unit?'selectedPtype':'selectptype'"
  32. v-for=" (items,indexs) in price_list" :key="indexs">
  33. <view class="ptype-title" v-if="items.hire_duration_unit==1">日租</view>
  34. <view class="ptype-title" v-if="items.hire_duration_unit==4">时租</view>
  35. <view class="ptype-title" v-if="items.hire_duration_unit==6">周租</view>
  36. <view class="ptype-title" v-if="items.hire_duration_unit==2">月租</view>
  37. <view class="ptype-title" v-if="items.hire_duration_unit==7">季租</view>
  38. <view :class="isSelectStatus == items.hire_duration_unit?'ptyped-text':'ptype-text'">
  39. <text style="font-size: 40rpx;">¥</text>
  40. <text> {{tools.toFix(items.hire_price/100)}}</text>
  41. </view>
  42. </view>
  43. <!-- <view v-if="price_list.length<=1" class="flex-row" style="flex: 1;">
  44. <view @tap="bindChangeStatus" :data-status="indexs" :data-unit="items.hire_duration_unit"
  45. :data-price="items.hire_price"
  46. class="selectptype"
  47. v-for=" (items,indexs) in price_list" style="margin-right: 0;" :key="indexs">
  48. <view class="ptype-title" v-if="items.hire_duration_unit==1">日租</view>
  49. <view class="ptype-title" v-if="items.hire_duration_unit==4">时租</view>
  50. <view class="ptype-title" v-if="items.hire_duration_unit==6">周租</view>
  51. <view
  52. :class="isSelectStatus == items.hire_duration_unit?'ptyped-text flex-end':'ptype-text flex-end'">
  53. ¥<text>{{tools.toFix(items.hire_price/100)}}</text>
  54. </view>
  55. </view>
  56. </view>
  57. <view v-else class="flex-row" style="flex: 1;">
  58. <view @tap="bindChangeStatus" :data-status="indexs" :data-unit="items.hire_duration_unit"
  59. :data-price="items.hire_price" :style="indexs==2?'margin-right:0;':''"
  60. :class="isSelectStatus == items.hire_duration_unit?'selectedPtype':'selectptype'"
  61. v-for=" (items,indexs) in price_list" :key="indexs">
  62. <view class="ptype-title" v-if="items.hire_duration_unit==1">日租</view>
  63. <view class="ptype-title" v-if="items.hire_duration_unit==4">时租</view>
  64. <view class="ptype-title" v-if="items.hire_duration_unit==6">周租</view>
  65. <view
  66. :class="isSelectStatus == items.hire_duration_unit?'ptyped-text flex-end':'ptype-text flex-end'">
  67. ¥<text>{{tools.toFix(items.hire_price/100)}}</text>
  68. </view>
  69. </view>
  70. </view> -->
  71. </view>
  72. </view>
  73. <view class="plan-time flex-row flex-between">
  74. <view>租车时长</view>
  75. <view class="quantity-count flex-row">
  76. <view class="total-time flex-row">
  77. <view style="font-weight: 600;margin: 0 10rpx;">{{tools.countToDay(count,isSelectStatus)}}</view>
  78. <text v-if="isSelectStatus==4">小时</text>
  79. <text v-else>天</text>
  80. </view>
  81. <!-- <view class="count-btn fbtn" @tap.stop.prevent="bindMinus">-</view> -->
  82. <view @tap.stop.prevent="bindMinus"><img class="count-btn fbtn"
  83. src="https://qiniu.bms16.com/Fm-SCbzVeVHgQK920bmWNvnJnL32" /></view>
  84. <input @input="bindInput" v-if="showInput" @blur="bindBlur" type="number" :value="count" />
  85. <!-- <view class="count-btn sbtn" @tap.stop.prevent="bindAdd">+</view> -->
  86. <view @tap.stop.prevent="bindAdd"><img class="count-btn sbtn"
  87. src="https://qiniu.bms16.com/FsO-2adBjkUkmk4ENuQco-aK7IyY" /></view>
  88. </view>
  89. </view>
  90. <!-- <view class="coupon-info flex-row flex-between">
  91. <view>优惠券</view>
  92. <view>
  93. 9.8 折
  94. <img src="https://qiniu.bms16.com/Fjw9OKXT_2aZ1iPStF941RoawSy_" />
  95. </view>
  96. </view> -->
  97. </view>
  98. <view v-if="isSelectStatus == exchange_plan.gift_detail[0].unit
  99. ||isSelectStatus == exchange_plan.gift_detail[1].unit
  100. ||isSelectStatus == exchange_plan.gift_detail[2].unit" class="change-info">
  101. <view class="change-title flex-row flex-between">
  102. <view>关于车辆换电</view>
  103. </view>
  104. <view class="change-border">
  105. <view class="flex-row flex-between" style="margin-bottom: 20rpx;">
  106. <view class="change-top flex-row ">
  107. <img src="https://qiniu.bms16.com/FjJ70vT8ydLEGfeABSFYWFe-zosV" />
  108. <text style="margin-right: 16rpx;">免费换电次数</text>
  109. <!-- <text class="change-num" style="margin: 0 4rpx;">2</text><text class="change-num">次/日</text> -->
  110. </view>
  111. <view class="change-bottom">共
  112. <text
  113. v-if="isSelectStatus == exchange_plan.gift_detail[0].unit">{{(exchange_plan.gift_detail[0].number)*count}}</text>
  114. <text
  115. v-else-if="isSelectStatus == exchange_plan.gift_detail[1].unit">{{(exchange_plan.gift_detail[1].number)*count}}</text>
  116. <text
  117. v-else-if="isSelectStatus == exchange_plan.gift_detail[2].unit">{{(exchange_plan.gift_detail[2].number)*count}}</text>
  118. </view>
  119. </view>
  120. <view class="change-dec">本单可享
  121. <text
  122. v-if="isSelectStatus == exchange_plan.gift_detail[0].unit">{{(exchange_plan.gift_detail[0].number)*count}}</text>
  123. <text
  124. v-else-if="isSelectStatus == exchange_plan.gift_detail[1].unit">{{(exchange_plan.gift_detail[1].number)*count}}</text>
  125. <text
  126. v-else-if="isSelectStatus == exchange_plan.gift_detail[2].unit">{{(exchange_plan.gift_detail[2].number)*count}}</text>
  127. 次免费换电数,超出后需要单独支付换电费用
  128. </view>
  129. </view>
  130. </view>
  131. <view v-if="insurance_setting != null && insurance_setting.price !=0" class="ride-info">
  132. <view class="guarantee-title flex-row flex-between">
  133. <view>骑行保障服务</view>
  134. <view @tap="clickShowInsuranceDesc">保障须知</view>
  135. </view>
  136. <view class="ride-border">
  137. <view class="ride-top flex-row flex-between">
  138. <view class="top-left">
  139. <img src="https://qiniu.bms16.com/FnFvHiZzSKIve3qMEvtTuvtwgRch" />
  140. <text>{{insurance_setting.insurance_name}}</text>
  141. </view>
  142. <view class="top-right">¥{{tools.toFix(insurance_setting.price / 100)}}/天</view>
  143. </view>
  144. <view class="dashed-border" style="margin-top: 20rpx;"></view>
  145. <view v-for="(item,index) in insurance_setting.detail" :key="index">
  146. <view class="ride-tab">
  147. <view class="tab-item flex-row flex-between">
  148. <view class="tab-title">{{item.info}}</view>
  149. <view class="tab-price">{{tools.toFix(item.money / 100)}}元</view>
  150. </view>
  151. </view>
  152. </view>
  153. </view>
  154. </view>
  155. <!-- <view v-if="isNotDeposit && carInfo.freeze_is_open==1" class="deposit-info" -->
  156. <view v-if=" !isRenew" class="deposit-info">
  157. <view>车辆押金</view>
  158. <!-- #ifdef MP-ALIPAY-->
  159. <view v-if="carInfo.freeze_is_open==1 &&!is_freeze&&(hire_end_time>user_freeze_time || hire_end_time == '')"
  160. @tap="clickSelectDeposit" data-status="0"
  161. :class="isSelectDeposit == 0?'selected-deposit':'select-deposit'" style="margin-bottom: 24rpx;">
  162. <view class="flex-row flex-between">
  163. <view class="deposit-item flex-row" style="align-items: center;">
  164. <img class="select-img" src="https://qiniu.bms16.com/FnSQ9sdDy7wYLHviD_WguwMcBQLy" />
  165. <view>支付宝芝麻信用</view>
  166. </view>
  167. <view class="blue-text">免押金</view>
  168. </view>
  169. <view class="deposit-item-tip">
  170. 芝麻信用550及以上并授权成功后免收;
  171. </view>
  172. </view>
  173. <view @tap="clickSelectDeposit" data-status="1"
  174. :class="isSelectDeposit == 1?'selected-deposit':'select-deposit'">
  175. <view class="flex-row flex-between">
  176. <view class="deposit-item flex-row">
  177. <img class="select-img" src="https://qiniu.bms16.com/FgyxDBJIXX-O8GjEIwqannXHT5S0" />
  178. <view>押金租借</view>
  179. </view>
  180. <view class="black-text">¥{{tools.toFix(deposit/100)}}</view>
  181. </view>
  182. </view>
  183. <!-- #endif -->
  184. <!-- #ifdef MP-WEIXIN -->
  185. <view @tap="clickSelectDeposit" data-status="1" class="select-deposit">
  186. <view class="flex-row flex-between">
  187. <view class="deposit-item flex-row">
  188. <img class="select-img" src="https://qiniu.bms16.com/FgyxDBJIXX-O8GjEIwqannXHT5S0" />
  189. <view>押金租借</view>
  190. </view>
  191. <view class="black-text">¥{{tools.toFix(deposit/100)}}</view>
  192. </view>
  193. </view>
  194. <!-- #endif -->
  195. </view>
  196. <view class="return-type ">
  197. <view class="return-type-title flex-row flex-between">
  198. <view>还车方式</view>
  199. <view class="tip-title-text">
  200. 需要归还至门店
  201. </view>
  202. </view>
  203. <view class="return-type-main">
  204. <view @tap="navToPage" class="flex-row flex-between can-return-view">
  205. <view class="flex-row flex-start">
  206. <img class="store-icon" src="https://qiniu.bms16.com/FnZDbSriwdbZ7tbY8I-w2J5QlSY8" alt="">
  207. <view class="can-return-text">可还门店<text class="grey-text">|离哪里近还哪里</text></view>
  208. </view>
  209. <view class="store-num">
  210. <text>{{return_shop_num}}个</text>
  211. <img class="to-store-icon" src="https://qiniu.bms16.com/FjVH-ijM3psPQP90J2mwusoTKyLL" alt="">
  212. </view>
  213. </view>
  214. </view>
  215. </view>
  216. <view class="assort-info" v-if="service_list.length>0">
  217. <view>配套服务</view>
  218. <view class="assort-text flex-row">
  219. <view v-for="(item,index) in service_list" :key="item.unique">{{item.service_name}}</view>
  220. </view>
  221. </view>
  222. <view class="current-store flex-row flex-between">
  223. <view>当前门店</view>
  224. <view class="current-store-text flex-row">
  225. {{shop_info.shop_name}}
  226. <!-- <img class="to-store-icon" src="https://qiniu.bms16.com/FgdKxv5lydoYTWxOCQKujcqou9yO" alt=""> -->
  227. </view>
  228. </view>
  229. <view class="pay-type flex-row flex-between">
  230. <view class="pay-type-tital">支付方式</view>
  231. <!-- <view class="pay-type-item" v-if="tools.toFix( wallet_money / 100) >= total_price"> -->
  232. <view class="pay-type-item" v-if="tools.toFix( wallet_money / 100) >= amount">
  233. <img src="https://qiniu.bms16.com/Fu_XFiEYY1jhmBVtNVF7fVEiqai0" style="width: 40rpx;height: 40rpx;" />
  234. <view style="padding-left: 10rpx;">钱包支付(¥{{tools.toFix( wallet_money / 100)}})</view>
  235. </view>
  236. <view class="pay-type-item" v-else>
  237. <!-- #ifdef MP-WEIXIN -->
  238. <img src="https://qiniu.bms16.com/FnGjQsTOIaEgJsnxfCA8Z89WZdth" style="width: 40rpx;height: 40rpx;" />
  239. <view style="padding-left: 10rpx;">微信支付</view>
  240. <!-- #endif -->
  241. <!-- #ifdef MP-ALIPAY-->
  242. <img src="https://qiniu.bms16.com/Fk4YmG_RbdH0LNo1s8qHKDtpCTXl" style="width: 40rpx;height: 40rpx;" />
  243. <view style="padding-left: 10rpx;">支付宝支付</view>
  244. <!-- #endif -->
  245. </view>
  246. </view>
  247. <view style="height: 180rpx;"></view>
  248. <view class="payment-info">
  249. <!-- <view class="payment-top" v-for="(item, index) in contractInfo" :key="index">
  250. <view @tap="bindContractInfo" :data-contractid="item.contract_id" style="display: inline-block">
  251. <img :src="
  252. contract_id!=0 && isAgree
  253. ? 'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq'
  254. : 'https://qiniu.bms16.com/Fh0JH6_QbiXYmVy7FNYnDkVIGvLC'" />
  255. </view>
  256. <view @tap="bindContractInfo" :data-contractid="item.contract_id"
  257. style="display: inline-block; margin-left: 10rpx">已阅读并同意</view>
  258. <view @tap="bindContractTo" style="display: inline-block; color: #0074FF"
  259. :data-contractid="item.contract_id">
  260. 《{{ item.main_title }}》
  261. </view>
  262. </view> -->
  263. <view class="payment-bottom flex-row flex-between">
  264. <view class="bottom-left flex-row">
  265. <!-- <view>¥{{tools.toFix(total_price)}}</view> -->
  266. <allPrice :amount="amount"></allPrice>
  267. <view class="b-text" @tap="changeDetail">明细<img
  268. src="https://qiniu.bms16.com/Fvl1d-AWRvwY_ehNrw7bMZOK6LBZ" /></view>
  269. </view>
  270. <!-- #ifdef MP-ALIPAY-->
  271. <view v-if="!isRenew" @tap="bindToPayOrDeposit">{{isSelectDeposit == 0?'支付·授权免押':'支付'}}</view>
  272. <view v-else @tap="bindToPayOrDeposit">{{isSelectDeposit == 0?'续费·授权免押':'续费'}}</view>
  273. <!-- #endif -->
  274. <!-- #ifdef MP-WEIXIN -->
  275. <view @tap="bindToPayOrDeposit">{{isRenew?'立即续费':'立即支付'}}</view>
  276. <!-- #endif -->
  277. </view>
  278. </view>
  279. <!-- 明细弹窗 -->
  280. <view v-if="isShowPriceDetail" class="modal-group">
  281. <view class="payment-info-main">
  282. <view class="payment-info-top">
  283. <view class="detail-title flex-row flex-between">
  284. <text class="detail-title-text">价格明细</text>
  285. <image style="width: 32rpx;height: 32rpx;margin-bottom: 48rpx;" @tap="changeDetail"
  286. src="https://qiniu.bms16.com/FtoTEHOJiUf_gjPCJGGHMsAtHI5M"></image>
  287. <!-- <text >X</text> -->
  288. </view>
  289. <view class="detail-text flex-row flex-between">
  290. <text>车辆租金</text>
  291. <text>
  292. ¥{{(price_list[selectIndex].hire_price/100)+'x'+count}}
  293. <text v-if="isSelectStatus==1">天</text>
  294. <text v-if="isSelectStatus==4">时</text>
  295. <text v-if="isSelectStatus==6">周</text>
  296. <text v-if="isSelectStatus==2">月</text>
  297. <text v-if="isSelectStatus==7">季</text>
  298. </text>
  299. </view>
  300. <view v-if="insurance_setting!=null&&(insurance_setting.price-0!=0)&&isPayInsuranceValue"
  301. class="detail-text flex-row flex-between">
  302. <text>骑行保障服务</text>
  303. <text v-if="isSelectStatus==4">{{'¥'+tools.toFix(insurance_setting.price / 100)+'x1天'}}</text>
  304. <text
  305. v-if="isSelectStatus==1">{{'¥'+tools.toFix(insurance_setting.price / 100)+'x'+(endCount?endCount:count)+'天'}}</text>
  306. <text
  307. v-if="isSelectStatus==6">{{'¥'+tools.toFix(insurance_setting.price / 100)+'x'+(endCount?endCount*7:count*7)+'天'}}</text>
  308. </view>
  309. <view v-if="isNotDeposit||carInfo.freeze_is_open==1" class="detail-text flex-row flex-between">
  310. <text>车辆押金</text>
  311. <view class="">
  312. <text v-if="isSelectDeposit==1">{{'¥'+tools.toFix(model_info.deposit/100)}}</text>
  313. <text v-if="isSelectDeposit==0">¥0 (免押)</text>
  314. </view>
  315. </view>
  316. <view class="detail-money-row flex-row flex-end">
  317. <view class="flex-row" style="align-items: baseline;">
  318. <text style="margin-right: 24rpx;">支付金额</text>
  319. <!-- <text class="detail-text-money">¥{{tools.toFix(total_price)}}</text> -->
  320. <allPrice :amount="amount"></allPrice>
  321. </view>
  322. </view>
  323. </view>
  324. <view class="payment-main">
  325. <!-- <view class="payment-top" v-for="(item, index) in contractInfo" :key="index">
  326. <view @tap="bindContractInfo" :data-contractid="item.contract_id" style="display: inline-block">
  327. <img :src="
  328. contract_id!=0 && isAgree
  329. ? 'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq'
  330. : 'https://qiniu.bms16.com/Fh0JH6_QbiXYmVy7FNYnDkVIGvLC'" />
  331. </view>
  332. <view @tap="bindContractInfo" :data-contractid="item.contract_id"
  333. style="display: inline-block; margin-left: 10rpx">已阅读并同意</view>
  334. <view @tap="bindContractTo" style="display: inline-block; color: #0074FF"
  335. :data-contractid="item.contract_id">
  336. 《{{ item.main_title }}》
  337. </view>
  338. </view> -->
  339. <view class="payment-bottom flex-row flex-between">
  340. <view class="bottom-left flex-row">
  341. <allPrice :amount="amount"></allPrice>
  342. <!-- <view>¥{{tools.toFix(total_price)}}</view> -->
  343. <view class="b-text" @tap="changeDetail">明细<img
  344. src="https://qiniu.bms16.com/FkzZI0r5jO-c2JRahNkZW2pHb9dR" /></view>
  345. </view>
  346. <!-- #ifdef MP-ALIPAY-->
  347. <view v-if="!isRenew" @tap="bindToPayOrDeposit">{{isSelectDeposit == 0?'支付·授权免押':'支付'}}</view>
  348. <view v-else @tap="bindToPayOrDeposit">{{isSelectDeposit == 0?'续费·授权免押':'续费'}}</view>
  349. <!-- #endif -->
  350. <!-- #ifdef MP-WEIXIN -->
  351. <view @tap="bindToPayOrDeposit">{{isRenew?'立即续费':'立即支付'}}</view>
  352. <!-- #endif -->
  353. </view>
  354. </view>
  355. </view>
  356. </view>
  357. </view>
  358. </template>
  359. <script module="tools" lang="wxs" src="@/pages/common/wxs/tools.wxs"></script>
  360. <script module="tools" lang="sjs" src="@/pages/common/wxs/tools.sjs"></script>
  361. <script>
  362. var config = require('../../common/config.js');
  363. var common = require('../../common/common.js');
  364. var http = require('../../common/http.js');
  365. var user = require('../../common/user.js');
  366. var storage = require('../../common/storage.js');
  367. import allPrice from '@/component/allPrice/allPrice';
  368. import { MAX_LIMITS } from '@/common/constant.js'
  369. export default {
  370. components: {
  371. allPrice,
  372. },
  373. data() {
  374. return {
  375. last_endurance: 0,
  376. count: 1,
  377. isSelectDeposit: 1,
  378. isSelectGuarantee: 0,
  379. isShowStores: false,
  380. insurance_setting: {
  381. // detail:[{money:1,info:'hhhhhjlasdjai'},{money:2,info:'hhhhhjlasdjai'}]
  382. },
  383. noDepositStatusTimer: null,
  384. myLocation: {},
  385. model_info: {}, //车辆信息
  386. old_model_info: {}, //车辆信息
  387. deposit: 0,
  388. quantity: 0, //电池电量
  389. price_list: [], //车辆价格 hire_duration_unit 1 日 4 小时 6 周
  390. isSelectStatus: '', //判断显示选择的租赁周期是什么
  391. returnShopNum: 0, //附近可还车辆门店数量
  392. service_list: [], //配套服务列表
  393. shop_info: {}, //门店信息
  394. isArgee: false, //是否同意协议
  395. price: 0, //租金
  396. amount: '',
  397. selectIndex: 0, //选择租赁周期index
  398. out_request_no: '', //免押订单号
  399. isOpenNoDeposit: false, //免押开通是否成功 成功后再次计算价钱时不算押金
  400. myAddress: {},
  401. wallet_money: 0, //钱包余额
  402. isShowPriceDetail: false,
  403. plate_number: '',
  404. isRenew: false,
  405. return_shop_num: 0,
  406. hire_end_time: '', //车辆租赁结束时间
  407. is_freeze: false, //是否原来有签约支付宝免押
  408. user_freeze_time: '', //原来的支付宝签约过期时间
  409. contractInfo: [],
  410. contract_id: 0,
  411. isAgree: false,
  412. order_sn: '',
  413. carInfo: {},
  414. pay_type: 9,
  415. orderInfo: {},
  416. isNotDeposit: true,
  417. renewTime: '',
  418. last_endurance: 0,
  419. isPayInsuranceValue: false,
  420. endCount: 0, //如果过期时间
  421. showInput:true
  422. };
  423. },
  424. /**
  425. * 生命周期函数--监听页面加载
  426. */
  427. onLoad: function(options) {
  428. const me = this
  429. me.plate_number = options.plate_number ? options.plate_number : ''
  430. me.isRenew = options.isRenew ? options.isRenew : ''
  431. me.order_sn = options.order_sn ? options.order_sn : ''
  432. var carInfo = options.carInfo ? JSON.parse(decodeURIComponent(options.carInfo)) : ''
  433. // const exchange_plan = {
  434. // exchange_price: 0,
  435. // // 1日 2 月 4 时 6周
  436. // gift_detail: [{
  437. // unit: "4",
  438. // number: "4"
  439. // }, {
  440. // unit: "6",
  441. // number: "6"
  442. // }, ],
  443. // plan_name: "默认方案",
  444. // }
  445. if (carInfo) {
  446. var exchange_plan = carInfo.exchange_plan
  447. me.setData({
  448. deposit: carInfo.model_info.deposit,
  449. carInfo: carInfo,
  450. // exchange_plan: exchange_plan
  451. exchange_plan: carInfo.exchange_plan
  452. })
  453. }
  454. me.walletInfo() //钱包余额
  455. me.loadContractTitles() //合同
  456. // common.loading();
  457. const storedLocation = uni.getStorageSync('user_current_location');
  458. if (storedLocation && storedLocation.longitude && storedLocation.latitude) {
  459. // 如果本地有存储的定位信息,则直接使用
  460. me.setData({
  461. myLocation: storedLocation
  462. });
  463. //me.order_sn == ''代表不是续费
  464. if (me.order_sn == '') {
  465. me.loadInputInfo()
  466. } else {
  467. me.loadCarInfo()
  468. }
  469. me.getAddress()
  470. } else {
  471. me.getLocationAndSave();
  472. }
  473. },
  474. /**
  475. * 生命周期函数--监听页面显示
  476. */
  477. onShow: function() {
  478. let pages = getCurrentPages();
  479. let currPage = pages[pages.length - 1];
  480. let isAgree = currPage.isAgree
  481. if (isAgree) {
  482. this.setData({
  483. isAgree: isAgree
  484. });
  485. }
  486. },
  487. methods: {
  488. clickShowInsuranceDesc() {
  489. uni.navigateTo({
  490. url: '/pages/webContent/webContent?webContent=' + this.insurance_setting.illustrate +
  491. '&title=' + '保险须知',
  492. success: function(res) {},
  493. fail: function(res) {},
  494. complete: function(res) {},
  495. })
  496. },
  497. changeDetail() {
  498. this.isShowPriceDetail = !this.isShowPriceDetail
  499. },
  500. walletInfo() {
  501. const me = this
  502. http.postApi(config.API_DAYHIRE_USER_WALLET_INFO, {}, function(resp) {
  503. if (resp.data.code === 200) {
  504. me.wallet_money = resp.data.data.balance // 用户钱包余额信息,用于展示用户钱包余额信息。
  505. } else {
  506. common.simpleToast(resp.data.msg)
  507. }
  508. })
  509. },
  510. getLocationAndSave: function() {
  511. const me = this;
  512. uni.getLocation({
  513. type: 'gcj02',
  514. isHighAccuracy: true,
  515. success: function(res) {
  516. uni.hideLoading();
  517. var myLocation = {
  518. longitude: res.longitude,
  519. latitude: res.latitude
  520. }
  521. me.setData({
  522. myLocation: myLocation
  523. })
  524. if (me.order_sn == '') {
  525. me.loadInputInfo()
  526. } else {
  527. me.loadCarInfo()
  528. }
  529. me.getAddress()
  530. uni.setStorageSync('user_current_location', myLocation);
  531. },
  532. fail: function(res) {
  533. uni.hideLoading();
  534. },
  535. complete: function(res) {
  536. uni.hideLoading();
  537. }
  538. });
  539. },
  540. loadInputInfo() {
  541. const test = this.carInfo.price_list.slice(0)
  542. var insurance_setting = null
  543. if (this.carInfo.insurance_setting) {
  544. insurance_setting = this.carInfo.insurance_setting
  545. } else {
  546. insurance_setting = {
  547. price: 0
  548. }
  549. }
  550. this.setData({
  551. insurance_setting: insurance_setting,
  552. quantity: this.carInfo.quantity,
  553. model_info: this.carInfo.model_info,
  554. // price_list: this.carInfo.price_list,
  555. price_list: test,
  556. service_list: this.carInfo.service_list,
  557. isSelectStatus: this.carInfo.price_list[0].hire_duration_unit,
  558. shop_info: this.carInfo.shop_info,
  559. return_shop_num: this.carInfo.return_shop_num,
  560. hire_end_time: this.carInfo.hire_end_time,
  561. is_freeze: this.carInfo.is_freeze,
  562. user_freeze_time: this.carInfo.user_freeze_time,
  563. last_endurance: this.carInfo.last_endurance
  564. })
  565. this.bindDuration()
  566. },
  567. loadCarInfo() {
  568. const me = this
  569. const pData = {
  570. longitude: this.myLocation.longitude,
  571. latitude: this.myLocation.latitude,
  572. plate_number: me.plate_number
  573. }
  574. http.postApi(config.API_DAYHIRE_CAR_CAR_INFO, pData, (resp) => {
  575. if (resp.data.code === 200) {
  576. const pData = resp.data.data
  577. var insurance_setting = null
  578. if (pData.insurance_setting == null) {
  579. insurance_setting = {
  580. price: 0
  581. }
  582. } else {
  583. insurance_setting = pData.insurance_setting
  584. }
  585. me.setData({
  586. insurance_setting: insurance_setting,
  587. quantity: pData.quantity,
  588. model_info: pData.model_info,
  589. price_list: pData.price_list,
  590. service_list: pData.service_list,
  591. isSelectStatus: pData.price_list[0].hire_duration_unit,
  592. shop_info: pData.shop_info,
  593. return_shop_num: pData.return_shop_num,
  594. is_freeze: pData.is_freeze,
  595. user_freeze_time: pData.user_freeze_time,
  596. deposit: pData.model_info.deposit,
  597. carInfo: pData,
  598. last_endurance: pData.last_endurance,
  599. exchange_plan: pData.exchange_plan
  600. })
  601. me.orderInfo = pData.order_info
  602. me.renewTime = common.loadAugmentTime(me.hire_duration_unit, common.formatTime(me.carInfo
  603. .hire_expire_time), me.count)
  604. me.bindDuration()
  605. } else {
  606. common.simpleToast(resp.data.msg)
  607. }
  608. })
  609. },
  610. bindChangeStatus(e) {
  611. const {
  612. status,
  613. unit,
  614. price
  615. } = e.currentTarget.dataset
  616. this.setData({
  617. isSelectStatus: unit,
  618. selectIndex: status,
  619. price: price,
  620. count: 1
  621. })
  622. this.bindDuration()
  623. },
  624. changeArgee() {
  625. this.isArgee = !this.isArgee
  626. },
  627. bindMinus() {
  628. if (this.count > 1) {
  629. this.setData({
  630. count: this.count - 1
  631. });
  632. }
  633. this.bindDuration()
  634. },
  635. bindInput(e) {
  636. // let count = Number(e.detail.value)
  637. // this.setData({
  638. // count: count,
  639. // })
  640. const num = Number(e.detail.value)
  641. this.bindTipCount(num)
  642. this.bindDuration()
  643. },
  644. bindBlur(e) {
  645. const count = e.detail.value
  646. this.bindTipCount(count)
  647. if (count < 1) {
  648. this.setData({
  649. count: 1
  650. })
  651. }
  652. this.bindDuration()
  653. },
  654. bindAdd() {
  655. // this.setData({
  656. // count: this.count + 1
  657. // });
  658. const num = this.count - 0 + 1
  659. this.bindTipCount(num)
  660. this.bindDuration()
  661. },
  662. bindTipCount(num) {
  663. const limit = MAX_LIMITS[this.isSelectStatus];
  664. if (limit && num > limit.max) {
  665. common.simpleToast(limit.message);
  666. this.setData({
  667. count: limit.max
  668. })
  669. this.blurHandle()
  670. } else {
  671. this.setData({
  672. count: num
  673. })
  674. }
  675. },
  676. clickSelectDeposit(e) {
  677. const status = e.currentTarget.dataset.status
  678. this.setData({
  679. isSelectDeposit: status
  680. })
  681. this.bindDuration()
  682. },
  683. //计算价格
  684. bindDuration() {
  685. const me = this
  686. var _insurance_price //保险金
  687. const unit_price = (me.price_list[me.selectIndex].hire_price / 100) * me.count //租金
  688. // pay_with_pledge =2、4、7时 不需要支付押金
  689. me.loadCalculateDeposit()
  690. // insurance_setting 保险 续费后还是过期不需要缴纳保险 this.carInfo.hire_expire_time * 1000
  691. var timestampNow = parseInt(Date.now()/1000);
  692. const end_time=this.carInfo.hire_expire_time
  693. if(me.isRenew){
  694. if (me.isSelectStatus == 4) { // 时
  695. me.isPayInsuranceValue= ((end_time+me.count*60*60)- timestampNow)>0
  696. me.endCount=Math.ceil(((end_time+me.count*60*60)- timestampNow)/3600)
  697. } else if (me.isSelectStatus == 6) { // 周
  698. me.isPayInsuranceValue= ((end_time+me.count*60*60*7*24)-timestampNow)>0
  699. me.endCount=Math.ceil(((end_time+me.count*60*60*7*24)- timestampNow)/(60*60*7*24))
  700. } else if (me.isSelectStatus == 1) { //天
  701. me.isPayInsuranceValue= ((end_time+me.count*60*60*24)-timestampNow)>0
  702. me.endCount=Math.ceil(((end_time+me.count*60*60*24)- timestampNow)/(3600*24))
  703. } else if (me.isSelectStatus == 2) { //月
  704. me.isPayInsuranceValue= ((end_time+me.count*60*60*30*24)-timestampNow)>0
  705. me.endCount=Math.ceil(((end_time+me.count*60*60*30*24)- timestampNow)/(60*60*30*24))
  706. } else if (me.isSelectStatus == 7) { //季
  707. me.isPayInsuranceValue= ((end_time+me.count*60*60*90*24)-timestampNow)>0
  708. me.endCount=Math.ceil(((end_time+me.count*60*60*90*24)- timestampNow)/(60*60*90*24))
  709. }
  710. }else{
  711. me.isPayInsuranceValue= true
  712. }
  713. if (me.insurance_setting != null &&me.isPayInsuranceValue) { // 有保险的时候
  714. // isSelectDeposit==0为免押 isOpenNoDeposit为是否成功开通免押 total_money为总金额
  715. // unit_price 租金 insurance_setting.price 保险金 deposit 押金
  716. if (me.isSelectStatus == 4) { // 时
  717. _insurance_price = (me.insurance_setting.price - 0) * 1
  718. } else if (me.isSelectStatus == 6) { // 周
  719. _insurance_price = (me.insurance_setting.price - 0) * 7 *(me.endCount? me.endCount:me.count)
  720. } else if(me.isSelectStatus == 1){ //
  721. _insurance_price =(me.insurance_setting.price - 0) *(me.endCount? me.endCount:me.count)
  722. }else if (me.isSelectStatus == 2) { //月
  723. _insurance_price = (me.insurance_setting.price - 0) * 30 *(me.endCount? me.endCount:me.count)
  724. } else if (me.isSelectStatus == 7) { //季
  725. _insurance_price = (me.insurance_setting.price - 0) * 90 *(me.endCount? me.endCount:me.count)
  726. }
  727. } else { // 无保险
  728. _insurance_price = 0
  729. }
  730. if ((me.isOpenNoDeposit) || me.isRenew) {
  731. // 金额=(周期数*周期价格)+保险金
  732. if (me.price != 0) {
  733. me.amount = ((me.count * me.price - 0) + (_insurance_price - 0)) / 100
  734. } else {
  735. me.amount = ((me.count * me.price_list[0].hire_price - 0) + (_insurance_price - 0)) / 100
  736. }
  737. } else {
  738. // 金额=(周期数*周期价格)+押金+保险金
  739. if (me.price != 0) {
  740. me.amount = ((me.count * me.price - 0) + (me.model_info.deposit - 0) + (_insurance_price - 0)) /
  741. 100
  742. } else {
  743. me.amount = ((me.count * me.price_list[0].hire_price - 0) + (me.model_info.deposit - 0) +
  744. (_insurance_price - 0)) / 100
  745. }
  746. }
  747. },
  748. //计算押金
  749. loadCalculateDeposit() {
  750. //续租
  751. if (!common.isObjectEmpty(this.orderInfo)) {
  752. if (this.orderInfo.pay_with_pledge == 2 || this.orderInfo.pay_with_pledge == 4 || this.orderInfo
  753. .pay_with_pledge == 7) {
  754. this.model_info.deposit = 0
  755. this.isNotDeposit = false
  756. } else if (this.orderInfo.pay_with_pledge == 5) { //支付宝信用免押
  757. // 押金 = 支付宝签约过期时间<续租后到期时间?押金:0
  758. var selTime = this.loadGetTime(this.count)
  759. if (!this.IsFourceDepostion(this.count) && selTime < this.carInfo
  760. .user_freeze_time) {
  761. this.model_info.deposit = 0
  762. }
  763. this.isNotDeposit = false
  764. } else {
  765. this.model_info.deposit = this.deposit
  766. }
  767. } else { //首租
  768. if (this.isSelectDeposit == 0) {
  769. this.model_info.deposit = 0
  770. } else {
  771. this.model_info.deposit = this.deposit
  772. }
  773. }
  774. },
  775. IsFourceDepostion(select_hire_duration) {
  776. var seltime = this.loadGetTime(select_hire_duration)
  777. var now = new Date(new Date().getTime() + 300 * 24 * 60 * 60 * 1000);
  778. var timestamp = parseInt(now.getTime() / 1000);
  779. if (seltime > timestamp) {
  780. this.setData({
  781. isOpenNoDeposit: true
  782. })
  783. }
  784. return seltime > timestamp
  785. },
  786. loadGetTime(select_hire_duration) {
  787. var timestamp = this.loadAugmentTime(this.carInfo.hire_expire_time * 1000, select_hire_duration)
  788. return timestamp;
  789. },
  790. loadAugmentTime(time, select_hire_duration) {
  791. var now = new Date(time);
  792. switch (this.carInfo.hire_duration_unit - 0) {
  793. case 1:
  794. now = new Date(now.getTime() + select_hire_duration * 24 *
  795. 60 * 60 * 1000);
  796. break;
  797. case 2:
  798. now.setMonth(now.getMonth() + select_hire_duration);
  799. break;
  800. case 3:
  801. now.setFullYear(now.getFullYear() + select_hire_duration);
  802. break;
  803. case 4:
  804. var cycle_time = select_hire_duration / 24;
  805. now = new Date(now.getTime() + cycle_time * 24 * 60 * 60 *
  806. 1000);
  807. break;
  808. case 5:
  809. var cycle_time = select_hire_duration;
  810. now = new Date(now.getTime() + cycle_time * 60 *
  811. 1000);
  812. break;
  813. case 6:
  814. var cycle_time = select_hire_duration * 7;
  815. now = new Date(now.getTime() + cycle_time * 24 * 60 * 60 *
  816. 1000);
  817. break;
  818. }
  819. return parseInt(now.getTime() / 1000);
  820. },
  821. bindToPayOrDeposit() {
  822. // if (this.contractInfo.length > 0 && (!this.isAgree || this.contract_id == 0)) {
  823. // common.simpleToast('请先阅读并同意协议')
  824. // return
  825. // }
  826. const me = this
  827. if (me.isRenew) { //续费
  828. if (me.is_freeze) { //上一单签约了免押
  829. if (me.user_freeze_time != 0 && me.hire_end_time > me.user_freeze_time) { //过期,需重新支付押金
  830. me.bindFreeze()
  831. } else {
  832. me.bindToRenew()
  833. }
  834. } else { //上一单没签约免押
  835. me.bindFreeze()
  836. }
  837. } else { // 租车
  838. me.bindFreeze()
  839. }
  840. },
  841. bindFreeze() {
  842. const me = this
  843. if (me.isSelectDeposit == 0) {
  844. if (!me.isOpenNoDeposit && me.carInfo.freeze_is_open == 1) {
  845. //去开通免押
  846. http.postApi(config.API_ALI_FREEZE, {
  847. model_id: me.model_info.model_id,
  848. license_plate_number: me.plate_number,
  849. }, (resp) => {
  850. if (resp.data.code === 200) {
  851. me.setData({
  852. out_request_no: resp.data.data.request_no
  853. });
  854. my.tradePay({
  855. orderStr: resp.data.data.params, // 完整的支付参数拼接成的字符串,从服务端获取
  856. success: (res) => {
  857. if (res.resultCode == 9000) {
  858. me.out_request_no = resp.data.data.request_no
  859. me.isOpenNoDeposit = true //开通成功后 不显示去开通免押金
  860. if (me.insurance_setting != null && me.insurance_setting
  861. .price != 0) {
  862. if (me.insurance_price != 0) {
  863. me.insurance_price
  864. } else {
  865. }
  866. } else {
  867. me.insurance_setting.price == 0
  868. }
  869. me.bindDuration()
  870. me.queryNoDepositStatus(me.out_request_no)
  871. } else {
  872. my.alert({
  873. content: '未成功开通免押金,需支付全部押金'
  874. });
  875. if (me.isRenew) {
  876. me.bindToRenew()
  877. } else {
  878. me.bindToPay()
  879. }
  880. }
  881. },
  882. fail: (res) => {
  883. my.alert({
  884. content: '未成功开通免押金!',
  885. });
  886. }
  887. });
  888. } else {
  889. common.simpleToast(resp.data.msg)
  890. }
  891. })
  892. } else {
  893. //直接支付
  894. if (me.isRenew) {
  895. me.bindToRenew() //续费
  896. } else {
  897. me.bindToPay()
  898. }
  899. }
  900. } else {
  901. //直接支付
  902. if (me.isRenew) {
  903. me.bindToRenew() //续费
  904. } else {
  905. me.bindToPay()
  906. }
  907. }
  908. },
  909. bindToRenew() {
  910. // 测试注意金额单位,否则影响支付方式!!!
  911. const me = this
  912. //#ifdef MP-ALIPAY
  913. const from = 'ali'
  914. const pay_type = me.wallet_money / 100 < me.amount ? '2' : '9'
  915. //#endif
  916. //#ifdef MP-WEIXIN
  917. const from = 'wx'
  918. const pay_type = me.wallet_money / 100 < me.amount ? '0' : '9'
  919. //#endif
  920. const pData = {
  921. order_sn: me.order_sn,
  922. hire_duration: this.count, //订单周期
  923. hire_duration_unit: this.isSelectStatus,
  924. pay_type: pay_type,
  925. from: from
  926. }
  927. if (pay_type == '9' && (me.wallet_money / 100) >= me.amount) {
  928. uni.showModal({
  929. title: '支付提示',
  930. content: '确认开通续租服务,支付续租费用?',
  931. cancelText: '取消',
  932. confirmText: '确定',
  933. success: function(res) {
  934. if (res.confirm) {
  935. me.loadHireRenew(pData)
  936. } else if (res.cancel) {
  937. common.simpleToast('支付取消')
  938. }
  939. },
  940. fail: function(res) {
  941. common.simpleToast(res.data.msg)
  942. },
  943. complete: function(res) {},
  944. })
  945. } else {
  946. // 走微信支付宝续租
  947. me.loadHireRenew(pData)
  948. }
  949. },
  950. loadHireRenew(pData) {
  951. const me = this
  952. http.postApi(config.API_DAYHIRE_HIRE_RENEW, pData, (resp) => {
  953. common.loading()
  954. if (resp.data.code === 200) {
  955. uni.hideLoading()
  956. if (pData.pay_type == '9') {
  957. setTimeout(function() {
  958. uni.navigateTo({
  959. url: '/pages/orderStatus/orderStatus?order_sn=' + pData
  960. .order_sn + '&longitude=' + me.myLocation.longitude +
  961. '&latitude=' + me.myLocation.latitude,
  962. success: function(res) {},
  963. fail: function(res) {},
  964. complete: function(res) {},
  965. })
  966. }, 1500)
  967. common.simpleToast('支付成功')
  968. } else {
  969. //#ifdef MP-ALIPAY
  970. my.tradePay({
  971. tradeNO: resp.data.data.trade_no,
  972. success: function(res) {
  973. if (res.resultCode == 9000) {
  974. common.simpleToast('支付成功');
  975. }
  976. setTimeout(function() {
  977. uni.navigateTo({
  978. url: '/pages/orderStatus/orderStatus?order_sn=' +
  979. me.order_sn + '&longitude=' + me
  980. .myLocation.longitude +
  981. '&latitude=' + me.myLocation.latitude,
  982. success: function(res) {},
  983. fail: function(res) {},
  984. complete: function(res) {}
  985. });
  986. }, 1000);
  987. },
  988. fail: function(res) {
  989. common.simpleToast('支付失败,请重试')
  990. },
  991. })
  992. //#endif
  993. //#ifdef MP-WEIXIN
  994. var payParams = JSON.parse(resp.data.data.payParams);
  995. user.wxPay(me.order_sn, payParams, function(isSuccess) {
  996. if (isSuccess) {
  997. common.simpleToast('支付成功')
  998. setTimeout(function() {
  999. uni.navigateTo({
  1000. url: '/pages/orderStatus/orderStatus?order_sn=' +
  1001. me.order_sn + '&longitude=' + me.myLocation
  1002. .longitude +
  1003. '&latitude=' + me.myLocation.latitude,
  1004. success: function(res) {},
  1005. fail: function(res) {},
  1006. complete: function(res) {}
  1007. });
  1008. }, 1000)
  1009. } else {
  1010. common.simpleToast('支付失败,请重试')
  1011. }
  1012. });
  1013. //#endif
  1014. }
  1015. } else {
  1016. uni.hideLoading()
  1017. common.simpleToast(resp.data.msg)
  1018. }
  1019. })
  1020. },
  1021. bindToPay() {
  1022. const me = this
  1023. //#ifdef MP-ALIPAY
  1024. const from = 'ali'
  1025. const pay_type = (me.wallet_money / 100) < me.amount ? '2' : '9'
  1026. //#endif
  1027. //#ifdef MP-WEIXIN
  1028. const from = 'wx'
  1029. const pay_type = (me.wallet_money / 100) < me.amount ? '0' : '9'
  1030. //#endif
  1031. const pData = {
  1032. plate_number: me.plate_number,
  1033. hire_duration: this.count, //订单周期
  1034. hire_duration_unit: this.isSelectStatus,
  1035. from: from, //wx ali
  1036. return_type: 1, //还车方式 1直接还 2门店送
  1037. free_order_no: this.out_request_no || '', //免押订单号
  1038. pay_type: pay_type, //0 wx 2 ali
  1039. city: this.myAddress.city,
  1040. address: this.myAddress.address
  1041. }
  1042. // 走钱包支付
  1043. if (pData.pay_type == '9' && (me.wallet_money / 100) >= me.amount) {
  1044. uni.showModal({
  1045. title: '支付提示',
  1046. content: '确认开通租车服务,支付租车费用?',
  1047. cancelText: '取消',
  1048. confirmText: '确定',
  1049. success: function(res) {
  1050. if (res.confirm) {
  1051. me.toPayWxOrAli(pData)
  1052. } else if (res.cancel) {
  1053. common.simpleToast('支付取消')
  1054. }
  1055. },
  1056. fail: function(res) {
  1057. common.simpleToast(res.data.msg)
  1058. },
  1059. complete: function(res) {},
  1060. })
  1061. } else {
  1062. // 走微信支付宝支付
  1063. me.toPayWxOrAli(pData)
  1064. }
  1065. },
  1066. toPayWxOrAli(pData) {
  1067. const me = this
  1068. http.postApi(config.API_DAYHIRE_HIRE_HIRE, pData, (resp) => {
  1069. if (resp.data.code === 200) {
  1070. var order_sn = resp.data.data.order_sn;
  1071. //钱包支付
  1072. const need_pay = resp.data.data.need_pay
  1073. if (!need_pay) {
  1074. common.simpleToast('支付成功')
  1075. setTimeout(function() {
  1076. uni.navigateTo({
  1077. url: '/pages/activation/activation?plate_number=' + me
  1078. .plate_number,
  1079. success: function(res) {},
  1080. fail: function(res) {},
  1081. complete: function(res) {}
  1082. });
  1083. }, 500);
  1084. // setTimeout(function() {
  1085. // uni.navigateTo({
  1086. // url: '/pages/orderStatus/orderStatus?order_sn=' + order_sn +
  1087. // '&longitude=' + me.myLocation.longitude + '&latitude=' + me
  1088. // .myLocation.latitude,
  1089. // success: function(res) {},
  1090. // fail: function(res) {},
  1091. // complete: function(res) {},
  1092. // })
  1093. // },500)
  1094. } else {
  1095. //#ifdef MP-WEIXIN
  1096. var payParams = JSON.parse(resp.data.data.payParams || null);
  1097. user.wxPay(order_sn, payParams, function(isSuccess) {
  1098. if (isSuccess) {
  1099. common.simpleToast('支付成功');
  1100. setTimeout(function() {
  1101. uni.navigateTo({
  1102. url: '/pages/activation/activation?plate_number=' +
  1103. me
  1104. .plate_number,
  1105. success: function(res) {},
  1106. fail: function(res) {},
  1107. complete: function(res) {}
  1108. });
  1109. }, 500);
  1110. } else {
  1111. // 取消支付
  1112. setTimeout(function() {
  1113. uni.navigateTo({
  1114. url: '/pages/orderStatus/orderStatus?order_sn=' +
  1115. order_sn + '&longitude=' + me.myLocation
  1116. .longitude + '&latitude=' + me.myLocation
  1117. .latitude,
  1118. success: function(res) {},
  1119. fail: function(res) {},
  1120. complete: function(res) {},
  1121. })
  1122. }, 500);
  1123. }
  1124. });
  1125. //#endif
  1126. //#ifdef MP-ALIPAY
  1127. my.tradePay({
  1128. tradeNO: resp.data.data.trade_no,
  1129. success: function(res) {
  1130. if (res.resultCode == 9000) {
  1131. common.simpleToast('支付成功')
  1132. setTimeout(function() {
  1133. uni.navigateTo({
  1134. url: '/pages/activation/activation?plate_number=' +
  1135. me
  1136. .plate_number,
  1137. success: function(res) {},
  1138. fail: function(res) {},
  1139. complete: function(res) {}
  1140. });
  1141. }, 500);
  1142. } else {
  1143. setTimeout(function() {
  1144. uni.navigateTo({
  1145. url: '/pages/orderStatus/orderStatus?order_sn=' +
  1146. order_sn + '&longitude=' + me
  1147. .myLocation.longitude +
  1148. '&latitude=' + me.myLocation
  1149. .latitude,
  1150. success: function(res) {},
  1151. fail: function(res) {},
  1152. complete: function(res) {},
  1153. })
  1154. }, 1500);
  1155. }
  1156. },
  1157. fail: function(res) {
  1158. },
  1159. });
  1160. //#endif
  1161. }
  1162. } else {
  1163. common.simpleToast(resp.data.msg)
  1164. }
  1165. })
  1166. },
  1167. queryNoDepositStatus(_out_request_no) {
  1168. const me = this
  1169. me.clearNoDepositStatusTimer();
  1170. me.noDepositStatusTimer = setInterval(function() {
  1171. http.postApi(
  1172. config.API_ALI_FREEZE_STATUS, {
  1173. model_id: me.model_info.model_id,
  1174. out_request_no: _out_request_no
  1175. },
  1176. function(resp) {
  1177. uni.hideLoading();
  1178. if (resp.data.code === 200) {
  1179. const {
  1180. status
  1181. } = resp.data.data
  1182. if (status === 2) {
  1183. common.simpleToast('开通免押金成功,正在前往租续设备~');
  1184. me.clearNoDepositStatusTimer();
  1185. me.setData({
  1186. isOpenNoDeposit: true
  1187. });
  1188. //重新计算价钱
  1189. me.bindDuration();
  1190. setTimeout(function() {
  1191. me.free_order_no = _out_request_no
  1192. if (me.isRenew) {
  1193. me.bindToRenew()
  1194. } else {
  1195. me.bindToPay()
  1196. }
  1197. }, 1500);
  1198. } else if (status === 1 || status === 0) {
  1199. common.simpleToast('查询免押金开通状态中,请稍后~');
  1200. }
  1201. } else {
  1202. common.simpleToast(resp.data.msg);
  1203. me.clearNoDepositStatusTimer();
  1204. }
  1205. }
  1206. );
  1207. }, 1000)
  1208. },
  1209. // 清空查询免押金状态
  1210. clearNoDepositStatusTimer: function() {
  1211. if (this.noDepositStatusTimer == null) {
  1212. return;
  1213. }
  1214. clearInterval(this.noDepositStatusTimer);
  1215. this.noDepositStatusTimer = null;
  1216. },
  1217. getAddress() {
  1218. const pData = {
  1219. pi: "wx_index",
  1220. lng: this.myLocation.longitude,
  1221. lat: this.myLocation.latitude,
  1222. }
  1223. const me = this
  1224. http.postApi(config.API_MAP_REGEO, pData, (resp) => {
  1225. if (resp.data.code === 200) {
  1226. const city = resp.data.data.data.province + resp.data.data.data.city
  1227. const address = resp.data.data.data.address
  1228. me.setData({
  1229. myAddress: {
  1230. city,
  1231. address
  1232. }
  1233. })
  1234. } else {
  1235. common.simpleToast(resp.data.msg)
  1236. }
  1237. })
  1238. },
  1239. navToPage() {
  1240. uni.navigateTo({
  1241. url: '/pages/carReturnStores/carReturnStores?plate_number=' + this.plate_number+'&is_show='+1,
  1242. fail() {}
  1243. })
  1244. },
  1245. bindContractInfo(e) {
  1246. // if (!this.isAgree && this.contract_id == 0) {
  1247. // common.simpleToast('请先点击阅读租赁合同');
  1248. // return;
  1249. // }
  1250. const contract_id = e.currentTarget.dataset.contractid;
  1251. if (this.contract_id == contract_id) {
  1252. this.setData({
  1253. contract_id: 0,
  1254. });
  1255. } else {
  1256. this.setData({
  1257. contract_id: contract_id
  1258. });
  1259. }
  1260. },
  1261. bindContractTo(e) {
  1262. const contract_id = e.currentTarget.dataset.contractid;
  1263. this.setData({
  1264. contract_id: contract_id
  1265. });
  1266. uni.navigateTo({
  1267. url: '/pages/contract/contract?contract_id=' + contract_id,
  1268. success: function(res) {},
  1269. fail: function(res) {},
  1270. complete: function(res) {}
  1271. });
  1272. },
  1273. loadContractTitles() {
  1274. const accountInfo = uni.getAccountInfoSync();
  1275. const me = this;
  1276. http.postApi(
  1277. config.API_CONTRACT_TITLE, {
  1278. appid: accountInfo.miniProgram.appId
  1279. },
  1280. function(resp) {
  1281. if (resp.data.code === 200) {
  1282. const contractInfo = resp.data.data.contractInfo;
  1283. me.setData({
  1284. contractInfo: contractInfo
  1285. });
  1286. }
  1287. }
  1288. );
  1289. },
  1290. blurHandle() {
  1291. this.showInput = false
  1292. this.$nextTick(() => {
  1293. this.showInput = true
  1294. })
  1295. },
  1296. }
  1297. };
  1298. </script>
  1299. <style>
  1300. @import './carIntroduce.css';
  1301. </style>