balanceLog.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. <template>
  2. <div class="balance-log">
  3. <div class="new-time">
  4. <div>
  5. 余额:<span class="user-balance">{{userBalance}}</span>元
  6. </div>
  7. <div>
  8. <div class="year" @click="time">
  9. <span class="year-span">{{year}}</span>年
  10. </div>
  11. <div class="month" @click="time">
  12. <span class="month-span">{{month}}</span>月
  13. </div>
  14. </div>
  15. <div class="btn-recharge" @click="recharge">充值</div>
  16. <button-tab>
  17. <button-tab-item selected @on-item-click="consoleIndex(1)">充值</button-tab-item>
  18. <button-tab-item :selected="!isSelected" @on-item-click="consoleIndex(2)">消费</button-tab-item>
  19. </button-tab>
  20. </div>
  21. <div style="margin-top: 165px;">
  22. <div style="color: #0b0b0b" v-for="(item, index) in tmp">
  23. <group>
  24. <cell
  25. :title="item.time"
  26. is-link
  27. value-align="left"
  28. :border-intent="false"
  29. :arrow-direction="isActive === index ? 'up' : 'down'" @click.native="show(index)"></cell>
  30. <p class="slide" :class="{ animate: isActive == index }">
  31. <span v-if="frontColor" style="display: block;text-align: left;color: green;">充值金额:{{item.amount}}</span>
  32. <span v-else style="display: block;text-align: left;color: red;" >消费金额:{{item.amount}}</span>
  33. <span style="display: block;text-align: left;">支付用途:{{item.memo}}</span>
  34. <span style="display: block;text-align: left;">交易类型:{{item.type_str}}</span>
  35. </p>
  36. </group>
  37. </div>
  38. </div>
  39. <!--<div style="margin-top: 165px;">-->
  40. <!--<h5>45</h5>-->
  41. <!--<div v-for="item in tmp">{{item.memo}}</div>-->
  42. <!--</div>-->
  43. <div class="o2o-modal modal-start" :class="{ modalEnd: moduleShow }">
  44. <div class="modal-box modal-start" :class="{ modalEnd: moduleShow }">
  45. <div class="select-the-month">选择月份</div>
  46. <div class="width-percent-50">
  47. <div class="btn-year-add" @click="modalTime(1)">+</div>
  48. <div class="modal-box-year">{{year}}</div>
  49. <div class="btn-year-sub" @click="modalTime(2)">-</div>
  50. </div>
  51. <div class="width-percent-50">
  52. <div class="btn-month-add" @click="modalTime(3)">+</div>
  53. <div class="modal-box-month">{{month}}</div>
  54. <div class="btn-month-sub" @click="modalTime(4)">-</div>
  55. </div>
  56. <div class="select">
  57. <div class="btn cancel" @click="cancel">取消</div>
  58. <div class="btn determine" @click="determine">确定</div>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. </template>
  64. <script type="es6">
  65. import {Tab, TabItem, ButtonTab, ButtonTabItem, Sticky, Cell, Group} from 'vux'
  66. import axios from 'axios'
  67. import qs from 'qs'
  68. import config from '../config/config'
  69. import selectTime from '../config/selectTime'
  70. export default {
  71. data () {
  72. return {
  73. userBalance: this.$store.state.user.userInfo.balance,
  74. year: selectTime.currentYear,
  75. month: selectTime.currentMonth,
  76. isActive: -1, // show 显示隐藏
  77. index: -1, // show 显示隐藏
  78. tmp: [],
  79. tmpL: -1,
  80. timeStatus: {},
  81. moduleShow: false,
  82. frontColor: 1,
  83. isSelected: true
  84. }
  85. },
  86. components: {
  87. Tab, TabItem, ButtonTab, ButtonTabItem, Sticky, Cell, Group
  88. },
  89. created () {
  90. this.consoleIndex(1)
  91. },
  92. methods: {
  93. time () {
  94. this.timeStatus = {
  95. year: this.year,
  96. month: this.month
  97. }
  98. this.moduleShow = true
  99. },
  100. cancel () {
  101. this.year = this.timeStatus.year
  102. this.month = this.timeStatus.month
  103. this.moduleShow = false
  104. },
  105. determine () {
  106. this.moduleShow = false
  107. this.consoleIndex(1)
  108. this.isSelected = true
  109. console.log(this.isSelected)
  110. },
  111. modalTime (index) {
  112. switch (index) {
  113. case 1:
  114. this.year++
  115. break
  116. case 2:
  117. this.year--
  118. break
  119. case 3:
  120. if (this.month > 0 && this.month < 12) {
  121. this.month++
  122. }
  123. break
  124. case 4:
  125. if (this.month > 1 && this.month < 12) {
  126. this.month--
  127. }
  128. break
  129. }
  130. },
  131. show (e) {
  132. if (this.index !== e) {
  133. this.isActive = e
  134. this.index = e
  135. } else {
  136. this.isActive = -1
  137. this.index = -1
  138. }
  139. },
  140. consoleIndex (index) {
  141. if (index === 1) {
  142. this.frontColor = 1
  143. } else {
  144. this.frontColor = 0
  145. }
  146. let balanceInfo = {
  147. id: config.userId,
  148. start_time: this.year + '-' + this.month + '-01',
  149. end_time: this.year + '-' + this.month + '-30',
  150. }
  151. // let balanceInfo = {id: config.userId, start_time: '2016-11-01', end_time: '2016-11-30'}
  152. this.balanceList(index, balanceInfo)
  153. },
  154. recharge () {
  155. this.$router.push({path: '/recharge'})
  156. },
  157. balanceList (index, balanceInfo) {
  158. let t = []
  159. let j = 0
  160. axios.post('o2o/user/getUserBalanceLog', qs.stringify(balanceInfo)).then(res => {
  161. console.log(index)
  162. if (index === 1) {
  163. j = 0
  164. for (let i in res.data.message) {
  165. if (res.data.message[i].amount > 0 && res.data.message[i].memo !== '微信下订单' && res.data.message[i].memo !== '下订单') {
  166. t[j++] = res.data.message[i]
  167. }
  168. }
  169. } else if (index === 2) {
  170. // 消费
  171. j = 0
  172. for (let i in res.data.message) {
  173. if (res.data.message[i].memo === '微信下订单' || res.data.message[i].memo === '下订单' || res.data.message[i].amount < 0) {
  174. t[j++] = res.data.message[i]
  175. }
  176. }
  177. }
  178. this.tmp = t
  179. })
  180. }
  181. }
  182. }
  183. // let balanceInfo = {id: config.userId, start_time: '2016-11-01', end_time: '2016-11-30'}
  184. </script>
  185. <style lang="less" scoped>
  186. @height: 110px;
  187. .new-time {
  188. top: 0;
  189. width: 100%;
  190. color: white;
  191. height: @height;
  192. position: fixed;
  193. padding: 25px 0;
  194. z-index: 99;
  195. padding-bottom: 0;
  196. background: url('http://odulvej8l.bkt.clouddn.com/mine-%E5%BA%95%E7%BA%B9.jpg') no-repeat;
  197. background-size: 100%;
  198. & > div:nth-child(1) {
  199. line-height: 40px;
  200. text-align: left;
  201. padding-left: 15px;
  202. .user-balance {
  203. color: white;
  204. margin: 0 15px;
  205. font-size: 25px;
  206. }
  207. }
  208. & > div:nth-child(2) {
  209. & > div {
  210. width: 25%;
  211. float: left;
  212. }
  213. .year {
  214. position: relative;
  215. transition: 500ms all;
  216. text-align: left;
  217. padding-left: 15px;
  218. line-height: 40px;
  219. span {
  220. display: inline-block;
  221. }
  222. .year-span {
  223. text-align: left;
  224. }
  225. }
  226. .month {
  227. .month-span {
  228. line-height: 40px;
  229. }
  230. }
  231. .year, .month {
  232. position: relative;
  233. }
  234. .year:after, .month:after {
  235. width: 0;
  236. height: 0;
  237. right: 0;
  238. top: 15px;
  239. content: "";
  240. position: absolute;
  241. border-top: 5px solid white;
  242. border-left: 5px solid transparent;
  243. border-right: 5px solid transparent;
  244. }
  245. .month:after {
  246. right: 15px;
  247. }
  248. }
  249. .btn-recharge {
  250. top: 35%;
  251. right: 15px;
  252. padding: 5px;
  253. font-size: 13px;
  254. line-height: 26px;
  255. border-radius: 50%;
  256. position: absolute;
  257. background-color: #927603;
  258. border: 1px solid rgb(197, 159, 0);
  259. }
  260. }
  261. .balance-content {
  262. background-color: green;
  263. padding: 5%;
  264. color: white;
  265. font-size: 25px;
  266. // border-radius: 15px;
  267. }
  268. .vux-button-group {
  269. margin-top: 66px;
  270. & > a.vux-button-group-current {
  271. background-color: #927603 !important;
  272. }
  273. }
  274. .recharge-details {
  275. width: 100%;
  276. margin-bottom: 10px;
  277. position: relative;
  278. background-color: white;
  279. border-top: 1px solid rgba(0, 0, 0, 0.3);
  280. border-bottom: 1px solid rgba(0, 0, 0, 0.3);
  281. & > div {
  282. padding-left: 15px;
  283. line-height: 1.8rem;
  284. }
  285. .arrow.active {
  286. border-bottom: 1px solid rgba(0, 0, 0, 0.3);
  287. &:before {
  288. position: absolute;
  289. right: 13px;
  290. top: 18px;
  291. width: 0;
  292. height: 0;
  293. content: "";
  294. border-width: 8px 8px 0 8px;
  295. border-style: solid;
  296. border-color: #333 transparent;
  297. -webkit-transition: transform .25s;
  298. -moz-transition: transform .25s;
  299. -ms-transition: transform .25s;
  300. -o-transition: transform .25s;
  301. transition: transform .25s;
  302. }
  303. &:after {
  304. position: absolute;
  305. right: 15px;
  306. top: 18px;
  307. width: 0;
  308. height: 0;
  309. content: "";
  310. border-width: 6px 6px 0 6px;
  311. border-style: solid;
  312. border-color: #fff transparent;
  313. -webkit-transition: all .25s;
  314. -moz-transition: all .25s;
  315. -ms-transition: all .25s;
  316. -o-transition: all .25s;
  317. transition: all .25s;
  318. }
  319. span.red {
  320. color: red;
  321. }
  322. }
  323. .time-str {
  324. border-bottom: 1px solid rgba(0, 0, 0, 0.3);
  325. }
  326. }
  327. /* .show {
  328. background-color: black;
  329. height: 500px;
  330. background-color: green;
  331. border: 1px solid white;
  332. .showHeight {
  333. height: @height;
  334. background-color: yellow;
  335. }
  336. }*/
  337. /*动画效果*/
  338. .slide {
  339. padding: 0 20px;
  340. overflow: hidden;
  341. max-height: 0;
  342. transition: max-height .5s cubic-bezier(0, 1, 0, 1) -.1s;
  343. }
  344. .animate {
  345. max-height: 9999px;
  346. transition-timing-function: cubic-bezier(0.5, 0, 1, 0);
  347. transition-delay: 0s;
  348. }
  349. /*模态框*/
  350. .o2o-modal {
  351. top: 0;
  352. left: 0;
  353. right: 0;
  354. bottom: 0;
  355. width: 100%;
  356. display: block;
  357. z-index: 99999;
  358. position: fixed;
  359. background: rgba(51, 51, 51, 0.5);
  360. .modal-box {
  361. top: 30%;
  362. left: 7.5%;
  363. width: 85%;
  364. position: fixed;
  365. background-color: #fcfafa;
  366. .select-the-month {
  367. color: #212121;
  368. line-height: 1.8rem;
  369. padding-left: 0.9rem;
  370. border-bottom: 2px solid #000000;
  371. margin-bottom: 0.3rem;
  372. }
  373. .width-percent-50 {
  374. width: 50%;
  375. float: left;
  376. & > div:nth-child(1), & > div:nth-child(3) {
  377. width: 40px;
  378. height: 30px;
  379. margin: 0 auto;
  380. cursor: pointer;
  381. line-height: 30px;
  382. text-align: center;
  383. border-radius: 3px;
  384. background-color: white;
  385. border: 1px solid rgba(0, 0, 0, 0.1);
  386. }
  387. & > div:nth-child(2) {
  388. margin: 3px;
  389. font-size: 15px;
  390. text-align: center;
  391. }
  392. }
  393. .select {
  394. clear: both;
  395. width: 100%;
  396. margin-top: 5.3rem;
  397. display: flex;
  398. & > div {
  399. width: 50%;
  400. float: left;
  401. line-height: 30px;
  402. text-align: center;
  403. border: 1px solid rgba(0, 0, 0, 0.14);
  404. background: transparent;
  405. position: relative;
  406. display: inline-block;
  407. padding: 6px 8px 7px;
  408. margin-bottom: 0;
  409. font-size: 12px;
  410. font-weight: 400;
  411. color: #333;
  412. white-space: nowrap;
  413. vertical-align: top;
  414. cursor: pointer;
  415. border-radius: 3px;
  416. }
  417. }
  418. }
  419. }
  420. /*模态框动画*/
  421. .modal-start {
  422. overflow: hidden;
  423. max-height: 0;
  424. transition: max-height .5s cubic-bezier(0, 1, 0, 1) -.1s;
  425. }
  426. .modalEnd {
  427. max-height: 9999px;
  428. transition-timing-function: cubic-bezier(0.5, 0, 1, 0);
  429. transition-delay: .1s;
  430. }
  431. </style>