index.vue 8.2 KB

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