index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <view class="homePage-container">
  3. <!-- 筛选弹框 -->
  4. <search-modal v-if="openScreen" :visible="openScreen" :defaultParams="searchForm" @refresh="refresh" @close="openScreen=false"></search-modal>
  5. <view class="homePage-head">
  6. <text class="homePage-tit">交易记录</text>
  7. <image class="filter-icon" src="@/static/filter.png" @tap="openScreen=true"></image>
  8. </view>
  9. <scroll-view class="scroll-con" scroll-y @scrolltolower="onreachBottom">
  10. <!-- 列表数据 -->
  11. <view class="cell-item-con">
  12. <view class="cell-item" v-for="(item, index) in listdata" :key="index">
  13. <view class="cell-item-c">
  14. <view class="cell-item-label">交易时间</view>
  15. <view class="cell-item-main">{{item.creatDate}}</view>
  16. </view>
  17. <view class="cell-item-c">
  18. <view class="cell-item-label">支付账户</view>
  19. <view class="cell-item-main">{{item.account}}</view>
  20. </view>
  21. <view class="cell-item-c">
  22. <view class="cell-item-label">交易数量(个)</view>
  23. <view :class="['cell-item-main', item.num>0 ? 'red' : 'blue']">{{item.num > 0 ? '+' + item.num : item.num }}</view>
  24. </view>
  25. <view class="cell-item-c">
  26. <view class="cell-item-label">备注</view>
  27. <view class="cell-item-main">{{item.des ? item.des : '--'}}</view>
  28. </view>
  29. <view class="cell-item-c handle-con">
  30. <view class="cell-item-label">操作</view>
  31. <view class="cell-item-main">
  32. <u-button type="primary" size="mini" v-if="item.state" class="handle-btn" @click="revokeFun(item)">撤销单据</u-button>
  33. <text v-else style="color: #909399;">单据已撤销</text>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <u-empty class="nodata" :text="noDataText" v-if="listdata.length==0 && status!='loading'" mode="list"></u-empty>
  39. <view class="loadmore">
  40. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  41. </view>
  42. </scroll-view>
  43. </view>
  44. </template>
  45. <script>
  46. import searchModal from './searchModal.vue'
  47. export default {
  48. components: { searchModal },
  49. data() {
  50. return {
  51. listdata: [
  52. { creatDate: '2020-11-05 17:13', account: '15787878787', num: 154, state: 1, des: '备注备注备注11221备注'},
  53. { creatDate: '2020-11-05 17:13', account: '15787878787', num: -15, state: 1, des: '描述秒回的时刻萨菲科技尸鬼封尽看嘎是否1备注'},
  54. { creatDate: '2020-11-05 17:13', account: '15000000000', num: 4, state: 0, des: '备注备注备注11221备注'},
  55. { creatDate: '2020-11-05 17:13', account: '15787878787', num: -8, state: 1, des: ''},
  56. { creatDate: '2020-11-05 17:13', account: '15787878787', num: 50, state: 0, des: '备注备注备注11221备注'},
  57. ],
  58. pageNo: 1, // 当前页码
  59. pageSize: 10, // 每页条数
  60. total: 0, // 数据总条数
  61. noDataText: '暂无数据', // 列表请求状态提示语
  62. status: 'loadmore', // 加载中状态
  63. openScreen: false, // 是否打开筛选
  64. searchForm: { // 查询条件
  65. beginDate: '', // 创建时间默认筛选近7天
  66. endDate: '', // 创建时间默认筛选近7天
  67. account: '' // 支付账户
  68. },
  69. }
  70. },
  71. onShow() {
  72. this.searchHandle(1)
  73. },
  74. methods:{
  75. // 获取查询参数 刷新列表
  76. refresh(params){
  77. this.searchForm = params
  78. this.listdata = []
  79. this.total = 0
  80. this.searchHandle(1)
  81. },
  82. // 撤销单据
  83. revokeFun(row){
  84. let _this = this
  85. uni.showModal({
  86. title: '提示',
  87. content: '撤销单据后乐豆将全部退回给原支付账号,确认撤销吗?',
  88. success(res) {
  89. if (res.confirm) {
  90. }
  91. }
  92. })
  93. },
  94. // 搜索查询
  95. searchHandle (pageNo) {
  96. this.status = "loading"
  97. pageNo ? this.pageNo = pageNo : null
  98. // searchSuppliers({
  99. // pageNo: this.pageNo,
  100. // pageSize: this.pageSize,
  101. // queryWord: this.queryValue
  102. // }).then(res => {
  103. // if (res.status == 200) {
  104. // if(this.pageNo>1){
  105. // this.listdata = this.listdata.concat(res.data.list || [])
  106. // }else{
  107. // this.listdata = res.data.list || []
  108. // }
  109. // this.total = res.data.count || 0
  110. // this.listdata.length == 0 && this.queryValue != '' ? this.noDataText = '没有搜索到相关结果' : this.noDataText = '暂无数据'
  111. // } else {
  112. // this.noDataText = res.message
  113. // this.listdata = []
  114. // this.total = 0
  115. // }
  116. this.status = "loadmore"
  117. // })
  118. },
  119. // scroll-view到底部加载更多
  120. onreachBottom() {
  121. if(this.listdata.length < this.total){
  122. this.pageNo += 1
  123. this.searchHandle()
  124. }else{
  125. uni.showToast({ title: '已经到底了', icon: 'none' })
  126. this.status = "nomore"
  127. }
  128. }
  129. }
  130. }
  131. </script>
  132. <style lang="scss">
  133. .homePage-container {
  134. width: 100%;
  135. padding-top: 84rpx;
  136. // 筛选菜单
  137. .homePage-head{
  138. display: flex;
  139. justify-content: space-between;
  140. align-items: center;
  141. position: fixed;
  142. top: 0;
  143. left: 0;
  144. z-index: 9;
  145. padding: 20rpx 30rpx;
  146. background-color: #fff;
  147. box-shadow: 0rpx 0rpx 14rpx rgba(0,0,0,.05);
  148. width: 100%;
  149. .filter-icon{
  150. width: 36rpx;
  151. height: 36rpx;
  152. }
  153. }
  154. // 列表
  155. .scroll-con{
  156. height: calc(100% - 40);
  157. overflow: auto;
  158. }
  159. // 列表样式
  160. .cell-item-con{
  161. padding: 0 30rpx;
  162. margin-top: 10rpx;
  163. .cell-item{
  164. background-color: #fff;
  165. color: #606266;
  166. padding: 20rpx 30rpx 14rpx;
  167. margin-bottom: 20rpx;
  168. border-radius: 16rpx;
  169. .cell-item-c{
  170. display: flex;
  171. justify-content: space-between;
  172. padding: 10rpx 0;
  173. .cell-item-label{
  174. flex-shrink: 0;
  175. width: 200rpx;
  176. color: #303133;
  177. }
  178. .cell-item-main{
  179. flex-grow: 1;
  180. text-align: right;
  181. .handle-btn{
  182. border-color: #fcbd71!important;
  183. background-color: #fcbd71!important;
  184. }
  185. }
  186. .blue {
  187. color: #1890FF;
  188. }
  189. .green {
  190. color: #16b50e;
  191. }
  192. .red {
  193. color: red;
  194. }
  195. }
  196. .handle-con{
  197. align-items: center;
  198. border-top: 1rpx solid #f8f8f8;
  199. margin-top: 10rpx;
  200. padding-top: 18rpx;
  201. }
  202. }
  203. }
  204. }
  205. </style>