index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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. console.log(res,'----res',row.id)
  99. if (res.confirm) {
  100. GoldLogCancel({ id: row.id }).then(ret => {
  101. if(ret.status == 200){
  102. uni.showToast({ title: ret.message, icon: 'none' })
  103. _this.searchHandle(1)
  104. }
  105. })
  106. }
  107. }
  108. })
  109. },
  110. // 搜索查询
  111. searchHandle (pageNo) {
  112. this.status = "loading"
  113. pageNo ? this.pageNo = pageNo : null
  114. getGoldLogList({
  115. pageNo: this.pageNo,
  116. pageSize: this.pageSize,
  117. beginDate: this.searchForm.beginDate,
  118. endDate: this.searchForm.endDate,
  119. customerMobile: this.searchForm.customerMobile
  120. }).then(res => {
  121. if (res.status == 200) {
  122. if(this.pageNo>1){
  123. this.listdata = this.listdata.concat(res.data.list || [])
  124. }else{
  125. this.listdata = res.data.list || []
  126. this.scrollTop = 0
  127. }
  128. this.total = res.data.count || 0
  129. this.noDataText = '暂无数据'
  130. } else {
  131. this.noDataText = res.message
  132. this.listdata = []
  133. this.total = 0
  134. }
  135. this.status = "loadmore"
  136. })
  137. },
  138. // scroll-view到底部加载更多
  139. onreachBottom() {
  140. if(this.listdata.length < this.total){
  141. this.pageNo += 1
  142. this.searchHandle()
  143. }else{
  144. uni.showToast({ title: '已经到底了', icon: 'none' })
  145. this.status = "nomore"
  146. }
  147. }
  148. }
  149. }
  150. </script>
  151. <style lang="scss">
  152. .homePage-container {
  153. width: 100%;
  154. padding-top: 102rpx;
  155. // 筛选菜单
  156. .homePage-head{
  157. font-size: 30rpx;
  158. display: flex;
  159. justify-content: space-between;
  160. align-items: center;
  161. position: fixed;
  162. top: 0;
  163. left: 0;
  164. z-index: 9;
  165. padding: 26rpx 30rpx;
  166. background-color: #fff;
  167. box-shadow: 0rpx 0rpx 14rpx rgba(0,0,0,.05);
  168. width: 100%;
  169. border-top: 10rpx solid #f8f8f8;
  170. .head-con{
  171. flex-grow: 1;
  172. display: flex;
  173. align-items: center;
  174. justify-content: space-between;
  175. .homePage-tit{
  176. color: #040301;
  177. }
  178. .total-con{
  179. color: #040301;
  180. .goleNum{
  181. color: #eb0000;
  182. font-size: 30rpx;
  183. font-weight: bold;
  184. }
  185. .ld-icon{
  186. width: 30rpx;
  187. height: 30rpx;
  188. margin: 0 0 0 10rpx;
  189. vertical-align: middle;
  190. }
  191. }
  192. }
  193. .filter-icon{
  194. flex-shrink: 0;
  195. width: 36rpx;
  196. height: 36rpx;
  197. padding-left: 20rpx;
  198. }
  199. }
  200. // 列表
  201. .scroll-con{
  202. height: calc(100% - 40);
  203. overflow: auto;
  204. }
  205. // 列表样式
  206. .cell-item-con{
  207. margin-top: 10rpx;
  208. .cell-item{
  209. background-color: #fff;
  210. color: #606266;
  211. padding: 0 30rpx;
  212. margin-bottom: 20rpx;
  213. border-radius: 16rpx;
  214. font-size: 28rpx;
  215. .cell-item-c{
  216. display: flex;
  217. justify-content: space-between;
  218. padding: 18rpx 0;
  219. border-bottom: 1rpx solid #f2f2f2;
  220. .cell-item-label{
  221. flex-shrink: 0;
  222. width: 200rpx;
  223. color: #303133;
  224. }
  225. .cell-item-main{
  226. flex-grow: 1;
  227. text-align: right;
  228. .handle-btn{
  229. border-color: #fcbd71!important;
  230. background-color: #fcbd71!important;
  231. }
  232. }
  233. .blue {
  234. color: #1890FF;
  235. }
  236. .green {
  237. color: #16b50e;
  238. }
  239. .red {
  240. color: red;
  241. }
  242. &:last-child{
  243. border: none;
  244. }
  245. }
  246. .handle-con{
  247. align-items: center;
  248. // margin-top: 10rpx;
  249. // padding-top: 18rpx;
  250. // padding: 0;
  251. }
  252. }
  253. }
  254. }
  255. </style>