Authored by 梁志锋

Merge branch 'feature/cart' of http://git.dev.yoho.cn/web/yohobuy into feature/cart

Showing 33 changed files with 495 additions and 309 deletions
... ... @@ -817,7 +817,7 @@
},
...
],
totalNum: 20
}
... ... @@ -1245,10 +1245,9 @@
'notForSale':'非卖品',
thumb: [
thumbs: [
{
id:1,
url : ''
img : ''
},
...
],
... ... @@ -1256,34 +1255,36 @@
price: '',
salePrice: '',
colors: [
{
id: 1,
chosed: true,
name: '黄色',
colorNum:10,
sizeNumStr:'10/20/30' //对应的商品尺码数目,用斜杠分割
},
...
],
{
id: 1,
skcId:,
chosed: true,
name: '黄色',
colorNum:10,
sizeNumStr:'10/20/30' //对应的商品尺码数目,用斜杠分割
},
...
],
sizes: [
{
id: 2,
skuId:,
goodId:,
chosed: true,
name: 'X',
sizeNum: 2,
colorNumStr:'10/20/30' //对应的商品颜色数目用斜杠分割
},
...
],
totalNum: 20
]
},
'introUrl' : '',
'id' : '',
'preferenceUrl' :'',
}
### 评价列表页面
### 评价列表页面
{
'comments':{
'list' : [
... ... @@ -1375,5 +1376,7 @@
'entitle' : 'LIFESTYLE',
}
],
'showYohood' : true/false
'showYohood' : true/false,
'yohoodHref' : '/yohood'
}
... ...
framework @ 75bbc3b0
Subproject commit e9d066dd88a8e7e37103021c427a205a5cfcdcec
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
... ...
... ... @@ -22,9 +22,24 @@ class HelpData
$param['method'] = 'app.help.li';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(Yohobuy::API_URL, $param, $param);
return Yohobuy::post(Yohobuy::API_URL, $param);
}
/*
* 获取帮助中心列表
*/
public static function serviceDetail($code)
{
//构建必传参数
$param = Yohobuy::param();
$param['method'] = 'app.help.detail';
$param['code'] = $code;
$param['return_type'] = 'html';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(Yohobuy::API_URL, $param, true);
}
}
... ...
... ... @@ -67,5 +67,17 @@ class IndexData
return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/home', $param);
}
/**
* 获取频道选择页数据
*
* @return array
*/
public static function channelData()
{
$param = Yohobuy::param();
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/entrance/getEntrance',$param,3600);
}
}
... ...
... ... @@ -82,4 +82,3 @@ exports.showDialog = function(data, callback) {
}
});
};
... ...
... ... @@ -6,7 +6,9 @@
var $ = require('jquery'),
lazyLoad = require('yoho.lazyload'),
Hammer = require('yoho.hammer');
Hammer = require('yoho.hammer'),
dialog = require('./dialog'),
tip = require('../plugin/tip');
var orderId = $('#order-detail').data('id');
... ... @@ -24,26 +26,64 @@ optHammer.on('tap', function(e) {
if ($cur.hasClass('btn-del')) {
//删除订单
if (confirm('确定删除订单吗?')) {
dialog.showDialog({
dialogText: '确定删除订单吗?',
hasFooter: {
leftBtnText: '取消',
rightBtnText: '确定'
}
}, function() {
$.ajax({
type: 'GET',
url: '/home/delOrder',
data: {
id: orderId
}
}).then(function(res) {
$('#dialog-wrapper').hide();
if (!res) {
tip.show('网络错误');
}
if (res.code === 200) {
tip.show('删除成功');
} else {
tip.show(res.message || '网络错误');
}
window.location.href = '/home/orders';
}).fail(function() {
tip.show('网络错误');
});
}
});
} else if ($cur.hasClass('btn-cancel')) {
//取消订单
if (confirm('确定取消订单吗?')) {
dialog.showDialog({
dialogText: '确定取消订单吗?',
hasFooter: {
leftBtnText: '取消',
rightBtnText: '确定'
}
}, function() {
$.ajax({
type: 'GET',
url: '/home/cancelOrder',
data: {
id: orderId
}
}).then(function(res) {
$('#dialog-wrapper').hide();
if (!res) {
tip.show('网络错误');
}
if (res.code === 200) {
tip.show('取消成功');
} else {
tip.show(res.message || '网络错误');
}
window.location.reload();
}).fail(function() {
tip.show('网络错误');
});
}
});
}
});
\ No newline at end of file
});
... ...
... ... @@ -10,28 +10,51 @@ var Swiper = require('yoho.iswiper'),
var recommendSwiper,
$recommendForYou = $('.recommend-for-you'),
preferenceUrl = $('#preferenceUrl').val();
if (preferenceUrl) {
$.get(preferenceUrl).then(function(html) {
if (html.length < 5) {
$recommendForYou.css('display', 'none');
} else {
$recommendForYou.html(html).show();
if ($('#swiper-recommend').length) {
recommendSwiper = new Swiper('#swiper-recommend', {
slidesPerView: 'auto',
grabCursor: true,
slideElement: 'a',
lazyLoading: true,
watchSlidesVisibility: true
});
preferenceUrl = $('#preferenceUrl').val(),
winH = $(window).height(),
end = false,
requesting = false;
function request() {
if (requesting || end) {
return;
}
requesting = true;
if (preferenceUrl) {
$.get(preferenceUrl).then(function(html) {
if (html.length < 5) {
$recommendForYou.css('display', 'none');
} else {
$recommendForYou.html(html).show();
if ($('#swiper-recommend').length) {
recommendSwiper = new Swiper('#swiper-recommend', {
slidesPerView: 'auto',
grabCursor: true,
slideElement: 'a',
lazyLoading: true,
watchSlidesVisibility: true
});
}
}
}
window.rePosFooter();
requesting = false;
end = true;
}).fail(function() {
$recommendForYou.hide();
});
}).fail(function() {
$recommendForYou.hide();
});
}
}
function scrollHandler() {
if (!end || $(window).scrollTop() + winH >= $(document).height() - 50) {
request();
}
}
$(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
... ...
... ... @@ -78,7 +78,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
//根据颜色切换图片
if ($this.closest('.block-list').hasClass('color-list')) {
$('.chose-panel .basic-info').find('.thumb').addClass('hide').eq(index).removeClass('hide');
$('.chose-panel').find('.thumb').addClass('hide').eq(index).removeClass('hide');
}
if ($chosed.length === 0) {
... ... @@ -120,6 +120,10 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
}
numArray = $siblingBlock.find('.chosed').data('numstr').split('/');
$that.find('.num .left-num').html('剩余' + numArray[index] + '件');
if (2 === $chosed.closest('.zero-stock').length) {
$('#chose-btn-sure').css('background-color', '#c0c0c0');
$('#chose-btn-sure').html('已售罄');
}
}
}).on('touchstart', '.btn-minus', function() {
... ...
... ... @@ -6,6 +6,7 @@
var $ = require('jquery'),
ellipsis = require('mlellipsis'),
chosePanel = require('../shopping-cart/chose-panel'),
lazyLoad = require('yoho.lazyload');
var dialog = require('../me/dialog'),
... ... @@ -149,3 +150,34 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
//})
$('.btn-balance').on('touchend', function() {
window.location.href = '/shoppingCart/orderEnsure?cartType=';
});
$('.down').on('touchend', function() {
chosePanel.show();
});
$('.cut').on('touchend', function() {
var id = $(this).closest('.shopping-cart-good').data('id');
$.ajax({
type: 'GET',
url: '/shoppingCart/modify',
data: {
old_product_sku: id,
new_product_sku: id,
buy_number: '0',
selected: 'Y'
},
success: function(data) {
if (data.code === 200) {
window.history.go(0);
}
},
error: function() {
tip.show('网络错误');
}
});
});
... ...
... ... @@ -9,12 +9,14 @@ var $ = require('jquery'),
Hammer = require('yoho.hammer'),
Handlebars = require('yoho.handlebars'),
tip = require('../plugin/tip'),
loading = require('../plugin/loading'),
orderInfo = require('./order-info').orderInfo;
var dispatchModeHammer,
dispatchTimeHammer,
$invoice = $('.invoice'),
$price = $('.price-cal'),
payType,
priceTmpl = Handlebars.compile($('#tmpl-price').html());
lazyLoad();
... ... @@ -93,39 +95,54 @@ function orderCompute() {
}
function submitOrder() {
loading.showLoadingMask();
$.ajax({
method: 'POST',
url: '/shoppingCart/orderSub',
data: {
addressId: orderInfo('addressId'),
cartType: orderInfo('cartType'),
deliveryId: orderInfo('deliveryId') || 1,
deliveryTimeId: orderInfo('deliveryTimeId') || 1,
invoiceText: orderInfo('invoiceText'),
invoiceType: orderInfo('invoiceType'),
msg: orderInfo('msg'),
deliveryId: orderInfo('deliveryId'),
deliveryTimeId: orderInfo('deliveryTimeId'),
invoiceText: $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'),
invoiceType: $invoice.find('.invoice-type').val() || orderInfo('invoiceType'),
msg: $('#msg').find('input').val() || orderInfo('msg'),
paymentTypeId: orderInfo('paymentTypeId'),
paymentType: orderInfo('paymentType'), //支付方式
couponCode: orderInfo('couponCode'),
yohoCoin: orderInfo('yohoCoin')
}
}).then(function(res) {
var url;
if (!res) {
loading.hideLoadingMask();
tip.show('网络出错');
return;
}
if (res.code !== 200) {
tip.show(res.message || '网络出错');
if (res.code === 200) {
if (payType === 2) {
// 货到付款的进入订单页面
url = '/home/orderDetail?order_code=' + res.data.order_code;
} else {
url = '/home/pay?order_code=' + res.data.order_code;
}
window.setCookie('order-info', '');
window.location.href = url;
} else {
console.log(1);
loading.hideLoadingMask();
tip.show(res.messege || '网络出错');
}
}).fail(function() {
loading.hideLoadingMask();
tip.show('网络出错');
});
}
// 界面点击,状态存 cookie
if (!orderInfo('addressId')) {
orderInfo('addressId', $('.address-wrap').data('address-id'));
orderInfo('addressId', $('.address-wrap').data('id'));
}
$('.dispatch-mode').on('touchend', 'li', function() {
... ... @@ -167,7 +184,10 @@ $('#msg').find('input').on('blur', function() {
});
$('.pay-mode').on('click', 'li', function() {
orderInfo('paymentTypeId', $(this).data('pay-id'));
orderInfo('paymentType', $(this).data('pay-type'));
var $this = $(this);
orderInfo('paymentTypeId', $this.data('pay-id'));
orderInfo('paymentType', $this.data('pay-type'));
payType = $this.data('pay-type');
submitOrder();
});
... ...
... ... @@ -30,6 +30,7 @@ $newCoupon.on('submit', function() {
if (res.code === 200) {
tip.show('优惠券可用');
orderInfo('couponCode', res.data.coupon_code);
orderInfo('couponValue', res.data.coupon_value);
window.location.href = '/shoppingCart/orderEnsure?coupon_code=' + res.data.coupon_code;
} else {
tip.show(res.message);
... ...
... ... @@ -2,6 +2,16 @@
width: 100%;
overflow: hidden;
margin: 0 auto;
#yohood {
background-color: transparent;
background-image: image-url('yohood.png');
background-size: 40%;
background-repeat: no-repeat;
background-position-x: 26%;
background-position-y: 36%;
border: none;
border-bottom: 4px solid #fff;
}
.index-header {
box-sizing: border-box;
padding: 0 20rem / $pxConvertRem;
... ...
... ... @@ -113,7 +113,7 @@
border-color: #e0e0e0;
background: none;
color: #e0e0e0;
background-color: #f0f0f0;
background-color: #c0c0c0;
}
}
... ...
... ... @@ -151,32 +151,61 @@
}
}
}
.calculate-num{
float: right;
.calculate{
float: right;
border:1px solid #b0b0b0;
border-radius:.2rem;
p{
color: #444;
&:first-child{
height: 60rem / $pxConvertRem;
border-bottom:1px solid #b0b0b0;
span {
border-left:1px solid #b0b0b0;
border-right:1px solid #b0b0b0;
}
}
i{
width: 72rem / $pxConvertRem;
height: 60rem / $pxConvertRem;
float: left;
line-height: 60rem / $pxConvertRem;
text-align: center;
}
span{
width: 96rem / $pxConvertRem;
height: 60rem / $pxConvertRem;
float: left;
font-size: 40rem / $pxConvertRem;
line-height: 60rem / $pxConvertRem;
text-align: center;
}
&:last-child {
span{
width: 168rem / $pxConvertRem;
overflow: hidden;
font-size: 48em / $pxConvertRem;
text-overflow:ellipsis;
white-space:nowrap;
}
}
}
}
.price{
line-height: 60rem / $pxConvertRem;
font-size: 52em / $pxConvertRem;
font-weight: bold;
}
.count{
position: absolute;
right: 20rem / $pxConvertRem;;
top: 20rem / $pxConvertRem;;
font-size: 52em / $pxConvertRem;
.good-detail-img {
// position: relative;
//height: 368rem / $pxConvertRem;
//.good-islike {
// position: absolute;
// width: 60rem / $pxConvertRem;
// height: 60rem / $pxConvertRem;
// top: 0rem / $pxConvertRem;
// right: 0rem / $pxConvertRem;
// line-height: 60rem / $pxConvertRem;
// font-size: 30rem / $pxConvertRem;
// text-align: center;
// color: #b0b0b0;
// text-decoration: none;
//}
//
//.good-like {
// color: #d72928;
//}
//img {
// display: block;
// width: 100%;
// height: 368rem / $pxConvertRem;
//}
.few-tag {
position: absolute;
... ...
... ... @@ -178,116 +178,6 @@
}
}
.gift-advance-good {
position: relative;
padding: 20rem / $pxConvertRem 0;
margin-left: 34rem / $pxConvertRem;
height: 160rem / $pxConvertRem;
border-bottom: 1px solid #e0e0e0;
&:last-child {
border-bottom: none;
}
}
.advance-block .gift-advance-good:last-child {
border-bottom: none;
}
.advance-block:last-child .gift-advance-good:last-child {
border-bottom: 1px solid #e0e0e0;
}
.thumb-wrap {
position: relative;
float: left;
width: 120rem / $pxConvertRem;
height: 160rem / $pxConvertRem;
.thumb {
width: 100%;
height: 100%;
}
}
.tag {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 25rem / $pxConvertRem;
color: #fff;
text-align: center;
background: #a1ce4e;
&:before {
content: '赠品';
}
}
.deps {
margin-left: 135rem / $pxConvertRem;
}
.name {
font-size: 28rem / $pxConvertRem;
}
.row:nth-child(2) {
font-size: 22rem / $pxConvertRem;
height: 45rem / $pxConvertRem;
line-height: 45rem / $pxConvertRem;
> span {
margin-right: 15rem / $pxConvertRem;
}
}
.row:nth-child(3) {
position: relative;
}
.color, .size {
color: #b6b6b6;
}
.price {
font-size: 24rem / $pxConvertRem;
color: #000;
}
.count {
font-size: 20rem / $pxConvertRem;
color: #999;
margin-left: 22rem / $pxConvertRem;
}
.chose {
position: absolute;
width: 88rem / $pxConvertRem;
height: 58rem / $pxConvertRem;
background: #f8f8f8;
border: 1px solid #ccc;
right: 20rem / $pxConvertRem;
top: 71rem / $pxConvertRem;
font-size: 26rem / $pxConvertRem;
}
.title {
height: 50rem / $pxConvertRem;
line-height: 50rem / $pxConvertRem;
padding-left: 20rem / $pxConvertRem;
font-size: 24rem / $pxConvertRem;
background: #f8f8f8;
}
.advance-block .tag {
background: #eb76aa;
&:before {
content: '加价购';
}
}
}
.shopping-cart-zero{
.cart-zero{
... ...
... ... @@ -93,7 +93,7 @@
}
.coupon-count {
padding: 5rem / $pxConvertRem;
padding: 5rem / $pxConvertRem 15rem / $pxConvertRem;
background: #f00;
color: #fff;
@include border-radius(10px);
... ... @@ -104,6 +104,14 @@
.coin-check {
float: right;
color: #999;
&.used {
color: #f00;
}
.iconfont {
color: #999;
}
}
.coin-check {
... ... @@ -115,6 +123,10 @@
color: #000;
}
em {
color: #f00;
}
}
.checkbox.icon-checkbox {
... ... @@ -187,6 +199,10 @@
}
}
.price-cal {
font-family: monospace;
}
.cost {
border-top: 1px solid #f7f7f7;
line-height: 100rem / $pxConvertRem;
... ...
... ... @@ -2,7 +2,7 @@
<div class="iHelp">
<ul>
{{# iHelp}}
<li><a href="/home/helpDetail?code={{ code}}"><span>{{ name}}</span><i class="iconfont num">&#xe604;</i></a></li>
<li><a href="{{url}}"><span>{{ name}}</span><i class="iconfont num">&#xe604;</i></a></li>
{{/ iHelp}}
</ul>
</div>
... ...
{{> layout/header}}
{{ iHelp}}
{{{iHelp}}}
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -106,15 +106,13 @@
<span class="iconfont num">&#xe604;</span>
</a>
</div>
{{!
<div class="group-list">
<a class="list-item" href="/help.html">
<a class="list-item" href="/home/help">
<span class="iconfont icon">&#xe639;</span>
帮助
<span class="iconfont num">&#xe604;</span>
</a>
</div>
}}
{{> product/recommend-for-you}}
{{> product/suspend-cart}}
... ...
... ... @@ -23,7 +23,7 @@
<a href="{{href}}" class="list-item">{{title}} <span class="lighter">{{entitle}}</span> <span class="iconfont right-icon">&#xe614;</span></a>
{{/channelList}}
{{#showYohood}}
<a href="/yohood" id="yohood" class="list-item"> <span class="iconfont right-icon">&#xe614;</span></a>
<a href="{{yohoodHref}}" id="yohood" class="list-item"> <span class="iconfont right-icon">&#xe614;</span></a>
{{/showYohood}}
</div>
</div>
... ...
{{> layout/header}}
<div id="mainCart" class="shopping-cart-page yoho-page">
{{# shoppingCart}}
{{#if cartNav}}
<ul class="cart-nav clearfix">
... ... @@ -45,7 +44,6 @@
{{/ shoppingCart}}
</div>
<div id="advanceBuy" class="shopping-cart-page yoho-page hide">
{{# shoppingCart}}
{{# commonCart}}
... ... @@ -68,6 +66,7 @@
<a href="">随便逛逛</a>
</div>
{{> product/recommend-for-you}}
{{> shopping-cart/chose-panel}}
</div>
{{> shopping-cart/chose-panel}}
... ...
{{> layout/header}}
<div class="order-ensure-page yoho-page">
{{# orderEnsure}}
<a class="address-wrap block" href="/shoppingCart/selectAddress" data-address-id="{{addressId}}">
<a class="address-wrap block" data-id="{{addressId}}" href="/shoppingCart/selectAddress">
<p class="infos">
收货地址
<span class="per-info">{{name}} {{phoneNum}}</span>
... ... @@ -44,7 +44,6 @@
{{# coupon}}
<li class="coupon">
<a href="/shoppingCart/selectCoupon">
<!-- <a href="{{url}}"> -->
<span class="title">优惠券</span>
{{#if count}}
<span class="coupon-count">
... ... @@ -67,16 +66,14 @@
</li>
{{/coupon}}
{{# yohoCoin}}
<li class="coin" data-yoho-coin="{{.}}">
<span class="title">YOHO币</span>
<span class="desc">可抵用¥{{.}}</span>
<span class="coin-check">
<em>- ¥ {{.}}</em>
<i class="iconfont checkbox icon-cb-checked"></i>
</span>
</li>
{{/ yohoCoin}}
<li class="coin" data-yoho-coin="{{yohoCoin}}">
<span class="title">YOHO币</span>
<span class="desc">可抵用¥{{yohoCoin}}</span>
<span class="coin-check">
<em>- ¥ {{yohoCoin}}</em>
<i class="iconfont checkbox icon-cb-checked"></i>
</span>
</li>
{{#if invoice}}
<li class="invoice {{#if needInvoice}}focus{{/if}}">
... ... @@ -124,7 +121,7 @@
{{/couponPrice}}
<li>
<span>YOHO币</span>
- {{yohoCoin}}
- ¥{{yohoCoin}}
</li>
<li class="cost">
应付金额: <em>¥{{price}}</em>
... ...
{{#cartInfo}}
<div class="chose-panel">
<div class="main">
<div class="infos">
... ... @@ -25,7 +25,7 @@
<span>颜色</span>
<ul class="clearfix" data-type="color">
{{# colors}}
<li class="block {{#if chosed}}chosed{{/if}} {{#unless colorNum}}zero-stock{{/unless}}" data-num="{{colorNum}}" data-numstr="{{sizeNumStr}}">
<li class="block {{#if chosed}}chosed{{/if}} {{#unless colorNum}}zero-stock{{/unless}}" data-num="{{colorNum}}" data-numstr="{{sizeNumStr}}" data-skcid="{{skcId}}">
{{name}}
</li>
{{/ colors}}
... ... @@ -35,7 +35,7 @@
<span>尺码</span>
<ul class="clearfix" data-type="size" >
{{# sizes}}
<li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-id={{id}} data-num="{{sizeNum}}" data-numstr="{{colorNumStr}}">
<li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-id={{id}} data-num="{{sizeNum}}" data-numstr="{{colorNumStr}}" data-skuid="{{skuId}}" data-goodid="{{goodId}}">
{{name}}
</li>
{{/ sizes}}
... ... @@ -61,4 +61,3 @@
</div>
</div>
</div>
{{/cartInfo}}
\ No newline at end of file
... ...
... ... @@ -10,6 +10,8 @@
{{/if}}
<div class="info">
<img class="thumb lazy" data-original={{thumb}}>
<!-- <div class="deps">
<div class="">
<a class="" href="{{url}}">
... ... @@ -74,6 +76,16 @@
</span>
{{/if}}
</p>
</div> -->
<div class="calculate-num">
<div class="calculate">
<p><i class="iconfont cut">&#xe625;</i><span>{{count}}</span><i class="iconfont add">&#xe624;</i></p>
<p><span>颜色:{{color}}尺码:{{size}}{{name}}</span><i class="iconfont down">&#xe616;</i></p>
</div>
<p><span class="price"> ¥{{price}}</span></p>
<span class="count">
×{{count}}
</span>
</div>
</div>
<!--<div class="opt-panel hide">
... ... @@ -87,4 +99,5 @@
删除
</div>
</div>-->
</div>
... ...
... ... @@ -835,67 +835,77 @@ class HomeController extends AbstractAction
// 审判跳转登录页
$this->auditJumpLogin();
/* 判断订单号是否传 */
$orderCode = $this->get('order_code');
if (empty($orderCode)) {
$this->error();
}
/* 订单信息不存在 */
$orderDetail = OrderModel::orderDetail($orderCode, $this->_uid, $this->_usession);
if (empty($orderDetail)) {
$this->error();
}
$this->setTitle('订单详情');
$this->setNavHeader('订单详情');
$this->_view->display('order-detail', array(
'orderDetailPage' => true,
'orderDetail' => OrderModel::orderDetail($orderCode, $this->_uid, $this->_session),
'orderDetail' => $orderDetail,
));
}
/**
* 帮助列表页
* 帮助中心列表页
*/
public function helpAction()
{
$this->setTitle('帮助中心');
$this->setNavHeader('帮助中心');
$data = array(
$this->_view->display('help', array(
'iHelp' => Home\HelpModel::serviceInfo(),
);
$this->_view->display('i-help', $data);
));
}
/**
* 帮助列表页
* 帮助中心列表详细信息
*/
public function helpDetailAction()
{
$this->setTitle('帮助中心');
$this->setNavHeader('帮助中心');
$data = array(
'iHelp' => array(
array('name' => '新用户注册'),
)
);
$this->_view->display('helpDetail', $data);
$caption = $this->get('caption', '帮助中心');
$code = $this->get('code', 0);
if (empty($code)) {
$this->error();
}
$this->setTitle($caption);
$this->setNavHeader($caption);
$this->_view->display('helpDetail', array(
'iHelp' => Home\HelpModel::serviceDetail($code),
));
}
/**
/**
* YOHO币详情 新版
*/
public function currencyDetailAction()
{
// 审判跳转登录页
$this->auditJumpLogin();
$this->setTitle('YOHO币');
$this->setNavHeader('YOHO币', true, false);
$data['money'] = '0';
$page = $this->post('page',1);
$size = $this->post('size', 20);
// $data = UserModel::getYohoCoinLists($this->_uid,$page,$size);
$data = UserModel::getYohoCoinLists(3965746,$page,$size);
$data = UserModel::getYohoCoinLists($this->_uid, 0, 20);
$this->_view->display('currency-detail', array(
'money' => $data['money'],
'pageFooter' => true,
'currencyDetail' => true,
'currencyDetailPage' => true
));
}
/**
... ... @@ -903,18 +913,18 @@ class HomeController extends AbstractAction
*/
public function ajaxCurrencyDetailAction()
{
$data['list'] = array();
$data['money'] = 0;
$page = $this->post('page',1);
$size = $this->post('size', 20);
$data = UserModel::getYohoCoinLists($this->_uid,$page,$size);
//$data = UserModel::getYohoCoinLists(3965746,$page,$size);
$this->_view->display('ajax-currency-detail', array(
'currency' => $data['list'],
'pageFooter' => true,
'currencyDetailPage' => true
));
if ($this->isAjax()) {
$uid = $this->getUid();
$page = $this->post('page', 1);
$data = UserModel::getYohoCoinLists($uid, $page, 20);
$this->_view->display('ajax-currency-detail', array(
'currency' => $data['list'],
'pageFooter' => true,
'currencyDetailPage' => true
));
} else {
echo ' ';
}
}
}
... ...
... ... @@ -23,16 +23,16 @@ class IndexController extends AbstractAction
// 设置浏览器缓存5分钟
$this->setExpires(300);
}
$result = Index\HomeModel::getChannel();
$result['background'] = Index\HomeModel::getBgImage();
$result['channelPage'] = true;
$result['showDownloadApp'] = true;
$result['searchUrl'] = Helpers::url('', null, 'search');
$result['pageFooter'] = true;
// 渲染模板
$this->_view->display('index', array(
'background' => Index\HomeModel::getBgImage(),
'channelPage' => true,
'showDownloadApp'=>true,
'searchUrl' => Helpers::url('', null, 'search'),
'pageFooter' => true,
));
$this->_view->display('index', $result);
}
/**
* 设置升级公告路由
*
... ...
... ... @@ -13,24 +13,35 @@ class HelpModel
/*
* 获取帮助中心列表
*/
public static function serviceInfo()
{
//调用接口获取数据
$res = json_decode(HelpData::serviceInfo(), TRUE);
$cateInfo = $res['data'];
$iHelp = array();
$list = array();
if ($cateInfo) {
foreach ($cateInfo as $key => $value) {
$cateInfo = HelpData::serviceInfo();
if (!empty($cateInfo['data'])) {
foreach ($cateInfo['data'] as $key => $value) {
$iHelp[$key]['name'] = $value['caption'];
$iHelp[$key]['code'] = $value['code'];
}
$iHelp[$key]['url'] = Helpers::url('/home/helpDetail', array('code' => $value['code'], 'caption' => $value['caption']));
}
}
return $iHelp;
}
/*
* 获取帮助中心详细内容
*/
}
public static function serviceDetail($code)
{
$res = HelpData::serviceDetail($code);
if (!empty($res)) {
if (false !== ($part = strstr($res, '<body>'))) {
$res = strstr($part, '</body>', true);
}
}
return $res;
}
}
... ...
... ... @@ -590,7 +590,7 @@ class CartModel
$result['message'] = '请选择配送方式';
} else {
$orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);
if ($orderSubRes && isset($orderSubRes['code'])) {
if ($orderSubRes && isset($orderSubRes['code'])) {
$result = $orderSubRes;
}
}
... ...
... ... @@ -10,7 +10,7 @@ use Configs\CacheConfig;
/**
* 首页相关的模板数据模型
*
*
* @name HomeModel
* @package models
* @copyright yoho.inc
... ... @@ -52,7 +52,7 @@ class HomeModel
/**
* 选择频道
*
*
* @return void
*/
public static function goSwitchChannel()
... ... @@ -70,7 +70,7 @@ class HomeModel
/**
* 设置选择的频道保存到浏览器COOKIE
*
*
* @param string $cookie
* @return void
*/
... ... @@ -81,7 +81,7 @@ class HomeModel
/**
* 获取频道选择页的背景图片
*
*
* @return string | false
*/
public static function getBgImage()
... ... @@ -122,7 +122,7 @@ class HomeModel
/**
* 获取男生,女生底部banner
*
*
* @return string | false
*/
public static function getBottomBanner($channel)
... ... @@ -164,7 +164,7 @@ class HomeModel
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else {
Cache::set($cache, $result);
Cache::set($cache, $result);
}
}
... ... @@ -173,7 +173,7 @@ class HomeModel
/**
* 获取男生首页的楼层数据
*
*
* @return array | false
*/
public static function getBoysFloor()
... ... @@ -204,13 +204,13 @@ class HomeModel
Cache::set(CacheConfig::KEY_ACTION_BOYS_INDEX, $result);
}
}
return $result;
}
/**
* 获取女生首页的楼层数据
*
*
* @return array | false
*/
public static function getGirlsFloor()
... ... @@ -247,7 +247,7 @@ class HomeModel
/**
* 获取潮童首页的楼层数据
*
*
* @return array | false
*/
public static function getKidsFloor()
... ... @@ -284,7 +284,7 @@ class HomeModel
/**
* 获取创意生活首页的楼层数据
*
*
* @return array | false
*/
public static function getLifestyleFloor()
... ... @@ -319,4 +319,53 @@ class HomeModel
return $result;
}
/**
* 获取频道选择页数据
*
* @return array
*/
public static function getChannel(){
$result = array();
$result['showYohood'] = false;
$data = IndexData::channelData();
$channelList = array();
if(isset($data['data']['list'])){
foreach($data['data']['list'] as $key => $value){
switch ($value['channel_id']) {
case 5:
$result['showYohood'] = true;
$result['yohoodHref'] = '/yohood';
break;
case 1:
$channelList[$key]['href'] = '/boys';
$channelList[$key]['title'] = '男生';
$channelList[$key]['entitle'] = 'BOYS';
break;
case 2:
$channelList[$key]['href'] = '/girls';
$channelList[$key]['title'] = '女生';
$channelList[$key]['entitle'] = 'GIRLS';
break;
case 3:
$channelList[$key]['href'] = '/kids';
$channelList[$key]['title'] = '潮童';
$channelList[$key]['entitle'] = 'KIDS';
break;
case 4:
$channelList[$key]['href'] = '/lifestyle';
$channelList[$key]['title'] = '创意生活';
$channelList[$key]['entitle'] = 'LIFESTYLE';
break;
default:
break;
}
}
$result['channelList'] = $channelList;
}
return $result;
}
}
... ...
... ... @@ -379,7 +379,7 @@ class UserModel
public static function getYohoCoinLists($uid, $page, $limit)
{
$result = array();
$data['money'] = '0';
// 调用接口获取YOHO币
$yohoCoin = UserData::yohoCoinData($uid, $page, $limit, 'post');
// 处理YOHO币数据
... ... @@ -396,6 +396,7 @@ class UserModel
}
}
$data['list'] = $result;
return $data;
}
... ...
... ... @@ -160,17 +160,15 @@ class DetailModel
$colorGroup = array();
$sizeList = array();
$goodsGroup = array();
$coverImage = '';
$colorStorageNum = 0; // 颜色的库存总数
$thumbImageList = array();
$colorStorageGroup = array(); // 颜色分组的库存总数集合, 多个之间用/分隔
$sizeStorageStr = ''; // 尺码库存总数集合, 多个之间用/分隔
$colorStorageNum = 0;
$totalStorageNum = 0; // 总库存数
foreach ($baseInfo['goodsList'] as $i => $value) {
foreach ($baseInfo['goodsList'] as $value) {
$sizeList = array();
$colorStorageNum = 0;
// 获取默认的封面图
if ($i === 0) {
$coverImage = Helpers::getImageUrl($value['colorImage'], 60, 60);
}
$sizeStorageStr = '';
// 商品分组
if (isset($value['goodsImagesList'])) {
... ... @@ -189,10 +187,13 @@ class DetailModel
'id' => $size['id'],
'skuId' => $size['goodsSizeSkuId'],
'goodsId' => $size['goodsId'],
'colorId' => $value['colorId'],
'name' => $size['sizeName'],
'sizeNum' => $size['goodsSizeStorageNum'],
);
$colorStorageNum += intval($size['goodsSizeStorageNum']);
$sizeStorageStr .= $size['goodsSizeStorageNum'] . '/';
$colorStorageGroup[ $size['sizeName'] ][ $value['colorName'] ] = $size['goodsSizeStorageNum'];
}
}
... ... @@ -202,11 +203,19 @@ class DetailModel
'skcId' => $value['productSkc'],
'name' => $value['colorName'],
'goodsName' => $value['goodsName'],
'shortUrl' => Helpers::getImageUrl($value['colorImage'], 60, 60),
'colorNum' => $colorStorageNum,
'sizes' => $sizeList,
'sizeNumStr' => rtrim($sizeStorageStr, '/'),
);
// 缩略图
$thumbImageList[] = array('img' => Helpers::getImageUrl($value['colorImage'], 60, 60) );
// 统计尺码对应的各个颜色的库存量
foreach ($sizeList as &$sizeArr) {
$sizeArr['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['name'] ]) );
}
// 商品库存总数
$totalStorageNum += $colorStorageNum;
}
... ... @@ -238,12 +247,13 @@ class DetailModel
if (!$soldOut && !$notForSale) {
$result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html');
$result['cartInfo']['productId'] = $productId;
$result['cartInfo']['thumb'] = $coverImage;
$result['cartInfo']['thumbs'] = $thumbImageList;
$result['cartInfo']['name'] = isset($result['goodsName']) ? $result['goodsName'] : '';
$result['cartInfo']['price'] = isset($result['goodsPrice']['currentPrice']) ? $result['goodsPrice']['currentPrice'] : '';
$result['cartInfo']['salePrice'] = isset($result['goodsPrice']['previousPrice']) ? $result['goodsPrice']['previousPrice'] : '';
$result['cartInfo']['totalNum'] = $totalStorageNum;
$result['cartInfo']['colors'] = $colorGroup;
$result['cartInfo']['sizes'] = $sizeList;
}
// 非卖品
elseif ($notForSale) {
... ... @@ -336,7 +346,7 @@ class DetailModel
$referenceList = array();
// 判断是否显示参考尺码
$showReference = !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['referenceSize']) && ($sizeInfo['sizeInfoBo']['sizeBoList'][0]['referenceSize']['gender'] == $gender || $sizeInfo['sizeInfoBo']['sizeBoList'][0]['referenceSize']['gender'] == 3);
$showReference = !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['referenceSize']);
if ($showReference) {
$referenceList[0] = array('param' => $referenceName);
}
... ... @@ -351,7 +361,10 @@ class DetailModel
foreach ($sizeInfo['sizeInfoBo']['sizeBoList'] as $value) {
$item = array();
$sizeNameList[] = array('param' => $value['sizeName']);
if (!empty($value['referenceSize']['gender']) && ($value['referenceSize']['gender'] == $gender || $value['referenceSize']['gender'] == 3)) {
if (!empty($value['referenceSize']['gender']) && $boyReference && ($value['referenceSize']['gender'] == 1 || $value['referenceSize']['gender'] == 3)) {
$referenceList[] = array('param' => empty($value['referenceSize']['referenceName']) ? ' ' : $value['referenceSize']['referenceName']);
}
elseif (!empty($value['referenceSize']['gender']) && $girlReference && ($value['referenceSize']['gender'] == 2 || $value['referenceSize']['gender'] == 3)) {
$referenceList[] = array('param' => empty($value['referenceSize']['referenceName']) ? ' ' : $value['referenceSize']['referenceName']);
}
foreach ($value['sortAttributes'] as $attr) {
... ...
... ... @@ -59,7 +59,7 @@ class BindController extends AbstractAction
$phoneNum=$this->get('phoneNum');
$data = array(
'bindIndex'=>true,//js标识
'bindCode'=>true,//js标识
'backUrl' => '/', // 返回的URL链接
'showHeaderImg' => true, // 控制显示头部图片
'isPassportPage' => true, // 模板中模块标识
... ... @@ -86,15 +86,17 @@ class BindController extends AbstractAction
$sourceType = $this->get('sourceType');
$nickname = $this->get('nickname');
$areaCode = $this->get('areaCode', '86');
$phoneNum=$this->get('phoneNum');
$data = array(
'bindIndex'=>true,//js标识
'bindPwd'=>true,//js标识
'backUrl' => '/', // 返回的URL链接
'showHeaderImg' => true, // 控制显示头部图片
'isPassportPage' => true, // 模板中模块标识
'sourceType' => $sourceType, // 第三方登录来源
'openId' => $openId, // openId
'nickname' => $nickname, //昵称
'areaCode' => $areaCode //国别码
'areaCode' => $areaCode, //国别码
'phoneNum' => $phoneNum //国别码
);
// 渲染模板
... ... @@ -138,7 +140,7 @@ class BindController extends AbstractAction
}
else
{
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => $res['data']);
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => isset($res['data'])?$res['data']:'');
}
}
while (false);
... ... @@ -192,15 +194,15 @@ class BindController extends AbstractAction
}
$phoneNum = $this->post('phoneNum');
$msgCode = $this->post('msgCode');
$code = $this->post('code');
$areaCode = $this->post('areaCode');
if (!is_numeric($phoneNum) || !$msgCode)
if (!is_numeric($phoneNum) || !$code)
{
break;
}
$data = BindData::checkBindCode($areaCode,$phoneNum, $msgCode);
$data = BindData::checkBindCode($areaCode,$phoneNum, $code);
if (!isset($data['code']))
{
break;
... ...
... ... @@ -187,7 +187,7 @@ class LoginController extends AbstractAction
$isBind = $result['data']['is_bind'];
if ($isBind == 'N')
{
$this->go(Helpers::url('/passport/bind/index',array('openId'=>$userId,'sourceType'=>'alipay','nickName'=>$realName)));
$this->go(Helpers::url('/passport/bind/index',array('openId'=>$userId,'sourceType'=>'alipay','nickname'=>$realName)));
}
$refer = $this->getCookie('refer');
... ... @@ -226,7 +226,7 @@ class LoginController extends AbstractAction
$isBind = $result['data']['is_bind'];
if ($isBind == 'N')
{
$this->go(Helpers::url('/passport/bind/index',array('openId'=>$access['openid'],'sourceType'=>'qq','nickName'=>$partnerInfo['nickname'])));
$this->go(Helpers::url('/passport/bind/index',array('openId'=>$access['openid'],'sourceType'=>'qq','nickname'=>$partnerInfo['nickname'])));
}
$refer = $this->getCookie('refer');
... ... @@ -270,7 +270,7 @@ class LoginController extends AbstractAction
$isBind = $result['data']['is_bind'];
if ($isBind == 'N')
{
$this->go(Helpers::url('/passport/bind/index',array('openId'=>$access['uid'],'sourceType'=>'sina','nickName'=>$partnerInfo['screen_name'])));
$this->go(Helpers::url('/passport/bind/index',array('openId'=>$access['uid'],'sourceType'=>'sina','nickname'=>$partnerInfo['screen_name'])));
}
$refer = $this->getCookie('refer');
... ...