capital2.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. <template>
  2. <view class="page hongbao-page">
  3. <view class="content">
  4. <view class="hongbao-header">
  5. <view class="hongbao-header-view">
  6. <view class="header-top">
  7. <view class="top-left">
  8. <image :src="myPhoto" class="top-left-left"></image>
  9. <view class="top-left-right">
  10. <text class="hb-name">{{my_data.nickname}}</text>
  11. <view>
  12. <text style="font-size: 24upx;color:#bebebe;margin-right:7px" @click="showTimeList">{{timeName}}</text>
  13. <text style="font-size: 10upx;color:#bebebe" class="iconfont-im icon-sanjiao"></text>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="top-right" v-if="0">
  18. <view><text>收到红包</text><text class="top-right-num">{{info.get_count}} 个</text></view>
  19. <view><text>手气最佳</text><text class="top-right-num">{{info.best_count}} 次</text></view>
  20. </view>
  21. <view class="top-right">
  22. <view><text>余额</text><text class="top-right-num">{{info.user_money}} 元</text></view>
  23. </view>
  24. </view>
  25. <view class="header-bottom">
  26. <text>总流水</text><text class="hongbao-num">¥{{info.amount}}</text>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="capital-list"
  31. v-if="list.length">
  32. <view class="capital-item"
  33. v-for="(item) in list"
  34. :key="item.id">
  35. <view class="item-left">
  36. <text class="time-msg">{{item.explain}}</text>
  37. <text class="time">{{timestampFormat(item.create_time + '')}}</text>
  38. </view>
  39. <view class="item-right">
  40. <text class="add-money"
  41. :style="{color:item.record_type == 0 ? '#e6b141' : 'black'}">{{item.record_type == 0 ? -item.money : '+'+item.money}}</text>
  42. <text class="yue">
  43. <text style="margin-right: 8rpx;">余额</text>
  44. {{item.user_money}}
  45. </text>
  46. </view>
  47. </view>
  48. <uni-load-more :status="status"></uni-load-more>
  49. </view>
  50. </view>
  51. <view class="hongbao-footer">
  52. <view @click="getHb(1)" :class="get==1?'active':''"><text>收入</text></view>
  53. <view @click="getHb(2)" :class="get==2?'active':''"><text>支出</text></view>
  54. </view>
  55. <uni-popup ref="popup2"
  56. type="bottom">
  57. <view class="but-view">
  58. <view class="but-top-view">
  59. <view v-for="item in timeList" :key="item.id" @click="getTimeHb(item.id,item.name)">{{item.name}}</view>
  60. </view>
  61. <view class="clone-but" @click="clonePopup">取消</view>
  62. </view>
  63. </uni-popup>
  64. </view>
  65. </template>
  66. <script>
  67. import uniLoadMore from "../../../components/uni-ui/uni-load-more/uni-load-more.vue";
  68. import _get from '../../../common/_get';
  69. import uniPopup from '../../../components/uni-popup/uni-popup.vue';
  70. import _action from '../../../common/_action';
  71. import _hook from '../../../common/_hook';
  72. import _data from '../../../common/_data';
  73. export default {
  74. computed: {
  75. status () {
  76. return this.pullUp == 0 ? 'more' : (this.pullUp == 1 ? 'loading' : '')
  77. },
  78. myPhoto(){
  79. return _data.staticPhoto() + this.my_data.photo;
  80. }
  81. },
  82. data () {
  83. return {
  84. info:{
  85. amount:'0.00',
  86. best_count:'0',
  87. get_count:'0',
  88. send_count:0,
  89. user_money:0,
  90. amount:0,
  91. },
  92. my_data:{},
  93. videPoup: false,
  94. get: 1,// 代表我发出还是收到
  95. time:4,
  96. pullUp: 0, //0加载更多 1 加载中 -1 加载完成
  97. page: 1,
  98. totallPage: 1,
  99. list: [
  100. ],
  101. timeName:'近三个月',
  102. type: '0',
  103. timeList:[{id:4,name:'近三个月'},{id:1,name:'本月'},{id:2,name:'上个月'},{id:3,name:'上上个月'}]
  104. }
  105. },
  106. onLoad (options) {
  107. if ('type' in options) {
  108. this.type = options.type;
  109. uni.setNavigationBarTitle({
  110. title: '我的红包记录'
  111. })
  112. }
  113. },
  114. onShow () {
  115. let _this = this;
  116. _hook.routeSonHook();
  117. this.getCapital('down');
  118. _get.getUserInfo({});
  119. uni.$on('data_user_info',function(data){
  120. _this.my_data = data;
  121. _data.data('user_info',data)
  122. });
  123. },
  124. components: {
  125. uniLoadMore,
  126. uniPopup
  127. },
  128. onReachBottom () {
  129. let _this = this;
  130. if (_this.pullUp == 0) {
  131. _this.page++;
  132. _this.pullUp = 1;
  133. this.getCapital('up');
  134. }
  135. },
  136. onPullDownRefresh () {
  137. this.pullUp = 0; //重置下拉
  138. this.page = 1;
  139. uni.startPullDownRefresh();
  140. this.getCapital('down', function () {
  141. uni.stopPullDownRefresh();
  142. });
  143. },
  144. methods: {
  145. // 发出和收到切换
  146. getHb(type){
  147. this.get= type
  148. this.page = 1;
  149. this.getCapital('down', function () {
  150. uni.stopPullDownRefresh();
  151. });
  152. },
  153. // 时间切换
  154. getTimeHb(time,name){
  155. this.timeName = name
  156. console.log(time)
  157. this.time = time;
  158. this.page = 1;
  159. let _this = this;
  160. this.getCapital('down', function () {
  161. _this.$refs.popup2.close();
  162. });
  163. },
  164. clonePopup(){
  165. this.$refs.popup2.close()
  166. },
  167. showTimeList () {
  168. console.log(55555)
  169. this.$refs.popup2.open()
  170. },
  171. getCapital (type, cb) {
  172. let _this = this;
  173. _get.getCapitalList({ page: this.page, type: 1,get:_this.get,time:_this.time }, function (res) {
  174. _this.totallPage = res.last_page;
  175. _this.info.amount = res.info.amount
  176. _this.info.user_money = res.info.user_money
  177. if (type == 'down') {
  178. _this.list = res.data;
  179. if (cb != undefined) cb();
  180. } else {
  181. if (_this.page > _this.totallPage) {
  182. _this.pullUp = -1;
  183. } else {
  184. _this.list = _this.list.concat(res.data)
  185. _this.pullUp = 0;
  186. }
  187. }
  188. _this.clonePopup()
  189. })
  190. },
  191. timestampFormat (time) {
  192. return _action.timestampFormat(time);
  193. },
  194. }
  195. }
  196. </script>
  197. <style>
  198. /*757575*/
  199. page {
  200. background-color: white;
  201. }
  202. .hongbao-header {
  203. padding: 40upx;
  204. }
  205. .hb-name{
  206. font-weight: bold;
  207. }
  208. .hongbao-page {
  209. display: flex;
  210. flex-direction: column;
  211. }
  212. .hongbao-page .content {
  213. padding-bottom: 100upx;
  214. }
  215. .hongbao-footer {
  216. height: 100upx;
  217. border-top: 1px solid #d3cdcd;
  218. position: fixed;
  219. display: flex;
  220. justify-content: space-between;
  221. bottom: 0;
  222. left: 0;
  223. right: 0;
  224. background: #ffffff;
  225. }
  226. .but-view {
  227. display: flex;
  228. flex-direction: column;
  229. padding: 40upx;
  230. }
  231. .but-top-view {
  232. display: flex;
  233. flex-direction: column;
  234. border-radius: 12upx;
  235. overflow: hidden;
  236. }
  237. .but-top-view view {
  238. width: 100%;
  239. background: #ffffff;
  240. display: flex;
  241. justify-content: center;
  242. align-items: center;
  243. height: 80upx;
  244. border-top: 1px solid #d3cdcd;
  245. }
  246. .clone-but{
  247. width: 100%;
  248. background: #ffffff;
  249. display: flex;
  250. justify-content: center;
  251. align-items: center;
  252. height: 80upx;
  253. border-radius: 12upx;
  254. margin-top: 30upx;
  255. }
  256. .hongbao-footer view {
  257. width: 50%;
  258. display: flex;
  259. align-items: center;
  260. justify-content: center;
  261. }
  262. .hongbao-footer text {
  263. height: 100%;
  264. display: flex;
  265. align-items: center;
  266. }
  267. .hongbao-footer .active text {
  268. border-top: 2px solid red;
  269. color: red;
  270. }
  271. .header-top {
  272. display: flex;
  273. height: 100upx;
  274. justify-content: space-between;
  275. }
  276. .top-left {
  277. display: flex;
  278. }
  279. .top-left-left {
  280. display: flex;
  281. align-items: center;
  282. justify-content: center;
  283. width: 100upx;
  284. background: chartreuse;
  285. border-radius: 10upx;
  286. height: 100%;
  287. margin-right: 20upx;
  288. }
  289. .top-left-right {
  290. display: flex;
  291. flex-direction: column;
  292. }
  293. .top-right-num {
  294. color: rebeccapurple;
  295. margin-left: 10upx;
  296. }
  297. .hongbao-header-view {
  298. height: 300upx;
  299. background: #f1edec;
  300. width: 100%;
  301. border-radius: 8upx;
  302. display: flex;
  303. justify-content: space-between;
  304. flex-direction: column;
  305. padding: 40upx;
  306. box-sizing: border-box;
  307. }
  308. .header-bottom {
  309. display: flex;
  310. align-items: center;
  311. }
  312. .hongbao-num {
  313. font-size: 46upx;
  314. font-weight: bold;
  315. }
  316. .item-left,
  317. .item-right {
  318. padding-bottom: 25upx;
  319. padding-top: 30upx;
  320. }
  321. .time,
  322. .yue {
  323. color: #757575;
  324. }
  325. .content .capital-list {
  326. display: flex;
  327. flex-direction: column;
  328. padding: 0upx 0upx 120upx 40upx;
  329. }
  330. .capital-list .capital-item {
  331. display: flex;
  332. flex-direction: row;
  333. justify-content: space-between;
  334. align-items: center;
  335. border-bottom: 1px solid #f2f2f2;
  336. }
  337. .item-right .add-money {
  338. margin-bottom: 15upx;
  339. font-size: 14px;
  340. font-weight: 500;
  341. }
  342. .sub-mone {
  343. margin-bottom: 15upx;
  344. font-size: 14px;
  345. font-weight: 500;
  346. color: #e6b141;
  347. }
  348. .item-left .time-msg {
  349. margin-bottom: 15upx;
  350. font-size: 14px;
  351. font-weight: 400;
  352. }
  353. .capital-list .capital-item .item-left {
  354. display: flex;
  355. flex-direction: column;
  356. }
  357. .capital-list .capital-item .item-right {
  358. display: flex;
  359. flex-direction: column;
  360. align-items: flex-end;
  361. padding-right: 40upx;
  362. }
  363. </style>