index.vue 7.9 KB

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