index.vue 8.1 KB

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