发票管理可能重复刷新问题

This commit is contained in:
itgaojian163 2025-05-14 09:48:02 +08:00
parent b50ddffca7
commit b28b7ab7b9
18 changed files with 376 additions and 294 deletions

View File

@ -16,7 +16,7 @@
"pages/mine/mineAccount/mineContact/mineContact",
"pages/treaty/rule/rule",
"pages/mine/mineAccount/minePayRecord/minePayRecord",
"pages/mine/mineAccount/mineInvoice/mineInvoice",
"pages/mine/mineAccount/mineInvoiceManage/mineInvoiceManage",
"pages/mine/mineAccount/invoiceInfo/invoiceInfo",
"pages/mine/mineAccount/makeInvoice/makeInvoice",
"pages/mine/mineAccount/invoiceOrder/invoiceOrder",

View File

@ -21,7 +21,7 @@ Component({
* 组件的初始数据
*/
data: {
progress: 0
progressNum: 0
},
/**

View File

@ -2,6 +2,6 @@
<view class="popup-box">
<view class="hint-text">{{hintText}}</view>
<view class="loading" style="margin-top: 10px;"></view>
<view class="progress">{{progress}}%</view>
<view class="progress">{{progressNum}}%</view>
</view>
</view>

View File

@ -299,7 +299,9 @@ Page({
const _self = this
let pages = getCurrentPages();
let beforePage = pages[pages.length - 2];
beforePage.doRefreshList()
beforePage.setData({
needRefresh: true
})
wx.navigateBack()
}
})

View File

@ -309,7 +309,9 @@ Page({
const _self = this
let pages = getCurrentPages();
let beforePage = pages[pages.length - 2];
beforePage.doRefreshList()
beforePage.setData({
needRefresh: true
})
wx.navigateBack()
}
})

View File

@ -36,7 +36,8 @@ Page({
text: '关闭'
}],
tempItem: null,
isShowOptions: false
isShowOptions: false,
needRefresh: false, //是否需要刷新
},
/**
@ -56,6 +57,15 @@ Page({
})
this.getRefundList(true)
},
onShow() {
const _self = this
if (_self.data.needRefresh) {
_self.setData({
needRefresh: false
})
_self.doRefreshList()
}
},
chooseOptions() {
this.setData({
isShowOptions: !this.data.isShowOptions,

View File

@ -56,7 +56,8 @@ Page({
tempDownloadPro: null, //下载的item
approveReason: '', //补正原因
isShowOptions: false,
curOptions: 'state'
curOptions: 'state',
needRefresh: false, //是否需要刷新
},
/**
@ -76,6 +77,15 @@ Page({
})
this.doRefreshList()
},
onShow() {
const _self = this
if (_self.data.needRefresh) {
_self.setData({
needRefresh: false
})
_self.doRefreshList()
}
},
chooseLeft(e) {
this.setData({
curOptions: e.currentTarget.dataset.value

View File

@ -83,7 +83,7 @@ Page({
isLoadMore: false, //是否正在加载更多中
hasMore: true, //是否有更多数据
showAd: false, //显示优惠卷广告
tempCoupons: null, //优惠卷
tempCoupons: [], //优惠卷
isNoShowToday: false, //今日不再显示
tabList: [{
"pagePath": "pages/index/index",
@ -129,7 +129,7 @@ Page({
menuRight: rect.width + 5
})
//获取消息通知
this.getMsgNotice()
// this.getMsgNotice()
},
//消息通知
getMsgNotice() {

View File

@ -114,7 +114,7 @@
<view slot="desc" style="margin-top: 10px;">
<view class="download-desc">
<view class="link-title">项目预览链接</view>
<text class="link" bind:tap="copyLink" data-value="{{sysPreviewUrl}}" selectable="true">{{sysPreviewUrl}}</text>
<text class="link" bind:tap="copyLink" data-value="{{sysPreviewUrl}}" user-select>{{sysPreviewUrl}}</text>
</view>
<view class="download-item">
<view class="download-title">

View File

@ -1,4 +1,5 @@
// pages/mine/mineAccount/invoiceOrder/invoiceOrder.js
//可以开具发票的充值订单列表页面
import InvoiceApi from '../../../../net/api/invoiceApi'
const app = getApp()
Page({
@ -161,14 +162,4 @@ Page({
})
}
},
show(e) {
},
hide(e) {
},
slideButtonTap(e) {
const item = e.currentTarget.dataset.value
const btn = e.detail.index
}
})

View File

@ -220,7 +220,7 @@ Page({
})
setTimeout(() => {
_self.backPageRefresh()
}, 1800);
}, 1000);
} else {
this.setData({
msgType: 'error',
@ -277,10 +277,10 @@ Page({
},
//提交
confirmSubmit() {
if (this.data.bean != null && this.data.bean.invoiceRechargeId != '') {
this.doSaveInfo()
} else {
if (this.data.editBean != null && this.data.editBean.invoiceRechargeId != '') {
this.doEditInfo()
} else {
this.doSaveInfo()
}
},
//编辑
@ -303,7 +303,7 @@ Page({
})
setTimeout(() => {
_self.backPageRefresh()
}, 1800);
}, 1000);
} else {
this.setData({
msgType: 'error',
@ -326,7 +326,9 @@ Page({
const _self = this
let pages = getCurrentPages();
let beforePage = pages[pages.length - 2];
beforePage.doRefreshList()
beforePage.setData({
needRefresh: true
})
wx.navigateBack()
},
closeDialog(e) {

View File

@ -1,227 +1,66 @@
// pages/mine/mineAccount/mineInvoice/mineInvoice.js
// 发票管理首页
import InvoiceApi from '../../../../net/api/invoiceApi'
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
keywords: '',
pageData: {
page: 1,
rows: 10,
keywords: ''
},
msgShow: false,
msgHint: '',
msgType: 'error',
loadingState: 'loading',
listRefreshTrig: false,
isLoadMore: false,
hasMore: true,
recordList: [], //开票记录
slideBtns: [{
text: '删除',
src: app.globalData.localAssets + "/ic_delete_red.png" // icon的路径
}]
},
/**
* 页面的初始数据
*/
data: {
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.setNavigationBarTitle({
title: '发票管理',
})
wx.setNavigationBarColor({
frontColor: '#000000', // 必写项,字体颜色仅支持#ffffff和#000000
backgroundColor: '#F0F0F0', // 传递的颜色值,仅支持十六进制颜色
animation: { // 可选项
duration: 500,
timingFunc: 'easeIn'
}
})
this.doRefreshList()
},
openInvoiceInfo() {
wx.navigateTo({
url: '/pages/mine/mineAccount/invoiceInfo/invoiceInfo',
})
},
inputKeywords(e) {
this.setData({
keywords: e.detail.value
})
},
//清除搜索内容
clearSearch() {
const _self = this
_self.setData({
keywords: ''
})
_self.doRefreshList()
},
//发起搜索
doSearchKeyWord() {
const _self = this
_self.doRefreshList()
},
doRefreshList() {
console.log('正在刷新...')
const _self = this
_self.setData({
listRefreshTrig: true,
loadingState: 'loading',
hasMore: true,
'pageData.page': 1,
'pageData.keywords': _self.data.keywords,
isLoadMore: false
})
_self.doGetInvoiceRecordList(true)
},
doLoadMore() {
//判断是否正在加载中 与是否存在更多数据
const _self = this
if (_self.data.isLoadMore || !_self.data.hasMore) {
return
}
_self.setData({
isLoadMore: true,
'pageData.page': ++_self.data.pageData.page,
'pageData.keywords': _self.data.keywords
})
_self.doGetInvoiceRecordList(false)
},
doGetInvoiceRecordList(isRefresh) {
const _self = this
_self.setData({
recordList: isRefresh ? [] : _self.data.recordList,
loadingState: isRefresh ? 'loading' : ''
})
InvoiceApi.doGetInvoiceRecordList(_self.data.pageData)
.then(res => {
console.log(res)
var status = 'success'
status = res.rows && res.rows.length > 0 ? 'success' : 'empty'
_self.setData({
loadingState: isRefresh ? status : '',
recordList: _self.data.recordList.concat(res.rows),
listRefreshTrig: false,
isLoadMore: false
})
_self.setData({
hasMore: _self.data.recordList.length < res.total
})
}, err => {
_self.setData({
loadingState: 'error',
listRefreshTrig: false,
isLoadMore: false,
hasMore: true
})
})
},
//跳转可以开具发票订单列表
openMake() {
wx.navigateTo({
url: '/pages/mine/mineAccount/invoiceOrder/invoiceOrder',
})
},
//取消开票
cancelRecord(e) {
const item = e.currentTarget.dataset.value
const _self = this
wx.showModal({
title: '警告',
content: '请问您是否真的想要取消此次开票操作?',
complete: (res) => {
if (res.confirm) {
_self.doCancelInvoiceRecord(item)
}
}
})
},
//取消开票
doCancelInvoiceRecord(item) {
const _self = this
wx.showLoading({
title: '取消中...',
})
InvoiceApi.doCancelInvoiceRecord(item.invoiceRechargeId)
.then(res => {
wx.hideLoading()
console.log(res)
_self.setData({
msgHint: '取消成功',
msgType: 'success',
msgShow: true
})
_self.doRefreshList()
})
.catch(err => {
wx.hideLoading()
_self.setData({
msgHint: err.msg ? err.msg : '取消出错了,请稍后重试',
msgShow: true,
msgType: 'error'
})
})
},
//去修改
doUpdate(e) {
const item = e.currentTarget.dataset.value
const params = JSON.stringify(item)
const _self = this
wx.navigateTo({
url: '/pages/mine/mineAccount/makeInvoice/makeInvoice?bean=' + params,
events: {
refreshData: function (data) {
console.log('刷新')
_self.doRefreshList()
}
}
})
},
openDetail(e) {
const item = e.currentTarget.dataset.value
const params = JSON.stringify(item)
wx.navigateTo({
url: '/pages/mine/mineAccount/invoiceRecordDetail/invoiceRecordDetail?bean=' + params,
})
},
slideButtonTap(e) {
const item = e.currentTarget.dataset.value
const btn = e.detail.index
console.log(item)
if (btn == 0) {
//删除,先判断状态 用户取消-1,开票失败:0,开票中:1,开票完成:2
if (item.invoiceStatus != '1') {
this.showDelDialog(item)
} else {
this.setData({
msgHint: '当前发票处于开具流程中,暂不支持删除',
msgType: 'error',
msgShow: true
})
}
}
},
showDelDialog(item) {
const _self = this
wx.showModal({
title: '警告',
content: '该开票记录删除后不可恢复,是否确认执行删除操作?请谨慎抉择',
complete: (res) => {
if (res.confirm) {
_self.doDelRecord(item)
}
}
})
},
//删除记录
doDelRecord(item) {
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,45 +1,2 @@
<view class="page-container">
<view class="search-box">
<view class="search-container">
<input class="search-input" value="{{keywords}}" bindinput="inputKeywords" bindconfirm="doSearchKeyWord" type="text" confirm-type="search" placeholder="搜索" />
<view wx:if="{{keywords !=''}}" bind:tap="clearSearch" class="icon-clear" style="width: 20px;height: 20px;"></view>
</view>
<view class="add-btn" bind:tap="openInvoiceInfo">开票信息</view>
</view>
<view class="content-container">
<container-loading loadingState="{{loadingState}}" style="height: 85vh;" bindrefresh="doRefreshList">
<scroll-view scroll-y="{{true}}" style="height: 85vh;padding-bottom: 40px;" bindrefresherrefresh="doRefreshList" refresher-enabled refresher-triggered="{{listRefreshTrig}}" bindscrolltolower="doLoadMore" lower-threshold='30'>
<view class="order-box">
<block wx:for="{{recordList}}" wx:key="index">
<!-- <mp-slideview id="mp-slide" buttons="{{slideBtns}}" icon="{{true}}" data-value="{{item}}" bindbuttontap="slideButtonTap"> -->
<view class="order-item">
<view class="record-title-box">
<view class="record-title-status {{tools.invoiceStatusColor(item.invoiceStatus)}}">{{tools.invoiceStatus(item.invoiceStatus)}}</view>
<view bind:tap="openDetail" data-value="{{item}}" class="record-title-name">{{item.invoiceName}}</view>
<view class="record-options">
<view wx:if="{{item.invoiceStatus=='-1' || item.invoiceStatus=='0'}}" class="options-btn green" bind:tap="doUpdate" data-value="{{item}}">修改</view>
<view wx:if="{{item.invoiceStatus=='1'}}" class="options-btn red" bind:tap="cancelRecord" data-value="{{item}}">取消</view>
</view>
</view>
<view bind:tap="openDetail" data-value="{{item}}" class="record-number mt-10">纳税人识别号: {{item.invoiceNumber}}</view>
<view bind:tap="openDetail" data-value="{{item}}" class="record-bottom-box mt-10">
<view class="record-time icon-time">{{item.gmtCreate}}</view>
<rich-text style="font-size: 40rpx;color: red;" nodes="{{tools.moneyTxt(10,item.invoiceRechargeMoney)}}"></rich-text>
</view>
</view>
<!-- </mp-slideview> -->
</block>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore}}" class="no-more">
<view class="no-more-dot"></view>
</view>
</view>
</scroll-view>
</container-loading>
</view>
<view class="bottom-fixed-footer">
<view class="bottom-btn-green" bind:tap="openMake">去开票</view>
</view>
</view>
<mp-toptips msg="{{msgHint}}" type="{{msgType}}" show="{{msgShow}}" :delay="2000"></mp-toptips>
<wxs src="../../../../utils/comm.wxs" module="tools"></wxs>
<!--pages/mine/mineAccount/mineInvoice/mineInvoice.wxml-->
<text>pages/mine/mineAccount/mineInvoice/mineInvoice.wxml</text>

View File

@ -0,0 +1,226 @@
// 发票管理首页
import InvoiceApi from '../../../../net/api/invoiceApi'
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
keywords: '',
pageData: {
page: 1,
rows: 10,
keywords: ''
},
msgShow: false,
msgHint: '',
msgType: 'error',
loadingState: 'loading',
listRefreshTrig: false,
isLoadMore: false,
hasMore: true,
recordList: [], //开票记录
needRefresh: false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.setNavigationBarTitle({
title: '发票管理',
})
wx.setNavigationBarColor({
frontColor: '#000000', // 必写项,字体颜色仅支持#ffffff和#000000
backgroundColor: '#F0F0F0', // 传递的颜色值,仅支持十六进制颜色
animation: { // 可选项
duration: 500,
timingFunc: 'easeIn'
}
})
this.doRefreshList()
},
onShow() {
const _self = this
console.log('是否需要刷新', _self.data.needRefresh)
if (_self.data.needRefresh) {
_self.setData({
needRefresh: false
})
_self.doRefreshList()
}
},
openInvoiceInfo() {
wx.navigateTo({
url: '/pages/mine/mineAccount/invoiceInfo/invoiceInfo',
})
},
inputKeywords(e) {
this.setData({
keywords: e.detail.value
})
},
//清除搜索内容
clearSearch() {
const _self = this
_self.setData({
keywords: ''
})
_self.doRefreshList()
},
//发起搜索
doSearchKeyWord() {
const _self = this
_self.doRefreshList()
},
doRefreshList() {
console.log('正在刷新...')
const _self = this
_self.setData({
listRefreshTrig: true,
loadingState: 'loading',
hasMore: true,
'pageData.page': 1,
'pageData.keywords': _self.data.keywords,
isLoadMore: false
})
_self.doGetInvoiceRecordList(true)
},
doLoadMore() {
//判断是否正在加载中 与是否存在更多数据
const _self = this
if (_self.data.isLoadMore || !_self.data.hasMore) {
return
}
_self.setData({
isLoadMore: true,
'pageData.page': ++_self.data.pageData.page,
'pageData.keywords': _self.data.keywords
})
_self.doGetInvoiceRecordList(false)
},
doGetInvoiceRecordList(isRefresh) {
const _self = this
_self.setData({
recordList: isRefresh ? [] : _self.data.recordList,
loadingState: isRefresh ? 'loading' : ''
})
InvoiceApi.doGetInvoiceRecordList(_self.data.pageData)
.then(res => {
console.log(res)
var status = 'success'
status = res.rows && res.rows.length > 0 ? 'success' : 'empty'
_self.setData({
loadingState: isRefresh ? status : '',
recordList: _self.data.recordList.concat(res.rows),
listRefreshTrig: false,
isLoadMore: false
})
_self.setData({
hasMore: _self.data.recordList.length < res.total
})
}, err => {
_self.setData({
loadingState: 'error',
listRefreshTrig: false,
isLoadMore: false,
hasMore: true
})
})
},
//跳转可以开具发票订单列表
openMake() {
wx.navigateTo({
url: '/pages/mine/mineAccount/invoiceOrder/invoiceOrder',
})
},
//取消开票
cancelRecord(e) {
const item = e.currentTarget.dataset.value
const _self = this
wx.showModal({
title: '警告',
content: '请问您是否真的想要取消此次开票操作?',
complete: (res) => {
if (res.confirm) {
_self.doCancelInvoiceRecord(item)
}
}
})
},
//取消开票
doCancelInvoiceRecord(item) {
const _self = this
wx.showLoading({
title: '取消中...',
})
InvoiceApi.doCancelInvoiceRecord(item.invoiceRechargeId)
.then(res => {
wx.hideLoading()
console.log(res)
_self.setData({
msgHint: '取消成功',
msgType: 'success',
msgShow: true
})
_self.doRefreshList()
})
.catch(err => {
wx.hideLoading()
_self.setData({
msgHint: err.msg ? err.msg : '取消出错了,请稍后重试',
msgShow: true,
msgType: 'error'
})
})
},
//去修改
doUpdate(e) {
const item = e.currentTarget.dataset.value
const params = JSON.stringify(item)
wx.navigateTo({
url: '/pages/mine/mineAccount/makeInvoice/makeInvoice?bean=' + params,
})
},
openDetail(e) {
const item = e.currentTarget.dataset.value
const params = JSON.stringify(item)
wx.navigateTo({
url: '/pages/mine/mineAccount/invoiceRecordDetail/invoiceRecordDetail?bean=' + params,
})
},
slideButtonTap(e) {
const item = e.currentTarget.dataset.value
const btn = e.detail.index
console.log(item)
if (btn == 0) {
//删除,先判断状态 用户取消-1,开票失败:0,开票中:1,开票完成:2
if (item.invoiceStatus != '1') {
this.showDelDialog(item)
} else {
this.setData({
msgHint: '当前发票处于开具流程中,暂不支持删除',
msgType: 'error',
msgShow: true
})
}
}
},
showDelDialog(item) {
const _self = this
wx.showModal({
title: '警告',
content: '该开票记录删除后不可恢复,是否确认执行删除操作?请谨慎抉择',
complete: (res) => {
if (res.confirm) {
_self.doDelRecord(item)
}
}
})
},
//删除记录
doDelRecord(item) {
}
})

View File

@ -0,0 +1,43 @@
<view class="page-container">
<view class="search-box">
<view class="search-container">
<input class="search-input" value="{{keywords}}" bindinput="inputKeywords" bindconfirm="doSearchKeyWord" type="text" confirm-type="search" placeholder="搜索" />
<view wx:if="{{keywords !=''}}" bind:tap="clearSearch" class="icon-clear" style="width: 20px;height: 20px;"></view>
</view>
<view class="add-btn" bind:tap="openInvoiceInfo">开票信息</view>
</view>
<view class="content-container">
<container-loading loadingState="{{loadingState}}" style="height: 85vh;" bindrefresh="doRefreshList">
<scroll-view scroll-y="{{true}}" style="height: 85vh;padding-bottom: 40px;" bindrefresherrefresh="doRefreshList" refresher-enabled refresher-triggered="{{listRefreshTrig}}" bindscrolltolower="doLoadMore" lower-threshold='30'>
<view class="order-box">
<block wx:for="{{recordList}}" wx:key="index">
<view class="order-item">
<view class="record-title-box">
<view class="record-title-status {{tools.invoiceStatusColor(item.invoiceStatus)}}">{{tools.invoiceStatus(item.invoiceStatus)}}</view>
<view bind:tap="openDetail" data-value="{{item}}" class="record-title-name">{{item.invoiceName}}</view>
<view class="record-options">
<view wx:if="{{item.invoiceStatus=='-1' || item.invoiceStatus=='0'}}" class="options-btn green" bind:tap="doUpdate" data-value="{{item}}">修改</view>
<view wx:if="{{item.invoiceStatus=='1'}}" class="options-btn red" bind:tap="cancelRecord" data-value="{{item}}">取消</view>
</view>
</view>
<view bind:tap="openDetail" data-value="{{item}}" class="record-number mt-10">纳税人识别号: {{item.invoiceNumber}}</view>
<view bind:tap="openDetail" data-value="{{item}}" class="record-bottom-box mt-10">
<view class="record-time icon-time">{{item.gmtCreate}}</view>
<rich-text style="font-size: 40rpx;color: red;" nodes="{{tools.moneyTxt(10,item.invoiceRechargeMoney)}}"></rich-text>
</view>
</view>
</block>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore}}" class="no-more">
<view class="no-more-dot"></view>
</view>
</view>
</scroll-view>
</container-loading>
</view>
<view class="bottom-fixed-footer">
<view class="bottom-btn-green" bind:tap="openMake">去开票</view>
</view>
</view>
<mp-toptips msg="{{msgHint}}" type="{{msgType}}" show="{{msgShow}}" :delay="2000"></mp-toptips>
<wxs src="../../../../utils/comm.wxs" module="tools"></wxs>

View File

@ -64,7 +64,7 @@ Page({
}, {
icon: "ic-invoice",
title: "发票管理",
path: "/pages/mine/mineAccount/mineInvoice/mineInvoice"
path: "/pages/mine/mineAccount/mineInvoiceManage/mineInvoiceManage"
}, {
icon: "ic-contact",
title: "产权联系人",