Commit a5eb8753 by 冷斌

fix bug

parent 9af803c8
...@@ -12,14 +12,17 @@ ...@@ -12,14 +12,17 @@
<select name="province" id="province"> <select name="province" id="province">
<option value="">请选择省</option> <option value="">请选择省</option>
<volist name="province" id="vo"> <volist name="province" id="vo">
<option value="{$vo.id}">{$vo.name}</option> <option value="{$vo.id}" <eq name="vo.id" value="$pid">selected</eq> >{$vo.name}</option>
</volist> </volist>
</select> </select>
<select name="city" id="city"> <select name="city" id="city">
<option value="">请选择市</option> <option value="">请选择市</option>
<volist name="dArea" id="co">
<option value="{$co.id}" <eq name="co.id" value="$cid">selected</eq> >{$co.name}</option>
</volist>
</select> </select>
<input type="text" name="meet" placeholder="满足"> <input type="text" value="{$dredge['meet']}" name="meet" placeholder="满足">
<input type="text" name="reduce" placeholder="减少"> <input type="text" value="{$dredge['reduce']}" name="reduce" placeholder="减少">
</div> </div>
</div> </div>
<br/> <br/>
......
...@@ -46,7 +46,10 @@ ...@@ -46,7 +46,10 @@
<td>{$vo.meet} </td> <td>{$vo.meet} </td>
<td>{$vo.reduce}</td> <td>{$vo.reduce}</td>
<td><a href="{:U('AuthManager/index?city='.$vo['id'])}">{$vo.city_name}</a></td> <td><a href="{:U('AuthManager/index?city='.$vo['id'])}">{$vo.city_name}</a></td>
<td><a href="javascript:del({$vo.id})" class="" >删除</a></td> <td>
<a href="{:U('other/dredgeAdd?id='.$vo['id'])}">编辑</a>
<a href="javascript:del({$vo.id})" class="" >删除</a>
</td>
</tr> </tr>
</volist> </volist>
<else/> <else/>
......
...@@ -180,7 +180,7 @@ class ApiIndentController extends Controller ...@@ -180,7 +180,7 @@ class ApiIndentController extends Controller
$userInfo=$user->where('id='.$_GET['uid'])->field('is_shop, is_vip')->find(); $userInfo=$user->where('id='.$_GET['uid'])->field('is_shop, is_vip')->find();
$goods=M('goods'); $goods=M('goods');
$dredge = M('dredge')->where('id='.$_GET['cityId'])->field('meet, reduce')->find();
if(isset($_GET['sum'])||!empty($_GET['sum'])){//存在商品数量执行快速购买 if(isset($_GET['sum'])||!empty($_GET['sum'])){//存在商品数量执行快速购买
$list1=$goods->where('yi_goods.id='.$_GET['gid']) $list1=$goods->where('yi_goods.id='.$_GET['gid'])
->field('yi_goods.id,title,z_img,goods_model,price,suggest_price, vip_price, favorable,meet,reduce,quota,k_quota,dist_quota') ->field('yi_goods.id,title,z_img,goods_model,price,suggest_price, vip_price, favorable,meet,reduce,quota,k_quota,dist_quota')
...@@ -211,8 +211,11 @@ class ApiIndentController extends Controller ...@@ -211,8 +211,11 @@ class ApiIndentController extends Controller
$mo=floor($list1['sum']/$list1['meet']); $mo=floor($list1['sum']/$list1['meet']);
$list1['explain']=$list1['reduce']*$mo; $list1['explain']=$list1['reduce']*$mo;
} }
// // 城市满减
// if ($dredge['meet'] > 0) {
// $mo2 = floor($list1['sum']/$dredge['meet']);
// $list1['explain']+=$dredge['reduce']*$mo2;
// }
unset($list1['suggest_price']);//去除推荐价格 unset($list1['suggest_price']);//去除推荐价格
unset($list1['meet']); unset($list1['meet']);
unset($list1['reduce']); unset($list1['reduce']);
...@@ -259,6 +262,11 @@ class ApiIndentController extends Controller ...@@ -259,6 +262,11 @@ class ApiIndentController extends Controller
$mo=floor($rows['sum']/$rows['meet']); $mo=floor($rows['sum']/$rows['meet']);
$rows['explain']=$rows['reduce']*$mo; $rows['explain']=$rows['reduce']*$mo;
} }
// // 城市满减
// if ($dredge['meet'] > 0) {
// $mo2 = floor($rows['sum']/$dredge['meet']);
// $rows['explain']+=$dredge['reduce']*$mo2;
// }
unset($rows['suggest_price']);//去除推荐价格 unset($rows['suggest_price']);//去除推荐价格
unset($rows['meet']); unset($rows['meet']);
unset($rows['reduce']); unset($rows['reduce']);
...@@ -273,6 +281,12 @@ class ApiIndentController extends Controller ...@@ -273,6 +281,12 @@ class ApiIndentController extends Controller
foreach($list as $key=>$v){ foreach($list as $key=>$v){
$z_price+=$v['z_price'];//计算商品总价 $z_price+=$v['z_price'];//计算商品总价
} }
// // 城市满减
// if ($dredge['meet'] > 0) {
// $mo2 = floor($list1['sum']/$dredge['meet']);
// $list1['explain']+=$dredge['reduce']*$mo2;
// }
if($z_price>=$sat['satisfy']){ if($z_price>=$sat['satisfy']){
$new_list['is_coup']=false;//满足优惠要求 $new_list['is_coup']=false;//满足优惠要求
}else{ }else{
......
...@@ -64,8 +64,28 @@ class ApiShopCartController extends Controller ...@@ -64,8 +64,28 @@ class ApiShopCartController extends Controller
if(!isset($_GET['uid'])||empty($_GET['uid'])){echo json2(401,'用户id=NUll','error');die;} if(!isset($_GET['uid'])||empty($_GET['uid'])){echo json2(401,'用户id=NUll','error');die;}
if(!isset($_GET['cityId'])||empty($_GET['cityId'])){echo json2(403,'城市id=NUll','error');die;} if(!isset($_GET['cityId'])||empty($_GET['cityId'])){echo json2(403,'城市id=NUll','error');die;}
$ShopCart=M('shopCart'); $ShopCart=M('shopCart');
$isVip = $isShop = 0;
if(isset($_GET['uid'])){
$user=M('user');
$user_info=$user->where('id='.$_GET['uid'])->field('is_shop,is_vip')->find();
$isVip = $user_info['is_vip'];
$isShop = $user_info['is_shop'];
}
// 价格查询
if ($isVip) {
$field = 'yi_shop_cart.*,z_img,title,yi_g_price.vip_price as price, yi_g_price.vip_price as suggest_price,quota,k_quota,dist_quota,yi_goods.stan g_stan';
} else {
if ($isShop) {
$field = 'yi_shop_cart.*,z_img,title,yi_g_price.suggest_price as price,yi_g_price.suggest_price,quota,k_quota,dist_quota,yi_goods.stan g_stan';
} else {
$field = 'yi_shop_cart.*,z_img,title,yi_g_price.price,yi_g_price.price as suggest_price,quota,k_quota,dist_quota,yi_goods.stan g_stan';
}
}
$list=$ShopCart->where('uid='.$_GET['uid']) $list=$ShopCart->where('uid='.$_GET['uid'])
->field('yi_shop_cart.*,z_img,title,yi_g_price.price,suggest_price,quota,k_quota,dist_quota,yi_goods.stan g_stan') // ->field('yi_shop_cart.*,z_img,title,yi_g_price.price,suggest_price,quota,k_quota,dist_quota,yi_goods.stan g_stan')
->field($field)
->join('yi_goods on yi_shop_cart.gid=yi_goods.id') ->join('yi_goods on yi_shop_cart.gid=yi_goods.id')
->join('yi_g_price on '.$_GET['cityId'].'=yi_g_price.city_id and yi_g_price.goods_id=yi_shop_cart.gid') ->join('yi_g_price on '.$_GET['cityId'].'=yi_g_price.city_id and yi_g_price.goods_id=yi_shop_cart.gid')
->order('yi_goods.id desc')->select(); ->order('yi_goods.id desc')->select();
...@@ -93,4 +113,4 @@ class ApiShopCartController extends Controller ...@@ -93,4 +113,4 @@ class ApiShopCartController extends Controller
echo json2(400,'修改失败!请稍后在试!','error'); echo json2(400,'修改失败!请稍后在试!','error');
} }
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment