company-vip.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. <template>
  2. <view>
  3. <view class="header">
  4. <ujp-navbar title="企业会员"></ujp-navbar>
  5. <view class="user-card">
  6. <view class="head-img">
  7. <img v-if="info.headImg" style="border-radius: 50px;"
  8. :src="info.headImg" alt="">
  9. <img v-else src="../../assets/img/headPortrait.png" alt="">
  10. </view>
  11. <view class="user-name">
  12. <view class="name">
  13. {{info.realName?info.realName:info.nickName}}
  14. </view>
  15. <view class="sign">
  16. {{platformN}}
  17. </view>
  18. <view class="sign2">
  19. {{cardNo}}
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <u-picker mode="time" v-model="popupShow" @confirm="changedate" :default-time="queryTime+'-1'" :params="params"></u-picker>
  25. <view class="details">
  26. <!-- 可用余额 -->
  27. <view class="balance" v-if="enterpriseAccount" >
  28. <view class="item2" >
  29. <view class="num " >
  30. {{enterpriseAccount.balance}}<span >元</span>
  31. </view>
  32. <view class="name">
  33. 充值余额
  34. </view>
  35. </view>
  36. <view class="item3"></view>
  37. <view class="item2" >
  38. <view class="num " >
  39. {{enterpriseAccount.giftAmount?enterpriseAccount.giftAmount:0}}<span >元</span>
  40. </view>
  41. <view class="name" @click="ckIcon">
  42. 赠送余额<u-icon name="info-circle"></u-icon>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="month-electric">
  47. <view class="month" @click="popupShow = true" >
  48. {{showTime(queryTime)}}
  49. <u-icon name="arrow-down" color="#b0b8c8" size="32" v-show="!popupShow"></u-icon>
  50. <u-icon name="arrow-up" color="#b0b8c8" size="32" v-show="popupShow"></u-icon>
  51. <!-- 8月<text class="iconfont">&#xe62b;</text> -->
  52. </view>
  53. <view class="electric">
  54. 本月累计充电 {{(electricQuantity).toFixed(1)}}度
  55. </view>
  56. </view>
  57. <view class="carNone" v-show="!list.length">
  58. <img src="@/assets/static/img/暂无数据-缺省页.png" alt="">
  59. <p>暂无充电记录</p>
  60. </view>
  61. <view class="item" v-for="(item,i) in list" :key="i" >
  62. <view class="infos">
  63. <view class="station-name">
  64. {{item.stationName}}
  65. </view>
  66. <view class="time">
  67. {{item.endTime}}
  68. </view>
  69. </view>
  70. <view class="electricity-consumption">
  71. {{(item.electricQuantity/10000).toFixed(1)}}度
  72. </view>
  73. </view>
  74. <u-divider color="#a8a8a8" v-if="list.length" half-width="200" border-color="#CFD2D5" fontSize="28">已经到底了</u-divider>
  75. </view>
  76. </view>
  77. </template>
  78. <script>
  79. import * as API_index from '@/apis/index.js'
  80. import * as API from '@/apis/user.js'
  81. import {
  82. daysDistance,
  83. beforeTimeStamp,
  84. currentTimeStamp,
  85. parseUnixTime
  86. } from '@/utils'
  87. export default {
  88. data() {
  89. return {
  90. enterpriseAccount:null,
  91. params: {
  92. year: true,
  93. month: true,
  94. day: false,
  95. hour: false,
  96. minute: false,
  97. second: false
  98. },
  99. popupShow:false,
  100. queryTime:"",
  101. info:{},
  102. platformN:'',
  103. platform:'',
  104. startDate:'',
  105. endTime:"",
  106. pageIndex:1,
  107. list: [],
  108. electricQuantity:0,
  109. recordsTotal: 0,
  110. cardNo:"",
  111. }
  112. },
  113. onReachBottom() {
  114. if (this.list.length < this.recordsTotal) {
  115. this.myLoadmore();
  116. }
  117. },
  118. onLoad(op) {
  119. this.platform=op.id;
  120. this.info=this.carhelp.getPersonInfo()
  121. var list=this.carhelp.getPersonInfoPlus().businessVipList;
  122. if(list){
  123. for(var i in list){
  124. if(list[i].platform==this.platform){
  125. this.platformN=list[i].platformN
  126. this.cardNo=list[i].cardNo
  127. }
  128. }
  129. }
  130. this.queryTime=parseUnixTime(currentTimeStamp(), '{y}-{m}'),
  131. this.endTime = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
  132. this.personalCenter()
  133. this.getList()
  134. },computed:{
  135. startTime(){
  136. return this.queryTime+'-1'
  137. },
  138. },
  139. methods: {
  140. ckIcon(){
  141. uni.showModal({
  142. title: '提示',
  143. content: '余额扣款顺序为先扣除充值余额,再扣除赠送余额.如申请退款,赠送余额不退换给用户.',
  144. showCancel:false,
  145. success: res=>{
  146. if (res.confirm) {
  147. } else if (res.cancel) {
  148. //('用户点击取消');
  149. }
  150. }
  151. });
  152. },
  153. personalCenter(){
  154. var list=this.carhelp.getPersonInfoPlus().businessVipList;
  155. if(list){
  156. for(var i in list){
  157. if(list[i].platform==this.platform){
  158. this.platformN=list[i].platformN
  159. }
  160. }
  161. }
  162. API_index.personalCenter().then((res2) => {
  163. var entRegList=res2.data.entRegList;
  164. for(var i in list){
  165. var item1=list[i]
  166. if(list[i].platform==this.platform){
  167. for(var j in entRegList){
  168. var item2=entRegList[j].vipUser;
  169. if(item1.id==item2.id){
  170. this.enterpriseAccount=entRegList[j].enterpriseAccount
  171. console.log(this.enterpriseAccount)
  172. }
  173. }
  174. }
  175. }
  176. this.$forceUpdate()
  177. }).catch(error => {
  178. uni.showToast({
  179. title: error
  180. })
  181. })
  182. },
  183. okbtn() {
  184. this.popupShow = false;
  185. this.getList(true)
  186. },
  187. changedate(e) {
  188. console.log(e)
  189. this.queryTime=e.year+'-'+e.month;
  190. if(e.month=='12'){
  191. this.endTime=(e.year)+"/12/31"
  192. }else{
  193. var b=e.year+'/'+(parseInt(e.month)+1)+'/1';
  194. var a=beforeTimeStamp(1,b);
  195. this.endTime= parseUnixTime(a, '{y}-{m}-{d}')
  196. }
  197. this.okbtn()
  198. },
  199. showTime(name){
  200. if(!name){
  201. return ''
  202. }
  203. return name.replace('-','年')+'月';
  204. },
  205. myLoadmore() {
  206. this.pageIndex += 1;
  207. this.getList()
  208. },
  209. getList(bl){
  210. uni.showLoading({
  211. title: "加载中",
  212. mask: true,
  213. })
  214. if (bl) {
  215. this.list = [];
  216. this.pageIndex = 1;
  217. }
  218. API.chargingRecordVipData({
  219. pageIndex: this.pageIndex,
  220. startDate: this.startTime,
  221. endDate: this.endTime,
  222. platform: this.platform,
  223. pageSize:20,
  224. }).then((res) => {
  225. uni.hideLoading();
  226. this.list = [
  227. ...this.list,
  228. ...res.data.data
  229. ];
  230. this.electricQuantity = res.data.electricQuantity;
  231. this.recordsTotal = res.data.recordsTotal;
  232. }).catch(error => {
  233. uni.showToast({
  234. title: error,
  235. icon: "none"
  236. })
  237. })
  238. },
  239. }
  240. }
  241. </script>
  242. <style lang="scss" scoped>
  243. // 余额
  244. .balance {
  245. background-color: #f3f4f7;
  246. margin: 12rpx 0px 22rpx 0px;
  247. padding: 32rpx 60rpx;
  248. display: flex;
  249. // justify-content: space-between;
  250. justify-content: space-around;
  251. border-radius: 12px;
  252. .item3{
  253. border-right: 1px solid #dad5d5;
  254. height: 60rpx;
  255. margin-top: 20rpx;
  256. }
  257. .item2 {
  258. text-align: center;
  259. display: table-row;
  260. .num {
  261. line-height: 56rpx;
  262. color: rgba(51, 51, 51, 100);
  263. font-size: 48rpx;
  264. position: relative;
  265. font-weight: bold;
  266. }
  267. .name {
  268. height: 32rpx;
  269. color: rgba(134, 134, 134, 100);
  270. font-size: 28rpx;
  271. margin-top: 2px;
  272. margin-botton: 4px;
  273. }
  274. }
  275. }
  276. page{
  277. background-color: #fff;
  278. }
  279. .header{
  280. background-color: #4C586B;
  281. color: #fff;
  282. .title{
  283. display: flex;
  284. line-height: 26px;
  285. padding: 9px 11px;
  286. }
  287. .iconfont{
  288. font-size: 24px
  289. }
  290. .content{
  291. flex: 1;
  292. text-align: center;
  293. font-size: 20px
  294. }
  295. .user-card{
  296. padding: 19px 0 39px 20px;
  297. margin: 21px 20px 0 20px;
  298. background:url(@/assets/img/companyVIP.png) no-repeat right,linear-gradient(to right,#C6D4ED,#DCE6F0) no-repeat;
  299. box-shadow: 0px 0px 16px 0px rgba(14, 39, 84, 28);
  300. border: 2px solid rgba(236, 239, 245, 100);
  301. border-radius: 16px;
  302. display: flex;
  303. .head-img{
  304. width: 48px;
  305. height: 48px;
  306. img{
  307. width: 100%;
  308. }
  309. }
  310. .user-name{
  311. margin-left: 12px;
  312. .name{
  313. line-height: 40rpx;
  314. color: rgba(33, 41, 48, 100);
  315. font-size: 40rpx;
  316. font-weight: 550;
  317. }
  318. .sign{
  319. color: rgba(76, 89, 111, 100);
  320. font-size: 28rpx;
  321. line-height: 28rpx;
  322. margin-top: 16rpx;
  323. }
  324. .sign2{
  325. color: #6C6F73 ;
  326. font-size: 24rpx;
  327. line-height: 24rpx;
  328. margin-top: 16rpx;
  329. }
  330. }
  331. }
  332. }
  333. .carNone{
  334. display: flex;
  335. flex-direction: column;
  336. justify-content: center;
  337. align-items: center;
  338. img{
  339. width: 100%;
  340. height: 100%;
  341. }
  342. p{
  343. margin-top: -60px;
  344. }
  345. }
  346. .details{
  347. height: 100%;
  348. box-shadow: 0px -6px 6px 0px #1A313C47;
  349. margin-top: -15px;
  350. border-radius: 16px 16px 0px 0px;
  351. background-color: #fff;
  352. padding: 10px 20px;
  353. .month-electric{
  354. display: flex;
  355. justify-content: space-between;
  356. line-height: 16px;
  357. margin-bottom: 25px;
  358. .month{
  359. color: #333333;
  360. .iconfont{
  361. color:#666666;
  362. }
  363. }
  364. .electric{
  365. color: rgba(102, 102, 102, 100);
  366. font-size: 16px;
  367. }
  368. }
  369. .item{
  370. display: flex;
  371. justify-content: space-between;
  372. margin-bottom: 22px;
  373. .infos{
  374. .station-name{
  375. color: rgba(51, 51, 51, 100);
  376. font-size: 16px;
  377. line-height: 16px;
  378. }
  379. .time{
  380. color: rgba(119, 119, 119, 100);
  381. line-height: 14px;
  382. margin-top: 8px;
  383. }
  384. }
  385. .electricity-consumption{
  386. margin: auto 0;
  387. font-size: 24px;
  388. color: #111111;
  389. }
  390. }
  391. ::v-deep.u-divider{
  392. margin-top: 27px !important;
  393. }
  394. }
  395. </style>