/** * 查询卡券包模板列表 */ public function getVoucherTemplateList($where, $field = '*', $limit = 0, $page = 0, $order = '', $group = '') { $voucher_list = array(); if (is_array($page)) { if ($page[1] > 0) { $voucher_list = $this->table('voucher_template')->field($field)->where($where)->page($page[0], $page[1])->order($order)->group($group)->select(); } else { $voucher_list = $this->table('voucher_template')->field($field)->where($where)->page($page[0])->order($order)->group($group)->select(); } } else { $voucher_list = $this->table('voucher_template')->field($field)->where($where)->page($page)->order($order)->group($group)->select(); } //查询店铺分类 $store_class = uk86_rkcache('store_class', true); if (!empty($voucher_list) && is_array($voucher_list)) { foreach ($voucher_list as $k => $v) { if (!empty($v['voucher_t_customimg'])) { $v['voucher_t_customimg'] = UPLOAD_SITE_URL . DS . ATTACH_VOUCHER . DS . $v['voucher_t_store_id'] . DS . $v['voucher_t_customimg']; } else { $v['voucher_t_customimg'] = UPLOAD_SITE_URL . DS . uk86_defaultGoodsImage(240); } $v['voucher_t_limit'] = intval($v['voucher_t_limit']); $v['voucher_t_sc_name'] = $store_class[$v['voucher_t_sc_id']]['sc_name']; $voucher_list[$k] = $v; } } return $voucher_list; }
<div class="info"><a href="<?php echo uk86_urlShop('show_store', 'index', array('store_id' => $v['voucher_t_store_id'])); ?> " class="store"><?php echo $v['voucher_t_storename']; ?> </a> <p class="store-classify"><?php echo $v['voucher_t_sc_name']; ?> </p> <div class="pic"><img src="<?php echo $v['voucher_t_customimg']; ?> " onerror="this.src='<?php echo UPLOAD_SITE_URL . DS . uk86_defaultGoodsImage(240); ?> '"/></div> </div> <dl class="value"> <dt><?php echo $lang['currency']; ?> <em><?php echo $v['voucher_t_price']; ?> </em></dt> <dd>购物满<?php echo $v['voucher_t_limit']; ?> 元可用</dd>
public function templateeditOp() { $t_id = intval($_GET['tid']); if ($t_id <= 0) { $t_id = intval($_POST['tid']); } if ($t_id <= 0) { uk86_showMessage(Uk86Language::uk86_get('wrong_argument'), 'index.php?act=store_voucher&op=templatelist', 'html', 'error'); } $model = Model('voucher'); //查询模板信息 $param = array(); $param['voucher_t_id'] = $t_id; $param['voucher_t_store_id'] = $_SESSION['store_id']; $param['voucher_t_state'] = $this->templatestate_arr['usable'][0]; $param['voucher_t_giveout'] = array('elt', '0'); $param['voucher_t_end_date'] = array('gt', time()); $t_info = $model->table('voucher_template')->where($param)->find(); if (empty($t_info)) { uk86_showMessage(Uk86Language::uk86_get('wrong_argument'), 'index.php?act=store_voucher&op=templatelist', 'html', 'error'); } if ($isOwnShop = uk86_checkPlatformStore()) { Tpl::output('isOwnShop', true); } else { //查询套餐信息 $quotainfo = $model->table('voucher_quota')->where(array('quota_id' => $t_info['voucher_t_quotaid'], 'quota_storeid' => $_SESSION['store_id']))->find(); if (empty($quotainfo)) { uk86_showMessage(Uk86Language::uk86_get('voucher_template_quotanull'), 'index.php?act=store_voucher&op=quotaadd', 'html', 'error'); } } //查询面额列表 $pricelist = $model->table('voucher_price')->order('voucher_price asc')->select(); if (empty($pricelist)) { uk86_showMessage(Uk86Language::uk86_get('voucher_template_pricelisterror'), 'index.php?act=store_voucher&op=templatelist', 'html', 'error'); } if (uk86_chksubmit()) { //验证提交的内容面额不能大于限额 $obj_validate = new Uk86Validate(); $obj_validate->validateparam = array(array("input" => $_POST['txt_template_title'], "require" => "true", "validator" => "Length", "min" => "1", "max" => "50", "message" => Uk86Language::uk86_get('voucher_template_title_error')), array("input" => $_POST['txt_template_total'], "require" => "true", "validator" => "Number", "message" => Uk86Language::uk86_get('voucher_template_total_error')), array("input" => $_POST['select_template_price'], "require" => "true", "validator" => "Number", "message" => Uk86Language::uk86_get('voucher_template_price_error')), array("input" => $_POST['txt_template_limit'], "require" => "true", "validator" => "Double", "message" => Uk86Language::uk86_get('voucher_template_limit_error')), array("input" => $_POST['txt_template_describe'], "require" => "true", "validator" => "Length", "min" => "1", "max" => "255", "message" => Uk86Language::uk86_get('voucher_template_describe_error'))); $error = $obj_validate->uk86_validate(); //金额验证 $price = intval($_POST['select_template_price']) > 0 ? intval($_POST['select_template_price']) : 0; foreach ($pricelist as $k => $v) { if ($v['voucher_price'] == $price) { $chooseprice = $v; //取得当前选择的面额记录 } } if (empty($chooseprice)) { $error .= Uk86Language::uk86_get('voucher_template_pricelisterror'); } $limit = intval($_POST['txt_template_limit']) > 0 ? intval($_POST['txt_template_limit']) : 0; if ($price >= $limit) { $error .= Uk86Language::uk86_get('voucher_template_price_error'); } if ($error) { showDialog($error, 'reload', 'error'); } else { $update_arr = array(); $update_arr['voucher_t_title'] = trim($_POST['txt_template_title']); $update_arr['voucher_t_desc'] = trim($_POST['txt_template_describe']); if ($_POST['txt_template_enddate']) { $enddate = strtotime($_POST['txt_template_enddate']); if (!$isOwnShop && $enddate > $quotainfo['quota_endtime']) { $enddate = $quotainfo['quota_endtime']; } $update_arr['voucher_t_end_date'] = $enddate; } else { //如果没有添加有效期则默认为套餐的结束时间 if ($isOwnShop) { $update_arr['voucher_t_end_date'] = time() + 2592000; } else { $update_arr['voucher_t_end_date'] = $quotainfo['quota_endtime']; } } $update_arr['voucher_t_price'] = $price; $update_arr['voucher_t_limit'] = $limit; $update_arr['voucher_t_sc_id'] = intval($_POST['sc_id']); $update_arr['voucher_t_state'] = intval($_POST['tstate']) == $this->templatestate_arr['usable'][0] ? $this->templatestate_arr['usable'][0] : $this->templatestate_arr['disabled'][0]; $update_arr['voucher_t_total'] = intval($_POST['txt_template_total']) > 0 ? intval($_POST['txt_template_total']) : 0; $update_arr['voucher_t_points'] = $chooseprice['voucher_defaultpoints']; $update_arr['voucher_t_eachlimit'] = intval($_POST['eachlimit']) > 0 ? intval($_POST['eachlimit']) : 0; //自定义图片 if (!empty($_FILES['customimg']['name'])) { $upload = new Uk86UploadFile(); $upload->uk86_set('default_dir', ATTACH_VOUCHER . DS . $_SESSION['store_id']); $upload->uk86_set('thumb_width', '160'); $upload->uk86_set('thumb_height', '160'); $upload->uk86_set('thumb_ext', '_small'); $result = $upload->uk86_upfile('customimg'); if ($result) { //删除原图 if (!empty($t_info['voucher_t_customimg'])) { //如果模板存在,则删除原模板图片 @unlink(BASE_UPLOAD_PATH . DS . ATTACH_VOUCHER . DS . $_SESSION['store_id'] . DS . $t_info['voucher_t_customimg']); @unlink(BASE_UPLOAD_PATH . DS . ATTACH_VOUCHER . DS . $_SESSION['store_id'] . DS . str_ireplace('.', '_small.', $t_info['voucher_t_customimg'])); } $update_arr['voucher_t_customimg'] = $upload->file_name; } } $rs = $model->table('voucher_template')->where(array('voucher_t_id' => $t_info['voucher_t_id']))->update($update_arr); if ($rs) { showDialog(Uk86Language::uk86_get('nc_common_op_succ'), 'index.php?act=store_voucher&op=templatelist', 'succ'); } else { showDialog(Uk86Language::uk86_get('nc_common_op_fail'), 'index.php?act=store_voucher&op=templatelist', 'error'); } } } else { if (!$t_info['voucher_t_customimg'] || !file_exists(BASE_UPLOAD_PATH . DS . ATTACH_VOUCHER . DS . $_SESSION['store_id'] . DS . $t_info['voucher_t_customimg'])) { $t_info['voucher_t_customimg'] = UPLOAD_SITE_URL . DS . uk86_defaultGoodsImage(240); } else { $t_info['voucher_t_customimg'] = UPLOAD_SITE_URL . DS . ATTACH_VOUCHER . DS . $_SESSION['store_id'] . DS . str_ireplace('.', '_small.', $t_info['voucher_t_customimg']); } TPL::output('type', 'edit'); TPL::output('t_info', $t_info); //店铺分类 $store_class = uk86_rkcache('store_class', true); Tpl::output('store_class', $store_class); //查询店铺详情 $store_info = Model('store')->getStoreInfoByID($_SESSION['store_id']); TPL::output('store_info', $store_info); TPL::output('quotainfo', $quotainfo); TPL::output('pricelist', $pricelist); $this->profile_menu('templateedit', 'templateedit'); Tpl::showpage('store_voucher_template.add'); } }
</div> <script src="<?php echo RESOURCE_SITE_URL; ?> /js/waypoints.js"></script> <script src="<?php echo SHOP_RESOURCE_SITE_URL; ?> /js/search_category_menu.js"></script> <script type="text/javascript"> var defaultSmallGoodsImage = '<?php echo uk86_defaultGoodsImage(240); ?> '; var defaultTinyGoodsImage = '<?php echo uk86_defaultGoodsImage(60); ?> '; $(function(){ $('#files').tree({ expanded: 'li:lt(2)' }); //浮动导航 waypoints.js $('#main-nav-holder').waypoint(function(event, direction) { $(this).parent().toggleClass('sticky', direction === "down"); event.stopPropagation(); }); // 单行显示更多 $('span[nc_type="show"]').click(function(){
/** * 获取运单图片地址 */ function uk86_getMbSpecialImageUrl($image_name = '') { $name_array = explode('_', $image_name); if (count($name_array) == 2) { $image_path = DS . ATTACH_MOBILE . DS . 'special' . DS . $name_array[0] . DS . $image_name; } else { $image_path = DS . ATTACH_MOBILE . DS . 'special' . DS . $image_name; } if (is_file(BASE_UPLOAD_PATH . $image_path)) { return UPLOAD_SITE_URL . $image_path; } else { return UPLOAD_SITE_URL . '/' . uk86_defaultGoodsImage('240'); } }
/** * 取得U币商品缩略图的完整URL路径 * * @param string $imgurl 商品名称 * @param string $type 缩略图类型 值为small * @return string */ function uk86_pointprodThumb($image_name = '', $type = '') { if (!in_array($type, array('small', 'mid'))) { $type = ''; } if (empty($image_name)) { return UPLOAD_SITE_URL . '/' . uk86_defaultGoodsImage('240'); } if ($type) { $file_path = ATTACH_POINTPROD . DS . str_ireplace('.', '_' . $type . '.', $image_name); } else { $file_path = ATTACH_POINTPROD . DS . $image_name; } if (!file_exists(BASE_UPLOAD_PATH . DS . $file_path)) { return UPLOAD_SITE_URL . '/' . uk86_defaultGoodsImage('240'); } return UPLOAD_SITE_URL . DS . $file_path; }