Authored by Rock Zhang

Merge branch 'develop' into test

Conflicts:
	library/Api/Yohobuy.php
Showing 36 changed files with 375 additions and 201 deletions
... ... @@ -1245,6 +1245,6 @@
'cartInfo' : {
'numInCart' : 3,
'goodsInstore' : 0,
''
'isCollect':true//
}
}
... ...
... ... @@ -28,7 +28,7 @@ class Yohobuy
const SERVICE_URL = 'http://test.service.api.yohobuy.com/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const YOHOBUY_ORDER = 'http://192.168.102.209:8080/yoho-order/'; //我的订单
const API_URL_MYCENTER = 'http://192.168.102.213:8081/yoho-users-web/'; // 我的个人中心接口URL
const API_URL_MYCENTER = 'http://192.168.102.205:8081/api-gateway-web/'; // 我的个人中心接口URL
const API_URL_SHOPINGCART = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的购物车接口URL
const API_URL_PRODUCTDETAIL = 'http://192.168.102.209:18080/yoho-product/'; // 商品详情页
... ...
... ... @@ -51,17 +51,17 @@ class CartData
}
/**
* 修改购物车商品数据
* 移入收藏夹
*
* @param int $uid 用户ID
* @param string $swapData 商品数据
* @param string $sku 商品sku列表
* @return array 接口返回的数据
*/
public static function modifyCartProduct($uid, $swapData)
public static function addToFav($uid, $sku)
{
$param = Yohobuy::param();
$param['method'] = 'app.Shopping.swap';
$param['swap_data'] = $swapData;
$param['method'] = 'app.Shopping.addfavorite';
$param['product_sku_list'] = $sku;
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
... ... @@ -69,17 +69,35 @@ class CartData
}
/**
* 移入收藏夹
* 获取购物车商品数据
*
* @param int $uid 用户ID
* @param string $sku 商品sku列表
* @param int $skn 商品skn
* @return array 接口返回的数据
*/
public static function addToFav($uid, $sku)
public static function cartProductData($uid, $skn)
{
$param = Yohobuy::param();
$param['method'] = 'app.Shopping.addfavorite';
$param['product_sku_list'] = $sku;
$param['method'] = 'app.product.data';
$param['product_skn'] = $skn;
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 修改购物车商品数据
*
* @param int $uid 用户ID
* @param string $swapData 商品数据
* @return array 接口返回的数据
*/
public static function modifyCartProduct($uid, $swapData)
{
$param = Yohobuy::param();
$param['method'] = 'app.Shopping.swap';
$param['swap_data'] = $swapData;
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
... ...
... ... @@ -9,4 +9,5 @@ require('./order-detail');
require('./fav');
require('./index');
require('./coupons');
require('./online-service');
\ No newline at end of file
require('./online-service');
require('./address');
\ No newline at end of file
... ...
... ... @@ -6,12 +6,17 @@
var $ = require('jquery');
var $userAvatar = $('.user-avatar'),
$listItem = $('.list-item');
var myImage = new Image();
var myImage = new Image(),
avatar;
require('../product/recommend-for-you.js');
myImage.src = $userAvatar.attr('src');
myImage.onerror = function() {
$userAvatar.attr('src', 'http://static.dev.yohobuy.com/img/me/index/user-avatar.png');
require('../product/suspend-cart.js');
// 部分老用户没有头像,显示默认头像
avatar = $userAvatar.data('avatar');
myImage.src = avatar;
myImage.onload = function() {
$userAvatar.css('background-image', 'url(' + avatar + ')');
};
$('.yoho-page').on('touchstart', '.list-item, .type-item', function() {
... ...
... ... @@ -5,9 +5,12 @@
*/
var $ = require('jquery');
var $userAvatar = $('.user-avatar');
var myImage = new Image();
var myImage = new Image(),
avatar;
myImage.src = $userAvatar.attr('src');
myImage.onerror = function() {
$userAvatar.attr('src', 'http://static.dev.yohobuy.com/img/me/index/user-avatar.png');
// 部分老用户没有头像,显示默认头像
avatar = $userAvatar.data('avatar');
myImage.src = avatar;
myImage.onload = function() {
$userAvatar.css('background-image', 'url(' + avatar + ')');
};
... ...
... ... @@ -47,15 +47,6 @@ function search() {
slidesPerView: 'auto'
});
//优选
// recommendSwiper = new Swiper('#swiper-recommend', {
// slidesPerView: 'auto',
// grabCursor: true,
// slideElement: 'li',
// lazyLoading: true,
// watchSlidesVisibility: true
// });
searching = false;
end = true;
loading.hideLoadingMask();
... ...
... ... @@ -11,8 +11,7 @@ var goodsSwiper;
require('./desc');
require('./comments-consults');
require('./like.js');
require('../recommend-for-you.js');
require('./like');
lazyLoad($('img.lazy'));
... ... @@ -50,6 +49,4 @@ $('.goodsDiscount .dropdown').on('click', function() {
$('.goodsDiscount .first-item span').html('');
$('.goodsDiscount .discount-folder').slideUp();
}
});
});
\ No newline at end of file
... ...
... ... @@ -7,11 +7,12 @@ var $ = require('jquery'),
Hammer = require('yoho.hammer'),
tip = require('../../plugin/tip');
var likeHammer = new Hammer('#likeBtn');
var likeHammer = new Hammer(document.getElementById('likeBtn'));
likeHammer.on('tap', function(e) {
var productId = $('#productId').val(),
opt;
var $this = $(this);
if ($this.hasClass('liked')) {
... ... @@ -40,4 +41,9 @@ likeHammer.on('tap', function(e) {
tip.show('网络断开连接了~');
}
});
});
\ No newline at end of file
});
// $('#likeBtn').on('click', function(e) {
// return false;
// });
\ No newline at end of file
... ...
... ... @@ -17,7 +17,7 @@ $.get('/home/preference').then(function(html) {
recommendSwiper = new Swiper('#swiper-recommend', {
slidesPerView: 'auto',
grabCursor: true,
slideElement: 'li',
slideElement: 'a',
lazyLoading: true,
watchSlidesVisibility: true
});
... ...
... ... @@ -102,6 +102,7 @@ a {
color: #fff;
font-size: 18px;
border: none;
z-index:2;
@include border-radius(10px);
}
... ...
... ... @@ -105,4 +105,22 @@
font-weight: bold;
color: #fff;
}
}
.systemMain{
width: 92%;
height: 100%;
overflow: hidden;
background-color:#444;
color: #fff;
padding:0 4%;
position: absolute;
top: 0;
left: 0;
p{
font-size: 52em / $pxConvertRem;
line-height: 60rem / $pxConvertRem;
&:first-of-type{
padding-top: 90rem / $pxConvertRem;
}
}
}
\ No newline at end of file
... ...
... ... @@ -25,10 +25,17 @@
height: pxToRem(126px);
border-radius: 50%;
border: pxToRem(6px) solid #a7a8a9;
background-image: image-url("me/index/user-avatar.png");
background-size: 100%;
}
.username {
float: left;
padding: 0 pxToRem(16px);
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
max-width: pxToRem(290px);
}
.vip-icon {
... ...
... ... @@ -17,6 +17,14 @@
}
height: 80rem / $pxConvertRem;
border-bottom: 1px solid #e0e0e0;
.user-avatar {
width: 100%;
height: 100%;
background-image: image-url("me/index/user-avatar.png");
background-size: 100%;
}
span{
&:first-of-type{
color: #444;
... ...
.goods-comments-page {
.goods-comments {
.comment-item {
border: 1px solid $borderC;
border-bottom: 1px solid $borderC;
padding: 0 pxToRem(28px);
.user-name {
font-size: pxToRem(24px);
... ... @@ -39,12 +39,14 @@
}
.goods-consults-page {
background-color: #f0f0f0;
.goto-consult {
padding: 0 pxToRem(28px);
height: pxToRem(120px);
background-color: #ffffff;
i,
span {
span,
a {
line-height: pxToRem(120px);
font-size: pxToRem(28px);
color: $mainFontC;
... ... @@ -59,6 +61,7 @@
}
.goods-consults {
.consult-item {
margin-top: pxToRem(30px);
padding: pxToRem(20px) pxToRem(28px);
background-color: #fff;
.question {
... ... @@ -98,10 +101,10 @@
}
}
}
.gap-block {
min-height: 30rem/$pxConvertRem;
background-color: #f0f0f0;
}
// .gap-block {
// min-height: 30rem/$pxConvertRem;
// background-color: #f0f0f0;
// }
}
.consult-form-page {
... ...
... ... @@ -30,50 +30,52 @@ $basicBtnC:#eb0313;
left: pxToRem(30px);
right: auto;
}
.tag-container{
.tag-container {
position: absolute;
left: pxToRem(108px);
top: pxToRem(40px);
height: pxToRem(35px);
// width: pxToRem(70px);
color: #fff;
font-size: pxToRem(20px);
line-height: pxToRem(35px);
z-index: 2;
.good-tag{
display: inline-block;
box-sizing: border-box;
margin-left: .5px;
font-size: pxToRem(23px);
text-align: center;
line-height: pxToRem(35px);
padding:0 8px;
}
.new-tag {
background-color: #78dc7e;
color: #fff;
}
.renew-tag {
background-color: #78dc7e;
color: #fff;
}
.sale-tag {
background-color: #ff575c;
color: #fff;
}
.new-festival-tag {
background-color: #000;
color: #fff;
}
.limit-tag {
border: 1px solid #000;
color: #000;
}
.soonSoldOut-tag{
background-color:#ffac5b;
color:#fff;
}
// width: pxToRem(70px);
color: #fff;
font-size: pxToRem(20px);
line-height: pxToRem(35px);
z-index: 2;
.good-tag {
display: inline-block;
box-sizing: border-box;
margin-left: .5px;
font-size: pxToRem(23px);
text-align: center;
line-height: pxToRem(35px);
padding: 0 8px;
}
.new-tag {
background-color: #78dc7e;
color: #fff;
}
.renew-tag {
background-color: #78dc7e;
color: #fff;
}
.sale-tag {
background-color: #ff575c;
color: #fff;
}
.new-festival-tag {
background-color: #000;
color: #fff;
}
.limit-tag {
border: 1px solid #000;
color: #000;
}
.soonSoldOut-tag {
background-color: #ffac5b;
color: #fff;
}
}
.good-detail-page {
overflow: hidden;
background-color: #f0f0f0;
... ... @@ -104,16 +106,16 @@ $basicBtnC:#eb0313;
width: 100%;
// .row {
// display: table-row;
.column {
box-sizing:border-box;
display: table-cell;
padding: pxToRem(16px) pxToRem(12px);
width: 50%;
border: 1px solid #fff;
font-size: pxToRem(24px);
background-color: $tableCellC;
float:left;
}
.column {
box-sizing: border-box;
display: table-cell;
padding: pxToRem(16px) pxToRem(12px);
width: 50%;
border: 1px solid #fff;
font-size: pxToRem(24px);
background-color: $tableCellC;
float: left;
}
// }
}
}
... ... @@ -136,15 +138,15 @@ $basicBtnC:#eb0313;
position: absolute;
z-index: 2;
bottom: pxToRem(40px);
.pagination-inner{
span{
.pagination-inner {
span {
background-color: #b0b0b0;
}
.swiper-pagination-bullet {
margin-right: 2px;
}
.swiper-pagination-bullet-active {
background-color: #000 ;
background-color: #000;
}
}
}
... ... @@ -227,8 +229,49 @@ $basicBtnC:#eb0313;
vertical-align: middle;
}
}
.vip-level {
box-sizing: box-border;
padding-left: pxToRem(28px);
padding-right: pxToRem(28px);
min-height: pxToRem(88px);
background-color: #fff;
font-size: pxToRem(22px);
color: #999999;
border-bottom: 1px solid $borderC;
.icons-item {
float: left;
width: 33.3%;
height: pxToRem(88px);
margin: 0;
span {
vertical-align: middle;
display: inline-block;
line-height: pxToRem(88px);
}
.vip-img {
width: pxToRem(53px);
height: pxToRem(32px);
}
&:nth-child(3) {
text-align: right;
.vip-img{
background: image-url('product/silver.png') no-repeat;
}
}
&:nth-child(2) {
.vip-img{
background: image-url('product/golden.png') no-repeat;
}
}
&:nth-child(1) {
text-align: left;
.vip-img{
background: image-url('product/platinum.png') no-repeat;
}
}
}
}
.vipLevel {
width: 100%;
box-sizing: border-box;
background-color: #fff;
display: table;
... ... @@ -242,25 +285,24 @@ $basicBtnC:#eb0313;
display: table-cell;
vertical-align: middle;
}
.vip-img{
.vip-img {
padding-right: pxToRem(22px);
.img{
width: pxToRem(52px);
height: pxToRem(32px);
.img {
width: pxToRem(53px);
height: pxToRem(33px);
}
&:nth-child(3n-3) .img{
&:nth-child(3n-3) .img {
background: image-url('product/silver.png') no-repeat;
}
&:nth-child(3n-2) .img{
&:nth-child(3n-2) .img {
background: image-url('product/golden.png') no-repeat;
}
&:nth-child(3n-1) .img{
&:nth-child(3n-1) .img {
background: image-url('product/platinum.png') no-repeat;
}
}
.vip-price {
padding-right: pxToRem(55px);
padding-right: pxToRem(52px);
}
.vip-price:last-child {
padding-right: 0;
... ... @@ -295,7 +337,6 @@ $basicBtnC:#eb0313;
.goodsDiscount {
text-indent: pxToRem(-14px);
}
.enter-store {
min-height: pxToRem(100px);
display: table;
... ... @@ -327,7 +368,6 @@ $basicBtnC:#eb0313;
}
}
}
//底部固定栏
.cart-bar {
position: relative;
... ... @@ -350,10 +390,10 @@ $basicBtnC:#eb0313;
font-size: pxToRem(34px);
color: #ccc
}
&.favorite.liked{
color:$basicBtnC;;
&.favorite.liked {
color: $basicBtnC;
;
}
&.addto-cart,
&.sold-out {
height: pxToRem(80px);
... ... @@ -382,10 +422,10 @@ $basicBtnC:#eb0313;
font-size: pxToRem(24px);
}
}
.recommend-for-you{
.recommend-for-you {
margin-bottom: pxToRem(120px);
}
}
@import "comments-consults";
@import "product-description";
\ No newline at end of file
@import "product-description";
... ...
.good-detail-page{
.goods-desc {
.service {
width: pxToRem(489px);
width: pxToRem(494px);
height: pxToRem(28px);
margin-top: pxToRem(22px);
margin-left: pxToRem(40px);
background: image-url('product/service.png') no-repeat;
background-size: cover;
}
.detail{
background-color: $tableCellC;
... ...
... ... @@ -45,20 +45,17 @@
line-height: 1;
span {
display: block;
display: inline-block;
// chrome 最小支持12px, 设计图是 10px ,用CSS3变换
@include transform(scale(0.875));
}
.sale-price {
color: #d9134f;
margin-left: pxToRem(-10px);
margin-right: pxToRem(8px);
}
.old-price {
position: absolute;
top: 0;
right: pxToRem(-6px);
color: #b0b0b0;
text-decoration: line-through;
}
... ...
... ... @@ -3,7 +3,7 @@
<div class="my-header">
{{#isLogin}}
<a class="user-info" href="/home/mydetails">
<img class="user-avatar" src="{{head_ico}}">
<span class="user-avatar" data-avatar="{{head_ico}}"></span>
<span class="username">{{profile_name}}</span>
{{#vip_info}}
<span class="vip-icon vip-{{next_level}}"></span>
... ... @@ -101,8 +101,9 @@
</a>
</div>
{{#isLogin}}
{{> product/recommend-for-you}}
{{/isLogin}}
{{> product/suspend-cart}}
</div>
{{> layout/download_app}}
{{> layout/footer}}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="personal-details">
<ul>
<li><span>头像</span><span><i class="head-portrait"><img class="user-avatar" src="{{ head_ico }}"></i></span></li>
<li><span>头像</span><span><i class="head-portrait"><span class="user-avatar" data-avatar="{{ head_ico }}"></span></i></span></li>
<li><span>昵称</span><span>{{ username }}</span></li>
<li><span>性别</span><span>{{ gender }}</span></li>
<li><span>生日</span><span>{{ birthday }}</span></li>
... ...
{{> layout/header}}
<div class="systemMain">
<P>尊敬的顾客:</P>
<P>您好!</P>
<P>为了向您提供更优质的服务,目前系统正在升级,请您耐心等待。</P>
<P>系统升级期间,部分地区用户体验会有暂 时中断,如遇紧急事宜,欢迎垂询客服热线:400-889-9646 09:00-22:30(周一至周日)。</P>
<P>稍后系统将恢复正常使用,欢迎您继续光顾 YOHO!BUY 有货!</P>
<P>带来不便之处深表 歉意,请您谅解!</P>
<P>特此公告</P>
<P>YOHO!BUY 有货 客户服务中心。</P>
</div>
{{> layout/footer}}
... ...
{{> layout/header}}
<div class="goods-comments-page yoho-page">
{{#comments}}
<div class="goods-comments">
<div class="goods-comments" id="goods-comments">
{{#list}}
<div class="comment-item">
<span class="user-name">
... ... @@ -20,7 +20,10 @@
{{/list}}
</div>
{{/comments}}
{{#if loadmore}}
<input id="loadMoreUrl" type="hidden" value={{loadMoreUrl}}>
{{/if}}
</div>
{{> layout/footer}}
... ...
... ... @@ -3,12 +3,11 @@
<div class="goto-consult">
<i class="iconfont consult-logo">&#xe639;</i>
<span>我要咨询</span>
<i class="iconfont enter-consult-page">&#xe604;</i>
<a href="/consultform" class="iconfont enter-consult-page">&#xe604;</a>
</div>
{{# consults}}
<div class="goods-consults">
<div class="goods-consults" id="goods-consults">
{{#list}}
<div class="gap-block"></div>
<div class="consult-item">
<div class="question">
<span class="iconfont">&#xe639;</span>
... ... @@ -27,5 +26,9 @@
{{/list}}
</div>
{{/ consults}}
{{#if loadmore}}
<input id="loadMoreUrl" type="hidden" value={{loadMoreUrl}}>
{{/if}}
</div>
{{> layout/footer}}
... ...
... ... @@ -2,7 +2,7 @@
<div class="good-detail-page yoho-page">
<div class="banner-container">
<div class="tag-container">
<p class="good-tag soonSoldOut-tag">即将售罄</p>
<!-- <p class="good-tag soonSoldOut-tag">即将售罄</p> -->
{{# tags}}
{{# is_new}}
<p class="good-tag new-tag">NEW</p>
... ... @@ -53,6 +53,19 @@
</div>
{{# vipLevel}}
<ul class="vip-level clearfix">
{{# list}}
<li class="icons-item">
<span class="vip-img" style="background-size:cover;">
<!-- <div class="img" alt="" style="background-size:cover;"></div> -->
</span>
<span class="vip-price">{{text}}</span>
</li>
{{/ list}}
</ul>
{{/vipLevel}}
<!-- {{# vipLevel}}
<div class="vipLevel">
{{# list}}
<span class="vip-img">
... ... @@ -61,7 +74,7 @@
<span class="vip-price">{{text}}</span>
{{/ list}}
</div>
{{/ vipLevel}}
{{/ vipLevel}} -->
{{# goodsDiscount}}
<div class="goodsDiscount">
... ... @@ -112,17 +125,14 @@
{{#if numInCart}}
<span class="num-tag">{{numInCart}}</span>
{{/if}}
<a href="" class="num-incart iconfont">&#xe62c;</a>
<a href="/shoppingCart" class="num-incart iconfont">&#xe62c;</a>
{{#if goodsInstore}}
<a href="" class="addto-cart ">加入购物车</a>
<a href="/shoppingCart" class="addto-cart ">加入购物车</a>
{{else}}
<a href="" class="sold-out">已售罄</a>
{{/if}}
{{#if favorite}}
<a href="" id="likeBtn" class="favorite iconfont liked">&#xe605;</a>
{{else}}
<a href="" class="favorite iconfont">&#xe605;</a>
<a href="javascript:;" class="sold-out">已售罄</a>
{{/if}}
<a href="javascript:;" id="likeBtn" class="favorite iconfont {{#isCollect}}liked{{/isCollect}}">&#xe605;</a>
</div>
{{/cartInfo}}
... ...
... ... @@ -45,7 +45,7 @@
<body {{#if isPassportPage}}class=passport-body{{/if}}>
{{#if systemUpdate}}
<div class="systemUpdate">
<a href="systemUpdate" class="systemHeader">YOHO!BUY关于系统升级的公告</a>
<a href="index/systemUpdate" class="systemHeader">YOHO!BUY关于系统升级的公告</a>
<span>X</span>
</div>
{{/if}}
... ...
... ... @@ -166,7 +166,13 @@
{{!-- 商品详情评论 --}}
{{#if goodsCommentsPage}}
<script>
seajs.use('js/product/detail/comments-consults');
seajs.use('js/product/detail/loadmore');
</script>
{{/if}}
{{!-- 商品详情咨询 --}}
{{#if goodsConsultsPage}}
<script>
seajs.use('js/product/detail/loadmore');
</script>
{{/if}}
{{!-- 品类 --}}
... ... @@ -210,6 +216,7 @@
{{#if myIndexPage}}
<script>
seajs.use('js/me/index');
seajs.use('js/index/footer');
</script>
{{/if}}
{{#if orderPage}}
... ...
... ... @@ -38,7 +38,7 @@
<div class="question">
<span class="iconfont">&#xe639;</span>
<p>
{{question}}
{{question}}<br>
<span class="time">{{time}}</span>
</p>
</div>
... ... @@ -59,7 +59,7 @@
<span class="iconfont">&#xe63c;</span>暂无咨询
</div>
<div class="consult-content-footer">
<a href="{{link}}">
<a href="/consultform">
我要咨询
<span class="iconfont">&#xe604;</span></a>
</div>
... ...
{{#goodsDescription}}
<div class="goods-desc page-block">
<img class="service lazy" data-original="http://static.dev.yohobuy.com/img/product/service.png" alt="">
<div class="service"></div>
<h1 class="title">
{{title}}
<span class="en-title">{{enTitle}}</span>
... ...
<div class="title">为您优选新品</div>
<div id="swiper-recommend" class="swiper-container">
<ul class="swiper-wrapper swiper-wrapper-recommend">
<div class="swiper-wrapper swiper-wrapper-recommend">
{{#recommendList}}
<li class="swiper-slide">
<a class="swiper-slide" href="{{url}}">
<img class="swiper-lazy img-box" data-src="{{thumb}}">
<div class="price">
<span class="sale-price {{^price}}no-price{{/price}}">¥{{salePrice}}</span>
{{#price}}<span class="old-price">¥{{.}}</span>{{/price}}
</div>
<div class="swiper-lazy-preloader"></div>
</li>
</a>
{{/recommendList}}
</ul>
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -49,6 +49,7 @@ class HomeController extends AbstractAction
$data = array(
'myIndexPage' => true,
'showDownloadApp' => true,
'pageFooter' => true
);
if ($this->_uid) {
... ... @@ -122,7 +123,7 @@ class HomeController extends AbstractAction
if ($this->isAjax()) {
$uid = $this->getUid();
$fav_id = $this->post('fav_id', 0);
$fav_id = $this->post('id', 0);
$result = UserModel::favoriteDelete($this->_uid, $fav_id);
}
... ...
... ... @@ -38,9 +38,11 @@ class IndexController extends AbstractAction
*
*/
public function systemUpdate()
public function systemUpdateAction()
{
$this->_view->display('systemUpdate','');
$this->setTitle('关于系统升级的公告');
$this->_view->display('systemUpdate');
}
}
... ...
... ... @@ -231,54 +231,19 @@ class ShoppingCartController extends AbstractAction
public function goodinfoAction()
{
$result = array();
if ($this->isAjax()) {
$data = array(
'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/09/17/03/014cacfa5c458b9732c68adf1af15d7a45.jpg?imageMogr2/thumbnail/120x120/extent/120x120/background/d2hpdGU=/position/center/quality/90',
'name' => '黄伟文Wyman X y yohood 联名商品YYYOHOOD圆领卫衣',
'price' => 289,
'salePrice' => 241,
'colors' => array(
array(
'id' => 1,
'name' => '黄色'
),
array(
'id' => 2,
'chosed' => true,
'name' => '白色'
)
),
'sizes' => array(
array(
'id' => 1,
'name' => 'XS'
),
array(
'id' => 2,
'name' => 'S'
),
array(
'id' => 3,
'chosed' => true,
'name' => 'M'
),
array(
'id' => 4,
'name' => 'L'
),
array(
'id' => 5,
'name' => 'XL'
),
array(
'id' => 6,
'name' => 'XXL'
)
),
'num' => 1
);
$this->echoJson(array('code' => 200, 'data' => $data));
$num = $this->get('buy_num', 1);
$skn = $this->get('id', 1);
$result = CartModel::cartProductData($this->_uid, $skn, $num); // 测试skn的ID为51172055
$result['num'] = $num;
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
}
... ...
... ... @@ -3,6 +3,7 @@
namespace Index;
use LibModels\Wap\Home\CartData;
use Plugin\Helpers;
use Plugin\Images;
/**
... ... @@ -98,6 +99,70 @@ class CartModel
}
/**
* 处理购物车商品数据
*
* @param int $uid 用户ID
* @param int $skn 商品skn
* @param int $num 购买数目
* @return array 接口返回的数据
*/
public static function cartProductData($uid, $skn, $num)
{
$result = array('code' => 400, 'message' => '出错啦~');
$product = CartData::cartProductData($uid, $skn);
if (isset($product['code']) && $product['code'] === 200) {
$result['code'] = 200;
$data = array();
$productData = $product['data'];
// 品牌信息
if (isset($productData['brand_info']) && !empty($productData['brand_info'])) {
$data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120);
}
$data['name'] = $productData['product_name'];
$data['price'] = $productData['market_price'];
$data['salePrice'] = $productData['sales_price'];
$data['storage'] = $productData['storage_sum'];
$data['num'] = $num;
// 商品选择
if (isset($productData['goods_list'])) {
$goodsList = $productData['goods_list'];
$colors = array();
$oneColor = array();
$sizes = array();
$oneSize = array();
foreach ($goodsList as $val) {
// 颜色
$oneColor = array();
$oneColor['id'] = $val['color_id'];
$oneColor['name'] = $val['color_name'];
// 尺码
foreach ($val['size_list'] as $one) {
$oneSize = array();
$oneSize['id'] = $one['size_id'];
$oneSize['name'] = $one['size_name'];
}
$sizes[] = $oneSize;
$oneColor['sizes'] = $sizes;
$colors[] = $oneColor;
}
$data['colors'] = $colors;
}
$result['data'] = $data;
}
return $result;
}
/**
* 修改购物车商品数据
*
* @param int $uid 用户ID
... ... @@ -135,6 +200,7 @@ class CartModel
// 购买的商品列表
foreach ($data['goods_list'] as $value) {
$oneGoods['id'] = $value['product_sku'];
$oneGoods['skn'] = $value['product_skn'];
$oneGoods['name'] = $value['product_name'];
$oneGoods['thumb'] = Images::getImageUrl($value['goods_images'], 120, 120);
$oneGoods['color'] = $value['color_name'];
... ...
... ... @@ -201,9 +201,9 @@ class UserModel
$product['fav_id'] = $val['product_id'];
$product['imgUrl'] = Helpers::getImageUrl($val['image'], 140, 140);
$product['title'] = $val['product_name'];
$product['price'] = '¥'.$val['market_price'];
$product['discountPrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥'.$val['sales_price'] : false;
$product['savePrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥'.($val['market_price'] - $val['sales_price']) : 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['market_price'] - $val['sales_price'] > 0) ? '¥'.($val['market_price'] - $val['sales_price']) . '.00' : false;
$product['sellOut'] = (bool)($val['price_down']);
$result[] = $product;
... ...
... ... @@ -203,6 +203,12 @@ class DetailModel
'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;
... ...