ldDetailed.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <view class="ldDetailed-container">
  3. <!-- 筛选菜单 -->
  4. <u-dropdown ref="uDropdown" class="filter-dropdown">
  5. <u-dropdown-item v-model="queryParam.changeType" :title="titType" :options="optionsType" @change="searchHandle()"></u-dropdown-item>
  6. <u-dropdown-item v-model="timeScope" :title="titScope" :options="optionsScope" @change="searchHandle()"></u-dropdown-item>
  7. </u-dropdown>
  8. <scroll-view class="scroll-con" scroll-y @scrolltolower="onreachBottom">
  9. <!-- 列表数据 -->
  10. <view class="cell-item-con">
  11. <view class="cell-item" v-for="(item, index) in listdata" :key="index">
  12. <text class="cell-item-month" v-if="timeScope == 'threeMonth'">{{item.month}}</text>
  13. <view class="cell-item-main" v-for="(subItem, ind) in item.monthDataList" :key="ind">
  14. <view :class="['cell-item-pic']">
  15. <u-image mode="scaleToFill" v-if="subItem.changeType == 'ADD'" shape="circle" width="70rpx" height="70rpx" src="/static/tudi.png"></u-image>
  16. <u-image mode="scaleToFill" v-else shape="circle" width="70rpx" height="70rpx" src="/static/bued.png"></u-image>
  17. </view>
  18. <view class="cell-item-c">
  19. <text class="cell-item-des">{{subItem.operateTypeDictValue||'--'}}</text>
  20. <text class="cell-item-date">{{subItem.createDate}}</text>
  21. </view>
  22. <view :class="['cell-item-score', subItem.changeType == 'ADD' ? 'black' : 'red']">
  23. <text>{{subItem.changeType == 'ADD' ? '+'+subItem.changeNum : '-'+subItem.changeNum}}</text>
  24. <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
  25. </view>
  26. </view>
  27. <view class="nodata" v-if="item.monthDataList.length==0 && status!='loading'">
  28. <u-empty :text="noDataText" mode="list"></u-empty>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="nodata" v-if="listdata.length==0 && status!='loading'">
  33. <u-empty :text="noDataText" mode="list"></u-empty>
  34. </view>
  35. <view class="loadmore">
  36. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  37. </view>
  38. </scroll-view>
  39. </view>
  40. </template>
  41. <script>
  42. import {ldUsedQuery} from '@/api/user.js'
  43. import getDate from '@/libs/getDate'
  44. import moment from 'moment'
  45. export default {
  46. data() {
  47. return {
  48. listdata: [],
  49. pageNo: 1, // 当前页码
  50. pageSize: 10, // 每页条数
  51. total: 0, // 数据总条数
  52. noDataText: '暂无数据', // 列表请求状态提示语
  53. status: 'loadmore', // 加载中状态
  54. timeScope: 'threeMonth', // 时间类别 1:近三个月 2:本月 3:本月前一月 4:本月前2月
  55. queryParam: { // 过滤条件
  56. changeType: '', // 金币变更类型
  57. },
  58. optionsType: [
  59. { label: '所有记录', value: '', },
  60. { label: '获取记录', value: 'ADD', },
  61. { label: '使用记录', value: 'SUB', }
  62. ]
  63. }
  64. },
  65. onShow() {
  66. this.searchHandle()
  67. },
  68. onLoad() {
  69. this.timeScope = 'threeMonth'
  70. this.queryParam.changeType = ''
  71. },
  72. computed: {
  73. // 时间过滤条件
  74. optionsScope(){ // 过滤条件 近3个月
  75. let arr = [
  76. { label: '近3个月', value: 'threeMonth' },
  77. { label: '本月', value: 'thisMonth' }
  78. ]
  79. arr[2] = { label: new Date().getMonth() + '月', value: 'lastMonth' }
  80. arr[3] = { label: new Date().getMonth()-1 + '月', value: 'lastTwoMonth' }
  81. return arr
  82. },
  83. titType(){ // 过滤条件 所有记录 title
  84. const row = this.optionsType.find(item => item.value == this.queryParam.changeType)
  85. return row ? row.label : this.optionsType[0].label
  86. },
  87. titScope(){ // 过滤条件 近3个月 title
  88. const row = this.optionsScope.find(item => item.value == this.timeScope)
  89. return row ? row.label : this.optionsScope[0].label
  90. },
  91. // 查询时间段
  92. queryDate() {
  93. var dt = new Date();
  94. const threeTime = dt.setMonth( dt.getMonth()-2 )
  95. const quickType = {
  96. threeMonth: [moment(getDate.getThreeMonthDays().starttime), moment(getDate.getThreeMonthDays().endtime)],
  97. lastMonth: [moment(getDate.getLastMonthDays().starttime), moment(getDate.getLastMonthDays().endtime)],
  98. thisMonth: [moment(getDate.getCurrMonthDays().starttime), moment(getDate.getCurrMonthDays().endtime)],
  99. lastTwoMonth: [moment(getDate.getLastTwoMonthDays().starttime), moment(getDate.getLastTwoMonthDays().endtime)],
  100. }
  101. let queryTime = {
  102. beginDate: quickType[this.timeScope][0].format('YYYY-MM-DD'),
  103. endDate: quickType[this.timeScope][1].format('YYYY-MM-DD')
  104. }
  105. return queryTime
  106. },
  107. },
  108. methods:{
  109. // 搜索查询
  110. searchHandle () {
  111. this.listdata = []
  112. this.status = "loading"
  113. let params = Object.assign(this.queryParam,this.queryDate)
  114. console.log(params,'pppppppp')
  115. ldUsedQuery(params).then(res => {
  116. console.log(res,'pppppppp')
  117. if (res.status == 200) {
  118. let list = res.data
  119. // 查询3个月时 数据处理
  120. if (this.timeScope == 'threeMonth') {
  121. list.map(item=>{
  122. let m = moment(item.month).month()+1
  123. item.month = (m == moment().month()+1) ? '本月' : m+'月'
  124. })
  125. }
  126. this.listdata = list
  127. } else {
  128. this.noDataText = res.message
  129. this.listdata = []
  130. this.total = 0
  131. }
  132. this.status = "nomore"
  133. })
  134. },
  135. }
  136. }
  137. </script>
  138. <style lang="less">
  139. page{
  140. height: 100%;
  141. background-color: #fff;
  142. }
  143. .ldDetailed-container{
  144. width: 100%;
  145. height: 100%;
  146. .nodata{
  147. margin: 50upx 0;
  148. }
  149. // 筛选菜单
  150. .filter-dropdown{
  151. background-color: #fff!important;
  152. .u-dropdown__menu__item{
  153. background-color: #fff!important;
  154. }
  155. }
  156. // 列表
  157. .scroll-con{
  158. height: calc(100% - 40);
  159. overflow: auto;
  160. }
  161. // 列表样式
  162. .cell-item-con{
  163. .cell-item{
  164. background-color: #fff;
  165. color: #606266;
  166. .cell-item-month{
  167. display: block;
  168. color: #909399;
  169. font-size: 26rpx;
  170. padding: 16rpx 30rpx;
  171. background-color: #f8f8f8;
  172. }
  173. .cell-item-main{
  174. display: flex;
  175. align-items: center;
  176. padding: 20rpx 30rpx;
  177. border-bottom: 1rpx solid #e9e9e9;
  178. .cell-item-pic{
  179. flex-shrink: 0;
  180. width: 90rpx;
  181. height: 90rpx;
  182. line-height: 90rpx;
  183. background-color: #FFFFFF;
  184. border-radius: 50%;
  185. text-align: center;
  186. display: flex;
  187. align-items: center;
  188. }
  189. .cell-item-c{
  190. flex-grow: 1;
  191. .cell-item-des{
  192. display: block;
  193. color: #606266;
  194. font-size: 30rpx;
  195. margin-bottom: 10rpx;
  196. }
  197. .cell-item-date{
  198. display: block;
  199. color: #909399;
  200. font-size: 24rpx;
  201. }
  202. }
  203. .cell-item-score{
  204. flex-shrink: 0;
  205. font-size: 40rpx;
  206. display: flex;
  207. align-items: center;
  208. }
  209. .black{
  210. color: #01c9b2;
  211. }
  212. .red{
  213. color: red;
  214. }
  215. .orange{
  216. background-color: #fcbd71;
  217. color: #fff;
  218. }
  219. }
  220. .cell-item-main:last-child{
  221. border: none;
  222. }
  223. }
  224. }
  225. }
  226. </style>