company-vip.vue 8.8 KB

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