切换导航条
此项目
正在载入...
登录
anyv
/
xkeasy
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
刘朕
5 years ago
提交
b3daa1230ba7584b6b090123d55404df6497fd63
1 个父辈
5e026e6d
1 个管道 的构建
通过
耗费 13 秒
购物车改为可输入购买商品数量
变更
3
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
41 行增加
和
5 行删除
app/portal/controller/ShopcartController.php
public/themes/simpleboot3/portal/shopcart/shop_cart.html
simplewind/cmf/controller/WeChatBaseController.php
app/portal/controller/ShopcartController.php
查看文件 @
b3daa12
...
...
@@ -81,6 +81,27 @@ class ShopcartController extends WeChatBaseController{
}
/**
* 商品数量修改
*/
public
function
shop_cart_numchange
(){
$id
=
$this
->
request
->
param
(
'id'
,
0
,
'intval'
);
$num
=
$this
->
request
->
param
(
'num'
,
0
,
'intval'
);
$data
=
Db
::
name
(
'shopping_cart'
)
->
where
(
'id'
,
$id
)
->
find
();
if
(
$data
[
'book_num'
]
!=
$num
){
if
(
$num
>
999
){
$this
->
error
(
'商品数量不能大于999'
);
}
$res
=
Db
::
name
(
'shopping_cart'
)
->
where
(
'id'
,
$id
)
->
update
([
'book_num'
=>
$num
]);
if
(
!
$res
)
{
$this
->
error
(
'购物车更新失败'
);
}
}
$this
->
success
(
'修改成功'
);
}
/**
* 商品数量加一
*/
public
function
shop_cart_numadd
(){
...
...
public/themes/simpleboot3/portal/shopcart/shop_cart.html
查看文件 @
b3daa12
...
...
@@ -40,7 +40,7 @@
<p
class=
"de_topTxt1_1"
>
¥
<span>
{$vo.price0}.{$vo.price1}
</span></p>
<div
class=
"order_newsNum"
>
<div
class=
"order_newsJian"
onclick=
"jian({$vo.carid})"
>
-
</div>
<input
class=
"order_newsnum"
type=
"text"
readonly=
"readonly"
value=
"{$vo.book_num}"
/>
<input
class=
"order_newsnum"
type=
"text"
value=
"{$vo.book_num}"
data-id=
"{$vo.carid}"
oninput=
"var v=this.value||'';v=v.replace(/[^\d]/g,'');if(v.length==1 && v==0){v=''};this.value=v.substr(0,3);"
/>
<div
class=
"order_newsJia"
onclick=
"jia({$vo.carid})"
>
+
</div>
</div>
</div>
...
...
@@ -222,6 +222,21 @@
$
(
".zoji span"
).
html
(
totalPrice
.
toFixed
(
2
));
}
$
(
function
()
{
// 输入框修改数量
$
(
'.order_newsnum'
).
change
(
function
()
{
var
id
=
$
(
this
).
data
(
'id'
);
var
num
=
$
(
this
).
val
();
if
(
num
>
999
)
{
alert
(
'商品数量不能大于999'
);
}
$
.
post
(
"{:url('Shopcart/shop_cart_numchange')}"
,{
id
:
id
,
num
:
num
},
function
(
data
){
if
(
data
.
code
==
1
)
{
calcTotal
();
}
else
{
alert
(
data
.
msg
);
}
});
});
$
(
".order_newsNum div"
).
on
(
"click"
,
function
(
evt
)
{
if
(
$
(
this
).
text
()
==
"-"
)
{
var
count
=
parseInt
(
$
(
this
).
next
().
val
());
...
...
simplewind/cmf/controller/WeChatBaseController.php
查看文件 @
b3daa12
...
...
@@ -208,10 +208,10 @@ class WeChatBaseController extends BaseController
$user
=
Db
::
name
(
'user'
)
->
where
(
'id'
,
6
)
->
find
();
cmf_update_current_user
(
$user
);
}
else
if
(
cmf_get_current_user_id
()
==
484
){
$user
=
Db
::
name
(
'user'
)
->
where
(
'id'
,
49
)
->
find
();
cmf_update_current_user
(
$user
);
}
// else if(cmf_get_current_user_id()==484){
// $user = Db::name('user')->where('id',49)->find();
// cmf_update_current_user($user);
// }
// if(cmf_get_current_user_id()==484){
// $user = Db::name('user')->where('id',6)->find();
// cmf_update_current_user($user);
...
...
请
注册
或
登录
后发表评论