发票信息简单联调

This commit is contained in:
qiaomu 2024-04-26 09:45:59 +08:00
parent cbe7db0ac1
commit 571373c33c
5 changed files with 64 additions and 17 deletions

View File

@ -1,6 +1,8 @@
import { getInvoiceInfo, updateInvoiceInfo } from "../../../../service/invoice"
import { getUserInfo } from "../../../../service/user";
import { alertInfo, alertSuccess } from "../../../../utils/index";
import request from '../../../../utils/request'
const { OK } = request
// pages/invoiceList/components/info/index.js
Component({
@ -32,7 +34,10 @@ Component({
methods: {
async getDetail() {
const { code, message, data } = await getInvoiceInfo()
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({ detail: {...data, },editType: 'detail', formData: {} })
},
async getUser() {

View File

@ -75,7 +75,7 @@
}
.month {
width: 138rpx;
width: 190rpx;
white-space: nowrap;
overflow: hidden;

View File

@ -1,3 +1,8 @@
import { getInvoiceInfo, makeInvoice } from "../../service/invoice"
import { alertInfo, alertSuccess } from "../../utils/index";
import request from '../../utils/request'
const { OK } = request
// pages/invoicing/index.js
Page({
@ -10,6 +15,7 @@ Page({
ids: [],
count: 0,
show: false,
remark: ""
},
/**
@ -18,20 +24,43 @@ Page({
onLoad(options) {
const { money = 10, tenement, ids = 'q', count = 10 } = options;
this.setData({ money, tenement, ids: ids.split(","), count })
this.getDetail();
},
async getDetail() {
const { code, message, data } = await getInvoiceInfo()
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({ detail: {...data, }, remark: data.remark })
},
changeRemark(e) {
this.setData({ remark: e.detail })
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
onSubmit() {
console.log('----------')
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
async onSubmit() {
const {ids = [], remark } = this.data;
const tenement = wx.getStorageSync('tenement')
const { code, message, data } = await makeInvoice({ ids, tenement: tenement.id, remark })
if (code !== OK) {
alertInfo(message)
return;
}
alertSuccess("开票成功,未完")
},
changeShow() {
this.setData({ show: true })

View File

@ -6,9 +6,9 @@
</view>
<view>
<card title="发票类型">
<van-radio-group disabled="{{true}}" direction="horizontal" slot="content">
<van-radio name="1" icon-size="30rpx" style="font-size: 32rpx;margin-bottom: 20rpx;">普通电子发票</van-radio>
<van-radio name="2" icon-size="30rpx" style="font-size: 32rpx;">增值税专用电子发票</van-radio>
<van-radio-group disabled="{{true}}" direction="horizontal" slot="content" value="{{detail.type}}">
<van-radio name="{{0}}" icon-size="30rpx" style="font-size: 32rpx;margin-bottom: 20rpx;">普通电子发票</van-radio>
<van-radio name="{{1}}" icon-size="30rpx" style="font-size: 32rpx;">增值税专用电子发票</van-radio>
</van-radio-group>
</card>
</view>
@ -23,59 +23,66 @@
title-width="132rpx"
>
<view slot="input" style="margin-top: 16rpx;">
<van-radio-group disabled="{{true}}" direction="horizontal">
<van-radio name="1" icon-size="30rpx" style="font-size: 30rpx;margin-bottom: 20rpx;">企业单位</van-radio>
<van-radio name="2" icon-size="30rpx" style="font-size: 30rpx;">个人/非企业单位</van-radio>
<van-radio-group disabled="{{true}}" direction="horizontal" value="{{detail.headerType}}">
<van-radio name="{{0}}" icon-size="30rpx" style="font-size: 30rpx;margin-bottom: 20rpx;">企业单位</van-radio>
<van-radio name="{{1}}" icon-size="30rpx" style="font-size: 30rpx;">个人/非企业单位</van-radio>
</van-radio-group>
</view>
</van-field>
<van-field
value="{{ '河北华昌宝能售电有限公司' }}"
wx:if="{{detail.headerType === 0}}"
value="{{ detail.name }}"
label="发票抬头"
readonly
title-width="132rpx"
disabled="{{true}}"
/>
<van-field
value="{{ '河北华昌宝能售电有限公司' }}"
value="{{ detail.tin }}"
wx:if="{{detail.headerType === 0}}"
label="发票税号"
readonly
title-width="132rpx"
disabled="{{true}}"
/>
<van-field
value="{{ '河北华昌宝能售电有限公司' }}"
value="{{ detail.bank }}"
wx:if="{{detail.headerType === 0}}"
label="开户行"
readonly
title-width="132rpx"
disabled="{{true}}"
/>
<van-field
value="{{ '河北华昌宝能售电有限公司' }}"
value="{{ detail.account }}"
wx:if="{{detail.headerType === 0}}"
label="银行账号"
readonly
title-width="132rpx"
disabled="{{true}}"
/>
<van-field
value="{{ '河北华昌宝能售电有限公司' }}"
value="{{ detail.address }}"
wx:if="{{detail.headerType === 0}}"
label="地址"
readonly
title-width="132rpx"
disabled="{{true}}"
/>
<van-field
value="{{ '河北华昌宝能售电有限公司' }}"
value="{{ detail.address }}"
wx:if="{{detail.headerType === 0}}"
label="电话"
readonly
title-width="132rpx"
disabled="{{true}}"
/>
<van-field
value="{{ '河北华昌宝能售电有限公司' }}"
value="{{ detail.remark }}"
label="备注说明"
title-width="132rpx"
bind:change="changeRemark"
/>
</view>
@ -93,6 +100,7 @@
title="确认开具"
show="{{ show }}"
show-cancel-button
bind:confirm="onSubmit"
>
<view class="modalContentWrapper">
<van-field

View File

@ -34,4 +34,9 @@ export const getInvoiceInfoDetail = async function(id) {
// 获取已开发票的列表
export const getAlreadyInvoiceList = async function(page) {
return await GET(`/wx/getAlreadyInvoiceList?tenement=${wx.getStorageSync('tenement')?.id}&page=${page}`);
}
// 开票
export const makeInvoice = async function(data) {
return await POST(`/wx/invoice`, data);
}