amount.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. <template>
  2. <div class="outer">
  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. export default {
  76. head() {
  77. return {
  78. title: "积分订单",
  79. };
  80. },
  81. data() {
  82. return {
  83. allList: [],
  84. showList: [],
  85. type: 0, //0全部 1充值 2支出
  86. gasolineAmount: 0,
  87. dieselAmount: 0,
  88. };
  89. },
  90. computed: {
  91. chargeList() {
  92. return this.allList.filter((ele) => {
  93. return ele.usageType === "+";
  94. });
  95. },
  96. payList() {
  97. return this.allList.filter((ele) => {
  98. return ele.usageType === "-";
  99. });
  100. },
  101. },
  102. filters: {
  103. toFixed: function (value) {
  104. return (+value).toFixed(2);
  105. },
  106. },
  107. components: {
  108. ProductList,
  109. },
  110. beforeCreate() {},
  111. created() {
  112. this.init();
  113. },
  114. methods: {
  115. async init() {
  116. // 获取油站列表
  117. this.$axios
  118. .$get("/getElectronicCardList", {
  119. params: {
  120. unionId: this.unionId,
  121. stationId: this.stationId,
  122. },
  123. })
  124. .then((res) => {
  125. console.log(res);
  126. if (res.retCode === 0) {
  127. res.data.forEach((ele) => {
  128. console.log(ele);
  129. if (ele.cardOilsType == "1") {
  130. this.gasolineAmount = ele.amt;
  131. } else if (ele.cardOilsType == "2") {
  132. this.dieselAmount = ele.amt;
  133. }
  134. });
  135. }
  136. console.log(this.gasolineAmount, this.dieselAmount);
  137. });
  138. // 获取订单
  139. try {
  140. const amountData = await this.$axios.$get("/getCardRecordList", {
  141. params: {
  142. stationId: this.stationId,
  143. unionId: this.unionId,
  144. usageType: "",
  145. },
  146. });
  147. if (amountData.retCode !== 0) {
  148. throw new Error(amountData.message);
  149. }
  150. this.allList = amountData.data.map((ele) => {
  151. ele.createTime = moment(ele.createTime, "MMM DD, YYYY HH:mm:ss A")
  152. .utc()
  153. .format("YYYY/MM/DD HH:mm:ss");
  154. return ele;
  155. });
  156. this.showList = this.allList;
  157. } catch (error) {
  158. alert(error);
  159. }
  160. },
  161. selectType(type) {
  162. this.type = type;
  163. const typeArr = ["allList", "chargeList", "payList"];
  164. this.showList = this[typeArr[type]];
  165. },
  166. },
  167. };
  168. </script>
  169. <style>
  170. .outer {
  171. width: 100%;
  172. height: 16.24rem;
  173. background: #ffffff;
  174. }
  175. .outer .container {
  176. width: 6.9rem;
  177. margin: 0 auto;
  178. }
  179. .outer .container .overview {
  180. width: 6.9rem;
  181. height: 2.8rem;
  182. background: url("../../static/point/4_b01_bj@2x.png") no-repeat;
  183. background-size: 100% 100%;
  184. position: relative;
  185. }
  186. .outer .container .overview .title {
  187. height: 0.4rem;
  188. font-size: 0.28rem;
  189. font-family: PingFangSC-Regular, PingFang SC;
  190. font-weight: 400;
  191. color: #ffffff;
  192. line-height: 0.4rem;
  193. position: absolute;
  194. left: 0.6rem;
  195. top: 0.3rem;
  196. }
  197. .outer .container .overview .gasoline {
  198. height: 0.6rem;
  199. font-size: 0.28rem;
  200. font-family: PingFangSC-Semibold, PingFang SC;
  201. font-weight: 600;
  202. color: #ffffff;
  203. line-height: 0.6rem;
  204. position: absolute;
  205. top: 1rem;
  206. left: 0.6rem;
  207. }
  208. .outer .container .overview .gasoline span {
  209. height: 0.6rem;
  210. font-size: 0.4rem;
  211. font-weight: 600;
  212. line-height: 0.6rem;
  213. }
  214. .outer .container .overview .diesel {
  215. height: 0.6rem;
  216. font-size: 0.28rem;
  217. font-family: PingFangSC-Semibold, PingFang SC;
  218. font-weight: 600;
  219. color: #ffffff;
  220. line-height: 0.6rem;
  221. position: absolute;
  222. top: 1.75rem;
  223. left: 0.6rem;
  224. }
  225. .outer .container .overview .diesel span {
  226. height: 0.6rem;
  227. font-size: 0.4rem;
  228. font-weight: 600;
  229. line-height: 0.6rem;
  230. }
  231. .outer .container .overview .pay {
  232. width: 1.56rem;
  233. height: 0.6rem;
  234. border-radius: 0.39rem;
  235. border: 0.02rem solid #ffffff;
  236. position: absolute;
  237. top: 1.3rem;
  238. right: 0.6rem;
  239. display: flex;
  240. align-items: center;
  241. justify-content: center;
  242. }
  243. .outer .container .overview .pay .icon {
  244. width: 0.3rem;
  245. height: 0.3rem;
  246. background: #ffffff;
  247. display: inline-block;
  248. background: url("../../static/point/jinbi.png") no-repeat;
  249. background-size: cover;
  250. }
  251. .outer .container .overview .pay .text {
  252. display: inline-block;
  253. width: 0.56rem;
  254. height: 0.6rem;
  255. font-size: 0.28rem;
  256. font-family: PingFangSC-Regular, PingFang SC;
  257. font-weight: 400;
  258. color: #ffffff;
  259. line-height: 0.6rem;
  260. margin-left: 0.2rem;
  261. }
  262. .outer .container .detail {
  263. width: 100%;
  264. height: 1.17rem;
  265. display: flex;
  266. justify-content: space-between;
  267. border-bottom: 0.01rem solid #e0e0e0;
  268. }
  269. .outer .container .detail .title {
  270. width: 1.28rem;
  271. height: 1.17rem;
  272. font-size: 0.32rem;
  273. font-family: PingFangSC-Regular, PingFang SC;
  274. font-weight: 400;
  275. color: #000000;
  276. line-height: 1.17rem;
  277. }
  278. .outer .container .detail .part {
  279. display: flex;
  280. width: 3.2rem;
  281. height: 1.13rem;
  282. justify-content: space-between;
  283. align-items: center;
  284. }
  285. .outer .container .detail .part div {
  286. width: 0.64rem;
  287. height: 1.13rem;
  288. font-size: 0.32rem;
  289. font-family: PingFangSC-Regular, PingFang SC;
  290. font-weight: 400;
  291. color: #aaaaaa;
  292. line-height: 1.13rem;
  293. }
  294. .outer .container .detail .part .active {
  295. width: 0.64rem;
  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. .outer .container .content {
  304. width: 100%;
  305. }
  306. .outer .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. .outer .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. .outer .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. .outer .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. .outer .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. .outer .container .content .ele .title .text {
  349. display: inline-block;
  350. height: 0.45rem;
  351. font-weight: 500;
  352. color: #111111;
  353. }
  354. .outer .container .content .ele .title .amount {
  355. display: inline-block;
  356. height: 0.45rem;
  357. font-weight: 500;
  358. color: #db9d28;
  359. }
  360. .outer .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. .outer .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. .outer .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>