monthlyCardBuy.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515
  1. <template>
  2. <view>
  3. <ujp-navbar title="服务费包月会员" >
  4. <view class="iconfont service" @click="openModal">
  5. &#xe60d;
  6. </view>
  7. </ujp-navbar>
  8. <!-- 提示 -->
  9. <!-- <template>
  10. <u-alert-tips type="warning" :title="title" :description="description" :show-icon="true"></u-alert-tips>
  11. </template> -->
  12. <!-- 卡片 -->
  13. <view class="main">
  14. <view class="carNone" v-if="!isReady">
  15. <img src="static/img/暂无数据-缺省页.png" alt="">
  16. <p class="" style="color: #bfdfd5;font-size: 18px;">加载中</p>
  17. </view>
  18. <view class="carNone" v-if="isReady&&cardList.length == 0">
  19. <img src="static/img/暂无数据-缺省页.png" alt="">
  20. <p class="" style="color: #bfdfd5;font-size: 18px;">暂无月卡上架</p>
  21. </view>
  22. <view class="user-card" v-if="ispay">
  23. <view class="head-img">
  24. <img style="border-radius: 50px;" v-if="userInfo.headImg" :src="userInfo.headImg" alt="">
  25. <img v-else src="../../assets/img/headPortrait.png" alt="">
  26. </view>
  27. <view class="user-name">
  28. <view class="name">
  29. {{userInfo.realName?userInfo.realName:userInfo.nickName}}
  30. </view>
  31. <view class="sign">
  32. {{userCard&&ispay?userCard.endTime.substring(0,10):''}}到期
  33. </view>
  34. </view>
  35. </view>
  36. <scroll-view class="scroll-view_H" scroll-x="true" :scrollWithAnimation="true" @scroll="scroll"
  37. :scrollLeft="scrollLeftSet" @scrolltoupper="scrolltoupper" @scrolltolower="scrolltolower">
  38. <view class="scroll-view-item_H" v-if="!ispay" v-for="(item,i) in cardList" :key="i">
  39. <view :style="'background-image: url('+item.monthlyRentCard.image+') ;'"
  40. :class="'cardtab card-'+i ">
  41. <view class="tag" v-if="item.monthlyRentCard.isVip">{{item.monthlyRentCard.platformText}}车主
  42. </view>
  43. <view class="tag" v-else-if="item.monthlyRentCard.remark">{{item.monthlyRentCard.remark}}</view>
  44. <view class="price">
  45. <view class="current-price">
  46. <b>{{item.monthlyRentCard.price}}</b><text>元/月</text>
  47. <!-- -->
  48. <p v-if="item.monthlyRentCard.buyNum">{{item.monthlyRentCard.buyNum}}人次购买</p>
  49. </view>
  50. <!-- <view class="original-cost" v-if="item.monthlyRentCard.isVip||item.monthlyRentCard.discount">
  51. 原价 {{item.monthlyRentCard.oldPrice}}元/月
  52. </view> -->
  53. </view>
  54. </view>
  55. </view>
  56. </scroll-view>
  57. </view>
  58. <u-action-sheet :list="list" @click="click" v-model="show"></u-action-sheet>
  59. <u-modal v-model="showModel" :show-cancel-button="true" @cancel="getUserInfo()" @confirm="confirm"
  60. confirm-text="支付成功?" title="扫码支付">
  61. <view style="
  62. text-align: center;
  63. ">
  64. <img id="qrcode2" :src="qrCodeImg">
  65. </view>
  66. <view style="
  67. text-align: center;
  68. ">请使用支付宝扫码</view>
  69. </u-modal>
  70. <u-modal v-model="show1" @confirm="gotoGz" cancel-text="暂不关注" confirm-text="前往关注" confirm-color="#53b56b"
  71. :show-cancel-button="true" ref="uModal2" :asyncClose="true">
  72. <view style="padding: 15px;">请先关注<span style=" color: #53b56b;">{{projectName}}</span>公众号,购买月卡</view>
  73. </u-modal>
  74. <u-modal v-model="infoSet1" @confirm="infoSet1=false,gotoUrl('pages/user/dataSet')" cancel-text="取消"
  75. confirm-text="完善个人信息" confirm-color="#53b56b" :show-cancel-button="true" ref="uModal2" :asyncClose="true">
  76. <view style="padding: 15px;">购买月卡需要完善以下2点<br />
  77. 1.填写真实姓名<br />
  78. 2.填写车牌号<br />
  79. </view>
  80. </u-modal>
  81. <img id="qrcode" style="display: none;">
  82. <!-- 须知 -->
  83. <view class="notice">
  84. <view class="title">
  85. 可享一个月充电服务费<span style="color:#ec4f27">全免</span>
  86. </view>
  87. <view class="line" >
  88. <!-- <view v-show="detail.type==1">· 仅限<b>非运营车</b>车主或<b>新用户</b>购买和使用</view>
  89. <view>· 在指定充电站充电时,此单服务费<b>全免</b></view>
  90. <view>· 不可抵扣电费、停车费、占位费</view> -->
  91. <view class="lineInfo" v-show="detail.type==1" :class="detail.type==1?'lineInfo1':'lineInfo2'" >
  92. <view class="lineSvg">
  93. <img src="@/assets/img/buy/bus2.svg">
  94. </view>
  95. <view class="lineView">
  96. <view class="lineTitle">适用车主</view>
  97. <p class="linep">仅限非运营车车主或新用户购买和使用</p>
  98. </view>
  99. </view>
  100. <view class="lineInfo" v-show="detail.type==2" :class="detail.type==1?'lineInfo1':'lineInfo2'" >
  101. <view class="lineSvg">
  102. <img src="@/assets/img/buy/bus.svg">
  103. </view>
  104. <view class="lineView">
  105. <view class="lineTitle">适用车主</view>
  106. <p class="linep">适合运营车车主购买和使用</p>
  107. </view>
  108. </view>
  109. <view class="lineInfo" :class="detail.type==1?'lineInfo1':'lineInfo2'" >
  110. <view class="lineSvg">
  111. <img src="@/assets/img/buy/fee.svg">
  112. </view>
  113. <view class="lineView">
  114. <view class="lineTitle">充电免服务费</view>
  115. <p class="linep">在指定站点充电时,此单服务费全免</p>
  116. </view>
  117. </view>
  118. <view class="lineInfo" :class="detail.type==1?'lineInfo1':'lineInfo2'" >
  119. <view class="lineSvg">
  120. <img src="@/assets/img/buy/tips.svg">
  121. </view>
  122. <view class="lineView">
  123. <view class="lineTitle">注意事项</view>
  124. <p class="linep">不可抵扣电费、停车费、占位费</p>
  125. </view>
  126. </view>
  127. </view>
  128. <u-divider fontSize="36" border-color="#bbc039" color="#101010">购卡须知</u-divider>
  129. <view class="text">
  130. <view class="num">
  131. 01
  132. </view>
  133. <view class="">
  134. 充电月卡默认与购卡人账户进行关联,所涉权益仅可绑定单个车牌,即账户、月卡、车牌三者关联形成一个权益主体。
  135. </view>
  136. </view>
  137. <view class="text">
  138. <view class="num">
  139. 02
  140. </view>
  141. <view class="">
  142. 充电月卡有效期内,持卡人在指定充电站为绑定车辆充电,可享受充电服务费全免。持卡人给非绑定车辆充电,将正常收取充电服务费。
  143. </view>
  144. </view>
  145. <view class="text">
  146. <view class="num">
  147. 03
  148. </view>
  149. <view class="">
  150. 如车牌等信息填写错误,请致电售后客服进行处理。
  151. </view>
  152. </view>
  153. <view class="text">
  154. <view class="num">
  155. 04
  156. </view>
  157. <view class="">
  158. 本卡一经售出,不支持任何形式的退换。
  159. </view>
  160. </view>
  161. <!-- <view
  162. @click="gotoUrl('pages/monthlyCardActivity/monthlyCardList?cardId='+(ispay?userCard.rentCardId:cardId))">
  163. 适用<br/>
  164. 站点
  165. </view> -->
  166. </view>
  167. <view class="notice2">
  168. <view class="titleHead">适用充电站点</view>
  169. <!-- 附近站点 -->
  170. <view class="station" v-for="(stationData,i) in pageListGetObj.list" :key="i"
  171. @click="gotoUrl('pages/searchPile/stationAndPile/stationDetails?id=' + stationData.id)">
  172. <view class="head">
  173. <view class="title oldTextjp" oldstyle="font-size: 20px;">
  174. {{stationData.name}}
  175. </view>
  176. <view class="distance ">
  177. <!-- <text class="iconfont" style="color:#666666">&#xe615;</text>{{stationData.distance!=null&&stationData.distance>0.1 ? stationData.distance.toFixed(1)+'公里':'小于100米'}} -->
  178. </view>
  179. </view>
  180. <view class="sign" v-if="stationData.stationType==50">
  181. {{stationData.address}}
  182. </view>
  183. <view class="sign" v-else>
  184. <!-- -->
  185. <view class="sign-1"
  186. v-if="stationData.giveDiscount&&stationData.discountRatio&&stationData.discountRatio!=100">
  187. 会员服务费{{discountRatio10(stationData.discountRatio)}}折</view>
  188. <view class="sign-3" v-if="stationData.category=='超充'">160kW超充站</view>
  189. <view class="sign-4"
  190. v-if="stationData.nightLowPriceEnabled">
  191. 夜间超低价</view>
  192. <view class="sign-2" v-if="stationData.tagList.length != 0"
  193. v-for="(tagName,tagIndex) in stationData.tagList" :key="tagIndex">{{tagName}}</view>
  194. </view>
  195. <view class="price-free oldTextClass">
  196. <view class="price" v-if="userInfo&&userInfo.userType==2">
  197. <view class="price-1">
  198. <text class="num">
  199. {{!stationData.giveDiscount ? (stationData.electricityPrice+stationData.servicePrice).toFixed(2)
  200. : (stationData.electricityPrice+stationData.discountServicePrice).toFixed(2)}}</text>
  201. <text class="unit " oldstyle="font-size: 48rpx;">元/度</text>
  202. </view>
  203. <view class="price-2 " oldstyle="font-size: 48rpx;" v-if="stationData.giveDiscount">
  204. <text
  205. class="num">{{(stationData.electricityPrice+stationData.servicePrice).toFixed(2)}}</text>
  206. <text class="unit ">元/度</text>
  207. </view>
  208. </view>
  209. <!-- 游客价格-->
  210. <view class="price" v-else>
  211. <view class="price-1">
  212. <text class="num">
  213. {{(stationData.electricityPrice+stationData.servicePrice).toFixed(2)}}</text>
  214. <text class="unit " oldstyle="font-size: 48rpx;">元/度</text>
  215. </view>
  216. <view class="price-3 " oldstyle="font-size: 48rpx;" v-if="stationData.giveDiscount">
  217. <text class="num1">会员</text>
  218. <text class="num">{{ (stationData.electricityPrice+stationData.discountServicePrice).toFixed(2)}}</text>
  219. <text class="unit ">元/度</text>
  220. </view>
  221. </view>
  222. <view class="free">
  223. <view class="fast" v-if="stationData.fastNum">
  224. <view class="fast-font">
  225. </view>
  226. <view class="num">
  227. {{stationData.fastAvailableNum}}/{{stationData.fastNum}}
  228. </view>
  229. </view>
  230. <view class="slow oldTextjp2" oldstyle="margin-left: 1px;" v-if="stationData.slowNum">
  231. <view class="slow-font">
  232. </view>
  233. <view class="num">
  234. {{stationData.slowAvailableNum}}/{{stationData.slowNum}}
  235. </view>
  236. </view>
  237. </view>
  238. </view>
  239. </view>
  240. <view class="bottom" @click="getPageList(true)"
  241. v-if="pageListGetObj.recordsTotal!=pageListGetObj.list.length">
  242. <view class="bot">
  243. <view class="bot-line"></view>
  244. <view class="bot-text " style="color: #00B962;text-align: center;margin-top: 10px">
  245. 点击查看更多(共{{pageListGetObj.recordsTotal}}站点)</view>
  246. <view class="bot-line"></view>
  247. </view>
  248. </view>
  249. <view class="bottom" v-else>
  250. <view class="bot">
  251. <view class="bot-line"></view>
  252. <view class="bot-text " style="color: #00B962;text-align: center;margin-top: 10px;">已经到底了</view>
  253. <view class="bot-line"></view>
  254. </view>
  255. </view>
  256. <view class="upupupView" v-show="flag==1">
  257. <view class="upupupImg">
  258. <img src="@/assets/img/upupup.svg">
  259. </view>
  260. <p>上划查看更多内容</p>
  261. </view>
  262. </view>
  263. <!-- 按钮 -->
  264. <view class="button" v-if="!ispay">
  265. <button class="btn " v-if="userInfo.userType=='1'">游客无法购买月卡
  266. </button>
  267. <button class="btn " v-else-if="!isReady">加载中
  268. </button>
  269. <button class="btn " v-else-if="ispay"> {{userCard&&ispay?userCard.endTime:''}}到期
  270. </button>
  271. <button class="btn " v-else-if="!endCardBool">已下架
  272. </button>
  273. <button class="btn " v-else-if="!show2" @click="gotoGz">关注公众号
  274. </button>
  275. <button class="btn " v-else-if="!infoSet" @click="gotoUrl('pages/user/dataSet')">完善个人信息
  276. </button>
  277. <button class="btn " v-else-if="!cardList.length" @click="putShelf">已下架
  278. </button>
  279. <button class="btn " @click="show = true" v-else-if="detail.isVip">
  280. <text style="font-size: 14px;">¥</text>
  281. <span>{{detail.price}}</span>
  282. <text class="price">{{detail.oldPrice}}</text>开通充电月卡
  283. <view class="position">
  284. <view id="talkbubble">{{detail.platformText}}车主</view>
  285. </view>
  286. </button>
  287. <button class="btn " @click="show = true" v-else>
  288. <text style="font-size: 14px;"></text>
  289. <span style="margin-right: 8px;">{{detail.price}}元</span>
  290. <text v-if="detail.discount" class="price">{{detail.oldPrice}}</text> 开通服务费包月会员
  291. <view class="position" v-if="detail.remark2">
  292. <view id="talkbubble">{{detail.remark2}}</view>
  293. </view>
  294. </button>
  295. <view class="hint">
  296. 开通表示阅读并同意<span @click="gotoUrl('pages/article/details?code=FWFZKXY')"
  297. style="text-decoration:underline;color: #C07C38;">《服务费折扣协议》</span>
  298. </view>
  299. </view>
  300. <u-modal v-model="show3" @confirm="confirmPhone" confirm-text="拨打电话" confirm-color="#606266"
  301. :show-cancel-button="true" ref="uModal" :asyncClose="true" title="客服电话" :content="consumerPhone"
  302. :content-style="{fontSize: '24px',color: '#101010'}"></u-modal>
  303. </view>
  304. </template>
  305. <script>
  306. import * as API_weixin from '@/apis/weixin.js'
  307. import * as API_site from '@/apis/site.js';
  308. import * as Pay from '@/apis/weixin.js'
  309. import * as API from '@/apis/card.js'
  310. import * as loginApi from '@/apis/login.js'
  311. import Tabbar from '@/components/Tabbar.vue';
  312. import QRCode from 'qrcodejs2'
  313. import {
  314. newDate,
  315. convertCanvasToImage,
  316. } from '@/utils'
  317. import {
  318. wxPayJs
  319. } from '@/utils/wxpay'
  320. export default {
  321. components: {
  322. Tabbar
  323. },
  324. data() {
  325. return {
  326. description: '盟主能量包本期限时优惠活动将于9月16日结束。',
  327. checked: "false",
  328. cardId: '',
  329. qrCodeImg: "",
  330. showModel: false,
  331. cardList: [],
  332. pageList: [],
  333. projectName: "",
  334. list: [{
  335. text: '微信',
  336. }, {
  337. text: '支付宝'
  338. }],
  339. show: false,
  340. submitForm: {},
  341. ykgz: '',
  342. detail: {},
  343. ispay: false,
  344. show3: false,
  345. show2: false,
  346. show1: false,
  347. infoSet: false,
  348. infoSet1: false,
  349. userCard: null,
  350. isReady: false,
  351. userInfo: {},
  352. elderStatus: false,
  353. consumerPhone: "",
  354. scrollLeftSet: 0,
  355. scrollLeftOldSet: 0,
  356. scrollLeftSetBl: false,
  357. flag: 0, //0 初始化, 1 ,开始判断, 2已经滑动
  358. }
  359. },
  360. onLoad() {
  361. this.projectName = process.car.ProjectName;
  362. },
  363. onReady() {
  364. var consumerPhone = this.carhelp.getConfig().consumerPhone
  365. // img="https://yktwechat.xiaoxinda.com/config/xxd2021.jpg"
  366. if (consumerPhone) {
  367. this.consumerPhone = consumerPhone
  368. }
  369. this.ykgz = this.carhelp.getConfig().ykgz
  370. //this.checkSubscribe()
  371. },
  372. onShow() {
  373. if (this.carhelp.get("getElderModeClass") == "长辈模式") {
  374. this.elderStatus = true;
  375. } else {
  376. this.elderStatus = false;
  377. }
  378. if (this.$refs.tabbarMain) {
  379. this.$refs.tabbarMain.setcount(1);
  380. }
  381. this.checkSubscribe();
  382. // this.getCardList();
  383. // this.show2 = true;
  384. },
  385. computed: {
  386. pageListGetObj() {
  387. var cardId = this.cardId
  388. if (this.ispay) {
  389. cardId = this.userCard.rentCardId;
  390. }
  391. var i = this.pageList.findIndex(item => {
  392. return item.monthlyRentCardId == cardId
  393. })
  394. if (i == -1)
  395. return {
  396. list: []
  397. }
  398. else
  399. return this.pageList[i]
  400. },
  401. endCardBool() {
  402. if (!this.cardList.length) {
  403. return false;
  404. }
  405. var date = new Date().getTime()
  406. if (!this.detail.endTime) {
  407. return true;
  408. }
  409. var date2 = newDate(this.detail.endTime).getTime();
  410. if (date < date2) {
  411. return true;
  412. } else {
  413. return false;
  414. }
  415. }
  416. },
  417. onPageScroll(e) {
  418. if (this.flag == 1) {
  419. if (e.scrollTop >= 50) {
  420. this.flag = 2;
  421. } else {
  422. }
  423. }
  424. },
  425. methods: {
  426. scrolltolower: function(e) {
  427. //
  428. },
  429. scrolltoupper: function(e) {
  430. //this.scrollLeftSetBl=false;
  431. },
  432. scroll: function(e) {
  433. if (this.scrollLeftSetBl) {
  434. return
  435. }
  436. this.scrollLeftSetBl = true;
  437. var scrollWidth = e.detail.scrollWidth
  438. if (e.detail.deltaX > 0) {
  439. //右移动
  440. this.scrollLeftSet = 0;
  441. this.checkboxChange(this.cardList[0].monthlyRentCard)
  442. } else {
  443. //左移动
  444. this.scrollLeftSet = scrollWidth
  445. if (this.cardList.length > 1) {
  446. this.checkboxChange(this.cardList[1].monthlyRentCard)
  447. }
  448. }
  449. this.scrollLeftSetBl = false;
  450. //this.old.scrollTop = e.detail.scrollTop
  451. this.scrollLeftOldSet = e.detail.scrollLeft
  452. },
  453. confirmPhone() {
  454. this.show = false;
  455. uni.makePhoneCall({
  456. phoneNumber: this.consumerPhone //仅为示例
  457. });
  458. },
  459. openModal() {
  460. this.show3 = true;
  461. },
  462. checkboxChange(monthlyRentCard) {
  463. this.detail = monthlyRentCard;
  464. this.cardId = monthlyRentCard.id
  465. monthlyRentCard.checked = true
  466. for (var i in this.cardList) {
  467. var obj = this.cardList[i].monthlyRentCard;
  468. if (this.cardId == obj.id) {
  469. } else {
  470. obj.checked = false
  471. }
  472. }
  473. this.getPageList(false);
  474. },
  475. gotoGz() {
  476. this.carhelp.setGzDate()
  477. var url = "https://mp.weixin.qq.com/s/mCHz1nNvg0xAICiBeIyKRQ";
  478. window.location.href = url
  479. },
  480. checkSubscribe() {
  481. uni.showLoading({
  482. title: "加载中",
  483. mask: true,
  484. })
  485. API_weixin.checkSubscribe({
  486. openId: this.carhelp.getOpenId()
  487. }).then((res) => {
  488. uni.hideLoading()
  489. if (res.data == "0") {
  490. this.show1 = true
  491. } else {
  492. //this.getInfo();
  493. this.getCardList();
  494. this.show2 = true;
  495. //this.carhelp.setGzDate()
  496. }
  497. //setGzDate
  498. }).catch(error => {
  499. uni.showToast({
  500. title: error
  501. })
  502. })
  503. },
  504. userCardBool(userCard) {
  505. if (userCard) {
  506. var date = new Date().getTime()
  507. var date2 = newDate(userCard.endTime).getTime();
  508. if (date < date2) {
  509. return true;
  510. }
  511. }
  512. return false
  513. },
  514. getCardList() {
  515. uni.showLoading({
  516. title: "加载中",
  517. mask: true,
  518. })
  519. API.cardList({
  520. }).then((response) => {
  521. this.cardList = response.data.cardList;
  522. for (var i in this.cardList) {
  523. var obj = this.cardList[i].monthlyRentCard
  524. //不打折的卡
  525. obj.remark2 = obj.remark;
  526. if (obj.oldPrice) {
  527. if (!obj.discount && obj.couponRemark) {
  528. obj.remark2 = obj.couponRemark
  529. if (!obj.remark) {
  530. obj.remark = "月卡优惠券"
  531. }
  532. }
  533. obj.discount = true
  534. }
  535. }
  536. if (this.cardList.length) {
  537. this.detail = this.cardList[0].monthlyRentCard
  538. this.cardId = this.detail.id;
  539. this.cardList[0].monthlyRentCard.checked = true
  540. if (this.pageList.length == 0) {
  541. this.pageList = this.cardList.map(item => {
  542. return {
  543. recordsTotal: -1,
  544. monthlyRentCardId: item.monthlyRentCard.id,
  545. list: [],
  546. pageIndex: 1,
  547. }
  548. })
  549. this.getPageList(false);
  550. }
  551. //this.pageList.map(item)
  552. }
  553. this.getUserInfo()
  554. this.isReady = true;
  555. //cardId: this.cardId
  556. }).catch(error => {
  557. uni.showToast({
  558. title: error
  559. })
  560. })
  561. },
  562. getPageList(bl) {
  563. var cardId = this.cardId
  564. if (this.ispay) {
  565. cardId = this.userCard.rentCardId;
  566. }
  567. var i = this.pageList.findIndex(item => {
  568. return item.monthlyRentCardId == cardId
  569. })
  570. var data = {
  571. monthlyRentCardId: cardId,
  572. online: 0,
  573. pageSize: 6,
  574. }
  575. if (this.carhelp.getPersonInfo()) {
  576. data.openId = this.carhelp.getOpenId()
  577. }
  578. if (i > -1) {
  579. if (bl) {
  580. this.pageList[i].pageIndex += 1;
  581. } else {
  582. if (this.pageList[i].recordsTotal == -1) {
  583. } else {
  584. return
  585. }
  586. }
  587. data.pageIndex = this.pageList[i].pageIndex
  588. } else {
  589. return
  590. }
  591. uni.showLoading({
  592. title: "加载中",
  593. mask: true,
  594. })
  595. var list = this.pageList[i].list;
  596. API_site.getChargingStationData(data).then((response) => {
  597. console.log(response)
  598. list = [
  599. ...list,
  600. ...response.data.data
  601. ];
  602. this.pageList[i].recordsTotal = response.data.recordsTotal;
  603. this.pageList[i].list = list;
  604. uni.hideLoading()
  605. }).catch(error => {
  606. uni.showToast({
  607. title: error
  608. })
  609. })
  610. },
  611. getUserInfo() {
  612. uni.showLoading({
  613. title: "加载中",
  614. mask: true,
  615. })
  616. loginApi.findByOpenId({
  617. openId: this.carhelp.getOpenId(),
  618. noerror: true
  619. }).then((res) => {
  620. if (res.code == 200 && res.result) {
  621. if (res.data.regUser) {
  622. var userInfo = res.data.regUser
  623. this.userInfo = userInfo;
  624. if (userInfo.userType == "1") {
  625. } else if (userInfo.carId && userInfo.realName) {
  626. this.infoSet = true;
  627. } else {
  628. this.infoSet = false;
  629. if (this.endCardBool) {
  630. this.infoSet1 = true;
  631. }
  632. }
  633. var userCard = res.data.userCard;
  634. this.userCard = userCard
  635. this.ispay = this.userCardBool(userCard)
  636. } else {
  637. }
  638. if (this.flag == 0) {
  639. this.flag = 1;
  640. setTimeout(() => {
  641. this.flag = 2;
  642. }, 5000)
  643. }
  644. }
  645. uni.hideLoading();
  646. }).catch(error => {
  647. uni.showToast({
  648. title: error,
  649. icon: "none"
  650. })
  651. })
  652. },
  653. putShelf2() {
  654. uni.showToast({
  655. title: "暂不支持重复购买"
  656. })
  657. },
  658. putShelf() {
  659. uni.showToast({
  660. title: "已下架,暂不支持购买"
  661. })
  662. },
  663. getInfo() {
  664. uni.showLoading({
  665. title: "加载中",
  666. mask: true,
  667. })
  668. API.cardDetail({
  669. cardId: this.cardId
  670. }).then((response) => {
  671. this.detail = response.data.monthlyRentCard
  672. uni.hideLoading()
  673. }).catch(error => {
  674. uni.showToast({
  675. title: error
  676. })
  677. })
  678. },
  679. submit(type) {
  680. if (!this.endCardBool) {
  681. return
  682. }
  683. uni.showLoading({
  684. title: "加载中",
  685. mask: true,
  686. })
  687. API.openCard({
  688. cardId: this.cardId
  689. }).then((response) => {
  690. this.submitForm.id = response.data.orderInfoId
  691. if (type == 0) {
  692. this.wxpy()
  693. }
  694. if (type == 1) {
  695. this.alpy()
  696. }
  697. }).catch(error => {
  698. uni.showToast({
  699. title: error
  700. })
  701. })
  702. },
  703. alpy() {
  704. uni.showLoading({
  705. title: "加载中",
  706. mask: true,
  707. })
  708. var listcanvas = document.getElementsByTagName('canvas')
  709. if (listcanvas.length > 0) {
  710. document.getElementById("qrcode").removeChild(document.getElementsByTagName('canvas')[0]);
  711. }
  712. Pay.alpay(this.submitForm).then((response) => {
  713. let qrcode = new QRCode('qrcode', {
  714. width: 200,
  715. height: 200,
  716. text: response.data.qr_code,
  717. correctLevel: QRCode.CorrectLevel.M,
  718. })
  719. this.outOrderNo = response.data.outOrderNo;
  720. var canvas = document.getElementsByTagName('canvas')[0];
  721. this.qrCodeImg = convertCanvasToImage(canvas);
  722. uni.hideLoading()
  723. this.showModel = true
  724. }).catch(error => {
  725. uni.showToast({
  726. title: error
  727. })
  728. })
  729. },
  730. wxpy() {
  731. Pay.wxpay(this.submitForm).then((response) => {
  732. if (!response.result) {
  733. uni.showToast({
  734. title: response.message
  735. })
  736. return
  737. }
  738. var data = response.data
  739. uni.hideLoading()
  740. //("Pay+"+new Date().getTime())
  741. wxPayJs(data);
  742. }).catch(error => {
  743. uni.showToast({
  744. title: error
  745. })
  746. })
  747. },
  748. confirm() {
  749. this.getUserInfo();
  750. uni.redirectTo({
  751. url: "/pages/user/finance/rechargeRes?id=" + this.outOrderNo
  752. })
  753. },
  754. click(index) {
  755. console.log(`点击了第${index + 1}项,内容为:${this.list[index].text}`)
  756. this.submit(index);
  757. }
  758. }
  759. }
  760. </script>
  761. <style>
  762. @keyframes movepoint {
  763. 25% {
  764. top: 10px;
  765. }
  766. 100% {
  767. top: 15px;
  768. }
  769. }
  770. .upupupImg {
  771. height: 80px;
  772. }
  773. .upupupView {
  774. text-align: center;
  775. font-size: 12px;
  776. padding: 30rpx;
  777. border-radius: 12px;
  778. position: absolute;
  779. background: rgb(0 0 0 / 70%);
  780. top: 50%;
  781. transform: translate(-50%);
  782. left: 50%;
  783. color: #fff;
  784. }
  785. .upupupView img {
  786. top: 15px;
  787. position: relative;
  788. width: 60px;
  789. animation: movepoint 2s infinite;
  790. -webkit-animation: movepoint 2s infinite;
  791. }
  792. </style>
  793. <style lang="scss" scoped>
  794. .scroll-Y {
  795. height: 300rpx;
  796. }
  797. .scroll-view_H {
  798. white-space: nowrap;
  799. width: 100%;
  800. }
  801. .scroll-view-item {
  802. height: 300rpx;
  803. line-height: 300rpx;
  804. text-align: center;
  805. font-size: 36rpx;
  806. }
  807. .scroll-view-item_H {
  808. display: inline-block;
  809. width: 85%;
  810. //height: 300rpx;
  811. line-height: 300rpx;
  812. text-align: center;
  813. font-size: 36rpx;
  814. }
  815. .service {
  816. font-size: 24px;
  817. //color: #fff;
  818. position: absolute;
  819. right: 16px;
  820. }
  821. /deep/.u-alert-desc {
  822. color: #ff7300;
  823. }
  824. // 卡片
  825. .main {
  826. background-color: #404A5E;
  827. padding: 40rpx 0 0 0;
  828. z-index: 80;
  829. .tag {
  830. position: absolute;
  831. background-color: rgba(255, 61, 0, 100);
  832. color: #ffffff;
  833. font-size: 24rpx;
  834. text-align: center;
  835. line-height: 40rpx;
  836. padding: 0 12rpx;
  837. right: 26rpx;
  838. top: 0rpx;
  839. border-radius: 0 12px 0 12px;
  840. }
  841. // @media screen and (max-width:320px) {
  842. // .tag {
  843. // padding: 0 4rpx;
  844. // }
  845. // .price {
  846. // position: absolute;
  847. // top: 24rpx !important;
  848. // right: 32rpx !important;
  849. // }
  850. // .current-price {
  851. // font-size: 36rpx;
  852. // }
  853. // }
  854. .price {
  855. top: -90rpx;
  856. right: 76rpx;
  857. position: absolute;
  858. p {
  859. text-align: right;
  860. color: rgba(0, 0, 0, 0.5);
  861. font-size: 12px;
  862. position: relative;
  863. top: -250rpx;
  864. }
  865. }
  866. .current-price {
  867. font-size: 48rpx;
  868. color: #101010;
  869. text-align: right;
  870. text {
  871. font-size: 28rpx;
  872. }
  873. }
  874. .original-cost {
  875. color: rgba(75, 65, 50, 100);
  876. text-decoration: line-through;
  877. margin-bottom: 6rpx;
  878. }
  879. /deep/.u-iconfont {
  880. font-size: 36rpx !important;
  881. }
  882. .card-0 {}
  883. .card-0 {
  884. background-position-x: 40rpx;
  885. }
  886. .cardtab {
  887. margin-top: 32rpx;
  888. position: relative;
  889. background-size: 90% 100%;
  890. background-repeat: no-repeat;
  891. height: 200rpx;
  892. /deep/.u-checkbox__icon-wrap {
  893. background-color: #607d8b;
  894. opacity: 0.3
  895. }
  896. .radio-box {
  897. position: absolute;
  898. right: 0;
  899. bottom: 40rpx;
  900. }
  901. }
  902. }
  903. // 按钮
  904. .button {
  905. position: fixed;
  906. margin-top: -20rpx;
  907. width: 100%;
  908. bottom: 40px;
  909. border-radius: 16px 16px 0px 0px;
  910. padding: 20px 20px 24px 20px;
  911. background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.75) 67%, rgba(255, 255, 255, 1) 84%);
  912. uni-button:after {
  913. border: none;
  914. }
  915. .btn {
  916. border: none !important;
  917. background: linear-gradient(#D8A05B, #C07C38);
  918. box-shadow: 0px 2px 6px 0px rgba(207, 175, 118, 40);
  919. border-radius: 50px;
  920. color: #FFF;
  921. font-size: 18px !important;
  922. line-height: 44px;
  923. height: 44px;
  924. overflow: inherit !important;
  925. .price {
  926. text-decoration: line-through;
  927. margin: auto 4px;
  928. font-size: 12px
  929. }
  930. }
  931. .hint {
  932. color: rgba(159, 157, 154, 100);
  933. line-height: 20px;
  934. text-align: center;
  935. margin-top: 8px;
  936. }
  937. .btn-2 {
  938. position: relative;
  939. }
  940. .position {
  941. position: absolute;
  942. top: -16px;
  943. left: 24%;
  944. z-index: 999;
  945. }
  946. #talkbubble {
  947. position: absolute;
  948. top: 0;
  949. left: 0;
  950. padding: 0 10px;
  951. line-height: 20px;
  952. font-size: 12px;
  953. color: #fff;
  954. background: red;
  955. position: relative;
  956. border-radius: 10px;
  957. text-align: center;
  958. }
  959. #talkbubble:before {
  960. content: "";
  961. position: absolute;
  962. top: 100%;
  963. //right: 45%;
  964. border-top: 5px solid red;
  965. border-right: 5px solid transparent;
  966. border-left: 5px solid transparent;
  967. }
  968. }
  969. .notice2 {
  970. padding: 0 0 120px 0;
  971. .titleHead {
  972. color: #101010;
  973. font-size: 40rpx;
  974. text-align: center;
  975. margin-bottom: 10px;
  976. }
  977. }
  978. // 须知
  979. .notice {
  980. top: -15px;
  981. border-radius: 15px 15px 0 0;
  982. position: relative;
  983. .title {
  984. color: rgba(51, 51, 51, 1);
  985. font-size: 40rpx;
  986. text-align: center;
  987. margin-bottom: 30rpx;
  988. }
  989. .line {
  990. margin-bottom: 40rpx;
  991. color: #666666;
  992. font-size: 34rpx;
  993. line-height: 52rpx;
  994. .lineInfo1{
  995. border: 1px solid #D5C5B5;
  996. background-color: #fef9f5;
  997. }
  998. .lineInfo2{
  999. border: 1px solid #79ACDB ;
  1000. background-color: #ffffff;
  1001. }
  1002. .lineInfo{
  1003. margin-right: 20rpx;
  1004. display: flex;
  1005. padding: 20rpx 15rpx 15rpx 10rpx;
  1006. border-radius: 10px;
  1007. margin-bottom: 16rpx;
  1008. .lineSvg{
  1009. padding-top: 2px;
  1010. margin: auto 16rpx;
  1011. img{
  1012. width: 70rpx;
  1013. color:#62574C ;
  1014. }
  1015. }
  1016. .lineView{
  1017. .lineTitle{
  1018. color:#62574C;
  1019. font-size: 36rpx;
  1020. }
  1021. .linep{
  1022. color:#8A7B6C;
  1023. font-size: 28rpx;
  1024. line-height: 28rpx;
  1025. }
  1026. }
  1027. }
  1028. }
  1029. background-color: #fff;
  1030. padding: 30rpx 30rpx 30rpx 50rpx;
  1031. /deep/.u-divider {
  1032. margin-bottom: 16px !important;
  1033. }
  1034. .text {
  1035. color: #666666;
  1036. margin-bottom: 12px;
  1037. line-height: 24px;
  1038. display: flex;
  1039. .num {
  1040. margin-right: 8px;
  1041. }
  1042. }
  1043. }
  1044. .carNone {
  1045. display: flex;
  1046. flex-direction: column;
  1047. justify-content: center;
  1048. align-items: center;
  1049. img {
  1050. width: 100%;
  1051. height: 100%;
  1052. }
  1053. p {
  1054. margin-top: -60px;
  1055. }
  1056. }
  1057. .slogan-4 {
  1058. margin-top: 10px;
  1059. /* text-decoration: underline; */
  1060. color: #9F9C99;
  1061. text-align: center;
  1062. position: fixed;
  1063. /* top: 40px; */
  1064. bottom: 40px;
  1065. right: 20px;
  1066. height: 55px;
  1067. width: 55px;
  1068. line-height: 20px;
  1069. font-size: 16px;
  1070. background: linear-gradient(45deg, #4BD2C0, rgb(72, 218, 149));
  1071. box-shadow: 0 4rpx 24rpx 0 rgb(72, 218, 149);
  1072. padding-top: 8px;
  1073. color: #fff;
  1074. border-radius: 25px;
  1075. }
  1076. .station,
  1077. .location,
  1078. .state1 {
  1079. box-shadow: 0px 4rpx 12rpx 0px #008c4a33;
  1080. }
  1081. // 附近站点改版
  1082. .station {
  1083. width: 91.4%;
  1084. border-radius: 8px;
  1085. padding: 12px 12px 12px 11px;
  1086. background-color: #fff;
  1087. margin: 8px auto 0;
  1088. .head {
  1089. display: flex;
  1090. justify-content: space-between;
  1091. align-items: center;
  1092. .title {
  1093. color: rgba(16, 16, 16, 100);
  1094. font-size: 32rpx;
  1095. font-weight: 550;
  1096. width: 440rpx;
  1097. text-overflow: ellipsis;
  1098. overflow: hidden;
  1099. white-space: nowrap;
  1100. }
  1101. .distance {
  1102. width: 180rpx;
  1103. color: rgba(102, 102, 102, 100);
  1104. font-size: 32rpx;
  1105. text-align: end;
  1106. .iconfont {
  1107. font-size: 24rpx;
  1108. margin-right: 4rpx;
  1109. }
  1110. }
  1111. }
  1112. .sign {
  1113. display: flex;
  1114. flex-wrap: wrap;
  1115. margin-top: 16rpx;
  1116. .sign-1 {
  1117. line-height: 40rpx;
  1118. border-radius: 8rpx;
  1119. background-color: rgba(255, 255, 255, 100);
  1120. color: rgba(255, 139, 0, 100);
  1121. font-size: 24rpx;
  1122. text-align: center;
  1123. border: 1px solid rgba(255, 139, 0, 100);
  1124. padding: 0 8rpx;
  1125. margin-right: 16rpx;
  1126. margin-bottom: 8rpx;
  1127. }
  1128. .sign-2 {
  1129. line-height: 40rpx;
  1130. border-radius: 8rpx;
  1131. background-color: rgba(255, 255, 255, 100);
  1132. color: rgba(153, 153, 153, 100);
  1133. font-size: 24rpx;
  1134. text-align: center;
  1135. border: 1px solid rgba(204, 204, 204, 100);
  1136. padding: 0 8rpx;
  1137. margin-right: 16rpx;
  1138. margin-bottom: 8rpx;
  1139. }
  1140. .sign-3 {
  1141. line-height: 40rpx;
  1142. border-radius: 8rpx;
  1143. background-color: rgba(255, 255, 255, 100);
  1144. color: #8161FF;
  1145. font-size: 24rpx;
  1146. text-align: center;
  1147. border: 1px solid #8161FF;
  1148. padding: 0 8rpx;
  1149. margin-right: 16rpx;
  1150. margin-bottom: 8rpx;
  1151. }
  1152. .sign-4 {
  1153. line-height: 40rpx;
  1154. border-radius: 8rpx;
  1155. background-color: rgba(255, 255, 255, 100);
  1156. color: #00B962;
  1157. font-size: 24rpx;
  1158. text-align: center;
  1159. border: 1px solid #00B962;
  1160. padding: 0 8rpx;
  1161. margin-right: 16rpx;
  1162. margin-bottom: 8rpx;
  1163. }
  1164. }
  1165. .price-free {
  1166. display: flex;
  1167. justify-content: space-between;
  1168. margin-top: 8rpx;
  1169. .price {
  1170. display: flex;
  1171. align-items: baseline;
  1172. }
  1173. .price-1 {
  1174. .num {
  1175. color: rgba(255, 98, 0, 100);
  1176. font-size: 44rpx;
  1177. }
  1178. .unit {
  1179. font-size: 12px;
  1180. color: rgba(153, 153, 153, 100);
  1181. }
  1182. }
  1183. .price-3 {
  1184. font-size: 24rpx;
  1185. color: #fff;
  1186. margin-left: 8rpx;
  1187. padding-right: 9rpx;
  1188. background:#00B962 ;
  1189. border-radius: 8rpx;
  1190. .num1{
  1191. padding-left: 12rpx;
  1192. border-radius: 8rpx 0 8rpx 8rpx;
  1193. padding-right: 18rpx;
  1194. background: #121212;
  1195. -webkit-clip-path: polygon(0 0, 93% 0, 84% 100%, 0% 100%);
  1196. clip-path: polygon(0 0, 93% 0, 84% 100%, 0% 100%);
  1197. }
  1198. }
  1199. .price-2 {
  1200. font-size: 24rpx;
  1201. color: rgba(153, 153, 153, 100);
  1202. margin-left: 8rpx;
  1203. text-decoration: line-through;
  1204. }
  1205. }
  1206. .free {
  1207. display: flex;
  1208. align-items: center;
  1209. .slow,
  1210. .fast {
  1211. display: flex;
  1212. .sp-font {
  1213. width: 40rpx;
  1214. height: 40rpx;
  1215. line-height: 40rpx;
  1216. border-radius: 4px;
  1217. background-color: #7a68f6;
  1218. color: #fff;
  1219. font-size: 28rpx;
  1220. text-align: center;
  1221. margin-right: 2rpx;
  1222. }
  1223. .fast-font {
  1224. width: 40rpx;
  1225. height: 40rpx;
  1226. line-height: 40rpx;
  1227. border-radius: 8rpx;
  1228. background-color: rgba(186, 240, 215, 100);
  1229. color: rgba(0, 130, 69, 100);
  1230. font-size: 28rpx;
  1231. text-align: center;
  1232. margin-right: 8rpx;
  1233. }
  1234. .slow-font {
  1235. width: 40rpx;
  1236. height: 40rpx;
  1237. line-height: 40rpx;
  1238. border-radius: 8rpx;
  1239. background-color: rgba(226, 226, 226, 100);
  1240. color: rgba(128, 128, 128, 100);
  1241. font-size: 28rpx;
  1242. text-align: center;
  1243. margin-right: 8rpx;
  1244. }
  1245. .num {
  1246. font-size: 32rpx;
  1247. color: rgba(0, 145, 67, 100);
  1248. line-height: 40rpx;
  1249. }
  1250. }
  1251. .slow {
  1252. margin-left: 24rpx;
  1253. }
  1254. }
  1255. }
  1256. .user-card {
  1257. padding: 19px 0 39px 20px;
  1258. margin: 21px 20px 0 20px;
  1259. background: url(@/assets/img/companyVIP.png) no-repeat right, linear-gradient(to right, #C6D4ED, #DCE6F0) no-repeat;
  1260. box-shadow: 0px 0px 16px 0px rgba(14, 39, 84, 28);
  1261. border: 2px solid rgba(236, 239, 245, 100);
  1262. border-radius: 16px;
  1263. display: flex;
  1264. .head-img {
  1265. width: 48px;
  1266. height: 48px;
  1267. img {
  1268. width: 100%;
  1269. }
  1270. }
  1271. .user-name {
  1272. margin-left: 12px;
  1273. .name {
  1274. line-height: 24px;
  1275. color: rgba(33, 41, 48, 100);
  1276. font-size: 24px;
  1277. font-weight: 550;
  1278. }
  1279. .sign {
  1280. color: rgba(76, 89, 111, 100);
  1281. font-size: 16px;
  1282. line-height: 16px;
  1283. margin-top: 8px;
  1284. }
  1285. }
  1286. }
  1287. </style>