Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
施宇
/
icsalesProgram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b97a3746
authored
Sep 26, 2019
by
施宇
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
111
parent
d1002dc1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
34 deletions
pages/form/bj/index.js
pages/form/good/index.js
pages/form/xj/index.js
utils/util.js
pages/form/bj/index.js
View file @
b97a3746
// pages/form/bj/index.js
import
{
getData
,
tips
tips
,
fourPoint
}
from
'../../../utils/util.js'
;
import
{
apis
...
...
@@ -49,19 +50,15 @@ Page({
}
else
if
(
isNaN
(
Number
(
obj
.
number
.
trim
())))
{
tips
(
'数量必须为数字'
);
return
}
else
if
(
!
obj
.
price
.
trim
().
length
)
{
tips
(
'请填写价格'
);
return
}
else
{
if
(
!
fourPoint
(
obj
.
price
))
{
return
}
if
(
obj
.
hq
==
2
)
{
//期货
if
(
!
obj
.
day
.
trim
().
length
)
{
tips
(
'请填写货期'
);
return
}
// else if (obj.day.trim().length > 3) {
// tips('货期不能大于3个字符');
// return
// }
}
}
this
.
postData
(
obj
);
...
...
pages/form/good/index.js
View file @
b97a3746
...
...
@@ -2,7 +2,8 @@
import
{
getData
,
chooseImg
,
tips
tips
,
fourPoint
}
from
'../../../utils/util.js'
;
import
{
apis
...
...
@@ -112,22 +113,16 @@ Page({
}
else
if
(
isNaN
(
Number
(
obj
.
stock
.
trim
())))
{
tips
(
'库存必须为数字'
);
return
}
else
if
(
!
obj
.
price
.
trim
().
length
)
{
tips
(
'请填写价格'
);
}
else
{
if
(
!
fourPoint
(
obj
.
price
)){
return
}
else
{
}
if
(
obj
.
hq
==
2
)
{
//期货
if
(
!
obj
.
day
.
trim
().
length
)
{
tips
(
'请填写货期'
);
return
}
// else if (isNaN(Number(obj.day.trim()))) {
// tips('货期必须为数字');
// return
// } else if (obj.day.trim().length > 3) {
// tips('货期不能大于3个字符');
// return
// }
}
}
this
.
postData
(
obj
);
...
...
pages/form/xj/index.js
View file @
b97a3746
...
...
@@ -2,7 +2,8 @@
import
{
getData
,
chooseImg
,
tips
tips
,
fourPoint
}
from
'../../../utils/util.js'
;
import
{
apis
...
...
@@ -46,22 +47,15 @@ Page({
}
else
if
(
isNaN
(
Number
(
obj
.
number
.
trim
())))
{
tips
(
'数量必须为数字'
);
return
}
else
if
(
!
obj
.
price
.
trim
().
length
)
{
tips
(
'请填写价格'
);
return
}
else
{
if
(
!
fourPoint
(
obj
.
price
))
{
return
}
if
(
obj
.
hq
==
2
)
{
//期货
if
(
!
obj
.
day
.
trim
().
length
)
{
tips
(
'请填写货期'
);
return
}
// else if (isNaN(Number(obj.day.trim()))) {
// tips('货期必须为数字');
// return
// } else if (obj.day.trim().length > 3) {
// tips('货期不能大于3个字符');
// return
// }
}
}
this
.
postData
(
obj
);
...
...
utils/util.js
View file @
b97a3746
...
...
@@ -68,7 +68,7 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => {
typeof
callBack
==
"function"
&&
callBack
(
res
.
data
,
""
);
}
}
if
(
tokenInvalid
){
if
(
tokenInvalid
)
{
wx
.
removeStorageSync
(
'access_token'
);
wx
.
removeStorageSync
(
'user_id'
);
wx
.
removeStorageSync
(
'company_name'
);
...
...
@@ -324,17 +324,37 @@ const interval = (usedTime) => {
}
}
}
const
fourPoint
=
(
num
)
=>
{
//检测价格是否是数字或者是四位小数点的小数
let
price
=
num
.
trim
();
if
(
!
price
.
length
)
{
tips
(
'请填写价格'
);
return
false
}
else
{
if
(
isNaN
(
Number
(
price
)))
{
tips
(
'价格必须为数字'
);
return
false
}
else
{
let
strArr
=
price
.
split
(
'.'
);
if
((
strArr
.
length
==
1
)
||
(
strArr
.
length
==
2
&&
strArr
[
1
].
length
==
4
))
{
return
true
}
else
{
tips
(
'价格只支持4位小数点'
);
return
false
}
}
}
}
const
matchReg
=
(
str
)
=>
{
let
reg
=
/<
\/?
.+
?\/?
>/g
;
let
newStr
=
str
.
replace
(
reg
,
''
);
return
newStr
}
const
reloginIm
=
()
=>
{
const
reloginIm
=
()
=>
{
wx
.
showModal
({
title
:
'提示'
,
content
:
'您的聊天账号被迫下线!'
,
confirmText
:
"重新登录"
,
success
:
function
(
res
)
{
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
wx
.
showLoading
();
getApp
().
conn
.
closed
=
true
;
...
...
@@ -356,5 +376,6 @@ module.exports = {
judgeToken
:
judgeToken
,
interval
:
interval
,
matchReg
:
matchReg
,
reloginIm
:
reloginIm
reloginIm
:
reloginIm
,
fourPoint
:
fourPoint
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment