capital.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  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="get == 1">
  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" v-else >
  22. <view><text>发出红包</text><text class="top-right-num">{{info.send_count}} 个</text></view>
  23. </view>
  24. </view>
  25. <view class="header-bottom">
  26. <text> {{get == 1 ? '共收到:':'共发出:'}}</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. },
  90. my_data:{},
  91. videPoup: false,
  92. get: 1,// 代表我发出还是收到
  93. time:4,
  94. pullUp: 0, //0加载更多 1 加载中 -1 加载完成
  95. page: 1,
  96. totallPage: 1,
  97. list: [
  98. ],
  99. timeName:'近三个月',
  100. type: '',
  101. timeList:[{id:4,name:'近三个月'},{id:1,name:'本月'},{id:2,name:'上个月'},{id:3,name:'上上个月'}]
  102. }
  103. },
  104. onLoad (options) {
  105. if ('type' in options) {
  106. this.type = options.type;
  107. uni.setNavigationBarTitle({
  108. title: '我的红包记录'
  109. })
  110. }
  111. },
  112. onShow () {
  113. let _this = this;
  114. _hook.routeSonHook();
  115. this.getCapital('down');
  116. _get.getUserInfo({});
  117. uni.$on('data_user_info',function(data){
  118. _this.my_data = data;
  119. _data.data('user_info',data)
  120. });
  121. },
  122. components: {
  123. uniLoadMore,
  124. uniPopup
  125. },
  126. onReachBottom () {
  127. let _this = this;
  128. if (_this.pullUp == 0) {
  129. _this.page++;
  130. _this.pullUp = 1;
  131. this.getCapital('up');
  132. }
  133. },
  134. onPullDownRefresh () {
  135. this.pullUp = 0; //重置下拉
  136. this.page = 1;
  137. uni.startPullDownRefresh();
  138. this.getCapital('down', function () {
  139. uni.stopPullDownRefresh();
  140. });
  141. },
  142. methods: {
  143. // 发出和收到切换
  144. getHb(type){
  145. this.get= type
  146. this.page = 1;
  147. this.getCapital('down', function () {
  148. uni.stopPullDownRefresh();
  149. });
  150. },
  151. // 时间切换
  152. getTimeHb(time,name){
  153. this.timeName = name
  154. console.log(time)
  155. this.time = time;
  156. this.page = 1;
  157. let _this = this;
  158. this.getCapital('down', function () {
  159. _this.$refs.popup2.close();
  160. });
  161. },
  162. clonePopup(){
  163. this.$refs.popup2.close()
  164. },
  165. showTimeList () {
  166. console.log(55555)
  167. this.$refs.popup2.open()
  168. },
  169. getCapital (type, cb) {
  170. let _this = this;
  171. _get.getUserCapitalList({ page: this.page, type: _this.type,get:_this.get,time:_this.time }, function (res) {
  172. _this.totallPage = res.last_page;
  173. if (type == 'down') {
  174. _this.list = res.data;
  175. if (cb != undefined) cb();
  176. } else {
  177. if (_this.page > _this.totallPage) {
  178. _this.pullUp = -1;
  179. } else {
  180. _this.list = _this.list.concat(res.data)
  181. _this.pullUp = 0;
  182. }
  183. }
  184. if(_this.type){
  185. if(_this.get == 1){
  186. _this.info.best_count = res.info.best_count
  187. _this.info.get_count = res.info.count
  188. _this.info.amount = res.info.amount
  189. }else {
  190. _this.info.send_count = res.info.send_count
  191. _this.info.amount = res.info.amount
  192. }
  193. }
  194. _this.clonePopup()
  195. })
  196. },
  197. timestampFormat (time) {
  198. return _action.timestampFormat(time);
  199. },
  200. }
  201. }
  202. </script>
  203. <style>
  204. /*757575*/
  205. page {
  206. background-color: white;
  207. }
  208. .hongbao-header {
  209. padding: 40upx;
  210. }
  211. .hb-name{
  212. font-weight: bold;
  213. }
  214. .hongbao-page {
  215. display: flex;
  216. flex-direction: column;
  217. }
  218. .hongbao-page .content {
  219. padding-bottom: 100upx;
  220. }
  221. .hongbao-footer {
  222. height: 100upx;
  223. border-top: 1px solid #d3cdcd;
  224. position: fixed;
  225. display: flex;
  226. justify-content: space-between;
  227. bottom: 0;
  228. left: 0;
  229. right: 0;
  230. background: #ffffff;
  231. }
  232. .but-view {
  233. display: flex;
  234. flex-direction: column;
  235. padding: 40upx;
  236. }
  237. .but-top-view {
  238. display: flex;
  239. flex-direction: column;
  240. border-radius: 12upx;
  241. overflow: hidden;
  242. }
  243. .but-top-view view {
  244. width: 100%;
  245. background: #ffffff;
  246. display: flex;
  247. justify-content: center;
  248. align-items: center;
  249. height: 80upx;
  250. border-top: 1px solid #d3cdcd;
  251. }
  252. .clone-but{
  253. width: 100%;
  254. background: #ffffff;
  255. display: flex;
  256. justify-content: center;
  257. align-items: center;
  258. height: 80upx;
  259. border-radius: 12upx;
  260. margin-top: 30upx;
  261. }
  262. .hongbao-footer view {
  263. width: 50%;
  264. display: flex;
  265. align-items: center;
  266. justify-content: center;
  267. }
  268. .hongbao-footer text {
  269. height: 100%;
  270. display: flex;
  271. align-items: center;
  272. }
  273. .hongbao-footer .active text {
  274. border-top: 2px solid red;
  275. color: red;
  276. }
  277. .header-top {
  278. display: flex;
  279. height: 100upx;
  280. justify-content: space-between;
  281. }
  282. .top-left {
  283. display: flex;
  284. }
  285. .top-left-left {
  286. display: flex;
  287. align-items: center;
  288. justify-content: center;
  289. width: 100upx;
  290. background: chartreuse;
  291. border-radius: 10upx;
  292. height: 100%;
  293. margin-right: 20upx;
  294. }
  295. .top-left-right {
  296. display: flex;
  297. flex-direction: column;
  298. }
  299. .top-right-num {
  300. color: rebeccapurple;
  301. margin-left: 10upx;
  302. }
  303. .hongbao-header-view {
  304. height: 300upx;
  305. background: #f1edec;
  306. width: 100%;
  307. border-radius: 8upx;
  308. display: flex;
  309. justify-content: space-between;
  310. flex-direction: column;
  311. padding: 40upx;
  312. box-sizing: border-box;
  313. }
  314. .header-bottom {
  315. display: flex;
  316. align-items: center;
  317. }
  318. .hongbao-num {
  319. font-size: 46upx;
  320. font-weight: bold;
  321. }
  322. .item-left,
  323. .item-right {
  324. padding-bottom: 25upx;
  325. padding-top: 30upx;
  326. }
  327. .time,
  328. .yue {
  329. color: #757575;
  330. }
  331. .content .capital-list {
  332. display: flex;
  333. flex-direction: column;
  334. padding: 0upx 0upx 120upx 40upx;
  335. }
  336. .capital-list .capital-item {
  337. display: flex;
  338. flex-direction: row;
  339. justify-content: space-between;
  340. align-items: center;
  341. border-bottom: 1px solid #f2f2f2;
  342. }
  343. .item-right .add-money {
  344. margin-bottom: 15upx;
  345. font-size: 14px;
  346. font-weight: 500;
  347. }
  348. .sub-mone {
  349. margin-bottom: 15upx;
  350. font-size: 14px;
  351. font-weight: 500;
  352. color: #e6b141;
  353. }
  354. .item-left .time-msg {
  355. margin-bottom: 15upx;
  356. font-size: 14px;
  357. font-weight: 400;
  358. }
  359. .capital-list .capital-item .item-left {
  360. display: flex;
  361. flex-direction: column;
  362. }
  363. .capital-list .capital-item .item-right {
  364. display: flex;
  365. flex-direction: column;
  366. align-items: flex-end;
  367. padding-right: 40upx;
  368. }
  369. </style>