正在显示
2 个修改的文件
包含
45 行增加
和
2 行删除
@@ -79,7 +79,33 @@ class ShopcartController extends WeChatBaseController{ | @@ -79,7 +79,33 @@ class ShopcartController extends WeChatBaseController{ | ||
79 | 79 | ||
80 | } | 80 | } |
81 | 81 | ||
82 | + /** | ||
83 | + * 商品数量加一 | ||
84 | + */ | ||
85 | + public function shop_cart_numadd(){ | ||
86 | + | ||
87 | + $id = $_POST['id']; | ||
88 | + $data = Db::name('shopping_cart') -> where('id',$id) -> find(); | ||
89 | + if($data['book_num']<200){ | ||
90 | + Db::name('shopping_cart') -> where('id',$id) -> setInc('book_num'); | ||
91 | + } | ||
92 | + return true; | ||
93 | + | ||
94 | + } | ||
82 | 95 | ||
96 | + /** | ||
97 | + * 商品数量减一 | ||
98 | + */ | ||
99 | + public function shop_cart_numdec(){ | ||
100 | + | ||
101 | + $id = $_POST['id']; | ||
102 | + $data = Db::name('shopping_cart') -> where('id',$id) -> find(); | ||
103 | + if($data['book_num']>1){ | ||
104 | + Db::name('shopping_cart') -> where('id',$id) -> setDec('book_num'); | ||
105 | + } | ||
106 | + return true; | ||
107 | + | ||
108 | + } | ||
83 | 109 | ||
84 | 110 | ||
85 | 111 |
@@ -37,9 +37,9 @@ | @@ -37,9 +37,9 @@ | ||
37 | <div class="order_newsTxt3"> | 37 | <div class="order_newsTxt3"> |
38 | <p class="de_topTxt1_1">¥<span>{$vo.price0}</span>.{$vo.price1}</p> | 38 | <p class="de_topTxt1_1">¥<span>{$vo.price0}</span>.{$vo.price1}</p> |
39 | <div class="order_newsNum"> | 39 | <div class="order_newsNum"> |
40 | - <div class="order_newsJian">-</div> | 40 | + <div class="order_newsJian" onclick="jia({$vo.carid})">-</div> |
41 | <input class="order_newsnum" type="text" readonly="readonly" value="1" /> | 41 | <input class="order_newsnum" type="text" readonly="readonly" value="1" /> |
42 | - <div class="order_newsJia">+</div> | 42 | + <div class="order_newsJia" onclick="jian({$vo.carid})">+</div> |
43 | </div> | 43 | </div> |
44 | </div> | 44 | </div> |
45 | </div> | 45 | </div> |
@@ -146,6 +146,23 @@ | @@ -146,6 +146,23 @@ | ||
146 | 146 | ||
147 | } | 147 | } |
148 | 148 | ||
149 | + /** | ||
150 | + *点击加一 | ||
151 | + */ | ||
152 | + function jia(id){ | ||
153 | + $.post("{:url('Shopcart/shop_cart_numadd')}",{id:id},function(data){ | ||
154 | + }); | ||
155 | + } | ||
156 | + | ||
157 | + /** | ||
158 | + * 点击减一 | ||
159 | + */ | ||
160 | + function jian(id){ | ||
161 | + $.post("{:url('Shopcart/shop_cart_numdec')}",{id:id},function(data){ | ||
162 | + | ||
163 | + }); | ||
164 | + } | ||
165 | + | ||
149 | // 计算总计 | 166 | // 计算总计 |
150 | function calcTotal() { | 167 | function calcTotal() { |
151 | var checkBoxes = $(".sh_cartround img"); | 168 | var checkBoxes = $(".sh_cartround img"); |
-
请 注册 或 登录 后发表评论