金融产品编辑

This commit is contained in:
老叶
2022-03-18 18:15:26 +08:00
parent 31f3d5f63f
commit 970fa4ae64
2 changed files with 235 additions and 93 deletions
+171 -73
View File
@@ -30,7 +30,9 @@ Page({
params['id'] = this.data.id;
_.apiQuery.getAppCusorderV2(params).then(res=>{
this.setData({
info:res.data,
notify_file_obj:res.data.notify_file,
lend_file_obj:res.data.lend_file,
price_loan:res.data.price_loan?res.data.price_loan:'',
})
@@ -104,39 +106,76 @@ Page({
//上传按揭通知函
chooseImg(e) {
let that = this
wx.chooseImage({
count: 1, // 默认9
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success(res) {
wx.showLoading();
wx.uploadFile({
url:_.config.api.upImg,
filePath:res.tempFilePaths[0],
name: 'img',
formData: {
'app': 'liche'
},
success: (resp) => {
resp.data = JSON.parse(resp.data);
wx.hideLoading();
if (resp.data.code == 200) {
that.setData({
'notify_file_obj.value':resp.data.data.url,
'notify_file_obj.src':resp.data.data.full_url,
})
}
},
})
},
fail: res => {
wx.showToast({
title: '文件选择失败',
icon: 'none',
duration: 2000
})
}
})
if(e.currentTarget.dataset.type=='notify'){
wx.chooseImage({
count: 1, // 默认9
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success(res) {
wx.showLoading();
wx.uploadFile({
url:_.config.api.upImg,
filePath:res.tempFilePaths[0],
name: 'img',
formData: {
'app': 'liche'
},
success: (resp) => {
resp.data = JSON.parse(resp.data);
wx.hideLoading();
if (resp.data.code == 200) {
that.setData({
'notify_file_obj.value':resp.data.data.url,
'notify_file_obj.src':resp.data.data.full_url,
})
}
},
})
},
fail: res => {
wx.showToast({
title: '文件选择失败',
icon: 'none',
duration: 2000
})
}
})
}
if(e.currentTarget.dataset.type=='lend'){
wx.chooseImage({
count: 1, // 默认9
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success(res) {
wx.showLoading();
wx.uploadFile({
url:_.config.api.upImg,
filePath:res.tempFilePaths[0],
name: 'img',
formData: {
'app': 'liche'
},
success: (resp) => {
resp.data = JSON.parse(resp.data);
wx.hideLoading();
if (resp.data.code == 200) {
that.setData({
'lend_file_obj.value':resp.data.data.url,
'lend_file_obj.src':resp.data.data.full_url,
})
}
},
})
},
fail: res => {
wx.showToast({
title: '文件选择失败',
icon: 'none',
duration: 2000
})
}
})
}
},
//修改贷款信息
@@ -161,51 +200,110 @@ Page({
}
else{
let that = this
wx.showModal({
title: '确定修改按揭信息?',
content: '金融机构:'+that.data.financeArray[that.data.financeIndex]+'\r\n贷款金额:'+that.data.price_loan+' ',
confirmColor: "#36afa2",
success(resW) {
if (resW.confirm) {
that.setData({
submitFlag: true,
})
let params = {};
params['o_id'] = that.data.id;
params['finance_id'] = that.data.finance_id;
params['notify_file'] = that.data.notify_file_obj.value;
params['price_loan'] = that.data.price_loan;
_.apiQuery.putAppLoan(params).then(res => {
//刷新详情页
let pages = getCurrentPages();
let prevPage = null; //上一个页面
if (pages.length >= 2) {
prevPage = pages[pages.length - 2]; //上一个页面
if(prevPage.route == 'pages/order/detail/index2'){
prevPage.onPullDownRefresh()
}
}
wx.showToast({
title: '编辑成功',
icon: 'success',
duration: 2000
})
setTimeout(function () {
wx.navigateBack({
delta: 1
})
}, 500)
}).catch(res=>{
if(that.data.info.edit_status==1){
wx.showModal({
title: '确定修改按揭信息?',
content: '金融机构:'+that.data.financeArray[that.data.financeIndex]+'\r\n贷款金额:'+that.data.price_loan+' ',
confirmColor: "#36afa2",
success(resW) {
if (resW.confirm) {
that.setData({
submitFlag: false,
submitFlag: true,
})
});
let params = {};
params['o_id'] = that.data.id;
params['finance_id'] = that.data.finance_id;
params['notify_file'] = that.data.notify_file_obj.value;
params['price_loan'] = that.data.price_loan;
if(that.data.lend_file_obj.value){
params['lend_file'] = that.data.lend_file_obj.value;
}
_.apiQuery.putAppLoan(params).then(res => {
that.setData({
submitFlag: false,
})
//刷新详情页
let pages = getCurrentPages();
let prevPage = null; //上一个页面
if (pages.length >= 2) {
prevPage = pages[pages.length - 2]; //上一个页面
if(prevPage.route == 'pages/order/detail/index2'){
prevPage.onPullDownRefresh()
}
}
wx.showToast({
title: '编辑成功',
icon: 'success',
duration: 2000
})
setTimeout(function () {
wx.navigateBack({
delta: 1
})
}, 500)
}).catch(res=>{
that.setData({
submitFlag: false,
})
});
}
}
})
}else{
that.setData({
submitFlag: true,
})
let params = {};
params['o_id'] = that.data.id;
params['finance_id'] = that.data.finance_id;
params['notify_file'] = that.data.notify_file_obj.value;
params['price_loan'] = that.data.price_loan;
if(that.data.lend_file_obj.value){
params['lend_file'] = that.data.lend_file_obj.value;
}
})
_.apiQuery.putAppLoan(params).then(res => {
that.setData({
submitFlag: false,
})
//刷新详情页
let pages = getCurrentPages();
let prevPage = null; //上一个页面
if (pages.length >= 2) {
prevPage = pages[pages.length - 2]; //上一个页面
if(prevPage.route == 'pages/order/detail/index2'){
prevPage.onPullDownRefresh()
}
}
wx.showToast({
title: '编辑成功',
icon: 'success',
duration: 2000
})
setTimeout(function () {
wx.navigateBack({
delta: 1
})
}, 500)
}).catch(res=>{
that.setData({
submitFlag: false,
})
});
}
}
},
//查看图片
previewImage: function (e) {
wx.previewImage({
current:this.data.notify_file_obj.src,
urls:[this.data.notify_file_obj.src],
})
},
})
+64 -20
View File
@@ -1,43 +1,87 @@
<view class="container">
<view class="inner30">
<view class="relative bbs-1-eb pl190 last-b-none" wx:if="{{financeArray.length>0}}">
<view class="absolute left-0 box-middle font-28 color-333">金融机构<text class="color-f9394d">*</text></view>
<view class="pt30 pb30 text-right font-28 color-666">
<picker bindchange="changeFinance" value="{{financeIndex}}" range="{{financeArray}}">
<text class="color-ccc" wx:if="{{financeIndex == -1}}">请选择</text>
<text wx:else>{{financeArray[financeIndex]}}</text>
<i class="iconfont ml5 icon-gengduo"></i>
</picker>
<block wx:if="{{info.edit_status==1}}">
<view class="relative bbs-1-eb pl190 last-b-none" wx:if="{{financeArray.length>0}}">
<view class="absolute left-0 box-middle font-28 color-333">金融机构<text class="color-f9394d">*</text></view>
<view class="pt30 pb30 text-right font-28">
<picker bindchange="changeFinance" value="{{financeIndex}}" range="{{financeArray}}">
<text class="color-ccc" wx:if="{{financeIndex == -1}}">请选择</text>
<text wx:else>{{financeArray[financeIndex]}}</text>
<i class="iconfont ml5 icon-gengduo"></i>
</picker>
</view>
</view>
</view>
<view class="relative bbs-1-eb last-b-none pl180 font-28">
<view class="absolute left-0 box-middle">贷款金额<text class="color-f9394d">*</text></view>
<view>
<input class="wp100 height-100 text-right font-28" placeholder-class="color-ccc" type="number" placeholder="请输入贷款金额" model:value='{{price_loan}}' />
<view class="relative bbs-1-eb last-b-none pl180 font-28">
<view class="absolute left-0 box-middle">贷款金额<text class="color-f9394d">*</text></view>
<view>
<input class="wp100 height-100 text-right font-28" placeholder-class="color-ccc" type="number" placeholder="请输入贷款金额" model:value='{{price_loan}}' />
</view>
</view>
</view>
<view class="relative">
<view class="mt30 font-28">按揭通知函<text class="color-f9394d">*</text></view>
<view class="mt30 text-center">
<view class="inline-block img-300x200 relative ulib-r10 overflowhidden" bindtap="chooseImg" data-type="notify" >
<block wx:if="{{notify_file_obj.value}}">
<view class="inline-block bg-f8 img-300x200 relative ulib-r10 overflowhidden">
<i class="absolute top-0 right-0 bg-000-op50 iconfont icon-shuaxin inner10 font-26 color-fff ulib-rtr10 ulib-rbl10 z-index-4"></i>
<image class='block wp100 img-h-200 ulib-r10' src='{{notify_file_obj.src}}' mode='aspectFit'></image>
</view>
</block>
<block wx:else>
<view class="inline-block bg-f8 img-300x200 relative ulib-r10 overflowhidden">
<view class="absolute left-0 right-0 box-middle color-ccc">
<i class="iconfont icon-fanmian font-60"></i>
<view class="mt10 font-22">上传按揭通知函</view>
</view>
</view>
</block>
</view>
</view>
</view>
</block>
<block wx:else>
<view class="relative bbs-1-eb pl190 last-b-none">
<view class="absolute left-0 box-middle font-28 color-333">金融机构</view>
<view class="pt30 pb30 text-right font-28 color-666" style="min-height:38rpx;">{{financeArray[financeIndex]}}</view>
</view>
<view class="relative bbs-1-eb last-b-none pl180 font-28">
<view class="absolute left-0 box-middle">贷款金额</view>
<view class="pt30 pb30 text-right font-28 color-666" style="min-height:38rpx;">{{price_loan}}</view>
</view>
<view class="relative">
<view class="mt30 font-28">按揭通知函</view>
<view class="mt30 text-center">
<view class="inline-block img-300x200 relative ulib-r10 overflowhidden" bindtap="previewImage">
<block wx:if="{{notify_file_obj.value}}">
<view class="inline-block img-300x200 relative ulib-r10 overflowhidden">
<image class='block wp100 img-h-200 ulib-r10' src='{{notify_file_obj.src}}' mode='aspectFit'></image>
</view>
</block>
</view>
</view>
</view>
</block>
<view class="relative">
<view class="mt30 font-28">按揭通知函<text class="color-f9394d">*</text></view>
<view class="mt30 font-28">放款通知函</view>
<view class="mt30 text-center">
<view class="inline-block img-300x200 relative ulib-r10 overflowhidden" bindtap="chooseImg">
<block wx:if="{{notify_file_obj.value}}">
<view class="inline-block img-300x200 relative ulib-r10 overflowhidden" bindtap="chooseImg" data-type="lend">
<block wx:if="{{lend_file_obj.value}}">
<view class="inline-block bg-f8 img-300x200 relative ulib-r10 overflowhidden">
<i class="absolute top-0 right-0 bg-000-op50 iconfont icon-shuaxin inner10 font-26 color-fff ulib-rtr10 ulib-rbl10 z-index-4"></i>
<image class='block wp100 img-h-200 ulib-r10' src='{{notify_file_obj.src}}' mode='aspectFit'></image>
<image class='block wp100 img-h-200 ulib-r10' src='{{lend_file_obj.src}}' mode='aspectFit'></image>
</view>
</block>
<block wx:else>
<view class="inline-block bg-f8 img-300x200 relative ulib-r10 overflowhidden">
<view class="absolute left-0 right-0 box-middle color-ccc">
<i class="iconfont icon-fanmian font-60"></i>
<view class="mt10 font-22">上传按揭通知函</view>
<view class="mt10 font-22">上传放款通知函</view>
</view>
</view>
</block>
</view>
</view>
</view>
</view>
</view>