index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <template>
  2. <view>
  3. <top-box :userinfo="userinfo" :days="days" keys="2"></top-box>
  4. <view class="ucenter">
  5. <view class="mydata">我的数据(累计)</view>
  6. <view class="data-box">
  7. <view class="datashow">
  8. <view class="icon">
  9. <image src="../../static/ucenter/icon3.png"></image>
  10. </view>
  11. <view class="num">{{ucenter.exchangeCnt || '-'}}</view>
  12. <view>换电次数<text>/次</text></view>
  13. </view>
  14. <view class="datashow">
  15. <view class="icon">
  16. <image src="../../static/ucenter/icon4.png"></image>
  17. </view>
  18. <view class="num">{{(ucenter.exchangePower*1).toFixed(2) || '-'}}</view>
  19. <view class="unit">换电量<text>/(kW/h)</text></view>
  20. </view>
  21. <view class="datashow">
  22. <view class="icon">
  23. <image src="../../static/ucenter/icon5.png"></image>
  24. </view>
  25. <view class="num">{{(ucenter.powerFee*1).toFixed(2) || '-'}}</view>
  26. <view class="unit">预估费用<text>/元</text></view>
  27. </view>
  28. </view>
  29. <view class="common">
  30. <view class="title">常用功能</view>
  31. <!-- <view class="list" @click="getqrcode">
  32. <view><image src="../../static/ucenter/icon6.png"></image></view>
  33. <view>下载换电二维码</view>
  34. <view>></view>
  35. </view> -->
  36. <view class="list" @click="toCar">
  37. <view>
  38. <image src="../../static/ucenter/icon7.png"></image>
  39. </view>
  40. <view>我的车辆</view>
  41. <view><image src="../../static/ucenter/dayu.png"></image></view>
  42. </view>
  43. <view class="list" @click="toRecord">
  44. <view>
  45. <image src="../../static/ucenter/icon8.png"></image>
  46. </view>
  47. <view>换电记录</view>
  48. <view><image src="../../static/ucenter/dayu.png"></image></view>
  49. </view>
  50. <view class="list" @click="contact">
  51. <view>
  52. <image src="../../static/ucenter/icon9.png"></image>
  53. </view>
  54. <view>联系客服</view>
  55. <view><image src="../../static/ucenter/dayu.png"></image></view>
  56. </view>
  57. <view class="list" @click="goAbout">
  58. <view><image src="../../static/ucenter/icon10.png"></image></view>
  59. <view>关于我们</view>
  60. <view><image src="../../static/ucenter/dayu.png"></image></view>
  61. </view>
  62. </view>
  63. </view>
  64. <!-- <uni-popup ref="popup" background-color="#fff" type="bottom">
  65. <view class="popuplist">
  66. <view>
  67. <image src="../../static/code.jpg"></image>
  68. </view>
  69. <view><text>车牌:</text> 渝AUU998</view>
  70. <view><text>车辆识别码:</text> LSPR********8273</view>
  71. <view>保存至相册</view>
  72. </view>
  73. </uni-popup> -->
  74. <tab-bar></tab-bar>
  75. </view>
  76. </template>
  77. <script>
  78. export default {
  79. data() {
  80. return {
  81. // qrcode: '../../static/code.jpg',
  82. token: this.$store.state.users.token,
  83. userinfo: this.$store.state.users,
  84. serviceTel: null, //客服电话
  85. ucenter: {},
  86. days: 0,
  87. }
  88. },
  89. onShow() {
  90. this.getServiceTel()
  91. this.getUcenterData()
  92. this.getUserDays()
  93. },
  94. methods: {
  95. //获取加入天数
  96. getUserDays() {
  97. this.$http.getDays().then(res => {
  98. if (res.code === 0) {
  99. this.days = res.data
  100. } else {
  101. this.$utils.msg(res.msg);
  102. }
  103. })
  104. },
  105. getUcenterData() {
  106. this.$http.ucenterData().then(rs => {
  107. if (rs.code === 0) {
  108. this.ucenter = rs.data
  109. } else {
  110. this.$utils.msg(rs.msg);
  111. }
  112. }).catch(error => {
  113. this.$utils.msg(error);
  114. });
  115. },
  116. //获取客服电话
  117. getServiceTel() {
  118. this.$http.getService().then(rs => {
  119. if (rs.code === 0) {
  120. this.serviceTel = rs.data
  121. } else {
  122. this.$utils.msg(rs.msg);
  123. }
  124. }).catch(error => {
  125. this.$utils.msg(error);
  126. });
  127. },
  128. //更新头部信息
  129. updatetopinfo(data) {
  130. if (this.$storage.getJson("token") && this.$store.state.users) {
  131. this.token = data.token
  132. this.userinfo = data
  133. }
  134. },
  135. //关于我们
  136. goAbout(){
  137. uni.navigateTo({
  138. url:'/pages/ucenter/about'
  139. })
  140. },
  141. //联系电话
  142. contact() {
  143. let that = this;
  144. const modelPhone = uni.getSystemInfoSync();
  145. if (modelPhone.platform == 'ios') {
  146. uni.makePhoneCall({
  147. phoneNumber: that.serviceTel,
  148. })
  149. }else{
  150. uni.showActionSheet({
  151. itemList: [`呼叫:${that.serviceTel}`],
  152. success: function(res) {
  153. if (!res.tapIndex) {
  154. uni.makePhoneCall({
  155. phoneNumber: that.serviceTel,
  156. })
  157. }
  158. },
  159. });
  160. }
  161. },
  162. //保存二维码到相册
  163. getqrcode() {
  164. this.$refs.popup.open('bottom')
  165. },
  166. toCar() {
  167. uni.navigateTo({
  168. url: '../ucenter/car'
  169. })
  170. },
  171. toRecord() {
  172. uni.navigateTo({
  173. url: '../ucenter/record'
  174. })
  175. }
  176. }
  177. }
  178. </script>
  179. <style lang="scss" scoped>
  180. .popuplist {
  181. display: flex;
  182. flex-direction: column;
  183. text-align: center;
  184. image {
  185. width: 347rpx;
  186. height: 347rpx;
  187. margin-top: 20rpx;
  188. }
  189. text {
  190. color: #888e9c;
  191. }
  192. view {
  193. margin-top: 15rpx;
  194. }
  195. view:last-child {
  196. padding: 25rpx 0;
  197. border-top: 10rpx solid rgba(149, 150, 151, 0.5);
  198. }
  199. }
  200. .ucenter {
  201. padding: 0 30rpx;
  202. .mydata {
  203. color: #1d2129;
  204. font-size: 32rpx;
  205. font-weight: bold;
  206. margin: 40rpx 0;
  207. text-indent: 10rpx;
  208. }
  209. .data-box {
  210. display: flex;
  211. justify-content: space-between;
  212. .datashow {
  213. background-color: #fff;
  214. box-sizing: border-box;
  215. border-radius: 25rpx;
  216. box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(226,226,226,0.25);
  217. padding: 25rpx;
  218. .icon {
  219. height: 100rpx;
  220. }
  221. .num {
  222. color: #1d2129;
  223. font-weight: bold;
  224. font-size: 32rpx;
  225. height: 50rpx;
  226. }
  227. .unit {
  228. color: #666666;
  229. font-size: 30rpx;
  230. }
  231. image {
  232. width: 60rpx;
  233. height: 60rpx;
  234. }
  235. text {
  236. color: #86909c;
  237. font-size: 28rpx;
  238. }
  239. }
  240. }
  241. .common {
  242. display: flex;
  243. margin-top: 20rpx;
  244. background-color: #fff;
  245. padding: 25rpx 35rpx;
  246. box-sizing: border-box;
  247. border-radius: 30rpx;
  248. flex-direction: column;
  249. height: 518rpx;
  250. justify-content: space-around;
  251. .title {
  252. color: #1d2129;
  253. font-size: 32rpx;
  254. font-weight: bold;
  255. }
  256. .list {
  257. display: flex;
  258. image {
  259. width: 36rpx;
  260. height: 36rpx;
  261. }
  262. view:first-child {
  263. width: 56rpx;
  264. padding-top: 5rpx;
  265. }
  266. view:nth-child(2) {
  267. color: #1d2129;
  268. font-size: 30rpx;
  269. font-weight: 500;
  270. width: 558rpx;
  271. }
  272. view:last-child {
  273. color: #959ea8;
  274. font-weight: bold;
  275. font-size: 32rpx;
  276. }
  277. }
  278. }
  279. }
  280. </style>