ldDetailed.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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. uni.showShareMenu({
  73. withShareTicket: true,
  74. menus: ['shareAppMessage', 'shareTimeline']
  75. })
  76. },
  77. computed: {
  78. // 时间过滤条件
  79. optionsScope(){ // 过滤条件 近3个月
  80. let arr = [
  81. { label: '近3个月', value: 'threeMonth' },
  82. { label: '本月', value: 'thisMonth' }
  83. ]
  84. arr[2] = { label: new Date().getMonth() + '月', value: 'lastMonth' }
  85. arr[3] = { label: new Date().getMonth()-1 + '月', value: 'lastTwoMonth' }
  86. return arr
  87. },
  88. titType(){ // 过滤条件 所有记录 title
  89. const row = this.optionsType.find(item => item.value == this.queryParam.changeType)
  90. return row ? row.label : this.optionsType[0].label
  91. },
  92. titScope(){ // 过滤条件 近3个月 title
  93. const row = this.optionsScope.find(item => item.value == this.timeScope)
  94. return row ? row.label : this.optionsScope[0].label
  95. },
  96. // 查询时间段
  97. queryDate() {
  98. var dt = new Date();
  99. const threeTime = dt.setMonth( dt.getMonth()-2 )
  100. const quickType = {
  101. threeMonth: [moment(getDate.getThreeMonthDays().starttime), moment(getDate.getThreeMonthDays().endtime)],
  102. lastMonth: [moment(getDate.getLastMonthDays().starttime), moment(getDate.getLastMonthDays().endtime)],
  103. thisMonth: [moment(getDate.getCurrMonthDays().starttime), moment(getDate.getCurrMonthDays().endtime)],
  104. lastTwoMonth: [moment(getDate.getLastTwoMonthDays().starttime), moment(getDate.getLastTwoMonthDays().endtime)],
  105. }
  106. let queryTime = {
  107. beginDate: quickType[this.timeScope][0].format('YYYY-MM-DD'),
  108. endDate: quickType[this.timeScope][1].format('YYYY-MM-DD')
  109. }
  110. return queryTime
  111. },
  112. },
  113. methods:{
  114. // 搜索查询
  115. searchHandle () {
  116. this.listdata = []
  117. this.status = "loading"
  118. let params = Object.assign(this.queryParam,this.queryDate)
  119. console.log(params,'pppppppp')
  120. ldUsedQuery(params).then(res => {
  121. console.log(res,'pppppppp')
  122. if (res.status == 200) {
  123. let list = res.data
  124. // 查询3个月时 数据处理
  125. if (this.timeScope == 'threeMonth') {
  126. list.map(item=>{
  127. let m = moment(item.month).month()+1
  128. item.month = (m == moment().month()+1) ? '本月' : m+'月'
  129. })
  130. }
  131. this.listdata = list
  132. } else {
  133. this.noDataText = res.message
  134. this.listdata = []
  135. this.total = 0
  136. }
  137. this.status = "nomore"
  138. })
  139. },
  140. }
  141. }
  142. </script>
  143. <style lang="less">
  144. page{
  145. height: 100%;
  146. background-color: #fff;
  147. }
  148. .ldDetailed-container{
  149. width: 100%;
  150. height: 100%;
  151. .nodata{
  152. margin: 50upx 0;
  153. }
  154. // 筛选菜单
  155. .filter-dropdown{
  156. background-color: #fff!important;
  157. .u-dropdown__menu__item{
  158. background-color: #fff!important;
  159. }
  160. }
  161. // 列表
  162. .scroll-con{
  163. height: calc(100% - 40);
  164. overflow: auto;
  165. }
  166. // 列表样式
  167. .cell-item-con{
  168. .cell-item{
  169. background-color: #fff;
  170. color: #606266;
  171. .cell-item-month{
  172. display: block;
  173. color: #909399;
  174. font-size: 26rpx;
  175. padding: 16rpx 30rpx;
  176. background-color: #f8f8f8;
  177. }
  178. .cell-item-main{
  179. display: flex;
  180. align-items: center;
  181. padding: 20rpx 30rpx;
  182. border-bottom: 1rpx solid #e9e9e9;
  183. .cell-item-pic{
  184. flex-shrink: 0;
  185. width: 90rpx;
  186. height: 90rpx;
  187. line-height: 90rpx;
  188. background-color: #FFFFFF;
  189. border-radius: 50%;
  190. text-align: center;
  191. display: flex;
  192. align-items: center;
  193. }
  194. .cell-item-c{
  195. flex-grow: 1;
  196. .cell-item-des{
  197. display: block;
  198. color: #606266;
  199. font-size: 30rpx;
  200. margin-bottom: 10rpx;
  201. }
  202. .cell-item-date{
  203. display: block;
  204. color: #909399;
  205. font-size: 24rpx;
  206. }
  207. }
  208. .cell-item-score{
  209. flex-shrink: 0;
  210. font-size: 40rpx;
  211. display: flex;
  212. align-items: center;
  213. }
  214. .black{
  215. color: #01c9b2;
  216. }
  217. .red{
  218. color: red;
  219. }
  220. .orange{
  221. background-color: #fcbd71;
  222. color: #fff;
  223. }
  224. }
  225. .cell-item-main:last-child{
  226. border: none;
  227. }
  228. }
  229. }
  230. }
  231. </style>