index.vue 7.2 KB

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