index.vue 7.5 KB

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