作者 anyv
1 个管道 的构建 通过 耗费 0 秒

4

... ... @@ -113,12 +113,15 @@ class ShopcartController extends WeChatBaseController{
*/
public function shop_cart_pay(){
dump($_POST['myprice']);die;
$uid = cmf_get_current_user_id();
$cart_id = explode(',',$_POST['id']);
foreach ($cart_id as $key => $val){
$goods_id[] = Db::name('shopping_cart') -> where('id',$val) -> find();
}
foreach ($goods_id as $key => $val){
$data[] = Db::name('goods') -> where('id',$val['goods_id']) -> find();
$data[$key]['book_num'] = $goods_id[$key]['book_num'];
}
foreach ($data as $key => $val){
if($data[0]['type'] == $data[$key]['type']){
... ... @@ -126,6 +129,17 @@ class ShopcartController extends WeChatBaseController{
return false;
}
}
if($data[0]['type'] == 1){
$indent['uid'] = $uid;
$indent['state'] = 4;
$indent['order_number'] = date('Ymd').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);
$ret['type'] = 1;
return 1;
}elseif ($data[0]['type'] == 2){
return 2;
}
}
... ...
... ... @@ -58,7 +58,7 @@
<!-- 合计 -->
<div class="shop_carts2">
<span class="shop_cartsIco">合计:</span>
<p class="de_topTxt1_1 zoji"><span>0.00</span></p>
<p class="de_topTxt1_1 zoji"><span id="myprice">0.00</span></p>
</div>
<!-- 去支付 -->
... ... @@ -141,8 +141,13 @@
alert('不能为空');
}else{
goods_id = goods_id.join(',');
$.post("{:url('Shopcart/shop_cart_pay')}",{id:goods_id},function(data){
myprice = $('#myprice').text();
$.post("{:url('Shopcart/shop_cart_pay')}",{id:goods_id,myprice:myprice},function(data){
if(data){
}else{
alert('业务员商品和平台商品不能同时购买!');
}
});
window.location.href = "{:url('Orderpage/order_page')}";
}
... ...