123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <template>
- <view class="invoice-header">
- <z-paging ref="paging" v-model="invoiceHeaderList" @query="queryList">
-
- <u-navbar
- title-color="#fff"
- :custom-back="customBack"
- :border-bottom="false"
- back-icon-color="#CCE8FF"
- :background="{ background: '#008CFF' }"
- title="抬头信息"
- slot="top"
- />
- <view class="invoice-header-list">
- <view class="invoice-header-list-item" v-for="(item, index) in invoiceHeaderList" :key="index">
- <view class="left">
- <view class="left-item">{{ item.invoName }}</view>
- <view class="left-item">{{ item.invoCode }}</view>
- </view>
- <view class="center">
- {{ formatType(item.invoHeadType) }}
- </view>
- <view class="right">
- <u-image width="28rpx" height="28rpx" src="/static/img/edit-icon.png" @click="editInvoiceHeader(item)" />
- </view>
- </view>
- </view>
- <view class="invoice-header-bottom" slot="bottom">
- <u-button type="primary" @click="addInvoiceHeader">新增抬头</u-button>
- </view>
- </z-paging>
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- invoiceHeaderList: [],
- queryParams: {
- pageNum: 1,
- pageSize: 10
- },
- invoType: 1
- };
- },
- onLoad(options) {
- const { invoType } = options;
- this.invoType = invoType;
- },
- methods: {
-
- queryList(pageNo, pageSize) {
- this.queryParams.pageNum = pageNo;
- this.queryParams.pageSize = pageSize;
- this.getList();
- },
-
- customBack() {
- this.$u.route({
- url: '/pages/invoiceModule/addInvoice/addInvoice',
- params: {
- invoType: this.invoType
- }
- });
- },
-
- async getList() {
- const { code, data } = await this.$u.api.invoiceModuleApi.getInvoiceHeadListApi({ ...this.queryParams });
- if (code === 200) {
- this.$refs.paging.complete(data?.pageInfo?.rows || []);
- }
- },
-
- addInvoiceHeader() {
- this.$u.route({
- url: '/pages/invoiceModule/addInvoiceHeader/addInvoiceHeader',
- params: {
- invoType: this.invoType
- }
- });
- },
-
- editInvoiceHeader(item) {
- this.$u.route({
- url: '/pages/invoiceModule/addInvoiceHeader/addInvoiceHeader',
- params: {
- id: item.id,
- invoType: this.invoType
- }
- });
- },
-
- async deleteInvoiceHeader(item) {
- const { id } = item;
- const { code } = await this.$u.api.invoiceModuleApi.deleteInvoiceHeaderApi({ id });
- if (code === 200) {
- this.$refs.uToast.show({
- title: '删除成功!',
- type: 'success'
- });
- this.getList();
- }
- },
-
- formatType(val) {
- const typeObj = {
- 1: '企业',
- 2: '个人'
- };
- return typeObj[val];
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- @import './invoiceHeaderList.scss';
- </style>
|