123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- <template>
- <view>
- <mescroll-body top="30" bottom="40" @init="mescrollInit" @down="downCallback" @up="upCallback" :option="{}">
- <view class="common-list">
- <view class="common-item" v-for="(item,index) in list" :key="item.id"
- @click="$navigateTo('/pages/invoiceDetail/invoiceDetail?invoiceId='+item.id+'&type='+type)">
- <view class="title">{{item.name}}</view>
- <view class="date">{{$field.findTypeName('invoiceType',item.invoiceType)}}</view>
- <view class="other">
- <view class="item">
- <view class="label">收款方</view>
- <view class="value">{{item.organizationName}}</view>
- </view>
- <view class="item">
- <view class="label">付款方</view>
- <view class="value">{{item.payMerchantName || item.payClientName}}</view>
- </view>
- </view>
- <view class="state">
- <view></view>
- <view class="tag">
- <div class="status-tag success" v-if="!item.status">正常</div>
- <div class="status-tag error" v-else-if="item.status === 1">作废</div>
- </view>
- </view>
- <view class="icon">
- <uni-icons custom-prefix="iconfont" :type="menu.iconClass" color="#08979c" size="30">
- </uni-icons>
- </view>
- </view>
- </view>
- </mescroll-body>
- </view>
- </template>
- <script>
- import {
- getInvoiceListByPage
- } from '@/request/api/invouce.js'
- import {
- bindProjectDetail
- } from '@/request/api/organization.js'
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- export default {
- mixins: [MescrollMixin], // 使用mixin
- data() {
- return {
- list: [],
- type: '',
- menu: {},
- payClientId: '',
- payMerchantId: '',
- paymentIds: ''
- }
- },
- onLoad(body) {
- this.type = parseInt(body.type);
- this.menu = this.title();
- this.paymentIds = body.paymentIds;
- uni.setNavigationBarTitle({
- title: this.menu.title
- });
- uni.$on('reloadContract', () => {
- this.mescroll.resetUpScroll(false);
- })
- },
- methods: {
- title() {
- let str = {
- title: '',
- iconClass: 'icon-app-hetongguanli-hetongfapiao'
- };
- switch (this.type) {
- case 1:
- str = {
- title: '合同发票',
- iconClass: 'icon-app-hetongguanli-hetongfapiao'
- };
- break;
- case 2:
- str = {
- title: '常规发票',
- iconClass: 'icon-integralrecord'
- };
- break;
- default:
- break;
- }
- return str;
- },
- /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
- upCallback(page) {
- let postData = {
- currPage: page.num,
- pageSize: 10,
- projectId: this.$store.getters.project.id,
- type: this.type
- }
- if (this.paymentIds) {
- postData['paymentIds'] = this.paymentIds.split(',');
- return this.getBillList(postData);
- }
- if (this.$store.getters.identity.id === 3 || this.$store.getters.identity.id === 6) {
- postData['organizationId'] = this.$store.getters.organization.id;
- this.getBillList(postData);
- } else if (this.$store.getters.identity.id === 4) {
- if (this.payMerchantId) {
- postData['payMerchantId'] = this.payMerchantId;
- this.getBillList(postData);
- return;
- }
- bindProjectDetail({
- bindOrganizationId: this.$store.getters.organization.id,
- projectId: this.$store.getters.project.id,
- identityId: 4
- }).then(res => {
- if (res.code === 200) {
- if (res.data.length == 0) return this.mescroll.endBySize(0, 0);
- this.payMerchantId = res.data[0].merchantId;
- postData['payMerchantId'] = this.payMerchantId;
- this.getBillList(postData);
- } else {
- this.mescroll.endErr();
- }
- }).catch(() => {
- //联网失败, 结束加载
- this.mescroll.endErr();
- })
- } else if (this.$store.getters.identity.id === 1) {
- if (this.payClientId) {
- postData['payClientId'] = this.payClientId;
- this.getBillList(postData);
- return;
- }
- bindProjectDetail({
- userId: this.$store.getters.user.userId,
- projectId: this.$store.getters.project.id,
- identityId: 1
- }).then(res => {
- if (res.code === 200) {
- if (res.data.length == 0) return this.mescroll.endBySize(0, 0);
- this.payClientId = res.data[0].clientId;
- postData['payClientId'] = this.payClientId;
- this.getBillList(postData);
- } else {
- this.mescroll.endErr();
- }
- }).catch(() => {
- //联网失败, 结束加载
- this.mescroll.endErr();
- })
- }
- },
- getBillList(postData) {
- getInvoiceListByPage(postData).then(res => {
- if (res.code === 200) {
- this.mescroll.endBySize(res.data.dataList.length, res.data.totalCount);
- if (postData.currPage == 1) this.list = []; //如果是第一页需手动制空列表
- let data = res.data.dataList;
- this.list = this.list.concat(data); //追加新数据
- } else {
- this.mescroll.endErr();
- }
- }).catch(() => {
- //联网失败, 结束加载
- this.mescroll.endErr();
- })
- }
- }
- }
- </script>
- <style>
- </style>
|