From c2cfb7a2957287f15af0f95dafca9c6c11a01b81 Mon Sep 17 00:00:00 2001 From: yerz123 Date: Tue, 15 Mar 2022 16:29:37 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=91=E8=9E=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order/editFinance/index.js | 195 +++++++++++++++++++---------- pages/order/editFinance/index.json | 1 + pages/order/editFinance/index.wxml | 34 ++++- 3 files changed, 165 insertions(+), 65 deletions(-) diff --git a/pages/order/editFinance/index.js b/pages/order/editFinance/index.js index 66507fe..83f59e1 100644 --- a/pages/order/editFinance/index.js +++ b/pages/order/editFinance/index.js @@ -1,66 +1,135 @@ -// pages/order/editFinance/index.js +import _ from '../../../commons/js/commons' +const app = getApp() Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - + data: { + o_id:'',//订单id + finance_id:'',//金融产品id + notify_file:'',//按揭通知函文件地址 + price_loan:'',//贷款金额 + submitFlag:false, + }, + onLoad: function (options) { + for (let key in options) { + this.setData({ + [key]: options[key] + }) } + + this.getAppCusorderV2() + + }, + onShow: function () { + + }, + + //获取订单详情 + getAppCusorderV2(){ + let params = {}; + params['id'] = this.data.id; + _.apiQuery.getAppCusorderV2(params).then(res=>{ + this.setData({ + main_type:res.data.main_type, + owner_name:res.data.owner_name?res.data.owner_name:'', + owner_mobile:res.data.owner_mobile?res.data.owner_mobile:'', + owner_cardid:res.data.owner_cardid?res.data.owner_cardid:'', + address:res.data.address?res.data.address:'', + company:res.data.company?res.data.company:'', + credit:res.data.credit?res.data.credit:'', + }) + + wx.stopPullDownRefresh() + + }) + }, + + //修改订单基本信息 + putAppCusorderV2Info() { + if(this.data.main_type == 0&&this.data.owner_name == ''){ + wx.showToast({ + title: '请填写车主姓名', + icon: 'none' + }) + } + else if(this.data.main_type == 0&&!/^1[3456789]\d{9}$/.test(this.data.owner_mobile)){ + wx.showToast({ + title: '请填写车主手机号', + icon: 'none' + }) + } + else if(this.data.main_type == 0&&(this.data.owner_cardid == ''|| !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|[xX])$/.test(this.data.owner_cardid))){ + wx.showToast({ + title: '请填写正确车主身份证', + icon: 'none' + }) + } + else if(this.data.main_type == 0&&this.data.address == ''){ + wx.showToast({ + title: '请填写车主地址', + icon: 'none' + }) + } + else if(this.data.main_type == 1&&this.data.company == ''){ + wx.showToast({ + title: '请填写企业名称', + icon: 'none' + }) + } + else if(this.data.main_type == 1&&this.data.credit == ''){ + wx.showToast({ + title: '请填写企业信用代码', + icon: 'none' + }) + } + else{ + let that = this + that.setData({ + submitFlag: true, + }) + let params = {}; + params['id'] = this.data.id; + if(that.data.owner_name != ''){ + params['owner_name'] = that.data.owner_name; + } + if(that.data.owner_mobile != ''){ + params['owner_mobile'] = that.data.owner_mobile; + } + if(that.data.owner_cardid != ''){ + params['owner_cardid'] = that.data.owner_cardid; + } + if(that.data.company != ''){ + params['company'] = that.data.company; + } + if(that.data.credit != ''){ + params['credit'] = that.data.credit; + } + _.apiQuery.putAppCusorderV2Info(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=>{ + that.setData({ + submitFlag: false, + }) + }); + } + }, + }) \ No newline at end of file diff --git a/pages/order/editFinance/index.json b/pages/order/editFinance/index.json index 8835af0..91032d1 100644 --- a/pages/order/editFinance/index.json +++ b/pages/order/editFinance/index.json @@ -1,3 +1,4 @@ { + "navigationBarTitleText": "金融产品", "usingComponents": {} } \ No newline at end of file diff --git a/pages/order/editFinance/index.wxml b/pages/order/editFinance/index.wxml index e171c1d..f09a0ca 100644 --- a/pages/order/editFinance/index.wxml +++ b/pages/order/editFinance/index.wxml @@ -1,2 +1,32 @@ - -pages/order/editFinance/index.wxml + + + + 车主姓名* + + + + + + 车主手机号码* + + + + + + 车主身份证* + + + + + + 车主地址* + + + + + + + + + + \ No newline at end of file