diff --git a/pages/apply/paymentTemplate/add/add.js b/pages/apply/paymentTemplate/add/add.js index c4875c8..55005ce 100644 --- a/pages/apply/paymentTemplate/add/add.js +++ b/pages/apply/paymentTemplate/add/add.js @@ -1690,6 +1690,71 @@ Page({ } }) }, + uploadFile(e){ + var that = this; + wx.chooseMessageFile({ + count: 1, + type: 'file', + success (res) { + console.log(res); + // tempFilePath可以作为 img 标签的 src 属性显示图片 + const tempFilePaths = res.tempFiles + wx.uploadFile({ + url: API.URL_GET_UPLOADFILE, + filePath: tempFilePaths[0].path, + name: 'file', + header: { + "Content-Type": "multipart/form-data",//记得设置 + "chartset":"utf-8", + 'Authorization':'Bearer '+getApp().globalData.userInfo.token + }, + formData:{ + bankType:'2', + accountType:'1', + isPeers:'Y' + }, + success (response){ + console.log(response); + let list = JSON.parse(response.data); + console.log(list); + that.setData({ + ['form.transfers[0].payeeList']:list.rows + }) + }, + fail(res){ + } + }) + } + }) + }, + downLoad(){ + wx.downloadFile({ + url: API.URL_GET_DOWNFILE, //仅为示例,并非真实的资源 + success (res) { + console.log(res); + // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容 + if (res.statusCode === 200) { + var fs = wx.getFileSystemManager(); + fs.saveFile({ + tempFilePath:res.tempFilePath, + success:function(response){ + console.log(response); + } + }) + // wx.saveFile({ + // tempFilePath: res.tempFilePath, + // success:function(response){ + // console.log(response); + // } + // }) + + // wx.playVoice({ + // filePath: res.tempFilePath + // }) + } + } + }) + }, /** * 生命周期函数--监听页面隐藏 */ diff --git a/pages/apply/paymentTemplate/add/add.wxml b/pages/apply/paymentTemplate/add/add.wxml index c1ee7ef..086eee1 100644 --- a/pages/apply/paymentTemplate/add/add.wxml +++ b/pages/apply/paymentTemplate/add/add.wxml @@ -221,7 +221,16 @@ + 收款方信息 + + + 批量上传 + + + + 模板下载 + diff --git a/project.private.config.json b/project.private.config.json index 3eadc8d..bb0c074 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -149,5 +149,5 @@ }, "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "projectname": "WXMB", - "libVersion": "2.11.2" + "libVersion": "2.24.3" } \ No newline at end of file diff --git a/utils/API.js b/utils/API.js index 7f93bda..791d191 100644 --- a/utils/API.js +++ b/utils/API.js @@ -306,6 +306,12 @@ const URL_GET_PAYEEGET = `${URL_PREFIX}/yinnong/payee/get/`; //收款人删除 const URL_GET_PAYEEREMOVE = `${URL_PREFIX}/yinnong/payee/remove/`; +//上传收款人 +const URL_GET_UPLOADFILE = `${URL_PREFIX}/yinnong/transfer/importData`; + +//下载收款人模板 +const URL_GET_DOWNFILE = `${URL_PREFIX}/yinnong/transfer/importTemplate`; + /****************接口地址end****************/ @@ -423,5 +429,7 @@ export { URL_GET_ASSETREMOVE, URL_GET_PAYEEEDIT, URL_GET_PAYEEGET, - URL_GET_PAYEEREMOVE + URL_GET_PAYEEREMOVE, + URL_GET_UPLOADFILE, + URL_GET_DOWNFILE } \ No newline at end of file