Detail.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <view class="container" v-if="isShow">
  3. <view class="headerBox">
  4. <view class="tabBox">
  5. <view class="tabItem" :class="tabIndex == 0 ? 'active' : ''" @tap="onChangeState(0)">积分收入</view>
  6. <view class="tabItem" :class="tabIndex == 1 ? 'active' : ''" @tap="onChangeState(1)">积分支出</view>
  7. </view>
  8. </view>
  9. <view class="totalPointBox">
  10. <text>总计:</text>
  11. <text class="totalPoint">{{totalPoint}}</text>
  12. </view>
  13. <view class="listHeader">
  14. <text class="listHeader_time">时间</text>
  15. <text class="listHeader_type">形式</text>
  16. <text class="listHeader_point">积分</text>
  17. </view>
  18. <view class="contentBox">
  19. <z-paging ref="paging" v-model="listData" @query="onGetList" refresher-update-time-key="list">
  20. <view class="listInfoBox">
  21. <view class="listInfo" v-for="(item, index) in listData" :key="index">
  22. <text class="listInfo_time">{{item.creationTime}}</text>
  23. <text class="listInfo_type">{{item.sourceTxt}}</text>
  24. <text class="listInfo_point">{{item.points}}</text>
  25. </view>
  26. </view>
  27. </z-paging>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. var that;
  33. export default {
  34. data() {
  35. return {
  36. isShow: false,
  37. tabIndex: 0,
  38. Direction: '',
  39. listData: [],
  40. isReLoad: false,
  41. totalPoint: 0
  42. }
  43. },
  44. onLoad(options) {
  45. that = this;
  46. that.onGetTotalPoint();
  47. that.isShow = true;
  48. },
  49. methods: {
  50. onGetTotalPoint(){
  51. that.$admin.req({
  52. method: 'GET',
  53. url: '/api/v1/Snapshot/points/total?Direction=' + that.tabIndex,
  54. }).then(res => {
  55. that.totalPoint = res;
  56. }, err => {
  57. that.$util.msg(err);
  58. })
  59. },
  60. onGetList(pageNo, pageSize) {
  61. that.$admin.req({
  62. method: 'GET',
  63. url: '/api/v1/Snapshot/points?Direction=' + that.tabIndex + '&QueryIndex=' + (pageNo - 1) + '&QueryCount=' + pageSize,
  64. }).then(res => {
  65. if (res && res.length > 0) {
  66. res.forEach((item, index) => {
  67. item.creationTime = item.creationTime ? that.$util.formatTime(new Date(item.creationTime)).split(' ')[0] : '';
  68. })
  69. that.$refs.paging.complete(res);
  70. } else if (res && res.length == 0) {
  71. that.$refs.paging.complete([]);
  72. } else {
  73. that.$util.msg('网络出错!');
  74. that.$refs.paging.complete(false);
  75. }
  76. typeof fun === 'function' && fun();
  77. }, err => {
  78. if (!that.isReLoad) {
  79. that.isReLoad = true;
  80. that.onGetOrderList(pageNo, pageSize);
  81. } else {
  82. that.$util.msg(err);
  83. that.$refs.paging.complete(false);
  84. }
  85. })
  86. },
  87. // 切换工单状态
  88. onChangeState(tabIndex) {
  89. if (that.tabIndex != tabIndex){
  90. that.tabIndex = tabIndex;
  91. that.$refs.paging.reload();
  92. }
  93. },
  94. }
  95. }
  96. </script>
  97. <style lang="less">
  98. .container {
  99. background-color: #F6F7F8;
  100. }
  101. .headerBox {
  102. line-height: 0;
  103. background-color: #fff;
  104. }
  105. .tabBox {
  106. padding: 0;
  107. line-height: 48rpx;
  108. }
  109. .tabItem {
  110. padding: 20rpx 0 30rpx;
  111. display: inline-block;
  112. width: calc(50%);
  113. text-align: center;
  114. color: #333333;
  115. font-size: 28rpx;
  116. position: relative;
  117. }
  118. .active {
  119. color: #3e6ffd;
  120. }
  121. .active::after {
  122. content: " ";
  123. width: 52rpx;
  124. height: 6rpx;
  125. background-color: #3e6ffd;
  126. position: absolute;
  127. bottom: 0;
  128. left: calc(50% - 26rpx);
  129. }
  130. .totalPointBox{
  131. padding: 30rpx 40rpx;
  132. text-align: right;
  133. font-size: 32rpx;
  134. font-weight: bold;
  135. }
  136. .totalPoint {
  137. color: #3e6ffd;
  138. font-size: 36rpx;
  139. }
  140. .listHeader {
  141. display: flex;
  142. justify-content: space-between;
  143. font-size: 32rpx;
  144. color: #333;
  145. padding: 30rpx 20rpx 20rpx;
  146. text-align: center;
  147. color: #3e6ffd;
  148. background-color: #fff;
  149. }
  150. .listHeader_time{
  151. width: 160rpx;
  152. text-align: center;
  153. }
  154. .listHeader_type{
  155. width: calc(100% - 320rpx);
  156. text-align: center;
  157. }
  158. .listHeader_point{
  159. width: 160rpx;
  160. text-align: center;
  161. }
  162. .contentBox {
  163. position: relative;
  164. height: calc(100% - 250rpx);
  165. background-color: #fff;
  166. }
  167. .listInfo {
  168. display: flex;
  169. justify-content: space-between;
  170. color: #333;
  171. text-align: center;
  172. padding: 30rpx 20rpx 20rpx;
  173. }
  174. .listInfo_time{
  175. width: 160rpx;
  176. text-align: center;
  177. }
  178. .listInfo_type{
  179. width: calc(100% - 320rpx);
  180. text-align: center;
  181. }
  182. .listInfo_point{
  183. width: 160rpx;
  184. text-align: center;
  185. color: #fe0000;
  186. }
  187. </style>