From 9d1734261138538c6d112a1e46467a4b47008759 Mon Sep 17 00:00:00 2001 From: liuminjian <517059477@qq.com> Date: Sun, 15 May 2022 11:31:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=94=B6=E5=85=A5=E7=99=BB?= =?UTF-8?q?=E8=AE=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/inCome/inCome.js | 334 +++++++++++++++++++++++++++++++-------- pages/inCome/inCome.json | 20 ++- pages/inCome/inCome.wxml | 118 ++++++++++---- pages/inCome/inCome.wxss | 63 ++++++-- utils/API.js | 5 +- 5 files changed, 426 insertions(+), 114 deletions(-) diff --git a/pages/inCome/inCome.js b/pages/inCome/inCome.js index f1e6ba3..2bd4eab 100644 --- a/pages/inCome/inCome.js +++ b/pages/inCome/inCome.js @@ -1,4 +1,6 @@ // pages/apply/index.js +import * as UTIL from '../../utils/util.js'; +import * as API from '../../utils/API.js'; const app = getApp(); Page({ @@ -7,37 +9,171 @@ Page({ */ data: { isIPX: app.globalData.isIPX, - show:false, - time:"2022-1-22", - srje:0, - crzh:123132, - srlx:"发包收入", - djbm:3423497895934633, - bzsm:"收合同2022年第一季度款", - fkr:"列示合同乙方或填写", - htbm:"DZ000001", - sjPics:[], - fpPics:[], - qtPics:[], - count:9 + bookName:'', //付款单位 + formData:{ + accountType:'', //账户类型 + accountDate:'', //收入时间 + jieAmount:'', //收入金额 + accountName:'', //存入账户 + incomeType:'', //收入类型 + billNum:'', //单据编码 + accountSummary:'', //备注说明 + contractionId:'', //合同编码 + incomeExpensesType:1, //收支类别 + isBill:0 + }, + incomeTypeOptions:[], //收入类型选项 + incomeTypeText:'222', //收入类型显示文字 + contractionOptions:[], //付款人合同信息列表接口 + showHt:false, + payerText:'', //付款人 + sjPics:[], //收据图片列表数据 + fpPics:[], //发票图片列表数据 + qtPics:[], //其他图片列表数据 + //收入时间弹窗显隐 + srShow:false, + minDate: new Date(2018, 0, 1).getTime(), + maxDate: new Date(2025, 0, 31).getTime(), + crzhShow:false, + accountListOptions:[] //存入账户类型选项 + }, + onCancelcrzh(){ + this.setData({crzhShow:false}) + }, + oncrzhShow(){ this.setData({crzhShow:true})}, + onConfirmcrzh(e){ + let data = e.detail.value; + this.setData({ + crzhShow:false, + 'formData.accountName':data.accountName, + 'formData.accountId':data.id, + 'formData.accountType':data.accountType + }) + }, + onsrDate(){ + this.setData({srShow:true}) + }, + onClose(){ this.setData({srShow:false})}, + onConfirm(e){ + let data = this.getNewDate(new Date(e.detail)); + this.setData({'formData.accountDate':data}) + this.setData({srShow:false}) + }, + closeBox(){ + this.setData({showHt:false}) + }, + getNewDate(date){ + //date是传过来的时间戳,注意需为13位,10位需*1000 + //也可以不传,获取的就是当前时间 + var time = new Date(date); + var year= time.getFullYear() //年 + var month = ("0" + (time.getMonth() + 1)).slice(-2); //月 + var day = ("0" + time.getDate()).slice(-2); //日 + var mydate = year + "-" + month + "-" + day; + return mydate + }, + onConfirmContraction(value){ + let obj = value.detail.value; + this.setData({ + payerText:obj.name, + showHt:false, + 'formData.contractionId':obj.code, + }) + }, + selectContraction(){ + this.setData({showHt:true}) + }, + bindPickerChange (e) { + let obj = this.data.incomeTypeOptions[e.detail.value]; + this.setData({ + 'formData.incomeType':obj.dictValue, + incomeTypeText:obj.dictLabel + }) + }, + inputChange(e){ + this.setData({ + [e.currentTarget.dataset.prop]: e.detail.value + }) }, - /** * 生命周期函数--监听页面加载 */ - onLoad: function (options) { + onShow: function (options) { + + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onLoad: function () { }, + /** + * 生命周期函数--监听页面显示 + */ + onReady: function () { + let that = this; + //初始化收入时间 + this.setData({ + 'formData.accountDate':UTIL.formatDate(new Date()) + }) + + //获取收入单位 + UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, { + success: (res) => { + if (res.code == API.SUCCESS_CODE) { + this.setData({bookName:res.user.bookName}) + } + } + }) + //获取收入类型状态 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'income_type', {method:'GET'}, { + success: (res) => { + if(res.data.length>0){ + that.setData({ + incomeTypeOptions:res.data, + incomeTypeText:res.data[0].dictLabel, + 'formData.incomeType':res.data[0].dictValue + }) + } + } + }) + + // 获取合同信息列表 + UTIL.httpRequest(API.URL_GET_CONTRACTIONLIST , {method:'GET'}, { + success: (res) => { + that.setData({ + contractionOptions:res.rows, + }) + } + }) + //获取当前账套付款账户列表 + UTIL.httpRequest(API.URL_GET_ACCOUNTLIST , {method:'GET'}, { + success: (res) => { + that.setData({ + accountListOptions:res.rows, + }) + } + }) + }, + + deleteimg:function(e){ + let oData = e.currentTarget.dataset; + let file = this.data[oData.status]; + file.splice(oData.id,1) + this.setData({ + [oData.status]:file + }) + }, back:function(){ wx.navigateBack({ delta: 1 }) }, + uploadSjPics: function (e) { //这里是选取图片的方法 var that = this; - var pics = []; var detailPics = that.data.sjPics; if (detailPics.length >= that.data.count) { wx.showToast({ @@ -50,14 +186,20 @@ Page({ sizeType: ['original', 'compressed'], // original 原图,compressed 压缩图,默认二者都有 sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认二者都有 success: function (res) { - var imgs = res.tempFilePaths; - for (var i = 0; i < imgs.length; i++) { - pics.push(imgs[i]) - } - that.uploadimg({ - url: "http://www.test.com//test-api/wechat/applet/api/uploadUserAvatar", //这里是你图片上传的接口 - path: pics, //这里是选取的图片的地址数组 - }); + let fileForm = that.data.sjPics + res.tempFilePaths.forEach(item => { + fileForm.push({ + file: item, + fileType:'1', + bizPath:'cashier', + tableName:'t_cashier_account_flow', + tableId:'' + }) + }) + that.setData({ + sjPics:fileForm + }) + }, }) }, @@ -76,14 +218,19 @@ Page({ sizeType: ['original', 'compressed'], // original 原图,compressed 压缩图,默认二者都有 sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认二者都有 success: function (res) { - var imgs = res.tempFilePaths; - for (var i = 0; i < imgs.length; i++) { - pics.push(imgs[i]) - } - that.uploadimg({ - url: "http://www.test.com//test-api/wechat/applet/api/uploadUserAvatar", //这里是你图片上传的接口 - path: pics, //这里是选取的图片的地址数组 - }); + let fileForm = that.data.fpPics + res.tempFilePaths.forEach(item => { + fileForm.push({ + file: item, + fileType:'2', + bizPath:'cashier', + tableName:'t_cashier_account_flow', + tableId:'' + }) + }) + that.setData({ + fpPics:fileForm + }) }, }) }, @@ -102,45 +249,104 @@ Page({ sizeType: ['original', 'compressed'], // original 原图,compressed 压缩图,默认二者都有 sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认二者都有 success: function (res) { - var imgs = res.tempFilePaths; - for (var i = 0; i < imgs.length; i++) { - pics.push(imgs[i]) - } - that.uploadimg({ - url: "http://www.test.com//test-api/wechat/applet/api/uploadUserAvatar", //这里是你图片上传的接口 - path: pics, //这里是选取的图片的地址数组 - }); + let fileForm = that.data.qtPics + res.tempFilePaths.forEach(item => { + fileForm.push({ + file: item, + fileType:'3', + bizPath:'cashier', + tableName:'t_cashier_account_flow', + tableId:'' + }) + }) + that.setData({ + qtPics:fileForm + }) }, }) }, swichAccounting:function(e){ - console.log(e.currentTarget.dataset.current); - // let cur = e.currentTarget.dataset.current; - // if (this.data.currentTaB == cur) { - // return false; - // }else{ - // wx.navigateTo({ - // url: '../inCome/index?id=' + id, - // }) - // } - wx.navigateTo({ - url: '../inCome/accounting/index?', + let codeStr = e.currentTarget.dataset.code; + let formDataObj = this.data.formData; + if(formDataObj.jieAmount==''){ //收入金额 + UTIL.showToastNoneIcon('请填写收入金额!'); + return false; + }else if(formDataObj.accountName==''){ //存入账户 + UTIL.showToastNoneIcon('请选择存入账户!'); + return false; + }else if(formDataObj.billNum==''){ //单据编码 + UTIL.showToastNoneIcon('请输入单据编码!'); + return false; + }else if(formDataObj.accountSummary==''){ //备注说明 + UTIL.showToastNoneIcon('请输入备注说明!'); + return false; + }else if(formDataObj.incomeType == '2' && formDataObj.contractionId==''){ + UTIL.showToastNoneIcon('收入类型为发包收入,必须选择关联合同!'); + return false; + } + let data = this.data.formData; + data.method = "POST"; + data.checkedStatus = codeStr; + UTIL.httpRequest(API.URL_POST_GERFLOWADD,data,{ + success: (res) => { + if(res.code == 200){ + let vouerId = res.data; + // let vouerId = 1; + let updataList = [...this.data.sjPics,...this.data.fpPics,...this.data.qtPics]; + + + for(let i=0; i 收入单位 - 学坝社区股份经济合作联合社 + {{bookName}} 基础信息 - + 收入时间 - - - {{time}} - - + + {{formData.accountDate}} + + - + 收入金额 - + + + 存入账户 + + + + 请选择存入账户 + {{formData.accountName}} + + + + + + + + + + + + 收入类型 + + + {{incomeTypeText}} + + - 存入账户 - 收入类型 - 单据编码 - 备注说明 + 单据编码 + 备注说明 关联合同 - - 付款人 - + + 付款人{{}} + + 请选择付款人 + {{payerText}} + + + + + + + 合同编码 + + 请选择合同编码 + {{formData.contractionId}} + + - 合同编码 附件 - + 收据 - + - + + @@ -61,14 +117,15 @@ - + 发票 - + - + + @@ -78,14 +135,15 @@ - + 其他 - + - + + @@ -96,9 +154,9 @@ - - - - + + + + \ No newline at end of file diff --git a/pages/inCome/inCome.wxss b/pages/inCome/inCome.wxss index bd9692e..81a5106 100644 --- a/pages/inCome/inCome.wxss +++ b/pages/inCome/inCome.wxss @@ -35,6 +35,11 @@ content:'*'; color:red; } +.rules.no::before{ + content:' '; + padding-left: 14rpx; + color:'#fff'; +} main-title{ background-image: linear-gradient(to right, #2C8E68 , #B3DB62); color: #ffffff; @@ -44,7 +49,7 @@ main-title{ } .main-box{ background: #ffffff; - padding: 20rpx; + padding: 20rpx 20rpx 10rpx; width: 94%; margin: 0 auto; border-radius: 10rpx; @@ -53,6 +58,10 @@ main-title{ .main-box block{ float: right; } + +.main-box .color-gray{ + color: #888; +} .title{ padding: 10rpx calc(3% + 20px); color : #07c160; @@ -60,21 +69,37 @@ main-title{ font-size:30rpx; } .table-box view{ - display: flex; - justify-content: space-between; + } .table-box text{ + /* line-height: 55rpx; */ +} +.table-box .flex-block{ line-height: 55rpx; + margin-bottom: 5rpx; + display: flex; + justify-content: space-between; +} +.table-box .rules{ + width: 200rpx; +} +.table-box .picker_wrap{ + /* display: flex; + justify-content: flex-end; + align-items: center; */ } +.table-box .picker{text-align: right;} +.table-box .wrap{flex:1; text-align: right;} .fjLable{ - display: inline-block; + display: flex; width:24px; - margin:30rpx 5rpx; + margin:25rpx 5rpx; color:#fff; background:#07c160; - border-radius: 10rpx; text-align: center; - line-height: 40rpx!important; + border-radius: 10rpx; + justify-content: center; /* 相对父元素水平居中 */ + align-items: center; padding:25rpx 0; } .content { @@ -94,13 +119,18 @@ main-title{ .img-item { width: 30%; text-align: left; - margin-right: 20rpx; + margin-right: 3%; margin-bottom: 10rpx; + position: relative; } - -.img-item image { - width: 180rpx; - height: 180rpx; +.img-item .close-ico{ + position: absolute; + right: -10rpx; + top: -10rpx; +} +.img-item .imagea { + width: 160rpx; + height: 160rpx; } .submit-btn { @@ -115,14 +145,19 @@ main-title{ } .chooseimg { + height: 160rpx; background-color: #fff; + display: flex; + justify-content: center; /* 相对父元素水平居中 */ + align-items: center; } .weui-uploader__input-box { + float: left; position: relative; - margin-right: 9rpx; - margin-bottom: 9rpx; + /* margin-right: 9rpx; + margin-bottom: 9rpx; */ width: 120rpx; height: 120rpx; border: 1px solid #d9d9d9; diff --git a/utils/API.js b/utils/API.js index 3de1140..644f06b 100644 --- a/utils/API.js +++ b/utils/API.js @@ -188,6 +188,8 @@ const URL_GET_GETMONEYORDERLIST = `${URL_PREFIX}/yinnong/moneyorder/list`; //汇票、现金支出申请 const URL_GET_GETCASHSAVE = `${URL_PREFIX}/yinnong/approvalItems/cashSave`; +//增加收入流水 +const URL_POST_GERFLOWADD = `${URL_PREFIX}/cashier/flow/add`; /****************接口地址end****************/ @@ -265,5 +267,6 @@ export { URL_GET_GETBOOKKEEP, URL_GET_GETAPPROVALBYID, URL_GET_GETMONEYORDERLIST, - URL_GET_GETCASHSAVE + URL_GET_GETCASHSAVE, + URL_POST_GERFLOWADD } \ No newline at end of file