| @@ -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 | |||||
| // }) | |||||
| } | |||||
| } | |||||
| }) | |||||
| }, | |||||
| /** | /** | ||||
| * 生命周期函数--监听页面隐藏 | * 生命周期函数--监听页面隐藏 | ||||
| */ | */ | ||||
| @@ -221,7 +221,16 @@ | |||||
| </block> | </block> | ||||
| </view> | </view> | ||||
| <text class="title">收款方信息</text> | <text class="title">收款方信息</text> | ||||
| <view bindtap="uploadFile"> | |||||
| <image src="/image/apply/icon_exel.png" style="width: 25px;height: 25px;"></image> | |||||
| <text>批量上传</text> | |||||
| </view> | |||||
| <view bindtap="downLoad"> | |||||
| <image src="/image/apply/icon_exel.png" style="width: 25px;height: 25px;"></image> | |||||
| <text>模板下载</text> | |||||
| </view> | |||||
| <view class="center-box"> | <view class="center-box"> | ||||
| <block wx:if="{{form.transfers[index].transferType == 12}}"> | <block wx:if="{{form.transfers[index].transferType == 12}}"> | ||||
| <view class="main-box table-box" wx:for="{{form.transfers[index].payeeList}}" wx:for-index="childrenIndex" wx:key="payeeId"> | <view class="main-box table-box" wx:for="{{form.transfers[index].payeeList}}" wx:for-index="childrenIndex" wx:key="payeeId"> | ||||
| @@ -149,5 +149,5 @@ | |||||
| }, | }, | ||||
| "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", | "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", | ||||
| "projectname": "WXMB", | "projectname": "WXMB", | ||||
| "libVersion": "2.11.2" | |||||
| "libVersion": "2.24.3" | |||||
| } | } | ||||
| @@ -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_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****************/ | /****************接口地址end****************/ | ||||
| @@ -423,5 +429,7 @@ export { | |||||
| URL_GET_ASSETREMOVE, | URL_GET_ASSETREMOVE, | ||||
| URL_GET_PAYEEEDIT, | URL_GET_PAYEEEDIT, | ||||
| URL_GET_PAYEEGET, | URL_GET_PAYEEGET, | ||||
| URL_GET_PAYEEREMOVE | |||||
| URL_GET_PAYEEREMOVE, | |||||
| URL_GET_UPLOADFILE, | |||||
| URL_GET_DOWNFILE | |||||
| } | } | ||||