发票信息简单联调

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

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 })