发票信息简单联调

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

View File

@ -75,7 +75,7 @@
} }
.month { .month {
width: 138rpx; width: 190rpx;
white-space: nowrap; white-space: nowrap;
overflow: hidden; 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 // pages/invoicing/index.js
Page({ Page({
@ -10,6 +15,7 @@ Page({
ids: [], ids: [],
count: 0, count: 0,
show: false, show: false,
remark: ""
}, },
/** /**
@ -18,20 +24,43 @@ Page({
onLoad(options) { onLoad(options) {
const { money = 10, tenement, ids = 'q', count = 10 } = options; const { money = 10, tenement, ids = 'q', count = 10 } = options;
this.setData({ money, tenement, ids: ids.split(","), count }) 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() { onReady() {
}, },
onSubmit() {
console.log('----------')
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { 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() { changeShow() {
this.setData({ show: true }) this.setData({ show: true })

View File

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

View File

@ -34,4 +34,9 @@ export const getInvoiceInfoDetail = async function(id) {
// 获取已开发票的列表 // 获取已开发票的列表
export const getAlreadyInvoiceList = async function(page) { export const getAlreadyInvoiceList = async function(page) {
return await GET(`/wx/getAlreadyInvoiceList?tenement=${wx.getStorageSync('tenement')?.id}&page=${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);
} }