Authored by yangyang

订单列表切换至新接口,订单总价数据暂时接口返回异常

... ... @@ -25,12 +25,10 @@ class OrderData
*/
static function getOrderData($type, $page, $limit, $uid) {
$param['limit'] = '10';
$param['page'] = 1;
$param['type'] = 1;
$param['uid'] = '12';
// $param['iscancel'] = false;
// $param['paymentStatus'] = 'Y';
$param['limit'] = $limit;
$param['page'] = $page;
$param['type'] = $type;
$param['uid'] = $uid;
return Yohobuy::jsonPost(Yohobuy::YOHOBUY_ORDER.'orderInfo/getOrderList',$param);
}
... ...
... ... @@ -24,23 +24,21 @@ class HomeController extends AbstractAction
/**
* 初始化
*/
public function init()
{
public function init() {
// 检查用户是否登录, 未登录则跳转到登录页
$uid = 8826435; //$this->getUid(true);
$action = $this->getRequest()->getActionName();
if (!$uid && $action !== 'index') {
$this->go(Helpers::url('/signin.html'));
}
parent::init();
}
/**
* 个人中心入口
*/
public function indexAction()
{
public function indexAction() {
// 设置网站标题
$this->setTitle('个人中心');
$this->setNavHeader('个人中心');
... ... @@ -66,8 +64,7 @@ class HomeController extends AbstractAction
/**
* 用户收藏的商品
*/
public function favoriteAction()
{
public function favoriteAction() {
// 设置网站标题
$this->setTitle('我的收藏');
$this->setNavHeader('我的收藏', true, SITE_MAIN);
... ... @@ -83,9 +80,9 @@ class HomeController extends AbstractAction
'pageFooter' => true,
'favorite' => true,
'hasFavProduct' => $favProducts,
'productUrl' => '/product/new',
'productUrl' => '/product/new',
'hasFavBrand' => $favBrands,
'brandUrl' => '/product/new'
'brandUrl' => '/product/new'
);
// 判断是否为品牌收藏页
if ($tab === 'brand') {
... ... @@ -98,8 +95,7 @@ class HomeController extends AbstractAction
/**
* 用户收藏的商品-删除
*/
public function favoriteDelAction()
{
public function favoriteDelAction() {
$result = array();
if ($this->isAjax()) {
... ... @@ -119,8 +115,7 @@ class HomeController extends AbstractAction
/**
* 个人信息
*/
public function personalDetailsAction()
{
public function personalDetailsAction() {
$this->setTitle('个人信息');
$this->setNavHeader('个人信息', true, SITE_MAIN);
... ... @@ -134,8 +129,7 @@ class HomeController extends AbstractAction
/**
* YOHO币
*/
public function currencyAction()
{
public function currencyAction() {
$this->setTitle('YOHO币');
$this->setNavHeader('YOHO币', true, false);
... ... @@ -149,8 +143,7 @@ class HomeController extends AbstractAction
/**
* 优惠券
*/
public function couponsAction()
{
public function couponsAction() {
$this->setTitle('优惠券');
$this->setNavHeader('优惠券', true, SITE_MAIN);
... ... @@ -158,8 +151,8 @@ class HomeController extends AbstractAction
$uid = 8826435;
$coupons = array(
'couponsUrl' => array(
'used' => \Index\UserModel::getCouponData($uid, 0),
'unused' => \Index\UserModel::getCouponData($uid, 1)
'used' => \Index\UserModel::getCouponData($uid, 0),
'unused' => \Index\UserModel::getCouponData($uid, 1)
),
'couponsPage' => true
);
... ... @@ -170,8 +163,7 @@ class HomeController extends AbstractAction
/**
* 我的消息
*/
public function messageAction()
{
public function messageAction() {
$uid = $this->getUid();
$page = $this->get('page', 0);
$size = $this->get('size', 10);
... ... @@ -184,8 +176,7 @@ class HomeController extends AbstractAction
/**
* 地址管理
*/
public function addressAction()
{
public function addressAction() {
// 设置网站标题
$this->setTitle('地址管理');
$this->setNavHeader('地址管理');
... ... @@ -205,8 +196,7 @@ class HomeController extends AbstractAction
/**
* 修改地址或者添加新地址
*/
public function saveAddressAction()
{
public function saveAddressAction() {
$result = array();
if ($this->isAjax()) {
... ... @@ -232,8 +222,7 @@ class HomeController extends AbstractAction
/**
* 设置默认地址
*/
public function defaultAddressAction()
{
public function defaultAddressAction() {
$result = array();
if ($this->isAjax()) {
... ... @@ -252,8 +241,7 @@ class HomeController extends AbstractAction
/**
* 删除地址
*/
public function delAddressAction()
{
public function delAddressAction() {
$result = array();
if ($this->isAjax()) {
... ... @@ -271,8 +259,7 @@ class HomeController extends AbstractAction
}
//在线客服
public function onlineServiceAction()
{
public function onlineServiceAction() {
// 设置网站标题
$this->setTitle('在线客服');
$this->setNavHeader('在线客服', true, SITE_MAIN);
... ... @@ -287,8 +274,7 @@ class HomeController extends AbstractAction
}
//在线客服-具体详情
public function onlineServiceDetailAction()
{
public function onlineServiceDetailAction() {
$service = array();
$cateId = $this->get('cateId', 0);
$cateName = $this->get('cateName', '');
... ... @@ -303,8 +289,7 @@ class HomeController extends AbstractAction
/**
* 我的逛
*/
public function myGuangAction()
{
public function myGuangAction() {
$page = $this->get('page', 1);
$limit = $this->get('limit', 10);
$uid = $this->getUid();
... ... @@ -327,8 +312,7 @@ class HomeController extends AbstractAction
/**
* 意见反馈
*/
public function suggestAction()
{
public function suggestAction() {
// 设置网站标题
$this->setTitle('意见反馈');
$this->setNavHeader('意见反馈', true, SITE_MAIN);
... ... @@ -350,8 +334,7 @@ class HomeController extends AbstractAction
/**
* 意见反馈-提交表单页面
*/
public function suggestSubAction()
{
public function suggestSubAction() {
// 设置网站标题
$this->setTitle('反馈问题');
... ... @@ -372,8 +355,7 @@ class HomeController extends AbstractAction
/**
* 异步上传图片
*/
public function suggestimgUploadAction()
{
public function suggestimgUploadAction() {
//$filename = $this->post('filename', '');
$result = UserModel::saveSuggestImg('fileData');
... ... @@ -383,8 +365,7 @@ class HomeController extends AbstractAction
/**
* 异步保存意见反馈数据
*/
public function savesuggestAction()
{
public function savesuggestAction() {
if ($this->isAjax()) {
$uid = $this->getUid();
$content = $this->post('content', '');
... ... @@ -399,8 +380,7 @@ class HomeController extends AbstractAction
/**
* 异步点击靠谱或者不靠谱
*/
public function upAndDownAction()
{
public function upAndDownAction() {
if ($this->isAjax()) {
$uid = $this->getUid();
$udid = $this->getUdid();
... ... @@ -414,8 +394,7 @@ class HomeController extends AbstractAction
/**
* 会员等级展示页
*/
public function gradeAction()
{
public function gradeAction() {
//设置网站seo信息
$this->setTitle('会员等级');
//显示网站导航头部信息
... ... @@ -430,23 +409,23 @@ class HomeController extends AbstractAction
/*
* 会员特权查看页
*/
public function preferentialAction()
{
public function preferentialAction() {
//设置网站seo信息
$this->setTitle('会员等级');
//显示网站导航头部信息
$this->setNavHeader('会员特权详情');
$data = GradeModel::getPreferential();
$data['pageFooter'] = true;
$this->_view->display('privilege', $data);
}
/*
* 我的订单页面,获得nav导航条焦点。并且异步请求订单详情列表页(getOrders)
*/
public function orderAction()
{
public function orderAction() {
//获得type值,type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论。
$type = $this->get('type', 1);
$this->setTitle('我的订单');
... ... @@ -466,17 +445,17 @@ class HomeController extends AbstractAction
}
//ajax请求订单页面
public function getOrdersAction()
{
public function getOrdersAction() {
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
}
//获取基本参数:type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论
//获取基本参数:type 1:全部 2:待付款 3:待发货 4:待收货 5:待评论 7:失败 取消 订单
$type = $this->get('type', 1);
$page = $this->get('page', 1);
$limit = $this->get('limit', 10);
$uid = $this->getUid();
$uid = '12';//测试数据
//调用模型层getOrder方法获得并处理数据
$data = OrderModel::getOrder($type, $page, $limit, $uid);
/* 如果取不到订单数据时,分两种情况:
... ... @@ -501,8 +480,7 @@ class HomeController extends AbstractAction
* 我的订单-取消订单
*/
public function cancelOrderAction()
{
public function cancelOrderAction() {
//判断是不是ajax请求
if (!$this->isAjax()) {
... ... @@ -524,8 +502,7 @@ class HomeController extends AbstractAction
* 我的订单-删除订单
*/
public function delOrderAction()
{
public function delOrderAction() {
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
... ... @@ -546,8 +523,7 @@ class HomeController extends AbstractAction
* 我的订单-支付链接获取
*/
private function paymentAction()
{
private function paymentAction() {
$gender = Helpers::getGenderByCookie();
$yh_channel = $this->get('yh_channel', 1);
OrderModel::payment($gender, $yh_channel);
... ... @@ -557,8 +533,7 @@ class HomeController extends AbstractAction
* 我的订单-随便逛逛链接获取
*/
private function strollAction()
{
private function strollAction() {
//获取性别、频道数据
$gender = Helpers::getGenderByCookie();
$yh_channel = $this->get('yh_channel', 1);
... ... @@ -570,8 +545,7 @@ class HomeController extends AbstractAction
/**
* 订单详情页
*/
public function orderDetailAction()
{
public function orderDetailAction() {
$data = array(
'name' => '毛毛莉Lydia',
'phoneNum' => '18600001133',
... ...
... ... @@ -40,28 +40,73 @@ class OrderModel
}
//调用接口获得数据
$data = OrderData::getOrderData($type, $page, $limit, $uid);
print_r($data);
//检查数据返回是否正常,正常则处理数据
if (!empty($data[0])) {
$result = array();
foreach($data as $key => $vo){
$result[$key]['detailUrl'] = $vo[''];
$result[$key]['orderNum'] = $vo['orderCode'];
$result[$key]['orderStatus'] = $vo['status'];
$result[$key]['count'] = count($vo['ordersGoodsList']);
$result[$key]['sumCost'] = $vo['amount'];
$result[$key]['sumCost'] = $vo['amount'];
switch ($vo['status']) {
case 1:
$result[$key]['sumCost'] = $vo['amount'];
break;
default:
break;
}
$result[$key]['sumCost'] = $vo['amount'];
}
foreach ($data as $key => $vo) {
if (empty($vo['ordersGoodsList'])) {
break;
}
$result[$key]['goods'] = self::formatOrderGoods($vo['ordersGoodsList']);
$result[$key]['detailUrl'] = '???';
$result[$key]['orderNum'] = $vo['orderCode'];
$result[$key]['count'] = count($vo['ordersGoodsList']);
$result[$key]['sumCost'] = $vo['goodsTotalAmount'];
do {
if ($vo['isCancel'] === 'Y') {
$result[$key]['canceled'] = true;
$result[$key]['orderStatus'] = '已取消';
break;
}
if ($vo['paymentType'] != 2) {
switch ($vo['ordersStatus']) {
case 0:
$result[$key]['unpaid'] = true;
$result[$key]['orderStatus'] = '待付款';
break;
//未发货&未收货 状态,统一合并到待收货状态。
case 1:
case 2:
case 3:
$result[$key]['orderStatus'] = '已付款';
$result[$key]['unreceived'] = true;
break;
case 4:
case 5:
$result[$key]['orderStatus'] = '已发货';
$result[$key]['unreceived'] = true;
//待收货状态,给查看物流url
$result[$key]['logisticsUrl'] = "暂无logisticsUrl数据";
break;
case 6:
$result[$key]['orderStatus'] = '交易成功';
$result[$key]['completed'] = true;
break;
default:
break;
}
} elseif ($vo['paymentType'] == 2) {
switch ($vo['ordersStatus']) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
$result[$key]['orderStatus'] = '备货中';
$result[$key]['unreceived'] = true;
//待收货状态,给查看物流url
$result[$key]['logisticsUrl'] = "暂无logisticsUrl数据";
break;
case 6:
$result[$key]['completed'] = true;
break;
default:
break;
}
}
} while (false);
}
}
if (USE_CACHE) {
... ... @@ -78,20 +123,33 @@ class OrderModel
}
//格式化订单商品
static function formatOrderGoods($orderGoods) {
static function formatOrderGoods($ordersGoodsList) {
$arr = array();
foreach ($orderGoods as $key => $vo) {
$arr[$key]['thumb'] = Helpers::getImageUrl($vo['goods_image'], 90, 120);
$arr[$key]['name'] = $vo['product_name'];
$arr[$key]['color'] = $vo['color_name'];
$arr[$key]['size'] = $vo['size_name'];
$arr[$key]['price'] = $vo['goods_price'];
$arr[$key]['count'] = $vo['buy_number'];
foreach ($ordersGoodsList as $key => $vo) {
$arr[$key]['thumb'] = Helpers::getImageUrl($vo['goodsImg'][0]['imageUrl'], 90, 120);
$arr[$key]['name'] = $vo['goodsName'];
$arr[$key]['color'] = $vo['colorName'];
$arr[$key]['size'] = $vo['sizeName'];
$arr[$key]['price'] = $vo['goodsPrice'];
$arr[$key]['count'] = $vo['num'];
//gift=>是否赠品,advanceBuy=>是否加价购;
if ($vo['goods_type'] == 'gift') {
$arr[$key]['gift'] = true;
} elseif ($vo['goods_type'] == 'price_gift') {
$arr[$key]['advanceBuy'] = true;
switch ($vo['goodsType']) {
case 1://普通商品
break;
case 2://商品的赠品
$arr[$key]['gift'] = true;
break;
case 3://订单的赠品
$arr[$key]['gift'] = true;
break;
case 4://商品满足条件加钱送
$arr[$key]['advanceBuy'] = true;
break;
case 5://订单满足条件价钱送
$arr[$key]['advanceBuy'] = true;
break;
default:
break;
}
}
return $arr;
... ...