From d3315d7eac567c749d56cf3b4f209d83512c47c0 Mon Sep 17 00:00:00 2001
From: TM <923727421@qq.com>
Date: Tue, 15 Dec 2020 15:59:35 +0800
Subject: [PATCH] 修改bug
---
pages/index/index.acss | 4
pages/shskPage/orderInfo/orderInfo.js | 56 +++++++---
utils/validator.js | 8 +
utils/ajaxFn.js | 7 +
pages/index/index.js | 2
pages/forgetPassword/forgetPassword.js | 8 +
pages/hbfqPage/orderInfo/orderInfo.js | 145 ++++++++++++++++++++++++----
pages/changePassword/changePassword.js | 33 +++++-
8 files changed, 205 insertions(+), 58 deletions(-)
diff --git a/pages/changePassword/changePassword.js b/pages/changePassword/changePassword.js
index dfd94ab..d5610e0 100644
--- a/pages/changePassword/changePassword.js
+++ b/pages/changePassword/changePassword.js
@@ -1,5 +1,6 @@
let $api = require('../../utils/ajaxFn.js')
let md5 = require('../../utils/md5.js')
+let validator = require('../../utils/validator.js')
const app = getApp()
Page({
data: {
@@ -8,31 +9,46 @@
info:{
newPwd: "",
oldPwd: ""
- }
+ },
+ userInfo:{}
},
onLoad() {
this.setData({
- userStyle:app.userStyle
+ userStyle:app.userStyle,
+ userInfo:app.userInfo
})
},
getOld(e){
this.setData({
- 'info.oldPwd':md5.hex_md5(e.detail.value)
+ 'info.oldPwd':e.detail.value
})
},
getNem(e){
this.setData({
- 'info.newPwd':md5.hex_md5(e.detail.value)
+ 'info.newPwd':e.detail.value
})
},
getNemTwo(e){
- console.log(3)
this.setData({
- newTwo: md5.hex_md5(e.detail.value)
+ newTwo: e.detail.value
})
},
save(){
- console.log(this.data.newTwo,this.data.info)
+ console.log(this.data.userInfo.mblNo,this.data.newTwo,this.data.info)
+ if(validator.checkValEmpty(this.data.info.oldPwd)){
+ my.showToast({
+ content: '请输入原密码',
+ duration: 2000,
+ });
+ return
+ }
+ if(validator.checkValEmpty(this.data.info.newPwd)){
+ my.showToast({
+ content: '请输入新密码',
+ duration: 2000,
+ });
+ return
+ }
if(this.data.newTwo != this.data.info.newPwd){
my.showToast({
content: '两次新密码不一致,请确认',
@@ -51,7 +67,8 @@
},
true,
{
- ...this.data.info
+ newPwd: md5.hex_md5(this.data.userInfo.mblNo+this.data.info.newPwd),
+ oldPwd: md5.hex_md5(this.data.userInfo.mblNo+this.data.info.oldPwd)
}
)
}
diff --git a/pages/forgetPassword/forgetPassword.js b/pages/forgetPassword/forgetPassword.js
index 1c9b612..a22ff27 100644
--- a/pages/forgetPassword/forgetPassword.js
+++ b/pages/forgetPassword/forgetPassword.js
@@ -50,11 +50,11 @@
})
}else if(code == 2){
this.setData({
- 'info.newPwd':md5.hex_md5(e.detail.value)
+ 'info.newPwd':e.detail.value
})
}else{
this.setData({
- newPwdTwo: md5.hex_md5(e.detail.value)
+ newPwdTwo:e.detail.value
})
}
},
@@ -118,7 +118,9 @@
err=>{},
false,
{
- ...this.data.info
+ mblNo:this.data.info.mblNo,
+ verCode:this.data.info.verCode,
+ newPwd: md5.hex_md5(this.data.info.mblNo+this.data.info.newPwd)
}
)
}
diff --git a/pages/hbfqPage/orderInfo/orderInfo.js b/pages/hbfqPage/orderInfo/orderInfo.js
index 662e490..41184e4 100644
--- a/pages/hbfqPage/orderInfo/orderInfo.js
+++ b/pages/hbfqPage/orderInfo/orderInfo.js
@@ -1,6 +1,7 @@
const app = getApp()
let $api = require('../../../utils/ajaxFn.js')
+let validator = require('../../../utils/validator.js')
Page({
data: {
isBoss: true,
@@ -91,7 +92,6 @@
this.setData({
info: { ...this.data.info, ...obj }
})
- console.log(this.data.info)
if (code == 1) {
if (!this.data.info.amt || !this.data.info.prodId || !this.data.info.term || !this.data.info.zfbVersion) {
this.setData({
@@ -127,7 +127,6 @@
]
})
this.getList({ prodId: this.data.info.prodId })
- console.log(this.data.info.amt, this.data.info.prodId, this.data.info.term, this.data.info.zfbVersion)
if (!this.data.info.amt || !this.data.info.prodId || !this.data.info.term || !this.data.info.zfbVersion) {
this.setData({
isBoss: false
@@ -146,7 +145,6 @@
termName: this.data.termsList[e.detail.value].name,
'info.term': this.data.termsList[e.detail.value].code
})
- console.log(this.data.info.amt, this.data.info.prodId, this.data.info.term, this.data.info.zfbVersion)
if (!this.data.info.amt || !this.data.info.prodId || !this.data.info.term || !this.data.info.zfbVersion) {
this.setData({
isBoss: false
@@ -177,7 +175,6 @@
{ name: '支付利率', rate: 0 }
]
})
- console.log(this.data.info.amt, this.data.info.prodId, this.data.info.term, this.data.info.zfbVersion)
this.getList({ prodId: this.data.info.prodId, zfbVersion: this.data.info.zfbVersion })
if (!this.data.info.amt || !this.data.info.prodId || !this.data.info.term || !this.data.info.zfbVersion) {
this.setData({
@@ -196,15 +193,62 @@
this.setData({
'info.payType': 2
})
- for (let key in this.data.info) {
- if (!this.data.info[key]) {
- my.showToast({
- type: 'none',
- content: '请完整输入信息',
- duration: 2000,
- });
- return
- }
+ let info = this.data.info
+ if (!validator.checkbdMoney(info.amt)||info.amt==0) {
+ my.showToast({
+ type: 'none',
+ content: '请输入0.01-100000之间分期本金',
+ duration: 2000,
+ });
+ return
+ }
+ if (validator.checkValEmpty(info.goodsName)) {
+ my.showToast({
+ type: 'none',
+ content: '请输入商品名称',
+ duration: 2000,
+ });
+ return
+ }
+ if (validator.checkValEmpty(info.prodId)) {
+ my.showToast({
+ type: 'none',
+ content: '请选择付息方式',
+ duration: 2000,
+ });
+ return
+ }
+ if (validator.checkValEmpty(info.zfbVersion)) {
+ my.showToast({
+ type: 'none',
+ content: '请选择办单通道',
+ duration: 2000,
+ });
+ return
+ }
+ if (validator.checkValEmpty(info.term)) {
+ my.showToast({
+ type: 'none',
+ content: '请选择分期期数',
+ duration: 2000,
+ });
+ return
+ }
+ if (validator.checkValEmpty(info.userName)) {
+ my.showToast({
+ type: 'none',
+ content: '请输入客户姓名',
+ duration: 2000,
+ });
+ return
+ }
+ if (validator.checkValEmpty(info.userMblNo)) {
+ my.showToast({
+ type: 'none',
+ content: '请输入客户手机号',
+ duration: 2000,
+ });
+ return
}
my.scan({
scanType: ['qrCode', 'barCode'],
@@ -232,15 +276,72 @@
this.setData({
'info.payType': 1
})
- for (let key in this.data.info) {
- if (!this.data.info[key]) {
- my.showToast({
- type: 'none',
- content: '请完整输入信息',
- duration: 2000,
- });
- return
- }
+ // for (let key in this.data.info) {
+ // if (!this.data.info[key]) {
+ // my.showToast({
+ // type: 'none',
+ // content: '请完整输入信息',
+ // duration: 2000,
+ // });
+ // return
+ // }
+ // }
+ let info = this.data.info
+ if (!validator.checkbdMoney(info.amt)||info.amt==0) {
+ my.showToast({
+ type: 'none',
+ content: '请输入0.01-100000之间分期本金',
+ duration: 2000,
+ });
+ return
+ }
+ if (validator.checkValEmpty(info.goodsName)) {
+ my.showToast({
+ type: 'none',
+ content: '请输入商品名称',
+ duration: 2000,
+ });
+ return
+ }
+ if (validator.checkValEmpty(info.prodId)) {
+ my.showToast({
+ type: 'none',
+ content: '请选择付息方式',
+ duration: 2000,
+ });
+ return
+ }
+ if (validator.checkValEmpty(info.zfbVersion)) {
+ my.showToast({
+ type: 'none',
+ content: '请选择办单通道',
+ duration: 2000,
+ });
+ return
+ }
+ if (validator.checkValEmpty(info.term)) {
+ my.showToast({
+ type: 'none',
+ content: '请选择分期期数',
+ duration: 2000,
+ });
+ return
+ }
+ if (validator.checkValEmpty(info.userName)) {
+ my.showToast({
+ type: 'none',
+ content: '请输入客户姓名',
+ duration: 2000,
+ });
+ return
+ }
+ if (validator.checkValEmpty(info.userMblNo)) {
+ my.showToast({
+ type: 'none',
+ content: '请输入客户手机号',
+ duration: 2000,
+ });
+ return
}
let str = JSON.stringify(this.data.info)
my.navigateTo({
diff --git a/pages/index/index.acss b/pages/index/index.acss
index e532a93..01dfde9 100644
--- a/pages/index/index.acss
+++ b/pages/index/index.acss
@@ -76,7 +76,5 @@
font-family: PingFang SC;
font-weight: 500;
color: #666666;
- position: fixed;
- bottom: 28px;
- left: 35%;
+ padding-top: 30vh;
}
\ No newline at end of file
diff --git a/pages/index/index.js b/pages/index/index.js
index a922582..2e012f1 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -154,7 +154,7 @@
'/sib/xcx/login/mgrLogin',
'POST',
(res)=>{
- this.userInfo = res.data.body
+ app.userInfo = res.data.body
my.reLaunch({
url: '/pages/home/home'
});
diff --git a/pages/shskPage/orderInfo/orderInfo.js b/pages/shskPage/orderInfo/orderInfo.js
index 67da88b..7989b73 100644
--- a/pages/shskPage/orderInfo/orderInfo.js
+++ b/pages/shskPage/orderInfo/orderInfo.js
@@ -1,4 +1,5 @@
let $api = require('../../../utils/ajaxFn.js')
+let validator = require('../../../utils/validator.js')
Page({
data: {
userStyle: {},
@@ -67,15 +68,24 @@
this.setData({
'info.payType': 2
})
- for (let key in this.data.info) {
- if (!this.data.info[key]) {
- my.showToast({
- type: 'none',
- content: '请完整输入信息',
- duration: 2000,
- });
- return
- }
+ // for (let key in this.data.info) {
+ // if (!this.data.info[key]) {
+ // my.showToast({
+ // type: 'none',
+ // content: '请输入商品金额',
+ // duration: 2000,
+ // });
+ // return
+ // }
+ // }
+ let info = this.data.info
+ if (!validator.checkbdMoney(info.payAmt)||info.payAmt==0) {
+ my.showToast({
+ type: 'none',
+ content: '请输入0.01-100000之间商品金额',
+ duration: 2000,
+ });
+ return
}
my.scan({
scanType: ['qrCode', 'barCode'],
@@ -104,17 +114,25 @@
this.setData({
'info.payType': 1
})
- for (let key in this.data.info) {
- if (!this.data.info[key]) {
- my.showToast({
- type: 'none',
- content: '请完整输入信息',
- duration: 2000,
- });
- return
- }
+ // for (let key in this.data.info) {
+ // if (!this.data.info[key]) {
+ // my.showToast({
+ // type: 'none',
+ // content: '请完整输入信息',
+ // duration: 2000,
+ // });
+ // return
+ // }
+ // }
+ let info = this.data.info
+ if (!validator.checkbdMoney(info.payAmt)||info.payAmt==0) {
+ my.showToast({
+ type: 'none',
+ content: '请输入0.01-100000之间商品金额',
+ duration: 2000,
+ });
+ return
}
-
let str = JSON.stringify(this.data.info)
console.log(this.data.info)
my.navigateTo({
diff --git a/utils/ajaxFn.js b/utils/ajaxFn.js
index 609d2c3..c5aea99 100644
--- a/utils/ajaxFn.js
+++ b/utils/ajaxFn.js
@@ -21,8 +21,8 @@
var params = {...data}
// console.log(needLogin)
if(needLogin){
- console.log('验签字符串',str+my.getStorageSync ({ key: 'sessionId' }).data.sessionId)
- console.log('加密',md5.hex_md5('30000003100阿萨德13阿三1588888888810759c883-e0b6-45ea-85db-07d67bb4f509'))
+ // console.log('验签字符串',str+my.getStorageSync ({ key: 'sessionId' }).data.sessionId)
+ // console.log('加密',md5.hex_md5('30000003100阿萨德13阿三1588888888810759c883-e0b6-45ea-85db-07d67bb4f509'))
let sessionId = my.getStorageSync ({ key: 'sessionId' }).data.sessionId
// params.sessionId = sessionId
params.jttechSign = md5.hex_md5(str+sessionId)
@@ -83,6 +83,9 @@
})
},
});
+ my.removeStorageSync({
+ key: 'sessionId',
+ });
}else{
my.hideLoading();
my.showToast({
diff --git a/utils/validator.js b/utils/validator.js
index 8db1577..711f6a0 100644
--- a/utils/validator.js
+++ b/utils/validator.js
@@ -115,6 +115,14 @@
// 如果通过的话,那么判断小数点的前几位数字
return reg.test(commission);
},
+
+ // 验证输入金额
+ checkbdMoney(commission) {
+ //一亿以内,保留四位小数
+ let reg = /^([1-7]\d{0,7}|0)(\.\d{1,2})?$/
+ // 如果通过的话,那么判断小数点的前几位数字
+ return reg.test(commission);
+ },
// 验证渠道编号是否符合规则--4-8位以内数字+字母,区分大小写
checkChannelNo(channelNo) {
let reg = /^[\w\d]{4,8}$/;
--
Gitblit v1.8.0