<? $nav='pay';?>
<? if ($_POST['提交']=='确认下单'){
if ($key1 != '')
{ null_back($_POST[$key1],'请输入'.$keyname1.''); }
if ($key2 != '')
{ null_back($_POST[$key2],'请输入'.$keyname2.''); }
if ($key3 != '')
{ null_back($_POST[$key3],'请输入'.$keyname3.''); }
if ($key4 != '')
{ null_back($_POST[$key4],'请输入'.$keyname4.''); }
null_back($_POST['num'],'请输入下单数量');
if ($_POST['num']< $s_dnum)
{ alert_href('下单失败:数量不能低于'.$s_dnum.'!',''); }
if ($_POST['num']> $s_gnum)
{ alert_href('下单失败:数量不能高于'.$s_gnum.'!',''); }
//下单判断
if ($s_iscfxd==0)
{
$sel="select * from ".flag."order where key1 = '".$_POST[$key1]."' and zid = ".$zhu_id." and sid =".$_GET['id']." and zt != 6 and zt != 7 ";
$sl=@mysql_query($sel);
$s=@mysql_fetch_array($sl);
if (is_array($s))
{ alert_href('下单失败:您有未完成的订单正在处理!',''); }
}
$pay_price = $s_price*$_POST['num']; //实际购买价格
if ($member_point < $pay_price)
{ alert_href('下单失败:您的余额'.$member_point.'元不足以支付'.$pay_price.'元!',''); }
else
{
$xfhje = $member_point-$pay_price;
$_data['point'] = $xfhje;
// $_data['s_date'] = $sj;
$str = arrtoinsert($_data);
$sql = 'update '.flag.'user set '.arrtoupdate($_data).' where id = '.$member_id.'';
if(mysql_query($sql)){
//消费记录
$_data1['hyid'] = $member_id;
$_data1['hyname'] = $member_name;
$_data1['xf_qje'] = $member_point;
$_data1['xf_je'] = $pay_price;
$_data1['xf_hje'] = $xfhje;
$_data1['xf_date'] = $sj;
$_data1['xf_qk'] ='购买商品:'.$s_name.'';
$_data1['xf_lx'] =0; //0扣除 -增加
$_data1['zid'] =$zhu_id; //
if ($zhu=='true')
{ $_data1['fid'] =0; }
else
{ $_data1['fid'] =$fen_id; }
$str1 = arrtoinsert($_data1);
$sql1 = 'insert into '.flag.'xfjl ('.$str1[0].') values ('.$str1[1].')';
mysql_query($sql1);
$danhao = date('Ymd') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);
if ($pingtai == 1)
{require_once('duijie/zhu.php');}
if ( $pingtai == 2)
{require_once('duijie/yile.php');}
if ( $pingtai == 3)
{require_once('duijie/95.php');}
if ( $pingtai == 4)
{require_once('duijie/yile3.php');}
//订单记录
$_data2['dingdanhao'] = $danhao;
$_data2['sid'] = $_GET['id'];
$_data2['sname'] = $s_name;
$_data2['hyid'] = $member_id;
$_data2['hyname'] = $member_name;
if ($keyname1!=''){ $_data2['keyname1'] = $keyname1; }
if ($keyname2!=''){ $_data2['keyname2'] =$keyname2; }
if ($keyname3!=''){ $_data2['keyname3'] = $$keyname3; }
if ($keyname4!=''){ $_data2['keyname4'] = $keyname4; }
$_data2['key1'] = $_POST[$key1];
$_data2['key2'] = $_POST[$key2];
$_data2['key3'] = $_POST[$key3];
$_data2['key4'] = $_POST[$key4];
$_data2['csnum'] = 0;
$_data2['num'] = $_POST['num'];
$_data2['dqnum'] = 0;
$_data2['price'] = $pay_price;
$_data2['zt'] = get_shopzt($_GET['id']);
$_data2['duijiezt'] = $s_duijiezt;
$_data2['date'] =$sj;
$_data2['zid'] =$zhu_id;
if ($zhu=='true')
{ $_data2['fid'] =0; }
else
{ $_data2['fid'] =$fen_id; }
$str2 = arrtoinsert($_data2);
$sql2 = 'insert into '.flag.'order ('.$str2[0].') values ('.$str2[1].')';
mysql_query($sql2);
if ($fen=='true')
{//分站增加收入
$chajia =$jprice*$_POST['num'];
$_fenzhanshouru['point'] = $site_point +$chajia;
$fenzhanshourusql = 'update '.flag.'fenzhan set '.arrtoupdate($_fenzhanshouru).' where ID = '.$fen_id.'';
mysql_query($fenzhanshourusql);
//分站资金积累
$_fenzhanzjjl['zid'] = $zhu_id;
$_fenzhanzjjl['fid'] = $fen_id;
$_fenzhanzjjl['qje'] = $site_point;
$_fenzhanzjjl['je'] = $chajia;
$_fenzhanzjjl['hje'] = $site_point+$chajia;
$_fenzhanzjjl['date'] = $sj;
$_fenzhanzjjl['lx'] = 1;
$_fenzhanzjjl['desc'] ='售出商品:'.$s_name;
$fenzhanzjjl = arrtoinsert($_fenzhanzjjl);
$fenzhanzjjlsql = 'insert into '.flag.'fenzhanpricejl ('.$fenzhanzjjl[0].') values ('.$fenzhanzjjl[1].')';
mysql_query($fenzhanzjjlsql);
}
alert_href('下单成功!','');
}
else
{ alert_href('下单失败!',''); }
}
}
//申请补单
if($_GET['act']=='bd'){
$_data['zt'] = 8;
$str = arrtoinsert($_data);
$sql = 'update '.flag.'order set '.arrtoupdate($_data).' where id = '.$_GET['oid'].' and zid = '.$zhu_id.'';
if(mysql_query($sql)){
alert_href('申请成功,等待处理!','/index/home/order/id/'.$_GET['id'].'.html');
}else{
alert_back('申请补单失败!');
}
}
//申请退款
if($_GET['act']=='tk'){
$_data['zt'] = 9;
$str = arrtoinsert($_data);
$sql = 'update '.flag.'order set '.arrtoupdate($_data).' where id = '.$_GET['oid'].' and zid = '.$zhu_id.'';
if(mysql_query($sql)){
alert_href('申请成功,等待处理!','/index/home/order/id/'.$_GET['id'].'.html');
}else{
alert_back('申请退款失败!');
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?=$s_name?>-<?=$site_name?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="<?=$site_ico?>" type="image/x-icon" />
<!-- Bootstrap core CSS -->
<link href="/template/index/01/assets/style/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
<link href="/template/index/01/assets/style/font-awesome_4.6.3/css/font-awesome.min.css" rel="stylesheet">
<!-- ionicons -->
<link href="/template/index/01/assets/style/css/ionicons.min.css" rel="stylesheet">
<!-- Morris -->
<link href="/template/index/01/assets/style/css/morris.css" rel="stylesheet"/>
<!-- Datepicker -->
<link href="/template/index/01/assets/style/css/datepicker.css" rel="stylesheet"/>
<!-- Animate -->
<link href="/template/index/01/assets/style/css/animate.min.css" rel="stylesheet">
<!-- Owl Carousel -->
<link href="/template/index/01/assets/style/css/owl.carousel.min.css" rel="stylesheet">
<link href="/template/index/01/assets/style/css/owl.theme.default.min.css" rel="stylesheet">
<!-- Simplify -->
<link href="/template/index/01/assets/style/css/simplify.min.css" rel="stylesheet">
<link href="/template/index/01/assets/common/bootstrap-switch/css/bootstrap3/bootstrap-switch.min.css"
rel="stylesheet">
<link rel="stylesheet" href="/template/index/01/assets/common/toastr/toastr.min.css">
<!-- Jquery -->
<script src="/template/index/01/assets/style/js/jquery-1.11.1.min.js"></script>
<style>
th {
text-align: center;
}
td {
text-align: center;
}
</style>
<script type="text/javascript">
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
</script>
</head>
<body class="overflow" >
<div class="wrapper ">
<? require_once('m_head.php');?>
<? require_once('m_left.php');?>
<div class="main-container">
<div class="padding-md" id="pjax-container">
<style>
@media (min-width: 768px) {
.order_div_height {
min-height: 330px;
}
}
.table-bordered th{font-size:13px;}
.table-bordered td{font-size:13px;}
</style>
<div class="alert alert-success alert-custom ">
<?=$s_content?></div>
<div class="row">
<div class="col-lg-3">
<div class="smart-widget widget-blue order_div_height">
<div class="smart-widget-header">
<?=$s_name?> <span class="smart-widget-option">
<span class="refresh-icon-animated">
<i class="fa fa-circle-o-notch fa-spin"></i>
</span>
<a href="#" class="widget-toggle-hidden-option">
<i class="fa fa-cog"></i>
评论0