charge.vue 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387
  1. <template>
  2. <view>
  3. <ujp-navbar title="开始充电" :is-back="isback" ></ujp-navbar>
  4. <!-- 优惠 -->
  5. <view class="discounts" style="padding:0 18px;" v-if="bannerList.length">
  6. <u-swiper bg-color="#fff" :img-mode="'scaleToFill'" height="160" :list="bannerList" @click="clickBanner"
  7. :name="'picUrl'">
  8. </u-swiper>
  9. </view>
  10. <view class="recharge" >
  11. <view class="title">
  12. <view class="left lefttitle">
  13. 请选择充电金额
  14. </view>
  15. <!-- <view class="to-recharge" @click="show=true,recordId='',otherNum_f='',fee=0">
  16. 去充值
  17. </view> -->
  18. </view>
  19. <view class="card"
  20. @click="payValue=0"
  21. :class="{
  22. cardselect:payValue==0,
  23. cardno:payValue!=0
  24. }">
  25. <view class="cardgo" >
  26. <view class="cardinfo">
  27. <img src="@/assets/img/icon_success.png" alt="">
  28. </view>
  29. </view>
  30. <view class="title">先付后退</view>
  31. <p>充电结束后,余额自动退还,不享受会员优惠</p>
  32. <view class="rechargeMain" v-show="payValue==0">
  33. <view class="recharge-item" @click="moneyActiveClass_n=(item.id)"
  34. :class="moneyActiveClass_n == item.id ? 'active' : ''" v-for="(item,index) in moneyListN"
  35. :key="item.id">
  36. {{item.name}}
  37. </view>
  38. </view>
  39. </view>
  40. <view class="card"
  41. @click="paySelectMethod"
  42. :class="{
  43. cardselect:payValue==1,
  44. cardno:payValue!=1
  45. }">
  46. <view class="cardgo" >
  47. <view class="cardinfo">
  48. <img src="@/assets/img/icon_success.png" width="32" alt="">
  49. </view>
  50. </view>
  51. <view class="title">会员账户余额充电</view>
  52. <p>当前余额{{user.balance>0?user.balance.toFixed(2):'0.00'}}元
  53. <span
  54. @click="paySelectShow()"
  55. style="color:#00B962;margin-left: 20px; ">去充值></span>
  56. </p>
  57. <view class="rechargeMain" v-show="payValue==1">
  58. <view @click="moneyClick(-1)" :class="!otherNum&&moneyActiveClass == -1? 'active' : ''" class=" recharge-item ">
  59. 充满自停
  60. </view>
  61. <view class="recharge-item" @click="moneyClick(item.id)"
  62. :class="!otherNum&&moneyActiveClass == item.id ? 'active' : ''" v-for="(item,index) in moneyList"
  63. :key="item.id">
  64. {{item.name}}元
  65. </view>
  66. <view class="recharge-item recharge-item2" :class="otherNum ? 'active' : ''" style="
  67. padding: 1px 0px;">
  68. <u-input v-model="otherNum" @input="ckInput" @focus="focus" type="digit" placeholder="其他充电金额" />
  69. </view>
  70. </view>
  71. </view>
  72. <!-- 优惠券2 -->
  73. <view class="discounts2" v-if="false">
  74. <view class="left lefttitle">
  75. 支付方式
  76. </view>
  77. <view class="right" @click="paySelect=true" style="color:#101010" >
  78. {{payName}}
  79. <view class="iconfont">&#xe600;</view>
  80. </view>
  81. </view>
  82. <view class="discounts2">
  83. <view class="left lefttitle">
  84. 优惠券
  85. </view>
  86. <view class="right" v-if="payValue=='0'">
  87. 先付后退不享受会员优惠活动
  88. </view>
  89. <view class="right" @click="chooseCoupons" v-else-if="selectObj.id">
  90. {{selectObj.threshold == 0 ? '无门槛' : '满'+selectObj.threshold.toFixed(2)+'元可用'}},
  91. <span class="price" v-if="selectObj.classify == '1'||selectObj.classify == '3'">抵扣{{selectObj.value.toFixed(2)}}元</span>
  92. <span class="price" v-if="selectObj.classify == '2'">服务费{{selectObj.value}}折</span>
  93. <view class="iconfont">&#xe600;</view>
  94. </view>
  95. <view class="right" @click="chooseCoupons" v-else-if="listlength">
  96. 未选择,剩余{{listlength}}张优惠券
  97. <view class="iconfont">&#xe600;</view>
  98. </view>
  99. <view class="right" @click="chooseCoupons" v-else>
  100. 无优惠券
  101. <view class="iconfont">&#xe600;</view>
  102. </view>
  103. </view>
  104. <!-- 会员活动 -->
  105. <view class="member" v-if="userCardBool" >
  106. <view class="actively ">
  107. 会员活动
  108. </view>
  109. <view class="right" v-if="payValue=='0'">
  110. 先付后退不享受会员优惠活动
  111. </view>
  112. <view class="type" v-else-if="!vin" style="color: red;" >
  113. vin码不一致
  114. </view>
  115. <view class="type" v-else-if="canUse">
  116. 充电服务费月卡
  117. </view>
  118. <view class="type" style="color: red;" v-else>
  119. 此充电站不支持月卡服务
  120. </view>
  121. </view>
  122. </view>
  123. <view class="bottom">
  124. <view class="botton"
  125. @click="submit"
  126. >开始充电</view>
  127. </view>
  128. <view class="textinfo">
  129. <p>充电说明:</p>
  130. <view>
  131. 1.最终结算金额将以实际充入电量为准;<br/>
  132. 2.充满自停模式需要您的余额不低于10元才可充电;<br/>
  133. 3.充电金额请输入1元~500元的整数。实际充电金额与所选金额会略有出入(一般误差约几分钱);<br/>
  134. 4.完成充电后,在满足条件的情况下,优惠券自动抵扣;提前结束充电则不使用优惠券并返还至您的卡包。<br/>
  135. </view>
  136. </view>
  137. <!-- <view class="but-box" style="margin-bottom: 20px;">
  138. <u-button
  139. style=" background-color: rgba(0, 185, 98, 100);
  140. color: rgba(255, 255, 255, 100);
  141. font-size: 16px;
  142. text-align: center;"
  143. @click="submit" shape="circle">开始充电</u-button>
  144. </view> -->
  145. <u-modal v-model="showmodal"
  146. :show-cancel-button="true"
  147. title="余额不足" confirm-text="前往充值"
  148. content="账户余额不足,充值成功后开始充电" @confirm="show=true"></u-modal>
  149. <!-- 弹窗2 -->
  150. <template >
  151. <view >
  152. <u-popup v-model="paySelect" mode="bottom" >
  153. <view class="paySelect">
  154. <view class="title lefttitle " >选择支付方式</view>
  155. <u-radio-group v-model="payValueTemp">
  156. <p >
  157. <u-radio
  158. name="0"
  159. active-color="#2979f6" shape="circle" size="48">
  160. <p >{{payList[0].name}}<span>({{payList[0].tips}})</span> </p>
  161. </u-radio>
  162. </p>
  163. <p v-if="personInfo.userType=='2'" >
  164. <u-radio
  165. name="1"
  166. active-color="#2979f6" shape="circle" size="48">
  167. <p >{{payList[1].name}}<span>({{payList[1].tips}})</span> </p>
  168. </u-radio>
  169. </p>
  170. <p v-if="false" >
  171. <u-radio
  172. name="2"
  173. active-color="#2979f6" shape="circle" size="48">
  174. <p >{{payList[2].name}}<span>(其他充值金额)</span> </p>
  175. </u-radio>
  176. </p>
  177. </u-radio-group>
  178. </view>
  179. <view class="recharge" style="padding-bottom: 0;">
  180. <view class="recharge-btn transactionClass" style="margin-top: 60px;">
  181. <u-button
  182. class="success-btn" @click="paySelectMethod"
  183. shape="circle" type="success" style="margin-top: 12px;margin-bottom: 16px;">
  184. <span>确定</span>
  185. </u-button>
  186. </view>
  187. </view>
  188. </u-popup>
  189. </view>
  190. </template>
  191. <!-- 弹窗 -->
  192. <template >
  193. <view >
  194. <u-popup v-model="show" mode="bottom" >
  195. <view class="recharge" style="padding-bottom: 0;">
  196. <view class="title lefttitle " >选择充值金额</view>
  197. <p>当前余额{{user.balance>0?user.balance.toFixed(2):'0.00'}}元</p>
  198. <view class="rechargeMain">
  199. <view class="recharge-item" :class="!otherNum_f&&moneyActiveClass_f == item.id ? 'active' : ''"
  200. v-for="(item,index) in moneyList_f" :key="item.id" @click="moneyClick_f(item.id,item)">
  201. {{item.amountDesc?item.amountDesc:item.rechargeAmount+'元'}}
  202. <view class="amount" v-if="item.amountRemark">{{item.amountRemark}}</view>
  203. </view>
  204. </view>
  205. <p class="oldTextjp2" oldstyle="font-size:16px">其他充值金额</p>
  206. <view style="margin-bottom: 32px;">
  207. <view
  208. :class="otherNum_f? 'active' : ''"
  209. class="recharge-input self-stop" style="height: 100%;width: 100%;margin-bottom: 8px;">
  210. <u-input v-model="otherNum_f" @input="ckInput_f" @focus="focus" type="digit" :border="true" />
  211. </view>
  212. <view style="color: rgba(153, 153, 153, 100);
  213. font-size: 12px;
  214. text-align: left;
  215. font-family: AlibabaPuHui-regular;"><span style="color:red">*</span>金额范围为1元-500元</view>
  216. </view>
  217. <view class="recharge-btn transactionClass" style="margin-top: 60px;">
  218. <view >
  219. <u-checkbox-group>
  220. <u-checkbox active-color="green" v-model="checked" shape="circle"></u-checkbox>
  221. </u-checkbox-group>
  222. 我已阅读并同意<span @click="gotoUrl('pages/article/details?code=CZXY')" style="color:#00B962" >《充值协议》</span>
  223. </view>
  224. <u-button
  225. class="success-btn"
  226. shape="circle" type="success" @click="rechargeNow" style="margin-top: 12px;margin-bottom: 16px;">
  227. <span>微信充值</span>
  228. </u-button>
  229. </view>
  230. </view>
  231. </u-popup>
  232. </view>
  233. </template>
  234. </view>
  235. </template>
  236. <script>
  237. import * as API from '@/apis/chargeProcess.js'
  238. import * as userApi from '@/apis/user.js'
  239. import * as newsApi from '@/apis/news.js'
  240. import * as API_finance from '@/apis/finance.js'
  241. import {
  242. wxPayJs
  243. } from '@/utils/wxpay'
  244. import * as Pay from '@/apis/weixin.js'
  245. export default {
  246. data() {
  247. return {
  248. fee:0,
  249. recordId:"",
  250. show2:false,
  251. stationId:"",
  252. elderMode:false,
  253. isback:true,
  254. show: false,
  255. moneyActiveClass_n: "50",
  256. moneyActiveClass: "-1",
  257. moneyActiveClass_f: "-1",
  258. detail: {},
  259. couponsuse:'',
  260. showmodal:false,
  261. //提交信息
  262. //提交信息
  263. submitForm_f: {
  264. //paytype:'YE',
  265. },
  266. submitForm: {
  267. deviceNo: '',
  268. channelNo: '',
  269. carNumber: '',
  270. chargeStrategy: 2,
  271. amount: 0
  272. //paytype:'YE',
  273. },
  274. uuid:0,
  275. user: {},
  276. otherNum_f: '',
  277. otherNum: '',
  278. moneyList_f:[],
  279. paySelect:false,
  280. payName:"",
  281. payValueTemp:0,
  282. payValue:0,
  283. payList:[{
  284. name:"先付后退",
  285. tips:"游客不享受平台优惠活动",
  286. value:"1",
  287. select:false,
  288. },{
  289. name:"个人账户支付",
  290. tips:"享受平台充电8.5折等优惠活动",
  291. value:"2",
  292. select:false,
  293. },{
  294. name:"单位账户支付",
  295. tips:"账户余额:99999元",
  296. value:"3",
  297. select:false,
  298. }],
  299. moneyList: [
  300. {
  301. id: '10',
  302. name: '10'
  303. },
  304. {
  305. id: '20',
  306. name: '20'
  307. },
  308. {
  309. id: '50',
  310. name: '50'
  311. },
  312. {
  313. id: '100',
  314. name: '100'
  315. },
  316. ],
  317. moneyListN: [
  318. {
  319. id: '50',
  320. name: '50元'
  321. },
  322. {
  323. id: '100',
  324. name: '100元'
  325. },
  326. {
  327. id: '150',
  328. name: '150元'
  329. }
  330. ],
  331. userCard:null,
  332. canUse:false,
  333. selectObj:{},
  334. value:"",
  335. // 优惠券
  336. listlength:0,
  337. vin:true,
  338. bannerList:[],
  339. checked:true,
  340. selectItem:{},
  341. personInfo:{},
  342. }
  343. },
  344. computed:{
  345. userCardBool(){
  346. if(this.userCard){
  347. var date=new Date().getTime()
  348. var reg=new RegExp('-','gi')
  349. var str=this.userCard.endTime;
  350. //console.log(str.replace(reg,'/'))
  351. var date2=new Date(str.replace(reg,'/')).getTime();
  352. if(date<date2){
  353. return true;
  354. }
  355. }
  356. return false
  357. }
  358. },
  359. onLoad(op) {
  360. this.personInfo=this.carhelp.getPersonInfo()
  361. // if(plus){
  362. // this.userCard=plus.userCard;
  363. // }
  364. this.uuid=new Date().getTime();
  365. this.stationId= op.stationId;
  366. if (op.deviceNo) {
  367. this.submitForm.deviceNo = op.deviceNo;
  368. this.submitForm.channelNo = op.gun;
  369. this.submitForm.carNumber = op.carNumber;
  370. this.carhelp.setGunIdCharge(this.submitForm);
  371. }
  372. if(op.vin=='no'){
  373. this.vin=false;
  374. }
  375. if(op.isback){
  376. this.isback=false;
  377. }
  378. this.useCoupon()
  379. var couponsuse=this.carhelp.getConfig().couponsuse
  380. // img="https://yktwechat.xiaoxinda.com/config/xxd2021.jpg"
  381. if(couponsuse){
  382. this.couponsuse=couponsuse
  383. }
  384. this.init()
  385. },
  386. onReady(){
  387. this.personInfo=this.carhelp.getPersonInfo()
  388. if(this.personInfo.userType=="1"){
  389. this.payValueTemp=0;
  390. this.payValue=0;
  391. }else{
  392. this.payValueTemp=1;
  393. this.payValue=1;
  394. }
  395. this.payName=this.payList[this.payValue].name;
  396. this.getBannerInfo("charge-start")
  397. this.elderMode = this.carhelp.get('getElderModeClass') == '长辈模式';
  398. if(this.elderMode)
  399. this.theme('elder')
  400. else
  401. this.theme('standard')
  402. },
  403. onShow() {
  404. this.personInfo=this.carhelp.getPersonInfo()
  405. var obj=this.carhelp.get("chooseCoupons");
  406. if(obj){
  407. if(obj.uuid==this.uuid){
  408. this.selectObj=obj.selectObj;
  409. }
  410. }
  411. this.getHomePage()
  412. },
  413. methods: {
  414. paySelectShow(){
  415. if(this.personInfo.userType=="1"){
  416. }else{
  417. this.show=true;
  418. this.recordId='';
  419. this.otherNum_f='';
  420. this.fee=0
  421. }
  422. },
  423. paySelectMethod(){
  424. if(this.personInfo.userType=="1"){
  425. uni.showToast({
  426. title:"游客模式只支持“先付后退”"
  427. })
  428. }else{
  429. this.payValue=1
  430. }
  431. },
  432. moneyClick_f(index,item) {
  433. this.otherNum_f='';
  434. this.moneyActiveClass_f = index;
  435. if(item){
  436. this.selectItem=item;
  437. // if(item.imgUrl){
  438. // this.selectImg=item
  439. // }
  440. }
  441. },
  442. rechargeNow2() {
  443. //先付后退
  444. this.submitForm_f={};
  445. var fee=0;
  446. this.submitForm_f.amount=this.fee;
  447. uni.showLoading({
  448. title: "加载中",
  449. mask: true,
  450. })
  451. if(this.recordId){
  452. this.submitForm_f.recordId=this.recordId
  453. }
  454. //(this.submitForm)
  455. this.wxpy()
  456. },
  457. rechargeNow() {
  458. if(!this.checked){
  459. uni.showToast({
  460. title:"请同意《充值协议》后进行充值"
  461. })
  462. return
  463. }
  464. this.submitForm_f={};
  465. var fee=0;
  466. if(!this.otherNum_f){
  467. this.submitForm_f.chargingMarketingId=this.selectItem.id;
  468. fee=this.selectItem.rechargeAmount
  469. }else{
  470. this.submitForm_f.amount=this.otherNum_f
  471. fee=this.otherNum_f
  472. }
  473. if(this.fee){
  474. var thisfee=this.fee
  475. if(this.fee>parseFloat(fee)){
  476. uni.showToast({
  477. title:`最少充值${thisfee}元才能启动充电`
  478. })
  479. return
  480. }
  481. }
  482. uni.showLoading({
  483. title: "加载中",
  484. mask: true,
  485. })
  486. if(this.recordId){
  487. this.submitForm_f.recordId=this.recordId
  488. }
  489. //(this.submitForm)
  490. this.wxpy()
  491. },
  492. wxpy(){
  493. Pay.wxpay(this.submitForm_f).then((response) => {
  494. if(!response.result){
  495. uni.showToast({
  496. title: response.message
  497. })
  498. return
  499. }
  500. var data = response.data
  501. uni.hideLoading()
  502. //("Pay+"+new Date().getTime())
  503. wxPayJs(data);
  504. }).catch(error => {
  505. uni.showToast({
  506. title: error
  507. })
  508. })
  509. },
  510. focus(){
  511. console.log(0)
  512. uni.pageScrollTo({
  513. scrollTop:999999,
  514. duration:0
  515. })
  516. },
  517. init() {
  518. var data = {
  519. type:2 ,
  520. };
  521. API_finance.marketingData(data).then((res) => {
  522. this.moneyList_f = res.data.chargingMarketingList
  523. if (this.moneyList_f.length > 0) {
  524. this.selectItem = this.moneyList_f[0];
  525. this.moneyActiveClass_f = this.moneyList_f[0].id
  526. //(this.moneyActiveClass)
  527. }
  528. }).catch(error => {
  529. uni.showToast({
  530. title: error
  531. })
  532. })
  533. },
  534. clickBanner(index){
  535. var mod= this.bannerList[index]
  536. if(mod.linkUrl.indexOf('http')==0){
  537. window.location=mod.linkUrl;
  538. }
  539. else if(mod.linkUrl.indexOf('#/')==0){
  540. if(mod.linkUrl.indexOf("?")==-1){
  541. mod.linkUrl+='?';
  542. }
  543. //window.location=mod.linkUrl;
  544. var url=mod.linkUrl.split("#")[1]
  545. //window.location = mod.clickUrl;
  546. uni.navigateTo({
  547. url: url
  548. })
  549. }
  550. else if(mod.linkUrl=='#'||mod.linkUrl==''){
  551. }
  552. else{
  553. uni.navigateTo({
  554. url:mod.linkUrl
  555. })
  556. }
  557. },
  558. getBannerInfo(code){
  559. uni.showLoading({
  560. title: "加载中",
  561. mask: true,
  562. })
  563. newsApi.getBannerInfo(code).then((res) => {
  564. uni.hideLoading();
  565. this.bannerList =res.data;
  566. // document.getElementsByClassName("uni-swiper-wrapper")[0].parentNode.style="background-color: rgb(255, 255, 255); height: 300px;"
  567. }).catch(error => {
  568. uni.showToast({
  569. title: error,icon: "none"
  570. })
  571. })
  572. },
  573. getPile(){
  574. },
  575. theme(type) {
  576. if(type == 'elder')
  577. {
  578. document.getElementsByTagName('body')[0].setAttribute('data-theme',type);
  579. }
  580. else
  581. {
  582. document.getElementsByTagName('body')[0].setAttribute('data-theme',type);
  583. }
  584. },
  585. chooseCoupons(){
  586. this.submitInit()
  587. this.gotoUrl('pages/user/coupon/chooseCoupons?uuid='+this.uuid+"&amount="+this.submitForm.amount+"&stationId="+this.stationId)
  588. },
  589. ckInput_f(text) {
  590. if (text.indexOf('.') > 0) {
  591. var k =text.split(".")[1]
  592. if(k.length>=3){
  593. this.$nextTick(()=>{
  594. text=parseFloat(text).toFixed(2);
  595. this.otherNum_f= text
  596. })
  597. }
  598. }
  599. var t = Number(text);
  600. if (t < 1) {
  601. this.$nextTick(() => {
  602. this.otherNum_f = '';
  603. })
  604. }
  605. if (t > 500) {
  606. this.$nextTick(() => {
  607. this.otherNum_f = 500;
  608. })
  609. }
  610. },
  611. ckInput(text) {
  612. if (text.indexOf('.') > 0) {
  613. this.$nextTick(() => {
  614. this.otherNum = text.substring(0, text.indexOf('.'))
  615. uni.showToast({
  616. title: "请输入正整数"
  617. })
  618. })
  619. }
  620. var t = Number(text);
  621. if (t < 1) {
  622. this.$nextTick(() => {
  623. this.otherNum = '';
  624. })
  625. }
  626. if (t > 500) {
  627. this.$nextTick(() => {
  628. this.otherNum = 500;
  629. })
  630. }
  631. this.selectJudge();
  632. },
  633. moneyClick(index) {
  634. this.otherNum = ''
  635. this.moneyActiveClass = index;
  636. this.selectJudge();
  637. },
  638. selectJudge(){
  639. this.submitInit()
  640. if(this.submitForm.amount==0){
  641. return
  642. }
  643. if(this.selectObj.id&&this.selectObj.threshold>this.submitForm.amount){
  644. uni.showToast({
  645. title:"请重新选择优惠券"
  646. })
  647. this.selectObj={}
  648. }
  649. },
  650. radioChange(e){},
  651. confirm() {
  652. ////(JSON.stringify(this.submitForm))
  653. if(this.payValue!=0){
  654. if(this.selectObj.id){
  655. this.submitForm.userCouponId=this.selectObj.id
  656. }
  657. if(this.userCardBool&&this.canUse&&this.vin){
  658. this.submitForm.userCardId=this.userCard.id
  659. }
  660. }
  661. uni.showLoading({
  662. title: "加载中",
  663. mask: true,
  664. })
  665. //this.submitForm.deviceNo = this.detail.deviceNo;
  666. API.startCarCharging(this.submitForm).then((res) => {
  667. //(JSON.stringify(this.res))
  668. if(res.data.status=="5"){
  669. uni.hideLoading()
  670. if(this.submitForm.payType=="1"){
  671. this.recordId=res.data.recordId;
  672. this.fee=res.data.fee;
  673. this.rechargeNow2()//先付后退
  674. }else{
  675. this.showmodal=true;
  676. this.recordId=res.data.recordId;
  677. var fee=res.data.fee;
  678. this.fee=(fee-this.user.balance).toFixed(2);
  679. this.otherNum_f=this.fee;
  680. }
  681. }else{
  682. this.gotoUrl("pages/searchPile/chargeProcess/dcCharging?id=" + res.data.recordId);
  683. }
  684. }).catch(error => {
  685. uni.hideLoading()
  686. if (error == '用户账户余额不足!') {
  687. } else {
  688. uni.showToast({
  689. title: error
  690. })
  691. }
  692. })
  693. },
  694. getHomePage() {
  695. uni.showLoading({
  696. title: "加载中",
  697. mask: true,
  698. })
  699. API.userCard({
  700. stationId:this.stationId
  701. }).then((res) => {
  702. console.log(res)
  703. this.userCard=res.data.regUserCard
  704. this.canUse=res.data.canUse
  705. //this.user = res.data
  706. API.personalCenter().then((res2) => {
  707. this.user = res2.data
  708. this.isReady = true;
  709. uni.hideLoading()
  710. }).catch(error => {
  711. uni.showToast({
  712. title: error
  713. })
  714. })
  715. }).catch(error => {
  716. uni.showToast({
  717. title: error
  718. })
  719. })
  720. },
  721. useCoupon(){
  722. var obj={
  723. status:0,
  724. stationId:this.stationId,
  725. hideCardCoupon:1
  726. }
  727. if(this.userCardBool) {
  728. obj.userCardId=this.userCard.id
  729. }
  730. userApi.couponList(obj).then((res) => {
  731. this.listlength= res.data.recordsTotal;
  732. //uni.hideLoading()
  733. }).catch(error => {
  734. uni.showToast({
  735. title: error
  736. })
  737. })
  738. },
  739. submitInit(){
  740. if (this.moneyActiveClass == -1 && !this.otherNum) {
  741. this.submitForm.chargeStrategy = 0;
  742. this.submitForm.amount = 0
  743. } else {
  744. this.submitForm.chargeStrategy = 2;
  745. if (this.otherNum) {
  746. this.submitForm.amount = this.otherNum
  747. } else {
  748. this.submitForm.amount = this.moneyActiveClass
  749. }
  750. }
  751. },
  752. submit() {
  753. if (!this.submitForm.channelNo) {
  754. uni.showToast({
  755. title: '请先选择充电通道'
  756. })
  757. return
  758. }
  759. this.submitForm.payType=this.payList[this.payValue].value;
  760. if(this.submitForm.payType=="1"){
  761. this.submitForm.amount = this.moneyActiveClass_n
  762. this.submitForm.chargeStrategy = 2;
  763. }else{
  764. this.submitInit()
  765. }
  766. this.confirm()
  767. },
  768. }
  769. }
  770. </script>
  771. <style>
  772. page {
  773. background-color: #fff;
  774. }
  775. </style>
  776. <style lang="scss" scoped>
  777. .textinfo{
  778. padding: 40rpx;
  779. font-size: 14px !important;
  780. color: #999999;
  781. p{
  782. font-size: 16px !important;
  783. color:#101010;
  784. font-weight: bold;
  785. }
  786. }
  787. .lefttitle{
  788. font-weight: bold;
  789. font-size: 16px
  790. }
  791. @import "@/_theme.scss";
  792. .listlength{
  793. float: right;
  794. padding-right: 10px;
  795. }
  796. /deep/.u-drawer-content{
  797. border-radius: 10px 10px 0 0
  798. }
  799. /deep/.u-radio-group {
  800. width: 100%;
  801. }
  802. /deep/.u-radio {
  803. position: relative;
  804. }
  805. /deep/.u-radio__icon-wrap {
  806. position: absolute;
  807. right: 0;
  808. }
  809. .recharge-item2 {
  810. @include themeify{
  811. font-size: themed('font-size2') !important;
  812. }
  813. /* font-size: 14px !important;*/
  814. color: #999999;
  815. }
  816. .paySelect{
  817. padding: 16px;
  818. .title{
  819. font-size:40rpx
  820. }
  821. p {
  822. width: 100%;
  823. span{
  824. color: #666;
  825. }
  826. .u-radio__label{
  827. color: #333333 ;
  828. }
  829. .u-radio{
  830. width: 100% !important;;
  831. }
  832. color: #333333 ;
  833. margin-top: 16rpx;
  834. font-size:32rpx;
  835. }
  836. }
  837. .recharge {
  838. padding: 16px;
  839. // padding-bottom: 80px;
  840. .title {
  841. @include themeify{
  842. font-size: themed('font-size3');
  843. }
  844. /* font-size: 16px;*/
  845. position: relative;
  846. }
  847. p {
  848. color: #666;
  849. margin-top: 4px;
  850. }
  851. .self-stop.active {
  852. background-color: #EFFFF7;
  853. border-color: #00B962;
  854. color: #00B962;
  855. }
  856. .rechargeMain {
  857. display: flex;
  858. flex-wrap: wrap;
  859. // justify-content: space-between;
  860. margin-top: 12px;
  861. margin-bottom: 5px;
  862. .recharge-item {
  863. .u-input {
  864. text-align: center !important;
  865. }
  866. width: 31%;
  867. border: 1px solid #e3e3e3;
  868. padding: 10px 0;
  869. border-radius: 4px;
  870. text-align: center;
  871. margin-bottom: 10px;
  872. position: relative;
  873. margin-left: 5px;
  874. @include themeify{
  875. font-size: themed('font-size3');
  876. }
  877. /* font-size: 16px;*/
  878. }
  879. .active {
  880. background-color: #EFFFF7;
  881. border-color: #00B962;
  882. color: #00B962;
  883. }
  884. }
  885. .self-stop {
  886. width: 105px;
  887. /* height: 48px;
  888. line-height: 48px;*/
  889. border-radius: 4px;
  890. color: #101010;
  891. @include themeify{
  892. font-size: themed('font-size3');
  893. height:themed('font-size19');
  894. line-height:themed('font-size19')
  895. }
  896. /* font-size: 16px;*/
  897. text-align: center;
  898. font-family: Arial;
  899. border: 1px solid rgba(227, 227, 227, 100);
  900. margin-top: 12px;
  901. }
  902. }
  903. .recharge-input {
  904. margin-top: 8px;
  905. margin-bottom: 32px;
  906. }
  907. .recharge-radio {
  908. margin-top: 10px;
  909. .recharge-radio-item {
  910. display: flex;
  911. align-items: center;
  912. }
  913. .recharge-radio-name {
  914. margin-left: 8px;
  915. }
  916. }
  917. .but-box {
  918. width: 89.3%;
  919. height: 44px;
  920. margin: 0 auto;
  921. position: fixed;
  922. bottom: 0;
  923. right: 0;
  924. left: 0;
  925. }
  926. //优惠券
  927. .discounts {
  928. margin-top: 10px;
  929. width: 100%;
  930. .title {
  931. width: 100%;
  932. .title-1 {
  933. /* height: 22px;*/
  934. color: rgba(16, 16, 16, 100);
  935. @include themeify{
  936. font-size: themed('font-size3');
  937. height:themed('font-size6');
  938. }
  939. /* font-size: 16px;*/
  940. }
  941. .title-2 {
  942. margin-left: 4px;
  943. @include themeify{
  944. font-size: themed('font-size2');
  945. line-height:themed('font-size5');
  946. }
  947. /* font-size: 14px;
  948. line-height: 20px;*/
  949. }
  950. .title-3 {
  951. float: right;
  952. @include themeify{
  953. font-size: themed('font-size3');
  954. line-height:themed('font-size5');
  955. }
  956. /* height: 19px;
  957. font-size: 16px;*/
  958. }
  959. }
  960. .select {
  961. position: relative;
  962. /deep/.u-radio {
  963. padding: 18px 16px;
  964. margin-top: 12px;
  965. width: 100%;
  966. height: 48px;
  967. border-radius: 4px;
  968. background-color: rgba(255, 255, 255, 100);
  969. text-align: center;
  970. border: 1px solid rgba(227, 227, 227, 100);
  971. position: relative;
  972. }
  973. // /deep/.u-radio:nth-child(3) {
  974. //
  975. // }
  976. /deep/.u-radio__icon-wrap {
  977. left: 16px;
  978. background-color: #fff;
  979. }
  980. /deep/.u-radio__label {
  981. margin-left: 40px;
  982. }
  983. }
  984. .explain {
  985. width: 64px;
  986. /* height: 24px;
  987. line-height: 24px;*/
  988. position: absolute;
  989. top: 10px;
  990. right: 12px;
  991. border-radius: 4px;
  992. background-color: rgba(255, 255, 255, 100);
  993. text-align: center;
  994. border: 1px solid rgba(227, 227, 227, 100);
  995. color: rgba(0, 185, 98, 100);
  996. /* font-size: 12px;*/
  997. @include themeify{
  998. font-size: themed('font-size1');
  999. line-height:themed('font-size7');
  1000. height:themed('font-size7');
  1001. }
  1002. }
  1003. }
  1004. // 优惠券2
  1005. .discounts2{
  1006. margin-top: 10px;
  1007. width: 100%;
  1008. display: flex;
  1009. justify-content: space-between;
  1010. .left{
  1011. /* width: 70px;*/
  1012. // height: 20px;
  1013. color: rgba(16, 16, 16, 100);
  1014. /* font-size: 20px;*/
  1015. @include themeify{
  1016. width:160rpx;
  1017. font-size: 40rpx;
  1018. }
  1019. }
  1020. .right{
  1021. /*
  1022. height: 16px;
  1023. line-height: 28px;*/
  1024. color: rgba(255, 61, 0, 100);
  1025. @include themeify{
  1026. font-size: themed('font-size3');
  1027. height: themed('font-size3');
  1028. line-height: themed('font-size9');
  1029. }
  1030. /* font-size: 16px;*/
  1031. text-align: right;
  1032. display: flex;
  1033. }
  1034. .iconfont{
  1035. @include themeify{
  1036. font-size: themed('font-size7');
  1037. line-height: themed('font-size10');
  1038. }
  1039. /* line-height: 29px;*/
  1040. text-align: center;
  1041. color: #b3b3b3;
  1042. /* font-size: 24px;*/
  1043. }
  1044. }
  1045. // 会员活动
  1046. .member{
  1047. margin-top: 20px;
  1048. display: flex;
  1049. justify-content: space-between;
  1050. .actively{
  1051. color: rgba(16, 16, 16, 100);
  1052. font-size: 20px;
  1053. }
  1054. .type{
  1055. color: rgba(16, 18, 18, 100);
  1056. font-size: 16px;
  1057. line-height: 28px;
  1058. padding-right: 10px;
  1059. }
  1060. }
  1061. // 尾部
  1062. .bottom {
  1063. background: #fff;
  1064. width: 100%;
  1065. // height: 64px;
  1066. // line-height: 64px;
  1067. // position: fixed;
  1068. // bottom: 0;
  1069. // left: 0;
  1070. z-index: 999;
  1071. padding: 0px 16px 16px;
  1072. .botton {
  1073. //width: 343px;
  1074. height: 40px;
  1075. line-height: 40px;
  1076. font-size:16px;
  1077. border-radius: 50px;
  1078. background-color: rgba(0, 185, 98, 100);
  1079. color: rgba(255, 255, 255, 100);
  1080. /* font-size: 16px;*/
  1081. // @include themeify{
  1082. // font-size: themed('font-size3');
  1083. // line-height: themed('font-size15');
  1084. // height: themed('font-size15');
  1085. // }
  1086. text-align: center;
  1087. margin: 0 auto;
  1088. }
  1089. }
  1090. .couponsuse{
  1091. color: rgba(153, 153, 153, 100);
  1092. margin-top: 10px;
  1093. font-size: 14px;
  1094. text-align: left;
  1095. font-family: AlibabaPuHui-regular;
  1096. }
  1097. .to-recharge{
  1098. padding: 0 16px;
  1099. line-height: 36px;
  1100. border-radius: 50px 0px 0px 50px;
  1101. background:linear-gradient(#FF9000,#FFB700);
  1102. color: rgba(255, 255, 255, 100);
  1103. font-size: 16px;
  1104. text-align: center;
  1105. position: absolute;
  1106. right: -16px;
  1107. top: 0;
  1108. }
  1109. /deep/.u-checkbox__icon-wrap--checked{
  1110. background-color: #2979ff !important;
  1111. border-color: #2979ff !important;
  1112. }
  1113. .amount {
  1114. // width: 41.9%;
  1115. height: 16px;
  1116. line-height: 15px;
  1117. border-radius: 0px 4px 0px 4px;
  1118. background-color: #ec4530;//rgba(0, 185, 98, 100)
  1119. color: rgba(255, 255, 255, 100);
  1120. font-size: 10px;
  1121. text-align: center;
  1122. position: absolute;
  1123. top: 0;
  1124. right: 0;
  1125. }
  1126. .card {
  1127. padding: 10px;
  1128. margin-top: 10px;
  1129. .title{
  1130. font-weight: bold;
  1131. }
  1132. }
  1133. .cardselect {
  1134. border-radius: 8px;
  1135. border: 2px solid rgba(0, 185, 98, 1);
  1136. .title{
  1137. color:#00B962;
  1138. font-weight: bold;
  1139. }
  1140. .cardgo{
  1141. position: relative;
  1142. .cardinfo{
  1143. background-color: #57ad55;
  1144. width: 64rpx;
  1145. height: 64rpx;
  1146. position: absolute;
  1147. top: -10px;
  1148. right: -10px;
  1149. border-radius: 0 0 0 8px;
  1150. img{
  1151. width: 64rpx;
  1152. }
  1153. }
  1154. }
  1155. }
  1156. .cardno {
  1157. border: 2px solid rgba(204, 204, 204, 1);
  1158. border-radius: 8px;
  1159. .title{
  1160. font-weight: bold;
  1161. }
  1162. .cardgo{
  1163. display: none;
  1164. }
  1165. }
  1166. </style>