Authored by ccbikai

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

Showing 64 changed files with 2722 additions and 465 deletions
... ... @@ -21,3 +21,23 @@ DATA:
---------------
{"code":200,"message":"Last Search List.","data":{"product_list":[{"brand_id":144,"market_price":590,"vip_price":0,"sales_price":590,"vip_discount_type":1,"product_id":"150783","max_sort_id":3,"storage_num":38,"product_name":"VANS M JT CARGO\t ","cn_alphabet":"VANSMJTCARGOVN02NJCMA","product_skn":51088175,"brand_name":"VANS","is_new":"Y","is_discount":"N","is_advance":"N","is_soon_sold_out":"N","is_limited":"N","is_yohood":"N","sales_phrase":"","goods_list":[{"goods_id":"207531","color_name":"\u7eff\u8272","color_id":"6","color_code":"#47ba17","color_value":"","images_url":"http:\/\/img13.static.yhbimg.com\/goodsimg\/2015\/09\/25\/10\/02b2ed1aad22f35ed07f7d98a9de5d6ebf.jpg?imageMogr2\/thumbnail\/{width}x{height}\/extent\/{width}x{height}\/background\/d2hpdGU=\/position\/center\/quality\/90","product_skc":"202881","is_default":"N"}],"tags":[],"default_images":"http:\/\/img13.static.yhbimg.com\/goodsimg\/2015\/09\/25\/10\/02b2ed1aad22f35ed07f7d98a9de5d6ebf.jpg?imageMogr2\/thumbnail\/{width}x{height}\/extent\/{width}x{height}\/background\/d2hpdGU=\/position\/center\/quality\/90"},{"brand_id":144,"market_price":490,"vip_price":0,"sales_price":490,"vip_discount_type":1,"product_id":"150781","max_sort_id":3,"storage_num":3,"product_name":"VANS M WARRICK\t ","cn_alphabet":"VANSMWARRICKVN02NIBHH","product_skn":51088174,"brand_name":"VANS","is_new":"Y","is_discount":"N","is_advance":"N","is_soon_sold_out":"N","is_limited":"N","is_yohood":"N","sales_phrase":"","goods_list":[{"goods_id":"207529","color_name":"\u9ed1\u8272","color_id":"2","color_code":"#333333","color_value":"","images_url":"http:\/\/img13.static.yhbimg.com\/goodsimg\/2015\/09\/25\/10\/02f401305cc7af370a894d7a094bd6f64c.jpg?imageMogr2\/thumbnail\/{width}x{height}\/extent\/{width}x{height}\/background\/d2hpdGU=\/position\/center\/quality\/90","product_skc":"202880","is_default":"N"}],"tags":[],"default_images":"http:\/\/img13.static.yhbimg.com\/goodsimg\/2015\/09\/25\/10\/02f401305cc7af370a894d7a094bd6f64c.jpg?imageMogr2\/thumbnail\/{width}x{height}\/extent\/{width}x{height}\/background\/d2hpdGU=\/position\/center\/quality\/90"}],"page_total":2,"total":52,"page":1,"content_code":""},"md5":"b66258633f505562a520e0fccf0b8803"}
## 检测是否嵌入APP, APP里直接使用浏览器打开HTML5页面
URL:
---------------
正式: http://m.yohobuy.com/appembed
测试: http://buy.test.yoho.cn/appembed
DATA:
---------------
{
"open": "Y",
"url": "http://m.yohobuy.com"
}
{
"open": "N",
"url": "http://m.yohobuy.com"
}
\ No newline at end of file
... ...
... ... @@ -309,13 +309,7 @@
{
infos:
[
{
show: true,
info: [
{...}, //标签
...
]
},
{...}, //标签
...
]
}
... ... @@ -945,20 +939,35 @@
### 我的订单
{
order: {
orders: [
navs: [
{
name: '',
active: true,
typeId: 1
},
...
]
}
}
//订单列表
{
orders: [
{
...//订单
}
]
//当无订单时,不传order,返回walkwayUrl
walkWayUrl: ''
}
//订单
{
detailUrl: '',
orderNum: '',
orderStatus: '',
goods: [
{
id: '',
thumb: '',
gift: true, //是否赠品
advanceBuy: true, //是否加价购
... ... @@ -1028,4 +1037,13 @@
yohoCoin: {
coinNum: 10
}
}
### 我的逛
{
myGuang: [
{...} //逛资讯
..
]
}
\ No newline at end of file
... ...
commit 7229af7cecf40861c6fb3987c1f38ac3da2faef9
Author: Lynnic <gunix@foxmail.com>
Date: Fri Nov 13 17:45:31 2015 +0800
update
commit 2c21a46be447a1bc1982d8ad3cad7f8c00a63a0f
Author: xuqi <xuqi9010@gmail.com>
Date: Fri Nov 13 17:27:02 2015 +0800
rm temp file
commit 34763241edf84698b24ecb2aa2f2bfa1e37afc32
Author: liangzhifeng <zhifeng.liang@yoho.cn>
Date: Fri Nov 13 16:58:28 2015 +0800
update yas version
commit 3b4a6cd6177ec9cef8ab953b165da1d222974382
Merge: c1b68bb 7ccb30d
Author: liangzhifeng <zhifeng.liang@yoho.cn>
Date: Fri Nov 13 16:39:59 2015 +0800
Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop
commit c1b68bb739bb2535d9d8a205aa198ccc1844752d
Author: liangzhifeng <zhifeng.liang@yoho.cn>
Date: Fri Nov 13 16:39:26 2015 +0800
update yas version
commit 7ccb30d2ca3d45bf82638f63c8ae0e0db27b3a5f
Author: Lynnic <gunix@foxmail.com>
Date: Fri Nov 13 15:37:18 2015 +0800
changed the name of conflicted function
commit e5569a46931588f42607e84bec1db64a8cf46bcd
Merge: a7552b8 b4b964e
Author: Lynnic <gunix@foxmail.com>
Date: Fri Nov 13 14:50:09 2015 +0800
Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
commit b4b964e589b88c0821e1138e46d56dca3f139bcd
Merge: 6f68082 7a6895e
Author: ccbikai <ccbikai@qq.com>
Date: Fri Nov 13 14:35:33 2015 +0800
Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
commit 6f6808272a6a6e40e425bc3df69eff26512e5c80
Author: ccbikai <ccbikai@qq.com>
Date: Fri Nov 13 14:35:28 2015 +0800
修改地址页面样式
commit 7a6895ebfa302d46b791f78196614b9a6d9404ce
Merge: 8413e20 0ff1e35
Author: uedxwg <xieweiguang11@163.com>
Date: Fri Nov 13 14:23:11 2015 +0800
Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
commit 8413e2059464cec3c386bbcb25cd5f7f9bc3e2da
Author: uedxwg <xieweiguang11@163.com>
Date: Fri Nov 13 14:22:31 2015 +0800
'hotrank'
commit a7552b8af3de3fba625736b885aac3d6aeb57b0a
Author: lynnic <gunix@foxmail.com>
Date: Fri Nov 13 13:40:22 2015 +0800
update
commit 9ce2bf2913bc9909a5fac0fa4a30777ba4db23c3
Author: ccbikai <ccbikai@qq.com>
Date: Fri Nov 13 13:35:07 2015 +0800
commit 0ff1e35337c656c288243a40602bd0cb7a85fdb4
Merge: 88ef01d cdba827
Author: ccbikai <ccbikai@qq.com>
Date: Fri Nov 13 13:30:37 2015 +0800
merge code
commit 88ef01d3931dc8b61657019bde2e02186c0222e3
Author: ccbikai <ccbikai@qq.com>
Date: Fri Nov 13 13:29:45 2015 +0800
地址模板修改
commit 072785ab101cff6bcd3f5548165cad6d18c79aa1
Merge: 5e3e194 cdba827
Author: liangzhifeng <zhifeng.liang@yoho.cn>
Date: Fri Nov 13 13:25:15 2015 +0800
Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop
commit cdba82787e574d2274025227bdcfd97553fbe30e
Merge: 91cebbc 35dbe8b
Author: hf <fei.hong@yoho.cn>
Date: Fri Nov 13 13:24:46 2015 +0800
merge master css js code
commit 91cebbc682532eab919ea903c7668f3ff9fb01a1
Author: hf <fei.hong@yoho.cn>
Date: Fri Nov 13 13:24:01 2015 +0800
merge master css js code
commit 5e3e194ef858a371f65b0a6e2965f79ec65fdb49
Merge: 9cb6944 35dbe8b
Author: liangzhifeng <zhifeng.liang@yoho.cn>
Date: Fri Nov 13 13:23:02 2015 +0800
Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop
commit 35dbe8bc57c1accce337e199df6d323d4e7b7ead
Author: ccbikai <ccbikai@qq.com>
Date: Fri Nov 13 13:22:34 2015 +0800
地址管理增加数据
commit 9cb6944ea59db8f2958f10de518db079aa0bc3ad
Merge: 09500b4 bfaf6f7
Author: liangzhifeng <zhifeng.liang@yoho.cn>
Date: Fri Nov 13 13:22:11 2015 +0800
Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop
commit f735917c59165291cfb3fcb064e06bb424e64b40
Author: lynnic <gunix@foxmail.com>
Date: Fri Nov 13 13:19:56 2015 +0800
product detail
commit bfaf6f7da9e7b3f15ca3e2223af4b04e890f7181
Merge: ddb8634 da2dd89
Author: ccbikai <ccbikai@qq.com>
Date: Fri Nov 13 11:47:23 2015 +0800
Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
commit ddb8634a6229dafd38b4380cdb4861d768cb207c
Author: ccbikai <ccbikai@qq.com>
Date: Fri Nov 13 11:47:18 2015 +0800
地址管理页面样式
commit 09500b4de29d35d7edb9526feaef5cfda53bc48b
Merge: b3d45dc da2dd89
Author: liangzhifeng <zhifeng.liang@yoho.cn>
Date: Fri Nov 13 11:18:17 2015 +0800
Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop
commit b3d45dcfe30770f888ccde298a1aa65c7b06c829
Author: liangzhifeng <zhifeng.liang@yoho.cn>
Date: Fri Nov 13 11:17:43 2015 +0800
update the version of yas
commit da2dd89e32be5bb319141af09fe5b8f1404e192d
Author: hf <fei.hong@yoho.cn>
Date: Fri Nov 13 11:15:06 2015 +0800
merge master css js code
commit e677bad09bfc0959d667a29a035375cf9feba5d2
Merge: cef0926 f1ec957
Author: hf <fei.hong@yoho.cn>
Date: Fri Nov 13 10:52:10 2015 +0800
merge master css js code
commit cef09262f23a1ba1fadef9c56fb2088cfd75cde5
Merge: d927c9f 1483b13
Author: hf <fei.hong@yoho.cn>
Date: Fri Nov 13 10:51:02 2015 +0800
do merge master code
commit 1483b137ec3273153d3dfa8f47aadd6b4b88fb9c
Author: ccbikai <ccbikai@qq.com>
Date: Fri Nov 13 10:18:43 2015 +0800
个人中心首页完善
commit 2b3507b2e6319697d96723e7ca3d72fcdce8bedc
Merge: a772911 67b011f
Author: ccbikai <ccbikai@qq.com>
Date: Fri Nov 13 09:39:53 2015 +0800
Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
commit 67b011f1647426d9d4e59daf67cd75e2e29d1acb
Merge: 9c12951 a7a3613
Author: uedxwg <xieweiguang11@163.com>
Date: Thu Nov 12 18:40:33 2015 +0800
Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
commit 9c12951e3d4aaa06cc99b8d76da2d8aa1b3bfcc1
Author: uedxwg <xieweiguang11@163.com>
Date: Thu Nov 12 18:39:49 2015 +0800
'hotrank'
commit a7a36134fbca6e9d5f4cb60e40fb9a9a83cb2c1a
Merge: d336ffb 47f54e6
Author: Rock Zhang <iamgtskk@gmail.com>
Date: Thu Nov 12 18:30:47 2015 +0800
Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop
Conflicts:
framework
commit d336ffb79bb7ead39b230b751f6a7a296cec4b78
Author: Rock Zhang <iamgtskk@gmail.com>
Date: Thu Nov 12 18:30:23 2015 +0800
完成个人中心部分功能
commit f1ec957452269f97436356c5e718460847d32b52
Author: hf <fei.hong@yoho.cn>
Date: Thu Nov 12 18:18:41 2015 +0800
modify to search goods list style
commit 47f54e6c63dbfdf87d125c17c7538cfd73c9fab9
Merge: 1ba211d a72e1a2
Author: lore-w <metro-cpu@hotmail.com>
Date: Thu Nov 12 18:16:56 2015 +0800
Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop
Conflicts:
static/js/me/entry.js
static/sass/me/_index.scss
template/m.yohobuy.com/partials/layout/use.phtml
commit afe58b17129e155698bf1114ef95ea25e867f43b
Author: hf <fei.hong@yoho.cn>
Date: Thu Nov 12 18:12:58 2015 +0800
modify to search goods list style
commit 32827f6aa9b9c3fe39a213e3c4001399868a10f0
Merge: 76c5106 80adb41
Author: hf <fei.hong@yoho.cn>
Date: Thu Nov 12 18:12:27 2015 +0800
Merge remote-tracking branch 'origin/hotfix'
commit 1ba211d6670de1f88538065b9276bdd63be55aef
Author: lore-w <metro-cpu@hotmail.com>
Date: Thu Nov 12 18:11:25 2015 +0800
收藏、意见反馈
commit 80adb4135a73c332ce435693a83fd5610c20721e
Author: ccbikai <ccbikai@qq.com>
Date: Thu Nov 12 18:09:40 2015 +0800
取消搜索不 focus
commit 76c51067fd3afdb2e04ece7f3cf21c7a3d98fb8d
Author: hf <fei.hong@yoho.cn>
Date: Thu Nov 12 18:01:57 2015 +0800
modify to search goods list style
commit ebf90d5f499facf9b0b38d3afe3a421273e319f7
Author: hf <fei.hong@yoho.cn>
Date: Thu Nov 12 18:01:37 2015 +0800
modify to search goods list style
commit 74c6939a6c0af5dea824447eedd57b40d5d36e8e
Merge: d874739 4be2273
Author: hf <fei.hong@yoho.cn>
Date: Thu Nov 12 18:
\ No newline at end of file
... ...
... ... @@ -19,7 +19,7 @@ class GradeData
* @param string $uid 用户id
* @return array 接口返回的会员等级数据
*/
public function getGradeData($gender, $channel, $uid) {
public static function getGradeData($gender, $channel, $uid) {
$urlList = array();
//获取会员等级数据
$param = Yohobuy::param();
... ...
... ... @@ -39,4 +39,39 @@ class OrderData
return Yohobuy::get(Yohobuy::API_URL2, $param);
}
/*
* 取消订单
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
public function cancelOrderData($order_code, $uid, $gender, $yh_channel, $method) {
$param = Yohobuy::param();
$param['order_code'] = $order_code;
$param['uid'] = $uid;
$param['gender'] = $gender;
$param['yh_channel'] = $yh_channel;
$param['method'] = $method;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/*
* 删除订单
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
public function deleteOrderData($order_code, $uid, $gender, $yh_channel, $method) {
$param = Yohobuy::param();
$param['order_code'] = $order_code;
$param['uid'] = $uid;
$param['gender'] = $gender;
$param['yh_channel'] = $yh_channel;
$param['method'] = $method;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
... ...
... ... @@ -298,7 +298,12 @@ class FloorProcess
$one['img'] = Helpers::getImageUrl($one['src'], 640, 403);
unset($one['src']);
}
$result['big_image']['list'] = $data['big_image'];
// 区别多张图与一张图
if (count($data['big_image']) > 1) {
$result['big_image']['list'] = $data['big_image'];
unset($data['big_image']);
}
foreach ($data['list'] as $kk => &$one) {
if ($kk == 0) {
... ... @@ -318,8 +323,6 @@ class FloorProcess
$data['title']['more_url'] = Helpers::getFilterUrl($data['title']['more_url']);
}
unset($data['big_image']);
$result['goodsCategory'] = $data;
return $result;
... ...
... ... @@ -50,4 +50,47 @@ class NewSaleProcess
return $result;
}
/**
* 处理热销排行榜数据
*
* @param array $products 接口传回的数据
* @param boolean $notab 是否传回tab数据
* @param int $limit 查询返回的最大限制数
* @param int $page 分页第几页
* @return array 处理之后的数据
*/
public static function topData($products, $notab, $limit, $page)
{
$result = array();
// 处理Tabs
if (!$notab && isset($products['tabs'])) {
$result['tabs'] = array();
foreach ($products['tabs'] as $key => $one) {
$tabItem = array();
$tabItem['title'] = $one;
$tabItem['dataId'] = $key;
if ($key === 0) {
$tabItem['focus'] = true;
}
$result['tabs'][] = $tabItem;
}
}
// 处理商品
if (isset($products['product_list'])) {
$count = count($products['product_list']);
$one = array();
foreach ($products['product_list'] as $key => $single) {
$one = Helpers::formatProduct($single, true, false, false, 75, 114);
$one['rank'] = $limit * ($page -1) + $key + 1;
$result['goods'][] = $one;
}
}
return $result;
}
}
... ...
... ... @@ -17,6 +17,12 @@ server
allow 172.16.0.0/16;
deny all;
#检测是否嵌入APP
location = /appembed {
default_type application/json;
return 200 '{"open":"Y","url":"http://m.yohobuy.com"}';
}
#账号相关
location = /reg.html {
root /Data/code/git/yohobuy/assets;
... ...
... ... @@ -14,6 +14,7 @@ fonts_dir = "font"
output_style = :expanded
# To enable relative paths to assets via compass helper functions. Uncomment:
relative_assets = true
sourcemap = true
# To disable debugging comments that display the original location of your selectors. Uncomment:
line_comments = false
... ...
... ... @@ -148,7 +148,7 @@ function rePosFooter() {
window._ozuid = uid;//暴露ozuid
if (window._yas) {
window._yas(1 * new Date(), '1.0.12', 'yohobuy_m', uid, '');
window._yas(1 * new Date(), '1.0.13', 'yohobuy_m', uid, '');
}
}());
... ...
... ... @@ -6,8 +6,10 @@
var $ = require('jquery'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload');
lazyLoad = require('yoho.lazyload'),
Swiper = require('yoho.iswiper');
//导航
var $navLi = $('#fav-tab > li'),
$favContainer = $('.fav-content');
... ... @@ -15,11 +17,15 @@ var $curContainer = $favContainer.children('.fav-type').first();//保存当前
var favTabHammer;
//轮播图
var $swiperList = $('.swiper-container'),
swiperArray = [],
swiperObj = {};
//lazyLoad();
favTabHammer = new Hammer(document.getElementById('fav-tab'));
favTabHammer.on('tap', function(e) {
console.log(1);
var $cur = $(e.target).closest('li'),
index;
... ... @@ -34,4 +40,20 @@ favTabHammer.on('tap', function(e) {
$curContainer.addClass('hide');
$curContainer = $favContainer.children(':eq(' + index + ')').removeClass('hide');
if (index === 1) {
//导航
for (var i = 0; i < $swiperList.length; i++) {
var id = $swiperList.eq(i).attr('data-id');
swiperObj[id] = new Swiper('#swiper-container-' + id, {
slidesPerView: 'auto',
grabCursor: true,
slideElement: 'li',
wrapperClass: 'swiper-wrapper-' + id,
lazyLoading: true,
watchSlidesVisibility: true
});
}
}
});
... ...
/*
UploadiFive 1.2.2
Copyright (c) 2012 Reactive Apps, Ronnie Garcia
Released under the UploadiFive Standard License <http://www.uploadify.com/uploadifive-standard-license>
*/
var jQuery = require('jquery');
;(function($) {
var methods = {
init : function(options) {
return this.each(function() {
// Create a reference to the jQuery DOM object
var $this = $(this);
$this.data('uploadifive', {
inputs : {}, // The object that contains all the file inputs
inputCount : 0, // The total number of file inputs created
fileID : 0,
queue : {
count : 0, // Total number of files in the queue
selected : 0, // Number of files selected in the last select operation
replaced : 0, // Number of files replaced in the last select operation
errors : 0, // Number of files that returned an error in the last select operation
queued : 0, // Number of files added to the queue in the last select operation
cancelled : 0 // Total number of files that have been cancelled or removed from the queue
},
uploads : {
current : 0, // Number of files currently being uploaded
attempts : 0, // Number of file uploads attempted in the last upload operation
successful : 0, // Number of files successfully uploaded in the last upload operation
errors : 0, // Number of files returning errors in the last upload operation
count : 0 // Total number of files uploaded successfully
}
});
var $data = $this.data('uploadifive');
// Set the default options
var settings = $data.settings = $.extend({
'auto' : true, // Automatically upload a file when it's added to the queue
'buttonClass' : false, // A class to add to the UploadiFive button
'buttonText' : 'Select Files', // The text that appears on the UploadiFive button
'checkScript' : false, // Path to the script that checks for existing file names
'dnd' : true, // Allow drag and drop into the queue
'dropTarget' : false, // Selector for the drop target
'fileObjName' : 'Filedata', // The name of the file object to use in your server-side script
'fileSizeLimit' : 0, // Maximum allowed size of files to upload
'fileType' : false, // Type of files allowed (image, etc), separate with a pipe character |
'formData' : {}, // Additional data to send to the upload script
'height' : 30, // The height of the button
'itemTemplate' : false, // The HTML markup for the item in the queue
'method' : 'post', // The method to use when submitting the upload
'multi' : true, // Set to true to allow multiple file selections
'overrideEvents' : [], // An array of events to override
'queueID' : false, // The ID of the file queue
'queueSizeLimit' : 0, // The maximum number of files that can be in the queue
'removeCompleted' : false, // Set to true to remove files that have completed uploading
'simUploadLimit' : 0, // The maximum number of files to upload at once
'truncateLength' : 0, // The length to truncate the file names to
'uploadLimit' : 0, // The maximum number of files you can upload
'uploadScript' : 'uploadifive.php', // The path to the upload script
'width' : 100 // The width of the button
/*
// Events
'onAddQueueItem' : function(file) {}, // Triggered for each file that is added to the queue
'onCancel' : function(file) {}, // Triggered when a file is cancelled or removed from the queue
'onCheck' : function(file, exists) {}, // Triggered when the server is checked for an existing file
'onClearQueue' : function(queue) {}, // Triggered during the clearQueue function
'onDestroy' : function() {} // Triggered during the destroy function
'onDrop' : function(files, numberOfFilesDropped) {}, // Triggered when files are dropped into the file queue
'onError' : function(file, fileType, data) {}, // Triggered when an error occurs
'onFallback' : function() {}, // Triggered if the HTML5 File API is not supported by the browser
'onInit' : function() {}, // Triggered when UploadiFive if initialized
'onQueueComplete' : function() {}, // Triggered once when an upload queue is done
'onProgress' : function(file, event) {}, // Triggered during each progress update of an upload
'onSelect' : function() {}, // Triggered once when files are selected from a dialog box
'onUpload' : function(file) {}, // Triggered when an upload queue is started
'onUploadComplete' : function(file, data) {}, // Triggered when a file is successfully uploaded
'onUploadFile' : function(file) {}, // Triggered for each file being uploaded
*/
}, options);
// Calculate the file size limit
if (isNaN(settings.fileSizeLimit)) {
var fileSizeLimitBytes = parseInt(settings.fileSizeLimit) * 1.024
if (settings.fileSizeLimit.indexOf('KB') > -1) {
settings.fileSizeLimit = fileSizeLimitBytes * 1000;
} else if (settings.fileSizeLimit.indexOf('MB') > -1) {
settings.fileSizeLimit = fileSizeLimitBytes * 1000000;
} else if (settings.fileSizeLimit.indexOf('GB') > -1) {
settings.fileSizeLimit = fileSizeLimitBytes * 1000000000;
}
} else {
settings.fileSizeLimit = settings.fileSizeLimit * 1024;
}
// Create a template for a file input
$data.inputTemplate = $('<input type="file">')
.css({
'font-size' : settings.height + 'px',
'opacity' : 0,
'position' : 'absolute',
'right' : '-3px',
'top' : '-3px',
'z-index' : 999
});
// Create a new input
$data.createInput = function() {
// Create a clone of the file input
var input = $data.inputTemplate.clone();
// Create a unique name for the input item
var inputName = input.name = 'input' + $data.inputCount++;
// Set the multiple attribute
if (settings.multi) {
input.attr('multiple', true);
}
// Set the accept attribute on the input
if (settings.fileType) {
input.attr('accept', settings.fileType);
}
// Set the onchange event for the input
input.bind('change', function() {
$data.queue.selected = 0;
$data.queue.replaced = 0;
$data.queue.errors = 0;
$data.queue.queued = 0;
// Add a queue item to the queue for each file
var limit = this.files.length;
$data.queue.selected = limit;
if (($data.queue.count + limit) > settings.queueSizeLimit && settings.queueSizeLimit !== 0) {
if ($.inArray('onError', settings.overrideEvents) < 0) {
alert('The maximum number of queue items has been reached (' + settings.queueSizeLimit + '). Please select fewer files.');
}
// Trigger the error event
if (typeof settings.onError === 'function') {
settings.onError.call($this, 'QUEUE_LIMIT_EXCEEDED');
}
} else {
for (var n = 0; n < limit; n++) {
file = this.files[n];
$data.addQueueItem(file);
}
$data.inputs[inputName] = this;
$data.createInput();
}
// Upload the file if auto-uploads are enabled
if (settings.auto) {
methods.upload.call($this);
}
// Trigger the select event
if (typeof settings.onSelect === 'function') {
settings.onSelect.call($this, $data.queue);
}
});
// Hide the existing current item and add the new one
if ($data.currentInput) {
$data.currentInput.hide();
}
$data.button.append(input);
$data.currentInput = input;
}
// Remove an input
$data.destroyInput = function(key) {
$($data.inputs[key]).remove();
delete $data.inputs[key];
$data.inputCount--;
}
// Drop a file into the queue
$data.drop = function(e) {
$data.queue.selected = 0;
$data.queue.replaced = 0;
$data.queue.errors = 0;
$data.queue.queued = 0;
var fileData = e.dataTransfer;
var inputName = fileData.name = 'input' + $data.inputCount++;
// Add a queue item to the queue for each file
var limit = fileData.files.length;
$data.queue.selected = limit;
if (($data.queue.count + limit) > settings.queueSizeLimit && settings.queueSizeLimit !== 0) {
// Check if the queueSizeLimit was reached
if ($.inArray('onError', settings.overrideEvents) < 0) {
alert('The maximum number of queue items has been reached (' + settings.queueSizeLimit + '). Please select fewer files.');
}
// Trigger the onError event
if (typeof settings.onError === 'function') {
settings.onError.call($this, 'QUEUE_LIMIT_EXCEEDED');
}
} else {
// Add a queue item for each file
for (var n = 0; n < limit; n++) {
file = fileData.files[n];
$data.addQueueItem(file);
}
// Save the data to the inputs object
$data.inputs[inputName] = fileData;
}
// Upload the file if auto-uploads are enabled
if (settings.auto) {
methods.upload.call($this);
}
// Trigger the onDrop event
if (typeof settings.onDrop === 'function') {
settings.onDrop.call($this, fileData.files, fileData.files.length);
}
// Stop FireFox from opening the dropped file(s)
e.preventDefault();
e.stopPropagation();
}
// Check if a filename exists in the queue
$data.fileExistsInQueue = function(file) {
for (var key in $data.inputs) {
input = $data.inputs[key];
limit = input.files.length;
for (var n = 0; n < limit; n++) {
existingFile = input.files[n];
// Check if the filename matches
if (existingFile.name == file.name && !existingFile.complete) {
return true;
}
}
}
return false;
}
// Remove an existing file in the queue
$data.removeExistingFile = function(file) {
for (var key in $data.inputs) {
input = $data.inputs[key];
limit = input.files.length;
for (var n = 0; n < limit; n++) {
existingFile = input.files[n];
// Check if the filename matches
if (existingFile.name == file.name && !existingFile.complete) {
$data.queue.replaced++;
methods.cancel.call($this, existingFile, true);
}
}
}
}
// Create the file item template
if (settings.itemTemplate == false) {
$data.queueItem = $('<div class="uploadifive-queue-item">\
<a class="close" href="#">X</a>\
<div><span class="filename"></span><span class="fileinfo"></span></div>\
<div class="progress">\
<div class="progress-bar"></div>\
</div>\
</div>');
} else {
$data.queueItem = $(settings.itemTemplate);
}
// Add an item to the queue
$data.addQueueItem = function(file) {
if ($.inArray('onAddQueueItem', settings.overrideEvents) < 0) {
// Check if the filename already exists in the queue
$data.removeExistingFile(file);
// Create a clone of the queue item template
file.queueItem = $data.queueItem.clone();
// Add an ID to the queue item
file.queueItem.attr('id', settings.id + '-file-' + $data.fileID++);
// Bind the close event to the close button
file.queueItem.find('.close').bind('click', function() {
methods.cancel.call($this, file);
return false;
});
var fileName = file.name;
if (fileName.length > settings.truncateLength && settings.truncateLength != 0) {
fileName = fileName.substring(0, settings.truncateLength) + '...';
}
file.queueItem.find('.filename').html(fileName);
// Add a reference to the file
file.queueItem.data('file', file);
$data.queueEl.append(file.queueItem);
}
// Trigger the addQueueItem event
if (typeof settings.onAddQueueItem === 'function') {
settings.onAddQueueItem.call($this, file);
}
// Check the filesize
if (file.size > settings.fileSizeLimit && settings.fileSizeLimit != 0) {
$data.error('FILE_SIZE_LIMIT_EXCEEDED', file);
} else {
$data.queue.queued++;
$data.queue.count++;
}
}
// Remove an item from the queue
$data.removeQueueItem = function(file, instant, delay) {
// Set the default delay
if (!delay) delay = 0;
var fadeTime = instant ? 0 : 500;
if (file.queueItem) {
if (file.queueItem.find('.fileinfo').html() != ' - Completed') {
file.queueItem.find('.fileinfo').html(' - Cancelled');
}
file.queueItem.find('.progress-bar').width(0);
file.queueItem.delay(delay).fadeOut(fadeTime, function() {
$(this).remove();
});
delete file.queueItem;
$data.queue.count--;
}
}
// Count the number of files that need to be uploaded
$data.filesToUpload = function() {
var filesToUpload = 0;
for (var key in $data.inputs) {
input = $data.inputs[key];
limit = input.files.length;
for (var n = 0; n < limit; n++) {
file = input.files[n];
if (!file.skip && !file.complete) {
filesToUpload++;
}
}
}
return filesToUpload;
}
// Check if a file exists
$data.checkExists = function(file) {
if ($.inArray('onCheck', settings.overrideEvents) < 0) {
// This request needs to be synchronous
$.ajaxSetup({
'async' : false
});
// Send the filename to the check script
var checkData = $.extend(settings.formData, {filename: file.name});
$.post(settings.checkScript, checkData, function(fileExists) {
file.exists = parseInt(fileExists);
});
if (file.exists) {
if (!confirm('A file named ' + file.name + ' already exists in the upload folder.\nWould you like to replace it?')) {
// If not replacing the file, cancel the upload
methods.cancel.call($this, file);
return true;
}
}
}
// Trigger the check event
if (typeof settings.onCheck === 'function') {
settings.onCheck.call($this, file, file.exists);
}
return false;
}
// Upload a single file
$data.uploadFile = function(file, uploadAll) {
if (!file.skip && !file.complete && !file.uploading) {
file.uploading = true;
$data.uploads.current++;
$data.uploads.attempted++;
// Create a new AJAX request
xhr = file.xhr = new XMLHttpRequest();
// Start the upload
// Use the faster FormData if it exists
if (typeof FormData === 'function' || typeof FormData === 'object') {
// Create a new FormData object
var formData = new FormData();
// Add the form data
formData.append(settings.fileObjName, file);
// Add the rest of the formData
for (i in settings.formData) {
formData.append(i, settings.formData[i]);
}
// Open the AJAX call
xhr.open(settings.method, settings.uploadScript, true);
// On progress function
xhr.upload.addEventListener('progress', function(e) {
if (e.lengthComputable) {
$data.progress(e, file);
}
}, false);
// On complete function
xhr.addEventListener('load', function(e) {
if (this.readyState == 4) {
file.uploading = false;
if (this.status == 200) {
if (file.xhr.responseText !== 'Invalid file type.') {
$data.uploadComplete(e, file, uploadAll);
} else {
$data.error(file.xhr.responseText, file, uploadAll);
}
} else if (this.status == 404) {
$data.error('404_FILE_NOT_FOUND', file, uploadAll);
} else if (this.status == 403) {
$data.error('403_FORBIDDEN', file, uploadAll);
} else {
$data.error('Unknown Error', file, uploadAll);
}
}
});
// Send the form data (multipart/form-data)
xhr.send(formData);
} else {
// Send as binary
var reader = new FileReader();
reader.onload = function(e) {
// Set some file builder variables
var boundary = '-------------------------' + (new Date).getTime(),
dashes = '--',
eol = '\r\n',
binFile = '';
// Build an RFC2388 String
binFile += dashes + boundary + eol;
// Generate the headers
binFile += 'Content-Disposition: form-data; name="' + settings.fileObjName + '"';
if (file.name) {
binFile += '; filename="' + file.name + '"';
}
binFile += eol;
binFile += 'Content-Type: application/octet-stream' + eol + eol;
binFile += e.target.result + eol;
for (key in settings.formData) {
binFile += dashes + boundary + eol;
binFile += 'Content-Disposition: form-data; name="' + key + '"' + eol + eol;
binFile += settings.formData[key] + eol;
}
binFile += dashes + boundary + dashes + eol;
// On progress function
xhr.upload.addEventListener('progress', function(e) {
$data.progress(e, file);
}, false);
// On complete function
xhr.addEventListener('load', function(e) {
file.uploading = false;
var status = this.status;
if (status == 404) {
$data.error('404_FILE_NOT_FOUND', file, uploadAll);
} else {
if (file.xhr.responseText != 'Invalid file type.') {
$data.uploadComplete(e, file, uploadAll);
} else {
$data.error(file.xhr.responseText, file, uploadAll);
}
}
}, false);
// Open the ajax request
var url = settings.uploadScript;
if (settings.method == 'get') {
var params = $(settings.formData).param();
url += params;
}
xhr.open(settings.method, settings.uploadScript, true);
xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + boundary);
// Trigger the uploadFile event
if (typeof settings.onUploadFile === 'function') {
settings.onUploadFile.call($this, file);
}
// Send the file for upload
xhr.sendAsBinary(binFile);
}
reader.readAsBinaryString(file);
}
}
}
// Update a file upload's progress
$data.progress = function(e, file) {
if ($.inArray('onProgress', settings.overrideEvents) < 0) {
if (e.lengthComputable) {
var percent = Math.round((e.loaded / e.total) * 100);
}
file.queueItem.find('.fileinfo').html(' - ' + percent + '%');
file.queueItem.find('.progress-bar').css('width', percent + '%');
}
// Trigger the progress event
if (typeof settings.onProgress === 'function') {
settings.onProgress.call($this, file, e);
}
}
// Trigger an error
$data.error = function(errorType, file, uploadAll) {
if ($.inArray('onError', settings.overrideEvents) < 0) {
// Get the error message
switch(errorType) {
case '404_FILE_NOT_FOUND':
errorMsg = '404 Error';
break;
case '403_FORBIDDEN':
errorMsg = '403 Forbidden';
break;
case 'FORBIDDEN_FILE_TYPE':
errorMsg = 'Forbidden File Type';
break;
case 'FILE_SIZE_LIMIT_EXCEEDED':
errorMsg = 'File Too Large';
break;
default:
errorMsg = 'Unknown Error';
break;
}
// Add the error class to the queue item
file.queueItem.addClass('error')
// Output the error in the queue item
.find('.fileinfo').html(' - ' + errorMsg);
// Hide the
file.queueItem.find('.progress').remove();
}
// Trigger the error event
if (typeof settings.onError === 'function') {
settings.onError.call($this, errorType, file);
}
file.skip = true;
if (errorType == '404_FILE_NOT_FOUND') {
$data.uploads.errors++;
} else {
$data.queue.errors++;
}
if (uploadAll) {
methods.upload.call($this, null, true);
}
}
// Trigger when a single file upload is complete
$data.uploadComplete = function(e, file, uploadAll) {
if ($.inArray('onUploadComplete', settings.overrideEvents) < 0) {
file.queueItem.find('.progress-bar').css('width', '100%');
file.queueItem.find('.fileinfo').html(' - Completed');
file.queueItem.find('.progress').slideUp(250);
file.queueItem.addClass('complete');
}
// Trigger the complete event
if (typeof settings.onUploadComplete === 'function') {
settings.onUploadComplete.call($this, file, file.xhr.responseText);
}
if (settings.removeCompleted) {
setTimeout(function() { methods.cancel.call($this, file); }, 3000);
}
file.complete = true;
$data.uploads.successful++;
$data.uploads.count++;
$data.uploads.current--;
delete file.xhr;
if (uploadAll) {
methods.upload.call($this, null, true);
}
}
// Trigger when all the files are done uploading
$data.queueComplete = function() {
// Trigger the queueComplete event
if (typeof settings.onQueueComplete === 'function') {
settings.onQueueComplete.call($this, $data.uploads);
}
}
// ----------------------
// Initialize UploadiFive
// ----------------------
// Check if HTML5 is available
if (window.File && window.FileList && window.Blob && (window.FileReader || window.FormData)) {
// Assign an ID to the object
settings.id = 'uploadifive-' + $this.attr('id');
// Wrap the file input in a div with overflow set to hidden
$data.button = $('<div id="' + settings.id + '" class="uploadifive-button">' + settings.buttonText + '</div>');
if (settings.buttonClass) $data.button.addClass(settings.buttonClass);
// Style the button wrapper
$data.button.css({
'height' : settings.height,
'line-height' : settings.height + 'px',
'overflow' : 'hidden',
'position' : 'relative',
'text-align' : 'center',
'width' : settings.width
});
// Insert the button above the file input
$this.before($data.button)
// Add the file input to the button
.appendTo($data.button)
// Modify the styles of the file input
.hide();
// Create a new input
$data.createInput.call($this);
// Create the queue container
if (!settings.queueID) {
settings.queueID = settings.id + '-queue';
$data.queueEl = $('<div id="' + settings.queueID + '" class="uploadifive-queue" />');
$data.button.after($data.queueEl);
} else {
$data.queueEl = $('#' + settings.queueID);
}
// Add drag and drop functionality
if (settings.dnd) {
var $dropTarget = settings.dropTarget ? $(settings.dropTarget) : $data.queueEl.get(0);
$dropTarget.addEventListener('dragleave', function(e) {
// Stop FireFox from opening the dropped file(s)
e.preventDefault();
e.stopPropagation();
}, false);
$dropTarget.addEventListener('dragenter', function(e) {
// Stop FireFox from opening the dropped file(s)
e.preventDefault();
e.stopPropagation();
}, false);
$dropTarget.addEventListener('dragover', function(e) {
// Stop FireFox from opening the dropped file(s)
e.preventDefault();
e.stopPropagation();
}, false);
$dropTarget.addEventListener('drop', $data.drop, false);
}
// Send as binary workaround for Chrome
if (!XMLHttpRequest.prototype.sendAsBinary) {
XMLHttpRequest.prototype.sendAsBinary = function(datastr) {
function byteValue(x) {
return x.charCodeAt(0) & 0xff;
}
var ords = Array.prototype.map.call(datastr, byteValue);
var ui8a = new Uint8Array(ords);
this.send(ui8a.buffer);
}
}
// Trigger the oninit event
if (typeof settings.onInit === 'function') {
settings.onInit.call($this);
}
} else {
// Trigger the fallback event
if (typeof settings.onFallback === 'function') {
settings.onFallback.call($this);
}
return false;
}
});
},
// Write some data to the console
debug : function() {
return this.each(function() {
console.log($(this).data('uploadifive'));
});
},
// Clear all the items from the queue
clearQueue : function() {
this.each(function() {
var $this = $(this),
$data = $this.data('uploadifive'),
settings = $data.settings;
for (var key in $data.inputs) {
input = $data.inputs[key];
limit = input.files.length;
for (i = 0; i < limit; i++) {
file = input.files[i];
methods.cancel.call($this, file);
}
}
// Trigger the onClearQueue event
if (typeof settings.onClearQueue === 'function') {
settings.onClearQueue.call($this, $('#' + $data.settings.queueID));
}
});
},
// Cancel a file upload in progress or remove a file from the queue
cancel : function(file, fast) {
this.each(function() {
var $this = $(this),
$data = $this.data('uploadifive'),
settings = $data.settings;
// If user passed a queue item ID instead of file...
if (typeof file === 'string') {
if (!isNaN(file)) {
fileID = 'uploadifive-' + $(this).attr('id') + '-file-' + file;
}
file = $('#' + fileID).data('file');
}
file.skip = true;
$data.filesCancelled++;
if (file.uploading) {
$data.uploads.current--;
file.uploading = false;
file.xhr.abort();
delete file.xhr;
methods.upload.call($this);
}
if ($.inArray('onCancel', settings.overrideEvents) < 0) {
$data.removeQueueItem(file, fast);
}
// Trigger the cancel event
if (typeof settings.onCancel === 'function') {
settings.onCancel.call($this, file);
}
});
},
// Upload the files in the queue
upload : function(file, keepVars) {
this.each(function() {
var $this = $(this),
$data = $this.data('uploadifive'),
settings = $data.settings;
if (file) {
$data.uploadFile.call($this, file);
} else {
// Check if the upload limit was reached
if (($data.uploads.count + $data.uploads.current) < settings.uploadLimit || settings.uploadLimit == 0) {
if (!keepVars) {
$data.uploads.attempted = 0;
$data.uploads.successsful = 0;
$data.uploads.errors = 0;
var filesToUpload = $data.filesToUpload();
// Trigger the onUpload event
if (typeof settings.onUpload === 'function') {
settings.onUpload.call($this, filesToUpload);
}
}
// Loop through the files
$('#' + settings.queueID).find('.uploadifive-queue-item').not('.error, .complete').each(function() {
_file = $(this).data('file');
// Check if the simUpload limit was reached
if (($data.uploads.current >= settings.simUploadLimit && settings.simUploadLimit !== 0) || ($data.uploads.current >= settings.uploadLimit && settings.uploadLimit !== 0) || ($data.uploads.count >= settings.uploadLimit && settings.uploadLimit !== 0)) {
return false;
}
if (settings.checkScript) {
// Let the loop know that we're already processing this file
_file.checking = true;
skipFile = $data.checkExists(_file);
_file.checking = false;
if (!skipFile) {
$data.uploadFile(_file, true);
}
} else {
$data.uploadFile(_file, true);
}
});
if ($('#' + settings.queueID).find('.uploadifive-queue-item').not('.error, .complete').size() == 0) {
$data.queueComplete();
}
} else {
if ($data.uploads.current == 0) {
if ($.inArray('onError', settings.overrideEvents) < 0) {
if ($data.filesToUpload() > 0 && settings.uploadLimit != 0) {
alert('The maximum upload limit has been reached.');
}
}
// Trigger the onError event
if (typeof settings.onError === 'function') {
settings.onError.call($this, 'UPLOAD_LIMIT_EXCEEDED', $data.filesToUpload());
}
}
}
}
});
},
// Destroy an instance of UploadiFive
destroy : function() {
this.each(function() {
var $this = $(this),
$data = $this.data('uploadifive'),
settings = $data.settings;
// Clear the queue
methods.clearQueue.call($this);
// Destroy the queue if it was created
if (!settings.queueID) $('#' + settings.queueID).remove();
// Remove extra inputs
$this.siblings('input').remove();
// Show the original file input
$this.show()
// Move the file input out of the button
.insertBefore($data.button);
// Delete the button
$data.button.remove();
// Trigger the destroy event
if (typeof settings.onDestroy === 'function') {
settings.onDestroy.call($this);
}
});
}
}
$.fn.uploadifive = function(method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('The method ' + method + ' does not exist in $.uploadify');
}
}
})(jQuery);
\ No newline at end of file
... ...
... ... @@ -11,12 +11,79 @@ var $ = require('jquery'),
var $navLi = $('#order-nav > li'),
$orderContainer = $('#order-container');
var $curContainer = $orderContainer.children('.orders').first();//保存当前显示的order-container
var $curContainer = $orderContainer.children('.orders:not(.hide)');//保存当前显示的order-container
var navHammer;
var winH = $(window).height();
var activeType = $navLi.filter('.active').data('type'); //当前active的项的index
var orderPage = {};
var inAjax = false;
var loading = require('../plugin/loading');
var navHammer, orderHammer;
//加载订单
function getOrders() {
var opt = {
type: activeType,
page: orderPage[activeType] ? (orderPage[activeType] + 1) : 1
};
if (inAjax) {
return;
}
inAjax = true;
loading.showLoadingMask();
$.ajax({
type: 'GET',
url: '/home/getOrders',
data: opt,
success: function(data) {
var num;
if (data.code === 200) {
orderPage[opt.type] = opt.page;
if (opt.page === 1) {
$curContainer.html(data.data);
lazyLoad($curContainer.find('.lazy'));
} else {
num = $curContainer.children('.order').length;
$curContainer.append(data.data);
//lazyload
lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ') .lazy'));
}
}
inAjax = false;
loading.hideLoadingMask();
}
});
}
lazyLoad();
//初始化导航
(function() {
var liCount = $navLi.length;
//默认4个导航项
if (liCount === 4) {
return;
}
$navLi.width(100 / liCount + '%');
}());
loading.init($('body')); //满屏loading
//导航切换
navHammer = new Hammer(document.getElementById('order-nav'));
navHammer.on('tap', function(e) {
var $cur = $(e.target).closest('li'),
... ... @@ -33,4 +100,79 @@ navHammer.on('tap', function(e) {
$curContainer.addClass('hide');
$curContainer = $orderContainer.children(':eq(' + index + ')').removeClass('hide');
});
\ No newline at end of file
activeType = $cur.data('type');
if (orderPage[activeType]) {
return;
} else {
getOrders();
}
});
//点击订单区域跳转订单详情页
orderHammer = new Hammer(document.getElementById('order-container'));
orderHammer.on('tap', function(e) {
var $cur = $(e.target),
$order,
id,
url;
if ($cur.closest('.locHref').length > 0) {
return;
}
$order = $cur.closest('.order');
id = $order.data('id');
if ($cur.closest('.del').length > 0) {
//Order delete
$.ajax({
type: 'GET',
url: '/home/delOrder',
data: {
id: id
},
success: function(data) {
if (data.code === 200) {
//删除订单页面刷新
location.href = location.href;
}
}
});
} else if ($cur.closest('.cancel').length > 0) {
//Order cancel
$.ajax({
type: 'GET',
url: '/home/cancelOrder',
data: {
id: id
},
success: function(data) {
if (data.code === 200) {
//取消订单
alert('order cancel');
}
}
});
} else {
//Location to order detail
url = $order.data('href');
location.href = url;
}
});
$(window).scroll(function() {
if ($(window).scrollTop() + winH >
$(document).height() - 0.25 * $orderContainer.height()) {
getOrders();
}
});
//初始化请求第一页数据
getOrders();
\ No newline at end of file
... ...
... ... @@ -4,34 +4,28 @@
* @date: 2015/11/12
*/
var $ = require('jquery'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload');
var $navLi = $('#fav-tab > li'),
$favContainer = $('.fav-content');
var $curContainer = $favContainer.children('.fav-type').first();//保存当前显示的$favContainer
var favTabHammer;
require('./jquery.uploadifive');
//lazyLoad();
$('#upload-img').uploadifive({
'auto': false,
'buttonClass': 'nav-btn',
'formData': {
favTabHammer = new Hammer(document.getElementById('fav-tab'));
favTabHammer.on('tap', function(e) {
console.log(1);
var $cur = $(e.target).closest('li'),
index;
},
'fileType': 'image/*',
'uploadScript': 'url',
'fileObjName': 'imgName',
'fileSizeLimit': 1024,
'onAddQueueItem': function (file) {
console.log(file);
alert(1);
},
'onQueueComplete': function (file) {
if ($cur.length === 0 || $cur.hasClass('active')) {
return;
}
index = $cur.index();
$navLi.filter('.active').removeClass('active');
$cur.addClass('active');
$curContainer.addClass('hide');
$curContainer = $favContainer.children(':eq(' + index + ')').removeClass('hide');
});
});
\ No newline at end of file
... ...
... ... @@ -6,9 +6,11 @@
var $ = require('jquery'),
Swiper = require('yoho.iswiper'),
lazyLoad = require('yoho.lazyload'),
Handlebars = require('yoho.handlebars'),
goodsSwiper,
sizeSwiper,
refSwiper;
refSwiper,
handleHelper;
lazyLoad($('img.lazy'));
... ... @@ -18,7 +20,7 @@ goodsSwiper = new Swiper('.banner-swiper', {
lazyLoadingInPrevNext: true,
loop: true,
paginationClickable: true,
pagination: '.swiper-pagination',
pagination: '.banner-top .pagination-inner',
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev'
});
... ... @@ -50,6 +52,11 @@ refSwiper = new Swiper('#reference-swiper-container',{
slidesPerView: 'auto'
});
handleHelper = Handlebars.registerHelper('addOne', function(index) {
return index + 1;
});
// $('#iframe').load(function() {
// var mainheight = $(this).contents().find('body').height() + 30;
// $(this).height(mainheight);
... ...
var $ = require('jquery'),
Hammer = require('yoho.hammer'),
Swiper = require('yoho.iswiper'),
lazyLoad = require('yoho.lazyload');
lazyLoad = require('yoho.lazyload'),
loading = require('../../plugin/loading');
var page = 1,
winH,
... ... @@ -13,10 +14,10 @@ var page = 1,
id = '';
function hotrank(page, sort, tabId, notab) {
console.log(sort);
loading.showLoadingMask();
$.ajax({
type: 'GET',
url: '/product/newsale/selectHotrank?'+sort,
url: '/product/newsale/selectHotrank?' + sort,
dataType: 'html',
data: {
page: page,
... ... @@ -25,36 +26,24 @@ function hotrank(page, sort, tabId, notab) {
},
success: function(data) {
if (page === 1) {
$('.rank-main').html('');
}
console.log(notab);
if (notab === 1) {
$('.rank-main').append(data);
} else {
$('#hotRank').append(data);
$('.rank-main').remove();
}
$('#hotRank').append(data);
lazyLoad($('img.lazy'));
$('#yoho-footer').css('position', 'static');
$('.rank-main ul li:gt(2)').find('.item-content i').removeClass('top');
winH = $(window).height();
if ($('.rank-main').length !== 0) {
$('#yoho-footer').css('position', 'static');
listTop = $('.rank-main').find('ul').offset().top;
} else {
$('#yoho-footer').css('position', 'fixed');
}
navSwiper = new Swiper('.s-goods-nav', {
grabCursor: true,
slidesPerView: 'auto',
slideElement: 'li'
});
winH = $(window).height();
listTop = $('.rank-main').find('ul').offset().top;
$('.s-goods-nav .nav-item').each(function(index) {
hotnav = new Hammer($('.s-goods-nav .nav-item')[index]);
hotnav.on('tap', function(e) {
var navItme = $('.s-goods-nav .nav-item').eq(index);
id = navItme.data('id') ? navItme.data('id') : '';
sort = navItme.data('sort') ? navItme.data('sort') : '';
page = 1;
notab = 1;
hotrank(page, sort, id, notab);
});
});
loading.hideLoadingMask();
}
});
}
... ... @@ -72,3 +61,18 @@ $(window).scroll(function () {
});
hotrank(page, sort, id, notab);
hotnav = new Hammer(document.getElementById('hotRank'));
hotnav.on('tap', function (e) {
var ev = ev || window.event;
var target = ev.target || ev.srcElement;
if (target.nodeName.toLowerCase() === 'span') {
$('.s-goods-nav .nav-item').removeClass('active');
target.parentNode.className = 'active ' + target.parentNode.className;
id = target.getAttribute('data-id') ? target.getAttribute('data-id') : '';
sort = target.getAttribute('data-sort') ? target.getAttribute('data-sort') : '';
page = 1;
notab = 1;
hotrank(page, sort, id, notab);
}
});
... ...
... ... @@ -62,4 +62,15 @@
text-overflow: ellipsis;
text-align: center;
}
.nav-btn {
display: block;
height: 100%;
position: absolute;
top: 0;
right: 0;
font-size: pxToRem(26px);
color: #b0b0b0;
padding-right: pxToRem(32px);
}
}
\ No newline at end of file
... ...
... ... @@ -43,7 +43,7 @@ $fav: sprite-map("me/fav/*.png",$spacing: 5px);
//收藏主体
.fav-content {
padding: 0 pxToRem(30px);
//padding: 0 pxToRem(30px);
.fav-null {
font-size: pxToRem(22px);
... ... @@ -74,5 +74,185 @@ $fav: sprite-map("me/fav/*.png",$spacing: 5px);
display: block;
font-size: pxToRem(26px);
}
.fav-product-list {
list-style: none;
margin-left: pxToRem(30px);
li {
height: auto;
overflow: hidden;
margin-top: pxToRem(20px);
}
.fav-img-box {
width: pxToRem(90px);
height: pxToRem(120px);
float: left;
margin-right: pxToRem(24px);
img {
display: block;
overflow: hidden;
width: 100%;
height: 100%;
}
}
.fav-info-list {
color: #444;
font-size: pxToRem(24px);
border-bottom: 1px solid #e0e0e0;
padding-bottom: pxToRem(20px);
height: pxToRem(120px);
overflow: hidden;
position: relative;
h2 {
width: pxToRem(430px);
@include ellipsis();
}
.fav-price {
.new-price {
color: #d1021c;
}
.price-underline {
text-decoration: line-through;
}
}
.save-price {
$width: pxToRem(image_width(sprite-file($fav, save-price)));
$height: pxToRem(image_height(sprite-file($fav, save-price)));
position: absolute;
bottom: pxToRem(20px);
left: 0;
width: 100%;
&.save-price-number {
text-indent: $width + pxToRem(10px);
&:before {
content: '';
display: block;
@include rem-sprite($fav, save-price);
width: $width;
height: $height;
position: absolute;
top: 50%;
left: 0;
margin-top: -$height / 2;
}
}
span {
color: #d1021c;
&.sell-out {
padding: pxToRem(5px) pxToRem(18px);
color: #fffefe;
@include border-radius(pxToRem(20px));
background: #7f7f7f;
font-size: pxToRem(22px);
}
&.del-fav {
$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%;
right: pxToRem(30px);
margin-top: -$height / 2;
}
}
}
}
}
//品牌收藏
.fav-brand-swiper {
.swiper-header {
height: pxToRem(60px);
padding: pxToRem(20px) pxToRem(30px);
display: inline-block;
.swiper-logo {
height: 100%;
display: inline-block;
float: left;
margin-right: pxToRem(45px);
> img {
max-height: 100%;
vertical-align: middle;
}
}
.brand-info {
float: left;
.brand-name {
font-size: pxToRem(28px);
b {
color: #b0b0b0;
font-weight: normal;
}
}
.brand-update {
font-size: pxToRem(22px);
b {
color: #b0b0b0;
font-weight: normal;
}
.brand-new {
color: #86bf4a;
margin-right: pxToRem(24px);
}
.brand-discount {
color: #d1021c;
}
}
}
}
.swiper-container {
height: pxToRem(300px);
margin: 0 pxToRem(30px);
.swiper-slide {
width: pxToRem(225px);
//width: (225/580)*100%;
height: 100%;
float: left;
padding-right: pxToRem(30px);
&:nth-last-of-type(1) {
padding-right: 0;
}
img {
display: block;
width: 100%;
height: 100%;
overflow: hidden;
}
}
}
}
}
}
\ No newline at end of file
... ...
$vip: sprite-map("me/vip/*.png");
.my-page {
background: #f0f0f0;
... ... @@ -27,8 +26,8 @@ $vip: sprite-map("me/vip/*.png");
.vip-icon {
display: inline-block;
width: pxToRem(70px);
height: pxToRem(30px);
width: pxToRem(72px);
height: pxToRem(32px);
vertical-align: middle;
}
... ...
$vip: sprite-map("me/vip/*.png", $spacing: 10px);
@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "fav", "suggest", "address", "online-service";
... ...
... ... @@ -2,11 +2,17 @@
background: #f0f0f0;
.order {
position: relative;
display: block;
background: #fff;
margin: 30rem / $pxConvertRem 0;
border-top: 1px solid #e0e0e0;
border-bottom: 1px solid #e0e0e0;
&:last-child {
margin-bottom: 0;
}
.header, .footer {
height: 90rem / $pxConvertRem;
line-height: 90rem / $pxConvertRem;
... ... @@ -37,7 +43,7 @@
border-top: 1px solid #e0e0e0;
text-align: right;
> .btn {
.btn {
display: inline-block;
box-sizing: border-box;
height: 60rem / $pxConvertRem;
... ... @@ -46,6 +52,7 @@
font-size: 24rem / $pxConvertRem;
text-align: center;
border: 1px solid #000;
@include border-radius(5px);
}
.pay {
... ... @@ -56,6 +63,43 @@
}
}
}
.no-order {
position: absolute;
background: #fff;
text-align: center;
top: 50%;
margin-top: -220rem / $pxConvertRem;
width: 100%;
.icon {
width: 153rem / $pxConvertRem;
height: 196rem / $pxConvertRem;
background: image-url('me/no-order.png') no-repeat;
background-size: 100%;
margin: 0 auto;
}
span {
display: block;
color: #b0b0b0;
font-size: 24rem / $pxConvertRem;
margin: 30rem / $pxConvertRem 0 110rem / $pxConvertRem;
}
.walk-way {
display: block;
height: 80rem / pxConvertRem;
line-height: 80rem / $pxConvertRem;
width: 70%;
margin: 0 auto;
text-align: center;
font-size: 30rem / $pxConvertRem;
color: #fff;
background: #444;
@include border-radius(5px);
}
}
}
.order-nav {
... ...
@import "compass/layout";
$suggest: sprite-map("me/suggest/*.png",$spacing: 5px);
.yoho-suggest-page {
... ... @@ -102,4 +104,97 @@ $suggest: sprite-map("me/suggest/*.png",$spacing: 5px);
}
}
}
//发表意见
.create-new-suggest {
display: block;
color: #444;
width: 100%;
height: pxToRem(88px);
line-height: pxToRem(88px);
text-align: center;
font-size: pxToRem(30px);
border-top: 1px solid #e0e0e0;
border-bottom: 1px solid #e0e0e0;
> span {
color: #b0b0b0;
font-size: pxToRem(26px);
}
}
}
// 提交页面
.yoho-suggest-sub-page {
width: 100%;
//height: 100%;
background: #f0f0f0;
.suggest-sub-form {
background: #fff;
width: 100%;
#suggest-textarea {
@include box-sizing();
width: 100%;
max-width: 100%;
min-width: 100%;
height: pxToRem(255px);
max-height: pxToRem(255px);
min-height: pxToRem(255px);
padding: pxToRem(30px);
font-size: pxToRem(26px);
line-height: pxToRem(48px);
//color: #b0b0b0;
color: #000;
display: block;
background: #fff;
border: none;
outline: none;
}
.img-form {
padding: 0 pxToRem(30px);
.img-add {
display: block;
width: pxToRem(130px);
height: pxToRem(130px);
border: 1px dashed #e0e0e0;
position: relative;
&:after {
$width: pxToRem(image_width(sprite-file($suggest, suggest-add)));
$height: pxToRem(image_height(sprite-file($suggest, suggest-add)));
content: '';
display: block;
@include rem-sprite($suggest, suggest-add);
width: $width;
height: $height;
position: absolute;
top: 50%;
left: 50%;
margin-top: -$height / 2;
margin-left: -$width / 2;
}
> input[type="file"] {
position: absolute;
//@include stretch();
@include opacity(0.2);
border: none;
outline: none;
display: block;
width: pxToRem(130px);
height: pxToRem(130px);
top: 0;
left: 0;
}
}
}
}
}
\ No newline at end of file
... ...
$vip: sprite-map("me/vip/*.png", $spacing: 10px);
.vip-grade-page {
background: #f0f0f0;
padding-bottom: 30rem / $pxConvertRem;
... ...
$mainFontC:#444444;
$subFontC:#b0b0b0;
$borderC:#b0b0b0;
$borderC:#e0e0e0;
$tableCellC:#eee;
$basicBtnC:#eb0313;
.good-detail-page {
... ... @@ -10,41 +11,41 @@ $tableCellC:#eee;
box-sizing:border-box;
width: 100%;
border-bottom: 2px solid $borderC;
border-top: 2px solid $borderC;
border-top: 1px solid $borderC;
padding: 0 pxToRem(28px);
.title{
>.title{
min-height: pxToRem(88px);
line-height: pxToRem(88px);
color: $mainFontC;
font-size : pxToRem(28px);
border-bottom: 2px solid $borderC;
border-bottom: 1px solid $borderC;
span{
color:#a0a0a0;
font-size:pxToRem(18px);
color:#a0a0a0;
font-size:pxToRem(18px);
// vertical-align: baseline;
}
}
.detail{
margin-top: pxToRem(20px);
margin-bottom: pxToRem(20px);
font-size: pxToRem(24px);
line-height: pxToRem(36px);
&.table{
display: table;
width: 100%;
.row{
display: table-row;
.column{
display: table-cell;
padding: 0.4em 0.8em;
border:2px solid white;
font-size: pxToRem(24px);
background-color: $tableCellC;
}
}
}
.detail{
margin-top: pxToRem(20px);
margin-bottom: pxToRem(20px);
font-size: pxToRem(24px);
line-height: pxToRem(36px);
&.table{
display: table;
width: 100%;
.row{
display: table-row;
.column{
display: table-cell;
padding: 0.4em 0.8em;
border:1px solid white;
font-size: pxToRem(24px);
background-color: $tableCellC;
}
}
}
// table {
// width: 100%;
... ... @@ -133,7 +134,7 @@ $tableCellC:#eee;
color:$subFontC;
padding-left:pxToRem(28px);
padding-right:pxToRem(28px);
border-bottom: 2px solid $borderC;
border-bottom:1px solid $borderC;
background-color: #f4f4f4;
}
... ... @@ -143,7 +144,7 @@ $tableCellC:#eee;
min-height: pxToRem(88px);
padding-left:pxToRem(28px);
padding-right:pxToRem(28px);
border-bottom: 2px solid $borderC;
border-bottom: 1px solid $borderC;
}
.goodsPrice{
float: left;
... ... @@ -161,9 +162,9 @@ $tableCellC:#eee;
}
}
.periodOfMarket{
font-size: pxToRem(24px);
float: right;
h1{
font-size: pxToRem(24px);
float: right;
h1{
display: inline-block;
line-height: pxToRem(88px);
}
... ... @@ -173,11 +174,11 @@ $tableCellC:#eee;
// width: 100%;
display:table;
span{
display: table-cell;
vertical-align: middle;
}
}
.vipLevel {
display: table-cell;
vertical-align: middle;
}
}
.vipLevel {
display: table;
min-height: pxToRem(88px);
padding-left:pxToRem(28px);
... ... @@ -185,7 +186,7 @@ $tableCellC:#eee;
font-size: pxToRem(22px);
color: #999999;
border-bottom: 2px solid $borderC;
border-bottom: 1px solid $borderC;
span{
display: table-cell;
vertical-align: middle;
... ... @@ -211,6 +212,7 @@ $tableCellC:#eee;
font-size: pxToRem(28px);
color: $mainFontC;
line-height: pxToRem(88px);
border-bottom: 2px solid $borderC;
.iconfont{
... ... @@ -234,8 +236,8 @@ $tableCellC:#eee;
height: pxToRem(60px);
padding: pxToRem(10px) 0;
background-color: #fff;
border-top: 2px solid $borderC;
border-bottom: 2px solid $borderC;
border-top: 1px solid $borderC;
border-bottom: 1px solid $borderC;
}
.comment-nav, .consult-nav {
... ... @@ -254,13 +256,13 @@ $tableCellC:#eee;
}
.comment-nav {
border-right: 2px solid #ccc;
border-right: 1px solid #ccc;
}
.comment-content{
.comment-content-main{
.comment-content-main{
background-color: #fff;
border-bottom: 2px solid $borderC;
border-bottom: 1px solid $borderC;
.user-name{
font-size: px2rem(24);
line-height: px2rem(62);
... ... @@ -315,6 +317,7 @@ $tableCellC:#eee;
}
.comment-content-footer{
min-height: pxToRem(88px);
text-align: center;
background-color: #fff;
... ... @@ -331,6 +334,7 @@ $tableCellC:#eee;
}
}
}
.content.hide {
... ... @@ -357,39 +361,49 @@ $tableCellC:#eee;
margin-right: pxToRem(-25px);
}
}
.store-name{
font-size: pxToRem(34px);
color:$mainFontC;
.store-name{
font-size: pxToRem(34px);
color:$mainFontC;
}
.store-link{
font-size:pxToRem(28px) ;
color:$subFontC;
text-align: right;
span{
font-size: inherit;
}
.store-link{
font-size:pxToRem(28px) ;
color:$subFontC;
text-align: right;
span{
font-size: inherit;
}
}
.goods-desc{
.service{
margin-top: pxToRem(22px);
}
}
}
// .goods-desc{
// table{
// }
// }
.tips{
color:$subFontC;
font-size: pxToRem(18px);
margin-top: pxToRem(20px);
}
.materials{
.detail{
img{
display: block;
overflow: hidden;
width: pxToRem(90px);
height: pxToRem(120px);
padding-right: pxToRem(20px);
float: left;
}
display: block;
overflow: hidden;
width: pxToRem(90px);
height: pxToRem(120px);
padding-right: pxToRem(20px);
float: left;
}
.material-desc{
// float: left;
font-size: pxToRem(24px);
}
}
.material-type{
border-top: 1px solid $borderC;
padding: pxToRem(17px) 0;
}
}
.product-detail{
... ... @@ -400,6 +414,7 @@ $tableCellC:#eee;
height: pxToRem(772px);
}
}
margin-bottom: pxToRem(120px);
}
.detail-swiper{
... ... @@ -408,13 +423,126 @@ $tableCellC:#eee;
width: pxToRem(114px);
div{
text-align: center;
&.cell{
font-size: pxToRem(24px);
background-color: $tableCellC;
padding:pxToRem(15px) 0;
border: 1px solid #fff;
}
}
div.cell{
background-color: $tableCellC;
padding:pxToRem(15px) 0;
border: 1px solid #fff;
}
}
}
#reference-swiper-container{
.first-group{
width: pxToRem(58px);
>div{
height: pxToRem(67px);
}
}
}
.measurement-method{
.detail{
width: 100%;
height: pxToRem(300px);
img{
float:left;
width: pxToRem(270px);
height: pxToRem(239px);
margin-top: pxToRem(18px);
margin-right: pxToRem(28px);
}
.right-part{
float:left;
.title{
>h1{
margin-top: pxToRem(10px);
display: inline-block;
padding-right: pxToRem(10px);
border-right: 1px solid $borderC;
line-height: 100%;
}
>span{
font-size: pxToRem(12px);
}
}
ul.items{
margin-top: pxToRem(20px);
padding: 0;
line-height: pxToRem(30px);
font-size: pxToRem(13px);
li{
span{
display: inline-block;
width: pxToRem(15px);
height: pxToRem(15px);
background-color: $basicBtnC;
border-radius: 50%;
color:white;
text-align: center;
line-height: pxToRem(15px);
font-size: pxToRem(13px);
margin-right: pxToRem(12px);
vertical-align: text-bottom;
}
}
}
}
clear:both;
}
}
.cart-bar{
position: relative;
box-sizing:border-box;
width: 100%;
height: pxToRem(120px);
position:fixed;
bottom: 0;
background-color: white;
z-index: 64;
padding:pxToRem(20px) pxToRem(28px);
text-align: center;
a{
display: inline-block;
&.num-incart{
width: pxToRem(45px);
height: pxToRem(45px);
background: url(../img/product/cart.png) no-repeat;
}
&.favorite{
width: pxToRem(34px);
height: pxToRem(32px);
background:url(../img/product/favorite.png) no-repeat;
}
&.addto-cart{
height: pxToRem(80px);
width: pxToRem(260px);
margin:0 pxToRem(100px) 0 pxToRem(128px);
color: #fff;
background-color: $basicBtnC;
font-size: pxToRem(40px);
line-height: pxToRem(80px);
text-align: center;
}
}
.num-tag{
position: absolute;
left:pxToRem(66px);
height: pxToRem(20px);
display: block;
width: pxToRem(36px);
height: pxToRem(36px);
background-color: $basicBtnC;
border-radius: 50%;
color:white;
font-size: pxToRem(24px);
}
}
}
... ...
... ... @@ -46,7 +46,7 @@
background: url("../img/me/employ/rank-t.png") no-repeat;
background-position: center top;
background-size: 100%;
line-height: 58rem / $pxConvertRem;
line-height: 54rem / $pxConvertRem;
}
}
... ... @@ -74,7 +74,7 @@
overflow: hidden;
white-space: nowrap;
span {
b {
text-decoration: line-through;
color: #b0b0b0;
margin-left: 10rem / $pxConvertRem;
... ... @@ -125,12 +125,20 @@
}
.s-goods-nav {
box-sizing:border-box;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
overflow: hidden;
li {
margin: 0 0 0 (50rem / $pxConvertRem);
width: auto;
height: 95%;
color: #999;
&.active{
color: #000;
border-bottom:2px solid #000;
}
a {
padding: 0;
}
... ...
... ... @@ -17,4 +17,4 @@
<p>有效期:2014.07.28 - 2014.09.15</p>
</div>
</div>
{{> layout/not-footer}}
\ No newline at end of file
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -7,9 +7,41 @@
</ul>
<div class="fav-content">
<div class="fav-type">
{{# hasFavProduct}}
<ul class="fav-product-list">
{{# hasFavProduct}}
<li>
<div class="fav-img-box">
<img src="{{imgUrl}}" alt=""/>
</div>
<div class="fav-info-list">
<h2>{{title}}</h2>
<div class="fav-price">
{{# discountPrice}}
<span class="new-price">{{.}}</span>
{{/ discountPrice}}
<span class="fav-price {{# discountPrice}}price-underline{{/ discountPrice}}">{{price}}</span>
</div>
{{/ hasFavProduct}}
{{# savePrice}}
<div class="save-price save-price-number">
比收藏时降价了<span>{{.}}</span>
<span class="del-fav"></span>
</div>
{{/ savePrice}}
{{^ savePrice}}
<div class="save-price">
{{# sellOut}}
<span class="sell-out">已售罄</span>
{{/ sellOut}}
<span class="del-fav"></span>
</div>
{{/ savePrice}}
</div>
</li>
{{/ hasFavProduct}}
</ul>
{{^ hasFavProduct}}
<span class="fav-null">您暂无收藏任何商品</span>
... ... @@ -18,7 +50,41 @@
</div>
<div class="fav-type hide">
{{# hasFavBrand}}
<div class="fav-brand-swiper">
<div class="swiper-header">
<div class="swiper-logo">
<img src="{{brandImg}}" alt=""/>
</div>
<div class="brand-info">
<span class="brand-name">{{brandName}}</span>
<div class="brand-update">
{{# update}}
<span class="brand-new">上新<b>{{.}}</b></span>
{{/ update}}
{{# discount}}
<span class="brand-discount">折扣<b>{{.}}</b></span>
{{/ discount}}
</div>
</div>
<a href="{{link}}"></a>
</div>
<div id="swiper-container-{{id}}" class="swiper-container" data-id="{{id}}">
<ul class="swiper-wrapper swiper-wrapper-{{id}}">
{{# productList}}
<li class="swiper-slide">
<img class="swiper-lazy" data-src="{{imgUrl}}" alt=""/>
<div class="brand-product">
<p class="{{# discount}}price-discount{{/ discount}}">
{{price}}
{{# discount}}<span>{{.}}{{/ discount}}<span>
</p>
</div>
<div class="swiper-lazy-preloader"></div>
</li>
{{/ productList}}
</ul>
</div>
</div>
{{/ hasFavBrand}}
{{^ hasFavBrand}}
... ...
{{> me/order/orders}}
\ No newline at end of file
... ...
... ... @@ -2,29 +2,17 @@
<div class="order-page yoho-page">
{{# order}}
<ul id="order-nav" class="order-nav clearfix">
<li class="active">
全部
</li>
<li>
待付款
</li>
<li>
待发货
</li>
<li>
待收货
</li>
{{#each navs}}
<li {{#if active}}class="active"{{/if}} data-type="{{typeId}}">
{{name}}
</li>
{{/each}}
</ul>
<div id="order-container" class="order-container">
<div class="all orders">
{{#each orders}}
{{> me/order/order}}
{{/each}}
</div>
<div class="unpaid orders hide"></div>
<div class="unshipped orders hide"></div>
<div class="unreceived orders hide"></div>
{{#each navs}}
<div class="orders{{#unless active}} hide{{/unless}}"></div>
{{/each}}
</div>
{{/ order}}
</div>
... ...
... ... @@ -3,7 +3,7 @@
<ul>
<li><span>头像</span><span><i class="head-portrait"><img src="{{ head_ico }}"></i></span></li>
<li><span>昵称</span><span>{{ username }}</span></li>
<li><span>性别</span><span></span></li>
<li><span>性别</span><span>{{ gender }}</span></li>
<li><span>生日</span><span>{{ birthday }}</span></li>
<li><span>会员等级</span>
<span>
... ...
... ... @@ -33,6 +33,9 @@
</div>
{{/ suggestContent}}
</div>
<a class="create-new-suggest" href="#">
反馈问题<span>(功能意见,界面意见)</span>
</a>
{{/ suggest}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="yoho-suggest-sub-page yoho-page">
{{# suggestSub}}
<div class="suggest-sub-form">
<textarea name="" id="suggest-textarea" placeholder="请输入意见反馈,我们会以消息形式回复您的建议或意见,改进产品体验,谢谢!"></textarea>
<div class="img-form">
<span class="img-add">
<input id="upload-img" type="file" name="fileselect[]" multiple />
</span>
</div>
</div>
{{/ suggestSub}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -121,6 +121,7 @@
{{#goodsDescription}}
<div class="goods-desc page-block">
<img class="service" src="http://static.dev.yohobuy.com/img/product/service.png" alt="">
<h1 class="title">
{{title}}
<span class="en-title">{{enTitle}}</span>
... ... @@ -169,6 +170,7 @@
{{/list}}
</div>
</div>
<p class="tips">提示:左滑查看完整表格信息</p>
</div>
{{/detail}}
</div>
... ... @@ -176,15 +178,32 @@
<div class="gap-block"></div>
<div class="size-info page-block">
{{#measurementMethod}}
<div class="measurement-method page-block">
<h1 class="title">
测量方式
<span class="en-title">SIZE INFO</span>
{{title}}
<span class="en-title">{{enTitle}}</span>
</h1>
<div class="detail">
{{#detail}}
<div class="detail" style="width:100%">
<img src="{{img}}" alt="">
<div class="right-part">
<div class="title">
<h1 >{{sort}}</h1>
<span>{{enSort}}</span>
</div>
<ul class="items">
{{#each items}}
<li>
<span>{{@index}}</span>
{{this}}</li>
{{/items}}
</ul>
</div>
</div>
{{/detail}}
</div>
{{/measurementMethod}}
<div class="gap-block"></div>
... ... @@ -199,14 +218,27 @@
<div class="swiper-container detail-swiper" id="reference-swiper-container">
<div class="swiper-wrapper">
{{#list}}
<div class="swiper-slide blue-slide" >
<div class="model-name cell">{{name}}</div>
{{#if @first}}
<div class="swiper-slide first-group" >
<div class="model-field" >{{fieldName}}</div>
<div class="first-model">
<img src="{{firstModel}}" alt="">
</div>
<div class="second-model">
<img src="{{secondModel}}" alt="">
</div>
</div>
{{^}}
<div class="swiper-slide" >
<div class="model-field cell">{{fieldName}}</div>
<div class="first-model cell">{{firstModel}}</div>
<div class="second-model cell">{{secondModel}}</div>
</div>
{{/if}}
{{/list}}
</div>
</div>
<p class="tips">提示:左滑查看完整表格信息</p>
</div>
{{/detail}}
</div>
... ... @@ -226,7 +258,9 @@
{{desc}}
</p>
</div>
<img src="{{materialType}}" alt="" class="material-type">
</div>
{{/materials}}
... ... @@ -244,6 +278,15 @@
</div>
</div>
{{/productDetail}}
{{#cartInfo}}
<div class="cart-bar">
<span class="num-tag">{{numInCart}}</span>
<a href="" class="num-incart"></a>
<a href="" class="addto-cart">加入购物车</a>
<a href="" class="favorite"></a>
</div>
{{/cartInfo}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
{{#if tabs}}
<div class="s-goods-nav goods-nav">
<ul class="swiper-wrapper clearfix">
{{# tabs}}
{{# title}}
<li class="swiper-slide nav-item" data-sort="{{ params}}" data-id="{{ id}}">
<span>{{ name}}</span>
</li>
{{# tabs}}
{{# title}}
<li class="swiper-slide nav-item {{#if @first}} active{{/if}}">
<span data-sort="{{ params}}" data-id="{{ id}}" >{{ name}}</span>
</li>
{{/ title}}
{{/ tabs}}
{{/ tabs}}
</ul>
</div>
{{/if}}
<div class="rank-main">
<ul>
{{# goods}}
... ... @@ -24,7 +25,7 @@
{{# active}}
<p>{{.}}</p>
{{/ active}}
<p>{{salePrice}}<span>{{price}}</span></p>
<p>{{salePrice}}<b>{{price}}</b></p>
</div>
</a>
</li>
... ...
{{> home/floor_header_more}}
<div class="goods-category">
{{# big_image}}
{{#if list}}
<div class="category-swiper">
<ul class="swiper-wrapper">
{{# list}}
<li class="swiper-slide">
<a href="{{url}}">
<img class="lazy" data-original="{{img}}" alt="{{title}}">
</a>
</li>
{{/ list}}
</ul>
<div class="swiper-pagination">
<div class="pagination-inner clearfix">
</div>
</div>
</div>
{{^}}
<div class="category-swiper">
<ul class="swiper-wrapper">
{{# list}}
<li class="swiper-slide">
<a href="{{url}}">
<img class="lazy" data-original="{{img}}" alt="{{title}}">
</a>
</li>
{{/ list}}
</ul>
<div class="swiper-pagination">
<div class="pagination-inner clearfix">
</div>
</div>
<a href={{url}}>
<img class="lazy" data-original="{{img}}" alt="{{title}}">
</a>
</div>
{{/if}}
{{/ big_image}}
<ul class="category-list clearfix">
{{# list}}
... ...
... ... @@ -28,7 +28,7 @@
a.async=1;
a.src=j;
m.parentNode.insertBefore(a,m);
})(window,document,'script','http://cdn.yoho.cn/yas-jssdk/1.0.12/yas.js','_yas');
})(window,document,'script','http://cdn.yoho.cn/yas-jssdk/1.0.13/yas.js','_yas');
</script>
{{> layout/use}}
{{> layout/analysis}}
... ...
{{#if hasWxShare}}
<script type="text/javascript" charset="utf-8" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
{{/if}}
{{#if rlsEnv}}
<script src="http://cdn.yoho.cn/myohobuy/{{version}}/lib.js"></script>
<script src="http://cdn.yoho.cn/myohobuy/{{version}}/index.js"></script>
{{/if}}
{{#if preEnv}}
<script src="http://cdn.yoho.cn/myohobuy/{{version}}/lib.js"></script>
<script src="http://cdn.yoho.cn/myohobuy/{{version}}/index.js"></script>
{{/if}}
{{#if testEnv}}
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/{{version}}/lib.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/{{version}}/index-debug.js"></script>
{{/if}}
{{#if devEnv}}
<script src="http://localhost:8000/static/js/sea.js?nowrap"></script>
<script>seajs.config({base: 'http://localhost:8000/'});</script>
{{/if}}
<script type="text/javascript">
(function(w,d,s,j,f){
w['YohoAcquisitionObject']=f;
w[f]=function(){w[f].p=arguments;};
var a=d.createElement(s);
var m=d.getElementsByTagName(s)[0];
a.async=1;
a.src=j;
m.parentNode.insertBefore(a,m);
})(window,document,'script','http://cdn.yoho.cn/yas-jssdk/1.0.12/yas.js','_yas');
</script>
{{> layout/use}}
{{> layout/analysis}}
</body>
</html>
\ No newline at end of file
... ... @@ -9,5 +9,8 @@
{{#navTitle}}
<p class="nav-title">{{.}}</p>
{{/navTitle}}
{{# navBtn}}
<span class="nav-btn">{{.}}</span>
{{/ navBtn}}
</header>
{{/pageHeader}}
\ No newline at end of file
... ...
... ... @@ -217,10 +217,17 @@
</script>
{{/if}}
{{#if favPage}}
{{!-- 个人中心: 收藏 --}}
<script>
seajs.use('js/me/fav');
</script>
{{/if}}
{{!-- 个人中心: 意见反馈 --}}
{{#if suggestPage}}
<script>
seajs.use('js/me/suggest');
</script>
{{/if}}
{{#if couponsPage}}
<script>
seajs.use('js/me/coupons');
... ...
<div class="order" data-id="{{orderNum}}">
<div class="order" data-id="{{orderNum}}" data-href="{{detailUrl}}">
<header class="header">
订单编号:{{orderNum}}
<span class="order-status">{{orderStatus}}</span>
... ... @@ -15,24 +15,24 @@
{{!-- 对应订单状态的操作逻辑 --}}
{{!-- 完成和取消订单显示删除按钮 --}}
{{#unless unpaid}}
{{#unless unreceived}}
<div class="order-opt">
<div class="order-opt">
{{#unless unpaid}}
{{#unless unreceived}}
<span class="btn del">删除订单</span>
</div>
{{/unless}}
{{/unless}}
{{/unless}}
{{#if unpaid}}
<div class="order-opt">
{{#if unpaid}}
<span class="btn cancel">取消订单</span>
<span class="btn pay">立即付款</span>
</div>
{{/if}}
<a class="locHref" href="{{payUrl}}">
<span class="btn pay">立即付款</span>
</a>
{{/if}}
{{#if unreceived}}
<div class="order-opt">
<a class="check-logistics" href="{{logisticsUrl}}">查看物流</a>
</div>
{{/if}}
{{#if unreceived}}
<a class="locHref" href="{{logisticsUrl}}">
<span class="btn check-logistics">查看物流</span>
</a>
{{/if}}
</div>
</div>
\ No newline at end of file
... ...
{{#if walkwayUrl}}
<div class="no-order">
<div class="icon"></div>
<span>你还没有订单</span>
<a class="walk-way" href="{{walkwayUrl}}">随便逛逛</a>
</div>
{{^}}
{{#each orders}}
{{> me/order/order}}
{{/each}}
{{/if}}
\ No newline at end of file
... ...
... ... @@ -4,6 +4,7 @@ use Action\AbstractAction;
use home\GradeModel;
use home\OrderModel;
use Plugin\Helpers;
use LibModels\Wap\Home\OrderData;
/**
* 个人中心相关的控制器
... ... @@ -26,7 +27,7 @@ class HomeController extends AbstractAction
$this->setNavHeader('个人中心', true, SITE_MAIN);
// $uid = $this->getUid();
$uid = 967016;
$uid = 8826435;
$data = \Index\UserModel::getUserProfileData($uid);
$data += \Index\UserModel::getInfoNumData($uid);
... ... @@ -42,51 +43,6 @@ class HomeController extends AbstractAction
}
/**
* 用户订单
*/
public function ordersAction() {
// $uid = $this->getUid();
// $type = $this->get('type', 1);
// $orders = \Index\UserModel::getUserOrderData(967016, $type);
$order = array(
'orders' => array(
array(
'orderNum' => '408539077',
'tradingStatus' => '交易成功',
'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'
)
),
'count' => 2,
'sumCost' => '699.00',
'unpaid' => true,
)
)
);
$this->_view->display('order', array('order' => $order, 'orderPage' => true));
// print_r($orders);
}
/**
* 用户收藏的商品
*/
public function favoriteAction() {
... ... @@ -97,7 +53,7 @@ class HomeController extends AbstractAction
//print_r($favProducts);
$this->_view->display('favorite', array(
'favPage' => true,
'favPage' => true, //加载js
'pageHeader' => array(
'navBack' => true,
'navTitle' => '我的收藏',
... ... @@ -105,8 +61,99 @@ class HomeController extends AbstractAction
),
'pageFooter' => true,
'favorite' => true,
'hasFavProduct' => false,
'hasFavBrand' => false
'hasFavProduct' => array(
'0' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'title' => 'adidas Originals ZX FLUXM22508 ',
'price' => '¥800',
'discountPrice' => false,
'savePrice' => false,
'sellOut' => true
),
'1' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'title' => 'adidas Originals ZX FLUXM22508 ',
'price' => '¥800',
'discountPrice' => '¥500',
'savePrice' => '¥300',
'sellOut' => false
)
),
'hasFavBrand' => array(
'0' => array(
'id' => '1',
'brandImg' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'brandName' => 'VANS',
'update' => 12,
'discount' => 10,
'link' => '#',
'productList' => array(
'0' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'price' => '¥240',
'discount' => '¥240'
),
'1' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'price' => '¥240',
'discount' => '¥240'
),
'2' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'price' => '¥240',
'discount' => '¥240'
),
'3' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'price' => '¥240',
'discount' => '¥240'
)
)
),
'1' => array(
'id' => '2',
'brandImg' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'brandName' => 'VANS',
'update' => 12,
'discount' => 10,
'link' => '#',
'productList' => array(
'0' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'price' => '¥240',
'discount' => '¥240'
),
'1' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'price' => '¥240',
'discount' => '¥240'
),
'2' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'price' => '¥240',
'discount' => '¥240'
),
'3' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'price' => '¥240',
'discount' => '¥240'
)
)
),
'2' => array(
'id' => '3',
'brandImg' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'brandName' => 'VANS',
'update' => 12,
'discount' => 10,
'link' => '#',
'productList' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'price' => '¥240',
'discount' => false
)
)
)
));
}
... ... @@ -140,26 +187,16 @@ class HomeController extends AbstractAction
* YOHO币
*/
public function currencyAction() {
// $uid = $this->getUid();
$this->setNavHeader('YOHO币', true, false);
$this->setTitle('YOHO币');
$this->setNavHeader('优惠券', true, SITE_MAIN);
$uid = 967016;
$currency = \Index\UserModel::getYohoCoinData($uid);
$this->setTitle('优惠券');
$this->setNavHeader('优惠券', true, SITE_MAIN);
// $uid = $this->getUid();
$uid = 8826435;
$coupons = array(
'couponsUrl' => array(
\Index\UserModel::getCouponData($uid, 0),
\Index\UserModel::getCouponData($uid, 1),
),
'couponsPage' => true
);
$this->_view->display('coupons', $coupons);
$currency['pageFooter'] = true;
$this->_view->display('currency', $currency);
}
/**
* 优惠券
*/
... ... @@ -204,8 +241,8 @@ class HomeController extends AbstractAction
// $uid = $this->getUid();
$uid = 967016;
$address = \Index\UserModel::getAddressData($uid);
$addressList = \Index\UserModel::getAddressListData($uid);
$address = \Index\UserModel::getAddressData($uid);
$addressList = \Index\UserModel::getAddressListData($uid);
// print_r($addressList);
... ... @@ -213,61 +250,57 @@ class HomeController extends AbstractAction
'addressPage' => true,
'pageFooter' => true,
'address' => $address,
'addressList' => $addressList
'addressList' => $addressList
));
}
/**
* 修改地址或者添加新地址
*/
public function saveAddressAction()
{
$result = array();
if ($this->isAjax()) {
// $uid = $this->getUid();
$uid = 967016;
$address = $this->post('address', '');
$area_code = $this->post('area_code', '');
$consignee = $this->post('consignee', '');
$email = $this->post('email', '');
$id = $this->post('id', null);
$mobile = $this->post('mobile', '');
$zip_code = $this->post('zip_code', '');
$result = \Index\UserModel::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 设置默认地址
*/
public function defaultAddressAction()
{
$result = array();
if ($this->isAjax()) {
// $uid = $this->getUid();
$uid = 967016;
$id = $this->post('id', '');
$result = \Index\UserModel::setDefaultAddress($uid, $id);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 修改地址或者添加新地址
*/
public function saveAddressAction() {
$result = array();
if ($this->isAjax()) {
// $uid = $this->getUid();
$uid = 967016;
$address = $this->post('address', '');
$area_code = $this->post('area_code', '');
$consignee = $this->post('consignee', '');
$email = $this->post('email', '');
$id = $this->post('id', null);
$mobile = $this->post('mobile', '');
$zip_code = $this->post('zip_code', '');
$result = \Index\UserModel::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 设置默认地址
*/
public function defaultAddressAction() {
$result = array();
if ($this->isAjax()) {
// $uid = $this->getUid();
$uid = 967016;
$id = $this->post('id', '');
$result = \Index\UserModel::setDefaultAddress($uid, $id);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
//在线客服
public function onlineServiceAction() {
... ... @@ -289,8 +322,7 @@ class HomeController extends AbstractAction
$service = array();
$cateId = $this->get('cateId', 0);
$cateName = $this->get('cateName', '');
if ($cateId > 0)
{
if ($cateId > 0) {
$service = home\OnlineModel::getOnlineServiceDetail($cateId);
}
$this->setTitle('在线客服');
... ... @@ -309,19 +341,19 @@ class HomeController extends AbstractAction
* 意见反馈
*/
public function suggestAction() {
// 设置网站标题
$this->setTitle('意见反馈');
$this->setNavHeader('意见反馈', true, SITE_MAIN);
$udid = $this->getUdid();
$page = $this->get('page', 1);
$limit = $this->get('limit', 30);
$suggest = \Index\UserModel::getSuggestData($udid, $page, $limit);
//print_r($suggest);
print_r($suggest);
$this->_view->display('suggest', array(
'suggestPage' => true,
'pageHeader' => array(
'navBack' => true,
'navTitle' => '意见反馈'
),
'suggestPage' => true, //加载js
'pageFooter' => true,
'suggest' => true,
'suggestContent' => array(
... ... @@ -348,6 +380,29 @@ class HomeController extends AbstractAction
}
/**
* 意见反馈-提交表单
*/
public function suggest_subAction() {
$udid = $this->getUdid();
$page = $this->get('page', 1);
$limit = $this->get('limit', 30);
$suggest = \Index\UserModel::getSuggestData($udid, $page, $limit);
//print_r($suggest);
$this->_view->display('suggest_sub', array(
'suggestPage' => true, //加载js
'pageHeader' => array(
'navBack' => true,
'navTitle' => '反馈问题',
'navBtn' => '提交'
),
'suggestSub' => true,
'pageFooter' => true
));
}
/**
* 异步保存意见反馈数据
*/
public function savesuggestAction() {
... ... @@ -355,7 +410,6 @@ class HomeController extends AbstractAction
$uid = $this->getUid();
$content = $this->post('content', '');
$suggest_type = $this->get('suggest_type', 2);
$result = \Index\UserModel::saveSuggestData($uid, $content, $suggest_type);
$this->echoJson($result);
... ... @@ -402,6 +456,30 @@ class HomeController extends AbstractAction
*/
public function orderAction() {
//获得type值
$type = $this->get('type', 1);
$this->setTitle('我的订单');
$this->setNavHeader('我的订单');
$data = OrderModel::getNavs($type);
if (!empty($data)) {
$order['navs'] = $data;
$order['orderPage'] = true;
} else {
$this->error();
}
$this->_view->display('order', array(
'order' => $order,
'pageFooter' => true
));
}
//ajax请求订单页面
public function getOrderAction() {
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
}
//获取基本参数:type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论
$type = $this->get('type', 1);
$page = $this->get('page', 1);
... ... @@ -412,25 +490,103 @@ class HomeController extends AbstractAction
$uid = '7566245'; //测试用
//调用模型层getOrder方法获得并处理数据
$data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid);
//如果没有订单数据,就给一个随便逛逛链接
$order = array();
if (!empty($data)) {
$order['orders'] = $data;
} else {
$order['walkwayUrl'] = 'http://www.baidu.com';
}
//渲染模板
$this->_view->display('order', array(
'order' => array(
'orders' => $data
)
));
$this->_view->display('order-content', $order);
}
/*
* 我的订单-处理ajax请求页面(切换订单状态)
* 我的订单-取消订单
*/
public function orderAjaxAction() {
public function cancelOrderAction() {
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
}
self::orderAction();
//传入order_code和uid以取消订单
$order_code = $this->get('orderCode');
$uid = $this->getUid();
$uid = '10267443'; //测试用
$gender = Helpers::getGenderByCookie();
$yh_channel = $this->get('yh_channel', 1);
$method = 'app.SpaceOrders.close';
$data = OrderData::cancelOrderData($order_code, $uid, $gender, $yh_channel, $method);
if ($data['code'] == 200) {
echo $data['message'];
}
}
/*
* 我的订单-删除订单
*/
public function deleteOrderAction() {
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
}
//传入order_code和uid以删除订单
$order_code = $this->get('orderCode');
$uid = $this->getUid();
$uid = '10267443'; //测试用
$gender = Helpers::getGenderByCookie();
$yh_channel = $this->get('yh_channel', 1);
$method = 'app.SpaceOrders.delOrderByCode';
$data = OrderData::deleteOrderData($order_code, $uid, $gender, $yh_channel, $method);
if ($data['code'] == 200) {
echo $data['message'];
}
}
/**
* 订单详情页
*/
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));
}
}
... ...
... ... @@ -15,7 +15,7 @@ class GradeModel
* 获取个人中心-会员等级数据
*/
public function getGrade($gender, $channel, $uid) {
public static function getGrade($gender, $channel, $uid) {
$result = array();
if (USE_CACHE) {
... ... @@ -27,40 +27,42 @@ class GradeModel
}
//调用接口获取数据
$data = GradeData::getGradeData($gender, $channel, $uid);
switch (intval($data['grade']['current_vip_level'])) {
case 0://普通会员
$result['vipGrade']['vip0'] = true;
break;
case 1://银卡会员
$result['vipGrade']['vip1'] = true;
break;
case 2://金卡会员
$result['vipGrade']['vip2'] = true;
break;
case 3://白金会员
$result['vipGrade']['vip3'] = true;
break;
}
//今年总消费
$result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost'];
//升级下一等级会员的进度;
$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']['sumCost'] = $data['grade']['current_total_cost'];
//username 调用获取用户基本信息数据,获得username;
//$userProfile = GradeData::getUserProfileData($gender,$uid,$channel);
$result['vipGrade']['name'] = $data['userProfile']['username'];
//跳转url(会员特权详情)
$result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential', null);
//当前vip等级享受的特权
$result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential'];
if (!empty($data['grade'])) {
switch (intval($data['grade']['current_vip_level'])) {
case 0://普通会员
$result['vipGrade']['vip0'] = true;
break;
case 1://银卡会员
$result['vipGrade']['vip1'] = true;
break;
case 2://金卡会员
$result['vipGrade']['vip2'] = true;
break;
case 3://白金会员
$result['vipGrade']['vip3'] = true;
break;
}
//今年总消费
$result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost'];
//升级下一等级会员的进度;
$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']['sumCost'] = $data['grade']['current_total_cost'];
//username 调用获取用户基本信息数据,获得username;
//$userProfile = GradeData::getUserProfileData($gender,$uid,$channel);
$result['vipGrade']['name'] = $data['userProfile']['username'];
//跳转url(会员特权详情)
$result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential', null);
//当前vip等级享受的特权
$result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential'];
}
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
... ...
... ... @@ -39,7 +39,7 @@ class OrderModel
foreach ($data['data']['order_list'] as $key => $vo) {
//订单号,支付状态,订单商品数量,订单总价格
$result[$key]['orderNum'] = $vo['order_code'];
$result[$key]['tradingStatus'] = $vo['status_str'];
$result[$key]['orderStatus'] = $vo['status_str'];
$result[$key]['count'] = count($vo['order_goods']);
$result[$key]['sumCost'] = $vo['amount'] + $vo['shipping_cost'];
//订单商品列表数据
... ... @@ -57,9 +57,13 @@ class OrderModel
case 0:
$result[$key]['unpaid'] = true;
break;
case 1 || 2 || 3 || 4 || 5:
case 1:
case 2:
case 3:
case 4:
case 5:
$result[$key]['unreceived'] = true;
$resault[$key]['logisticsUrl'] = "暂无logisticsUrl数据";
$result[$key]['logisticsUrl'] = "暂无logisticsUrl数据";
break;
case 6:
$result[$key]['completed'] = true;
... ... @@ -117,5 +121,55 @@ class OrderModel
}
return $arr;
}
//根据type值设置nav属性
public function getNavs($type){
$nav = array(
array(
'name' => '全部',
'typeId' => '1'
),
array(
'name' => '待付款',
'typeId' => '2'
),
array(
'name' => '待发货',
'typeId' => '3'
),
array(
'name' => '待收货',
'typeId' => '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;
}
}
return $nav;
}
}
... ...
... ... @@ -33,6 +33,7 @@ class UserModel
// 处理个人详情数据
if (isset($userData['data']) && !empty($userData['data'])) {
$result = $userData['data'];
$result['gender'] = $result['gender'] == 1 ? '男' : '女';
$result['head_ico'] = Images::getImageUrl($result['head_ico'], 128, 128);
}
... ... @@ -103,8 +104,6 @@ class UserModel
// 处理用户订单数据
if (isset($orderData['data']) && !empty($orderData['data'])) {
$result = $orderData['data'];
$oneOrder = array();
foreach ($orderData['data']['order_list'] as $val) {
$oneOrder = array();
... ... @@ -120,21 +119,18 @@ class UserModel
$oneGoods = array();
$oneGoods['id'] = 1;
$oneGoods['thumb'] = Helpers::getImageUrl($goods['goods_image'], 60, 80);
$oneGoods['name'] = $val['product_name'];
$oneGoods['color'] = $val['color_name'];
$oneGoods['size'] = $val['size_name'];
$oneGoods['size_name'] = $val['size_name'];
$oneGoods['price'] = $val['goods_price'];
$oneGoods['count'] = $val['buy_number'];
$result['goods'][] = $oneGoods;
$oneGoods['name'] = $goods['product_name'];
$oneGoods['color'] = $goods['color_name'];
$oneGoods['size'] = $goods['size_name'];
$oneGoods['price'] = $goods['goods_price'];
$oneGoods['count'] = $goods['buy_number'];
$oneOrder[] = $oneGoods;
}
$result['orders'][] = $oneOrder;
}
}
print_r($result);
return $result;
}
... ... @@ -307,7 +303,8 @@ class UserModel
$address = UserData::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code);
// 处理返回结果
if (isset($address['code']) && $address['code'] == 200) {
$result = $address['data'];
$result['code'] = $address['code'];
$result['message'] = $address['message'];
}
}
... ... @@ -353,7 +350,20 @@ class UserModel
// 处理意见反馈数据
if (isset($suggest['data']) && !empty($suggest['data'])) {
$result = $suggest['data'];
$one = array();
foreach ($suggest['data']['list'] as $val) {
$one = array();
$one['hasImage'] = $val['has_image'];
$one['imgUrl'] = Helpers::getImageUrl($val['cover_image'], 640, 240);
$one['title'] = $val['filter_content'];
$one['content'] = $val['reply_content'];
$one['good'] = $val['is_reliable'];
$one['bad'] = !$val['is_reliable'];
$one['goodNum'] = $val['reliable'];
$one['badNum'] = $val['unreliable'];
$result[] = $one;
}
}
return $result;
... ...
... ... @@ -234,8 +234,8 @@ class NewsaleModel
* @param string|null $sort 品类ID查询参数
* @param integer|null $tab_id Tab的ID
* @param boolean $notab 时候返回顶部tab的数据,默认返回
* @param integer $limit 查询返回的最大限制数, 默认为50
* @param integer $page 分页第几页, 默认第1页
* @param integer $limit 查询返回的最大限制数
* @param integer $page 分页第几页
* @return array 处理之后的数据
*/
public static function selectTopData($gender, $sort, $tab_id, $notab, $limit, $page)
... ... @@ -245,12 +245,7 @@ class NewsaleModel
$data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page);
if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) {
$result = NewSaleProcess::newSaleData($data['data']);
unset($result['filter']);
if ($notab) {
unset($result['tabs']);
}
$result = NewSaleProcess::topData($data['data'], $notab, $limit, $page);
}
return $result;
... ...
... ... @@ -145,13 +145,20 @@ SHOE BQT KEN BLOCK',
'measurementMethod'=>array(
'title' => '测量方式',
'enTitle' =>'SIZE INFO',
'enTitle' =>'MEASUREMENT METHOD',
'detail'=>array(
'kind' =>'上衣' ,
'enKind'=>'TOPS',
'img' =>''
'sort' =>'上衣' ,
'enSort'=>'TOPS',
'img' =>'http://static.dev.yohobuy.com/img/product/tops.png',
'items'=>array(
'肩宽(两端肩线间的直线长度)',
'胸围(两端肩线间的直线长度)',
'肩宽(两端肩线间的直线长度)',
'肩宽(两端肩线间的直线长度)',
'肩宽(两端肩线间的直线长度)',
'肩宽(两端肩线间的直线长度)'
)
)
),
... ... @@ -162,32 +169,32 @@ SHOE BQT KEN BLOCK',
'detail' =>array(
'list'=>array(
array(
'name'=>'头像',
'firstModel'=>'',
'secondModel' =>''
'fieldName'=>' ',
'firstModel'=>'http://static.dev.yohobuy.com/img/product/avatar1.png',
'secondModel' =>'http://static.dev.yohobuy.com/img/product/avatar2.png'
),
array(
'name'=>'模特',
'fieldName'=>'模特',
'firstModel'=>'Oliver',
'secondModel' =>'Jvly'
),
array(
'name'=>'身高',
'fieldName'=>'身高',
'firstModel'=>'175',
'secondModel' =>'170'
),
array(
'name'=>'体重',
'fieldName'=>'体重',
'firstModel'=>'53',
'secondModel' =>'59'
),
array(
'name'=>'三围',
'fieldName'=>'三围',
'firstModel'=>'78/70/87',
'secondModel' =>'78/70/87'
),
array(
'name'=>'吊牌尺',
'fieldName'=>'吊牌尺',
'firstModel'=>'S',
'secondModel' =>'L'
)
... ... @@ -199,7 +206,8 @@ SHOE BQT KEN BLOCK',
'title' => '商品材质',
'enTitle' =>'MATERIALS',
'img' => 'http://static.dev.yohobuy.com/img/product/material.png',
'desc' =>'用各种洗涤剂,可手洗机洗,但不宜氯漂,宜阴干,避免曝晒,以免深色衣物褪色,在日光下晾晒时,将里面朝外。浸泡时间不能太长,避免褪色,深色与浅色衣服最好请分开洗涤,避免染色。'
'desc' =>'用各种洗涤剂,可手洗机洗,但不宜氯漂,宜阴干,避免曝晒,以免深色衣物褪色,在日光下晾晒时,将里面朝外。浸泡时间不能太长,避免褪色,深色与浅色衣服最好请分开洗涤,避免染色。',
'materialType'=>'http://static.dev.yohobuy.com/img/product/material-type.png'
),
'productDetail' =>array(
... ... @@ -207,7 +215,11 @@ SHOE BQT KEN BLOCK',
'enTitle' =>'DETAILS',
'desc' => 'Married to the MOB是由Leah McSweeney创立的女装品牌,一向标榜不羁、大胆的女性streetwear设计。喜欢恶搞的女生们,赶紧入手吧。',
'img' =>'http://static.dev.yohobuy.com/img/product/product.png'
)
),
'cartInfo' =>array(
'numInCart' => 3
)
);
... ...
... ... @@ -112,7 +112,6 @@ class NewsaleController extends AbstractAction
$gender = Helpers::getGenderByCookie();
$result = \Product\NewsaleModel::selectTopData($gender, $sort, $tab_id, $notab, $limit, $page);
}
if (empty($result)) {
echo ' ';
} else {
... ...