purchaseOrder.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093
  1. <template>
  2. <view class="container-view">
  3. <view class="car-info">
  4. <view class="car-top flex-row flex-between">
  5. <view class="top-flex">
  6. <view>{{modelInfo.car_model}}</view>
  7. <view>续航{{modelInfo.endurance}}|重量{{modelInfo.weight}}</view>
  8. <view class="config-list-view">
  9. <view :class="service_list.length>4?'config-list-view-1 flex-row':'flex-row'">
  10. <view class="service_name-tab" v-for=" (item,indexs) in service_list" :key="indexs">
  11. {{item.service_name}}
  12. </view>
  13. </view>
  14. </view>
  15. </view>
  16. <img style="width: 160rpx;height: 160rpx;" :src="modelInfo.model_images[0]" />
  17. </view>
  18. <view class="take-car-time flex-row flex-between">
  19. <view class="flex-row">
  20. <img style="width: 40rpx;height: 40rpx;" src="https://qiniu.bms16.com/FrUjLnCOIJiIRQvYgAsgPnlD0bvG"
  21. alt="">
  22. <view style="margin-left: 16rpx;">取车时间</view>
  23. </view>
  24. <view @tap="tapSelectTime" class="flex-row">
  25. <view style="color: #0074FF;margin-right: 4rpx;" class="">{{takeCar}}</view>
  26. <img style="width: 28rpx;height: 28rpx;" src="https://qiniu.bms16.com/FpbKGisSPfL9r8a7QkZCYXolhu1Y"
  27. alt="">
  28. </view>
  29. </view>
  30. <!-- <view class="car-bottom flex-row flex-between">
  31. <view class="flex-row">
  32. <view>{{takeCar}}</view>
  33. <img src="https://qiniu.bms16.com/FoXmBbj7YGWmjyeuVEY35nzieqnx" />
  34. <view>{{returnCar}}</view>
  35. </view>
  36. <view>共{{leaseTime+rentalUnit}}</view>
  37. </view> -->
  38. </view>
  39. <view class="plan-info">
  40. <view>选择租车方案</view>
  41. <view class="plan-type">
  42. <view :class="price_list.length>3 ? 'plan-type-1 flex-row' :'flex-row' ">
  43. <view @tap="bindChangeStatus" :data-status="indexs" :data-unit="items.hire_duration_unit"
  44. :data-price="items.hire_price"
  45. :class="isSelectStatus == items.hire_duration_unit?'selectedPtype':'selectptype'"
  46. :style="{ 'min-width': (tools.toFixLength(items.hire_price/100) <=3 ? '176rpx' : ((tools.toFixLength(items.hire_price/100)*25.8+130))) + 'rpx' }"
  47. v-for=" (items,indexs) in price_list" :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 class="ptype-title" v-if="items.hire_duration_unit==2">月租</view>
  52. <view class="ptype-title" v-if="items.hire_duration_unit==7">季租</view>
  53. <view
  54. :class="isSelectStatus == items.hire_duration_unit?'ptyped-text flex-row':'ptype-text flex-row'">
  55. <text style="font-size: 40rpx;">¥</text>
  56. <text> {{tools.toFix(items.hire_price/100)}}</text>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="plan-time flex-row flex-between">
  62. <view>租车时长</view>
  63. <view class="quantity-count flex-row">
  64. <view class="total-time flex-row">
  65. <view style="font-weight: 600;margin: 0 10rpx;">{{tools.countToDay(count,isSelectStatus)}}
  66. </view>
  67. <text v-if="isSelectStatus==4">小时</text>
  68. <text v-else>天</text>
  69. </view>
  70. <view @tap.stop.prevent="bindMinus"><img class="count-btn fbtn"
  71. src="https://qiniu.bms16.com/Fm-SCbzVeVHgQK920bmWNvnJnL32" /></view>
  72. <input @input="bindInput" v-if="showInput" @blur="bindBlur" type="number" :value="count" />
  73. <view @tap.stop.prevent="bindAdd"><img class="count-btn sbtn"
  74. src="https://qiniu.bms16.com/FsO-2adBjkUkmk4ENuQco-aK7IyY" /></view>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="method-info">
  79. <view class="flex-row flex-between">
  80. <view style="font_40">取还方式</view>
  81. <!-- <view style="background: #EEF6FF;border-radius: 26rpx;" class="flex-row">
  82. <view @tap="clickSelectMethod" data-status="1" :class="return_type == 1?'to-store selected-tab':'to-store'">自行到店</view>
  83. <view @tap="clickSelectMethod" data-status="2" :class="return_type == 2?'to-door selected-tab':'to-door'">送车上门</view>
  84. </view> 注释原因:送车上门费用未开发-->
  85. </view>
  86. <view class="flex-row shop-view">
  87. <view style="width: 100%;margin-bottom: 24rpx;" class="flex-row flex-between">
  88. <view class="flex-row">
  89. <img style="width: 40rpx;height: 40rpx;"
  90. :src="return_type == 1?'https://qiniu.bms16.com/FpuR_O5a3b-z_X-HXlybF0oUzcZ4':'https://qiniu.bms16.com/Fol9Qf61SZjBupc7wp6rGGf02xl3'"
  91. alt="">
  92. <view v-if="return_type == 1" style="margin-left: 16rpx;">自行去门店取还</view>
  93. <view v-if="return_type == 2" style="margin-left: 16rpx;">商家送车上门</view>
  94. </view>
  95. <view v-if="return_type == 1">门店距离您 <text style="color: #0074FF;">{{distance}}</text> </view>
  96. <view v-if="return_type == 2">取车点距离您 <text style="color: #0074FF;">{{distance}}</text> </view>
  97. </view>
  98. <view @tap="bindToNav" class="shop-bg flex-row flex-between">
  99. <view class="shop-name-view">
  100. <view class="shop-name">{{shopInfo.shop_name}}</view>
  101. <view class="shop-address">{{shopInfo.address}}</view>
  102. </view>
  103. <view class="nav-btn flex-row">
  104. <img style="width: 48rpx;height: 48rpx;" src="https://zxappfile.bms16.com/zx_admin/cab_nav.png"
  105. alt="">
  106. <view style="margin-top: 12rpx;font-size: 24rpx;">导航</view>
  107. </view>
  108. </view>
  109. <!-- <view class="home-second flex-row flex-between">
  110. <view>送车距离:</view>
  111. <view>{{distance}}</view>
  112. </view> -->
  113. </view>
  114. <!-- <view v-if="returnType.length == 2" class="flex-row flex-around">
  115. <view @tap="clickSelectMethod" data-status="1" :class="return_type == 1?'selected-item':'select-item'">
  116. 自行取还
  117. <view :class="return_type == 1?'selected-border':'select-border'"></view>
  118. </view>
  119. <view @tap="clickSelectMethod" data-status="2" :class="return_type == 2?'selected-item':'select-item'">
  120. 送车上门
  121. <view :class="return_type == 2?'selected-border':'select-border'"></view>
  122. </view>
  123. </view>
  124. <view v-else class="flex-row flex-around">
  125. <view @tap="clickNotShow" data-status="1" :class="return_type == 1?'selected-item':'select-item'">
  126. 自行取还
  127. <view :class="return_type == 1?'selected-border':'select-border'"></view>
  128. </view>
  129. <view @tap="clickNotShow" data-status="2" :class="return_type == 2?'selected-item':'select-item'">
  130. 送车上门
  131. <view :class="return_type == 2?'selected-border':'select-border'"></view>
  132. </view>
  133. </view>
  134. <view v-if="return_type == 1" class="method-bottom flex-row">
  135. <img src="https://qiniu.bms16.com/FicUzQgPOVgDC9Mu4QCAA2c-VGBb" />
  136. <view style="width: 75%;">
  137. <view class="bottom-center flex-row flex-between">
  138. <view class="center-text">
  139. <view>{{shopInfo.shop_name}}</view>
  140. <view>{{shopInfo.address}}</view>
  141. </view>
  142. <view @tap="bindToNav" class="bottom-bottom flex-row flex-column" style="align-items: center;">
  143. <img src="https://qiniu.bms16.com/FqCVS_ihJb8IuxeJNGaqC6NKhYMY" />
  144. <view>{{distance}}</view>
  145. </view>
  146. </view>
  147. <view class="ctime flex-row" style="align-items: center;">
  148. <img src="https://qiniu.bms16.com/FlGVpR2fdrD1GfeHfDgt-dUMgkOq" />
  149. {{shopInfo.work_begin_time +'-'+ shopInfo.work_end_time}}
  150. </view>
  151. </view>
  152. </view>
  153. <view v-if="return_type == 2" class="home-delivery">
  154. <view class="home-first flex-row flex-between">
  155. <view class="first-text">
  156. <view>{{shopInfo.shop_name}}</view>
  157. <view>{{shopInfo.address}}</view>
  158. </view>
  159. <view @tap="bindToNav" class="bottom-bottom flex-row flex-column" style="align-items: center;">
  160. <img src="https://qiniu.bms16.com/FqCVS_ihJb8IuxeJNGaqC6NKhYMY" />
  161. <view>{{distance}}</view>
  162. </view>
  163. </view>
  164. <view class="home-second flex-row flex-between">
  165. <view>送车距离</view>
  166. <view>{{distance}}</view>
  167. </view>
  168. </view>
  169. -->
  170. </view>
  171. <view class="deposit-info">
  172. <view>车辆押金</view>
  173. <!-- #ifdef MP-ALIPAY-->
  174. <view v-if="freeze_is_open==1" @tap="clickSelectDeposit" data-status="1" :class="is_freeze == 1?'selected-deposit':'select-deposit'"
  175. style="margin-bottom: 24rpx;">
  176. <view class="deposit-item flex-row" style="align-items: center;">
  177. <img class="select-img"
  178. :src="is_freeze==1?'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq':'https://qiniu.bms16.com/FkmDjxBNZhFGFU5inza2usdtDlX8'" />
  179. <view>支付宝芝麻信用</view>
  180. </view>
  181. <view :class="is_freeze == 1?'blue-text':'black-text'" style="font-size: 32rpx;">免押</view>
  182. </view>
  183. <!-- #endif -->
  184. <view @tap="clickSelectDeposit" data-status="0" :class="is_freeze == 0?'selected-deposit':'select-deposit'">
  185. <view class="deposit-item flex-row">
  186. <img class="select-img"
  187. :src="is_freeze==0?'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq':'https://qiniu.bms16.com/FkmDjxBNZhFGFU5inza2usdtDlX8'" />
  188. <!-- <view>押金租借<text>|还车后退还</text></view> -->
  189. <view>押金租借</view>
  190. </view>
  191. <view :class="is_freeze == 0?'blue-text':'black-text'" style="font-size: 36rpx;">
  192. ¥{{modelInfo.deposit / 100}}</view>
  193. </view>
  194. </view>
  195. <!-- <view class="change-info">
  196. <view class="change-title flex-row flex-between">
  197. <view>关于车辆换电</view>
  198. </view>
  199. <view class="change-border">
  200. <view class="flex-row flex-between" style="margin-bottom: 20rpx;">
  201. <view class="change-top flex-row ">
  202. <img src="https://qiniu.bms16.com/FjJ70vT8ydLEGfeABSFYWFe-zosV" />
  203. <text style="margin-right: 16rpx;">免费换电次数</text><text class="change-num" style="margin: 0 4rpx;">2</text><text class="change-num">次/日</text>
  204. </view>
  205. <view class="change-bottom">共<text>4</text>次</view>
  206. </view>
  207. <view class="change-dec">本单可享4次免费换电数,超出后需要单独支付换电费用</view>
  208. </view>
  209. </view> -->
  210. <view v-if="insurance_setting != null" class="ride-info">
  211. <view class="guarantee-title flex-row flex-between">
  212. <view>骑行保障服务</view>
  213. <view @tap="clickShowInsuranceDesc">保障须知</view>
  214. </view>
  215. <view class="ride-border">
  216. <view class="ride-top flex-row flex-between">
  217. <view class="top-left">
  218. <img src="https://qiniu.bms16.com/FnFvHiZzSKIve3qMEvtTuvtwgRch" />
  219. <text class="content-top">{{insurance_setting.insurance_name}}</text>
  220. </view>
  221. <view class="top-right">¥{{insurance_setting.price / 100}}/天</view>
  222. </view>
  223. <view class="dashed-border" style="margin-top: 20rpx;"></view>
  224. <view v-for="(item,index) in insurance_setting.detail" :key="index">
  225. <view class="ride-tab">
  226. <view class="tab-item flex-row flex-between">
  227. <view class="tab-title">{{item.info}}</view>
  228. <view class="tab-price">{{item.money / 100}}元</view>
  229. </view>
  230. </view>
  231. </view>
  232. </view>
  233. </view>
  234. <view v-if="cancel_setting.length != 0" class="remove-info">
  235. <view>预约取消政策</view>
  236. <view class="remove-title flex-row">
  237. <view>预约取消时间</view>
  238. <view>扣费标准</view>
  239. </view>
  240. <view v-for="(item,index) in cancel_setting" :key="index" class="remove-text flex-row">
  241. <view>支付超过{{item.hour}}小时</view>
  242. <view v-if="item.percent != 0">扣除{{item.percent}}%租金总金额</view>
  243. <view v-else>免费取消</view>
  244. </view>
  245. </view>
  246. <!-- <view class="assort-info">
  247. <view>配套服务</view>
  248. <view class="assort-box flex-row">
  249. <view v-for="(item,index) in service_list" :key="item.service_id" class="assort-text"
  250. :class="{'even-item': index % 2 !== 0, 'odd-item': index % 2 === 0}">
  251. {{item.service_name}}
  252. </view>
  253. </view>
  254. </view> -->
  255. <view class="pay-type flex-row flex-between">
  256. <view class="pay-type-tital">支付方式</view>
  257. <view v-if="wallet_money >= (amount * 100)" class="pay-type-item">
  258. <img src="https://qiniu.bms16.com/Fu_XFiEYY1jhmBVtNVF7fVEiqai0" style="width: 40rpx;height: 40rpx;" />
  259. <view style="padding-left: 10rpx;">钱包支付(¥{{tools.toFix( wallet_money / 100)}})</view>
  260. </view>
  261. <view v-else class="pay-type-item">
  262. <!-- #ifdef MP-WEIXIN -->
  263. <img src="https://qiniu.bms16.com/FnGjQsTOIaEgJsnxfCA8Z89WZdth" style="width: 40rpx;height: 40rpx;" />
  264. <view style="padding-left: 10rpx;">微信支付</view>
  265. <!-- #endif -->
  266. <!-- #ifdef MP-ALIPAY -->
  267. <img src="https://qiniu.bms16.com/Fk4YmG_RbdH0LNo1s8qHKDtpCTXl" style="width: 40rpx;height: 40rpx;" />
  268. <view style="padding-left: 10rpx;">支付宝支付</view>
  269. <!-- #endif -->
  270. </view>
  271. </view>
  272. <view style="height: 224rpx;"></view>
  273. <view v-if="!isShowDetail" class="payment-info">
  274. <!-- <view class="payment-top">
  275. <img :src="isArgee?'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq':'https://qiniu.bms16.com/FkmDjxBNZhFGFU5inza2usdtDlX8'" />
  276. 已阅读并同意
  277. <text>《小众电动车租赁用户协议》</text>
  278. </view> -->
  279. <!-- <view class="payment-top" v-for="(item, index) in contractInfo" :key="index">
  280. <view @tap="bindContractInfo" :data-contractid="item.contract_id" style="display: inline-block">
  281. <img :src="
  282. contract_id!=0 && isAgree
  283. ? 'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq'
  284. : 'https://qiniu.bms16.com/Fh0JH6_QbiXYmVy7FNYnDkVIGvLC'" />
  285. </view>
  286. <view @tap="bindContractInfo" :data-contractid="item.contract_id"
  287. style="display: inline-block; margin-left: 10rpx">已阅读并同意</view>
  288. <view @tap="bindContractTo" style="display: inline-block; color: #0074FF"
  289. :data-contractid="item.contract_id">
  290. 《{{ item.main_title }}》
  291. </view>
  292. </view> -->
  293. <view class="payment-bottom flex-row flex-between">
  294. <view class="bottom-left flex-row">
  295. <allPrice :amount="amount"></allPrice>
  296. <view @tap="bindDetail" class="all-money">明细<img
  297. src="https://qiniu.bms16.com/Fvl1d-AWRvwY_ehNrw7bMZOK6LBZ" /></view>
  298. </view>
  299. <view @tap="navToPage">{{is_freeze==0?'立即支付':'支付·授权免押'}}</view>
  300. </view>
  301. </view>
  302. <view v-else class="show-detail">
  303. <view class="detail-info">
  304. <view class="pay-money">
  305. <view class="flex-row flex-between" style="margin-bottom: 46rpx;">
  306. <view>价格明细</view>
  307. <view>
  308. <image style="width: 32rpx;height: 32rpx;" @tap="isShowDetail = false"
  309. src="https://qiniu.bms16.com/FtoTEHOJiUf_gjPCJGGHMsAtHI5M" />
  310. </view>
  311. </view>
  312. <view class="flex-row flex-between" style="margin-bottom: 44rpx;">
  313. <view>车辆租金</view>
  314. <view>
  315. <!-- ¥{{(leaseTime * price_list[0].hire_price) /100}} -->
  316. ¥{{(price/100)+'x'+count}}
  317. <text v-if="isSelectStatus==4">时</text>
  318. <text v-if="isSelectStatus==1">天</text>
  319. <text v-if="isSelectStatus==6">周</text>
  320. <text v-if="isSelectStatus==2">月</text>
  321. <text v-if="isSelectStatus==7">季</text>
  322. </view>
  323. </view>
  324. <view v-if="freeze_is_open==0||(freeze_is_open==1&&is_freeze==0)" class="flex-row flex-between"
  325. :style="insurance_setting!=null&&insurance_setting.price-0!=0?'margin-bottom: 44rpx;':''">
  326. <view>车辆押金</view>
  327. <view>¥{{modelInfo.deposit /100}}</view>
  328. </view>
  329. <view v-if="insurance_setting!=null&&insurance_setting.price-0!=0" class="flex-row flex-between"
  330. style="margin-bottom: 44rpx;">
  331. <view>骑行保障服务</view>
  332. <view v-if="isSelectStatus==4">{{'¥'+tools.toFix(insurance_setting.price / 100)+'x1天'}}</view>
  333. <view v-if="isSelectStatus==1">{{'¥'+tools.toFix(insurance_setting.price / 100)+'x'+count+'天'}}
  334. </view>
  335. <view v-if="isSelectStatus==6">
  336. {{'¥'+tools.toFix(insurance_setting.price / 100)+'x'+count*7+'天'}}
  337. </view>
  338. <view v-if="isSelectStatus==2">
  339. {{'¥'+tools.toFix(insurance_setting.price / 100)+'x'+count*30+'天'}}
  340. </view>
  341. <view v-if="isSelectStatus==7">
  342. {{'¥'+tools.toFix(insurance_setting.price / 100)+'x'+count*90+'天'}}
  343. </view>
  344. </view>
  345. <view class="detail-money flex-row" style="padding-bottom: 44rpx;">
  346. <view>支付金额</view>
  347. <allPrice :amount="amount"></allPrice>
  348. </view>
  349. </view>
  350. <view class="second">
  351. <!-- <view class="payment-top" v-for="(item, index) in contractInfo" :key="index">
  352. <view @tap="bindContractInfo" :data-contractid="item.contract_id" style="display: inline-block">
  353. <img :src="
  354. contract_id!=0 && isAgree
  355. ? 'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq'
  356. : 'https://qiniu.bms16.com/Fh0JH6_QbiXYmVy7FNYnDkVIGvLC'" />
  357. </view>
  358. <view @tap="bindContractInfo" :data-contractid="item.contract_id"
  359. style="display: inline-block; margin-left: 10rpx">已阅读并同意</view>
  360. <view @tap="bindContractTo" style="display: inline-block; color: #0074FF"
  361. :data-contractid="item.contract_id">
  362. 《{{ item.main_title }}》
  363. </view>
  364. </view> -->
  365. <view class="payment-bottom flex-row flex-between">
  366. <view class="bottom-left flex-row">
  367. <allPrice :amount="amount"></allPrice>
  368. <view @tap="isShowDetail = false" class="all-money">明细<img
  369. src="https://qiniu.bms16.com/FkzZI0r5jO-c2JRahNkZW2pHb9dR" /></view>
  370. </view>
  371. <view @tap="navToPage">{{is_freeze==0?'立即支付':'支付·授权免押'}}</view>
  372. </view>
  373. </view>
  374. </view>
  375. </view>
  376. <calendar ref="calendar" :showPopup.sync="isShowCalendar" @valuesUpdated="handleValuesUpdated"
  377. @close="() => isShowCalendar = false" />
  378. </view>
  379. </template>
  380. <script module="tools" lang="wxs" src="@/pages/common/wxs/tools.wxs"></script>
  381. <script module="tools" lang="sjs" src="@/pages/common/wxs/tools.sjs"></script>
  382. <script>
  383. var config = require('../../common/config.js');
  384. var common = require('../../common/common.js');
  385. var http = require('../../common/http.js');
  386. var storage = require('../../common/storage.js');
  387. var user = require('../../common/user.js');
  388. import allPrice from '@/component/allPrice/allPrice';
  389. import calendar from '@/component/smartCalendar';
  390. import {
  391. MAX_LIMITS
  392. } from '@/common/constant.js';
  393. export default {
  394. components: {
  395. allPrice,
  396. calendar
  397. },
  398. data() {
  399. return {
  400. takeCar: '',
  401. returnCar: '',
  402. leaseTime: '',
  403. // rentalUnit: '',
  404. startDate: '',
  405. desc_city: '',
  406. modelId: '',
  407. modelInfo: {},
  408. shopInfo: {},
  409. service_list: [],
  410. cancel_setting: [],
  411. return_type: 1,
  412. is_freeze: 0,//是否选择免押 1是 0否
  413. freeze_is_open: 0,
  414. distance: '',
  415. longitude: '',
  416. latitude: '',
  417. isSelectGuarantee: 0,
  418. isArgee: false,
  419. from: '',
  420. duration_unit: '',
  421. free_order_no: '', // 免押订单号
  422. contract_id: 0,
  423. contractInfo: [],
  424. insurance_setting: null,
  425. isAgree: false,
  426. amount: '',
  427. price_list: [],
  428. order_sn: '',
  429. out_request_no: '',
  430. isOpenNoDeposit: false, // 是否去开通免押
  431. noDepositStatusTimer: null,
  432. pay_type: 0,
  433. out_request_no: '',
  434. wallet_money: 0, // 用户钱包余额信息
  435. returnType: [], // 数组
  436. isShowDetail: false,
  437. isSelectStatus: 4,
  438. count: 1,
  439. isShowCalendar: false, //选择预约订单时间
  440. showInput: true,
  441. userInfo: {
  442. is_auth: 0,
  443. status: 0
  444. },
  445. };
  446. }
  447. /**
  448. * 生命周期函数--监听页面加载
  449. */
  450. ,
  451. onLoad: function(options) {
  452. //#ifdef MP-WEIXIN
  453. this.is_freeze = 0
  454. //#endif
  455. this.setData({
  456. takeCar: options.takeCar || '',
  457. returnCar: options.returnCar || '',
  458. leaseTime: options.leaseTime || '',
  459. isSelectStatus: options.duration_unit || ''
  460. })
  461. this.modelId = options.modelId || ''
  462. this.longitude = options.longitude || ''
  463. this.latitude = options.latitude || ''
  464. this.desc_city = options.desc_city || ''
  465. this.startDate = options.startDate || ''
  466. // if (this.rentalUnit == '小时') {
  467. // this.duration_unit = 4
  468. // } else if (this.rentalUnit == '天') {
  469. // this.duration_unit = 1
  470. // } else if (this.rentalUnit == '周') {
  471. // this.duration_unit = 6
  472. // }
  473. this.loadCarInfo()
  474. this.loadContractTitles();
  475. this.walletInfo()
  476. },
  477. /**
  478. * 生命周期函数--监听页面显示
  479. */
  480. onShow: function() {
  481. let pages = getCurrentPages();
  482. let currPage = pages[pages.length - 1];
  483. let isAgree = currPage.isAgree
  484. if (isAgree) {
  485. this.setData({
  486. isAgree: isAgree
  487. });
  488. }
  489. var userInfo = storage.getUserInfoData()
  490. if (userInfo) this.userInfo = userInfo.userInfo
  491. },
  492. computed: {
  493. serviceListLength() {
  494. return this.service_list.length;
  495. }
  496. },
  497. methods: {
  498. clickShowInsuranceDesc() {
  499. uni.navigateTo({
  500. url: '/pages/webContent/webContent?webContent=' + this.insurance_setting.illustrate +
  501. '&title=' + '保险须知',
  502. success: function(res) {},
  503. fail: function(res) {},
  504. complete: function(res) {},
  505. })
  506. },
  507. bindToNav() {
  508. const {
  509. address,
  510. latitude,
  511. longitude,
  512. shop_name
  513. } = this.shopInfo
  514. uni.openLocation({
  515. latitude: latitude - 0,
  516. longitude: longitude - 0,
  517. scale: 15,
  518. name: shop_name,
  519. address: address,
  520. success: function(res) {},
  521. })
  522. },
  523. loadCarInfo() {
  524. const me = this
  525. common.loading()
  526. http.postApi(config.API_DAYHIRE_CAR_MODEL_INFO, {
  527. model_id: me.modelId,
  528. longitude: me.longitude,
  529. latitude: me.latitude,
  530. }, (resp) => {
  531. if (resp.data.code === 200) {
  532. uni.hideLoading()
  533. me.freeze_is_open = resp.data.data.freeze_is_open //门店是1否0开启免押配置
  534. //#ifdef MP-ALIPAY
  535. me.is_freeze = resp.data.data.freeze_is_open==0?0:1
  536. //#endif
  537. me.modelInfo = resp.data.data.model_info
  538. me.shopInfo = resp.data.data.shop_info
  539. me.cancel_setting = resp.data.data.cancel_setting
  540. me.distance = common.formatDistance(me.shopInfo.distance - 0)
  541. me.modelInfo.endurance = common.formatDistance(me.modelInfo.endurance - 0)
  542. me.modelInfo.weight = common.formatWeight(me.modelInfo.weight - 0)
  543. me.service_list = resp.data.data.service_list
  544. me.insurance_setting = resp.data.data.insurance_setting
  545. me.returnType = resp.data.data.return_type
  546. me.return_type = resp.data.data.return_type[0]
  547. me.modelInfo.model_images = me.modelInfo.model_images.split(',')
  548. if (resp.data.data.price_list && Array.isArray(resp.data.data.price_list)) {
  549. me.price_list = resp.data.data.price_list
  550. resp.data.data.price_list.forEach(i => {
  551. if (i.hire_duration_unit == me.isSelectStatus) {
  552. me.setData({price:i.hire_price})
  553. // me.price = i.hire_price
  554. }
  555. })
  556. }
  557. me.bindDuration()
  558. } else {
  559. uni.hideLoading()
  560. common.simpleToast(resp.data.msg)
  561. }
  562. })
  563. },
  564. getServiceStyle(index) {
  565. if (index % 2 === 0) {
  566. return {
  567. borderRadius: '16rpx 0 0 16rpx'
  568. };
  569. } else {
  570. return {
  571. borderRadius: '0 16rpx 16rpx 0'
  572. };
  573. }
  574. },
  575. clickSelectMethod(e) {
  576. const status = e.currentTarget.dataset.status
  577. this.setData({
  578. return_type: status
  579. })
  580. },
  581. clickSelectDeposit(e) {
  582. const me = this
  583. const status = e.currentTarget.dataset.status
  584. me.setData({
  585. is_freeze: status
  586. })
  587. me.bindDuration()
  588. },
  589. clickSelectGuarantee(e) {
  590. const status = e.currentTarget.dataset.status
  591. this.setData({
  592. isSelectGuarantee: status
  593. })
  594. },
  595. navToPage(e) {
  596. const me = this
  597. if (this.userInfo.is_auth - 0 == 1 && this.userInfo.status - 0 != 2) {
  598. uni.showModal({
  599. title: '身份认证提示',
  600. content: '尚未完成身份认证,是否进行身份认证?',
  601. cancelText: '取消',
  602. confirmText: '确定',
  603. success: function(res) {
  604. if (res.confirm) {
  605. me.loadFaceToken()
  606. }
  607. },
  608. fail: function(res) {},
  609. complete: function(res) {},
  610. })
  611. return
  612. }
  613. // if (this.contractInfo.length > 0 && (!this.isAgree || this.contract_id == 0)) {
  614. // // if (有合同&&(没查看合同||没勾选同意)) {
  615. // common.simpleToast('请查阅合同')
  616. // return
  617. // }
  618. const isBuyModel= storage.getIsBuyModel()
  619. if(isBuyModel){//TODO
  620. common.simpleToast('您已有租车订单,请先完成订单')
  621. return
  622. }
  623. // if(storage.setIsBuyModel)
  624. //#ifdef MP-ALIPAY
  625. this.bindToPayAli()
  626. //#endif
  627. //#ifdef MP-WEIXIN
  628. this.bindToPayWx()
  629. //#endif
  630. },
  631. loadFaceToken() {
  632. const me = this
  633. http.postApi(config.API_USER_FACE_TOKEN, {}, (resp) => {
  634. if (resp.data.code === 200) {
  635. me.face_token = resp.data.data.token
  636. me.face_key = resp.data.data.key
  637. uni.navigateTo({
  638. url: '/pages/livenessView/livenessView?face_token=' + me.face_token +
  639. '&face_key=' + this.face_key,
  640. success: function(res) {},
  641. fail: function(res) {},
  642. complete: function(res) {},
  643. })
  644. } else {
  645. common.simpleToast(resp.data.msg)
  646. }
  647. })
  648. },
  649. bindToPayAli() {
  650. const me = this
  651. me.from = 'ali'
  652. const money = me.amount * 100
  653. // 默认钱包余额不够支付走支付宝(2)否则走钱包余额类型9
  654. me.pay_type = me.wallet_money < money ? '2' : '9'
  655. if (me.freeze_is_open == 1 && me.is_freeze == 1) { // 等于0表开启免押
  656. if (me.isOpenNoDeposit) {
  657. me.bindToPay()
  658. return
  659. }
  660. http.postApi(config.API_ALI_FREEZE, {
  661. model_id: me.modelInfo.model_id
  662. }, (resp) => {
  663. const params = resp.data.data.params
  664. my.tradePay({
  665. orderStr: params,
  666. success: (res) => {
  667. if (res.resultCode == 9000) {
  668. me.out_request_no = resp.data.data.request_no
  669. me.isOpenNoDeposit = true //开通成功后 不显示去开通免押金
  670. me.bindDuration()
  671. // me.amount = ((me.leaseTime * me.price_list[0].hire_price) + (me.insurance_setting!=null?(me.insurance_setting.price - 0):0)) / 100
  672. me.queryNoDepositStatus(me.out_request_no)
  673. } else {
  674. my.alert({
  675. content: '未成功开通免押金,需支付全部押金',
  676. });
  677. me.is_freeze = 0
  678. me.bindDuration()
  679. me.bindToPay()
  680. }
  681. },
  682. fail: (res) => {
  683. my.alert({
  684. content: '未成功开通免押金!',
  685. });
  686. }
  687. })
  688. })
  689. } else {
  690. me.bindToPay()
  691. }
  692. },
  693. bindToPayWx() {
  694. this.from = 'wx'
  695. this.free_order_no = ''
  696. const money = this.amount * 100
  697. // 默认钱包余额不够支付走微信(0)否则走钱包余额类型9
  698. this.pay_type = this.wallet_money < money ? '0' : '9'
  699. this.bindToPay()
  700. },
  701. bindToPay() {
  702. const me = this
  703. if (me.pay_type == '9' && me.wallet_money >= (me.amount * 100)) {
  704. uni.showModal({
  705. title: '支付提示',
  706. content: '确认使用钱包余额进行支付吗?',
  707. cancelText: '取消',
  708. confirmText: '确定',
  709. success: function(res) {
  710. if (res.confirm) {
  711. me.payMoney()
  712. } else if (res.cancel) {
  713. common.simpleToast('支付取消')
  714. return
  715. }
  716. },
  717. fail: function(res) {
  718. common.simpleToast(res.data.msg)
  719. },
  720. complete: function(res) {},
  721. })
  722. } else {
  723. me.payMoney()
  724. }
  725. },
  726. payMoney() {
  727. const me = this
  728. const begin_time = Math.floor(Date.parse(me.startDate + ':00') / 1000);
  729. http.postApi(config.API_DAYHIRE_HIRE_PREDETERMINE, {
  730. model_id: me.modelId,
  731. hire_duration: me.count, // 周期
  732. hire_duration_unit: me.isSelectStatus, // 周期单位
  733. begin_time: begin_time,
  734. from: me.from,
  735. return_type: me.return_type,
  736. free_order_no: me.free_order_no,
  737. pay_type: me.pay_type,
  738. city: me.desc_city,
  739. address: me.shopInfo.address,
  740. longitude: me.longitude,
  741. latitude: me.latitude,
  742. }, (resp) => {
  743. common.loading()
  744. if (resp.data.code === 200) {
  745. uni.hideLoading()
  746. me.order_sn = resp.data.data.order_sn;
  747. if (me.pay_type == '9') {
  748. common.simpleToast('支付成功')
  749. setTimeout(function() {
  750. uni.navigateTo({
  751. url: '/pages/orderStatus/orderStatus?order_sn=' + me.order_sn,
  752. success: function(res) {},
  753. fail: function(res) {},
  754. complete: function(res) {},
  755. })
  756. }, 500)
  757. } else {
  758. //#ifdef MP-ALIPAY
  759. my.tradePay({
  760. tradeNO: resp.data.data.trade_no,
  761. success: function(res) {
  762. if (res.resultCode == 9000) {
  763. common.simpleToast('支付成功');
  764. }
  765. setTimeout(function() {
  766. uni.navigateTo({
  767. url: '/pages/orderStatus/orderStatus?order_sn=' +
  768. me.order_sn + '&longitude=' + me
  769. .longitude + '&latitude=' + me
  770. .latitude,
  771. success: function(res) {},
  772. fail: function(res) {},
  773. complete: function(res) {}
  774. });
  775. }, 1000);
  776. },
  777. fail: function(res) {
  778. uni.navigateTo({
  779. url: '/pages/orderStatus/orderStatus?order_sn=' + me
  780. .order_sn + '&longitude=' + me.longitude +
  781. '&latitude=' + me.latitude,
  782. success: function(res) {},
  783. fail: function(res) {},
  784. complete: function(res) {}
  785. });
  786. },
  787. })
  788. //#endif
  789. //#ifdef MP-WEIXIN
  790. var payParams = JSON.parse(resp.data.data.payParams);
  791. user.wxPay(me.order_sn, payParams, function(isSuccess) {
  792. if (isSuccess) {
  793. common.simpleToast('支付成功')
  794. // // 跳转激活车辆
  795. // uni.navigateTo({
  796. // url: '/pages/inputLicensePlate/inputLicensePlate?order_sn=' + me.order_sn +'&order_model_id='+me.modelId,
  797. // success: function(res) {},
  798. // fail: function(res) {},
  799. // complete: function(res) {}
  800. // })
  801. setTimeout(function() {
  802. uni.navigateTo({
  803. url: '/pages/orderStatus/orderStatus?order_sn=' +
  804. me.order_sn + '&longitude=' + me
  805. .longitude +
  806. '&latitude=' + me.latitude,
  807. success: function(res) {},
  808. fail: function(res) {},
  809. complete: function(res) {}
  810. });
  811. }, 1000)
  812. } else {
  813. uni.navigateTo({
  814. url: '/pages/orderStatus/orderStatus?order_sn=' + me
  815. .order_sn +
  816. '&longitude=' + me.longitude + '&latitude=' + me
  817. .latitude,
  818. success: function(res) {},
  819. fail: function(res) {},
  820. complete: function(res) {}
  821. });
  822. }
  823. });
  824. //#endif
  825. }
  826. } else {
  827. uni.hideLoading()
  828. common.simpleToast(resp.data.msg)
  829. }
  830. })
  831. },
  832. queryNoDepositStatus(_out_request_no) {
  833. const me = this
  834. me.clearNoDepositStatusTimer();
  835. me.noDepositStatusTimer = setInterval(function() {
  836. http.postApi(
  837. config.API_ALI_FREEZE_STATUS, {
  838. model_id: me.modelInfo.model_id,
  839. out_request_no: _out_request_no
  840. },
  841. function(resp) {
  842. uni.hideLoading();
  843. if (resp.data.code === 200) {
  844. const {
  845. status
  846. } = resp.data.data
  847. if (status === 2) {
  848. common.simpleToast('开通免押金成功,正在前往租赁车辆~');
  849. me.clearNoDepositStatusTimer();
  850. setTimeout(function() {
  851. me.free_order_no = _out_request_no
  852. me.bindToPay()
  853. }, 1500);
  854. } else if (status === 1 || status === 0) {
  855. common.simpleToast('查询免押金开通状态中,请稍后~');
  856. }
  857. } else {
  858. common.simpleToast(resp.data.msg);
  859. me.clearNoDepositStatusTimer();
  860. }
  861. }
  862. );
  863. }, 1000)
  864. },
  865. // 清空查询免押金状态
  866. clearNoDepositStatusTimer: function() {
  867. if (this.noDepositStatusTimer == null) {
  868. return;
  869. }
  870. clearInterval(this.noDepositStatusTimer);
  871. this.noDepositStatusTimer = null;
  872. },
  873. bindContractInfo(e) {
  874. // if (!this.isAgree && this.contract_id == 0) {
  875. // common.simpleToast('请先点击阅读租赁合同');
  876. // return;
  877. // }
  878. const contract_id = e.currentTarget.dataset.contractid;
  879. if (this.contract_id == contract_id) {
  880. this.setData({
  881. contract_id: 0,
  882. });
  883. } else {
  884. this.setData({
  885. contract_id: contract_id
  886. });
  887. }
  888. },
  889. loadContractTitles() {
  890. const accountInfo = uni.getAccountInfoSync();
  891. const me = this;
  892. http.postApi(
  893. config.API_CONTRACT_TITLE, {
  894. appid: accountInfo.miniProgram.appId
  895. },
  896. function(resp) {
  897. if (resp.data.code === 200) {
  898. const contractInfo = resp.data.data.contractInfo;
  899. me.setData({
  900. contractInfo: contractInfo
  901. });
  902. }
  903. }
  904. );
  905. },
  906. bindContractTo(e) {
  907. const contract_id = e.currentTarget.dataset.contractid;
  908. this.setData({
  909. contract_id: contract_id
  910. });
  911. uni.navigateTo({
  912. url: '/pages/contract/contract?contract_id=' + contract_id,
  913. success: function(res) {},
  914. fail: function(res) {},
  915. complete: function(res) {}
  916. });
  917. },
  918. clickNotShow() {
  919. common.simpleToast('门店未开通,不可自选');
  920. },
  921. walletInfo() {
  922. const me = this
  923. http.postApi(config.API_DAYHIRE_USER_WALLET_INFO, {}, function(resp) {
  924. if (resp.data.code === 200) {
  925. me.wallet_money = resp.data.data.balance // 用户钱包余额信息,用于展示用户钱包余额信息。
  926. } else {
  927. common.simpleToast(resp.data.msg)
  928. }
  929. })
  930. },
  931. bindDetail() {
  932. this.isShowDetail = true
  933. },
  934. //计算价格
  935. bindDuration() {
  936. const me = this
  937. var _insurance_price //保险金
  938. const unit_price = (me.price / 100) * me.count //租金
  939. // insurance_setting 保险
  940. if (me.insurance_setting != null) { // 有保险的时候
  941. // isSelectDeposit==0为免押 isOpenNoDeposit为是否成功开通免押 total_money为总金额
  942. // unit_price 租金 insurance_setting.price 保险金 deposit 押金
  943. if (me.isSelectStatus == 4) { // 时
  944. _insurance_price = (me.insurance_setting.price - 0) * 1
  945. } else if (me.isSelectStatus == 6) { // 周
  946. _insurance_price = (me.insurance_setting.price - 0) * 7 * me.count
  947. } else if (me.isSelectStatus == 1) { //天
  948. _insurance_price = (me.insurance_setting.price - 0) * me.count
  949. } else if (me.isSelectStatus == 2) { //月
  950. _insurance_price = (me.insurance_setting.price - 0) * 30 * me.count
  951. } else if (me.isSelectStatus == 7) { //季
  952. _insurance_price = (me.insurance_setting.price - 0) * 90 * me.count
  953. }
  954. } else { // 无保险
  955. _insurance_price = 0
  956. }
  957. if (me.freeze_is_open == 1 &&( me.isOpenNoDeposit || me.is_freeze == 1)) {
  958. // 金额=(周期数*周期价格)+保险金
  959. me.amount = ((me.count * me.price - 0) + (_insurance_price - 0)) / 100
  960. } else {
  961. // 金额=(周期数*周期价格)+押金+保险金
  962. me.amount = ((me.count * me.price - 0) + (me.modelInfo.deposit - 0) + (_insurance_price - 0)) / 100
  963. }
  964. },
  965. bindChangeStatus(e) {
  966. const {
  967. status,
  968. unit,
  969. price
  970. } = e.currentTarget.dataset
  971. this.setData({
  972. isSelectStatus: unit,
  973. selectIndex: status,
  974. price: price,
  975. count: 1
  976. })
  977. this.bindDuration()
  978. },
  979. bindMinus() {
  980. if (this.count > 1) {
  981. this.setData({
  982. count: this.count - 1
  983. });
  984. }
  985. this.bindDuration()
  986. },
  987. blurHandle() {
  988. this.showInput = false
  989. this.$nextTick(() => {
  990. this.showInput = true
  991. })
  992. },
  993. bindInput(e) {
  994. // let count = Number(e.detail.value)
  995. // this.setData({
  996. // count: count,
  997. // })
  998. const num = e.detail.value
  999. this.bindTipCount(num)
  1000. this.bindDuration()
  1001. },
  1002. bindBlur(e) {
  1003. const count = e.detail.value
  1004. this.bindTipCount(count)
  1005. if (count < 1) {
  1006. this.setData({
  1007. count: 1
  1008. })
  1009. }
  1010. this.bindDuration()
  1011. },
  1012. bindAdd() {
  1013. // this.setData({
  1014. // count: this.count + 1
  1015. // });
  1016. const num = this.count - 0 + 1
  1017. this.bindTipCount(num)
  1018. this.bindDuration()
  1019. },
  1020. bindTipCount(num) {
  1021. const limit = MAX_LIMITS[this.isSelectStatus];
  1022. if (limit && num > limit.max) {
  1023. common.simpleToast(limit.message);
  1024. this.setData({
  1025. count: limit.max
  1026. })
  1027. this.blurHandle()
  1028. } else {
  1029. this.setData({
  1030. count: num
  1031. })
  1032. }
  1033. },
  1034. handleValuesUpdated(e) {
  1035. this.takeCar = e.takeCar
  1036. this.returnCar = e.returnCar
  1037. this.leaseTime = e.leaseTime
  1038. this.startDate = e.startDate
  1039. this.isShowCalendar = false;
  1040. },
  1041. tapSelectTime() {
  1042. this.setData({
  1043. isShowCalendar: true
  1044. })
  1045. this.$refs.calendar['leaseType'] = +this.selectType
  1046. this.$nextTick(() => {
  1047. this.$refs.calendar && this.$refs.calendar.setTakeCarData({
  1048. takeCar: this.takeCar,
  1049. dateText: this.startDate.replace('T', ' ')
  1050. })
  1051. })
  1052. },
  1053. }
  1054. };
  1055. </script>
  1056. <style>
  1057. @import './purchaseOrder.css';
  1058. </style>