Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
yunxin
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
2dcb3ba5
authored
Jun 03, 2019
by
PRY5YKGJ82EZEPX\Administrator
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
更新修改联营sku
parent
67d36d77
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
13 deletions
app/Http/function.php
app/Model/Server/ServerFoostoneModel.php
public/pc/js/controller/GoodsComList.js
app/Http/function.php
View file @
2dcb3ba5
...
...
@@ -905,6 +905,19 @@ function arrayToCommaStr($data,$col,$type=''){
}
}
/*
* /^[1-9]{1}\d{0,9}$/
* 判断是否大于0的数字,包括小数
*/
function
checkIn
(
$str
){
if
(
preg_match
(
"/^[1-9]
{
1}\d{0,9
}
$/"
,
$str
))
//大于0的数字,包括小数
{
return
true
;
}
else
{
return
false
;
}
}
/*
* /^[1-9]{1}\d{0,9}$/
* 判断是否大于0的数字,包括小数
*/
function
checkFloat
(
$str
){
...
...
@@ -1050,7 +1063,7 @@ function ExportLayui2($errcode=[]){
}
function
Export2
(
$errcode
=
0
,
$errmsg
=
'成功'
,
$data
=
''
,
$other
=
''
){
if
(
is_array
(
$errcode
)){
echo
json_encode
([
'code'
=>
$errcode
[
0
],
'errmsg'
=>
$errcode
[
1
],
'data'
=>!
empty
(
@
$errcode
[
2
])
?@
$errcode
[
2
]
:
''
,
'other'
=>@
$errcode
[
3
]],
JSON_UNESCAPED_UNICODE
|
JSON_UNESCAPED_SLASHES
);
echo
json_encode
([
'code'
=>
@
$errcode
[
0
],
'errmsg'
=>@
$errcode
[
1
],
'data'
=>!
empty
(
@
$errcode
[
2
])
?@
$errcode
[
2
]
:
''
,
'other'
=>@
$errcode
[
3
]],
JSON_UNESCAPED_UNICODE
|
JSON_UNESCAPED_SLASHES
);
}
else
{
echo
json_encode
([
'code'
=>
$errcode
,
'errmsg'
=>
$errmsg
,
'data'
=>
$data
,
'other'
=>
$other
],
JSON_UNESCAPED_UNICODE
|
JSON_UNESCAPED_SLASHES
);
}
...
...
app/Model/Server/ServerFoostoneModel.php
View file @
2dcb3ba5
...
...
@@ -99,7 +99,14 @@ class ServerFoostoneModel
public
function
comSkuEdit
(
$data
,
$type
=
1
){
if
(
empty
(
@
$data
[
'goods_id'
]))
return
[
1001
,
'商品id必填'
];
$tdata
[
'goods_id'
]
=
$data
[
'goods_id'
];
if
(
!
empty
(
@
$data
[
'stock'
]))
$tdata
[
'stock'
]
=
$data
[
'stock'
];
$stock
=
@
$data
[
'stock'
];
if
(
array_key_exists
(
'stock'
,
$data
)){
if
(
@
$stock
!=
'0'
&&
!
checkIn
(
$stock
))
//大于0的数字,包括小数
{
return
[
1002
,
'库存数量填写不正确:'
.
$stock
];
}
$tdata
[
'stock'
]
=
$stock
;
}
if
(
array_key_exists
(
'purchases'
,
$data
))
{
$ladder_price
=
[];
$price_cn
=
$data
[
'price_cn'
];
//国内含税价
...
...
@@ -111,8 +118,8 @@ class ServerFoostoneModel
if
(
!
(
int
)
$v
)
return
[
1002
,
'阶梯数量填写不对:'
.
$v
];
if
(
$k
>
0
&&
$purchases
[
$k
]
<=
$purchases
[
$k
-
1
])
return
[
1003
,
'第'
.
(
$k
+
1
)
.
'行阶梯数量必须比上一行阶梯数量大'
];
if
(
empty
(
$price_cn
[
$k
])
&&
empty
(
$price_us
[
$k
])
)
return
[
1004
,
'阶梯数量对应国内含税价或香港交货价必填写一个'
.
$price_cn
[
$k
]];
if
(
$k
>
0
&&
$price_cn
[
$k
]
!=
""
&&
$price_cn
[
$k
]
<=
$price_cn
[
$k
-
1
])
return
[
1005
,
'第'
.
(
$k
+
1
)
.
'行国内含税价必须比上一行国内含税价大
'
];
if
(
$k
>
0
&&
$price_us
[
$k
]
!=
""
&&
$price_us
[
$k
]
<=
$price_us
[
$k
-
1
])
return
[
1006
,
'第'
.
(
$k
+
1
)
.
'行香港含税价必须比上一行香港含税价大
'
];
if
(
$k
>
0
&&
$price_cn
[
$k
]
!=
""
&&
$price_cn
[
$k
]
>=
$price_cn
[
$k
-
1
])
return
[
1005
,
'第'
.
(
$k
+
1
)
.
'行国内含税价必须比上一行国内含税价小
'
];
if
(
$k
>
0
&&
$price_us
[
$k
]
!=
""
&&
$price_us
[
$k
]
>=
$price_us
[
$k
-
1
])
return
[
1006
,
'第'
.
(
$k
+
1
)
.
'行香港含税价必须比上一行香港含税价小
'
];
array_push
(
$ladder_price
,[
"purchases"
=>
$v
,
"price_cn"
=>
$price_cn
[
$k
],
...
...
@@ -120,18 +127,19 @@ class ServerFoostoneModel
]);
}
foreach
(
$price_cn
as
$a
=>
$b
){
if
(
empty
(
$
v
))
continue
;
if
(
empty
(
$
b
))
continue
;
if
(
!
checkFloatInt
(
$b
,
5
,
2
))
return
[
1007
,
"国内含税价填写不对:"
.
$b
];
}
foreach
(
$purchases
as
$c
=>
$d
){
if
(
empty
(
$
v
))
continue
;
if
(
empty
(
$
d
))
continue
;
if
(
!
checkFloatInt
(
$d
,
5
,
2
))
return
[
1007
,
"国内含税价填写不对:"
.
$d
];
}
$tdata
[
'ladder_price'
]
=
$ladder_price
;
}
return
$this
->
push
(
'/yunxin/api/pool/sku/edit'
,
$tdata
,
$type
);
$res
=
$this
->
push
(
'/yunxin/api/pool/sku/edit'
,
$tdata
,
$type
);
return
[
$res
[
'code'
],
$res
[
'errmsg'
]];
}
...
...
public/pc/js/controller/GoodsComList.js
View file @
2dcb3ba5
...
...
@@ -178,11 +178,6 @@ function pureEditStock(goods_id,stock) {
layer
.
close
(
index
);
},
btn2
:
function
()
{
var
stock
=
$
(
"input[name='stock']"
).
val
()
if
(
!
num_int
.
test
(
stock
)){
alert_err
(
"库存必须是大于0的正整数"
)
return
false
;
}
alert_confirm
(
"你确定要修改库存吗?"
,
function
()
{
var
res
=
ajax_push2
(
"/api/ApiComSkuEdit"
,{
"goods_id"
:
$
(
"input[name='goods_id2']"
).
val
(),
...
...
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