index.vue 6.9 KB

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