Authored by yangyang

修改订单为空时,写入随便逛逛地址

... ... @@ -147,19 +147,20 @@ class HomeController extends AbstractAction
$currency = \Index\UserModel::getYohoCoinData($uid);
$this->setTitle('优惠券');
$this->setNavHeader('优惠券', true, SITE_MAIN);
// $uid = $this->getUid();
$uid = 8826435;
$coupons = array(
'couponsUrl' => array(
\Index\UserModel::getCouponData($uid, 0),
\Index\UserModel::getCouponData($uid, 1),
),
'couponsPage' => true
);
$this->setNavHeader('优惠券', true, SITE_MAIN);
// $uid = $this->getUid();
$uid = 8826435;
$coupons = array(
'couponsUrl' => array(
\Index\UserModel::getCouponData($uid, 0),
\Index\UserModel::getCouponData($uid, 1),
),
'couponsPage' => true
);
$this->_view->display('coupons', $coupons);
}
/**
* 优惠券
*/
... ... @@ -204,8 +205,8 @@ class HomeController extends AbstractAction
// $uid = $this->getUid();
$uid = 967016;
$address = \Index\UserModel::getAddressData($uid);
$addressList = \Index\UserModel::getAddressListData($uid);
$address = \Index\UserModel::getAddressData($uid);
$addressList = \Index\UserModel::getAddressListData($uid);
// print_r($address);
... ... @@ -213,61 +214,57 @@ class HomeController extends AbstractAction
'addressPage' => true,
'pageFooter' => true,
'address' => $address,
'addressList' => $addressList
'addressList' => $addressList
));
}
/**
* 修改地址或者添加新地址
*/
public function saveAddressAction()
{
$result = array();
if ($this->isAjax()) {
// $uid = $this->getUid();
$uid = 967016;
$address = $this->post('address', '');
$area_code = $this->post('area_code', '');
$consignee = $this->post('consignee', '');
$email = $this->post('email', '');
$id = $this->post('id', null);
$mobile = $this->post('mobile', '');
$zip_code = $this->post('zip_code', '');
$result = \Index\UserModel::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 设置默认地址
*/
public function defaultAddressAction()
{
$result = array();
if ($this->isAjax()) {
// $uid = $this->getUid();
$uid = 967016;
$id = $this->post('id', '');
$result = \Index\UserModel::setDefaultAddress($uid, $id);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 修改地址或者添加新地址
*/
public function saveAddressAction() {
$result = array();
if ($this->isAjax()) {
// $uid = $this->getUid();
$uid = 967016;
$address = $this->post('address', '');
$area_code = $this->post('area_code', '');
$consignee = $this->post('consignee', '');
$email = $this->post('email', '');
$id = $this->post('id', null);
$mobile = $this->post('mobile', '');
$zip_code = $this->post('zip_code', '');
$result = \Index\UserModel::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 设置默认地址
*/
public function defaultAddressAction() {
$result = array();
if ($this->isAjax()) {
// $uid = $this->getUid();
$uid = 967016;
$id = $this->post('id', '');
$result = \Index\UserModel::setDefaultAddress($uid, $id);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
//在线客服
public function onlineServiceAction() {
... ... @@ -289,8 +286,7 @@ class HomeController extends AbstractAction
$service = array();
$cateId = $this->get('cateId', 0);
$cateName = $this->get('cateName', '');
if ($cateId > 0)
{
if ($cateId > 0) {
$service = home\OnlineModel::getOnlineServiceDetail($cateId);
}
$this->setTitle('在线客服');
... ... @@ -412,11 +408,17 @@ class HomeController extends AbstractAction
$uid = '7566245'; //测试用
//调用模型层getOrder方法获得并处理数据
$data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid);
//如果没有订单数据,就给一个随便逛逛链接
$order = array();
if (!empty($data)) {
$order['orders'] = $data;
} else {
$order['walkwayUrl'] = 'http://www.baidu.com';
}
//渲染模板
$this->_view->display('order', array(
'order' => array(
'orders' => $data
)
'order' => $order
));
}
... ...
... ... @@ -39,7 +39,7 @@ class OrderModel
foreach ($data['data']['order_list'] as $key => $vo) {
//订单号,支付状态,订单商品数量,订单总价格
$result[$key]['orderNum'] = $vo['order_code'];
$result[$key]['tradingStatus'] = $vo['status_str'];
$result[$key]['orderStatus'] = $vo['status_str'];
$result[$key]['count'] = count($vo['order_goods']);
$result[$key]['sumCost'] = $vo['amount'] + $vo['shipping_cost'];
//订单商品列表数据
... ...