| | |
| | | // pages/module_ledger/ledgerupload/ledgerupload.js |
| | | const ledgerservice = require("../../../service/ledgerservice") |
| | | const moment = require('../../../utils/moment.min') |
| | | const $f = require('../../../service/baserequest') |
| | | const app = getApp() |
| | | |
| | | Page({ |
| | |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | imgFiles: [] |
| | | imgFiles: [], |
| | | |
| | | remark: '', |
| | | remarkDisable: false |
| | | }, |
| | | |
| | | /** |
| | |
| | | ledger: data.ledger, |
| | | indexGroup: data.indexGroup |
| | | }) |
| | | |
| | | that.checkStatus() |
| | | }) |
| | | }, |
| | | |
| | |
| | | */ |
| | | onReady() { |
| | | |
| | | }, |
| | | |
| | | checkStatus() { |
| | | if (this.data.ledger.upLoad) { |
| | | var that = this |
| | | var userId = app.globalData.accessToken.userId |
| | | var typeId = this.data.ledger.ledgerSubTypeId |
| | | var sceneType = app.globalData.userInfo.extension2 |
| | | var time = moment().format('YYYY-MM-DD') |
| | | ledgerservice.getLedgerDetail(userId, typeId, sceneType, time, { |
| | | success (res) { |
| | | if (res.length > 0) { |
| | | let detail = res[0] |
| | | if (detail.upLoad) { |
| | | let imgFiles = detail.path1.split(';').map((value, index) => { |
| | | return $f.basePicUrl + value |
| | | }) |
| | | let remark = detail.remark1 == null ? '' : detail.remark1 |
| | | let remarkDisable = true |
| | | that.setData({imgFiles, remark, remarkDisable}) |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | uploadFile(file) { |
| | |
| | | }, |
| | | |
| | | submitLedger() { |
| | | var that = this |
| | | |
| | | this.setData({ |
| | | showDialog: false, |
| | | }) |
| | | wx.showLoading({ |
| | | title: '上传中', |
| | | title: '提交中', |
| | | mask: true, |
| | | success: (res) => {}, |
| | | fail: (res) => {}, |
| | |
| | | this.data.imgFiles.forEach(f => { |
| | | path.push(f.url) |
| | | }); |
| | | ledgerservice.uploadLedger(app.globalData.accessToken.userId, this.data.ledger, path, { |
| | | 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.hideLoading() |
| | | } |
| | | }) |
| | | } |