查看文件: index_orderinfo.php
大小: 24.3 KB
类型: application/octet-stream
<?php require_once('./Connections/BE2.php'); ?> <?php if (!isset($_SESSION)){ session_start(); } if(! isset($_SESSION['login_memid']) || $_SESSION['login_memid']==""){ ?> <script>alert('請記的先登入');location.href = '/';</script> <? exit; } ?> <? $buynow=''; $order_moneyALL= 0; $order_express= 0 ; //isset($_POST['order_express'])?$_POST['order_express']:0; $pay_money= 0; $pay_money=0; $company_count=0; if( isset($_POST['pay_money']) && $_POST['pay_money']>0){ mysql_select_db($database_BE2, $BE2); //cexpdiff_ $empt1= sprintf("delete from tmporder1 where sess='%s'",session_id()); mysql_query($empt1, $BE2) or die(mysql_error()); // $logpath="/www2/skybni/log110.txt"; // $fp = fopen($logpath, "a"); // foreach($_POST as $key=>$value){ // echo "$key=$value"; // fwrite($fp,"$key=$value"."\r\n"); // } $com_arr=array(); $comcount= isset($_POST['comcount'])?$_POST['comcount']:0; for($i=1;$i<=$comcount;$i++){ if((isset($_POST['cta_'.$i]))&&( $_POST['cta_'.$i]>0)){ $com_arr[]=$_POST['ccidm_'.$i]; if(isset($_POST['ccid'.$i])){ // ccid if (is_array($_POST['ccid'.$i])) { foreach($_POST['ccid'.$i] as $value){ mysql_select_db($database_BE2, $BE2); //cexpdiff_ $inst1= sprintf("INSERT INTO tmporder1(coid,mid,mexp,mexpkid,sess)VALUES('%s','%s','%s','%s','%s')",$_POST['ccidm_'.$i],$value,$_POST['cexpdiff_'.$i],'1',session_id()); //fwrite($fp,$inst1."\r\n"); mysql_query($inst1, $BE2) or die(mysql_error()); } } } //if ccid }//if cta_1 >0 } //for // fclose($fp); $buynow='N'; } // else{ exit ;} //商品 order_moneyALL 運費 order_express 結帳總金 pay_money $colname_Rt2 = session_id() ;// $_SESSION['login_memid']; //SELECT * FROM product_data WHERE mem_auto='%s' mysql_select_db($database_BE2, $BE2); $query_Rt2 = sprintf("SELECT a.*,b.p_title,b.p_new,b.company_num,b.meta_img,b.p_tag,c.company_title,c.com_express,c.com_express_max,d.mexp FROM order_tmp as a,product_data as b,company as c,tmporder1 as d WHERE a.mem_auto=b.mem_auto AND b.company_num=c.coid AND a.p_sess= '1' AND a.ccid=d.mid AND d.sess='%s' ORDER BY a.ccid DESC",$colname_Rt2); $Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); $totalRows_Rt2 = mysql_num_rows($Rt2); //echo $query_Rt2; mysql_select_db($database_BE2, $BE2); //$query_Rtn = sprintf("SELECT a.*,b.* FROM member as a,address as b WHERE a.mem_auto='%s' AND a.mem_address=b.address_id",$_SESSION['login_memid']); $query_Rtn = sprintf("SELECT * FROM member WHERE mem_auto='%s' ",$_SESSION['login_memid']); $Rtn = mysql_query($query_Rtn, $BE2) or die(mysql_error()); $row_Rtn = mysql_fetch_assoc($Rtn); $address=$row_Rtn['mem_google'];//$row_Rtn['county'].$row_Rtn['district'].$row_Rtn['street'].$row_Rtn['mem_address2']."號"; //if ($row_Rtn['mem_address3']<>""){ // $address .= $row_Rtn['mem_address3']."樓"; // } if(! isset($com_arr[0])) { $com_arr=array(); $query_Rtf = sprintf("SELECT b.* FROM tmporder1 as a,order_tmp as b WHERE a.mid=b.ccid AND a.sess='%s'",$colname_Rt2); mysql_select_db($database_BE2, $BE2); $Rtf = mysql_query($query_Rtf, $BE2) or die(mysql_error()); $row_Rtf = mysql_fetch_assoc($Rtf); $totalRows_Rtf = mysql_num_rows($Rtf); if($totalRows_Rtf>0){ $buynow='Y' ; $com_arr[0]=$row_Rtf['coid']; $order_moneyALL= 0; $order_express= 0 ; //isset($_POST['order_express'])?$_POST['order_express']:0; $pay_money= 0; } mysql_free_result($Rtf); } mysql_select_db($database_BE2, $BE2); $query_Rtc = sprintf("SELECT * FROM company WHERE coid='%s' ",$com_arr[0]); $Rtc = mysql_query($query_Rtc, $BE2) or die(mysql_error()); $row_Rtc = mysql_fetch_assoc($Rtc); $expess=array(); $expess[0]=$row_Rtc['com_express']; $expess[1]=$row_Rtc['com_express_max']; $expess[2]=$row_Rtc['com_express_shop']; $expess[3]=$row_Rtc['com_express_local']; mysql_free_result($Rtc); mysql_select_db($database_BE2, $BE2); $q_Rtp = sprintf("SELECT sum(e_ival)-sum(e_oval) as sk_point FROM order_point WHERE euid='%s' group by euid ",$_SESSION['login_memid']); $Rtp = mysql_query($q_Rtp, $BE2) or die(mysql_error()); $row_Rtp = mysql_fetch_assoc($Rtp); $skybni_point=$row_Rtp['sk_point']; mysql_free_result($Rtp); //if($_SERVER["REMOTE_ADDR"]=="220.130.43.118"){ echo $query_Rt2."<br>";} ?> <? if($totalRows_Rt2>0){ ?> <div class="container g-pt-80 g-pb-70"> <div class="g-overflow-x-scroll g-overflow-x-visible--lg"> <table class="text-center w-100"> <thead class="g-brd-bottom g-brd-gray-light-v3 g-color-black text-uppercase"> <tr> <th width="60"></th> <th width="108" class="g-font-weight-400 text-left g-pb-20">商品</th> <th width="92" class="g-font-weight-400 g-width-130 g-pb-20">價格</th> <th width="38" class="g-font-weight-400 g-width-50 g-pb-20">數量</th> <th width="38" class="g-font-weight-400 g-width-130 g-pb-20">總計</th> <th width="1"></th> </tr> </thead> <tbody> <?php $p1=0; $p2=0; //sum $order_express=0; $coid=0; //tab $coid_count=0; $stotal=0; $coid_total=$totalRows_Rt2; do { if($order_express==0){ $order_express= $row_Rt2['p_express']; } ?> <? if($row_Rt2['coid']<>$coid){ ?> <? if($coid>0){ ?> <tr class="g-brd-bottom g-brd-gray-light-v3"> <td colspan="6" class= "text-right" ><div id="ctol_<?= $coid_count?>"><?= '金額 : '.$stotal ?></div></td> </tr> <? $stotal=0; }?> <? $coid_count++; ?> <tr class="g-brd-bottom g-brd-gray-light-v3"> <td colspan="6" class="text-left" > 店舖: <?= $row_Rt2['company_title']?> /本次店鋪運費 $<?= $row_Rt2['com_express'] ?> </td> </tr> <? $coid=$row_Rt2['coid']; } ?> <tr class="g-brd-bottom g-brd-gray-light-v3"> <td colspan="2" class="g-color-gray-dark-v2 g-font-size-16 text-left"> <? $imagepath = "/admin/upload_image/".$row_Rt2['meta_img']; if($row_Rt2['p_new']==1){ $imagepath = "/admin/upload2_image/".sprintf("%07d",$row_Rt2['company_num']).'/'.$row_Rt2['meta_img'].'.'.$row_Rt2['p_tag']; } ?><a href="categoryDetail-<?= $row_Rt2['mem_auto'] ?>.html" target="_self"><img class="d-inline-block g-width-60 mr-4" src="<?= $imagepath;?>" alt="<?= $row_Rt2['p_title'];?>"></a> <?= $row_Rt2['p_title'];?> </td> <td class="g-color-gray-dark-v2 g-font-size-16"><?= $row_Rt2['p_money']?> </td> <td><?= $row_Rt2['p_count'] ?> </td> <td class="g-color-gray-dark-v2 g-font-size-16"><? $p1=$row_Rt2['p_count']*$row_Rt2['p_money']; $p2+=$p1; $stotal=$stotal+$p1; ?> <div id="cth_<?= $row_Rt2['ccid'] ?>"><?= $p1;?></div></td> <td class="g-color-gray-dark-v2 g-font-size-16"> </td> </tr> <?php } while ($row_Rt2 = mysql_fetch_assoc($Rt2)); ?> <tr class="g-brd-bottom g-brd-gray-light-v3"> <td colspan="6" class= "text-right" ><div class="col-md-4"> 免運金額:$<?= $expess[1]?> </div><div id="ctol_<?= $coid_count?>"><?= '金額 :$ '.$stotal ?></div> </td> </tr> </tbody> </table> </div> <form action="/ordercar.html" method="post" name="form1" onsubmit="return form1check(this.form);"> <? //$expess[0]=$row_Rtc['com_express']; //$expess[1]=$row_Rtc['com_express_max']; //商品 order_moneyALL 運費 order_express 結帳總金 pay_money if( $buynow=='N'){ $order_moneyALL=isset($_POST['order_moneyALL'])?$_POST['order_moneyALL']:0; $order_express= ($order_moneyALL>$expess[1])?0:$expess[0]; //isset($_POST['order_express'])?$_POST['order_express']:0; $pay_money=isset($_POST['pay_money'])?$_POST['pay_money']:0; $pay_money=$pay_money+ $order_express; $company_count=isset($_POST['company_count'])?$_POST['company_count']:0; }else if( $buynow=='Y'){ $order_moneyALL=$p2; $pay_money=$p2; } ?> <input name="order_moneyALL" id="order_moneyALL" type="hidden" value="<?= $order_moneyALL ?>"> <table class="table table-bordered g-mt-20"> <tr> <td width="217"> <div class="row"> <div class="col-md-3"> <div id="ov1" style="color="#336633">商品總金額:$<?= $order_moneyALL ?></div> </div> <div class="col-md-2"> <div id="ov2" style="color="#336633">運費:$<?= $order_express ?></div> <input name="order_express" id="order_express" type="hidden" value="<?= $order_express ?>"> </div> <div class="col-md-3"> <? /* //$expess[0]=$row_Rtc['com_express']; $expess[1]=$row_Rtc['com_express_max']; $expess[2]=$row_Rtc['com_express_shop']; $expess[3]=$row_Rtc['com_express_local']; */ ?> <input name="expmax" id="expmax" type="hidden" value="<?= $expess[1]?>" > <input name="exp1" id="exp1" type="hidden" value="<?= $expess[0]?>" > <input name="exp2" id="exp2" type="hidden" value="<?= $expess[2]?>" > <input name="exp3" id="exp3" type="hidden" value="0" size="2" > <input name="pay_money" id="pay_money" type="hidden" value="<?= $pay_money?>"> <div id="ov3" style="color='#336633'">結帳總金額:$<?= $pay_money ?></div> </div> <div class="col-md-3"> <? $select=true; if($company_count>1){ $select=false;}?> <input name="p_moneyKind" id="p_moneyKind" type="hidden" value="1"> <? /* <label class="g-font-size-14">取貨 : </label> <select class="custom-select mr-sm-3 mb-3 mb-lg-0" name="p_moneyKind" id="p_moneyKind" onchange="set_expess(this);" > <option value="1" selected>宅配</option> <option value="2" >超商取貨</option> <? if($expess[3]=='Y'){?> <option value="3" >到店取貨</option> <? } ?></select> */ ?> <input name="company_count" id="company_count" type="hidden" value="<?= $company_count?>"> </div> </div> </td> </tr> </table> <input name="skybni_point" id="skybni_point" type="hidden" value="<?= $skybni_point ?>"> <div class="row"> <div class="col-md-3"> <div style="color="#336633">可使用雲點 :<?= $skybni_point ?> </div> </div> <div class="col-md-5"> <div id="ov2" style="color="#336633">雲點數支付:<input name="pay_skybni" id="pay_skybni" type="text" value="0" size="4" <? if($skybni_point>0){?> onchange="pay_point();" <? }else{?> readonly="readonly" <? }?>></div> </div> </div> <table class="table table-bordered g-mt-20"> <tr> <td><font size="3" color="#000">購買人資料</font></td> </tr> <tr> <td> <div class="row"> <div class="col-md-3"> <label>姓名</label> <input name="mem_name" id="mem_name" type="text" class="form-control" value="<?= $row_Rtn['mem_name'] ?>" required> </div> <div class="col-md-3"> <label>手機</label> <input name="mem_mobile" id="mem_mobile" type="text" class="form-control" value="<?= $row_Rtn['mem_mobile'] ?>" required> </div> <div class="col-md-6"> <label>信箱</label> <input name="mem_mail" id="mem_mail" type="text" class="form-control" value="<?= $row_Rtn['mem_mail'] ?>" required> </div> <div class="col-md-12"> <label>地址</label> <input name="mem_address" id="mem_address" type="text" class="form-control" value="<?= $address ?>" required> </div> </div> </td> </tr> <tr> <td><font size="3" color="#000" class="g-mr-20">收件人資料</font> <label><input type="checkbox" name="s1" value="1" onChange="checkall()"><i></i> 同<font size="3" color="#000">購買人</font>資料</label></td> </tr> <tr> <td> <div class="row"> <div class="col-md-3"> <label>姓名</label> <input name="mem_name2" id="mem_name2" type="text" class="form-control" required> </div> <div class="col-md-3"> <label>手機</label> <input name="mem_mobile2" id="mem_mobile2" type="text" class="form-control" required> </div> <div class="col-md-6"> <label>信箱</label> <input name="mem_mail2" id="mem_mail2" type="text" class="form-control" required> </div> <div class="col-md-12"> <label>地址</label> <input name="mem_address2" id="mem_address2" type="text" class="form-control" required> </div> </div> </td> </tr> <tr> <td> <? /* <div class="row"> <div class="form-group col-md-12"> <label class="col-md-3 control-label" >發票資料</label> <div class="col-md-4"> <label class="radio"><input type="radio" name="order_invoice" value="二聯式" onClick="javascript:showfp2()" > B2B公司</label> </div> <div class="col-md-4"> <label class="radio"><input type="radio" name="order_invoice" value="三聯式" onClick="javascript:showfp()" checked><i>三聯式</i></label> </div> </div> </div> */ ?> <div class="row"> <div class="form-group col-md-12"> <label class="col-md-3 control-label" >電子發票資料</label> <div class="col-md-4"> <label class="radio"><input type="radio" name="selb2c" id="selb2c" value="0" checked > B2B 公司發票</label> <input type="hidden" name="order_invoice" value="三聯式"> <input type="hidden" name="order_invoice2" value=""> <input type="hidden" name="order_invoice3" value=""> </div> <div class="col-md-4"> <label class="radio"><input type="radio" name="selb2c" id="selb2c" value="1" ><i>B2C 個人發票</i></label> </div> </div> </div> </td> </tr> <tr id="fp2" > <td> <div class="row"> <div class="col-md-4"> <label>載具/手機/統編</label> <input name="q_phone" type="text" class="form-control" id="q_phone" maxlength="12"> <input name="q_uncode" type="hidden" id="q_uncode" value="42656789"> </div> <div class="col-md-4"> <label>發票捐贈碼</label> <input name="q_donationcode" id="q_donationcode" type="text" maxlength="12" class="form-control"> </div> <div class="col-md-4"> <label>發票Email郵件</label> <input name="q_email" id="q_email" type="text" maxlength="40" class="form-control"> </div> </div> </td> </tr> <tr> <td> <div class="row"> <div class="form-group col-md-12"> <label class="col-md-3"><font size="3" color="#000">適合收件時間</font></label> <div class="col-md-4"> <label class="radio"><input type="radio" name="order_time" value="白天9:00~18:00" required><i> 白天9:00~18:00</i></label> </div> <div class="col-md-4"> <label class="radio"><input type="radio" name="order_time" value="晚上18:00~21:00"><i> 晚上18:00~21:00</i></label> </div> </div> </div> </td> </tr> <tr> <td> <div class="row"> <div class="col-md-12"> <label><font size="3" color="#000">付款方式</font></label><br> <? // onClick="javascript:showfp3()" ?> <label><input type="radio" name="order_pay" value="1" checked><i></i> 信用卡線上刷卡</label><br> <input type="hidden" name="p_channel" id="p_channel" value="0"> <? /* <div class="row"> <div class="col-lg-12 g-mb-40"> <label class="g-font-size-14">選擇刷卡分期:</label> <select class="custom-select mr-sm-3 mb-3 mb-lg-0" name="p_channel" id="p_channel" > <option value="0" selected="selected">一次付清</option> <option value="3">分期 3 期</option> <option value="6">半年 6期</option> <option value="12" >一年12期</option> <option value="24">二年24期</option> </select> </div> <button class="btn btn-block u-btn-blue" type="button" onclick="location.href='中租0卡分期.html';">零卡分期消費者注意事項</button> </div> */ ?> <? /* <label><input type="radio" name="order_pay" value="2" onClick="javascript:showfp3()"><i></i> 超商取貨付款</label><br> <label><input type="radio" name="order_pay" value="3" onClick="javascript:showfp31()"><i></i> 臨櫃匯款</label><br> */ ?> <? /* <p> 國泰世華銀行-八德分行<br> 戶名:天空商城有限公司<br> 銀行代號:013, 帳號:077-03-500322-6 </p> <label><input type="radio" name="order_pay" value="4" onClick="javascript:showfp31()"><i></i> ATM轉帳</label><br> <p> 銀行代號:013,帳號:077-03-500322-6 </p> */ ?> </div> <div class="col-md-3"> <? /* <label>輸入卡片末5碼</label> */ ?> <input name="atm_code" id="atm_code" type="hidden" class="form-control" value=""> </div> <input name="order_pay2" id="order_pay2" type="hidden" value=""> <input name="paytoesafe" id="paytoesafe" type="hidden" value="pay" /> <? /* <div class="col-md-12" id="fp3"> <label><font size="3" color="#000">分期期數:不分期</font></label><br> <img class="img-fluid" src="/images/28bank.jpg" alt="skybni"> </div> */ ?> </div> </td> </tr> <tr> <td> <div class="row"> <div class="col-md-12"> <label><font size="3" color="#000">備註留言</font></label> <textarea id="mem_note" name="mem_note" rows="4" class="form-control"></textarea> </div> </div> </td> </tr> <tr> <td><input type="submit" name="Submit" value="確認購買資訊進入線上付款" class="btn u-btn-blue g-font-size-18 g-py-15 mb-4 g-color-white"></td> </tr> </table> </form> </div> </div> </div> <? } ?> <script language="JavaScript"> <!-- function form1check(){ var ck=true; var v = $("input[name='selb2c']:checked").val(); if(v==0){ ck= check_tax_number(); } return ck; } function check_tax_number() { const gui_number = $('#q_phone').val();//document.querySelector('.gui_number').value; // 取欄位內容 const cx = [1, 2, 1, 2, 1, 2, 4, 1]; const cnum = gui_number.split(''); let sum = 0; function cc(num) { let total = num; if (total > 9) { let s = total.toString(); const n1 = s.substring(0, 1) * 1; const n2 = s.substring(1, 2) * 1; total = n1 + n2; } return total; } if (gui_number.length !== 8) { alert('統編錯誤,要有 8 個數字'); return false; } cnum.forEach((item, index) => { if (gui_number.charCodeAt() < 48 || gui_number.charCodeAt() > 57) { // alert('統編錯誤,要有 8 個 0-9 數字組合'); return false; } sum += cc(item * cx[index]); }); if (sum % 10 === 0) { //alert('統編正確'); return true; } else if (cnum[6] === '7' && (sum + 1) % 10 === 0) { //alert('統編正確2'); return true; } else { alert('統編錯誤'); return false; } } function pay_point() { $('#pay_skybni').val(ival($('#pay_skybni').val())) ; var s_point= ival($('#skybni_point').val()) ; var p_point= ival($('#pay_skybni').val()) ; $('#pay_skybni').val( p_point) ; if(p_point>s_point){$('#pay_skybni').val(0);} } function set_expess(selObj) { // MAX, 運費 超商 到店 var s=selObj.options[selObj.selectedIndex].value; //order_express ov2 運費 //order_moneyALL 總金額 ov1 商品總金額:$ //pay_money + 總金額+express ov3 if($('#order_moneyALL').val()*1>$('#expmax').val()*1){ $('#order_express').val(0);} else{ if(s=='1'){$('#order_express').val( $('#exp1').val() ); } else if(s=='2'){ $('#order_express').val( $('#exp2').val() ) ;} else if(s=='3'){ $('#order_express').val(0);} } var vt = 0; vt=($('#order_moneyALL').val()*1)+$('#order_express').val()*1; $('#pay_money').val(vt); $('#ov2').html('運費 : $'+$('#order_express').val()); $('#ov3').html('應付金額:$'+$('#pay_money').val()); } function checkall() { document.getElementById("mem_name2").value = document.getElementById("mem_name").value; document.getElementById("mem_mobile2").value = document.getElementById("mem_mobile").value; document.getElementById("mem_address2").value = document.getElementById("mem_address").value; document.getElementById("mem_mail2").value = document.getElementById("mem_mail").value; } function showfp() { fp2.style.display = ''; } function showfp2() { fp2.style.display = 'none'; } function showfp3() { fp3.style.display = ''; } function showfp31() { fp3.style.display = 'none'; } function ival(num){ var num=parseFloat(num); if(isNaN(num)) return 0; return num; } //--> </script> <?php mysql_free_result($Rt2); mysql_free_result($Rtn); ?>
保存
取消
返回文件列表