Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.91 KB | None | 0 0
  1. <template>
  2. <view class="cm-wrap">
  3. <cm-header tit="转账记录" type="black"></cm-header>
  4. <tab-scroll-view ref="scrollBox" :currentIndex.sync="currentIndex" :scrollTop.sync="scrollTop" :tabParams="tabParams" :tabContent.sync="tabContent" :loadMoreFunc="loadMoreFunc" :tabList.sync="tabList">
  5. <template slot-scope="contentItem" slot="contentItem">
  6. <transfer-record-item :data="contentItem"></transfer-record-item>
  7. </template>
  8. </tab-scroll-view>
  9. </view>
  10. </template>
  11.  
  12. <script>
  13. import tabScrollView from "@/components/cm-tab-scroll-view.vue"
  14. import transferRecordItem from "@/components/pages/pay/transferRecordItem.vue"
  15. import {
  16. ApiqueryPage,
  17. ApigetPlatformList
  18. } from "@/common/libs/service/game.js"
  19. export default {
  20. components: {
  21. tabScrollView,
  22. transferRecordItem
  23. },
  24. data() {
  25. return {
  26. scrollTop:0,
  27. currentIndex:0,
  28. tabList: [{
  29. label: "全部",
  30. key: "all",
  31. },
  32. {
  33. label: "已完成",
  34. key: "complete"
  35. },
  36. {
  37. label: "失败",
  38. key: "fail"
  39. }
  40. ],
  41. tabContent: [{
  42. key: "all",
  43. list: [],
  44. LoadingType: 0,
  45. scrollTop:0
  46. },
  47. {
  48. key: "complete",
  49. list: [],
  50. LoadingType: 0,
  51. scrollTop:0
  52. },
  53. {
  54. key: "fail",
  55. list: [],
  56. LoadingType: 0,
  57. scrollTop:0
  58. }
  59. ],
  60. tabParams: [{
  61. "limit": 20,
  62. "page": 1,
  63. },
  64. {
  65. "limit": 20,
  66. "page": 1,
  67. // "platformCode": "string",
  68. "status": 1,
  69. // "transferType": 0
  70. },
  71. {
  72. "limit": 20,
  73. "page": 1,
  74. // "platformCode": "string",
  75. "status": 2,
  76. // "transferType": 0 //transferType: 2 转出 1转入
  77. },
  78. ],
  79. pfList: [],
  80. PlatformMap: {}, //平台key和label匹配
  81. }
  82. },
  83. onShow(){
  84. this.$refs.scrollBox.fixedScroll(this.currentIndex);
  85. },
  86. methods: {
  87. loadPf() {
  88. return new Promise((resole, reject) => {
  89. ApigetPlatformList({}).then(res => {
  90. if (res.code !== "ERROR") {
  91. this.pfList = res.data;
  92. }
  93. resole(res.data);
  94. })
  95. })
  96.  
  97. },
  98. async loadMoreFunc(isupdate, index) {
  99. if (!this.pfList.length) {
  100. await this.loadPf();
  101. this.matchPfTxt();
  102. }
  103. return new Promise((resolve, reject) => {
  104. ApiqueryPage(this.tabParams[index]).then(res => {
  105. if (res.code !== "ERROR") {
  106. let list = res.data.list.map(item => {
  107. return this.formatData(item);
  108. });
  109. if (isupdate) {
  110. this.tabContent[index].list = [...this.tabContent[index].list, ...list];
  111. } else {
  112. this.tabContent[index].list = list;
  113. }
  114. this.tabContent[index].totalPage = res.data.totalPage;
  115. resolve(res);
  116. }
  117. })
  118. })
  119.  
  120. },
  121. formatData(item) {
  122. this.PlatformMap[item.platformCode] ? item.platformName = this.PlatformMap[item.platformCode] : "";
  123. switch (Number(item.status)) {
  124. case 1:
  125. item.statusTxt = "需要check"
  126. break;
  127. case 2:
  128. item.statusTxt = "失败"
  129. break;
  130. case 3:
  131. item.statusTxt = "成功"
  132. break;
  133. }
  134. switch (Number(item.transferType)) {
  135. case 1:
  136. item.platformOption = '从主账号转入'+item.platformName
  137. break;
  138. case 2:
  139. item.platformOption = '从'+item.platformName+"转出到主账号"
  140. break;
  141. }
  142. return item;
  143. },
  144. matchPfTxt() {
  145. this.pfList.forEach(element => {
  146. if (!this.PlatformMap[element.platformCode]) {
  147. this.PlatformMap[element.platformCode] = element.platformName;
  148. }
  149. });
  150. }
  151.  
  152. },
  153. }
  154. </script>
  155.  
  156. <style scoped>
  157.  
  158. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement