Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <template>
- <view class="cm-wrap">
- <cm-header tit="转账记录" type="black"></cm-header>
- <tab-scroll-view ref="scrollBox" :currentIndex.sync="currentIndex" :scrollTop.sync="scrollTop" :tabParams="tabParams" :tabContent.sync="tabContent" :loadMoreFunc="loadMoreFunc" :tabList.sync="tabList">
- <template slot-scope="contentItem" slot="contentItem">
- <transfer-record-item :data="contentItem"></transfer-record-item>
- </template>
- </tab-scroll-view>
- </view>
- </template>
- <script>
- import tabScrollView from "@/components/cm-tab-scroll-view.vue"
- import transferRecordItem from "@/components/pages/pay/transferRecordItem.vue"
- import {
- ApiqueryPage,
- ApigetPlatformList
- } from "@/common/libs/service/game.js"
- export default {
- components: {
- tabScrollView,
- transferRecordItem
- },
- data() {
- return {
- scrollTop:0,
- currentIndex:0,
- tabList: [{
- label: "全部",
- key: "all",
- },
- {
- label: "已完成",
- key: "complete"
- },
- {
- label: "失败",
- key: "fail"
- }
- ],
- tabContent: [{
- key: "all",
- list: [],
- LoadingType: 0,
- scrollTop:0
- },
- {
- key: "complete",
- list: [],
- LoadingType: 0,
- scrollTop:0
- },
- {
- key: "fail",
- list: [],
- LoadingType: 0,
- scrollTop:0
- }
- ],
- tabParams: [{
- "limit": 20,
- "page": 1,
- },
- {
- "limit": 20,
- "page": 1,
- // "platformCode": "string",
- "status": 1,
- // "transferType": 0
- },
- {
- "limit": 20,
- "page": 1,
- // "platformCode": "string",
- "status": 2,
- // "transferType": 0 //transferType: 2 转出 1转入
- },
- ],
- pfList: [],
- PlatformMap: {}, //平台key和label匹配
- }
- },
- onShow(){
- this.$refs.scrollBox.fixedScroll(this.currentIndex);
- },
- methods: {
- loadPf() {
- return new Promise((resole, reject) => {
- ApigetPlatformList({}).then(res => {
- if (res.code !== "ERROR") {
- this.pfList = res.data;
- }
- resole(res.data);
- })
- })
- },
- async loadMoreFunc(isupdate, index) {
- if (!this.pfList.length) {
- await this.loadPf();
- this.matchPfTxt();
- }
- return new Promise((resolve, reject) => {
- ApiqueryPage(this.tabParams[index]).then(res => {
- if (res.code !== "ERROR") {
- let list = res.data.list.map(item => {
- return this.formatData(item);
- });
- if (isupdate) {
- this.tabContent[index].list = [...this.tabContent[index].list, ...list];
- } else {
- this.tabContent[index].list = list;
- }
- this.tabContent[index].totalPage = res.data.totalPage;
- resolve(res);
- }
- })
- })
- },
- formatData(item) {
- this.PlatformMap[item.platformCode] ? item.platformName = this.PlatformMap[item.platformCode] : "";
- switch (Number(item.status)) {
- case 1:
- item.statusTxt = "需要check"
- break;
- case 2:
- item.statusTxt = "失败"
- break;
- case 3:
- item.statusTxt = "成功"
- break;
- }
- switch (Number(item.transferType)) {
- case 1:
- item.platformOption = '从主账号转入'+item.platformName
- break;
- case 2:
- item.platformOption = '从'+item.platformName+"转出到主账号"
- break;
- }
- return item;
- },
- matchPfTxt() {
- this.pfList.forEach(element => {
- if (!this.PlatformMap[element.platformCode]) {
- this.PlatformMap[element.platformCode] = element.platformName;
- }
- });
- }
- },
- }
- </script>
- <style scoped>
- </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement