amount.vue 11 KB

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