添加核对提示框

This commit is contained in:
老叶
2021-08-31 16:48:34 +08:00
parent 2eab4c7296
commit 2d809cdf6c
2 changed files with 95 additions and 134 deletions
+82 -130
View File
@@ -47,6 +47,9 @@ Page({
entrust_idcard:'',//委托人身份证
isPreview:false,//是否预览
isShowcheck:false,//是否显示预览核对弹框
checkCount: 4,
checktext: '5s',
},
//生命周期函数--监听页面加载
@@ -432,148 +435,90 @@ Page({
wx.pageScrollTo({
scrollTop: 0
})
that.setData({
isShowcheck:true,
checkCount:4,
checktext: 5 + 's'
})
let interval = setInterval(res => {
if (that.data.checkCount > 0) {
that.setData({
checkCount: that.data.checkCount - 1,
checktext: that.data.checkCount + 's'
})
} else {
clearInterval(interval)
that.setData({
checkCount: 5,
checktext: '知道了'
})
}
}, 1000)
}
},
//新建订单
postAppCusorder() {
let that = this
if (that.data.customerIndex == -1 ) {
wx.showToast({
title: '请选择客户',
icon: 'none'
})
}else if (that.data.name == '' ) {
wx.showToast({
title: '请输入客户姓名',
icon: 'none'
})
}else if (!/^1[3456789]\d{9}$/.test(that.data.mobile)){
wx.showToast({
title: '请输入客户手机号',
icon: 'none'
})
}else if(that.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(that.data.cardid)){
wx.showToast({
title: '请填写正确客户身份证',
icon: 'none'
})
}else if (that.data.address == '' ) {
wx.showToast({
title: '请输入客户地址',
icon: 'none'
})
}else if(that.data.car_id == '' ){
wx.showToast({
title: '请选择车型车系',
icon: 'none'
})
}else if(that.data.v_id == '' ){
wx.showToast({
title: '请选择车型级别',
icon: 'none'
})
}else if(that.data.color_id == '' ){
wx.showToast({
title: '请选择车型颜色',
icon: 'none'
})
}else if(that.data.incolor_id == '' ){
wx.showToast({
title: '请选择内饰颜色',
icon: 'none'
})
}else if(that.data.paymentIndex == -1 ){
wx.showToast({
title: '请选择付款方式',
icon: 'none'
})
}else if(that.data.packIndex == -1 ){
wx.showToast({
title: '请选择代办包',
icon: 'none'
})
that.setData({
submitFlag: true,
})
let params = {};
params['cus_id'] = that.data.customer[that.data.customerIndex].id;
params['name'] = that.data.name;
params['mobile'] = that.data.mobile;
params['cardid'] = that.data.cardid;
params['address'] = that.data.address;
params['car_id'] = that.data.car_id;
params['v_id'] = that.data.v_id;
params['color_id'] = that.data.color_id;
params['incolor_id'] = that.data.incolor_id;
params['price'] = that.data.priceinfo.price;
params['deposit'] = that.data.priceinfo.deposit;
params['payway'] = that.data.paymentIndex==0?'1':'0';
params['pack_id'] = that.data.pack_id;
//params['main_type'] = that.data.mainIndex==0?'0':'1';
params['ifentrust'] = that.data.entrustIndex==0?'1':'0';
if(this.data.entrust_name != ''){
params['entrust_name'] = this.data.entrust_name;
}
// else if(that.data.mainIndex == -1 ){
// wx.showToast({
// title: '请选择购车主体',
// icon: 'none'
// })
// }
else if(that.data.entrustIndex == -1 ){
wx.showToast({
title: '请选择是否委托',
icon: 'none'
})
}else if(that.data.entrustIndex == 0 && that.data.entrust_name == ''){
wx.showToast({
title: '请填写委托人姓名',
icon: 'none'
})
}else if(that.data.entrustIndex == 0 && (that.data.entrust_idcard == ''|| !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|[xX])$/.test(that.data.entrust_idcard))){
wx.showToast({
title: '请填写正确委托人身份证',
icon: 'none'
})
}else{
that.setData({
submitFlag: true,
})
let params = {};
params['cus_id'] = that.data.customer[that.data.customerIndex].id;
params['name'] = that.data.name;
params['mobile'] = that.data.mobile;
params['cardid'] = that.data.cardid;
params['address'] = that.data.address;
params['car_id'] = that.data.car_id;
params['v_id'] = that.data.v_id;
params['color_id'] = that.data.color_id;
params['incolor_id'] = that.data.incolor_id;
params['price'] = that.data.priceinfo.price;
params['deposit'] = that.data.priceinfo.deposit;
params['payway'] = that.data.paymentIndex==0?'1':'0';
params['pack_id'] = that.data.pack_id;
//params['main_type'] = that.data.mainIndex==0?'0':'1';
params['ifentrust'] = that.data.entrustIndex==0?'1':'0';
if(this.data.entrust_name != ''){
params['entrust_name'] = this.data.entrust_name;
}
if(this.data.entrust_idcard != ''){
params['entrust_idcard'] = this.data.entrust_idcard;
}
_.apiQuery.postAppCusorder(params).then(res => {
if(this.data.entrust_idcard != ''){
params['entrust_idcard'] = this.data.entrust_idcard;
}
_.apiQuery.postAppCusorder(params).then(res => {
//刷新列表页
let pages = getCurrentPages();
let prevPage = null; //上一个页面
if (pages.length >= 2) {
prevPage = pages[pages.length - 2]; //上一个页面
if(prevPage.route == 'pages/order/index'){
prevPage.onPullDownRefresh()
}
//刷新列表页
let pages = getCurrentPages();
let prevPage = null; //上一个页面
if (pages.length >= 2) {
prevPage = pages[pages.length - 2]; //上一个页面
if(prevPage.route == 'pages/order/index'){
prevPage.onPullDownRefresh()
}
}
wx.showModal({
title: '登记成功',
content: '',
confirmText: "查看详情",
confirmColor: "#36afa2",
showCancel:false,
success() {
wx.redirectTo({
url: '/pages/order/detail/index?id=' + res.data.id
})
}
})
}).catch(res=>{
that.setData({
submitFlag: false,
})
});
}
wx.showModal({
title: '登记成功',
content: '',
confirmText: "查看详情",
confirmColor: "#36afa2",
showCancel:false,
success() {
wx.redirectTo({
url: '/pages/order/detail/index?id=' + res.data.id
})
}
})
}).catch(res=>{
that.setData({
submitFlag: false,
})
});
},
//输入
//显示隐藏预览
optPreview(e) {
this.setData({
isPreview:!this.data.isPreview,
@@ -583,6 +528,13 @@ Page({
})
},
//显示隐藏预览提示
optShowcheck(){
this.setData({
isShowcheck:!this.data.isShowcheck,
})
},
//输入
inputTx(e) {
this.setData({
+13 -4
View File
@@ -1,5 +1,5 @@
<view class="container">
<view class="pl30 pr30" wx:if="{{!isPreview}}">
<view class="pl30 pr30 pb200" wx:if="{{!isPreview}}">
<view class="mt20 relative">
<view class="font-32">用户信息</view>
<view class="absolute right-0 box-middle font-22 color-666">销售顾问:<text class="color-36afa2">{{userInfo.uname}}</text></view>
@@ -156,12 +156,12 @@
</view>
</block>
<view class="mt60 pl60 pr60">
<view class="fixed left-0 right-0 bottom-0 bg-fff-op90 inner40 fn-flex safe-pb">
<button class="wp100 btn-36afa2 pt10 pb10 text-center font-32 color-fff ulib-r750" hover-class="btn-36afa2-hover" bindtap="previewCusorder">登记预览</button>
</view>
</view>
<view class="pl30 pr30 text-break" wx:else>
<view class="pl30 pr30 text-break pb200" wx:else>
<view class="mt10 pt20 pb20 bg-e3f5f3 font-36 text-center ulib-r10">信息预览</view>
<view class="mt20 relative">
<view class="font-32">用户信息</view>
@@ -243,7 +243,7 @@
</view>
</block>
<view class="mt60 pl30 pr30 fn-flex">
<view class="fixed left-0 right-0 bottom-0 bg-fff-op90 inner40 fn-flex safe-pb">
<button class="wp100 bds-2-36afa2 bg-fff mr20 pt10 pb10 text-center font-32 color-36afa2 ulib-r750" hover-class="btn-36afa2-hover" bindtap="optPreview">重新编辑</button>
<button class="wp100 btn-36afa2 ml20 pt10 pb10 text-center font-32 color-fff ulib-r750" hover-class="btn-36afa2-hover" disabled="{{submitFlag}}" bindtap="postAppCusorder">确认登记</button>
</view>
@@ -270,4 +270,13 @@
<view class="pt25 pb25 color-36afa2" bindtap="hideSelectCustomer">确定</view>
</view>
</view>
</lcb-msg>
<lcb-msg isShow="{{isShowcheck}}">
<view slot="content">
<view class="inner40 pt60 pb60 line-height-16 font-34 color-666">请核对客户姓名,手机号,身份证,地址等信息是否填写正确!</view>
<view class="bts-1-eb text-center font-32 color-666">
<view class="pt25 pb25 {{checkCount==5?'color-36afa2':'color-ccc'}}" bindtap="{{checkCount==5?'optShowcheck':''}}">{{checktext}}</view>
</view>
</view>
</lcb-msg>