index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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">{{ldTotal}}</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, GoldLogTotal } 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. ldTotal: 0 // 乐豆总计数
  79. }
  80. },
  81. onShow() {
  82. this.openScreen = false // 关闭筛选框
  83. this.searchHandle(1)
  84. this.getGoldLogTotal()
  85. },
  86. methods:{
  87. // 总计
  88. getGoldLogTotal(){
  89. GoldLogTotal({}).then(res => {
  90. if(res.status == 200){
  91. this.ldTotal = res.data ? res.data.changeNum : 0
  92. }else{
  93. this.ldTotal = 0
  94. }
  95. })
  96. },
  97. // 获取查询参数 刷新列表
  98. refresh(params){
  99. this.searchForm = params
  100. this.listdata = []
  101. this.total = 0
  102. this.searchHandle(1)
  103. this.getGoldLogTotal()
  104. },
  105. // 撤销单据
  106. revokeFun(row){
  107. const _this = this
  108. uni.showModal({
  109. title: '提示',
  110. content: '撤销单据后乐豆将全部退回给原支付账号,确认撤销吗?',
  111. success(res) {
  112. if (res.confirm) {
  113. GoldLogCancel({ id: row.id }).then(ret => {
  114. if(ret.status == 200){
  115. uni.showToast({ title: ret.message, icon: 'none' })
  116. _this.searchHandle(1)
  117. }
  118. })
  119. }
  120. }
  121. })
  122. },
  123. // 搜索查询
  124. searchHandle (pageNo) {
  125. this.status = "loading"
  126. pageNo ? this.pageNo = pageNo : null
  127. getGoldLogList({
  128. pageNo: this.pageNo,
  129. pageSize: this.pageSize,
  130. beginDate: this.searchForm.beginDate,
  131. endDate: this.searchForm.endDate,
  132. customerMobile: this.searchForm.customerMobile
  133. }).then(res => {
  134. if (res.status == 200) {
  135. if(this.pageNo>1){
  136. this.listdata = this.listdata.concat(res.data.list || [])
  137. }else{
  138. this.listdata = res.data.list || []
  139. this.scrollTop = 0
  140. }
  141. this.total = res.data.count || 0
  142. this.noDataText = '暂无数据'
  143. } else {
  144. this.noDataText = res.message
  145. this.listdata = []
  146. this.total = 0
  147. }
  148. this.status = "loadmore"
  149. })
  150. },
  151. // scroll-view到底部加载更多
  152. onreachBottom() {
  153. if(this.listdata.length < this.total){
  154. this.pageNo += 1
  155. this.searchHandle()
  156. }else{
  157. uni.showToast({ title: '已经到底了', icon: 'none' })
  158. this.status = "nomore"
  159. }
  160. }
  161. }
  162. }
  163. </script>
  164. <style lang="scss">
  165. page{
  166. height: 100%;
  167. }
  168. .homePage-container {
  169. width: 100%;
  170. height: 100%;
  171. display: flex;
  172. flex-direction: column;
  173. padding-top: 102rpx;
  174. // 筛选菜单
  175. .homePage-head{
  176. font-size: 30rpx;
  177. display: flex;
  178. justify-content: space-between;
  179. align-items: center;
  180. position: fixed;
  181. top: 0;
  182. left: 0;
  183. z-index: 9;
  184. padding: 26rpx 30rpx;
  185. background-color: #fff;
  186. box-shadow: 0rpx 0rpx 14rpx rgba(0,0,0,.05);
  187. width: 100%;
  188. border-top: 10rpx solid #f8f8f8;
  189. .head-con{
  190. flex-grow: 1;
  191. display: flex;
  192. align-items: center;
  193. justify-content: space-between;
  194. .homePage-tit{
  195. color: #040301;
  196. }
  197. .total-con{
  198. color: #040301;
  199. .goleNum{
  200. color: #eb0000;
  201. font-size: 30rpx;
  202. font-weight: bold;
  203. }
  204. .ld-icon{
  205. width: 30rpx;
  206. height: 30rpx;
  207. margin: 0 0 0 10rpx;
  208. vertical-align: middle;
  209. }
  210. }
  211. }
  212. .filter-icon{
  213. flex-shrink: 0;
  214. width: 36rpx;
  215. height: 36rpx;
  216. padding-left: 20rpx;
  217. }
  218. }
  219. // 列表
  220. .scroll-con{
  221. flex: 1;
  222. // height: calc(100% - 40);
  223. overflow: auto;
  224. }
  225. // 列表样式
  226. .cell-item-con{
  227. margin-top: 10rpx;
  228. .cell-item{
  229. background-color: #fff;
  230. color: #606266;
  231. padding: 0 30rpx;
  232. margin-bottom: 20rpx;
  233. border-radius: 16rpx;
  234. font-size: 28rpx;
  235. .cell-item-c{
  236. display: flex;
  237. justify-content: space-between;
  238. padding: 18rpx 0;
  239. border-bottom: 1rpx solid #f2f2f2;
  240. .cell-item-label{
  241. flex-shrink: 0;
  242. width: 200rpx;
  243. color: #303133;
  244. }
  245. .cell-item-main{
  246. flex-grow: 1;
  247. text-align: right;
  248. .handle-btn{
  249. border-color: #fcbd71!important;
  250. background-color: #fcbd71!important;
  251. }
  252. }
  253. .blue {
  254. color: #1890FF;
  255. }
  256. .green {
  257. color: #16b50e;
  258. }
  259. .red {
  260. color: red;
  261. }
  262. &:last-child{
  263. border: none;
  264. }
  265. }
  266. .handle-con{
  267. align-items: center;
  268. // margin-top: 10rpx;
  269. // padding-top: 18rpx;
  270. // padding: 0;
  271. }
  272. }
  273. }
  274. }
  275. </style>