正在显示
2 个修改的文件
包含
21 行增加
和
2 行删除
@@ -113,12 +113,15 @@ class ShopcartController extends WeChatBaseController{ | @@ -113,12 +113,15 @@ class ShopcartController extends WeChatBaseController{ | ||
113 | */ | 113 | */ |
114 | public function shop_cart_pay(){ | 114 | public function shop_cart_pay(){ |
115 | 115 | ||
116 | + dump($_POST['myprice']);die; | ||
117 | + $uid = cmf_get_current_user_id(); | ||
116 | $cart_id = explode(',',$_POST['id']); | 118 | $cart_id = explode(',',$_POST['id']); |
117 | foreach ($cart_id as $key => $val){ | 119 | foreach ($cart_id as $key => $val){ |
118 | $goods_id[] = Db::name('shopping_cart') -> where('id',$val) -> find(); | 120 | $goods_id[] = Db::name('shopping_cart') -> where('id',$val) -> find(); |
119 | } | 121 | } |
120 | foreach ($goods_id as $key => $val){ | 122 | foreach ($goods_id as $key => $val){ |
121 | $data[] = Db::name('goods') -> where('id',$val['goods_id']) -> find(); | 123 | $data[] = Db::name('goods') -> where('id',$val['goods_id']) -> find(); |
124 | + $data[$key]['book_num'] = $goods_id[$key]['book_num']; | ||
122 | } | 125 | } |
123 | foreach ($data as $key => $val){ | 126 | foreach ($data as $key => $val){ |
124 | if($data[0]['type'] == $data[$key]['type']){ | 127 | if($data[0]['type'] == $data[$key]['type']){ |
@@ -126,6 +129,17 @@ class ShopcartController extends WeChatBaseController{ | @@ -126,6 +129,17 @@ class ShopcartController extends WeChatBaseController{ | ||
126 | return false; | 129 | return false; |
127 | } | 130 | } |
128 | } | 131 | } |
132 | + if($data[0]['type'] == 1){ | ||
133 | + | ||
134 | + $indent['uid'] = $uid; | ||
135 | + $indent['state'] = 4; | ||
136 | + $indent['order_number'] = date('Ymd').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8); | ||
137 | + | ||
138 | + $ret['type'] = 1; | ||
139 | + return 1; | ||
140 | + }elseif ($data[0]['type'] == 2){ | ||
141 | + return 2; | ||
142 | + } | ||
129 | 143 | ||
130 | } | 144 | } |
131 | 145 |
@@ -58,7 +58,7 @@ | @@ -58,7 +58,7 @@ | ||
58 | <!-- 合计 --> | 58 | <!-- 合计 --> |
59 | <div class="shop_carts2"> | 59 | <div class="shop_carts2"> |
60 | <span class="shop_cartsIco">合计:</span> | 60 | <span class="shop_cartsIco">合计:</span> |
61 | - <p class="de_topTxt1_1 zoji">¥<span>0.00</span></p> | 61 | + <p class="de_topTxt1_1 zoji">¥<span id="myprice">0.00</span></p> |
62 | </div> | 62 | </div> |
63 | <!-- 去支付 --> | 63 | <!-- 去支付 --> |
64 | 64 | ||
@@ -141,8 +141,13 @@ | @@ -141,8 +141,13 @@ | ||
141 | alert('不能为空'); | 141 | alert('不能为空'); |
142 | }else{ | 142 | }else{ |
143 | goods_id = goods_id.join(','); | 143 | goods_id = goods_id.join(','); |
144 | - $.post("{:url('Shopcart/shop_cart_pay')}",{id:goods_id},function(data){ | 144 | + myprice = $('#myprice').text(); |
145 | + $.post("{:url('Shopcart/shop_cart_pay')}",{id:goods_id,myprice:myprice},function(data){ | ||
146 | + if(data){ | ||
145 | 147 | ||
148 | + }else{ | ||
149 | + alert('业务员商品和平台商品不能同时购买!'); | ||
150 | + } | ||
146 | }); | 151 | }); |
147 | window.location.href = "{:url('Orderpage/order_page')}"; | 152 | window.location.href = "{:url('Orderpage/order_page')}"; |
148 | } | 153 | } |
-
请 注册 或 登录 后发表评论