123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- // pages/ticketWait/ticketWait.js
- const utils = require('../../utils/util.js')
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- list: [],
- pageNum: 1,
- pageSize: 10,
- pages: '',
- finish: false,
- customerName: '',
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.getList()
- },
- //获取待开抬头
- getList(type) {
- let params = {
- mobile: utils.getInfo().mobile,
- // reqChannel: 5,
- belongEntTaxId: wx.getStorageSync('entTaxId'),
- pageNum: this.data.pageNum,
- pageSize: this.data.pageSize
- }
- let customerName = utils.trimAll(this.data.customerName)
- if (customerName !== '') {
- params.customerName = customerName
- }
- utils.axios({
- method: 'get',
- url: '/sys/taitou/todo/findPage',
- data: params,
- sendBefore() {
- wx.showLoading({
- title: '加载中...'
- })
- },
- complete() {
- wx.hideLoading()
- wx.stopPullDownRefresh()
- },
- success: res => {
- let result = res.data
- if (type === 'toFresh') {
- this.setData({
- list: result.records,
- pages: result.pages
- })
- } else {
- let list = this.data.list
- list = list.concat(result.records)
- this.setData({
- list,
- pages: result.pages
- })
- }
- if (result.total <= this.data.pageSize) {
- this.setData({
- finish: true
- })
- }
- }
- })
- },
- toFresh() {
- this.setData({
- pageNum: 1,
- pages: '',
- finish: false
- })
- wx.pageScrollTo({
- scrollTop: 0,
- duration: 300
- })
- this.getList('toFresh')
- },
- //搜素
- search(e) {
- let customerName = e.detail.value
- this.setData({
- customerName
- })
- this.toFresh()
- },
- //确认框
- showDel(e) {
- let params = {
- mobile: utils.getInfo().mobile,
- reqChannel: 5,
- delList: [{
- recordId: e.currentTarget.dataset.recordid,
- belongEntTaxId: e.currentTarget.dataset.belong
- }]
- }
- let index = Number(e.currentTarget.dataset.index)
- wx.showModal({
- content: '确定删除该条数据吗?',
- confirmColor: '#007dff',
- success: res => {
- if (res.confirm) {
- this.del(params, index)
- }
- }
- })
- },
- //删除
- del(params, index) {
- utils.axios({
- method: 'post',
- url: '/sys/taitou/todo/delete',
- data: params,
- sendBefore() {
- wx.showLoading({
- title: '删除中...',
- mask: true
- })
- },
- complete() {
- wx.hideLoading()
- },
- success: res => {
- let list = this.data.list
- list.splice(index, 1)
- this.setData({
- list
- })
- utils.toast('删除成功')
- }
- })
- },
- //点击开票
- toTicket(e) {
- let index = e.currentTarget.dataset.index
- let item = this.data.list[index]
- wx.setStorageSync('ticketMakeData', item)
- wx.navigateTo({
- url: '/pages/ticketMake/ticketMake'
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- this.toFresh()
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- let pageNum = this.data.pageNum
- let pages = this.data.pages
- pageNum++
- if (pageNum <= pages) {
- this.setData({
- pageNum
- })
- this.getList()
- } else {
- this.setData({
- finish: true
- })
- return
- }
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- return {
- title: '诺信云',
- path: '/pages/index/index'
- }
- }
- })
|