Esempio n. 1
0
 public function get_selffetch($pigcms_id, $store_id)
 {
     $condition_trade_selffetch['pigcms_id'] = $pigcms_id;
     $condition_trade_selffetch['store_id'] = $store_id;
     $selffetch = $this->db->where($condition_trade_selffetch)->find();
     if ($selffetch) {
         import('source.class.area');
         $area_class = new area();
         $selffetch['province_txt'] = $area_class->get_name($selffetch['province']);
         $selffetch['city_txt'] = $area_class->get_name($selffetch['city']);
         $selffetch['county_txt'] = $area_class->get_name($selffetch['county']);
     }
     return $selffetch;
 }
Esempio n. 2
0
 public function getMyAddress($uid)
 {
     $addresses = $this->db->where(array('uid' => $uid))->select();
     if (!empty($addresses)) {
         import('area');
         $areaClass = new area();
         foreach ($addresses as &$value) {
             $value['province_txt'] = $areaClass->get_name($value['province']);
             $value['city_txt'] = $areaClass->get_name($value['city']);
             $value['area_txt'] = $areaClass->get_name($value['area']);
         }
     }
     return $addresses;
 }
Esempio n. 3
0
 public function getCompanyByUid($uid)
 {
     $company = $this->db->where(array('uid' => $uid))->find();
     if ($company) {
         import('source.class.area');
         $area_class = new area();
         $company['province_code'] = $company['province'];
         $company['city_code'] = $company['city'];
         $company['area_code'] = $company['area'];
         $company['province'] = $area_class->get_name($company['province']);
         $company['city'] = $area_class->get_name($company['city']);
         $company['area'] = $area_class->get_name($company['area']);
         return $company;
     }
     return false;
 }
Esempio n. 4
0
 public function getListByIDList($physical_id_list)
 {
     if (empty($physical_id_list) || !is_array($physical_id_list)) {
         return array();
     }
     //$store_physical_list = $this->db->where(array('pigcms_id' => array('in', $physical_id_list)))->select();
     $store_physical_list = D('')->field("`s`.`buyer_selffetch_name`, `sp`.*")->table(array('Store' => 's', 'Store_physical' => 'sp'))->where("`s`.`store_id` = `sp`.`store_id` AND `sp`.`pigcms_id` in (" . join(',', $physical_id_list) . ")")->select();
     import('source.class.area');
     $area_class = new area();
     $return_data = array();
     foreach ($store_physical_list as $value) {
         $value['images_arr'] = explode(',', $value['images']);
         foreach ($value['images_arr'] as &$image_value) {
             $image_value = getAttachmentUrl($image_value);
         }
         $value['province_txt'] = $area_class->get_name($value['province']);
         $value['city_txt'] = $area_class->get_name($value['city']);
         $value['county_txt'] = $area_class->get_name($value['county']);
         $return_data[$value['pigcms_id']] = $value;
     }
     return $return_data;
 }
Esempio n. 5
0
 public function storeContactList($store_id_arr)
 {
     if (empty($store_id_arr) || !is_array($store_id_arr)) {
         return array();
     }
     $store_contact_list = D('')->table(array('Store' => 's', 'Store_contact' => 'sc'))->where("`s`.`store_id` IN (" . join(',', $store_id_arr) . ") AND `s`.`store_id` = `sc`.`store_id`")->field(`sc.*, s.name`)->select();
     import('area');
     $areaClass = new area();
     $return_data = array();
     foreach ($store_contact_list as $value) {
         $value['province_txt'] = $areaClass->get_name($value['province']);
         $value['city_txt'] = $areaClass->get_name($value['city']);
         $value['county_txt'] = $areaClass->get_name($value['county']);
         $value['logo'] = getAttachmentUrl($value['logo']);
         $return_data[$value['store_id']] = $value;
     }
     return $return_data;
 }
Esempio n. 6
0
 /**
  * 收货地址
  */
 function address()
 {
     if (empty($this->user_session)) {
         $referer = url('account:address');
         redirect(url('account:login', array('referer' => $referer)));
         exit;
     }
     // 实例化user_address_model
     $user_address_model = M('User_address');
     // 添加新收货地址
     if (IS_POST) {
         $name = $_POST['name'];
         $tel = $_POST['tel'];
         $province = $_POST['province'];
         $city = $_POST['city'];
         $area = $_POST['area'];
         $address = $_POST['address'];
         $default = $_POST['default'] + 0;
         if (empty($name)) {
             echo json_encode(array('status' => false, 'msg' => '收货人没有填写'));
             exit;
         }
         if (empty($tel) || !preg_match("/1[3458]{1}\\d{9}\$/", $tel)) {
             echo json_encode(array('status' => false, 'msg' => '手机号码格式不正确'));
             exit;
         }
         if (empty($province)) {
             echo json_encode(array('status' => false, 'msg' => '省份没有选择'));
             exit;
         }
         if (empty($city)) {
             echo json_encode(array('status' => false, 'msg' => '城市没有选择'));
             exit;
         }
         if (empty($area)) {
             echo json_encode(array('status' => false, 'msg' => '地区没有选择'));
             exit;
         }
         if (empty($address)) {
             echo json_encode(array('status' => false, 'msg' => '街道没有填写'));
             exit;
         }
         // 更新数据库操作,当有address_id时做更新操作,没有时做添加操作
         $data = array();
         $data['uid'] = $this->user_session['uid'];
         $data['name'] = $name;
         $data['tel'] = $tel;
         $data['province'] = $province;
         $data['city'] = $city;
         $data['area'] = $area;
         $data['address'] = $address;
         $data['default'] = $default;
         $address_id = $_POST['address_id'];
         $msg = '添加成功';
         if (!empty($address_id)) {
             $msg = '修改成功';
             // 更改记录条件
             $condition = array();
             $condition['uid'] = $this->user_session['uid'];
             $condition['address_id'] = $address_id;
             $user_address_model->save_address($condition, $data);
         } else {
             $data['add_time'] = time();
             $address_id = $user_address_model->add($data);
         }
         // 设置默认收货地址
         if ($default == 1) {
             $user_address_model->canelDefaultAaddress($this->user_session['uid'], $address_id);
         }
         import('area');
         $areaClass = new area();
         $data['province_txt'] = $areaClass->get_name($data['province']);
         $data['city_txt'] = $areaClass->get_name($data['city']);
         $data['area_txt'] = $areaClass->get_name($data['area']);
         $data['address_id'] = $address_id;
         echo json_encode(array('status' => true, 'msg' => $msg, 'data' => array('nexturl' => 'refresh', 'address' => $data)));
         exit;
     }
     $address_list = $user_address_model->getMyAddress($this->user_session['uid']);
     $this->assign('address_list', $address_list);
     $this->display();
 }
Esempio n. 7
0
 public function delivery_address()
 {
     import('source.class.area');
     $user_address = M('User_address');
     if (IS_POST && !empty($_POST['type'])) {
         $data = array();
         $data['name'] = isset($_POST['name']) ? trim($_POST['name']) : '';
         $data['tel'] = isset($_POST['tel']) ? trim($_POST['tel']) : '';
         $data['province'] = isset($_POST['province']) ? intval(trim($_POST['province'])) : '';
         $data['city'] = isset($_POST['city']) ? intval(trim($_POST['city'])) : '';
         $data['area'] = isset($_POST['area']) ? intval(trim($_POST['area'])) : '';
         $data['address'] = isset($_POST['address']) ? trim($_POST['address']) : '';
         $data['zipcode'] = isset($_POST['zipcode']) ? intval(trim($_POST['zipcode'])) : '';
         $data['add_time'] = time();
         $data['uid'] = $this->user_session['uid'];
         if ($address_id = $user_address->add($data)) {
             $address = new area();
             $address_detail = array();
             $address_detail['address_id'] = $address_id;
             $address_detail['province'] = $address->get_name($data['province']);
             $address_detail['city'] = $address->get_name($data['city']);
             $address_detail['area'] = $address->get_name($data['area']);
             $address_detail['address'] = $data['address'];
             json_return(0, $address_detail);
         } else {
             json_return(1001, '收货地址添加失败');
         }
     }
     //收货地址
     $tmp_addresses = $user_address->getMyAddress($this->user_session['uid']);
     $addresses = array();
     $address = new area();
     foreach ($tmp_addresses as $tmp_address) {
         $province = $address->get_name($tmp_address['province']);
         $city = $address->get_name($tmp_address['city']);
         $area = $address->get_name($tmp_address['area']);
         $addresses[] = array('address_id' => $tmp_address['address_id'], 'province' => $province, 'city' => $city, 'area' => $area, 'address' => $tmp_address['address']);
     }
     echo json_encode($addresses);
     exit;
 }
Esempio n. 8
0
     }
     break;
 case 'postage':
     if (IS_POST) {
         $address_id = $_POST['address_id'];
         $province_id = $_POST['province_id'];
         if (!empty($address_id)) {
             $nowAddress = D('User_address')->field('`province`')->where(array('address_id' => $_POST['address_id']))->find();
             if (empty($nowAddress)) {
                 json_return(1007, '该地址不存在');
             }
         } else {
             if (!empty($province_id)) {
                 import('area');
                 $areaClass = new area();
                 $province_txt = $areaClass->get_name($province_id);
                 if (empty($province_txt)) {
                     json_return(1007, '该地址不存在');
                 }
                 $nowAddress['province'] = $province_id;
             } else {
                 json_return(1007, '该地址不存在');
             }
         }
         $nowOrder = M('Order')->find($_POST['orderNo']);
         if (empty($nowOrder)) {
             json_return(1008, '该订单不存在');
         }
         if (empty($nowOrder['address'])) {
             //计算运费
             $postage_arr = array();
Esempio n. 9
0
 function address()
 {
     $order_id = $_GET['order_id'];
     if (empty($order_id)) {
         pigcms_tips('缺少最基本的参数');
     }
     $order = M('Order')->find($order_id);
     // 有收货地址不给更改收货地址
     if ($order['address']) {
         redirect(url('order:detail', array('order_id' => $order_id)));
     }
     if (empty($order)) {
         pigcms_tips('未找到相应的订单');
     }
     if ($order['uid'] != $this->user_session['uid']) {
         pigcms_tips('请您操作自己的订单');
     }
     if ($order['status'] > 1) {
         redirect(url('order:detail', array('order_id' => $order_id)));
     }
     $store = M('Store')->getStore($order['store_id']);
     // 优惠活动
     $product_id_arr = array();
     $store_id = 0;
     $uid = 0;
     $total_price = 0;
     $product_price_arr = array();
     $offline_payment = $store['offline_payment'];
     $is_all_selfproduct = true;
     $is_all_supplierproduct = true;
     foreach ($order['proList'] as $product) {
         // 分销商品不参与满赠和使用优惠券
         if ($product['source_product_id'] != '0') {
             $offline_payment = 0;
             $is_all_selfproduct = false;
             continue;
         } else {
             $is_all_supplierproduct = false;
         }
         $product_id_arr[] = $product['product_id'];
         $store_id = $product['store_id'];
         $uid = $product['uid'];
         // 单个商品总价
         $product_price_arr[$product['product_id']]['price'] = $product['pro_price'];
         // 每个商品购买数量
         $product_price_arr[$product['product_id']]['pro_num'] = $product['pro_num'];
         // 所有商品价格
         $total_price += $product['pro_price'] * $product['pro_num'];
     }
     import('source.class.Appmarket');
     $reward_arr = array();
     $reward_arr['product_id_arr'] = $product_id_arr;
     $reward_arr['store_id'] = $store_id;
     $reward_arr['uid'] = $uid;
     $product_arr = array();
     $product_arr['product_price_arr'] = $product_price_arr;
     $product_arr['total_price'] = $total_price;
     $reward_list = Appmarket::getAeward($reward_arr, $product_arr);
     // 第一步抽出用户购买的产品有哪些优惠券
     $user_coupon_list = M('User_coupon')->getListByProductId($reward_list['product_price_list'], $store_id, $uid);
     //print_r($user_coupon_list);
     // 第二步计算出用户购买原产品可以使用哪些优惠券
     $user_coupon_list = Appmarket::getCoupon($reward_list, $user_coupon_list);
     //print_r($reward_list);exit;
     if (IS_POST) {
         $shipping_method = $_POST['shipping_method'];
         $selffetch_id = $_POST['selffetch_id'];
         $address_user = $_POST['address_user'];
         $address_tel = $_POST['address_tel'];
         $address_time = $_POST['address_time'];
         $address_id = $_POST['address_id'];
         $comment = $_POST['comment'];
         $coupon_id = $_POST['coupon_id'];
         // 是否支付货到付款
         if ((!$store['offline_payment'] || !$is_all_selfproduct) && $_POST['payment_method'] == 'off') {
             echo json_encode(array('status' => false, 'msg' => '此订单不支持货到付款'));
             exit;
         }
         if (!empty($address_id) || !empty($selffetch_id) || $shipping_method == 'friend') {
             $data_order = array();
             if ($shipping_method == 'selffetch') {
                 //$selffetch = M('Trade_selffetch')->get_selffetch($selffetch_id, $order['store_id']);
                 // 判断是否为全部自营产品
                 if (!$is_all_selfproduct || !$store['buyer_selffetch']) {
                     $buyer_selffetch_name = $store['buyer_selffetch_name'] ? $store['buyer_selffetch_name'] : '上门自提';
                     echo json_encode(array('status' => false, 'msg' => '此订单不支持' . $buyer_selffetch_name));
                     exit;
                 }
                 $selffetch = array();
                 if (strpos($selffetch_id, 'store')) {
                     $selffetch = M('Store_contact')->get($order['store_id']);
                     if (!empty($selffetch)) {
                         $store = M('Store')->getStore($order['store_id']);
                         $selffetch['tel'] = ($selffetch['phone1'] ? $selffetch['phone1'] . '-' : '') . $selffetch['phone2'];
                         $selffetch['business_hours'] = '';
                         $selffetch['name'] = $store['name'];
                         $selffetch['physical_id'] = 0;
                         $selffetch['store_id'] = $order['store_id'];
                     }
                 } else {
                     $selffetch = M('Store_physical')->getOne($selffetch_id);
                     if (!empty($selffetch) && $selffetch['store_id'] != $order['store_id']) {
                         $selffetch = array();
                     } else {
                         if (!empty($selffetch)) {
                             $selffetch['tel'] = ($selffetch['phone1'] ? $selffetch['phone1'] . '-' : '') . $selffetch['phone2'];
                             $selffetch['physical_id'] = $selffetch_id;
                             $selffetch['store_id'] = $order['store_id'];
                         }
                     }
                 }
                 if (empty($selffetch)) {
                     echo json_encode(array('status' => false, 'msg' => '该门店不存在'));
                     exit;
                 }
                 $data_order['postage'] = '0';
                 $data_order['shipping_method'] = 'selffetch';
                 $data_order['address_user'] = $address_user;
                 $data_order['address_tel'] = $address_tel;
                 $data_order['address'] = serialize(array('name' => $selffetch['name'], 'address' => $selffetch['address'], 'province' => $selffetch['province_txt'], 'province_code' => $selffetch['province'], 'city' => $selffetch['city_txt'], 'city_code' => $selffetch['city'], 'area' => $selffetch['county_txt'], 'area_code' => $selffetch['county'], 'tel' => $selffetch['tel'], 'date' => substr($address_time, 0, 10), 'time' => substr($address_time, 11), 'long' => $selffetch['long'], 'lat' => $selffetch['lat'], 'business_hours' => $selffetch['business_hours'], 'store_id' => $selffetch['store_id'], 'physical_id' => $selffetch['physical_id']));
                 $data_order['comment'] = $comment;
                 $data_order['postage'] = 0;
                 // 到自提点将邮费设置为0
                 $order['postage'] = 0;
             } else {
                 if ($shipping_method == 'friend') {
                     if ($_POST['payment_method'] == 'off') {
                         echo json_encode(array('status' => false, 'msg' => '"送朋友"订单不支持货到付款'));
                         exit;
                     }
                     if (!$store['open_friend']) {
                         echo json_encode(array('status' => false, 'msg' => '店铺没有开启"送朋友"功能'));
                         exit;
                     }
                     if (empty($_POST['provinceId']) || empty($_POST['cityId']) || empty($_POST['areaId'])) {
                         echo json_encode(array('status' => false, 'msg' => '没有相应的收货地址'));
                         exit;
                     }
                     import('source.class.area');
                     $area_class = new area();
                     $address_arr = array();
                     $address_arr['address'] = $_POST['address'];
                     $address_arr['province'] = $area_class->get_name($_POST['provinceId']);
                     $address_arr['province_code'] = $_POST['provinceId'];
                     $address_arr['city'] = $area_class->get_name($_POST['cityId']);
                     $address_arr['city_code'] = $_POST['cityId'];
                     $address_arr['area'] = $area_class->get_name($_POST['areaId']);
                     $address_arr['area_code'] = $_POST['areaId'];
                     $data_order = array();
                     $data_order['address'] = serialize($address_arr);
                     $data_order['address_user'] = $_POST['address_user'];
                     $data_order['address_tel'] = $_POST['address_tel'];
                     $data_order['comment'] = $comment;
                     $data_order['shipping_method'] = 'friend';
                 } else {
                     if ($shipping_method == 'express') {
                         $address = M('User_address')->getAdressById('', $this->user_session['uid'], $address_id);
                         if (empty($address)) {
                             echo json_encode(array('status' => false, 'msg' => '没有相应的收货地址'));
                             exit;
                         }
                         $address_arr = array();
                         $address_arr['address'] = $address['address'];
                         $address_arr['province'] = $address['province_txt'];
                         $address_arr['province_code'] = $address['province'];
                         $address_arr['city'] = $address['city_txt'];
                         $address_arr['city_code'] = $address['city'];
                         $address_arr['area'] = $address['area_txt'];
                         $address_arr['area_code'] = $address['area'];
                         $data_order = array();
                         $data_order['address'] = serialize($address_arr);
                         $data_order['address_user'] = $address['name'];
                         $data_order['address_tel'] = $address['tel'];
                         $data_order['comment'] = $comment;
                         $data_order['shipping_method'] = 'express';
                     } else {
                         echo json_encode(array('status' => false, 'msg' => '确认收货地址失败'));
                         exit;
                     }
                 }
             }
             if (!empty($data_order)) {
                 $result = D('Order')->data($data_order)->where(array('order_id' => $order['order_id']))->save();
                 if ($result) {
                     // 用户享受的优惠券
                     $money = 0;
                     $pro_num = 0;
                     $pro_count = 0;
                     foreach ($reward_list as $key => $reward) {
                         if ($key === 'product_price_list') {
                             continue;
                         }
                         // 积分
                         if ($reward['score'] > 0) {
                             M('Store_user_data')->changePoint($order['store_id'], $this->user_session['uid'], $reward['score']);
                         }
                         // 送赠品
                         if (is_array($reward['present']) && count($reward['present']) > 0) {
                             foreach ($reward['present'] as $present) {
                                 $data_order_product = array();
                                 $data_order_product['order_id'] = $order['order_id'];
                                 $data_order_product['product_id'] = $present['product_id'];
                                 // 是否有属性,有则随机挑选一个属性
                                 if ($present['has_property']) {
                                     $sku_arr = M('Product_sku')->getRandSku($present['product_id']);
                                     $data_order_product['sku_id'] = $sku_arr['sku_id'];
                                     $data_order_product['sku_data'] = $sku_arr['propertiey'];
                                 }
                                 $data_order_product['pro_num'] = 1;
                                 $data_order_product['pro_price'] = 0;
                                 $data_order_product['is_present'] = 1;
                                 $pro_num++;
                                 if (!in_array($present['product_id'], $product_id_arr)) {
                                     $pro_count++;
                                 }
                                 D('Order_product')->data($data_order_product)->add();
                                 unset($data_order_product);
                             }
                         }
                         // 送优惠券
                         if ($reward['coupon']) {
                             $data_user_coupon = array();
                             $data_user_coupon['uid'] = $this->user_session['uid'];
                             $data_user_coupon['store_id'] = $reward['coupon']['store_id'];
                             $data_user_coupon['coupon_id'] = $reward['coupon']['id'];
                             $data_user_coupon['card_no'] = String::keyGen();
                             $data_user_coupon['cname'] = $reward['coupon']['name'];
                             $data_user_coupon['face_money'] = $reward['coupon']['face_money'];
                             $data_user_coupon['limit_money'] = $reward['coupon']['limit_money'];
                             $data_user_coupon['start_time'] = $reward['coupon']['start_time'];
                             $data_user_coupon['end_time'] = $reward['coupon']['end_time'];
                             $data_user_coupon['is_expire_notice'] = $reward['coupon']['is_expire_notice'];
                             $data_user_coupon['is_share'] = $reward['coupon']['is_share'];
                             $data_user_coupon['is_all_product'] = $reward['coupon']['is_all_product'];
                             $data_user_coupon['is_original_price'] = $reward['coupon']['is_original_price'];
                             $data_user_coupon['description'] = $reward['coupon']['description'];
                             $data_user_coupon['timestamp'] = time();
                             $data_user_coupon['type'] = 2;
                             $data_user_coupon['give_order_id'] = $order['order_id'];
                             D('User_coupon')->data($data_user_coupon)->add();
                         }
                         $data = array();
                         $data['order_id'] = $order['order_id'];
                         $data['uid'] = $this->user_session['uid'];
                         $data['rid'] = $reward['rid'];
                         $data['name'] = $reward['name'];
                         $data['content'] = serialize($reward);
                         $money += $reward['cash'];
                         D('Order_reward')->data($data)->add();
                     }
                     // 用户使用的优惠券
                     foreach ($user_coupon_list as $user_coupon) {
                         if ($user_coupon['id'] == $coupon_id) {
                             $data = array();
                             $data['order_id'] = $order['order_id'];
                             $data['uid'] = $this->user_session['uid'];
                             $data['coupon_id'] = $user_coupon['coupon_id'];
                             $data['name'] = $user_coupon['cname'];
                             $data['user_coupon_id'] = $coupon_id;
                             $data['money'] = $user_coupon['face_money'];
                             $money += $user_coupon['face_money'];
                             D('Order_coupon')->data($data)->add();
                             // 将用户优惠券改为已使用
                             $data = array();
                             $data['is_use'] = 1;
                             $data['use_time'] = time();
                             $data['use_order_id'] = $order['order_id'];
                             D('User_coupon')->where(array('id' => $coupon_id))->data($data)->save();
                             // 更新店铺相应优惠券使用数量
                             M('User_coupon')->updateCouponInfo($user_coupon['coupon_id']);
                             break;
                         }
                     }
                     // 更改订单金额
                     $total = max(0, $order['sub_total'] + $order['postage'] + $order['float_amount'] - $money);
                     $pro_count = $order['pro_count'] + $pro_count;
                     $pro_num = $order['pro_num'] + $pro_num;
                     $trade_no = date('YmdHis', $_SERVER['REQUEST_TIME']) . mt_rand(100000, 999999);
                     $data = array();
                     $data['trade_no'] = $trade_no;
                     $data['status'] = 1;
                     $data['total'] = $total;
                     $data['pro_count'] = $pro_count;
                     $data['pro_num'] = $pro_num;
                     if ($_POST['payment_method'] == 'off') {
                         $data['payment_method'] = 'codpay';
                         $data['status'] = 2;
                     }
                     D('Order')->where(array('order_id' => $order['order_id']))->data($data)->save();
                     echo json_encode(array('status' => true, 'msg' => '确认收货地址成功', 'data' => array('nexturl' => url('order:pay', array('order_id' => $order_id)))));
                     exit;
                 } else {
                     echo json_encode(array('status' => false, 'msg' => '确认收货地址失败'));
                     exit;
                 }
             } else {
                 echo json_encode(array('status' => false, 'msg' => '确认收货地址失败'));
                 exit;
             }
         } else {
             echo json_encode(array('status' => false, 'msg' => '确认收货地址失败'));
             exit;
         }
     }
     $address_list = '';
     if ($store['open_logistics']) {
         $address_list = M('User_address')->getMyAddress($this->user_session['uid']);
     }
     //店铺资料
     if (empty($store)) {
         pigcms_tips('您访问的店铺不存在', 'none');
     }
     //上门自提
     if ($store['buyer_selffetch'] && $is_all_selfproduct) {
         $selffetch_list = array();
         // M('Trade_selffetch')->getListNoPage($now_store['store_id']);
         $store_contact = M('Store_contact')->get($store['store_id']);
         $store_physical = M('Store_physical')->getList($store['store_id']);
         if ($store_contact) {
             $data = array();
             $data['pigcms_id'] = '99999999_store';
             $data['name'] = $store['name'] . '';
             $data['tel'] = ($store_contact['phone1'] ? $store['phone1'] . '-' : '') . $store_contact['phone2'];
             $data['province_txt'] = $store_contact['province_txt'] . '';
             $data['city_txt'] = $store_contact['city_txt'] . '';
             $data['county_txt'] = $store_contact['area_txt'] . '';
             $data['address'] = $store_contact['address'] . '';
             $data['business_hours'] = '';
             $selffetch_list[] = $data;
         }
         if ($store_physical) {
             foreach ($store_physical as $physical) {
                 $data = array();
                 $data['pigcms_id'] = $physical['pigcms_id'];
                 $data['name'] = $physical['name'] . '';
                 $data['tel'] = ($physical['phone1'] ? $physical['phone1'] . '-' : '') . $physical['phone2'];
                 $data['province_txt'] = $physical['province_txt'] . '';
                 $data['city_txt'] = $physical['city_txt'] . '';
                 $data['county_txt'] = $physical['county_txt'] . '';
                 $data['address'] = $physical['address'] . '';
                 $data['business_hours'] = $physical['business_hours'] . '';
                 $selffetch_list[] = $data;
             }
         }
         //$selffetch_list = M('Trade_selffetch')->getListNoPage($store['store_id']);
         $this->assign('selffetch_list', $selffetch_list);
     }
     $this->assign('address_list', $address_list);
     $this->assign('order', $order);
     $this->assign('reward_list', $reward_list);
     $this->assign('user_coupon_list', $user_coupon_list);
     $this->assign('store', $store);
     $this->assign('offline_payment', $offline_payment);
     $this->assign('is_all_selfproduct', $is_all_selfproduct);
     $this->assign('is_all_supplierproduct', $is_all_supplierproduct);
     $this->display();
 }
Esempio n. 10
0
     }
     if (!preg_match("/\\d{9,13}\$/", $friend_phone)) {
         json_return(1009, '请填写正确的手机号');
     }
     if (empty($province)) {
         json_return(1009, '请选择省份');
     }
     if (empty($city)) {
         json_return(1009, '请选择城市');
     }
     if (empty($county)) {
         json_return(1009, '请选择区县');
     }
     import('source.class.area');
     $area_class = new area();
     $province_txt = $area_class->get_name($province);
     $city_txt = $area_class->get_name($city);
     $county_txt = $area_class->get_name($county);
     if (empty($province_txt) || empty($city_txt)) {
         json_return(1009, '该地址不存在');
     }
     $data_order['total'] = $nowOrder['sub_total'];
     $data_order['shipping_method'] = 'friend';
     $data_order['address_user'] = $friend_name;
     $data_order['address_tel'] = $friend_phone;
     $data_order['address'] = serialize(array('address' => $friend_address, 'province' => $province_txt, 'province_code' => $province, 'city' => $city_txt, 'city_code' => $city, 'area' => $county_txt, 'area_code' => $county, 'date' => $friend_date, 'time' => $friend_time));
 } else {
     $address = M('User_address')->getAdressById(session_id(), $wap_user['uid'], $_POST['address_id']);
     if (empty($address)) {
         json_return(1009, '该地址不存在');
     }