'item_fee', 'value'=>15), /* 单件商品配送的价格 */ array('name' => 'base_fee', 'value'=>10), /* 1000克以内的价格 */ array('name' => 'step_fee', 'value'=>5), /* 续重每1000克增加的价格 */ ); /* 模式编辑器 */ $modules[$i]['print_model'] = 2; /* 打印单背景 */ $modules[$i]['print_bg'] = '/images/receipt/dly_zto.jpg'; /* 打印快递单标签位置信息 */ $modules[$i]['config_lable'] = 't_shop_province,' . $_LANG['lable_box']['shop_province'] . ',116,30,296.55,117.2,b_shop_province||,||t_customer_province,' . $_LANG['lable_box']['customer_province'] . ',114,32,649.95,114.3,b_customer_province||,||t_shop_address,' . $_LANG['lable_box']['shop_address'] . ',260,57,151.75,152.05,b_shop_address||,||t_shop_name,' . $_LANG['lable_box']['shop_name'] . ',259,28,152.65,212.4,b_shop_name||,||t_shop_tel,' . $_LANG['lable_box']['shop_tel'] . ',131,37,138.65,246.5,b_shop_tel||,||t_customer_post,' . $_LANG['lable_box']['customer_post'] . ',104,39,659.2,242.2,b_customer_post||,||t_customer_tel,' . $_LANG['lable_box']['customer_tel'] . ',158,22,461.9,241.9,b_customer_tel||,||t_customer_mobel,' . $_LANG['lable_box']['customer_mobel'] . ',159,21,463.25,265.4,b_customer_mobel||,||t_customer_name,' . $_LANG['lable_box']['customer_name'] . ',109,32,498.9,115.8,b_customer_name||,||t_customer_address,' . $_LANG['lable_box']['customer_address'] . ',264,58,499.6,150.1,b_customer_address||,||t_months,' . $_LANG['lable_box']['months'] . ',35,23,135.85,392.8,b_months||,||t_day,' . $_LANG['lable_box']['day'] . ',24,23,180.1,392.8,b_day||,||'; return; } class zto { /*------------------------------------------------------ */ //-- PUBLIC ATTRIBUTEs /*------------------------------------------------------ */ /** * 配置信息 */ var $configure; /*------------------------------------------------------ */ //-- PUBLIC METHODs /*------------------------------------------------------ */ /** * 构造函数 * * @param: $configure[array] 配送方式的参数的数组 * * @return null */ function zto($cfg = array()) { foreach ($cfg AS $key=>$val) { $this->configure[$val['name']] = $val['value']; } } /** * 计算订单的配送费用的函数 * * @param float $goods_weight 商品重量 * @param float $goods_amount 商品金额 * @param float $goods_number 商品件数 * @return decimal */ function calculate($goods_weight, $goods_amount, $goods_number) { if ($this->configure['free_money'] > 0 && $goods_amount >= $this->configure['free_money']) { return 0; } else { @$fee = $this->configure['base_fee']; $this->configure['fee_compute_mode'] = !empty($this->configure['fee_compute_mode']) ? $this->configure['fee_compute_mode'] : 'by_weight'; if ($this->configure['fee_compute_mode'] == 'by_number') { $fee = $goods_number * $this->configure['item_fee']; } else { if ($goods_weight > 1) { $fee += (ceil(($goods_weight - 1))) * $this->configure['step_fee']; } } return $fee; } } /** * 查询发货状态 * * @access public * @param string $invoice_sn 发货单号 * @return string */ function query($invoice_sn) { $str = '
'; return $str; } /** * 计算保价费用 * 保价费不低于100元,保价金额不得高于10000元,保价金额超过10000元的,超过的部分无效 * @access public * @param int $goods_amount 保价费用 * @param int $insure 保价比例 * * @return void */ function calculate_insure ($goods_amount, $insure) { if ($goods_amount > 10000) { $goods_amount = 10000; } $fee = $goods_amount * $insure; if ($fee < 100) { $fee = 100; } return $fee; } } ?>