index.vue 7.0 KB

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