From 5020402f10f524d493382757b040e35d63d60ddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=8F=B6?= Date: Fri, 7 Apr 2023 15:26:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B4=AD=E8=BD=A6=E4=BA=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 3 +- pages/order/detail/index2.wxml | 9 +- pages/order/editBuyer/index.js | 169 +++++++++++++++++++++++++++++++ pages/order/editBuyer/index.json | 3 + pages/order/editBuyer/index.wxml | 36 +++++++ pages/order/editBuyer/index.wxss | 19 ++++ 6 files changed, 236 insertions(+), 3 deletions(-) create mode 100644 pages/order/editBuyer/index.js create mode 100644 pages/order/editBuyer/index.json create mode 100644 pages/order/editBuyer/index.wxml create mode 100644 pages/order/editBuyer/index.wxss diff --git a/app.json b/app.json index b82ceb9..eafad62 100644 --- a/app.json +++ b/app.json @@ -60,7 +60,8 @@ "pages/order/editDeliveryckimg/index", "pages/order/editQVImg/index", "pages/order/editVoucherImg/index", - "pages/dataAnalysis/detail/index" + "pages/dataAnalysis/detail/index", + "pages/order/editBuyer/index" ], "echarts": [ { diff --git a/pages/order/detail/index2.wxml b/pages/order/detail/index2.wxml index 1993fb1..fc9568d 100644 --- a/pages/order/detail/index2.wxml +++ b/pages/order/detail/index2.wxml @@ -2,8 +2,13 @@ - 购车人信息 - 销售顾问:{{info.admin_name}} + 销售顾问:{{info.admin_name}} + + + 购车人信息 + + + 客户姓名 diff --git a/pages/order/editBuyer/index.js b/pages/order/editBuyer/index.js new file mode 100644 index 0000000..aa176e6 --- /dev/null +++ b/pages/order/editBuyer/index.js @@ -0,0 +1,169 @@ +import _ from '../../../commons/js/commons' +const app = getApp() +Page({ + data: { + name:'',//姓名 + mobile:'',//手机号 + cardid:'',//身份证 + }, + 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({ + name:res.data.name?res.data.name:'', + mobile:res.data.mobile?res.data.mobile:'', + cardid:res.data.cardid?res.data.cardid:'', + }) + + wx.stopPullDownRefresh() + + }) + }, + + //修改订单基本信息 + putAppCusorderV2Info() { + this.setData({ + mobile:this.trimAll(this.data.mobile), + cardid:this.trimAll(this.data.cardid), + }) + if (this.data.name == '' ) { + wx.showToast({ + title: '请输入客户姓名', + icon: 'none' + }) + }else if (this.data.mobile != this.data.org_mobile && !/^1[3456789]\d{9}$/.test(this.data.mobile)){ + wx.showToast({ + title: '请输入客户手机号', + icon: 'none' + }) + } + else if(this.data.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.cardid)){ + wx.showToast({ + title: '请填写正确客户身份证', + icon: 'none' + }) + } + else{ + let that = this + that.setData({ + submitFlag: true, + }) + let params = {}; + params['id'] = that.data.id; + params['name'] = that.data.name; + params['mobile'] = that.data.mobile; + params['cardid'] = that.data.cardid; + _.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, + }) + }); + } + }, + + //推送链接 + pushLink(e){ + if(e.currentTarget.dataset.url){ + _.$router.openUrlScheme(e.currentTarget.dataset.url) + } + }, + + //选择图片 + chooseImg(e) { + let that = this + //上传身份证正面-车主身份证 + //上传身份证正面-客户身份证 + if(e.currentTarget.dataset.type=='customer'){ + wx.chooseImage({ + count: 1, // 默认9 + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success(res) { + wx.showLoading({ + title: '识别中', + }) + wx.uploadFile({ + url:_.config.api.upImg, + filePath:res.tempFilePaths[0], + name: 'img', + formData: { + 'app': 'liche' + }, + success: (resp) => { + resp.data = JSON.parse(resp.data); + if (resp.data.code == 200) { + let params = {}; + params['img'] = resp.data.data.url; + _.apiQuery.getAppIdcardInfo(params).then(res2 => { + wx.hideLoading(); + that.setData({ + cardid:res2.data.IdNum, + name:res2.data.Name, + }) + }) + } + }, + fail: res => { + wx.hideLoading(); + } + }) + }, + fail: res => { + wx.showToast({ + title: '文件选择失败', + icon: 'none', + duration: 2000 + }) + } + }) + } + }, + + //去除空格 + trimAll(ele){ + if(typeof ele === 'string'){ + return ele.split(' ').join(''); + }else{ + console.error(`${typeof ele} is not the expected type, but the string type is expected`) + } + }, + +}) \ No newline at end of file diff --git a/pages/order/editBuyer/index.json b/pages/order/editBuyer/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/order/editBuyer/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/order/editBuyer/index.wxml b/pages/order/editBuyer/index.wxml new file mode 100644 index 0000000..8277717 --- /dev/null +++ b/pages/order/editBuyer/index.wxml @@ -0,0 +1,36 @@ + + + 购车人信息 + + + 客户手机号码* + + + + + + 客户身份证* + + + + + + + 客户姓名* + + + + + + + + + 《狸车用户注册协议》 + + 《狸车用户隐私政策》 + + + + + + \ No newline at end of file diff --git a/pages/order/editBuyer/index.wxss b/pages/order/editBuyer/index.wxss new file mode 100644 index 0000000..14fc525 --- /dev/null +++ b/pages/order/editBuyer/index.wxss @@ -0,0 +1,19 @@ +/*复选框外框样式*/ +.statement checkbox .wx-checkbox-input { + width:22rpx; + height:22rpx; + border-color: #999; + background: #f9f9f9; +} +/* 选中后的 背景样式*/ +.statement checkbox .wx-checkbox-input.wx-checkbox-input-checked { + border-color: #36afa2; + background: #36afa2; +} +/*复选框选中后内部样式*/ +.statement checkbox .wx-checkbox-input.wx-checkbox-input-checked::before { + font-size:18rpx; + color:#fff; + transform:translate(-50%, -50%) scale(1); + -webkit-transform:translate(-50%, -50%) scale(1); +} \ No newline at end of file