cardBag.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <view>
  3. <ujp-navbar title="我的卡包"></ujp-navbar>
  4. <view class="tabs">
  5. <u-tabs bar-width="80" active-color="#333333" inactive-color="#999999" :list="list" :is-scroll="false"
  6. :current="current" @change="change"></u-tabs>
  7. </view>
  8. <view class="main">
  9. <view class="mcorporate-member" v-if="current==0" v-for="(item,i) in businessVipList"
  10. @click="gotoUrl('pages/user/company-vip?id='+item.vipUser.platform)" :key="i" >
  11. <view class="icon">
  12. <img src="../../assets/img/corporateMember.png" alt="">
  13. </view>
  14. <view class="infos">
  15. <view class="name">
  16. 企业会员
  17. </view>
  18. <view class="company">
  19. {{item.vipUser.platformN}}
  20. </view>
  21. <view class="balance" v-if="item.vipUser.entAccountEnabled&&item.enterpriseAccount!=null">
  22. 企业账户余额:{{item.enterpriseAccount.totalAmount?item.enterpriseAccount.totalAmount.toFixed(2):'0.00'}}元
  23. </view>
  24. </view>
  25. </view>
  26. <template v-for="(item,i) in showList">
  27. <view class="monthly-payment" @click="gotoUrl('pages/monthlyCardActivity/monthlyCardBuy')"
  28. :key="i+'a'" v-if="item.classify==1" >
  29. <view class="icon">
  30. <img src="../../assets/img/monthlyPayment.png" alt="">
  31. </view>
  32. <view class="infos">
  33. <view class="name">
  34. 服务费包月会员
  35. </view>
  36. <view class="date">
  37. {{item.endTime.substring(0,10)}}到期
  38. </view>
  39. </view>
  40. </view>
  41. <view class="discount-card" @click="gotocardDetails(item)"
  42. :key="i+'b'" v-if="item.classify==2">
  43. <view class="name">
  44. {{item.cardName}}
  45. </view>
  46. <view class="progress">
  47. <view class="time">
  48. {{thisendTime(item.endTime)}}到期 剩余{{thisdaysDistance(item.endTime)}}天
  49. </view>
  50. <view class="electric-quantity">
  51. 已用{{item.chargedDegree?item.chargedDegree.toFixed(0):0.00}}度 / 共{{item.chargeDegreeLimit}}度
  52. </view>
  53. </view>
  54. <ujp-line-progress active-color="#2979ff" :percent="thispercent(item)"></ujp-line-progress>
  55. </view>
  56. </template>
  57. <view class="carNone" v-if="current==0&&businessVipList.length==0&&showList.length==0">
  58. <img src="static/img/暂无数据-缺省页.png" alt="">
  59. <p class="oldTextjp2" oldstyle="font-size: 18px;">暂无数据</p>
  60. </view>
  61. <view class="carNone" v-if="current==1&&expireUserCardList.length==0">
  62. <img src="static/img/暂无数据-缺省页.png" alt="">
  63. <p class="oldTextjp2" oldstyle="font-size: 18px;">暂无数据</p>
  64. </view>
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. import * as API from '@/apis/index.js'
  70. import {
  71. newDate,daysDistance
  72. } from '@/utils'
  73. export default {
  74. data() {
  75. return {
  76. list: [{
  77. name: '生效中'
  78. }, {
  79. name: '已过期'
  80. }],
  81. expireUserCardList:[],
  82. cardList:[],
  83. pageIndex: 1,
  84. recordsTotal: 0,
  85. current: 0,
  86. businessVipList:[],
  87. userCard:null,
  88. }
  89. },
  90. computed:{
  91. showList(){
  92. if(this.current==0 ){
  93. return this.cardList
  94. }
  95. if(this.current==1){
  96. return this.expireUserCardList
  97. }
  98. return []
  99. },
  100. userCardBool(){
  101. if(this.userCard){
  102. var date=new Date().getTime()
  103. //var reg=new RegExp('-','gi')
  104. var str=this.userCard.endTime;
  105. //console.log(str.replace(reg,'/'))
  106. var date2=newDate(str).getTime();
  107. if(date<date2){
  108. return true;
  109. }
  110. }
  111. return false
  112. }
  113. },
  114. onReady() {
  115. this.getChargeList();
  116. },
  117. methods: {
  118. gotocardDetails(item){
  119. this.carhelp.set("cardDetails-info",item)
  120. uni.navigateTo({
  121. url:'/pages/cardBag/cardDetails?id='+item.id
  122. })
  123. },
  124. thisdaysDistance(endTime){
  125. var date=new Date()
  126. var date2=newDate(endTime);
  127. return daysDistance(date,date2)
  128. },
  129. getChargeList() {
  130. uni.showLoading({
  131. title: "加载中",
  132. mask: true,
  133. })
  134. API.personCardList({
  135. }).then((res) => {
  136. uni.hideLoading();
  137. this.cardList = res.data.cardList;
  138. this.expireUserCardList = res.data.expireUserCardList;
  139. //this.recordsTotal = res.data.recordsTotal;
  140. this.businessVipList=res.data.memberCardList;
  141. }).catch(error => {
  142. uni.showToast({
  143. title: error,
  144. icon: "none"
  145. })
  146. })
  147. },
  148. thisendTime(endTime){
  149. if(endTime){
  150. var reg=new RegExp('-','gi')
  151. var str=endTime.substring(0,10).replace(reg,'.')
  152. return str
  153. }
  154. return ''
  155. },
  156. thispercent(userCard){
  157. var p=0
  158. if(userCard&&userCard.chargeDegreeLimit){
  159. p=userCard.chargedDegree/userCard.chargeDegreeLimit*100
  160. }
  161. if(p>100){
  162. p=100
  163. }
  164. return p.toFixed(0)
  165. },
  166. change(index) {
  167. this.current = index;
  168. }
  169. }
  170. }
  171. </script>
  172. <style scoped lang="scss">
  173. .carNone{
  174. display: flex;
  175. flex-direction: column;
  176. justify-content: center;
  177. align-items: center;
  178. img{
  179. width: 100%;
  180. height: 100%;
  181. }
  182. p{
  183. margin-top: -60px;
  184. }
  185. }
  186. /deep/.u-tab-bar {
  187. background-color: #00B962 !important;
  188. }
  189. .main {
  190. padding: 0 32rpx;
  191. .monthly-payment,.mcorporate-member{
  192. height: 160rpx;
  193. border-radius: 8px;
  194. background-color: rgba(55, 59, 80, 1);
  195. padding-left: 24rpx;
  196. margin-top: 24rpx;
  197. display: flex;
  198. align-items: center;
  199. .icon{
  200. width: 80rpx;
  201. height: 80rpx;
  202. img{
  203. width: 100%;
  204. }
  205. }
  206. .infos{
  207. margin-left: 16rpx;
  208. .name{
  209. color: rgba(225, 192, 130, 1);
  210. font-size: 32rpx;
  211. }
  212. .date{
  213. color: rgba(211, 185, 134, 1);
  214. font-size: 24rpx;
  215. }
  216. .company{
  217. color: rgba(204, 204, 204, 1);
  218. font-size: 24rpx;
  219. }
  220. .balance{
  221. color: rgba(219, 219, 219, 1);
  222. font-size: 24rpx;
  223. }
  224. }
  225. }
  226. .discount-card{
  227. border-radius: 8px;
  228. background-color: rgba(55, 59, 80, 1);
  229. padding: 24rpx;
  230. margin-top: 24rpx;
  231. .name{
  232. color: rgba(255, 255, 255, 1);
  233. font-size: 32rpx;
  234. }
  235. .progress{
  236. display: flex;
  237. justify-content: space-between;
  238. color: rgba(219, 219, 219, 1);
  239. font-size: 24rpx;
  240. margin-bottom: 16rpx;
  241. }
  242. /deep/.u-active{
  243. background: linear-gradient(84.49deg, rgba(59,182,254,1) 4.25%,rgba(0,185,98,1) 95.02%);
  244. }
  245. }
  246. }
  247. </style>