amount.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. <template>
  2. <div class="charge-amount">
  3. <div class="container">
  4. <div class="overview">
  5. <div class="title">会员余额(¥)</div>
  6. <div class="gasoline">
  7. 汽油卡:<span>{{ this.gasolineAmount | toFixed }}</span>
  8. </div>
  9. <div class="diesel">
  10. 柴油卡:<span>{{ this.dieselAmount | toFixed }}</span>
  11. </div>
  12. <div class="pay">
  13. <span class="icon"></span>
  14. <router-link to="/charge/" tag="span" class="text">充值</router-link>
  15. </div>
  16. </div>
  17. <div class="detail">
  18. <div class="title">金额明细</div>
  19. <div class="part">
  20. <div :class="[type === 0 ? 'active' : '']" @click="selectType(0)">
  21. 全部
  22. </div>
  23. <div :class="[type === 1 ? 'active' : '']" @click="selectType(1)">
  24. 充值
  25. </div>
  26. <div :class="[type === 2 ? 'active' : '']" @click="selectType(2)">
  27. 支出
  28. </div>
  29. </div>
  30. </div>
  31. <div class="content">
  32. <div v-if="showList.length=== 0" class="no-img">
  33. <div></div>
  34. <span>无记录</span>
  35. </div>
  36. <template v-else>
  37. <div class="ele" v-for="(item, index) in showList" :key="index">
  38. <div class="title">
  39. <span class="text">{{
  40. item.cardOilsType == "1" ? "汽油卡" : "柴油卡"
  41. }}</span>
  42. <span class="amount"
  43. >{{ item.usageType }}
  44. {{ (+item.amt + +item.presentAmt) | toFixed }}</span
  45. >
  46. </div>
  47. <div class="item">
  48. <span class="text">{{
  49. item.usageType == "+" ? "充值金额" : "消费金额"
  50. }}</span>
  51. <span class="amount">{{ item.amt | toFixed }}</span>
  52. </div>
  53. <div class="item" v-if="item.usageType === '+'">
  54. <span class="text">赠送金额{{ item.usageType }}</span>
  55. <span class="amount">{{ item.presentAmt | toFixed }}</span>
  56. </div>
  57. <div class="item">
  58. <span class="text">{{
  59. item.usageType == "+" ? "充值时间" : "消费时间"
  60. }}</span>
  61. <span class="amount">{{ item.createTime }}</span>
  62. </div>
  63. </div>
  64. </template>
  65. <template>
  66. <div></div>
  67. </template>
  68. </div>
  69. </div>
  70. </div>
  71. </template>
  72. <script>
  73. import ProductList from "../../components/ProductList";
  74. import moment from "moment";
  75. import { mapGetters } from "vuex";
  76. export default {
  77. head() {
  78. return {
  79. title: "电子卡明细",
  80. };
  81. },
  82. data() {
  83. return {
  84. allList: [],
  85. showList: [],
  86. type: 0, //0全部 1充值 2支出
  87. gasolineAmount: 0,
  88. dieselAmount: 0,
  89. };
  90. },
  91. computed: {
  92. ...mapGetters({
  93. userInfo: "authen/userInfo",
  94. }),
  95. chargeList() {
  96. return this.allList.filter((ele) => {
  97. return ele.usageType === "+";
  98. });
  99. },
  100. payList() {
  101. return this.allList.filter((ele) => {
  102. return ele.usageType === "-";
  103. });
  104. },
  105. },
  106. filters: {
  107. toFixed: function (value) {
  108. return (+value).toFixed(2);
  109. },
  110. },
  111. components: {
  112. ProductList,
  113. },
  114. created() {
  115. this.init();
  116. console.log("user.info",this.userInfo)
  117. },
  118. methods: {
  119. async init() {
  120. // 获取油站列表
  121. this.$axios
  122. .$get("/getElectronicCardList", {
  123. params: {
  124. unionId: this.unionId,
  125. stationId: this.stationId,
  126. },
  127. })
  128. .then((res) => {
  129. console.log(res);
  130. if (res.retCode === 0) {
  131. res.data.forEach((ele) => {
  132. console.log(ele);
  133. if (ele.cardOilsType == "1") {
  134. this.gasolineAmount = ele.amt;
  135. } else if (ele.cardOilsType == "2") {
  136. this.dieselAmount = ele.amt;
  137. }
  138. });
  139. }
  140. }).catch((e)=>{
  141. })
  142. // 获取订单
  143. try {
  144. const amountData = await this.$axios.$get("/getCardRecordList", {
  145. params: {
  146. stationId: this.stationId,
  147. unionId: this.unionId,
  148. usageType: "",
  149. },
  150. });
  151. if (amountData.retCode !== 0) {
  152. throw new Error(amountData.message);
  153. }
  154. this.allList = amountData.data.map((ele) => {
  155. ele.createTime = moment.parseZone(ele.createTime, "MMM DD, YYYY HH:mm:ss A")
  156. .utc()
  157. .format("YYYY/MM/DD HH:mm:ss");
  158. return ele;
  159. });
  160. this.showList = this.allList;
  161. } catch (error) {
  162. alert(error);
  163. }
  164. },
  165. selectType(type) {
  166. this.type = type;
  167. const typeArr = ["allList", "chargeList", "payList"];
  168. this.showList = this[typeArr[type]];
  169. },
  170. },
  171. };
  172. </script>
  173. <style>
  174. .charge-amount {
  175. width: 100%;
  176. height: 16.24rem;
  177. background: #ffffff;
  178. }
  179. .charge-amount .container {
  180. width: 6.9rem;
  181. margin: 0 auto;
  182. }
  183. .charge-amount .container .overview {
  184. width: 6.9rem;
  185. height: 2.8rem;
  186. background: url("../../static/point/4_b01_bj@2x.png") no-repeat;
  187. background-size: 100% 100%;
  188. position: relative;
  189. }
  190. .charge-amount .container .overview .title {
  191. height: 0.4rem;
  192. font-size: 0.28rem;
  193. font-family: PingFangSC-Regular, PingFang SC;
  194. font-weight: 400;
  195. color: #ffffff;
  196. line-height: 0.4rem;
  197. position: absolute;
  198. left: 0.6rem;
  199. top: 0.3rem;
  200. }
  201. .charge-amount .container .overview .gasoline {
  202. height: 0.6rem;
  203. font-size: 0.28rem;
  204. font-family: PingFangSC-Semibold, PingFang SC;
  205. font-weight: 600;
  206. color: #ffffff;
  207. line-height: 0.6rem;
  208. position: absolute;
  209. top: 1rem;
  210. left: 0.6rem;
  211. }
  212. .charge-amount .container .overview .gasoline span {
  213. height: 0.6rem;
  214. font-size: 0.4rem;
  215. font-weight: 600;
  216. line-height: 0.6rem;
  217. }
  218. .charge-amount .container .overview .diesel {
  219. height: 0.6rem;
  220. font-size: 0.28rem;
  221. font-family: PingFangSC-Semibold, PingFang SC;
  222. font-weight: 600;
  223. color: #ffffff;
  224. line-height: 0.6rem;
  225. position: absolute;
  226. top: 1.75rem;
  227. left: 0.6rem;
  228. }
  229. .charge-amount .container .overview .diesel span {
  230. height: 0.6rem;
  231. font-size: 0.4rem;
  232. font-weight: 600;
  233. line-height: 0.6rem;
  234. }
  235. .charge-amount .container .overview .pay {
  236. width: 1.56rem;
  237. height: 0.6rem;
  238. border-radius: 0.39rem;
  239. border: 0.02rem solid #ffffff;
  240. position: absolute;
  241. top: 1.3rem;
  242. right: 0.6rem;
  243. display: flex;
  244. align-items: center;
  245. justify-content: center;
  246. }
  247. .charge-amount .container .overview .pay .icon {
  248. width: 0.3rem;
  249. height: 0.3rem;
  250. background: #ffffff;
  251. display: inline-block;
  252. background: url("../../static/point/jinbi.png") no-repeat;
  253. background-size: cover;
  254. }
  255. .charge-amount .container .overview .pay .text {
  256. display: inline-block;
  257. height: 0.6rem;
  258. font-size: 0.28rem;
  259. font-family: PingFangSC-Regular, PingFang SC;
  260. font-weight: 400;
  261. color: #ffffff;
  262. line-height: 0.6rem;
  263. margin-left: 0.2rem;
  264. }
  265. .charge-amount .container .detail {
  266. width: 100%;
  267. height: 1.17rem;
  268. display: flex;
  269. justify-content: space-between;
  270. border-bottom: 0.01rem solid #e0e0e0;
  271. }
  272. .charge-amount .container .detail .title {
  273. height: 1.17rem;
  274. font-size: 0.32rem;
  275. font-family: PingFangSC-Regular, PingFang SC;
  276. font-weight: 400;
  277. color: #000000;
  278. line-height: 1.17rem;
  279. }
  280. .charge-amount .container .detail .part {
  281. display: flex;
  282. width: 3.2rem;
  283. height: 1.13rem;
  284. justify-content: space-between;
  285. align-items: center;
  286. }
  287. .charge-amount .container .detail .part div {
  288. height: 1.13rem;
  289. font-size: 0.32rem;
  290. font-family: PingFangSC-Regular, PingFang SC;
  291. font-weight: 400;
  292. color: #aaaaaa;
  293. line-height: 1.13rem;
  294. }
  295. .charge-amount .container .detail .part .active {
  296. height: 1.13rem;
  297. font-size: 0.32rem;
  298. font-family: PingFangSC-Regular, PingFang SC;
  299. font-weight: 400;
  300. color: #111111;
  301. border-bottom: 0.06rem solid #db9d28;
  302. }
  303. .charge-amount .container .content {
  304. width: 100%;
  305. }
  306. .charge-amount .container .content .no-img {
  307. width: 100%;
  308. height: 60vh;
  309. position: relative;
  310. display: flex;
  311. flex-direction: column;
  312. justify-content: center;
  313. align-items: center;
  314. }
  315. .charge-amount .container .content .no-img div {
  316. width: 2.29rem;
  317. height: 1.87rem;
  318. background: url("../../static/common/wu@2x.png") no-repeat 0 0;
  319. background-size: 100% 100%;
  320. }
  321. .charge-amount .container .content .no-img span {
  322. width: 2.29rem;
  323. height: 0.4rem;
  324. font-size: 0.28rem;
  325. font-weight: 500;
  326. color: #aaaaaa;
  327. line-height: 0.4rem;
  328. text-align: center;
  329. }
  330. .charge-amount .container .content .ele {
  331. height: 2.7rem;
  332. border-bottom: 0.01rem solid #e0e0e0;
  333. padding: 0.3rem 0;
  334. display: flex;
  335. flex-direction: column;
  336. justify-content: space-around;
  337. }
  338. .charge-amount .container .content .ele .title {
  339. width: 100%;
  340. height: 0.45rem;
  341. font-size: 0.32rem;
  342. font-family: PingFangSC-Regular, PingFang SC;
  343. color: #111111;
  344. line-height: 0.45rem;
  345. display: flex;
  346. justify-content: space-between;
  347. }
  348. .charge-amount .container .content .ele .title .text {
  349. display: inline-block;
  350. height: 0.45rem;
  351. font-weight: 500;
  352. color: #111111;
  353. }
  354. .charge-amount .container .content .ele .title .amount {
  355. display: inline-block;
  356. height: 0.45rem;
  357. font-weight: 500;
  358. color: #db9d28;
  359. }
  360. .charge-amount .container .content .ele .item {
  361. display: flex;
  362. justify-content: space-between;
  363. align-items: center;
  364. margin-top: 0.15rem;
  365. height: 0.4rem;
  366. font-size: 0.28rem;
  367. font-family: PingFangSC-Regular, PingFang SC;
  368. font-weight: 400;
  369. color: #aaaaaa;
  370. line-height: 0.4rem;
  371. }
  372. .charge-amount .container .content .ele .item .text {
  373. display: inline-block;
  374. height: 0.4rem;
  375. font-size: 0.28rem;
  376. font-family: PingFangSC-Regular, PingFang SC;
  377. font-weight: 400;
  378. color: #aaaaaa;
  379. line-height: 0.4rem;
  380. }
  381. .charge-amount .container .content .ele .item .amount {
  382. display: inline-block;
  383. height: 0.4rem;
  384. font-size: 0.28rem;
  385. font-family: PingFangSC-Regular, PingFang SC;
  386. font-weight: 400;
  387. color: #666666;
  388. line-height: 0.4rem;
  389. }
  390. </style>