| | |
| | | // pages/m_ledger/ledgerupload/ledgerupload.js |
| | | const ledgerservice = require("../../../service/ledgerservice") |
| | | const moment = require('../../../utils/moment.min') |
| | | const $f = require('../../../service/baserequest') |
| | | import b_upload from "../behaviors/b_uploadLedger" |
| | | import b_uploadLedger from '../behaviors/b_uploadLedger' |
| | | import ledgerservice from "../../../service/ledgerservice" |
| | | import moment from '../../../utils/moment.min' |
| | | import b_loadingToast from '../../../base/behaviors/b_loadingToast' |
| | | |
| | | const app = getApp() |
| | | |
| | | Page({ |
| | | |
| | | behaviors: [b_upload, b_uploadLedger, b_loadingToast], |
| | | /** |
| | | * 页面的初始数据 |
| | | */ |
| | |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | | onReady() { |
| | | |
| | | }, |
| | | |
| | | checkStatus() { |
| | | if (this.data.ledger.path1) { |
| | | let imgFiles = this.data.ledger.path1 |
| | |
| | | } |
| | | }, |
| | | |
| | | uploadFile(file) { |
| | | let data = file.detail.newFiles |
| | | console.log(data); |
| | | data.forEach(element => { |
| | | element.loading = false |
| | | }); |
| | | this.setData({ |
| | | imgFiles: data |
| | | }) |
| | | }, |
| | | |
| | | onSubmit: function () { |
| | | if (this.data.imgFiles.length == 0) { |
| | | wx.showToast({ |
| | |
| | | }, |
| | | |
| | | submitLedger() { |
| | | var that = this |
| | | |
| | | this.setData({ |
| | | showDialog: false, |
| | | }) |
| | | wx.showLoading({ |
| | | title: '提交中', |
| | | mask: true, |
| | | success: (res) => {}, |
| | | fail: (res) => {}, |
| | | complete: (res) => {}, |
| | | this._uploadLedger() |
| | | }, |
| | | |
| | | _success(res) { |
| | | this.getOpenerEventChannel().emit('uploadOver', { |
| | | indexGroup: that.data.indexGroup |
| | | }) |
| | | setTimeout(() => { |
| | | wx.hideLoading() |
| | | }, 20000); |
| | | let path = [] |
| | | this.data.imgFiles.forEach(f => { |
| | | path.push(f.url) |
| | | }); |
| | | let ledger = this.data.ledger |
| | | ledger.remark1 = this.data.remark |
| | | ledgerservice.uploadLedger(app.globalData.accessToken.userId, ledger, path, { |
| | | success (res) { |
| | | wx.hideLoading({ |
| | | success: (res) => { |
| | | wx.showToast({ |
| | | title: '提交成功', |
| | | duration: 1000, |
| | | icon: 'success', |
| | | mask: true, |
| | | success: (res) => { |
| | | that.getOpenerEventChannel().emit('uploadOver', { |
| | | indexGroup: that.data.indexGroup |
| | | }) |
| | | wx.navigateBack({ |
| | | delta: 1, |
| | | }) |
| | | }, |
| | | }) |
| | | }, |
| | | }) |
| | | }, |
| | | complete (res) { |
| | | } |
| | | wx.navigateBack({ |
| | | delta: 1, |
| | | }) |
| | | }, |
| | | |