| @@ -0,0 +1,108 @@ | |||
| <?php | |||
| /* | |||
| file: shop.php 購物 | |||
| */ | |||
| class Shop extends CC_Controller | |||
| { | |||
| function __construct() | |||
| { | |||
| parent::__construct('shop'); | |||
| } | |||
| // 首頁 | |||
| public function index() | |||
| { | |||
| $this->show_page('main_page'); | |||
| } | |||
| // 咖啡包預覽頁 | |||
| public function coffee_shop() | |||
| { | |||
| $product_id = $this->uri->segment(3); // 商品代碼 | |||
| $data = $this->app_model()->q_product($product_id); | |||
| unset($data['product_plan']); | |||
| $this->show_page('main_page', $data); | |||
| } | |||
| // 付款 | |||
| public function transfer_money() | |||
| { | |||
| $product_id = $this->input->post('product_id', true); | |||
| $product_code = $this->input->post('product_code', true); | |||
| $invoice_receiver = $this->input->post('invoice_receiver', true); | |||
| $company_no = $this->input->post('company_no', true); | |||
| $email = $this->input->post('email', true); | |||
| $mobile = $this->input->post('mobile', true); | |||
| // 建立訂單 | |||
| $new_bill = $this->app_model()->create_product_bill($product_id, $product_code); | |||
| if(!isset($new_bill['order_no'])) | |||
| { | |||
| echo 'bill_create_fail'; | |||
| exit; | |||
| } | |||
| $parms = array( | |||
| 'order_no' => $new_bill['order_no'], | |||
| 'invoice_receiver' => $invoice_receiver, | |||
| 'company_no' => $company_no, | |||
| 'email' => $email, | |||
| 'mobile' => $mobile | |||
| ); | |||
| // 處理產品訂單 | |||
| $proceed_bill = $this->app_model()->proceed_product_bill($parms, 50); // 50: 歐付寶刷卡 | |||
| // 開始進行繳交帳單 | |||
| if(!isset($proceed_bill['status']) || $proceed_bill['status'] != 100) | |||
| { | |||
| echo 'bill_proceed_fail'; | |||
| exit; | |||
| } | |||
| // 串接總公司購物流程 | |||
| $proceed_bill['station_no'] = $this->get_station_no(); | |||
| $proceed_bill['product_id'] = $product_id; | |||
| $proceed_bill['product_code'] = $product_code; | |||
| trigger_error(__FUNCTION__ . '..' . print_r($proceed_bill, true)); | |||
| try{ | |||
| $ch = curl_init(); | |||
| curl_setopt($ch, CURLOPT_URL, 'https://parks.altob.com.tw/bill_service.html/proceed_bill'); // 金流 | |||
| curl_setopt($ch, CURLOPT_HEADER, FALSE); | |||
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); | |||
| curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); | |||
| curl_setopt($ch, CURLOPT_POST, TRUE); | |||
| curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,30); | |||
| curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout in seconds | |||
| curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($proceed_bill)); | |||
| $result = curl_exec($ch); | |||
| if(curl_errno($ch)) | |||
| { | |||
| trigger_error(__FUNCTION__ . ', curl error: '. curl_error($ch)); | |||
| } | |||
| curl_close($ch); | |||
| }catch (Exception $e){ | |||
| trigger_error(__FUNCTION__ . 'error:'.$e->getMessage()); | |||
| } | |||
| echo $result; | |||
| } | |||
| // 買 | |||
| public function i_do() | |||
| { | |||
| $product_id = $this->uri->segment(3); // 商品代碼 | |||
| $data = $this->app_model()->q_coffee_shop($product_id); | |||
| trigger_error(__FUNCTION__ . '..' . print_r($data, true)); | |||
| echo 'ok'; | |||
| } | |||
| } | |||
| @@ -168,4 +168,12 @@ class CC_Controller extends CI_Controller | |||
| $this->$model_name->init($this->vars); | |||
| return $this->$model_name; | |||
| } | |||
| // 取得場站編號 | |||
| public function get_station_no() | |||
| { | |||
| $station_setting = $this->data_model()->station_setting_query(); | |||
| $station_no_arr = explode(SYNC_DELIMITER_ST_NO, $station_setting['station_no']); | |||
| return $station_no_arr[0]; | |||
| } | |||
| } | |||
| @@ -0,0 +1,152 @@ | |||
| <?php | |||
| /* | |||
| file: Shop_model.php 購物 | |||
| */ | |||
| class Shop_model extends CI_Model | |||
| { | |||
| var $vars = array(); | |||
| function __construct() | |||
| { | |||
| parent::__construct(); | |||
| $this->load->database(); | |||
| // product code | |||
| define('PRODUCT_CODE_COFFEE_SHOP', 'coffee_shop'); // 咖啡產品包 | |||
| define('PRODUCT_CODE_COFFEE', 'coffee'); // 咖啡 | |||
| } | |||
| public function init($vars) | |||
| { | |||
| $this->vars = $vars; | |||
| } | |||
| // 取得產品資訊 | |||
| public function q_product($product_id=0, $product_code='') | |||
| { | |||
| $now = date('Y/m/d H:i:s'); | |||
| $where_arr = array('start_time <= ' => $now, 'valid_time > ' => $now); | |||
| // 指定產品流水號 | |||
| if(!empty($product_id)) | |||
| $where_arr['product_id'] = $product_id; | |||
| // 指定產品包 | |||
| if(!empty($product_code)) | |||
| $where_arr['product_code'] = PRODUCT_CODE_COFFEE_SHOP; // 預設咖啡包 | |||
| $data = array(); | |||
| $result = $this->db->select('product_id, product_code, product_name, product_desc, amt, remarks, product_plan') | |||
| ->from('products') | |||
| ->where($where_arr) | |||
| ->limit(1) | |||
| ->get() | |||
| ->row_array(); | |||
| return $result; | |||
| } | |||
| // 產生交易序號 | |||
| private function gen_trx_no() | |||
| { | |||
| return time().rand(10000,99999); | |||
| } | |||
| // 建立產品訂單 | |||
| public function create_product_bill($product_id, $product_code) | |||
| { | |||
| // 取得商品資訊 | |||
| $product_info = $this->q_product($product_id, $product_code); | |||
| if(!isset($product_info['product_plan'])) | |||
| { | |||
| return 'unknown_product'; // 中斷 | |||
| } | |||
| $data = array(); | |||
| $data['order_no'] = $this->gen_trx_no(); | |||
| $data['product_id'] = $product_info["product_id"]; | |||
| $data['product_code'] = $product_info["product_code"]; | |||
| $data['product_plan'] = $product_info["product_plan"]; | |||
| $data['invoice_remark'] = $product_info["product_name"]; | |||
| $data['amt'] = $product_info["amt"]; | |||
| $data['valid_time'] = date('Y-m-d H:i:s', strtotime(" + 15 minutes")); // 15 min 內有效 | |||
| $this->db->insert('product_bill', $data); | |||
| $affect_rows = $this->db->affected_rows(); | |||
| if ($affect_rows <= 0) | |||
| return 'fail'; | |||
| trigger_error(__FUNCTION__ . '..' . print_r($data, true)); | |||
| return $data; | |||
| } | |||
| // 處理產品訂單 | |||
| public function proceed_product_bill($parms, $tx_type=0) | |||
| { | |||
| $order_no = $parms['order_no']; | |||
| $invoice_receiver = $parms['invoice_receiver']; | |||
| $company_no = $parms['company_no']; | |||
| $email = $parms['email']; | |||
| $mobile = $parms['mobile']; | |||
| $product_info = $this->db->select('valid_time, product_plan') | |||
| ->from('product_bill') | |||
| ->where(array('order_no' => $order_no)) | |||
| ->limit(1) | |||
| ->get() | |||
| ->row_array(); | |||
| if(!isset($product_info['product_plan'])) | |||
| { | |||
| trigger_error(__FUNCTION__ . "|{$order_no}|unknown_order"); | |||
| return 'unknown_order'; // 中斷 | |||
| } | |||
| if(!isset($product_info['valid_time'])) | |||
| { | |||
| trigger_error(__FUNCTION__ . "|{$order_no}|valid_time_not_found"); | |||
| return 'valid_time_not_found'; // 中斷 | |||
| } | |||
| $data = array(); | |||
| $data['tx_type'] = $tx_type; // 交易種類: 0:未定義, 1:現金, 40:博辰人工模組, 41:博辰自動繳費機, 50:歐付寶轉址刷卡, 51:歐付寶APP, 52:歐付寶轉址WebATM, 60:中國信託刷卡轉址 | |||
| if(strlen($company_no) >= 8) | |||
| { | |||
| $data['company_no'] = $company_no; // 電子發票:公司統編 | |||
| $data['company_receiver'] = "公司名稱"; // 電子發票:公司名稱 | |||
| $data['company_address'] = "公司地址"; // 電子發票:公司地址 | |||
| } | |||
| $data['invoice_receiver'] = (strlen($invoice_receiver) >= 7) ? $invoice_receiver : ''; // 電子發票:載具編號 | |||
| $data['email'] = (strlen($email) >= 5) ? $email : ''; // 電子發票:email | |||
| $data['mobile'] = (strlen($mobile) >= 10) ? $mobile : ''; // 電子發票:手機 | |||
| // 交易時間 | |||
| $tx_time = time(); | |||
| $data['tx_time'] = date('Y/m/d H:i:s', $tx_time); | |||
| if(strtotime($product_info['valid_time']) < $tx_time) | |||
| { | |||
| $data['status'] = 99; //狀態: 99:訂單逾期作廢 | |||
| $this->db->update('product_bill', $data, array('order_no' => $order_no)); | |||
| trigger_error(__FUNCTION__ . "|{$order_no}| 99 gg"); | |||
| return 'gg'; | |||
| } | |||
| // 完成 | |||
| $data['status'] = 100; // 狀態: 100:交易進行中 | |||
| $this->db->update('product_bill', $data, array('order_no' => $order_no)); | |||
| $affect_rows = $this->db->affected_rows(); | |||
| if ($affect_rows <= 0) | |||
| return 'fail'; | |||
| $data['order_no'] = $order_no; | |||
| trigger_error(__FUNCTION__ . ".." . print_r($data, true)); | |||
| return $data; | |||
| } | |||
| } | |||
| @@ -0,0 +1,334 @@ | |||
| <div data-items="checkout_page" class="content-new parking-bill-total"> | |||
| <section class="page"> | |||
| <div class="wrapper"> | |||
| <div class="pbt-plate-number"> | |||
| <h3><span id='checkout_lpr'></span></h3> | |||
| </div> | |||
| <form id="payment_data" role="form" method="post" target="_self" action="<?=APP_URL?>transfer_money/"> | |||
| <div class="pb-detail-list"> | |||
| <div class="pbd-list-box pbd-lb-separate"> | |||
| <dl> | |||
| <dt>停車位置</dt> | |||
| <dd><span id='checkout_station_name'></span></dd> | |||
| </dl> | |||
| <dl> | |||
| <dt>繳費單號</dt> | |||
| <dd><span id='checkout_order_no'></span></dd> | |||
| </dl> | |||
| <dl> | |||
| <dt>入場時間</dt> | |||
| <dd><span id='checkout_in_time'></span></dd> | |||
| </dl> | |||
| <dl> | |||
| <dt>計價時間</dt> | |||
| <dd><span id='checkout_balance_time'></span></dd> | |||
| </dl> | |||
| <dl> | |||
| <dt>預計可離場時間</dt> | |||
| <dd><span id='checkout_out_before_time'>交易成功 15 分鐘內</span></dd> | |||
| </dl> | |||
| <dl> | |||
| <dt>停車費</dt> | |||
| <dd class="red">NT$ <span id='checkout_amt'></span></dd> | |||
| </dl> | |||
| </div> | |||
| <div class="pbd-list-box pbd-invoice"> | |||
| <dl> | |||
| <dt>電子信箱</dt> | |||
| <dd> | |||
| <input type="text" id="email" name="email" class="form-control" placeholder="發票將寄信通知" | |||
| data-validation="email" | |||
| data-validation-optional="true" | |||
| data-validation-error-msg="請輸入正確信箱<br/>例如:altob@gmail.com" | |||
| data-validation-error-msg-container="#checkout_error_msg" | |||
| /> | |||
| </dd> | |||
| </dl> | |||
| <dl> | |||
| <dt>手機號碼</dt> | |||
| <dd> | |||
| <input type="text" id="mobile" name="mobile" class="form-control" placeholder="發票將寄簡訊通知" | |||
| data-validation="custom" | |||
| data-validation-optional="true" | |||
| data-validation-regexp="^(?=.{10}$)09([0-9]+)$" | |||
| data-validation-error-msg="請輸入正確手機號碼<br/>例如:0912345678" | |||
| data-validation-error-msg-container="#checkout_error_msg" | |||
| /> | |||
| </dd> | |||
| </dl> | |||
| <dl> | |||
| <dt>開立發票方式</dt> | |||
| <dd> | |||
| <div class="pbd-select"> | |||
| <select> | |||
| <option class="invoice_way1">二聯式發票</option> | |||
| <option class="invoice_way2">手機條碼載具</option> | |||
| <option class="invoice_way3">輸入統一編號</option> | |||
| <!--option class="invoice_way4">捐贈發票</option--> | |||
| </select> | |||
| </div> | |||
| </dd> | |||
| </dl> | |||
| <div class="inv_way iw_1"></div> | |||
| <div class="inv_way iw_2"> | |||
| <dl> | |||
| <dt></dt> | |||
| <dd> | |||
| <input type="text" id="invoice_receiver" name="invoice_receiver" class="form-control" placeholder="請輸入手機條碼" | |||
| data-validation="custom" | |||
| data-validation-regexp="^$|^(?=.{7}$)([A-Za-z0-9]+)$|^(?=.{8}$)\u002F([A-Za-z0-9]+)$" | |||
| data-validation-error-msg="請輸入正確載具<br/>格式: / + 7碼 <br/>(共8碼)" | |||
| data-validation-error-msg-container="#checkout_error_msg" | |||
| /> | |||
| </dd> | |||
| </dl> | |||
| </div> | |||
| <div class="inv_way iw_3"> | |||
| <dl> | |||
| <dt></dt> | |||
| <dd> | |||
| <input type="text" id="company_no" name="company_no" class="form-control" placeholder="請輸入統一編號" | |||
| data-validation="custom" | |||
| data-validation-optional="true" | |||
| data-validation-regexp="^(?=.{8}$)([0-9]+)$" | |||
| data-validation-error-msg="請輸入正確統編<br/>例如:80682490" | |||
| data-validation-error-msg-container="#checkout_error_msg" | |||
| /> | |||
| </dd> | |||
| </dl> | |||
| </div> | |||
| <div class="inv_way iw_4"> | |||
| <dl> | |||
| <dt></dt> | |||
| <dd> | |||
| 25885-伊甸基金會 | |||
| </dd> | |||
| </dl> | |||
| </div> | |||
| </div> | |||
| <dl> | |||
| <dt></dt> | |||
| <dd class="red"><span id='checkout_error_msg'></span></dd> | |||
| </dl> | |||
| <div class="pbd-img-box"> | |||
| <!--img id='checkout_image' src="http://fakeimg.pl/768x461/ddd" alt=""--> | |||
| <img id='checkout_image' src="" alt=""> | |||
| </div> | |||
| <div class="form-group"> | |||
| <input id="order_no" type="hidden" name="order_no" value="0" /> | |||
| </div> | |||
| </div> | |||
| </form> | |||
| <div class="fixed-btn-box fbb-1"> | |||
| <a class="btn blue-btn" onclick="transfer_money(event);">前往繳費</a> | |||
| </div> | |||
| </div> | |||
| </section> | |||
| </div> | |||
| <script> | |||
| // 載入 | |||
| function load_checkout_page() | |||
| { | |||
| $("#checkout_lpr").text('').text(current_altob_checkout_bill['lpr']); | |||
| $("#checkout_station_name").text('').text(current_altob_checkout_bill['station_name']); | |||
| $("#checkout_order_no").text('').text(current_altob_checkout_bill['order_no']); | |||
| $("#checkout_in_time").text('').text(current_altob_checkout_bill['in_time']); | |||
| $("#checkout_balance_time").text('').text(current_altob_checkout_bill['balance_time']); | |||
| //$("#checkout_out_before_time").text('').text(current_altob_checkout_bill['balance_time']); | |||
| $("#checkout_amt").text('').text(current_altob_checkout_bill['amt']); | |||
| $("#checkout_image").attr('src', '').attr('src', current_altob_checkout_bill['image_url']); | |||
| // 設定訂單編號 | |||
| $("#order_no").val("0").val(current_altob_checkout_bill['order_no']); | |||
| // 明細 | |||
| /* | |||
| $("#price_data_tbody").html(""); | |||
| // A. 依r_no 分群, 暫存到 tmp_r_no_array | |||
| var tmp_r_no_array = []; | |||
| for(lv1 in current_altob_checkout_bill['price_detail']) | |||
| { | |||
| if (lv1 == 0) { continue; } | |||
| var today = current_altob_checkout_bill['price_detail'][lv1]; | |||
| for(lv2 in today) | |||
| { | |||
| if(lv2.match(/\u003A/)){ // 取出有時間的部份 | |||
| var detail = today[lv2]; | |||
| if(!(detail.r_no in tmp_r_no_array)){ | |||
| tmp_r_no_array[detail.r_no] = []; | |||
| } | |||
| tmp_r_no_array[detail.r_no].push([detail.r_no, '_', lv1, '_', lv2].join('')); | |||
| } | |||
| } | |||
| } | |||
| //console.log('tmp_r_no_array: ' + tmp_r_no_array); | |||
| // B. 將 tmp_r_no_array 解析, 產生顯示用的 price_result_array | |||
| var price_result_array = []; | |||
| var last_r_no_keys_array = []; | |||
| var check_p = 0; | |||
| for(r_no in tmp_r_no_array) | |||
| { | |||
| var r_no_array = tmp_r_no_array[r_no].sort(); // 依r_no 排序 | |||
| //console.log(r_no + ' length: ' + r_no_array.length); | |||
| for(key in r_no_array) | |||
| { | |||
| var keys = r_no_array[key].split('_'); | |||
| var r_no = keys[0]; | |||
| var lv1 = keys[1]; | |||
| var lv2 = keys[2]; | |||
| var time_str = [lv1, ' ', lv2].join(''); | |||
| var detail = current_altob_checkout_bill['price_detail'][lv1][lv2]; | |||
| var detail_p0_price = current_altob_checkout_bill['price_detail'][lv1].p0; | |||
| var detail_limit0 = current_altob_checkout_bill['price_detail'][lv1].limit0; | |||
| var detail_free0_min = current_altob_checkout_bill['price_detail'][lv1].free0_min; | |||
| if(detail.p > 0){ | |||
| check_p += detail.p; | |||
| var before_keys = last_r_no_keys_array.pop(); //r_no_array[key - 1].split('_'); | |||
| var before_r_no = before_keys[0]; | |||
| var before_lv1 = before_keys[1]; | |||
| var before_lv2 = before_keys[2]; | |||
| var before_time_str = [before_lv1, ' ', before_lv2].join(''); | |||
| var before_detail = current_altob_checkout_bill['price_detail'][before_lv1][before_lv2]; | |||
| // create result | |||
| var data_p_desc = ''; | |||
| var data_p_time = ''; | |||
| var data_p_time_desc = ['*時段 ', before_time_str, '<br/>至 ', time_str].join(''); | |||
| var data_p_price_desc = [detail.p, ' 元'].join(''); | |||
| // p_desc | |||
| if(detail.status == 1){ | |||
| data_p_desc = ['費率:每日最高收費上限 ', detail_limit0, ' 元,已達當日上限'].join(''); // '每日最高收費上限 150元'; | |||
| }else{ | |||
| data_p_desc = [' 每小時 ', 2 * detail_p0_price, ' 元,前 ', detail_free0_min, ' 分鐘免費。'].join(''); // '費率:每小時 20元'; | |||
| } | |||
| // p_time | |||
| var detail_part = []; | |||
| if('h' in detail && detail.h > 0){ | |||
| detail_part.push(detail.h, ' 小時 '); | |||
| } | |||
| if('i' in detail && detail.i > 0){ | |||
| detail_part.push(detail.i, ' 分鐘'); | |||
| } | |||
| //if(detail.p < before_detail_p2_price){detail_part.push(' (', r_no, ') ');} | |||
| data_p_time = detail_part.join(''); | |||
| if(price_result_array.length > 0){ | |||
| if(r_no == price_result_array[price_result_array.length - 1].r_no){ | |||
| // 與上一筆結算為同一價錢週期時, 更新上一筆結算 | |||
| var last_result = price_result_array[price_result_array.length - 1]; | |||
| last_result.p_desc = '每日最高收費上限 150元'; | |||
| last_result.p_time = [last_result.p_time, '接續<br/><br/>', data_p_time].join('');; | |||
| last_result.p_time_desc = [last_result.p_time_desc, ' 接續<br/><br/>', data_p_time_desc].join(''); | |||
| last_result.p_price_desc = [last_result.p_price_desc, ' + ', data_p_price_desc].join(''); | |||
| // push last | |||
| last_r_no_keys_array.push(keys); | |||
| continue; | |||
| } | |||
| } | |||
| // 與上一筆結算不同價錢週期, 新增一筆結算 | |||
| var data = []; | |||
| data.r_no = r_no; | |||
| data.p_desc = data_p_desc; | |||
| data.p_time = data_p_time; | |||
| data.p_time_desc = data_p_time_desc; | |||
| data.p_price_desc = data_p_price_desc; | |||
| price_result_array.push(data); | |||
| // push last | |||
| last_r_no_keys_array.push(keys); | |||
| }else{ | |||
| // push last | |||
| last_r_no_keys_array.push(keys); | |||
| } | |||
| } | |||
| } | |||
| // C. 根據 price_result_array, 產生頁面顯示 | |||
| var seq = 0; | |||
| for(key in price_result_array) | |||
| { | |||
| var result = price_result_array[key]; | |||
| var meta_0_str = ++seq; | |||
| $("#price_data_list>[data-tag=p_no]").text(meta_0_str); | |||
| $("#price_data_list>[data-tag=p_meta]").html(result.p_time_desc); | |||
| $("#price_data_list>[data-tag=p_result]").html(result.p_time); | |||
| $("<tr data-day='day'>"+$("#price_data_list").html()+"</tr>").appendTo("#price_data_tbody"); | |||
| $("#price_data_list>[data-tag=p_no]").text(""); | |||
| $("#price_data_list>[data-tag=p_meta]").html(result.p_desc); | |||
| $("#price_data_list>[data-tag=p_result]").html(result.p_price_desc); | |||
| $("<tr data-day='day' style='color: red;'>"+$("#price_data_list").html()+"</tr>").appendTo("#price_data_tbody"); | |||
| } | |||
| var bill_time_part = ['共 ']; | |||
| if('bill_days' in jdata && jdata.bill_days > 0){ | |||
| bill_time_part.push(jdata.bill_days, ' 天 : '); | |||
| } | |||
| if('bill_hours' in jdata && jdata.bill_hours > 0){ | |||
| bill_time_part.push(jdata.bill_hours, ' 小時 : '); | |||
| } | |||
| if('bill_mins' in jdata && jdata.bill_mins > 0){ | |||
| bill_time_part.push(jdata.bill_mins, ' 分鐘'); | |||
| } | |||
| $("#show_amt_detail_time").text(bill_time_part.join('')); | |||
| $("#show_amt_detail_price").text([jdata.amt, ' 元'].join('')); | |||
| */ | |||
| } | |||
| // 開啟轉帳畫面 | |||
| function transfer_money(event) | |||
| { | |||
| event.preventDefault(); | |||
| if(! $("#payment_data").isValid()) return false; | |||
| if($("#email").val() == '' && $("#mobile").val() == '') | |||
| { | |||
| alertify_error("請至少提供一項發票通知方式<br/>1. 電子信箱 <br/>2. 或 手機號碼<br/><br/>謝謝!!"); | |||
| return false; | |||
| } | |||
| /* | |||
| var order_no = $("#checkout_order_no").text() == '' ? '0' : $("#checkout_order_no").text(); | |||
| var invoice_receiver = $("#invoice_receiver").val() == '' ? '0' : $("#invoice_receiver").val(); | |||
| var company_no = $("#company_no").val() == '' ? '0' : $("#company_no").val(); | |||
| var email = $("#email").val() == '' ? '0' : $("#email").val(); | |||
| var mobile = $("#mobile").val() == '' ? '0' : $("#mobile").val(); | |||
| */ | |||
| payment_data.submit(); | |||
| } | |||
| </script> | |||
| <!-- 這段要放後面才能運作 --> | |||
| <script src="/libs/opay/lib/actions.js"></script> | |||
| @@ -0,0 +1,173 @@ | |||
| <div data-items="item_page" class="content-new parking-bill-total"> | |||
| <section class="page"> | |||
| <div class="wrapper"> | |||
| <div class="pbt-plate-number"> | |||
| <h3><span id='checkout_desc'></span></h3> | |||
| </div> | |||
| <form id="payment_data" role="form" method="post" target="_self" action="<?=APP_URL?>transfer_money/"> | |||
| <div class="pb-detail-list"> | |||
| <div class="pbd-list-box pbd-lb-separate"> | |||
| <dl> | |||
| <dt>名稱</dt> | |||
| <dd><span id='checkout_name'></span></dd> | |||
| </dl> | |||
| <dl> | |||
| <dt>說明</dt> | |||
| <dd><span id='checkout_remarks'></span></dd> | |||
| </dl> | |||
| <dl> | |||
| <dt>價格</dt> | |||
| <dd class="red">NT$ <span id='checkout_amt'></span></dd> | |||
| </dl> | |||
| </div> | |||
| <div class="pbd-list-box pbd-invoice"> | |||
| <dl> | |||
| <dt>電子信箱</dt> | |||
| <dd> | |||
| <input type="text" id="email" name="email" class="form-control" placeholder="發票將寄信通知" | |||
| data-validation="email" | |||
| data-validation-optional="true" | |||
| data-validation-error-msg="請輸入正確信箱<br/>例如:altob@gmail.com" | |||
| data-validation-error-msg-container="#checkout_error_msg" | |||
| /> | |||
| </dd> | |||
| </dl> | |||
| <dl> | |||
| <dt>手機號碼</dt> | |||
| <dd> | |||
| <input type="text" id="mobile" name="mobile" class="form-control" placeholder="發票將寄簡訊通知" | |||
| data-validation="custom" | |||
| data-validation-optional="true" | |||
| data-validation-regexp="^(?=.{10}$)09([0-9]+)$" | |||
| data-validation-error-msg="請輸入正確手機號碼<br/>例如:0912345678" | |||
| data-validation-error-msg-container="#checkout_error_msg" | |||
| /> | |||
| </dd> | |||
| </dl> | |||
| <dl> | |||
| <dt>開立發票方式</dt> | |||
| <dd> | |||
| <div class="pbd-select"> | |||
| <select> | |||
| <option class="invoice_way1">二聯式發票</option> | |||
| <option class="invoice_way2">手機條碼載具</option> | |||
| <option class="invoice_way3">輸入統一編號</option> | |||
| <!--option class="invoice_way4">捐贈發票</option--> | |||
| </select> | |||
| </div> | |||
| </dd> | |||
| </dl> | |||
| <div class="inv_way iw_1"></div> | |||
| <div class="inv_way iw_2"> | |||
| <dl> | |||
| <dt></dt> | |||
| <dd> | |||
| <input type="text" id="invoice_receiver" name="invoice_receiver" class="form-control" placeholder="請輸入手機條碼" | |||
| data-validation="custom" | |||
| data-validation-regexp="^$|^(?=.{7}$)([A-Za-z0-9]+)$|^(?=.{8}$)\u002F([A-Za-z0-9]+)$" | |||
| data-validation-error-msg="請輸入正確載具<br/>格式: / + 7碼 <br/>(共8碼)" | |||
| data-validation-error-msg-container="#checkout_error_msg" | |||
| /> | |||
| </dd> | |||
| </dl> | |||
| </div> | |||
| <div class="inv_way iw_3"> | |||
| <dl> | |||
| <dt></dt> | |||
| <dd> | |||
| <input type="text" id="company_no" name="company_no" class="form-control" placeholder="請輸入統一編號" | |||
| data-validation="custom" | |||
| data-validation-optional="true" | |||
| data-validation-regexp="^(?=.{8}$)([0-9]+)$" | |||
| data-validation-error-msg="請輸入正確統編<br/>例如:80682490" | |||
| data-validation-error-msg-container="#checkout_error_msg" | |||
| /> | |||
| </dd> | |||
| </dl> | |||
| </div> | |||
| <div class="inv_way iw_4"> | |||
| <dl> | |||
| <dt></dt> | |||
| <dd> | |||
| 25885-伊甸基金會 | |||
| </dd> | |||
| </dl> | |||
| </div> | |||
| </div> | |||
| <dl> | |||
| <dt></dt> | |||
| <dd class="red"><span id='checkout_error_msg'></span></dd> | |||
| </dl> | |||
| <div class="pbd-img-box"> | |||
| <img id='checkout_image' src="" alt=""> | |||
| </div> | |||
| <div class="form-group"> | |||
| <input id="product_id" type="hidden" name="product_id" value="0" /> | |||
| <input id="product_code" type="hidden" name="product_code" value="" /> | |||
| </div> | |||
| </div> | |||
| </form> | |||
| <div class="fixed-btn-box fbb-1"> | |||
| <a class="btn blue-btn" onclick="transfer_money(event);">前往繳費</a> | |||
| </div> | |||
| </div> | |||
| </section> | |||
| </div> | |||
| <script> | |||
| // 載入 | |||
| function load_item_page() | |||
| { | |||
| $("#checkout_name").text(PRODUCT_RESULT.product_name); | |||
| $("#checkout_desc").text(PRODUCT_RESULT.product_desc); | |||
| $("#checkout_remarks").text(PRODUCT_RESULT.remarks); | |||
| $("#checkout_amt").text(PRODUCT_RESULT.amt); | |||
| $("#checkout_image").attr("src", "<?=SERVER_URL?>i3/pics/coffee.jpg"); | |||
| $("#product_id").val(PRODUCT_RESULT.product_id); | |||
| $("#product_code").val(PRODUCT_RESULT.product_code); | |||
| } | |||
| // 開啟轉帳畫面 | |||
| function transfer_money(event) | |||
| { | |||
| event.preventDefault(); | |||
| if(! $("#payment_data").isValid()) return false; | |||
| if($("#email").val() == '' && $("#mobile").val() == '') | |||
| { | |||
| alertify_error("請至少提供一項發票通知方式<br/>1. 電子信箱 <br/>2. 或 手機號碼<br/><br/>謝謝!!"); | |||
| return false; | |||
| } | |||
| payment_data.submit(); | |||
| } | |||
| </script> | |||
| <!-- 這段要放後面才能運作 --> | |||
| <script src="/libs/opay/lib/actions.js"></script> | |||
| @@ -0,0 +1,294 @@ | |||
| <!DOCTYPE html> | |||
| <html lang="zh-TW"> | |||
| <head> | |||
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |||
| <meta name="viewport" content="width=device-width, initial-scale=1 ,maximum-scale=1.0, user-scalable=no"> | |||
| <title>歐特儀停車場</title> | |||
| <meta name="keywords" content="歐特儀,停車場"> | |||
| <meta name="description" content="歐特儀,停車場"> | |||
| <!-- opay --> | |||
| <link href="/libs/opay/css/reset_new.css" rel='stylesheet' type='text/css' /> | |||
| <link href="/libs/opay/css/global_new.css" rel='stylesheet' type='text/css' /> | |||
| <link href="/libs/opay/css/page_new.css" rel='stylesheet' type='text/css' /> | |||
| <script src="/libs/opay/lib/jquery-1.7.1.min.js"></script> | |||
| <!-- alertify --> | |||
| <link href="/libs/css/alertify.core.css" rel="stylesheet"> | |||
| <link href="/libs/css/alertify.bootstrap.css" rel="stylesheet"> | |||
| <script src="/libs/js/alertify.min.js"></script> | |||
| <!-- jQuery validate --> | |||
| <script src="/libs/form-validator/jquery.form-validator.min.js"></script> | |||
| <!-- md5 --> | |||
| <script src="/libs/js/md5.min.js"></script> | |||
| <!-- other --> | |||
| <script src="/libs/js/js.cookie.js"></script> | |||
| <link href="/libs/css/custom-table.css" rel="stylesheet"> | |||
| </head> | |||
| <body class="body-wbg"> | |||
| <!-- Start: Content --> | |||
| <header> | |||
| <div class="previous" onclick="back_page(event);"></div> | |||
| <h1>歐特儀停車場</h1> | |||
| </header> | |||
| <div class="content-new parking-search-setting"> | |||
| <section class="page"> | |||
| <div data-items="home_page" class="wrapper"> | |||
| <div class="wbt-fill-box"> | |||
| <div class="wbtf-box-line none-underline"> | |||
| <div class="wbt-fill-title"> | |||
| <img src="/libs/opay/images/fee/ic_parking_fee.svg" class="wft-gov-icon"> | |||
| <h3>兌換卷</h3> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="pss-choose-box"> | |||
| <h4 class="spacing-title">兌換快捷鍵</h4> | |||
| <div class="parkinsys-search-wrap"> | |||
| <ul id="order_history_list" class="psw-choose-num"> | |||
| <!--li><a href="javascript:void(0)">ABC-1234</a></li> | |||
| <li><a href="javascript:void(0)">HT-114</a></li> | |||
| <li><a href="javascript:void(0)">YA-520</a></li> | |||
| <li><a href="javascript:void(0)">FC-500</a></li> | |||
| <li><a href="javascript:void(0)">PO-100</a></li> | |||
| <li><a href="javascript:void(0)">7128-AMY</a></li--> | |||
| </ul> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div id="page-wrapper"><!-- 動態切換顯示 --> | |||
| </div> | |||
| </section> | |||
| </div> | |||
| <!-- End: Content --> | |||
| </body> | |||
| </html> | |||
| <script> | |||
| <?php /* alertify function */ ?> | |||
| function alertify_log($msg) | |||
| { | |||
| alertify.set({delay : 2000}); | |||
| alertify.log($msg); | |||
| } | |||
| function alertify_error($msg) | |||
| { | |||
| alertify.set({delay : 2000}); | |||
| alertify.error($msg); | |||
| } | |||
| function alertify_success($msg) | |||
| { | |||
| alertify.set({delay : 2000}); | |||
| alertify.success($msg); | |||
| } | |||
| // -- 顯示指定項目 (切換) -- | |||
| function show_item_without_change(tags) | |||
| { | |||
| $("[data-items]").hide(); | |||
| $("[data-items="+tags+"]").show(); | |||
| return false; | |||
| } | |||
| // -- 顯示指定項目 -- | |||
| function show_item(tags, type) | |||
| { | |||
| current_page_tags = tags; // 記錄目前頁面 | |||
| switch(tags) | |||
| { | |||
| // -- 首頁 -- | |||
| case "home_page": | |||
| reload_order_list(); | |||
| break; | |||
| // -- 產品展示 -- | |||
| case "item_page": | |||
| load_page(tags); | |||
| load_item_page(); | |||
| break; | |||
| // -- 結帳 -- | |||
| case "checkout_page": | |||
| load_page(tags); | |||
| load_checkout_page(); | |||
| break; | |||
| default: | |||
| $("#"+tags+"_list").html(""); // -- 清除原內容 -- | |||
| break; | |||
| } | |||
| $("[data-items]").hide(); | |||
| $("[data-items="+tags+"]").show(); | |||
| return false; | |||
| } | |||
| // 載入頁面 | |||
| function load_page(tags) | |||
| { | |||
| if ($("[data-items='"+tags+"']").length == 0) // 第一次loading | |||
| { | |||
| $.ajax | |||
| ({ | |||
| url:"<?=APP_URL?>get_html", | |||
| async:false, | |||
| timeout:1500, | |||
| type:"post", | |||
| dataType:"text", | |||
| data:{"tag_name":tags}, | |||
| success:function(jdata) | |||
| { | |||
| $("#page-wrapper").append(jdata); | |||
| } | |||
| }); | |||
| } | |||
| } | |||
| ///////////////////////////////////// | |||
| // | |||
| // 開始 | |||
| // | |||
| ///////////////////////////////////// | |||
| // 取得產品資訊 | |||
| var PRODUCT_RESULT = {}; | |||
| PRODUCT_RESULT.product_id = '<?= $product_id; ?>'; | |||
| PRODUCT_RESULT.product_code = '<?= $product_code; ?>'; | |||
| PRODUCT_RESULT.product_name = '<?= $product_name; ?>'; | |||
| PRODUCT_RESULT.product_desc = '<?= $product_desc; ?>'; | |||
| PRODUCT_RESULT.amt = '<?= $amt; ?>'; | |||
| PRODUCT_RESULT.remarks = '<?= $remarks; ?>'; | |||
| // 暫存區 | |||
| var current_page_tags; // 目前所在頁面 | |||
| var current_altob_check_list; // 目前待結清單 | |||
| var current_altob_checkout_bill; // 目前待繳帳單 | |||
| var AltobCookies = Cookies.noConflict(); | |||
| // 設定 cookie | |||
| function set_cookie(key, value) | |||
| { | |||
| AltobCookies.set(key, value, { expires: 30 }); | |||
| } | |||
| $(document).ready(function() | |||
| { | |||
| <?php /* validate 設定start */ ?> | |||
| $.validate( | |||
| { | |||
| modules : 'security', | |||
| } | |||
| ); | |||
| <?php /* validate 設定end */ ?> | |||
| // 若有帶產品编號, 前往展示頁 | |||
| if(PRODUCT_RESULT.product_id != '') | |||
| { | |||
| show_item('item_page', 'item_page'); | |||
| } | |||
| else | |||
| { | |||
| show_item('home_page', 'home_page'); | |||
| } | |||
| }); | |||
| // 載入兌換資訊 | |||
| function reload_order_list() | |||
| { | |||
| $("#order_history_list").html(''); | |||
| if(AltobCookies.get('order_history') !== undefined) // 清除 Cookies.expire('order_history') | |||
| { | |||
| var query_list = []; | |||
| var order_history_arr = AltobCookies.get('order_history').split(';'); | |||
| for(key in order_history_arr) | |||
| { | |||
| if(order_history_arr[key] != '') | |||
| { | |||
| console.log('+' + order_history_arr[key]); | |||
| } | |||
| /* | |||
| query_list = query_list.concat(['<li><a href="javascript:void(0)" onclick="get_item(', key ,');">', | |||
| order_history_arr[key] ,'</a></li>']); | |||
| */ | |||
| } | |||
| $("#order_history_list").append(query_list.join('')); | |||
| } | |||
| else | |||
| { | |||
| // 重新下載兌換卷 | |||
| } | |||
| } | |||
| // 新增兌換記錄 | |||
| function new_order_list(order_key) | |||
| { | |||
| var isNewLpr = true; | |||
| var order_history_arr = []; | |||
| if(AltobCookies.get('order_history') !== undefined) // 清除 Cookies.expire('order_history') | |||
| { | |||
| order_history_arr = AltobCookies.get('order_history').split(';'); | |||
| for(key in order_history_arr) | |||
| { | |||
| if(order_history_arr[key] == order_key) | |||
| { | |||
| isNewLpr = false; | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| if(isNewLpr && order_key != '-') | |||
| { | |||
| // 最多記錄 5 筆, 新的被清掉 | |||
| if(order_history_arr.length >= 5) | |||
| order_history_arr.shift(); | |||
| order_history_arr.push(order_key); | |||
| set_cookie('order_history', order_history_arr.join(';')) | |||
| // 重建兌換記錄 | |||
| reload_order_list(); | |||
| } | |||
| } | |||
| // 設定車號 | |||
| function set_lpr(key) | |||
| { | |||
| var order_history_arr = AltobCookies.get('order_history').split(';'); | |||
| var order_front_tail = String(order_history_arr[key]).split('-'); | |||
| $("#order_front").val('').val(order_front_tail[0]); | |||
| $("#order_tail").val('').val(order_front_tail[1]); | |||
| } | |||
| // 回上頁 | |||
| function back_page(event) | |||
| { | |||
| if(event !== undefined) | |||
| event.preventDefault(); | |||
| // 預設回首頁 | |||
| show_item('home_page', 'home_page'); | |||
| } | |||
| </script> | |||
| @@ -0,0 +1,237 @@ | |||
| <!DOCTYPE html> | |||
| <html lang="zh-TW"> | |||
| <head> | |||
| <meta charset="utf-8"> | |||
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |||
| <meta name="description" content=""> | |||
| <meta name="author" content=""> | |||
| <title>歐特儀停車場</title> | |||
| <!-- Bootstrap Core CSS --> | |||
| <link href="<?=BOOTSTRAPS?>bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"> | |||
| <!-- MetisMenu CSS --> | |||
| <link href="<?=BOOTSTRAPS?>bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet"> | |||
| <!-- Timeline CSS --> | |||
| <link href="<?=BOOTSTRAPS?>dist/css/timeline.css" rel="stylesheet"> | |||
| <!-- Custom CSS --> | |||
| <link href="<?=BOOTSTRAPS?>dist/css/sb-admin-3.css" rel="stylesheet"> | |||
| <!-- Morris Charts CSS --> | |||
| <link href="<?=BOOTSTRAPS?>bower_components/morrisjs/morris.css" rel="stylesheet"> | |||
| <!-- Custom Fonts --> | |||
| <link href="<?=BOOTSTRAPS?>bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"> | |||
| </head> | |||
| <body style="font-family:Microsoft JhengHei;"> | |||
| <div id="wrapper"> | |||
| <div id="page-wrapper"><?php /* 主要資料顯示區 */ ?> | |||
| <div class="row"> | |||
| <div class="col-lg-12"> | |||
| <!--h1 class="page-header">歐特儀自動化服務機</h1--><?php /* 右側小表頭 */ ?> | |||
| | |||
| </div> | |||
| </div> | |||
| <!-- /.row --> | |||
| <?php /* ----- 查詢結果 ----- */ ?> | |||
| <div data-items="not_found" class="row"> | |||
| <div class="col-lg-12"> | |||
| <div class="panel panel-default"> | |||
| <div class="panel-heading" style="font-size:28px;"><?php /* 資料顯示區灰色小表頭 */ ?> | |||
| 查詢結果:查無 <span id="not_found_product" style="font-size:28px;color:blue;"></span> 商品資料 | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <?php /* ----- 查詢結果 ----- */ ?> | |||
| <div data-items="output_product" class="row" style="display:none;"> | |||
| <div class="col-lg-7 col-sm-7"> | |||
| <div class="panel panel-default"> | |||
| <div class="panel-heading" style="font-size:36px;"> | |||
| <button class="btn btn-large btn-success pull-right" style="font-size:28px;" onclick='i_do(event);'>我要買</button> | |||
| 歐特儀精選 | |||
| </div> | |||
| <div class="panel-body" style="margin: 0px auto;"> | |||
| <div data-rows class="row"> | |||
| <div class="col-lg-12" style="margin: 0px auto;"> | |||
| <table class="table table-striped table-bordered table-hover"> | |||
| <tbody style="font-size:20px;"> | |||
| <tr> | |||
| <td style="text-align:right;vertical-align: middle;">名稱</td> | |||
| <td id="show_product_name" style="text-align:left;vertical-align: middle;"></td> | |||
| </tr> | |||
| <tr> | |||
| <td style="text-align:right;vertical-align: middle;">描述</td> | |||
| <td id="show_product_remarks" style="text-align:left;vertical-align: middle; font-size:20px; color:blue;"></td> | |||
| </tr> | |||
| <tr> | |||
| <td style="text-align:right;vertical-align: middle;">費用</td> | |||
| <td style="text-align:left;vertical-align: middle;"> | |||
| <span id="show_product_amt" style="font-size:20px;color:green;"/> | |||
| </td> | |||
| </tr> | |||
| <!--tr> | |||
| <td style="text-align:right;vertical-align: middle;"></td> | |||
| <td> | |||
| <button class="btn btn-large btn-success pull-right" style="font-size:28px;">我要買</button> | |||
| </td> | |||
| </tr--> | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| <!-- /.col-lg-6 (nested) --> | |||
| </div> | |||
| <!-- /.row (nested) --> | |||
| </div> | |||
| <!-- /.panel-body --> | |||
| </div> | |||
| <!-- /.panel --> | |||
| </div> | |||
| <div class="col-lg-5 col-sm-5"> | |||
| <div class="panel panel-default"> | |||
| <div class="panel-heading" style="font-size:20px;"><?php /* 資料顯示區灰色小表頭 */ ?> | |||
| <span id="show_product_desc"/> | |||
| </div> | |||
| </div> | |||
| <div class="panel-body" style="margin: 0px auto;"> | |||
| <div class="col-lg-12" style="margin: 0px auto;"> | |||
| <table class="table table-striped table-bordered table-hover"> | |||
| <tbody> | |||
| <tr> | |||
| <td style="text-align:center;vertical-align: middle;"> | |||
| <img id="show_img" style="width: 100%" /> | |||
| </td> | |||
| </tr> | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <!-- /.col-lg-12 --> | |||
| </div> | |||
| <!-- /#page-wrapper --> | |||
| </div> | |||
| <!-- /#wrapper --> | |||
| <!-- jQuery --> | |||
| <script src="<?=BOOTSTRAPS?>bower_components/jquery/dist/jquery.min.js"></script> | |||
| <!-- Bootstrap Core JavaScript --> | |||
| <script src="<?=BOOTSTRAPS?>bower_components/bootstrap/dist/js/bootstrap.min.js"></script> | |||
| <!-- Metis Menu Plugin JavaScript --> | |||
| <script src="<?=BOOTSTRAPS?>bower_components/metisMenu/dist/metisMenu.min.js"></script> | |||
| <!-- Morris Charts JavaScript --> | |||
| <script src="<?=BOOTSTRAPS?>bower_components/raphael/raphael-min.js"></script> | |||
| <!--script src="<?=BOOTSTRAPS?>bower_components/morrisjs/morris.min.js"></script--> | |||
| <!--script src="<?=BOOTSTRAPS?>js/morris-data.js"></script--> | |||
| <!-- alertify --> | |||
| <link href="<?=WEB_LIB?>css/alertify.core.css" rel="stylesheet"> | |||
| <link href="<?=WEB_LIB?>css/alertify.bootstrap.css" rel="stylesheet"> | |||
| <script src="<?=WEB_LIB?>js/alertify.min.js"></script> | |||
| <!-- moment --> | |||
| <script src="<?=WEB_LIB?>js/moment.min.js"></script> | |||
| <!-- Custom Theme JavaScript --> | |||
| <script src="<?=BOOTSTRAPS?>dist/js/sb-admin-2.js"></script> | |||
| <div id="works" style="display:none;"></div><?php /* 作為浮動顯示區之用 */ ?> | |||
| </body> | |||
| </html> | |||
| <script> | |||
| <?php /* alertify function */ ?> | |||
| function alertify_count_down($msg, $delay) | |||
| { | |||
| alertify.set({delay : $delay}); | |||
| alertify.log($msg); | |||
| } | |||
| function alertify_log($msg) | |||
| { | |||
| alertify.set({delay : 2000}); | |||
| alertify.log($msg); | |||
| } | |||
| function alertify_error($msg) | |||
| { | |||
| alertify.set({delay : 2000}); | |||
| alertify.error($msg); | |||
| } | |||
| function alertify_success($msg) | |||
| { | |||
| alertify.set({delay : 2000}); | |||
| alertify.success($msg); | |||
| } | |||
| function alertify_msg($msg) | |||
| { | |||
| alertify.set({ labels: { | |||
| ok : "確定" | |||
| } }); | |||
| alertify.alert($msg, function (e){ | |||
| // do nothing | |||
| }); | |||
| } | |||
| // 取得搜尋結果 | |||
| var PRODUCT_RESULT = {}; | |||
| PRODUCT_RESULT.product_id = '<?= $product_id; ?>'; | |||
| PRODUCT_RESULT.product_name = '<?= $product_name; ?>'; | |||
| PRODUCT_RESULT.product_desc = '<?= $product_desc; ?>'; | |||
| PRODUCT_RESULT.amt = '<?= $amt; ?>'; | |||
| PRODUCT_RESULT.remarks = '<?= $remarks; ?>'; | |||
| PRODUCT_RESULT.product_plan = '<?= $product_plan; ?>'; | |||
| if(PRODUCT_RESULT.product_id == '') | |||
| { | |||
| $("#not_found_product").text(''); | |||
| show_item("not_found"); | |||
| } | |||
| else | |||
| { | |||
| show_item("output_product"); | |||
| } | |||
| <?php /* 顯示指定項目 */ ?> | |||
| function show_item(tags) | |||
| { | |||
| $("#show_product_name").text(PRODUCT_RESULT.product_name); | |||
| $("#show_product_desc").text(PRODUCT_RESULT.product_desc); | |||
| $("#show_product_remarks").text(PRODUCT_RESULT.remarks); | |||
| $("#show_product_amt").text('NTD ' + PRODUCT_RESULT.amt + ' 元'); | |||
| $("#show_img").attr("src", "<?=SERVER_URL?>i3/pics/coffee.jpg"); | |||
| $("[data-items]").hide(); | |||
| $("[data-items="+tags+"]").show(); | |||
| return false; | |||
| } | |||
| $(document).ready(function() | |||
| { | |||
| <?php /* 鎖右鍵 */ ?> | |||
| $(document).bind('contextmenu', function (e) { | |||
| e.preventDefault(); | |||
| }); | |||
| }); | |||
| // 買 | |||
| function i_do(e) | |||
| { | |||
| e.preventDefault(); | |||
| $.ajax | |||
| ({ | |||
| url: "<?=APP_URL?>i_do/" + PRODUCT_RESULT.product_id, | |||
| dataType:"text", | |||
| type:"get", | |||
| data:{}, | |||
| success:function(result) | |||
| { | |||
| console.log(result); | |||
| } | |||
| }); | |||
| } | |||
| </script> | |||