Authored by hf

code review by hf: merge zhangzhen code to fixes home floor bugs

Showing 47 changed files with 1512 additions and 1346 deletions
... ... @@ -24,14 +24,13 @@ class Yohobuy
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
/* 测试环境 */
const API_URL = 'http://devapi.yoho.cn:58078/';
const SERVICE_URL = 'http://devservice.yoho.cn:58077/';
const API_URL = 'http://testapi.yoho.cn:28078/';
const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const YOHOBUY_ORDER = 'http://192.168.102.205:8084/order/'; //我的订单
const API_URL_MYCENTER = 'http://192.168.102.205:8081/users/'; // 我的个人中心接口URL
const YOHOBUY_ORDER = 'http://192.168.102.209:8084/order/'; //我的订单
const API_URL_MYCENTER = 'http://192.168.102.207:8081/users/'; // 我的个人中心接口URL
const API_URL_SHOPINGCART = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的购物车接口URL
const API_URL_PRODUCTDETAIL = 'http://192.168.102.205:8083/product/'; // 商品详情页
const API_URL_LOGISTICS = 'http://192.168.102.205:8080/gateway'; //查看物流接口URL
const API_URL_PRODUCTDETAIL = 'http://192.168.102.212:8083/product/'; // 商品详情页
/**
* 私钥列表
... ...
... ... @@ -18,7 +18,7 @@ class OrderData
* and open the template in the editor.
*/
static function getOrderData($type, $page, $limit, $gender, $yh_channel, $uid)
public static function getOrderData($type, $page, $limit, $gender, $yh_channel, $uid)
{
//构建必传参数
$param = Yohobuy::param();
... ... @@ -40,7 +40,7 @@ class OrderData
* and open the template in the editor.
*/
static function cancelOrderData($order_code, $uid, $gender, $yh_channel)
public static function cancelOrderData($order_code, $uid, $gender, $yh_channel)
{
//构建必传参数
$param = Yohobuy::param();
... ... @@ -60,7 +60,7 @@ class OrderData
* and open the template in the editor.
*/
static function deleteOrderData($order_code, $uid, $gender, $yh_channel)
public static function deleteOrderData($order_code, $uid, $gender, $yh_channel)
{
//构建必传参数
$param = Yohobuy::param();
... ... @@ -76,17 +76,18 @@ class OrderData
/*
* 我的订单-查看物流
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*
* @param int $orderCode 订单号
* @param int $uid 用户ID
* @return array
*/
static function LogisticsData()
public static function LogisticsData($orderCode, $uid)
{
//构建必传参数
$param = Yohobuy::param();
$param['method'] = 'app.express.li';
//$param['gender'] = $gender;
//$param['yh_channel'] = $yh_channel;
$param['order_code'] = $orderCode;
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
//调用接口获得数据
return Yohobuy::get(Yohobuy::API_URL, $param);
... ... @@ -96,7 +97,7 @@ class OrderData
* 支付url
* To change this template file, choose Tools | Templates
*/
static function paymentData($gender, $yh_channel, $code)
public static function paymentData($gender, $yh_channel, $code)
{
//构建必传参数
$param = Yohobuy::param();
... ... @@ -109,10 +110,11 @@ class OrderData
}
/*
* 随便逛逛url
* To change this template file, choose Tools | Templates
* 随便逛逛url
*
* 备注:暂不使用
*/
static function strollData($gender, $yh_channel, $code)
public static function strollData($gender, $yh_channel, $code)
{
//构建必传参数
$param = Yohobuy::param();
... ...
... ... @@ -21,6 +21,7 @@ class UserData
* 个人详情数据
*
* @param int $uid 用户ID
* @param int $udid 客户端唯一标识
* @return array 个人详情接口返回的数据
*/
public static function userData($uid)
... ... @@ -39,11 +40,12 @@ class UserData
* @param int $uid 用户ID
* @return array 接口返回的数据
*/
public static function infoNum($uid)
public static function infoNum($uid, $udid)
{
$param = Yohobuy::param();
$param['method'] = 'app.home.getInfoNum';
$param['uid'] = $uid;
$param['udid'] = $udid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
... ... @@ -189,7 +191,23 @@ class UserData
}
/**
* YOHO币数据
* YOHO币总数
*
* @param int $uid 用户ID
* @return array YOHO币接口返回的数据
*/
public static function yohoCoinTotal($uid)
{
$param = Yohobuy::param();
$param['method'] = 'app.yohocoin.total';
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* YOHO币列表数据
*
* @param int $uid 用户ID
* @param int $page 第几页,默认1
... ... @@ -431,4 +449,35 @@ class UserData
return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v1/help/getCategory', $param);
}
/**
* 帮助中心列表接口
*
* @return array 接口返回的数据
*/
public static function helpListData()
{
$param = Yohobuy::param();
$param['method'] = 'app.help.li';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 帮助详情接口
*
* @param string $code 具体一条帮助的code
* @return array 接口返回的数据
*/
public static function helpDetailData($code)
{
$param = Yohobuy::param();
$param['method'] = 'app.help.detail';
$param['return_type'] = 'html';
$param['code'] = $code;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param, true, true);
}
}
... ...
... ... @@ -313,7 +313,7 @@ class ListProcess
{
$fieldArr = array();
foreach ($array as $k => $v) {
$fieldArr[$k] = $v[$field];
$fieldArr[$k] = isset($v[$field]) ? $v[$field] : '';
}
$sort = $desc == false ? SORT_ASC : SORT_DESC;
array_multisort($fieldArr, $sort, $array);
... ...
... ... @@ -203,7 +203,7 @@ class Helpers
$result['product_id'] = $productData['product_id'];
$result['thumb'] = Images::getImageUrl($productData['default_images'], $width, $height);
$result['name'] = $productData['product_name'];
$result['price'] = empty($productData['market_price']) ? false : $productData['market_price'];
$result['price'] = empty($productData['market_price']) ? false : $productData['market_price'];
$result['salePrice'] = $productData['sales_price'];
if ($showPoint) {
$result['price'] && $result['price'] .= '.00';
... ... @@ -211,12 +211,12 @@ class Helpers
}
$result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y');
$result['url'] = SITE_MAIN . '/product/pro_' . $productData['product_id'] . '_'
. $productData['goods_list'][0]['goods_id']
. '/' . $productData['cn_alphabet'] . '.html';
. $productData['goods_list'][0]['goods_id']
. '/' . $productData['cn_alphabet'] . '.html';
// APP访问需要加附加的参数
// 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护
if ($isApp) {
$result['url'] .= '?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":'.$productData['product_skn'].'}}';
$result['url'] .= '?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":' . $productData['product_skn'] . '}}';
}
if ($showTags) {
... ... @@ -228,21 +228,19 @@ class Helpers
$result['tags']['midYear'] = isset($productData['mid-year']) && $productData['mid-year'] === 'Y'; // 年中
$result['tags']['yearEnd'] = isset($productData['year-end']) && $productData['year-end'] === 'Y'; // 年末
$result['tags']['is_advance'] = isset($productData['is_advance']) && $productData['is_advance'] === 'Y'; // 再到着
// 打折与即将售完组合显示打折
if ($result['is_soon_sold_out'] && $result['tags']['is_discount']) {
$result['tags']['is_new'] = false;
}
// 打折与其它组合则隐藏打折
elseif ($result['tags']['is_discount'] &&
($result['tags']['is_new'] || $result['tags']['is_limited'] || $result['tags']['is_yohood'] || $result['tags']['is_advance']) ) {
elseif ($result['tags']['is_discount'] &&
($result['tags']['is_new'] || $result['tags']['is_limited'] || $result['tags']['is_yohood'] || $result['tags']['is_advance'])) {
$result['tags']['is_discount'] = false;
}
}
// YOHOOD和新品组合显示YOHOOD
elseif ($result['tags']['is_yohood'] && $result['tags']['is_new']) {
$result['tags']['is_new'] = false;
}
}
return $result;
... ... @@ -287,7 +285,7 @@ class Helpers
$result['like']['count'] = $articleData['praise_num'];
$result['like']['isLiked'] = isset($articleData['isPraise']) && $articleData['isPraise'] === 'Y';
}
// 分享链接
$result['share'] = $isApp && isset($articleData['share']['url']) ? $articleData['share']['url'] : false;
... ... @@ -493,4 +491,25 @@ class Helpers
return false;
}
//格式化订单商品
public static function formatOrderGoods($orderGoods)
{
$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'];
//gift=>是否赠品,advanceBuy=>是否加价购;
if ($vo['goods_type'] == 'gift') {
$arr[$key]['gift'] = true;
} elseif ($vo['goods_type'] == 'price_gift') {
$arr[$key]['advanceBuy'] = true;
}
}
return $arr;
}
}
... ...
... ... @@ -123,6 +123,20 @@ function rePosFooter() {
}
}
/**
*
* add extra margin-bottom for footer to show yoho copyright when there is fixed bottom element on page
* @param {String} The jquery selecor of the fixed bottom element
* @return undefined
*/
function reMarginFooter(fixedElement) {
var fixedElH = $(fixedElement).outerHeight();
if (fixedElement) {
$footer.css('margin-bottom', fixedElH + 'px');
}
}
//页面通用底部位置及status设置
(function() {
var $op = $footer.children('.op-row');
... ... @@ -231,6 +245,8 @@ window.getShoppingKey = getShoppingKey;
window.rePosFooter = rePosFooter;
window.reMarginFooter = reMarginFooter;
});
define("js/category/entry", ["jquery","hammer","swiper","lazyload","index"], function(require, exports, module){
/**
... ... @@ -1592,7 +1608,7 @@ $('.overlay').on('touchstart', function(e) {
});
//点击一级导航,弹出二级导航
$sideNav.on('touchstart', 'li', function (e) {
$sideNav.on('touchstart', 'li', function(e) {
if ($(this).find('.sub-nav').size() > 0) {
$('.sub-nav').removeClass('show');
$(this).find('.sub-nav').addClass('show');
... ... @@ -1605,8 +1621,8 @@ $sideNav.on('touchstart', 'li', function (e) {
});
//返回一级导航,收起二级导航
$subNav.each(function () {
$(this).find('li').eq(0).on('touchstart', function (e) {
$subNav.each(function() {
$(this).find('li').eq(0).on('touchstart', function(e) {
$('.sub-nav').removeClass('show');
e.stopPropagation();
return false;
... ... @@ -1668,7 +1684,7 @@ if ($('.trend-topic-swiper').find('li').size() > 1) {
}
//潮流上装/经典裤装等轮播
$('.category-swiper').each(function (i, index) {
$('.category-swiper').each(function(i, index) {
swiperClass = 'category-swiper' + i;
$(this).addClass(swiperClass);
if ($('.' + swiperClass).find('.swiper-slide').size() > 1) {
... ... @@ -1684,7 +1700,7 @@ $('.category-swiper').each(function (i, index) {
});
//logo动画
requestFrame = (function () {
requestFrame = (function() {
var tempFunc = null,
prefixList = ['webkit', 'moz', 'ms'];
... ... @@ -1697,11 +1713,11 @@ requestFrame = (function () {
}
if (supportCss3) {
return function (callback) {
return function(callback) {
window[tempFunc](callback);
};
}
return function (callback) {
return function(callback) {
window.setTimeout(callback, 67);
};
})();
... ... @@ -1728,7 +1744,7 @@ function tsAnimate() {
if (start % 360 === 0) {
window.setTimeout(tsAnimate, 60 * 1000);
} else {
requestFrame(function () {
requestFrame(function() {
tsAnimate();
});
}
... ... @@ -1744,9 +1760,7 @@ $('.home-header .iconfont').on('touchstart', function() {
});
// 底部留出tab 的高度
$('#yoho-footer').css({
'margin-bottom': '2.5rem'
});
window.reMarginFooter('.footer-tab');
//set cookie
exports.set = function(c) {
... ... @@ -1755,6 +1769,7 @@ exports.set = function(c) {
domain: '.m.yohobuy.com'
});
};
});
define("js/home/maybe-like", ["jquery","hammer","lazyload"], function(require, exports, module){
/**
... ... @@ -3762,7 +3777,7 @@ var opt = {};
var paramStr = window.location.search.split('?')[1];
var keyVal = paramStr.split('&');
var keyVal = paramStr ? paramStr.split('&') : [];
var i, key, val;
... ... @@ -3773,52 +3788,25 @@ for (i = keyVal.length; i > 0; i--) {
key = key[0];
//初始化默认参数
switch (key) {
case 'gender':
opt.gender = val;
break;
case 'brand':
opt.brand = val;
break;
case 'sort':
opt.sort = val;
break;
case 'msort':
opt.msort = val;
break;
case 'misort':
opt.misort = val;
break;
case 'color':
opt.color = val;
break;
case 'size':
opt.size = val;
break;
case 'price':
opt.price = val;
break;
case 'discount':
opt.discount = val;
break;
case 'query':
opt.query = val;
break;
case 'style':
opt.style = val;
break;
case 'limit':
opt.limit = val;
break;
case 'channel':
opt.channel = val;
break;
case 'p_d':
opt.p_d = val;
opt[key] = val;
//discount = p_d,同时需要两个参数
if (key === 'discount' || key === 'p_d') {
opt.discount = val;
opt.p_d = val;
}
}
if (typeof opt.gender === 'undefined') {
switch (window.cookie('_Channel')) {
case 'boys':
opt.gender = '1,3';
break;
case 'dayLimit':
opt.dayLimit = val;
case 'girls':
opt.gender = '2,3';
break;
default:
opt.gender = '1,2,3';
}
}
... ... @@ -4698,7 +4686,8 @@ var goodsSwiper,
require("js/product/detail/desc");
require("js/product/detail/comments-consults");
//add extra marign-bottom for footer to show the yoho copyright
window.reMarginFooter('.cart-bar');
lazyLoad($('img.lazy'));
... ... @@ -4730,6 +4719,7 @@ $('.goodsDiscount .dropdown').on('click', function() {
}
});
require("js/product/detail/like");
});
define("js/product/detail/desc", ["jquery","lazyload","swiper","index"], function(require, exports, module){
/**
... ... @@ -5359,7 +5349,7 @@ var $navLi = $('#fav-tab > li'),
$brandLoadMore = $('.fav-brand-load-more'),
winH = $(window).height(),
$favProductList = $('.fav-product-list'),
$favBrandList = $('.fav-brand-swiper'),
$favBrandList = $('.fav-brand-swiper-wrapper'),
pageId = 1,
brandPageId = 1, //收藏品牌的当前页数
lockId = true,
... ... @@ -5703,7 +5693,7 @@ $likeBtn.bind('click', function() {
}).then(function(data) {
if (data.code === 200) {
$that.closest('.suggest-type').removeClass('show');
$('.suggest-good').addClass('show');
$that.closest('.suggest-item').find('.suggest-good').addClass('show');
}
}).fail(function(data) {
... ... @@ -5730,7 +5720,7 @@ $disLikeBtn.bind('click', function() {
}).then(function(data) {
if (data.code === 200) {
$that.closest('.suggest-type').removeClass('show');
$('.suggest-bad').addClass('show');
$that.closest('.suggest-item').find('.suggest-bad').addClass('show');
}
}).fail(function(data) {
... ... @@ -6668,7 +6658,7 @@ function couponAJAX(statu, page) {
url: '/home/couponData',
dataType: 'html',
data: {
statu: statu,
status: statu,
page: page
},
success: function(data) {
... ... @@ -6765,6 +6755,7 @@ $confim.on('touchend', '.cancel', function() {
$confim.hide();
}).on('touchend', '.confim', function() {
loading.showLoadingMask();
$confim.hide();
$.ajax({
method: 'POST',
url: '/home/delAddress',
... ... @@ -6777,15 +6768,15 @@ $confim.on('touchend', '.cancel', function() {
}
if (res.code !== 200) {
tip.show(res.message || '网络出了点问题~');
loading.hideLoadingMask();
} else {
window.location.reload();
}
}).fail(function() {
tip.show('网络出了点问题~');
loading.hideLoadingMask();
}).always(function() {
deleteId = null;
$confim.hide();
loading.hideLoadingMask();
});
});
... ... @@ -6809,7 +6800,7 @@ $action.on('touchend', '.del', function() {
$submit.on('touchend', function() {
if (security.hasDangerInput(false)) {
return false;
return false;
}
$addressForm.submit();
return false;
... ... @@ -6819,7 +6810,6 @@ $submit.on('touchend', function() {
$(this).removeClass('highlight');
});
});
define("js/me/browse-record", ["jquery","lazyload","handlebars","source-map","hammer"], function(require, exports, module){
/**
... ... @@ -6957,11 +6947,12 @@ var $addressForm = $('.edit-address'),
$submit = $('.submit'),
$editAddressPage = $('.my-edit-address-page'),
$addressListPage = $('.my-address-list-page'),
$area = $('.area'),
$footer = $('#yoho-footer'),
$backBtn = $('.nav-back'),
$navTitle = $('.nav-title'),
$input = $('input, textarea'),
navTitle = $navTitle.html(),
$area = $('.area'),
isSubmiting,
currentPage = 'edit',
newArea = [];
... ... @@ -6984,7 +6975,7 @@ $backBtn.on('touchend', function(e) {
// 恢复默认的三级选择
$addressListPage.hide();
$addressListPage.find('ul').hide();
$addressListPage.find('ul').hide().find('li').removeClass('highlight');
$addressListPage.children('ul').show().children('li').show();
newArea = [];
} else {
... ... @@ -7045,6 +7036,7 @@ $addressForm.on('submit', function() {
});
$submit.on('touchend', function() {
$input.blur();
$addressForm.submit();
return false;
}).on('touchstart', function() {
... ... @@ -7053,71 +7045,80 @@ $submit.on('touchend', function() {
$(this).removeClass('highlight');
});
// 省市区
$area.on('touchend', function() {
$editAddressPage.hide();
$addressListPage.show(1, function() {
$footer.hide();
});
currentPage = 'list';
$navTitle.html('地区选择');
$input.on('focus', function() {
$footer.hide();
}).on('blur', function() {
$footer.show();
});
// touchend 在下滑的时候会触发
// 省市区联动
$addressListPage.find('.address').each(function(i, elem) {
var addressHammer = new Hammer(elem);
// 省市区列表异步加载
$.get('/home/locationList').then(function(html) {
$addressListPage.html(html);
addressHammer.on('tap', function(e) {
var $this = $(e.target);
// 省市区
$area.on('touchend', function() {
$editAddressPage.hide();
$addressListPage.show(1, function() {
$footer.hide();
});
currentPage = 'list';
$navTitle.html('地区选择');
});
newArea.push($this.children('.caption').text());
$this.siblings().hide();
$this.children('ul').show().children('li').show();
// touchend 在下滑的时候会触发
// 省市区联动
$addressListPage.find('.address').each(function(i, elem) {
var addressHammer = new Hammer(elem);
$(this).removeClass('highlight');
e.srcEvent.preventDefault();
e.srcEvent.stopPropagation();
addressHammer.on('tap', function(e) {
var $this = $(e.target);
if (e.target.tagName.toLowerCase() !== 'li') {
$this = $this.parent('li');
}
newArea.push($this.children('.caption').text());
$this.siblings().hide();
$this.children('ul').show().children('li').show();
e.srcEvent.preventDefault();
e.srcEvent.stopPropagation();
});
});
});
$addressListPage.find('.address-last').each(function(i, elem) {
var addressLastHammer = new Hammer(elem);
$addressListPage.find('.address-last').each(function(i, elem) {
var addressLastHammer = new Hammer(elem);
addressLastHammer.on('tap', function(e) {
var $this = $(e.target);
addressLastHammer.on('tap', function(e) {
var $this = $(e.target);
// 填结果到 html
newArea.push($this.children('.caption').text());
$('[name="area"]').val(newArea.join(' '));
$('[name="area_code"]').val($this.data('id'));
// 填结果到 html
newArea.push($this.children('.caption').text());
$('[name="area"]').val(newArea.join(' '));
$('[name="area_code"]').val($this.data('id'));
$editAddressPage.show();
currentPage = 'edit';
$navTitle.html(navTitle);
$footer.show();
$editAddressPage.show();
currentPage = 'edit';
$navTitle.html(navTitle);
$footer.show();
// 恢复默认的三级选择
$addressListPage.hide();
$addressListPage.find('ul').hide();
$addressListPage.children('ul').show().children('li').show();
newArea = [];
// 恢复默认的三级选择
$addressListPage.hide();
$addressListPage.find('ul').hide().find('li').removeClass('highlight');
$addressListPage.children('ul').show().children('li').show();
newArea = [];
e.srcEvent.preventDefault();
e.srcEvent.stopPropagation();
e.srcEvent.preventDefault();
e.srcEvent.stopPropagation();
});
});
});
$addressListPage.on('touchstart', 'li', function() {
$(this).addClass('highlight');
}).on('touchend touchcancel', 'li', function() {
$(this).removeClass('highlight');
});
$('input, textarea').on('focus', function() {
$footer.hide();
}).on('blur', function() {
$footer.show();
$addressListPage.on('touchstart', 'li', function() {
$(this).addClass('highlight');
}).on('touchend touchcancel', 'li', function() {
$(this).removeClass('highlight');
});
}).fail(function() {
tip.show('获取省市区列表失败');
});
});
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -16,6 +16,7 @@ var $addressForm = $('.edit-address'),
$footer = $('#yoho-footer'),
$backBtn = $('.nav-back'),
$navTitle = $('.nav-title'),
$input = $('input, textarea'),
navTitle = $navTitle.html(),
$area = $('.area'),
isSubmiting,
... ... @@ -101,6 +102,7 @@ $addressForm.on('submit', function() {
});
$submit.on('touchend', function() {
$input.blur();
$addressForm.submit();
return false;
}).on('touchstart', function() {
... ... @@ -109,26 +111,26 @@ $submit.on('touchend', function() {
$(this).removeClass('highlight');
});
$('input, textarea').on('focus', function() {
$input.on('focus', function() {
$footer.hide();
}).on('blur', function() {
$footer.show();
});
// 省市区
$area.on('touchend', function() {
$editAddressPage.hide();
$addressListPage.show(1, function() {
$footer.hide();
});
currentPage = 'list';
$navTitle.html('地区选择');
});
// 省市区列表异步加载
$.get('/home/locationList').then(function(html) {
$addressListPage.html(html);
// 省市区
$area.on('touchend', function() {
$editAddressPage.hide();
$addressListPage.show(1, function() {
$footer.hide();
});
currentPage = 'list';
$navTitle.html('地区选择');
});
// touchend 在下滑的时候会触发
// 省市区联动
$addressListPage.find('.address').each(function(i, elem) {
... ... @@ -137,6 +139,9 @@ $.get('/home/locationList').then(function(html) {
addressHammer.on('tap', function(e) {
var $this = $(e.target);
if (e.target.tagName.toLowerCase() !== 'li') {
$this = $this.parent('li');
}
newArea.push($this.children('.caption').text());
$this.siblings().hide();
$this.children('ul').show().children('li').show();
... ...
/**
* 支付页面
* @author: 赵彪<bill.zhao@yoho.cn>
* @date: 2015/12/03
*/
function isWXOpen() {
var ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) === 'micromessenger') {
return true;
} else {
return false;
}
}
function hideWeChatPay() {
var payApps = document.getElementsByClassName('app');
[].forEach.call(payApps, function(app, index) {
if (app.innerHTML.indexOf('微信') !== -1) {
app.parentNode.style.display = 'none';
return false;
}
});
}
function handleForWX() {
if (isWXOpen()) {
hideWeChatPay();
}
}
window.onload = handleForWX;
... ...
... ... @@ -23,8 +23,9 @@
width: 16rem / $pxConvertRem;
height: 16rem / $pxConvertRem;
margin: 0 (8rem / $pxConvertRem);
background: #efefef;
background: #f0f0f0;
border-radius: 50%;
opacity: 1;
}
span.swiper-pagination-bullet-active {
... ... @@ -85,4 +86,4 @@
}
}
}
}
\ No newline at end of file
}
... ...
... ... @@ -23,7 +23,7 @@
display: inline-block;
max-width: pxToRem(380px);
overflow: hidden;
text-overflow: ellipsis;
text-overflow: ellipsis;
white-space: nowrap;
}
... ... @@ -37,10 +37,10 @@
}
.action {
font-size: pxToRem(32px);
font-size: pxToRem(40px);
line-height: pxToRem(60px);
text-align: right;
.edit,
.del {
display: inline-block;
... ... @@ -48,10 +48,6 @@
width: pxToRem(60px);
height: pxToRem(60px);
color: #999;
&:hover {
color: #666;
}
}
.edit {
... ... @@ -216,7 +212,7 @@
float: right;
color: #d0d0d0;
}
&.highlight {
background: #eee;
}
... ...
... ... @@ -23,7 +23,7 @@
}
}
}
#employ{
.employ-list{
width:100%;
height: auto;
overflow:hidden;
... ... @@ -42,21 +42,16 @@
float: left;
text-align: center;
line-height: 180rem / $pxConvertRem;
font-size: 50px;
font-size: 180em / $pxConvertRem;
}
p{
width: 55.517241%;
height: auto;
padding: 0 5% 18em / $pxConvertRem;
padding: 0 5% 18em / $pxConvertRem;;
float: left;
&:first-of-type{
padding-top: 0.75rem;
font-size: 18px;
height: 76rem / $pxConvertRem;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
padding-top:30em / $pxConvertRem;
font-size: 60em / $pxConvertRem;
}
}
i{
... ...
... ... @@ -126,7 +126,6 @@
.price-underline {
text-decoration: line-through;
margin-left: pxToRem(15px);
}
}
... ... @@ -171,14 +170,17 @@
}
&.del-fav {
width: 2rem;
height: 1.5rem;
line-height: 1.5rem;
$width: pxToRem(image_width(sprite-file($fav, fav-del)));
$height: pxToRem(image_height(sprite-file($fav, fav-del)));
@include rem-sprite($fav, fav-del);
width: $width;
height: $height;
position: absolute;
top: 50%;
margin-top: -0.75rem;
right: 0;
color: #666;
right: pxToRem(30px);
margin-top: -$height / 2;
}
}
}
... ... @@ -186,24 +188,6 @@
}
//品牌收藏
.fav-brand-swiper {
border-top: 1px solid #e0e0e0;
border-bottom: pxToRem(28px) solid #f0f0f0;
position: relative;
&:nth-of-type(1) {
border-top: 0;
}
&:after {
content: '';
position: absolute;
left: 0;
bottom: -2px;
border-top: 1px solid #e0e0e0;
display: block;
width: 100%;
height: 1px;
}
.swiper-header {
height: pxToRem(100px);
... ... @@ -255,30 +239,21 @@
}
}
.fav-more {
width: 2.5rem;
height: 2.5rem;
$width: pxToRem(image_width(sprite-file($fav, fav-more)));
$height: pxToRem(image_height(sprite-file($fav, fav-more)));
@include rem-sprite($fav, fav-more);
width: $width;
height: $height;
position: absolute;
top: 0;
right: 0;
&:after {
$width: pxToRem(image_width(sprite-file($fav, fav-more)));
$height: pxToRem(image_height(sprite-file($fav, fav-more)));
@include rem-sprite($fav, fav-more);
width: $width;
height: $height;
position: absolute;
top: 50%;
right: pxToRem(30px);
margin-top: -$height / 2;
content: '';
}
top: 50%;
right: pxToRem(30px);
margin-top: -$height / 2;
}
}
.swiper-container {
height: pxToRem(365px);
height: pxToRem(300px);
margin: 0 pxToRem(30px);
.swiper-slide {
... ... @@ -295,28 +270,9 @@
img {
display: block;
width: 100%;
height: pxToRem(300px);
height: 100%;
overflow: hidden;
}
.brand-product {
height: pxToRem(65px);
line-height: pxToRem(65px);
text-align: center;
font-size: pxToRem(22px);
color: #fff;
.price-discount {
span {
color: #d1021c
}
b {
color: #b0b0b0;
text-decoration: line-through;
font-weight: normal;
margin-left: pxToRem(13px);
}
}
}
}
}
}
... ...
... ... @@ -140,7 +140,6 @@
border-top: 1px solid #e0e0e0;
.type-item {
position: relative;
float: left;
color: #444;
font-size: pxToRem(28px);
... ... @@ -150,20 +149,6 @@
&.highlight {
background: #eee;
}
.num {
position: absolute;
padding: 0 pxToRem(8px);
top: 0;
right: pxToRem(40px);
min-width: pxToRem(16px);
font-size: pxToRem(24px);
line-height: pxToRem(32px);
color: #fff;
background: #F03D35;
text-align: center;
border-radius: pxToRem(20px);
}
}
.iconfont {
... ...
$vip: sprite-map("me/vip/*.png", $spacing: 10px);
$fav: sprite-map("me/fav/*.png", $spacing: 5px);
@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "fav", "suggest", "address", "online-service", "my-guang", "ihelp", "browse-record";
@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "fav", "suggest", "address", "online-service", "my-guang", "ihelp", "logistic";
... ...
... ... @@ -171,4 +171,4 @@
@extend %qa;
}
}
}
}
\ No newline at end of file
... ...
.pay-page {
padding: (40rem / $pxConvertRem) (20rem / $pxConvertRem) 0;
.box {
border: 1px solid #eee;
border-radius: 10rem / $pxConvertRem;
padding: (12rem / $pxConvertRem) (20rem / $pxConvertRem);
display: flex;
align-items: center;
margin-bottom: 20rem / $pxConvertRem;
> div {
min-height: 40rem / $pxConvertRem;
display: flex;
align-items: center;
}
.icon {
flex-grow: 0.3;
img {
width: 60rem / $pxConvertRem;
margin: 0;
}
}
.app {
flex-grow: 3;
font-size: 32rem / $pxConvertRem;
color: #414141;
//padding-left: 20rem/$pxConvertRem
}
.hint {
flex-grow: 4;
font-size: 24rem / $pxConvertRem;
color: #4b4b4b;
}
.iconfont {
flex-grow: 1;
justify-content: flex-end;
color: #e0e0e0;
font-size: 28rem / $pxConvertRem;
}
}
}
... ...
... ... @@ -38,16 +38,11 @@ $suggest: sprite-map("me/suggest/*.png",$spacing: 5px);
color: #444;
border-top: 1px solid #e0e0e0;
border-bottom: pxToRem(30px) solid #f0f0f0;
overflow: hidden;
.suggest-item-img {
width: 100%;
> img {
display: block;
overflow: hidden;
> img {
margin: 0 auto;
display: block;
max-width: 100%;
}
width: 100%;
}
> h2 {
... ... @@ -181,8 +176,7 @@ $suggest: sprite-map("me/suggest/*.png",$spacing: 5px);
.img-form {
padding: 0 pxToRem(30px);
padding-top: pxToRem(40px);
overflow: hidden;
float: left;
.upload-img-list {
float: left;
... ...
... ... @@ -16,7 +16,6 @@
.user-name {
font-size: 25rem / $pxConvertRem;
margin-right: 0.5rem;
}
.vip-icon {
... ...
... ... @@ -261,7 +261,13 @@
height: pxToRem(200px);
line-height: pxToRem(200px);
color: #e0e0e0;
font-size: 20px;
text-align: center;
span{
display: inline-block;
font-size: 20px;
padding-right: 5px;
}
}
}
}
... ...
... ... @@ -33,21 +33,15 @@ $basicBtnC:#eb0313;
line-height: pxToRem(36px);
&.table {
width: 100%;
// .row {
// display: table-row;
.column {
box-sizing: border-box;
display: table-cell;
padding: pxToRem(16px) pxToRem(12px);
padding: pxToRem(20px) pxToRem(12px);
width: 50%;
border-bottom: 1px solid #fff;
border-right: 1px solid #fff;
font-size: pxToRem(24px);
background-color: $tableCellC;
float: left;
// &:nth-child(even) {
// border-right: none;
// }
}
}
}
... ... @@ -89,7 +83,6 @@ $basicBtnC:#eb0313;
left: pxToRem(108px);
top: pxToRem(40px);
height: pxToRem(35px);
// width: pxToRem(70px);
color: #fff;
font-size: pxToRem(20px);
line-height: pxToRem(35px);
... ... @@ -100,8 +93,10 @@ $basicBtnC:#eb0313;
margin-left: .5px;
font-size: pxToRem(18px);
text-align: center;
line-height: pxToRem(30px);
padding: 0 8px;
line-height: pxToRem(24px);
position: relative;
vertical-align: middle;
padding:0 5px;
}
.new-tag {
background-color: #78dc7e;
... ... @@ -135,6 +130,12 @@ $basicBtnC:#eb0313;
background-color: #fff;
// overflow: hidden;
}
.banner-top-single{
height:pxToRem(600px);
width: pxToRem(448px);
margin:pxToRem(30px) pxToRem(72px);
overflow: hidden;
}
.banner-top {
// width: 100%;
min-height: 660rem / $pxConvertRem;
... ... @@ -161,14 +162,12 @@ $basicBtnC:#eb0313;
min-height: pxToRem(600px);
min-width: pxToRem(448px);
margin: pxToRem(30px) pxToRem(96px);
// position: relative;
overflow: hidden;
ul {
position: relative;
height: 100%;
li {
float: left;
// height: 100%;
}
}
}
... ... @@ -253,6 +252,7 @@ $basicBtnC:#eb0313;
vertical-align: middle;
display: inline-block;
line-height: pxToRem(88px);
padding-left: pxToRem(8px);
}
.vip-img {
width: pxToRem(53px);
... ... @@ -394,9 +394,10 @@ $basicBtnC:#eb0313;
// .recommend-for-you {
// margin-bottom: pxToRem(30px);
// }
.yoho-tip{
top:40%;
}
}
.bottom-blank{
height: pxToRem(120px);
}
@import "comments-consults";
@import "product-description";
... ...
... ... @@ -44,27 +44,24 @@
min-height: pxToRem(136px);
margin: pxToRem(10px) 0;
text-align: center;
display: flex;
align-items: center;
// width: 100%;
// border-bottom:1px solid $borderC;
img {
position:absolute;
top:0;
bottom:0;
left:0;
margin:auto;
//position:absolute;
//top:0;
//bottom:0;
//left:0;
//margin:auto;
//width: pxToRem(90px);
height: auto;
padding-right: pxToRem(20px);
//height: auto;
//padding-right: pxToRem(20px);
}
.material-image {
display: inline-block;
width: 23%;
min-height: pxToRem(136px);
float: left;
//background-size: 100%;
background-position-x: center;
background-repeat: no-repeat;
}
.material-desc {
//padding-left:pxToRem(120px);
... ... @@ -84,17 +81,17 @@
}
}
.wash-tips{
padding-top:pxToRem(18px);
padding-top:pxToRem(20px);
&.page-block{
// border-top: 0px;
padding-left: pxToRem(15px);
padding-right: pxToRem(15px);
}
// padding-bottom:pxToRem(18px);
.tip{
display: inline-block;
width: 16.6%;
float:left;
//min-height: pxToRem(120px);
// margin-right: pxToRem(24px);
img{
width: pxToRem(48px);
... ... @@ -106,7 +103,9 @@
padding: 0 pxToRem(13px);
font-size: pxToRem(18px);
line-height: pxToRem(22px);
margin-bottom: pxToRem(18px);
//margin-bottom: pxToRem(18px);
min-height: pxToRem(44px);
text-align:center;
}
}
... ... @@ -146,11 +145,12 @@
width: pxToRem(70px);
margin-top: pxToRem(66px);
.avatar {
line-height: pxToRem(40px);
// line-height: pxToRem(40px);
display: inline-block;
width: pxToRem(40px);
border-radius: 50%;
height: pxToRem(40px);
margin: pxToRem(18px) 0;
margin: pxToRem(12px) 0;
}
}
}
... ...
... ... @@ -2,7 +2,7 @@
<div class="my-address-page yoho-page">
<div class="my-edit-address-page page-wrap">
<form class="edit-address">
<input type="hidden" name="id" value="{{address.address_id}}">
<input type="hidden" name="id" value="{{address.id}}">
<label class="username">
收件人姓名
<input type="text" name="consignee" maxlength="20" value="{{address.consignee}}">
... ... @@ -18,7 +18,7 @@
<span class="iconfont">&#xe604;</span>
</label>
<label class="address">
详细地址
详细地址
<textarea name="address" maxlength="255">{{address.address}}</textarea>
</label>
... ... @@ -28,7 +28,6 @@
确认
</div>
</div>
<div class="my-address-list-page page-wrap hide">
</div>
{{> me/address/address-list}}
</div>
{{> layout/footer}}
{{> layout/footer}}
\ No newline at end of file
... ...
{{#coupons}}
<div class="employ-main" style="background:url('{{coupon_pic}}')">
<div class="employ-main" style="background-image:url('{{coupon_pic}}')">
<span>{{ money}}</span>
<p class="coupon-name">{{ coupon_name}}</p>
<p>{{ couponValidity}}</p>
<p>有效期:{{ couponValidity}}</p>
{{# used}}<i></i>{{/ used}}
</div>
{{/coupons}}
... ...
{{> layout/header}}
<div class="yoho-page">
<div class="employ">
<span class="active">未使用</span>
<span>已使用</span>
<div class="employ">
<span class="active">未使用</span>
<span>已使用</span>
</div>
{{# couponsUrl}}
<div class="employ-list">
{{# used}}
<div class="employ-main">
<span>{{ money}}</span>
<p>{{ coupon_name}}</p>
<p>{{ couponValidity}}</p>
</div>
{{/ used}}
{{^ used}}
<div class="null">
<i></i>
<p>您还没有优惠券!</p>
<a href="{{topURL}}">随便逛逛</a>
</div>
{{/ used}}
</div>
<div id="employ"></div>
<div class="employ-list not none">
{{# unused}}
<div class="employ-main">
<span>{{ money}}</span>
<p>{{ coupon_name}}</p>
<p>{{ couponValidity}}</p>
<i></i>
</div>
{{/ unused}}
{{^ unused}}
<div class="null">
<i></i>
<p>您还没有使用的优惠券!</p>
<a href="{{topURL}}">随便逛逛</a>
</div>
{{/ unused}}
</div>
{{/ couponsUrl}}
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -17,7 +17,7 @@
<div class="fav-load-more fav-load-background hide"></div>
</div>
<div class="fav-type">
<div class="fav-brand-swiper-wrapper"></div>
<div class="fav-brand-swiper"></div>
<div class="fav-content-loading"></div>
<div class="fav-null-box hide">
... ...
... ... @@ -28,7 +28,7 @@
{{#isLogin}}{{brand_favorite_total}}{{/isLogin}}
<p>收藏的品牌</p>
</a>
<a class="link-item" href="/home/record">
<a class="link-item" href="/home/">
{{#isLogin}}{{product_browse}}{{/isLogin}}
<p>浏览记录</p>
</a>
... ... @@ -44,23 +44,14 @@
<a class="type-item" href="/home/order?type=2">
<span class="iconfont">&#xe634;</span>
<br>待付款
{{#if pendingPaymentCount}}
<span class="num">{{pendingPaymentCount}}</span>
{{/if}}
</a>
<a class="type-item" href="/home/order?type=3">
<span class="iconfont">&#xe63b;</span>
<br>待发货
{{#if dueOutGoodsCount}}
<span class="num">{{dueOutGoodsCount}}</span>
{{/if}}
</a>
<a class="type-item" href="/home/order?type=4">
<span class="iconfont">&#xe633;</span>
<br>待收货
{{#if dueInGoodsCount}}
<span class="num">{{dueInGoodsCount}}</span>
{{/if}}
</a>
</div>
</div>
... ... @@ -103,7 +94,7 @@
</a>
</div>
<div class="group-list">
<a class="list-item" href="/help.html">
<a class="list-item" href="/home/IHelp">
<span class="iconfont icon">&#xe639;</span>
帮助
<span class="iconfont num">&#xe604;</span>
... ... @@ -115,4 +106,4 @@
</div>
{{> layout/download_app}}
{{> layout/footer}}
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -2,7 +2,7 @@
<div class="logistic-page yoho-page">
<div class="overview">
<div class="left" >
<div class="icon" style='background-image:url("{{logisticImg}}")'> </div>
<a href="{{logisticUrl}}"><div class="icon" style='background-image:url("{{logisticImg}}")'></div></a>
</div>
<div class="right">
... ... @@ -28,7 +28,7 @@
<span class="timeline-node"></span>
<div class="timeline-info">
<div class="timeline-info-row">
{{ city}}&nbsp;&nbsp;&nbsp;{{ status}}
{{status}}
</div>
<div class="timeline-info-row">
{{date}}
... ...
{{> layout/header}}
<div class="online-service-detail-page yoho-page">
<div class="qa-list">
{{# service}}
{{# list}}
<div class="question-item">
<div class="question">Q:{{q}}</div>
<div class="answer">{{a}}</div>
</div>
{{/ list}}
{{/ service}}
{{/ list}}
</div>
</div>
{{> layout/footer}}
{{> layout/footer}}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="pay-page yoho-page">
{{# payAppInfo}}
<div class="box">
<div class="icon">
<img src="{{appIcon}}" alt="app图标">
</div>
<div class="app">{{app}}</div>
<div class="hint">
{{hint}}
{{#if subHint}}
<br>
{{subHint}}
{{/if}}
</div>
<div class="iconfont">&#xe604</div>
</div>
{{/ payAppInfo}}
</div>
{{> layout/footer}}
... ...
... ... @@ -10,20 +10,18 @@
{{# suggestContent}}
<div class="suggest-item" data-id="{{suggest_id}}">
{{#if imgUrl}}
<div class="suggest-item-img">
<img class="lazy" data-original="{{imgUrl}}" alt=""/>
</div>
{{/if}}
<h2>{{title}}</h2>
<p>{{content}}</p>
<div class="suggest-type suggest-good {{#good}}show{{/good}}">
<div class="suggest-type suggest-good">
<div class="active">
<span class="iconfont">&#xe601;</span>
<span>靠谱,谢谢您的反馈</span>
</div>
</div>
<div class="suggest-type suggest-bad {{# bad}}show{{/ bad}}">
<div class="suggest-type suggest-bad">
<div class="active">
<span class="iconfont">&#xe601;</span>
<span>不靠谱,谢谢您的反馈</span>
... ...
... ... @@ -2,7 +2,6 @@
<div class="good-detail-page yoho-page">
<div class="banner-container">
<div class="tag-container">
<!-- <p class="good-tag new-tag">NEW</p> -->
{{# tags}}
{{# is_new}}
<p class="good-tag new-tag">NEW</p>
... ... @@ -56,7 +55,7 @@
<ul class="vip-level clearfix">
{{# list}}
<li class="icons-item">
<span class="vip-img" style="background-size:cover;">
<span class="vip-img" style="background-size:contain;">
</span>
<span class="vip-price">{{text}}</span>
</li>
... ... @@ -114,7 +113,6 @@
{{/ enterStore}}
<div id="productDesc"> </div>
<!-- {{> product/product-description}} -->
{{> product/recommend-for-you}}
{{#cartInfo}}
... ...
... ... @@ -22,7 +22,10 @@
<ul class="swiper-wrapper swiper-wrapper-{{id}}">
{{# productList}}
<li class="swiper-slide">
<img class="swiper-lazy" data-src="{{imgUrl}}" alt=""/>
<a href="{{link}}">
<img class="swiper-lazy" data-src="{{imgUrl}}" alt=""/>
</a>
<div class="brand-product">
<div class="{{# discount}}price-discount{{/ discount}}">
{{# discount}}<span>{{.}}<span>{{/ discount}}
... ...
... ... @@ -15,7 +15,7 @@
{{# savePrice}}
<div class="save-price save-price-number">
比收藏时降价了<span>{{.}}</span>
<span class="del-fav"></span>
<span class="del-fav iconfont">&#xe621;</span>
</div>
{{/ savePrice}}
... ...
... ... @@ -277,14 +277,11 @@
</script>
{{/if}}
{{#if browseRecordPage}}
<<<<<<< HEAD
<script>
seajs.use('js/me/browse-record');
</script>
{{/if}}
{{#if logisticInfoPage}}
=======
>>>>>>> feature/hf
<script>
seajs.use('js/me/logistic');
</script>
... ...
... ... @@ -44,7 +44,7 @@
</div>
<div class="answer">
<span class="iconfont">&#xe63c;</span>
<span class="iconfont">&#xe63d;</span>
<p>{{answer}}</p>
</div>
{{/ consults}}
... ... @@ -56,7 +56,7 @@
</div>
{{else}}
<div class="consult-content-main content-main no-item">
<span class="iconfont">&#xe63c;</span>暂无咨询
<span class="iconfont">&#xe63d;</span>暂无咨询
</div>
<div class="consult-content-footer">
<a href="/product/detail/consultform">
... ...
... ... @@ -105,7 +105,9 @@
<p class="material-desc">
{{desc}}
</p>-->
<div class="material-image" style="background-image:url({{img}})"></div>
<div class="material-image">
<img src="{{img}}" alt="材质图">
</div>
<div class="material-desc">
{{desc}}
</div>
... ...
... ... @@ -18,720 +18,769 @@ use Index\UserModel as UserModel;
class HomeController extends AbstractAction
{
protected $_uid;
/**
* 初始化
*/
public function init() {
// 检查用户是否登录, 未登录则跳转到登录页
// @todo 为了方便测试,支持传uid参数
$this->_uid = $this->getUid();
// if (!$uid) {
// $uid = $this->_uid = $this->get('uid', 7394907); //$this->getUid(true);
// }
$action = $this->getRequest()->getActionName();
$excludeActions = array(
'index',
'onlineservice',
'suggest',
'suggestsub',
'suggestimgupload',
);
if (!$this->_uid && !in_array($action, $excludeActions) && !$this->isAjax()) {
$this->go(Helpers::url('/signin.html'));
}
parent::init();
}
/**
* 个人中心入口
*/
public function indexAction() {
// 设置网站标题
$this->setTitle('个人中心');
$this->setNavHeader('个人中心');
$data = array(
'myIndexPage' => true,
'showDownloadApp' => true,
'pageFooter' => true
);
if ($this->_uid) {
$data['isLogin'] = true;
$data += UserModel::getUserProfileData($this->_uid);
$data += UserModel::getInfoNumData($this->_uid);
// 优选新品数据
$channel = Helpers::getChannelByCookie();
$data['recommendForYou'] = UserModel::getPreferenceData($channel);
}
$this->_view->display('index', $data);
}
/**
* 为您优选
*/
public function preferenceAction()
{
$result = array();
if ($this->isAjax()) {
// 优选新品数据
$channel = Helpers::getChannelByCookie();
$result = UserModel::getPreferenceData($channel);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('recommend-content', $result);
}
}
/**
* 用户收藏的商品
*/
public function favoriteAction() {
// 设置网站标题
$this->setTitle('我的收藏');
$this->setNavHeader('我的收藏', true, SITE_MAIN);
$tab = $this->get('tab', '');
$data = array(
'favPage' => true, //加载js
'pageFooter' => true,
'favorite' => true,
'productUrl' => '/product/new',
'brandUrl' => '/product/new',
);
// 判断是否为品牌收藏页
if ($tab === 'brand') {
$data['brandTab'] = true;
}
$this->_view->display('favorite', $data);
}
/**
* 用户收藏的商品数据获取接口
*/
public function favProductAction() {
$result = array();
if ($this->isAjax()) {
$page = $this->post('page', 1);
$result = UserModel::getFavProductData($this->_uid, $page, 10);
}
if (empty($result)) {
echo ' ';
} else if (isset($result['end'])) {
echo 'end';
} else {
$this->_view->display('favorite_product', $result);
}
}
/**
* 用户收藏的品牌数据获取接口
*/
public function favBrandAction() {
$result = array();
if ($this->isAjax()) {
$page = $this->post('page', 1);
$result = UserModel::getFavBrandData($this->_uid, 10, $page, 10);
}
if (empty($result)) {
echo ' ';
} else if (isset($result['end'])) {
echo 'end';
} else {
$this->_view->display('favorite_brand', $result);
}
}
/**
* 用户收藏的商品-删除
*/
public function favoriteDelAction() {
$result = array();
if ($this->isAjax()) {
$fav_id = $this->post('id', 0);
$result = UserModel::favoriteDelete($this->_uid, $fav_id);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 浏览记录页面
*/
public function recordAction()
{
// 设置网站标题
$this->setTitle('浏览记录');
$this->setNavHeader('浏览记录', true, SITE_MAIN);
$this->_view->display('browse-record', array(
'browseRecordPage' => true
));
}
/**
* 浏览记录
*/
public function recordContentAction()
{
$result = array();
if ($this->isAjax()) {
$udid = $this->getUdid();
$page = $this->get('page', 1);
$limit = $this->get('limit', 100);
$result = UserModel::browserRecord($this->_uid, $udid, $page, $limit);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('browse-record-content', $result);
}
}
/**
* 删除浏览记录
*/
public function delRecordAction()
{
$result = array();
if ($this->isAjax()) {
$skn = $this->get('skn', 0);
$result = UserModel::delRecord($this->_uid, $skn);
}
$this->echoJson($result);
}
/**
* 个人信息
*/
public function mydetailsAction() {
$this->setTitle('个人信息');
$this->setNavHeader('个人信息');
$data = UserModel::getUserProfileData($this->_uid);
$data['personalDetailsPage'] = true;
$data['pageFooter'] = true;
$this->_view->display('personal-details', $data);
}
/**
* YOHO币
*/
public function currencyAction() {
$this->setTitle('YOHO币');
$this->setNavHeader('YOHO币', true, false);
$currency = UserModel::getYohoCoinData($this->_uid);
$currency['pageFooter'] = true;
$this->_view->display('currency', $currency);
}
/**
* 优惠券
*/
public function couponsAction() {
$this->setTitle('优惠券');
$this->setNavHeader('优惠券', true, SITE_MAIN);
$coupons = array(
'couponsPage' => true,
'pageFooter' => true
);
$this->_view->display('coupons', $coupons);
}
/**
* 异步获取指定状态的优惠券数据
*/
public function couponDataAction() {
$result = array();
if ($this->isAjax()) {
$status = $this->post('status', 0);
$page = $this->post('page', 1);
$result = UserModel::getCouponData($this->_uid, $status, $page);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('coupon_list', $result);
}
}
/**
* 我的消息
*
* 暂时使用老的,因后面APP、PC、WAP会进行一次改版
*/
/*public function messageAction() {
$page = $this->get('page', 1);
$size = $this->get('size', 10);
$messages = UserModel::getMessageData($this->_uid, $page, $size);
print_r($messages);
}*/
/**
* 异步获取三级地址数据
*/
public function locationListAction() {
$result = array();
if ($this->isAjax()) {
$result['addressList'] = UserModel::getAddressListData($this->_uid);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('location-list', $result);
}
}
/**
* 地址管理
*/
public function addressAction() {
// 设置网站标题
$this->setTitle('地址管理');
$this->setNavHeader('地址管理');
$address = UserModel::getAddressData($this->_uid);
$this->_view->display('address', array(
'addressPage' => true,
'pageFooter' => true,
'address' => $address,
'showAddBtn' => (count($address) <= 5)
));
}
/**
*
* 地址编辑或添加页面
*/
public function addressActAction() {
$id = $this->get('id', null);
$data = array(
'addressActionPage' => true,
'pageFooter' => true,
'addressList' => UserModel::getAddressListData($this->_uid)
);
if ($id !== null) { // 编辑地址
// 设置网站标题
$this->setTitle('编辑地址');
$this->setNavHeader('编辑地址');
$data['id'] = $id;
// 获取特定地址的数据
$data['address'] = UserModel::getAddressDataById($this->_uid, $id);
} else {
// 设置网站标题
$this->setTitle('添加地址');
$this->setNavHeader('添加地址');
}
$this->_view->display('address-act', $data);
}
/**
* 修改地址或者添加新地址
*/
public function saveAddressAction() {
$result = array();
if ($this->isAjax()) {
$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 = UserModel::saveAddressData($this->_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()) {
$id = $this->post('id', '');
$result = UserModel::setDefaultAddress($this->_uid, $id);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 删除地址
*/
public function delAddressAction() {
$result = array();
if ($this->isAjax()) {
$id = $this->post('id', '');
$result = UserModel::deleteAddress($this->_uid, $id);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 在线客服
*/
public function onlineServiceAction() {
// 设置网站标题
$this->setTitle('在线客服');
$this->setNavHeader('在线客服', true, SITE_MAIN);
$service = Home\OnlineModel::getOnlineServiceInfo();
$this->_view->display('online-service', array(
'onlineServicePage' => true,
'pageFooter' => true,
'service' => $service
));
}
/**
* 在线客服-具体详情
*/
public function onlineServiceDetailAction() {
$service = array();
$cateId = $this->get('cateId', 0);
$cateName = $this->get('cateName', '');
if ($cateId > 0) {
$service = Home\OnlineModel::getOnlineServiceDetail($cateId);
}
$this->setTitle('在线客服');
$this->setNavHeader($cateName, true, '');
$this->_view->display('online-service-detail', array(
'onlineServiceDetailPage' => true,
protected $_uid;
/**
* 通过当前用户审判是否跳到登录
*
* @param int $useSession (true:从服务端session中检查, false:从客户端cookie中检查)
* @return void
*/
protected function auditJumpLogin($useSession = true)
{
$uid = $this->getUid($useSession);
if (!$uid) {
$this->go(Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', '/'))));
}
}
/**
* 个人中心入口
*/
public function indexAction()
{
// 设置网站标题
$this->setTitle('个人中心');
$this->setNavHeader('个人中心');
$data = array(
'myIndexPage' => true,
'showDownloadApp' => true,
'pageFooter' => true
);
$uid = $this->getUid(true);
if ($uid) {
$data['isLogin'] = true;
$data += UserModel::getUserProfileData($uid);
$data += UserModel::getInfoNumData($uid);
}
$this->_view->display('index', $data);
}
/**
* 为您优选
*/
public function preferenceAction()
{
$result = array();
if ($this->isAjax()) {
// 优选新品数据
$channel = Helpers::getChannelByCookie();
$result = UserModel::getPreferenceData($channel);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('recommend-content', $result);
}
}
/**
* 用户收藏的商品
*/
public function favoriteAction()
{
// 审判跳转登录页
$this->auditJumpLogin();
// 设置网站标题
$this->setTitle('我的收藏');
$this->setNavHeader('我的收藏');
$tab = $this->get('tab', '');
$data = array(
'favPage' => true, //加载js
'pageFooter' => true,
'favorite' => true,
'productUrl' => Helpers::url('/product/new'),
'brandUrl' => Helpers::url('/product/new'),
'brandTab' => $tab === 'brand' ? true : false, // 是否为品牌收藏页
);
$this->_view->display('favorite', $data);
}
/**
* 用户收藏的商品数据获取接口
*/
public function favProductAction()
{
$result = array();
if ($this->isAjax()) {
$uid = $this->getUid(true);
$page = $this->post('page', 1);
$result = UserModel::getFavProductData($uid, $page, 10);
}
if (empty($result)) {
echo ' ';
} else if (isset($result['end'])) {
echo 'end';
} else {
$this->_view->display('favorite_product', $result);
}
}
/**
* 用户收藏的品牌数据获取接口
*/
public function favBrandAction()
{
$result = array();
if ($this->isAjax()) {
$uid = $this->getUid(true);
$page = $this->post('page', 1);
$result = UserModel::getFavBrandData($uid, 10, $page, 10);
}
if (empty($result)) {
echo ' ';
} else if (isset($result['end'])) {
echo 'end';
} else {
$this->_view->display('favorite_brand', $result);
}
}
/**
* 用户收藏的商品-删除
*/
public function favoriteDelAction()
{
$result = array();
if ($this->isAjax()) {
$uid = $this->getUid(true);
$favId = $this->post('id', 0);
$result = UserModel::favoriteDelete($uid, $favId);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 浏览记录页面
*/
public function recordAction()
{
// 审判跳转登录页
$this->auditJumpLogin();
// 设置网站标题
$this->setTitle('浏览记录');
$this->setNavHeader('浏览记录', true, SITE_MAIN);
$this->_view->display('browse-record', array(
'browseRecordPage' => true
));
}
/**
* 浏览记录
*/
public function recordContentAction()
{
$result = array();
if ($this->isAjax()) {
$uid = $this->getUid(true);
$udid = $this->getUdid();
$page = $this->get('page', 1);
$result = UserModel::browserRecord($uid, $udid, $page, 100);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('browse-record-content', $result);
}
}
/**
* 删除浏览记录
*/
public function delRecordAction()
{
$result = array();
if ($this->isAjax()) {
$uid = $this->getUid(true);
$skn = $this->get('skn', 0);
$result = UserModel::delRecord($uid, $skn);
}
$this->echoJson($result);
}
/**
* 个人信息
*/
public function mydetailsAction()
{
// 审判跳转登录页
$this->auditJumpLogin();
$this->setTitle('个人信息');
$this->setNavHeader('个人信息');
$data = UserModel::getUserProfileData($this->_uid);
$data['personalDetailsPage'] = true;
$data['pageFooter'] = true;
$this->_view->display('personal-details', $data);
}
/**
* YOHO币
*/
public function currencyAction()
{
// 审判跳转登录页
$this->auditJumpLogin();
$this->setTitle('YOHO币');
$this->setNavHeader('YOHO币', true, false);
$currency = UserModel::getYohoCoinData($this->_uid);
$currency['pageFooter'] = true;
$this->_view->display('currency', $currency);
}
/**
* 优惠券
*/
public function couponsAction()
{
// 审判跳转登录页
$this->auditJumpLogin();
$this->setTitle('优惠券');
$this->setNavHeader('优惠券', true, SITE_MAIN);
$coupons = array(
'couponsPage' => true,
'pageFooter' => true
);
$this->_view->display('coupons', $coupons);
}
/**
* 异步获取指定状态的优惠券数据
*/
public function couponDataAction()
{
$result = array();
if ($this->isAjax()) {
$uid = $this->getUid(true);
$status = $this->post('status', 0);
$page = $this->post('page', 1);
$result = UserModel::getCouponData($uid, $status, $page);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('coupon_list', $result);
}
}
/**
* 异步获取三级地址数据
*/
public function locationListAction()
{
$result = array();
if ($this->isAjax()) {
$uid = $this->getUid(true);
$result['addressList'] = UserModel::getAddressListData($uid);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('location-list', $result);
}
}
/**
* 地址管理
*/
public function addressAction()
{
// 审判跳转登录页
$this->auditJumpLogin();
// 设置网站标题
$this->setTitle('地址管理');
$this->setNavHeader('地址管理');
$uid = $this->_uid;
$address = UserModel::getAddressData($uid);
$this->_view->display('address', array(
'addressPage' => true,
'pageFooter' => true,
'address' => $address,
'showAddBtn' => (count($address) <= 5),
));
}
/**
*
* 地址编辑或添加页面
*/
public function addressActAction()
{
// 审判跳转登录页
$this->auditJumpLogin();
$uid = $this->_uid;
$id = $this->get('id', null);
$data = array(
'addressActionPage' => true,
'pageFooter' => true,
'addressList' => UserModel::getAddressListData($uid)
);
if ($id !== null) { // 编辑地址
// 设置网站标题
$this->setTitle('编辑地址');
$this->setNavHeader('编辑地址');
$data['id'] = $id;
// 获取特定地址的数据
$data['address'] = UserModel::getAddressDataById($uid, $id);
} else {
// 设置网站标题
$this->setTitle('添加地址');
$this->setNavHeader('添加地址');
}
$this->_view->display('address-act', $data);
}
/**
* 修改地址或者添加新地址
*/
public function saveAddressAction()
{
$result = array();
if ($this->isAjax()) {
$uid = $this->getUid(true);
$address = $this->post('address', '');
$areaCode = $this->post('area_code', '');
$consignee = $this->post('consignee', '');
$email = $this->post('email', '');
$id = $this->post('id', null);
$mobile = $this->post('mobile', '');
$zipCode = $this->post('zip_code', '');
$result = UserModel::saveAddressData($uid, $address, $areaCode, $consignee, $email, $id, $mobile, $zipCode);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 设置默认地址
*/
public function defaultAddressAction()
{
$result = array();
if ($this->isAjax()) {
$uid = $this->getUid(true);
$id = $this->post('id', '');
$result = UserModel::setDefaultAddress($uid, $id);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 删除地址
*/
public function delAddressAction()
{
$result = array();
if ($this->isAjax()) {
$uid = $this->getUid(true);
$id = $this->post('id', '');
$result = UserModel::deleteAddress($uid, $id);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 在线客服
*/
public function onlineServiceAction()
{
// 设置网站标题
$this->setTitle('在线客服');
$this->setNavHeader('在线客服', true, SITE_MAIN);
$service = Home\OnlineModel::getOnlineServiceInfo();
$this->_view->display('online-service', array(
'onlineServicePage' => true,
'pageFooter' => true,
'service' => $service
));
}
/**
* 我的逛
*/
public function myGuangAction() {
$page = $this->get('page', 1);
$limit = $this->get('limit', 10);
$gender = Helpers::getGenderByCookie();
$yh_channel = Helpers::getChannelByCookie();
$guangInfo = \Home\GuangModel::getMyGuang($this->_uid, $page, $yh_channel, $gender, $limit);
$totalPage = $guangInfo['totalPage'];
if ($page == 1) {
$this->setTitle('我收藏的');
$this->setNavHeader('我收藏的', true, '');
$this->_view->display('my-guang', array('myGuangPage' => true, 'myGuang' => array('infos' => $guangInfo), 'pageFooter' => true));
} else if ($page > 1 && $page <= $totalPage) {
$this->_view->display('my-guang-partial', array('infos' => $guangInfo));
} else if ($page > 1 && $page > $totalPage) {
echo ' '; //退出循环
}
}
/**
* 意见反馈
*/
public function suggestAction() {
// 设置网站标题
$this->setTitle('意见反馈');
$this->setNavHeader('意见反馈', true, SITE_MAIN);
$udid = $this->getUdid();
$page = $this->get('page', 1);
$limit = $this->get('limit', 30);
$suggest = UserModel::getSuggestData($udid, $page, $limit);
$this->_view->display('suggest', array(
'suggestPage' => true, //加载js
'pageFooter' => true,
'suggest' => true,
'suggestContent' => $suggest
));
}
/**
* 意见反馈-提交表单页面
*/
public function suggestSubAction() {
// 设置网站标题
$this->setTitle('反馈问题');
$data = array(
'suggestPage' => true, //加载js
'pageHeader' => array(
'navBack' => true,
'navTitle' => '反馈问题',
'navBtn' => '提交'
),
'suggestSub' => true,
'pageFooter' => true
);
$this->_view->display('suggest-sub', $data);
}
/**
* 异步上传图片
*/
public function suggestimgUploadAction() {
$result = UserModel::saveSuggestImg('fileData');
$this->echoJson($result);
}
/**
* 异步保存意见反馈数据
*/
public function savesuggestAction() {
if ($this->isAjax()) {
$content = $this->post('content', '');
$suggest_type = $this->post('suggest_type', 2);
$image = $this->post('image', null);
$result = UserModel::saveSuggestData($this->_uid, $content, $image, $suggest_type);
$this->echoJson($result);
}
}
/**
* 异步点击靠谱或者不靠谱
*/
public function upAndDownAction() {
if ($this->isAjax()) {
$udid = $this->getUdid();
$suggest_id = $this->post('suggest_id', 0);
$reliable = $this->post('reliable', 2);
$result = UserModel::upAndDown($this->_uid, $udid, $suggest_id, $reliable);
$this->echoJson($result);
}
}
/**
* 会员等级展示页
*/
public function gradeAction() {
//设置网站seo信息
$this->setTitle('会员等级');
//显示网站导航头部信息
$this->setNavHeader('会员等级');
$gender = Helpers::getGenderByCookie();
$channel = Helpers::getChannelByCookie();
$data = GradeModel::getGrade($gender, $channel, $this->_uid);
$data['pageFooter'] = true;
$this->_view->display('vip-grade', $data);
}
/*
* 会员特权查看页
*/
public function preferentialAction() {
//设置网站seo信息
$this->setTitle('会员等级');
//显示网站导航头部信息
$this->setNavHeader('会员特权详情');
$channel = Helpers::getChannelByCookie();
$data = GradeModel::getPreferential($channel, $this->_uid);
$data['pageFooter'] = true;
$this->_view->display('privilege', $data);
}
/*
* 我的订单页面,获得nav导航条焦点。并且异步请求订单详情列表页(getOrders)
*/
public function orderAction() {
//获得type值,type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论。
$type = $this->get('type', 1);
$this->setTitle('我的订单');
$this->setNavHeader('我的订单');
$data = OrderModel::getNavs($type);
if (!empty($data)) {
$order['navs'] = $data;
} else {
$this->error();
}
//渲染模板
$this->_view->display('order', array(
'order' => $order,
'pageFooter' => true,
'orderPage' => true
));
}
/**
* ajax请求订单页面
*/
public function getOrdersAction()
{
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
}
//获取基本参数:type 1:全部 2:待付款 3:待发货 4:待收货 5:待评论 7:失败 取消 订单
$type = $this->get('type', 1);
$page = $this->get('page', 1);
$limit = $this->get('limit', 10);
//调用模型层getOrder方法获得并处理数据
$gender = Helpers::getGenderByCookie();
$channel = Helpers::getChannelByCookie();
$data = OrderModel::getOrder($type, $page, $limit, $gender, $channel, $this->_uid);
/* 如果取不到订单数据时,分两种情况:
1、page>1时,echo一个空格字符串到浏览器。
2、page=1时,就给一个随便逛逛的链接。
* */
$order = array();
if (!empty($data)) {
$order['orders'] = $data;
} else {
if ($page > 1) {
echo " ";
} elseif ($page == 1) {
$order['walkwayUrl'] = Helpers::url('/product/new');
}
}
//渲染模板
$this->_view->display('order-content', $order);
}
/*
* 我的订单-取消订单
*/
public function cancelOrderAction() {
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
}
//传入orderCode取消订单
$orderCode = $this->get('id');
$gender = Helpers::getGenderByCookie();
$channel = Helpers::getChannelByCookie();
//调用取消订单接口,返回订单取消状态
$data = OrderData::cancelOrderData($orderCode, $this->_uid, $gender, $channel);
//将取消状态返回至浏览器
$info = array();
if(empty($data['code'])&&empty($data['message'])){
$this->echoJson(array('code'=>200));
}else{
$this->echoJson($data);
}
}
/*
* 我的订单-删除订单
*/
public function delOrderAction() {
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
}
//传入orderCode删除订单
$orderCode = $this->get('id');
$gender = Helpers::getGenderByCookie();
$channel = Helpers::getChannelByCookie();
//调用接口删除订单,并返回订单删除状态
$data = OrderData::deleteOrderData($orderCode, $this->_uid, $gender, $channel);
//将订单删除状态返回至浏览器
$info = array();
if(empty($data['code'])&&empty($data['message'])){
$this->echoJson(array('code'=>200));
}else{
$this->echoJson($data);
}
}
/*
* 我的订单-查看物流详情
*/
public function getLogisticsAction(){
$order_code = $this->get('order_code');
$order_code = '1509143619';
$data = OrderModel::Logistics($order_code);
}
/*
* 我的订单-支付链接获取
*/
// private function paymentAction() {
// $gender = Helpers::getGenderByCookie();
// $yh_channel = $this->get('yh_channel', 1);
// OrderModel::payment($gender, $yh_channel);
// }
}
/**
* 在线客服-具体详情
*/
public function onlineServiceDetailAction()
{
$service = array();
$cateId = $this->get('cateId', 0);
$cateName = $this->get('cateName', '');
if ($cateId > 0) {
$service = Home\OnlineModel::getOnlineServiceDetail($cateId);
}
$this->setTitle('在线客服');
$this->setNavHeader($cateName, true, '');
$this->_view->display('online-service-detail', $service);
}
/**
* 我的逛
*/
public function myGuangAction()
{
$page = $this->get('page', 1);
$uid = $this->getUid(true);
$gender = Helpers::getGenderByCookie();
$channel = Helpers::getChannelByCookie();
$guangInfo = \Home\GuangModel::getMyGuang($uid, $page, $channel, $gender, 10);
$totalPage = $guangInfo['totalPage'];
if ($page == 1) {
$this->setTitle('我收藏的');
$this->setNavHeader('我收藏的', true, '');
$this->_view->display('my-guang', array('myGuangPage' => true, 'myGuang' => array('infos' => $guangInfo), 'pageFooter' => true));
} else if ($page > 1 && $page <= $totalPage) {
$this->_view->display('my-guang-partial', array('infos' => $guangInfo));
} else if ($page > 1 && $page > $totalPage) {
echo ' '; //退出循环
}
}
/**
* 意见反馈
*/
public function suggestAction()
{
// 设置网站标题
$this->setTitle('意见反馈');
$this->setNavHeader('意见反馈');
$udid = $this->getUdid();
$page = $this->get('page', 1);
$limit = $this->get('limit', 30);
$suggest = UserModel::getSuggestData($udid, $page, $limit);
$this->_view->display('suggest', array(
'suggestPage' => true, //加载js
'pageFooter' => true,
'suggest' => true,
'suggestContent' => $suggest
));
}
/**
* 意见反馈-提交表单页面
*/
public function suggestSubAction()
{
// 设置网站标题
$this->setTitle('反馈问题');
$this->setNavHeader('意见反馈');
$data = array(
'suggestPage' => true, //加载js
'pageHeader' => array(
'navBack' => true,
'navTitle' => '反馈问题',
'navBtn' => '提交'
),
'suggestSub' => true,
'pageFooter' => true
);
$this->_view->display('suggest-sub', $data);
}
/**
* 异步上传图片
*/
public function suggestimgUploadAction()
{
$result = UserModel::saveSuggestImg('fileData');
$this->echoJson($result);
}
/**
* 异步保存意见反馈数据
*/
public function savesuggestAction()
{
if ($this->isAjax()) {
$uid = $this->getUid(true);
$content = $this->post('content', '');
$suggest_type = $this->post('suggest_type', 2);
$image = $this->post('image', null);
$result = UserModel::saveSuggestData($uid, $content, $image, $suggest_type);
$this->echoJson($result);
}
}
/**
* 异步点击靠谱或者不靠谱
*/
public function upAndDownAction()
{
if ($this->isAjax()) {
$uid = $this->getUid(true);
$udid = $this->getUdid();
$suggest_id = $this->post('suggest_id', 0);
$reliable = $this->post('reliable', 2);
$result = UserModel::upAndDown($uid, $udid, $suggest_id, $reliable);
$this->echoJson($result);
}
}
/**
* 会员等级展示页
*/
public function gradeAction()
{
// 审判跳转登录页
$this->auditJumpLogin();
//设置网站seo信息
$this->setTitle('会员等级');
//显示网站导航头部信息
$this->setNavHeader('会员等级');
$gender = Helpers::getGenderByCookie();
$channel = Helpers::getChannelByCookie();
$data = GradeModel::getGrade($gender, $channel, $this->_uid);
$data['pageFooter'] = true;
$this->_view->display('vip-grade', $data);
}
/*
* 会员特权查看页
*/
public function preferentialAction()
{
// 审判跳转登录页
$this->auditJumpLogin();
//设置网站seo信息
$this->setTitle('会员等级');
//显示网站导航头部信息
$this->setNavHeader('会员特权详情');
$channel = Helpers::getChannelByCookie();
$data = GradeModel::getPreferential($channel, $this->_uid);
$data['pageFooter'] = true;
$this->_view->display('privilege', $data);
}
/*
* 我的订单页面,获得nav导航条焦点。并且异步请求订单详情列表页(getOrders)
*
*/
public function orderAction()
{
// 审判跳转登录页
$this->auditJumpLogin();
$this->setTitle('我的订单');
$this->setNavHeader('我的订单');
$order = array();
//获得type值,type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论
$type = $this->get('type', 1);
$data = OrderModel::getNavs($type);
if (!empty($data)) {
$order['navs'] = $data;
}
//渲染模板
$this->_view->display('order', array(
'order' => $order,
'pageFooter' => true,
'orderPage' => true
));
}
/**
* ajax请求订单页面
*/
public function getOrdersAction()
{
//判断是不是ajax请求
if (!$this->isAjax()) {
echo ' ';
}
//获取基本参数:type 1:全部 2:待付款 3:待发货 4:待收货 5:待评论 7:失败 取消 订单
$type = $this->get('type', 1);
$page = $this->get('page', 1);
//调用模型层getOrder方法获得并处理数据
$uid = $this->getUid(true);
$gender = Helpers::getGenderByCookie();
$channel = Helpers::getChannelByCookie();
$data = OrderModel::getOrder($type, $page, 10, $gender, $channel, $uid);
/* 如果取不到订单数据时,分两种情况:
1、page>1时,echo一个空格字符串到浏览器。
2、page=1时,就给一个随便逛逛的链接。
* */
$order = array();
if (!empty($data)) {
$order['orders'] = $data;
} else if ($page == 1) {
$order['walkwayUrl'] = Helpers::url('/product/new');
} else {
echo ' ';
}
//渲染模板
$this->_view->display('order-content', $order);
}
/*
* 我的订单-取消订单
*/
public function cancelOrderAction()
{
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->echoJson(array('code' => 200));
}
//传入orderCode取消订单
$orderCode = $this->get('id');
$gender = Helpers::getGenderByCookie();
$channel = Helpers::getChannelByCookie();
$uid = $this->getUid(true);
//调用取消订单接口,返回订单取消状态
$data = OrderData::cancelOrderData($orderCode, $uid, $gender, $channel);
//将取消状态返回至浏览器
if (empty($data['code']) && empty($data['message'])) {
$this->echoJson(array('code' => 200));
} else {
$this->echoJson($data);
}
}
/*
* 我的订单-删除订单
*/
public function delOrderAction()
{
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->echoJson(array('code' => 200));
}
//传入orderCode删除订单
$orderCode = $this->get('id');
$gender = Helpers::getGenderByCookie();
$channel = Helpers::getChannelByCookie();
$uid = $this->getUid(true);
//调用接口删除订单,并返回订单删除状态
$data = OrderData::deleteOrderData($orderCode, $uid, $gender, $channel);
//将订单删除状态返回至浏览器
if (empty($data['code']) && empty($data['message'])) {
$this->echoJson(array('code' => 200));
} else {
$this->echoJson($data);
}
}
/**
* 我的订单-查看物流信息
*/
public function logisticAction()
{
// 审判跳转登录页
$this->auditJumpLogin();
$this->setTitle('物流详情');
$this->setNavHeader('物流详情');
$orderCode = $this->get('order_code');
$data = OrderModel::Logistics($orderCode, $this->_uid);
$data['logisticInfoPage'] = true;
$data['pageFooter'] = true;
$this->_view->display('logistic', $data);
}
/*
* 我的订单-付款跳转页
*/
public function payAction()
{
$this->_view->display('pay', array(
'payAppInfo' => array(
0 => array(
'appIcon' => '',
'weixin' => true,
'app' => '微信支付',
'hint' => '需下载微信客户端',
'subHint' => '推荐使用',
),
),
));
}
/*
* 我的订单-确认收货
*/
// /*
// * 我的订单-确认收货
// */
// private function confirmAction(){
// //
// $gender = Helpers::getGenderByCookie();
... ... @@ -742,72 +791,62 @@ class HomeController extends AbstractAction
// $this->echoJson($data);
// }
/**
* 订单详情页
*/
public function orderDetailAction() {
$data = array(
'name' => '毛毛莉Lydia',
'phoneNum' => '18600001133',
'address' => '南京市建邺区嘉陵江东街18号国家广告产业园5栋17楼',
'orderStatus' => '订单取消',
'orderNum' => '418358063',
'orderTime' => '2014-03-10 17:25:10',
'orderCancel' => true,
'goods' => array(
array(
'id' => 1,
'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => 'Adidas Originals ZX FLUXM22508',
'color' => '黄',
'size' => '43',
'price' => '699.00',
'count' => '2'
),
array(
'id' => 1,
'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/11/04/05/0188f1aca49ac478a565ec029b5d2d4a6c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => 'B.Duck浴室玩伴mini浮水鸭',
'gift' => true,
'color' => '黄',
'size' => '43',
'price' => '0.00',
'count' => '1'
)
),
'sumPrice' => 799,
'salePrice' => 80,
'freight' => 5,
'coupon' => 0,
'yohoCoin' => 5,
'price' => 719
);
$this->_view->display('order-detail', array('orderDetail' => $data, 'orderDetailPage' => true));
}
/**
* 帮助列表页
*/
private function IHelpAction()
{
$this->setTitle('帮助中心');
$this->setNavHeader('帮助中心');
$data = array(
'iHelp' => array(
array('name' => '新用户注册','url' => 'http://m.dev.yohobuy.com/' ),
array('name' => '交款须知' ,'url' => 'http://m.dev.yohobuy.com/'),
array('name' => '服务条款' ,'url' => 'http://m.dev.yohobuy.com/'),
array('name' => '网站订购流程' ,'url' => 'http://m.dev.yohobuy.com/'),
array('name' => '会员登录' ,'url' => 'http://m.dev.yohobuy.com/'),
array('name' => '网站订单修改' ,'url' => 'http://m.dev.yohobuy.com/'),
array('name' => 'YOHO币' ,'url' => 'http://m.dev.yohobuy.com/'),
array('name' => '常见问题' ,'url' => 'http://m.dev.yohobuy.com/'),
array('name' => '支付方式' ,'url' => 'http://m.dev.yohobuy.com/'),
array('name' => '发票制度说明' ,'url' => 'http://m.dev.yohobuy.com/'),
array('name' => '配送时间' ,'url' => 'http://m.dev.yohobuy.com/')
)
);
$this->_view->display('i-help', $data);
}
/**
* 订单详情页
*/
public function orderDetailAction()
{
$data = array(
'name' => '毛毛莉Lydia',
'phoneNum' => '18600001133',
'address' => '南京市建邺区嘉陵江东街18号国家广告产业园5栋17楼',
'orderStatus' => '订单取消',
'orderNum' => '418358063',
'orderTime' => '2014-03-10 17:25:10',
'orderCancel' => true,
'goods' => array(
array(
'id' => 1,
'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => 'Adidas Originals ZX FLUXM22508',
'color' => '黄',
'size' => '43',
'price' => '699.00',
'count' => '2'
),
array(
'id' => 1,
'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/11/04/05/0188f1aca49ac478a565ec029b5d2d4a6c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => 'B.Duck浴室玩伴mini浮水鸭',
'gift' => true,
'color' => '黄',
'size' => '43',
'price' => '0.00',
'count' => '1'
)
),
'sumPrice' => 799,
'salePrice' => 80,
'freight' => 5,
'coupon' => 0,
'yohoCoin' => 5,
'price' => 719
);
$this->_view->display('order-detail', array('orderDetail' => $data, 'orderDetailPage' => true));
}
// /**
// * 帮助列表页
// */
// public function helpAction()
// {
// $this->setTitle('帮助中心');
// $this->setNavHeader('帮助中心');
// $data = array(
// 'iHelp' => array(
// array('name' => '新用户注册', 'url' => 'http://m.dev.yohobuy.com/'),
// )
// );
// $this->_view->display('i-help', $data);
// }
}
... ...
... ... @@ -107,8 +107,8 @@ class BrandModel
$build['list'] = array();
foreach ($value as $row) {
$list['name'] = $row['brand_name'];
$list['isHot'] = ($row['is_hot'] === 'Y') ? true : false;
$list['isNew'] = ($row['is_show_new'] === 'Y') ? true : false;
$list['isHot'] = (isset($row['is_hot']) && $row['is_hot'] === 'Y') ? true : false;
$list['isNew'] = (isset($row['is_show_new']) && $row['is_show_new'] === 'Y') ? true : false;
$list['url'] = Helpers::url('', null, $row['brand_domain']);
$build['list'][] = $list;
}
... ...
... ... @@ -16,8 +16,7 @@ class GradeModel
* 获取个人中心-会员等级数据
*/
public static function getGrade($gender, $channel, $uid)
{
public static function getGrade($channel, $uid) {
$result = array();
if (USE_CACHE) {
... ... @@ -27,9 +26,9 @@ class GradeModel
return $result;
}
}
//调用接口获取数据
$data = GradeData::getGradeData($channel, $uid);
if (!empty($data['grade'])) {
switch (intval($data['grade']['current_vip_level'])) {
case 0://普通会员
... ... @@ -47,25 +46,23 @@ class GradeModel
}
//今年总消费
$result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost'];
//升级下一等级会员的进度;
if ($data['grade']['next_need_cost'] == 0) {
$result['vipGrade']['costOfThisYear'] = sprintf("%.2f", $data['grade']['current_year_cost']);
//升级下一等级会员的进度;
if($data['grade']['next_need_cost'] == 0){
//当vip等级升至顶级时,进度条满格
$result['vipGrade']['percent'] = 100;
} else {
$result['vipGrade']['percent'] = 100 * (round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2));
}
//距离升级所需消费金额
if ($data['grade']['current_vip_level'] != 3) {
$result['vipGrade']['costGap'] = $data['grade']['upgrade_need_cost'];
$result['vipGrade']['costGap'] = sprintf("%.2f", $data['grade']['upgrade_need_cost']);
}
//消费总计
$result['vipGrade']['sumCost'] = $data['grade']['current_total_cost'];
//username 调用获取用户基本信息数据,获得username;
//$userProfile = GradeData::getUserProfileData($gender,$uid,$channel);
$result['vipGrade']['name'] = !empty($data['userProfile']) ? $data['userProfile']['username'] : '';
$result['vipGrade']['sumCost'] = sprintf("%.2f", $data['grade']['current_total_cost']);
//username 调用获取用户基本信息数据,获得nikename昵称;
$result['vipGrade']['name'] = !empty($data['userProfile']) ? $data['userProfile']['nickname'] : '';
//跳转url(会员特权详情)
$result['vipGrade']['allUrl'] = Helpers::url('/home/preferential', null);
//当前vip等级享受的特权
... ... @@ -85,13 +82,12 @@ class GradeModel
return $result;
}
/*
* 获取个人中心-会员特权详情页
*/
public static function getPreferential($channel, $uid)
{
public static function getPreferential($channel, $uid) {
$result = array();
if (USE_CACHE) {
... ... @@ -101,17 +97,17 @@ class GradeModel
return $result;
}
}
//调取接口获得数据
$data = GradeData::getPreferentialData($channel, $uid);
if (isset($data['code']) && $data['code'] == 200) {
$result['vipGrade']['privilege'] = $data['data'];
}
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get(CacheConfig::KEY_ACTION_HOME_GRADE, 'slave');
$result = Cache::get(CacheConfig::KEY_ACTION_HOME_PREFERENTIAL, 'slave');
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else {
... ...
... ... @@ -4,14 +4,6 @@ namespace Home;
use LibModels\Wap\Home\OrderData;
use Plugin\Helpers;
use Plugin\Cache;
use Configs\CacheConfig;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of Order
... ... @@ -19,7 +11,6 @@ use Configs\CacheConfig;
*/
class OrderModel
{
/* 频道选择页取背景图片的位置码 */
const CODE_PAYMENT = '04cf5abaa7c20178325a07c4a833782c'; //支付订单资源码
const CODE_STROLL = 'a7989369aa86681c678bc40f171b8f1d'; //随便逛逛url地址资源码
... ... @@ -28,29 +19,25 @@ class OrderModel
* 订单相关数据处理
*/
static function getOrder($type, $page, $limit, $gender, $yh_channel, $uid)
public static function getOrder($type, $page, $limit, $gender, $yh_channel, $uid)
{
$result = array();
if (USE_CACHE) {
$key = CacheConfig::KEY_ACTION_HOME_ORDER_ORDER;
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get($key, 'master');
if (!empty($result)) {
return $result;
}
}
//调用接口获得数据
$data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, $uid);
// 判断是否还有数据, 没有数据则返回空
if (isset($data['data']['page_total']) && $page > $data['data']['page_total']) {
return $result;
}
//检查数据返回是否正常,正常则处理数据
if ($data['code'] == 200 && isset($data['data'])) {
if (!empty($data['data']['order_list'])) {
foreach ($data['data']['order_list'] as $key => $vo) {
//订单号,支付状态,订单商品数量,订单总价格(订单总价加上运费)
//订单号,支付状态,订单商品数量,订单总价格
$result[$key]['orderNum'] = $vo['order_code'];
$result[$key]['orderStatus'] = $vo['status_str'];
$result[$key]['count'] = count($vo['order_goods']);
$result[$key]['sumCost'] = $vo['amount'] + $vo['shipping_cost'];
$result[$key]['sumCost'] = $vo['amount'];
//类内调用格式化订单商品数据方法
$result[$key]['goods'] = self::formatOrderGoods($vo['order_goods']);
$result[$key]['goods'] = Helpers::formatOrderGoods($vo['order_goods']);
//根据订单status判断订单处于什么状态。
do {
//订单取消状态 = Y 时,跳出判断订单状态循环,并设置订单状态为已取消。
... ... @@ -59,8 +46,8 @@ class OrderModel
break;
}
/* 先判断订单付款方式,根据不同的付款方式计算订单状态。(注:货到付款没有待付款状态)
* 付款方式:1 => 在线支付,2 => 货到付款,3 => 现金支付,4 => 抵消支付;
*/
* 付款方式:1 => 在线支付,2 => 货到付款,3 => 现金支付,4 => 抵消支付;
*/
//支付方式为非货到付款时,计算订单状态。
if ($vo['payment_type'] != 2) {
switch ($vo['status']) {
... ... @@ -71,25 +58,14 @@ class OrderModel
case 1:
case 2:
case 3:
case 4:
case 5:
//已付款状态不给查看物流URL
$result[$key]['unreceived'] = true;
//待收货状态,给查看物流url
$result[$key]['logisticsUrl'] = "暂无logisticsUrl数据";
break;
case 6:
$result[$key]['completed'] = true;
break;
default:
break;
}
} elseif ($vo['payment_type'] == 2) {
//订单为货到付款订单时,计算订单状态。(货到付款没有待付款状态)
switch ($vo['status']) {
case 0 || 1 || 2 || 3 || 4 || 5:
case 4:
case 5:
//已发货状态,给查看物流URL
$result[$key]['unreceived'] = true;
//待收货状态,给查看物流url
$resault[$key]['logisticsUrl'] = "备注:暂无logisticsUrl数据";
$result[$key]['logisticsUrl'] = Helpers::url('/home/logistic', array('order_code' => $vo['order_code']));
break;
case 6:
$result[$key]['completed'] = true;
... ... @@ -97,123 +73,99 @@ class OrderModel
default:
break;
}
break;
}
//订单为货到付款订单时,计算订单状态。(货到付款没有待付款状态)
switch ($vo['status']) {
case 0:
case 1:
case 2:
case 3:
//备货中、已付款状态不给查看物流链接
$result[$key]['unreceived'] = true;
break;
case 4:
case 5:
//待收货状态,给查看物流url
$result[$key]['unreceived'] = true;
$result[$key]['logisticsUrl'] = Helpers::url('/home/logistic', array('order_code' => $vo['order_code']));
break;
case 6:
$result[$key]['completed'] = true;
break;
default:
break;
}
} while (false);
}
}
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get($key, 'slave');
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else {
Cache::set($key, $result);
}
}
return $result;
}
//格式化订单商品
static function formatOrderGoods($orderGoods)
/**
* 获得支付链接
*/
public static function payment($gender, $yh_channel)
{
$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'];
//gift=>是否赠品,advanceBuy=>是否加价购;
if ($vo['goods_type'] == 'gift') {
$arr[$key]['gift'] = true;
} elseif ($vo['goods_type'] == 'price_gift') {
$arr[$key]['advanceBuy'] = true;
}
}
return $arr;
$code = self::CODE_PAYMENT;
$data = OrderData::paymentData($gender, $yh_channel, $code);
return $data;
}
//根据type值设置nav属性
static function getNavs($type)
/**
* 查看物流
*
* @param int $orderCode 订单编号
* @param int $uid 用户ID
* @return array
*/
public static function Logistics($orderCode, $uid)
{
$nav = array(
array(
'name' => '全部',
'typeId' => '1',
'url' => '/home/order?type=1'
),
array(
'name' => '待付款',
'typeId' => '2',
'url' => '/home/order?type=2'
),
array(
'name' => '待发货',
'typeId' => '3',
'url' => '/home/order?type=3'
),
array(
'name' => '待收货',
'typeId' => '4',
'url' => '/home/order?type=4'
)
);
foreach ($nav as $key => $vo) {
switch ($type) {
case 1:
if ($vo['typeId'] == 1) {
$nav[$key]['active'] = true;
}
break;
case 2:
if ($vo['typeId'] == 2) {
$nav[$key]['active'] = true;
}
break;
case 3:
if ($vo['typeId'] == 3) {
$nav[$key]['active'] = true;
}
break;
case 4:
if ($vo['typeId'] == 4) {
$nav[$key]['active'] = true;
}
break;
default:
break;
$result = array();
if (isset($orderCode) && is_numeric($uid)) {
$logistics = OrderData::LogisticsData($orderCode, $uid);
if (!empty($logistics['data'])) {
$result['logisticUrl'] = $logistics['data']['url'];
$result['logisticImg'] = $logistics['data']['logo'];
$result['logisticCompany'] = $logistics['data']['caption'];
$result['logisticNumber'] = $logistics['data']['express_number'];
$build = array();
foreach ($logistics['data']['express_detail'] as $value) {
$build['status'] = $value['accept_address'];
$build['date'] = $value['acceptTime'];
$result['logisticDetail'][] = $build;
}
}
}
return $nav;
}
//获得支付链接
static function payment($gender, $yh_channel)
{
$code = self::CODE_PAYMENT;
$data = OrderData::paymentData($gender, $yh_channel, $code);
return $result;
}
//查看物流
// static function Logistics(){
// OrderData::LogisticsData();
// }
//随便逛逛url获取
static function stroll($gender, $yh_channel)
/**
* 根据type值设置nav属性
*/
public static function getNavs($type)
{
//获取随便逛逛url资源码
$code = self::CODE_STROLL;
//调用接口获得数据
$data = OrderData::strollData($gender, $yh_channel, $code);
$stroll = 1;
//检查数据返回是否正常,正常则处理数据
if ($data['code'] == 200) {
$strollUrl = $data['data'][0]['data'][0]['url'];
$navType = array(1 => '全部', 2 => '待付款', 3 => '待发货', 4 => '待收货');
$nav = array();
foreach ($navType as $key => $value) {
$act = false;
if ($type == $key) {
$act = true;
}
$nav[] = array(
'name' => $value,
'typeId' => $key,
'active' => $act,
'url' => Helpers::url('/home/order', array('type' => $key))
);
}
return $strollUrl;
return $nav;
}
}
... ...
... ... @@ -142,10 +142,10 @@ class HomeModel
// 调用接口获取数据
$banner = IndexData::getBannerStart($resource);
if (isset($banner['code']) && $banner['code'] == 200) {
if (isset($banner['code']) && $banner['code'] == 200 && $banner['data']['total'] > 0) {
$result = array();
// 处理数据
foreach ($banner['data'] as $val) {
foreach ($banner['data']['list'] as $val) {
foreach ($val['data'] as $single) {
$result['url'] = ($channel === 2) ? Helpers::url('/boys') : Helpers::url('/girls');
$result['img'] = Helpers::getImageUrl($single['src'], 640, 200);
... ...
... ... @@ -46,14 +46,15 @@ class UserModel
* 处理个人中心页面优惠券,收藏的商品等的数目数据
*
* @param int $uid 用户ID
* @param int $udid 客户端唯一标识
* @return array|mixed 处理之后的个人中心页面优惠券,收藏的商品等的数目数据
*/
public static function getInfoNumData($uid)
public static function getInfoNumData($uid, $udid)
{
$result = array();
// 调用接口获取个人中心页面优惠券,收藏的商品等的数目数据
$infoNumData = UserData::infoNum($uid);
$infoNumData = UserData::infoNum($uid, $udid);
// 处理个人中心页面优惠券,收藏的商品等的数目数据
if (isset($infoNumData['data']) && !empty($infoNumData['data'])) {
... ... @@ -181,9 +182,9 @@ class UserModel
$product['imgUrl'] = Helpers::getImageUrl($val['image'], 447, 596);
;
$product['title'] = $val['product_name'];
$product['price'] = !empty($val['market_price']) ? '¥' . $val['market_price'] . '.00' : 0;
$product['discountPrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥' . $val['sales_price'] . '.00' : false;
$product['savePrice'] = ($val['price_down'] > 0) ? '¥' . $val['price_down'] . '.00' : false;
$product['price'] = !empty($val['market_price']) ? '¥' . $val['market_price'] . '.00' : 0;
$product['discountPrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥' . $val['sales_price'] . '.00' : false;
$product['savePrice'] = ($val['price_down'] > 0) ? '¥' . $val['price_down'] . '.00' : false;
$product['sellOut'] = ($val['storage'] <= 0);
$datas[] = $product;
... ... @@ -236,7 +237,8 @@ class UserModel
$product = array();
foreach ($val['new_product'] as $one) {
$product = array();
$product['imgUrl'] = Images::getImageUrl($one['default_images'], 235, 314);
$product['link'] = isset($val['goodsId']) ? Helpers::url('/product/pro_' . $val['product_skn'] . '_' . $val['goodsId'] . '/' . $val['cnAlphabet'] . '.html') : '';
$product['imgUrl'] = (isset($one['default_images']) && !empty($one['default_images'])) ? Images::getImageUrl($one['default_images'], 235, 314) : '';
$product['price'] = !empty($one['market_price']) ? '¥' . $one['market_price'] . '.00' : 0;
$product['discount'] = !empty($one['sales_price']) ? '¥' . $one['sales_price'] . '.00' : 0;
... ... @@ -299,9 +301,10 @@ class UserModel
} else {
$data = $records['data']['product_list'];
foreach ($data as &$val) {
$val['image'] = Helpers::getImageUrl($val['image'], 140, 140);
$val['link'] = isset($val['goodsId']) ? Helpers::url('/product/pro_' . $val['product_skn'] . '_' . $val['goodsId'] . '/' . $val['cnAlphabet'] . '.html') : '';
$val['image'] = !empty($val['image']) ? Helpers::getImageUrl($val['image'], 140, 140) : '';
$val['sales_price'] = !empty($val['sales_price']) ? $val['sales_price'] . '.00' : 0;
$val['market_price'] = !empty($val['market_price']) ? $val['market_price'] . '.00' : 0;
$val['market_price'] = ($val['market_price'] - $val['sales_price'] > 0) ? $val['market_price'] . '.00' : false;
}
!empty($data) && $result['browseRecord'] = $data;
}
... ... @@ -333,7 +336,7 @@ class UserModel
}
/**
* 处理YOHO币数据
* 处理YOHO币总数数据
*
* @param int $uid 用户ID
* @return array|mixed 处理之后的YOHO币数据
... ... @@ -343,7 +346,7 @@ class UserModel
$result = array();
// 调用接口获取YOHO币
$yohoCoin = UserData::yohoCoinData($uid);
$yohoCoin = UserData::yohoCoinTotal($uid);
// 处理YOHO币数据
if (isset($yohoCoin['data']) && !empty($yohoCoin['data'])) {
... ... @@ -725,4 +728,42 @@ class UserModel
return $result;
}
/**
* 处理帮助中心列表数据
*
* @return array|mixed 处理之后的返回
*/
public static function getHelpListData()
{
$result = array();
$helpListData = UserData::helpListData();
if (isset($helpListData['data']) && !empty($helpListData['data'])) {
$help = $helpListData['data'];
$one = array();
foreach ($help as $val) {
$one = array();
$one['name'] = $val['caption'];
$one['url'] = Helpers::url('/home/helpdetail/', array('code' => $val['code']));
$result['iHelp'][] = $one;
}
}
return $result;
}
/**
* 处理帮助详情数据
*
* @param string $code 具体一条帮助的code
* @return array|mixed 处理之后的返回
*/
public static function getHelpDetailData($code)
{
return UserData::helpDetailData($code);
}
}
... ...
... ... @@ -31,8 +31,8 @@ class DetailModel
if (is_numeric($productId) && is_numeric($goodsId)) {
// 调用服务
$baseInfo = DetailData::baseInfo($productId, $uid);
$baseInfo = DetailData::baseInfo($productId, $uid);
// 判断商品是否在架
if (empty($baseInfo['status'])) {
return $result;
... ... @@ -41,7 +41,7 @@ class DetailModel
// 商品名称
if (isset($baseInfo['productName'])) {
$result['goodsName'] = $baseInfo['productName'];
}
}
// 商品标签
if (!empty($baseInfo['productTagBoList'])) {
... ... @@ -50,10 +50,10 @@ class DetailModel
case 'is_soon_sold_out': // 即将售磬
$result['tags']['is_soon_sold_out'] = true;
break;
case 'is_new': // 新品
case 'is_new': // 新品NEW
$result['tags']['is_new'] = true;
break;
case 'is_discount': // 在售
case 'is_discount': // SALE
$result['tags']['is_discount'] = true;
break;
case 'is_limited': // 限量
... ... @@ -68,7 +68,7 @@ class DetailModel
}
}
}
// 商品价格
if (isset($baseInfo['productPriceBo'])) {
$result['goodsPrice'] = array();
... ... @@ -88,10 +88,10 @@ class DetailModel
}
// 上市期
if (isset($baseInfo['expectArrivalTime'])) {
$result['periodOfMarket'] = date('n', $baseInfo['firstShelveTime']) . '月';
if (isset($baseInfo['expectArrivalTime']) && !empty($baseInfo['expectArrivalTime'])) {
$result['periodOfMarket'] = date('n', $baseInfo['expectArrivalTime']) . '月';
}
// 促销信息
if (isset($baseInfo['promotionBoList'])) {
$build = array();
... ... @@ -103,7 +103,7 @@ class DetailModel
}
$result['feedbacks'] = array();
// 商品咨询
$result['feedbacks']['consultsNum'] = 0;
if (!empty($baseInfo['consultBoWrapper'])) {
... ... @@ -118,7 +118,11 @@ class DetailModel
}
$result['feedbacks']['link'] = Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $result['feedbacks']['consultsNum']));
}
// 暂无咨询
else {
$result['feedbacks']['link'] = Helpers::url('/product/detail/consultform', array('product_id' => $productId));
}
// 商品评价
$result['feedbacks']['commentsNum'] = 0;
if (!empty($baseInfo['commentBoWrapper'])) {
... ... @@ -155,7 +159,7 @@ class DetailModel
$colorId = intval($value['colorId']);
// 商品按颜色进行分类分组
foreach ($value['goodsImagesList'] as $goods) {
$goodsList[ $goods['goodsId'] ] = $colorId;
$goodsList[$goods['goodsId']] = $colorId;
$goodsGroup[$colorId][] = array(
'goodsId' => $goods['goodsId'],
'img' => $goods['imageUrl'],
... ... @@ -168,14 +172,14 @@ class DetailModel
}
// 商品的尺码列表
foreach ($value['goodsSizeBoList'] as $size) {
$sizeGroup[ $colorId ] = array(
$sizeGroup[$colorId] = array(
'sizeName' => $size['sizeName'],
'sizeSku' => $size['goodsSizeSkuId'],
'sizeStorage' => $size['goodsSizeStorageNum'],
);
}
}
// 商品图
$goodsId = intval($goodsId);
if (isset($goodsList[$goodsId])) {
... ... @@ -199,17 +203,17 @@ class DetailModel
// 悬浮的购物车信息
$result['cartInfo'] = array(
'cartUrl' => Helpers::url('/shoppingCart'),
'cartUrl' => Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html'),
'numInCart' => 0,
'goodsInstore' => $baseInfo['storage'],
);
// 是否收藏
$result['isCollect'] = false;
if (isset($baseInfo['isCollect']) && $baseInfo['isCollect'] === 'Y') {
$result['isCollect'] = true;
}
// 底部简介的URL链接
$result['introUrl'] = Helpers::url('/product/intro_' . $baseInfo['erpProductId'] . '/' . $baseInfo['cnAlphabet'] . '.html');
$result['id'] = $productId;
... ... @@ -227,11 +231,11 @@ class DetailModel
public static function getSizeInfo($productSkn)
{
$result = array();
if (is_numeric($productSkn)) {
// 调用服务
$sizeInfo = DetailData::sizeInfo($productSkn);
// 商品信息
if (isset($sizeInfo['productDescBo']['erpProductId'])) {
$sex = '通用';
... ... @@ -245,7 +249,7 @@ class DetailModel
}
$result['goodsDescription'] = array(
'title' => '商品信息',
'enTitle' => 'PRODUCT INFO',
'enTitle' => 'DESCRIPTION',
'detail' => array(
'list' => array(
array('param' => '编号:' . $sizeInfo['productDescBo']['erpProductId']),
... ... @@ -263,7 +267,7 @@ class DetailModel
if (isset($sizeInfo['phrase'])) {
$result['goodsDescription']['desc'] = $sizeInfo['phrase'];
}
// 尺码信息
if (!empty($sizeInfo['sizeInfoBo'])) {
$result['sizeInfo'] = array(
... ... @@ -271,25 +275,25 @@ class DetailModel
'enTitle' => 'SIZE INFO',
'detail' => array('list' => array()),
);
$sizeNameList = array(0 => array('param' => '吊牌尺码')) ; // 尺码名称
$sizeNameList = array(0 => array('param' => '吊牌尺码')); // 尺码名称
$sizeBoGroup = array(); // 尺码按ID分组
foreach ($sizeInfo['sizeInfoBo']['sizeAttributeBos'] as $attr) {
$sizeBoGroup[ $attr['id'] ][0] = array('param' => $attr['attributeName']);
$sizeBoGroup[$attr['id']][0] = array('param' => $attr['attributeName']);
}
foreach ($sizeInfo['sizeInfoBo']['sizeBoList'] as $value) {
$sizeNameList[] = array('param' => $value['sizeName']);
foreach ($value['sortAttributes'] as $attr) {
$sizeBoGroup[ $attr['id'] ][] = array('param' => $attr['sizeValue']);
$sizeBoGroup[$attr['id']][] = array('param' => $attr['sizeValue']);
}
}
// 根据模板页面的显示,按表格一列一列来显示
$result['sizeInfo']['detail']['list'][0]['params'] = $sizeNameList;
foreach ($sizeBoGroup as $value) {
$result['sizeInfo']['detail']['list'][]['params'] = $value;
}
}
// 测量方式
if (!empty($sizeInfo['sizeImage'])) {
$result['measurementMethod'] = array(
... ... @@ -298,7 +302,7 @@ class DetailModel
'img' => $sizeInfo['sizeImage'],
);
}
// 模特试穿, 竖着输出排列显示
if (!empty($sizeInfo['modelBos'])) {
$result['reference'] = array(
... ... @@ -306,11 +310,11 @@ class DetailModel
'enTitle' => 'REFERENCE',
'detail' => array('list' => array()),
);
// 控制是否显示备注
$showRemark = false;
$remarkList = array(0 => array('param' => '备注'));
$result['reference']['detail']['list'][0]['params'] = array(0 => array('param' => '')); // 头像列表
$result['reference']['detail']['list'][1]['params'] = array(0 => array('param' => '模特')); // 模特名字列表
$result['reference']['detail']['list'][2]['params'] = array(0 => array('param' => '身高')); // 身高列表
... ... @@ -318,7 +322,7 @@ class DetailModel
$result['reference']['detail']['list'][4]['params'] = array(0 => array('param' => '三围')); // 三围列表
$result['reference']['detail']['list'][5]['params'] = array(0 => array('param' => '吊牌尺码')); // 吊牌尺码
$result['reference']['detail']['list'][6]['params'] = array(0 => array('param' => '试穿描述')); // 试穿描述
foreach ($sizeInfo['modelBos'] as $value) {
$result['reference']['detail']['list'][0]['params'][] = array('param' => $value['avatar']);
$result['reference']['detail']['list'][1]['params'][] = array('param' => $value['modelName']);
... ... @@ -334,13 +338,13 @@ class DetailModel
$remarkList[] = array('param' => '');
}
}
// 显示模特备注
if ($showRemark) {
$result['reference']['detail']['list'][7]['params'] = $remarkList;
}
}
// 商品材质
if (!empty($sizeInfo['productMaterialList'])) {
$result['materials'] = array(
... ... @@ -355,7 +359,7 @@ class DetailModel
);
}
}
// 洗涤提示
if (!empty($sizeInfo['washTipsBoList'])) {
$result['washTips']['list'] = array();
... ... @@ -363,7 +367,7 @@ class DetailModel
$result['washTips']['list'][] = $value;
}
}
// 详情配图
if (isset($sizeInfo['productIntroBo']['productIntro'])) {
$productIntro = $sizeInfo['productIntroBo']['productIntro'];
... ... @@ -380,7 +384,6 @@ class DetailModel
);
}
}
}
return $result;
... ... @@ -392,7 +395,7 @@ class DetailModel
public static function getComments($productId, $pageNum = 1, $pageSize = 100)
{
$result = array();
if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
$commentList = DetailData::commentList($productId, $pageNum, $pageSize);
if (!empty($commentList)) {
... ... @@ -406,10 +409,10 @@ class DetailModel
}
}
}
return $result;
}
/**
* 获取咨询列表
*
... ... @@ -421,7 +424,7 @@ class DetailModel
public static function getConsults($productId, $pageNum = 1, $pageSize = 100)
{
$result = array();
if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
$consultList = DetailData::consultList($productId, $pageNum, $pageSize);
if (!empty($consultList)) {
... ... @@ -435,10 +438,10 @@ class DetailModel
}
$consultList = array();
}
return $result;
}
/**
* 获取为你优选的商品
*
... ... @@ -448,7 +451,7 @@ class DetailModel
public static function getPreference($productSkn)
{
$result = array();
if (is_numeric($productSkn)) {
$preference = DetailData::preference($productSkn);
if (!empty($preference['data'])) {
... ... @@ -457,8 +460,8 @@ class DetailModel
}
}
}
return $result;
}
}
... ...