完善发票和充值

This commit is contained in:
qiaomu 2024-03-21 09:38:10 +08:00
parent 7648ace524
commit c102434221
19 changed files with 388 additions and 16 deletions

View File

@ -1,17 +1,19 @@
{
"pages": [
"pages/login/index",
"pages/invoiceList/index",
"pages/rechargeRecord/index",
"pages/meterList/index",
"pages/recharge/index",
"pages/login/index",
"pages/handleLogin/index",
"pages/member/index",
"pages/my/index",
"pages/questions/index",
"pages/home/index",
"pages/index/index",
"pages/qrCode/index"
"pages/qrCode/index",
"pages/invoiceDetail/index",
"pages/editInvoice/index"
],
"tabBar": {
"list": [

View File

@ -30,7 +30,6 @@ Component({
*/
methods: {
async onInput(e) {
console.log('this.type', this.data.type)
// this.setData({
// visible: true,
// list: [e.detail, e.detail, e.detail]

View File

@ -0,0 +1,75 @@
import { getInvoiceInfoDetail } from "../../service/invoice";
// pages/invoiceInfo/index.js
Page({
/**
* 页面的初始数据
*/
data: {
detail: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const { id } = options;
console.log('options', options)
if (id !== "-1") {
this.init(id);
}
},
async init(id) {
const { code, message, data } = await getInvoiceInfoDetail(id)
this.setData({ detail: data });
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,6 @@
{
"usingComponents": {
"van-field": "@vant/weapp/field/index",
"van-button": "@vant/weapp/button/index"
}
}

View File

@ -0,0 +1,50 @@
<van-cell-group>
<van-field
value="{{ detail.name }}"
label="公司名称"
border="{{ false }}"
placeholder="请选择公司名称"
required
/>
<van-field
value="{{ detail.tin }}"
label="税号"
border="{{ false }}"
placeholder="请输入税号"
required
/>
<van-field
value="{{ detail.address }}"
label="单位地址"
border="{{ false }}"
placeholder="请输入单位地址"
/>
<van-field
value="{{ detail.phone }}"
label="电话"
border="{{ false }}"
placeholder="请输入电话"
/>
<van-field
value="{{ detail.bank }}"
label="开户银行"
border="{{ false }}"
placeholder="请输入开户银行"
/>
<van-field
value="{{ detail.account }}"
label="开户账号"
border="{{ false }}"
placeholder="请输入开户账号"
/>
<van-field
value="{{ detail.email }}"
label="邮箱"
border="{{ false }}"
placeholder="请输入邮箱"
/>
</van-cell-group>
<view class="wrapper operate">
<van-button type="info" block style="margin-left: 30rpx;flex: 1;">保存</van-button>
</view>

View File

@ -0,0 +1,6 @@
/* pages/editInvoice/index.wxss */
.operate {
display: flex;
align-items: center;
margin-top: 50rpx;
}

View File

@ -0,0 +1,74 @@
import { getInvoiceInfoDetail } from "../../service/invoice";
// pages/invoiceInfo/index.js
Page({
/**
* 页面的初始数据
*/
data: {
detail: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const { id } = options;
this.init(id);
},
async init(id) {
const { code, message, data } = await getInvoiceInfoDetail(id)
this.setData({ detail: data });
},
handleBack() {
wx.navigateBack()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,6 @@
{
"usingComponents": {
"van-field": "@vant/weapp/field/index",
"van-button": "@vant/weapp/button/index"
}
}

View File

@ -0,0 +1,50 @@
<!--pages/invoiceInfo/index.wxml-->
<van-cell-group>
<van-field
value="{{ detail.name }}"
label="公司名称"
border="{{ false }}"
readonly
/>
<van-field
value="{{ detail.tin }}"
label="税号"
border="{{ false }}"
readonly
/>
<van-field
value="{{ detail.address }}"
label="单位地址"
border="{{ false }}"
readonly
/>
<van-field
value="{{ detail.phone }}"
label="电话"
border="{{ false }}"
readonly
/>
<van-field
value="{{ detail.bank }}"
label="开户银行"
border="{{ false }}"
readonly
/>
<van-field
value="{{ detail.account }}"
label="开户账号"
border="{{ false }}"
readonly
/>
<van-field
value="{{ detail.email }}"
label="邮箱"
border="{{ false }}"
readonly
/>
</van-cell-group>
<view class="wrapper operate">
<van-button type="default" block style="flex: 1" bind:click="handleBack">返回</van-button>
<van-button type="info" block style="margin-left: 30rpx;flex: 1;">编辑</van-button>
</view>

View File

@ -0,0 +1,7 @@
/* pages/invoiceInfo/index.wxss */
.operate {
display: flex;
align-items: center;
margin-top: 50rpx;
}

View File

@ -1,3 +1,7 @@
import { deleteInvoiceInfo, getInvoiceInfoList } from "../../service/invoice";
import { alertInfo, alertSuccess, wxModal } from "../../utils/index";
import request from '../../utils/request'
const { OK } = request
// pages/invoiceList/index.js
Page({
@ -5,7 +9,14 @@ Page({
* 页面的初始数据
*/
data: {
list: [],
show: false,
actions: [
{ name: '查看', },
{ name: '编辑', },
{ name: '删除', },
],
selectData: {}
},
/**
@ -26,9 +37,53 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
this.init();
},
async init() {
const { data, code, message } = await getInvoiceInfoList()
this.setData({ list: data })
},
operate(e) {
const { data } = e.currentTarget.dataset;
this.setData({
show: true,
selectData: data
})
},
onClose() {
this.setData({ show: false, selectData: {} });
},
onSelect(e) {
const type = e.detail.name;
switch(type) {
case "编辑":
break;
case "查看":
wx.navigateTo({
url: '/pages/invoiceDetail/index?id=' + this.data.selectData.id,
})
break;
case "删除":
this.handleDelete();
break;
}
},
async handleDelete() {
const { id } = this.data.selectData;
await wxModal({ content: "确定要删除当前记录吗?" })
const { code, message } = await deleteInvoiceInfo(id)
if (code !== OK) {
alertInfo(message)
return;
}
alertSuccess("删除成功")
this.init();
},
handleCreate() {
wx.navigateTo({
url: '/pages/editInvoice/index?id=-1',
})
},
/**
* 生命周期函数--监听页面隐藏
*/

View File

@ -1,4 +1,7 @@
{
"usingComponents": {},
"usingComponents": {
"van-action-sheet": "@vant/weapp/action-sheet/index",
"van-button": "@vant/weapp/button/index"
},
"navigationBarTitleText": "开票信息"
}

View File

@ -1,2 +1,27 @@
<!--pages/invoiceList/index.wxml-->
<text>pages/invoiceList/index.wxml</text>
<view class="wrapper">
<view
wx:for="{{list}}"
wx:key="index"
class="item"
>
<view style="flex: 1"> {{ item.tenement.name }} </view>
<view class="operate">
<view class="primaryTextBtn" data-data="{{item}}" bind:tap="operate"> 操作 </view>
<!-- <view class="primaryTextBtn" style="margin-left: 24rpx;"> 编辑 </view>
<view class="dangerTextBtn" style="margin-left: 24rpx;"> 删除 </view> -->
</view>
</view>
<view style="margin-top: 10vh;">
<van-button type="info" block bind:click="handleCreate">创建一个</van-button>
</view>
</view>
<van-action-sheet
show="{{ show }}"
actions="{{ actions }}"
bind:close="onClose"
bind:select="onSelect"
cancel-text="取消"
/>

View File

@ -1 +1,15 @@
/* pages/invoiceList/index.wxss */
/* pages/invoiceList/index.wxss */
.wrapper {
margin-left: 24rpx;
margin-right: 24rpx;
}
.item {
display: flex;
align-items: center;
margin: 10rpx 0;
}
.operate {
display: flex;
}

View File

@ -39,7 +39,6 @@ Component({
},
async agree(e) {
const { user } = e.currentTarget.dataset;
console.log('user', user)
await wxModal({ content: `同意${user.nickName}的申请?` })
const { code, message } = await approveUser({ userId: user.id, type: 1 })
if (code !== OK) {

View File

@ -39,7 +39,6 @@ Component({
},
async setAdmin(e) {
const { user } = e.currentTarget.dataset;
console.log('user', user)
await wxModal({ content: `你的管理员身份将转交给${user.nickName}` })
const { code, message } = await approveUser({ userId: user.id, type: 2 })
if (code !== OK) {

View File

@ -21,12 +21,10 @@ Page({
*/
onLoad(options) {
const { tenement, code } = options
console.log('options', options)
this.init({ tenement, code })
},
async init(options) {
const { code, message, data = {}} = await getMeterDetail(options)
console.log('data', data)
this.setData({
detail: data
})

View File

@ -46,7 +46,6 @@ Page({
},
async init(year) {
const { code, message, data } = await getRechargeList(year);
console.log('data', data)
this.setData({
list: data
})

View File

@ -17,11 +17,16 @@ export const updateInvoiceInfo = async function(data) {
}
// 删除发票信息
export const deleteInvoiceInfo = async function(data) {
return await DELETE(`/wx/deleteInvoiceInfo/${id}`, data);
export const deleteInvoiceInfo = async function(id) {
return await DELETE(`/wx/deleteInvoiceInfo/${id}`);
}
// 获取可开发票列表
export const getInvoiceList = async function() {
return await GET(`/wx/getInvoiceList`);
}
// 获取创建的发开票信息详情
export const getInvoiceInfoDetail = async function(id) {
return await GET(`/wx/getInvoiceInfoDetail/${id}`);
}