Authored by hf

do add guang search api docs

Showing 37 changed files with 796 additions and 364 deletions
@@ -943,7 +943,8 @@ @@ -943,7 +943,8 @@
943 { 943 {
944 name: '', 944 name: '',
945 active: true, 945 active: true,
946 - typeId: 1 946 + typeId: 1,
  947 + url: ''
947 }, 948 },
948 ... 949 ...
949 ] 950 ]
@@ -18,17 +18,18 @@ class Yohobuy @@ -18,17 +18,18 @@ class Yohobuy
18 { 18 {
19 19
20 // /* 正式环境 */ 20 // /* 正式环境 */
21 -// const API_URL = 'http://api2.open.yohobuy.com/';  
22 -// const API_URL2 = 'http://api.open.yohobuy.com/';  
23 -// const SERVICE_URL = 'http://service.api.yohobuy.com/';  
24 -// const YOHOBUY_URL = 'http://www.yohobuy.com/'; 21 + const API_URL = 'http://api2.open.yohobuy.com/';
  22 + const API_URL2 = 'http://api.open.yohobuy.com/';
  23 + const SERVICE_URL = 'http://service.api.yohobuy.com/';
  24 + const YOHOBUY_URL = 'http://www.yohobuy.com/';
25 25
26 /* 测试环境 */ 26 /* 测试环境 */
27 - const API_URL = 'http://test2.open.yohobuy.com/';  
28 - const SERVICE_URL = 'http://test.service.api.yohobuy.com/';  
29 - const YOHOBUY_URL = 'http://www.yohobuy.com/';  
30 - const API_URL_MYCENTER = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的个人中心接口URL  
31 - const API_URL_SHOPINGCART = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的购物车接口URL 27 + // const API_URL = 'http://test2.open.yohobuy.com/';
  28 + // const SERVICE_URL = 'http://test.service.api.yohobuy.com/';
  29 + // const YOHOBUY_URL = 'http://www.yohobuy.com/';
  30 + // const API_URL_MYCENTER = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的个人中心接口URL
  31 + // const API_URL_SHOPINGCART = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的购物车接口URL
  32 +
32 33
33 /** 34 /**
34 * 私钥列表 35 * 私钥列表
@@ -24,7 +24,7 @@ class OrderData @@ -24,7 +24,7 @@ class OrderData
24 * and open the template in the editor. 24 * and open the template in the editor.
25 */ 25 */
26 26
27 - public function getOrderData($type, $page, $limit, $gender, $yh_channel, $uid) { 27 + static function getOrderData($type, $page, $limit, $gender, $yh_channel, $uid) {
28 //构建必传参数 28 //构建必传参数
29 $param = Yohobuy::param(); 29 $param = Yohobuy::param();
30 $param['gender'] = $gender; 30 $param['gender'] = $gender;
@@ -36,7 +36,7 @@ class OrderData @@ -36,7 +36,7 @@ class OrderData
36 $param['yh_channel'] = $yh_channel; 36 $param['yh_channel'] = $yh_channel;
37 $param['client_secret'] = Sign::getSign($param); 37 $param['client_secret'] = Sign::getSign($param);
38 //调用接口获得数据 38 //调用接口获得数据
39 - return Yohobuy::get(Yohobuy::API_URL2, $param); 39 + return Yohobuy::get(Yohobuy::API_URL, $param);
40 } 40 }
41 41
42 /* 42 /*
@@ -45,7 +45,7 @@ class OrderData @@ -45,7 +45,7 @@ class OrderData
45 * and open the template in the editor. 45 * and open the template in the editor.
46 */ 46 */
47 47
48 - public function cancelOrderData($order_code, $uid, $gender, $yh_channel, $method) { 48 + static function cancelOrderData($order_code, $uid, $gender, $yh_channel, $method) {
49 $param = Yohobuy::param(); 49 $param = Yohobuy::param();
50 $param['order_code'] = $order_code; 50 $param['order_code'] = $order_code;
51 $param['uid'] = $uid; 51 $param['uid'] = $uid;
@@ -62,7 +62,7 @@ class OrderData @@ -62,7 +62,7 @@ class OrderData
62 * and open the template in the editor. 62 * and open the template in the editor.
63 */ 63 */
64 64
65 - public function deleteOrderData($order_code, $uid, $gender, $yh_channel, $method) { 65 + static function deleteOrderData($order_code, $uid, $gender, $yh_channel, $method) {
66 $param = Yohobuy::param(); 66 $param = Yohobuy::param();
67 $param['order_code'] = $order_code; 67 $param['order_code'] = $order_code;
68 $param['uid'] = $uid; 68 $param['uid'] = $uid;
@@ -74,4 +74,20 @@ class OrderData @@ -74,4 +74,20 @@ class OrderData
74 return Yohobuy::get(Yohobuy::API_URL, $param); 74 return Yohobuy::get(Yohobuy::API_URL, $param);
75 } 75 }
76 76
  77 + /*
  78 + * 支付订单
  79 + * To change this template file, choose Tools | Templates
  80 + * and open the template in the editor.
  81 + */
  82 +
  83 + static function getPaymentData($contentCode, $gender, $yh_channel) {
  84 + $param = Yohobuy::param();
  85 + $param['content_code'] = $contentCode;
  86 + $param['gender'] = $gender;
  87 + $param['yh_channel'] = $yh_channel;
  88 + $param['client_secret'] = Sign::getSign($param);
  89 + //print_r($param);
  90 + return Yohobuy::get(Yohobuy::SERVICE_URL . '/operations/api/v5/resource/get', $param);
  91 + }
  92 +
77 } 93 }
@@ -130,6 +130,24 @@ class UserData @@ -130,6 +130,24 @@ class UserData
130 } 130 }
131 131
132 /** 132 /**
  133 + * 取消收藏的商品数据
  134 + *
  135 + * @param int $uid 用户ID
  136 + * @param int $fav_id 要取消的收藏id
  137 + * @return array 接口返回的数据
  138 + */
  139 + public static function favoriteDelete($uid, $fav_id)
  140 + {
  141 + $param = Yohobuy::param();
  142 + $param['method'] = 'app.favorite.cancel';
  143 + $param['type'] = 'product';
  144 + $param['fav_id'] = $fav_id;
  145 + $param['client_secret'] = Sign::getSign($param);
  146 +
  147 + return Yohobuy::get(Yohobuy::API_URL, $param);
  148 + }
  149 +
  150 + /**
133 * YOHO币数据 151 * YOHO币数据
134 * 152 *
135 * @param int $uid 用户ID 153 * @param int $uid 用户ID
@@ -160,15 +178,24 @@ class UserData @@ -160,15 +178,24 @@ class UserData
160 */ 178 */
161 public static function couponData($uid, $status, $page = 1, $limit = 10) 179 public static function couponData($uid, $status, $page = 1, $limit = 10)
162 { 180 {
  181 + $urlList = array();
  182 +
163 $param = Yohobuy::param(); 183 $param = Yohobuy::param();
164 $param['method'] = 'app.coupons.li'; 184 $param['method'] = 'app.coupons.li';
165 $param['uid'] = $uid; 185 $param['uid'] = $uid;
166 - $param['status'] = $status; 186 + $param['status'] = 0;
167 $param['page'] = $page; 187 $param['page'] = $page;
168 $param['limit'] = $limit; 188 $param['limit'] = $limit;
  189 +
169 $param['client_secret'] = Sign::getSign($param); 190 $param['client_secret'] = Sign::getSign($param);
  191 + $urlList['unused'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
170 192
171 - return Yohobuy::get(Yohobuy::API_URL, $param); 193 + unset($param['client_secret']);
  194 + $param['status'] = 1;
  195 + $param['client_secret'] = Sign::getSign($param);
  196 + $urlList['used'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
  197 +
  198 + return Yohobuy::getMulti($urlList);
172 } 199 }
173 200
174 /** 201 /**
@@ -224,7 +251,7 @@ class UserData @@ -224,7 +251,7 @@ class UserData
224 $param['consignee'] = $consignee; 251 $param['consignee'] = $consignee;
225 $param['email'] = $email; 252 $param['email'] = $email;
226 253
227 - if ($id !== null) { // 修改 254 + if (!empty($id)) { // 修改
228 $param['id'] = $id; 255 $param['id'] = $id;
229 $param['method'] = 'app.address.update'; 256 $param['method'] = 'app.address.update';
230 } else { // 添加 257 } else { // 添加
@@ -258,6 +285,24 @@ class UserData @@ -258,6 +285,24 @@ class UserData
258 } 285 }
259 286
260 /** 287 /**
  288 + * 删除地址
  289 + *
  290 + * @param int $uid 用户ID
  291 + * @param int $id 地址唯一标识符id
  292 + * @return array 接口返回的数据
  293 + */
  294 + public static function deleteAddress($uid, $id)
  295 + {
  296 + $param = Yohobuy::param();
  297 + $param['id'] = $id;
  298 + $param['method'] = 'app.address.del';
  299 + $param['uid'] = $uid;
  300 + $param['client_secret'] = Sign::getSign($param);
  301 +
  302 + return Yohobuy::get(Yohobuy::API_URL, $param);
  303 + }
  304 +
  305 + /**
261 * 意见反馈数据 306 * 意见反馈数据
262 * 307 *
263 * @param string $udid 客户端唯一标识 308 * @param string $udid 客户端唯一标识
@@ -106,6 +106,93 @@ class Images @@ -106,6 +106,93 @@ class Images
106 return $domain; 106 return $domain;
107 } 107 }
108 108
  109 +
  110 + /**
  111 + * 图片上传
  112 + * @param string $name 文件表单name, 即用于$_FILES[$name]
  113 + */
  114 + public static function saveImage($name)
  115 + {
  116 + if (empty($_FILES[$name]))
  117 + {
  118 + return array();
  119 + }
  120 + $files = $_FILES[$name];
  121 + $images = array();
  122 + if (is_array($files['tmp_name']))
  123 + {
  124 + foreach ($files['tmp_name'] as $k => $tmp_name)
  125 + {
  126 + if(!empty($tmp_name))
  127 + {
  128 + $images[$files['name'][$k]] = $tmp_name;
  129 + }
  130 + }
  131 + }
  132 + else
  133 + {
  134 + $images[$files['name']] = $files['tmp_name'];
  135 + }
  136 +
  137 + return self::uploadStreamImage($images);
  138 + }
  139 +
  140 + /**
  141 + * 上传图片[图片上传域名限制于http://test.service.api.yohobuy.com]
  142 + *
  143 + * @param string | array(filename => absolute file path) $file
  144 + * url:http://upload.static.yohobuy.com?project=sns&fileData=xxx
  145 + * @return mixed
  146 + */
  147 + public static function uploadStreamImage($file)
  148 + {
  149 + $end ="\r\n";
  150 + $twoHyphens ="--";
  151 + $boundary = "*****";
  152 + $stream = '';
  153 + $files = is_array($file) ? $file : array($file);
  154 + foreach($files as $name => $filename)
  155 + {
  156 + if(!file_exists($filename))
  157 + {
  158 + continue;
  159 + }
  160 + $name = is_numeric($name) ? name.'.jpg' : $name;
  161 + $stream .= $twoHyphens.$boundary.$end;
  162 + $stream .="Content-Disposition: form-data; "."name=\"fileData\";filename=\"".$name ."\"".$end; // form file element name :fileData
  163 + $stream .= $end;
  164 + $stream .= file_get_contents($filename);
  165 + $stream .= $end;
  166 + }
  167 + if(empty($stream))
  168 + {
  169 + return false;
  170 + }
  171 + $stream .= $twoHyphens.$boundary.$end;
  172 + $stream .="Content-Disposition: form-data; "."name=\"project\"".$end;
  173 + $stream .= $end;
  174 + $stream .= "sns";//project sns
  175 + $stream .= $end;
  176 + $stream .= $twoHyphens .$boundary .$twoHyphens .$end;
  177 + $opts = array(
  178 + 'http' => array(
  179 + 'method' => 'POST',
  180 + 'header' => 'content-type:multipart/form-data;boundary='.$boundary,
  181 + 'content' => $stream
  182 + )
  183 + );
  184 + $context = stream_context_create($opts);
  185 + $result = json_decode(file_get_contents('http://upload.static.yohobuy.com', false, $context), true);
  186 + if(!empty($result['data']['imagesList']))
  187 + {
  188 + return count($file) == 1 || !is_array($file) ? current($result['data']['imagesList']) : $result['data']['imagesList'] ;
  189 + }
  190 + else
  191 + {
  192 + return false;
  193 + }
  194 + }
  195 +
109 /** 196 /**
110 * 获取模板的图片地址 197 * 获取模板的图片地址
111 * @param $fileName 198 * @param $fileName
@@ -5,16 +5,16 @@ @@ -5,16 +5,16 @@
5 */ 5 */
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 - Hammer = require('yoho.hammer'),  
9 - ellipsis = require('mlellipsis'),  
10 - lazyLoad = require('yoho.lazyload'); 8 + Hammer = require('yoho.hammer'),
  9 + ellipsis = require('mlellipsis'),
  10 + lazyLoad = require('yoho.lazyload');
11 11
12 var tip = require('../plugin/tip'); 12 var tip = require('../plugin/tip');
13 var loading = require('../plugin/loading'); 13 var loading = require('../plugin/loading');
14 14
15 var $loadMoreInfo = $('#load-more-info'); 15 var $loadMoreInfo = $('#load-more-info');
16 var $loading = $(''), 16 var $loading = $(''),
17 - $noMore = $(''); 17 + $noMore = $('');
18 18
19 var searching = false; 19 var searching = false;
20 20
@@ -34,8 +34,8 @@ function setLazyLoadAndMellipsis($infos) { @@ -34,8 +34,8 @@ function setLazyLoadAndMellipsis($infos) {
34 34
35 $infos.each(function() { 35 $infos.each(function() {
36 var $this = $(this), 36 var $this = $(this),
37 - $title = $this.find('.info-title'),  
38 - $text = $this.find('.info-text'); 37 + $title = $this.find('.info-title'),
  38 + $text = $this.find('.info-text');
39 39
40 $title[0].mlellipsis(2); 40 $title[0].mlellipsis(2);
41 $text[0].mlellipsis(2); 41 $text[0].mlellipsis(2);
@@ -55,16 +55,19 @@ function initInfosEvt($container) { @@ -55,16 +55,19 @@ function initInfosEvt($container) {
55 55
56 cHammer = new Hammer($container[0]); 56 cHammer = new Hammer($container[0]);
57 57
  58 + //点赞或者收藏事件
58 cHammer.on('tap', function(e) { 59 cHammer.on('tap', function(e) {
59 var $this = $(e.target), 60 var $this = $(e.target),
60 - opt = 'ok',  
61 - $likeBtn,  
62 - $collectBtn,  
63 - $info;  
64 -  
65 - $likeBtn = $this.closest('.like-btn');  
66 - if ($likeBtn.length > 0) {  
67 - if ($likeBtn.hasClass('like')) { 61 + opt = 'ok',
  62 + $btn,
  63 + $info;
  64 +
  65 + e.preventDefault();
  66 +
  67 + //点赞
  68 + $btn = $this.closest('.like-btn');
  69 + if ($btn.length > 0) {
  70 + if ($btn.hasClass('like')) {
68 opt = 'cancel'; 71 opt = 'cancel';
69 } 72 }
70 73
@@ -80,22 +83,23 @@ function initInfosEvt($container) { @@ -80,22 +83,23 @@ function initInfosEvt($container) {
80 var code = data.code; 83 var code = data.code;
81 84
82 if (code === 200) { 85 if (code === 200) {
83 - $likeBtn.next('.like-count').text(data.data); 86 + $btn.next('.like-count').text(data.data);
84 87
85 //切换点赞状态 88 //切换点赞状态
86 - $likeBtn.toggleClass('like'); 89 + $btn.toggleClass('like');
87 } 90 }
88 }, 91 },
89 error: function() { 92 error: function() {
90 tip.show('网络断开连接了~'); 93 tip.show('网络断开连接了~');
91 } 94 }
92 }); 95 });
  96 + return;
93 } 97 }
94 98
95 - // 2015/11/03 hf: 增加APP里的收藏资讯功能. 写得不对的地方还请大神修改!  
96 - $collectBtn = $this.closest('.collect-btn');  
97 - if ($collectBtn.length > 0) {  
98 - if ($collectBtn.hasClass('collected')) { 99 + //APP收藏
  100 + $btn = $this.closest('.collect-btn');
  101 + if ($btn.length > 0) {
  102 + if ($btn.hasClass('collected')) {
99 opt = 'cancel'; 103 opt = 'cancel';
100 } 104 }
101 105
@@ -111,7 +115,7 @@ function initInfosEvt($container) { @@ -111,7 +115,7 @@ function initInfosEvt($container) {
111 if (data.code && data.code === 200) { 115 if (data.code && data.code === 200) {
112 116
113 //切换收藏状态 117 //切换收藏状态
114 - $collectBtn.toggleClass('collected'); 118 + $btn.toggleClass('collected');
115 } 119 }
116 }, 120 },
117 error: function() { 121 error: function() {
  1 +/**
  2 + * 地址管理
  3 + * @author: bikai<kai.bi@yoho.cn>
  4 + * @date: 2015/11/17
  5 + */
  6 +
  7 +var $ = require('jquery'),
  8 + tip = require('../plugin/tip');
  9 +
  10 +var $action = $('.action'),
  11 + $addressForm = $('.edit-address'),
  12 + $submit = $('.submit'),
  13 + $addAddress = $('.add-address'),
  14 + $editAddressPage = $('.my-edit-address-page'),
  15 + $addressListPage = $('.my-address-list-page'),
  16 + $area = $('.area'),
  17 + $footer = $('#yoho-footer'),
  18 + isSubmiting,
  19 + newArea = [];
  20 +
  21 +function editAddress(data) {
  22 + data = data || {};
  23 + $addressForm.find('[name="id"]').val(data.id || '');
  24 + $addressForm.find('[name="consignee"]').val(data.consignee || '');
  25 + $addressForm.find('[name="mobile"]').val(data.mobile || '');
  26 + $addressForm.find('[name="area_code"]').val(data.areaCode || '');
  27 + $addressForm.find('[name="area"]').val(data.area || '');
  28 + $addressForm.find('[name="address"]').val(data.address || '');
  29 + $editAddressPage.show();
  30 +
  31 + // $addressForm.find('[name="address"]').blur();
  32 + // $addressForm.find('[name="consignee"]').focus();
  33 +}
  34 +
  35 +function deleteAddress(data) {
  36 +
  37 +}
  38 +
  39 +// 添加地址
  40 +$addAddress.on('touchend', function() {
  41 + editAddress();
  42 +});
  43 +
  44 +// 编辑或删除
  45 +$action.on('touchend', '.edit', function() {
  46 + editAddress($(this).data());
  47 +}).on('touchend', '.del', function() {
  48 + deleteAddress();
  49 +});
  50 +
  51 +$submit.on('touchend', function() {
  52 + $addressForm.submit();
  53 + return false;
  54 +});
  55 +
  56 +$addressForm.on('submit', function() {
  57 + if (isSubmiting) {
  58 + return false;
  59 + }
  60 + isSubmiting = true;
  61 + $.ajax({
  62 + method: 'POST',
  63 + url: '/home/saveaddress',
  64 + data: $(this).serialize()
  65 + }).then(function(res) {
  66 + if ($.type(res) !== 'object') {
  67 + res = {};
  68 + }
  69 + if (res.code !== 200) {
  70 + tip.show(res.message || '网络出了点问题~');
  71 + } else {
  72 + window.location.reload();
  73 + }
  74 + }).fail(function() {
  75 + tip.show('网络出了点问题~');
  76 + }).always(function() {
  77 + isSubmiting = false;
  78 + });
  79 + return false;
  80 +});
  81 +
  82 +// 省市区
  83 +$area.on('touchend', function() {
  84 + $footer.hide();
  85 + $addressListPage.show();
  86 +});
  87 +
  88 +$addressListPage.on('touchend', '.address', function() {
  89 + newArea.push($(this).children('.caption').text());
  90 + $(this).siblings().hide();
  91 + $(this).children('ul').show();
  92 + return false;
  93 +}).on('touchend', '.address-last', function() {
  94 +
  95 + // 填结果到 html
  96 + newArea.push($(this).children('.caption').text());
  97 + $('[name="area"]').val(newArea.join(' '));
  98 + $('[name="area_code"]').val($(this).data('id'));
  99 +
  100 + // 恢复默认的三级选择
  101 + $addressListPage.hide();
  102 + $addressListPage.find('ul').hide();
  103 + $addressListPage.children('ul').show().children('li').show();
  104 + $footer.show();
  105 + newArea = [];
  106 + return false;
  107 +});
  1 +/**
  2 + * 我的逛
  3 + * @author xuqi<qi.xu@yoho.cn>
  4 + * @date: 2015/11/17
  5 + */
  6 +
  7 +var $ = require('jquery');
  8 +
  9 +var $infoList = $('#info-list');
  10 +
  11 +var winH = $(window).height();
  12 +
  13 +var info = require('../guang/info'),
  14 + loadMore = info.loadMore;
  15 +
  16 +var setting = {
  17 + page: 2,
  18 + end: false
  19 +};
  20 +
  21 +info.initInfoEvt($infoList);
  22 +
  23 +$(window).scroll(function() {
  24 + if ($(window).scrollTop() + winH >= $(document).height() - 0.25 * $infoList.height()) {
  25 + loadMore($infoList, setting);
  26 + }
  27 +});
@@ -17,27 +17,32 @@ var winH = $(window).height(); @@ -17,27 +17,32 @@ var winH = $(window).height();
17 17
18 var activeType = $navLi.filter('.active').data('type'); //当前active的项的index 18 var activeType = $navLi.filter('.active').data('type'); //当前active的项的index
19 19
20 -var orderPage = {}; 20 +var order = {
  21 + page: 0,
  22 + end: false
  23 +};
21 24
22 var inAjax = false; 25 var inAjax = false;
23 26
24 var loading = require('../plugin/loading'); 27 var loading = require('../plugin/loading');
25 28
26 -var navHammer, orderHammer; 29 +var orderHammer;
27 30
28 //加载订单 31 //加载订单
29 -function getOrders() { 32 +function getOrders(option) {
30 var opt = { 33 var opt = {
31 type: activeType, 34 type: activeType,
32 - page: orderPage[activeType] ? (orderPage[activeType] + 1) : 1 35 + page: order.page + 1
33 }; 36 };
34 37
  38 + var show = option && option.showLoadingMask;
  39 +
35 if (inAjax) { 40 if (inAjax) {
36 return; 41 return;
37 } 42 }
38 43
39 inAjax = true; 44 inAjax = true;
40 - loading.showLoadingMask(); 45 + show && loading.showLoadingMask();
41 46
42 $.ajax({ 47 $.ajax({
43 type: 'GET', 48 type: 'GET',
@@ -46,23 +51,27 @@ function getOrders() { @@ -46,23 +51,27 @@ function getOrders() {
46 success: function(data) { 51 success: function(data) {
47 var num; 52 var num;
48 53
49 - if (data.code === 200) {  
50 - orderPage[opt.type] = opt.page; 54 + if (data !== ' ') {
  55 + order.page = opt.page;
51 56
52 if (opt.page === 1) { 57 if (opt.page === 1) {
53 - $curContainer.html(data.data); 58 + $curContainer.html(data);
54 lazyLoad($curContainer.find('.lazy')); 59 lazyLoad($curContainer.find('.lazy'));
55 } else { 60 } else {
56 num = $curContainer.children('.order').length; 61 num = $curContainer.children('.order').length;
57 - $curContainer.append(data.data); 62 + $curContainer.append(data);
58 63
59 //lazyload 64 //lazyload
60 - lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ') .lazy')); 65 + lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy'));
61 } 66 }
  67 +
  68 + window.rePosFooter(); //重新计算底部位置
  69 + } else {
  70 + order.end = true;
62 } 71 }
63 72
64 inAjax = false; 73 inAjax = false;
65 - loading.hideLoadingMask(); 74 + show && loading.hideLoadingMask();
66 } 75 }
67 }); 76 });
68 } 77 }
@@ -83,33 +92,6 @@ lazyLoad(); @@ -83,33 +92,6 @@ lazyLoad();
83 92
84 loading.init($('body')); //满屏loading 93 loading.init($('body')); //满屏loading
85 94
86 -//导航切换  
87 -navHammer = new Hammer(document.getElementById('order-nav'));  
88 -navHammer.on('tap', function(e) {  
89 - var $cur = $(e.target).closest('li'),  
90 - index;  
91 -  
92 - if ($cur.length === 0 || $cur.hasClass('active')) {  
93 - return;  
94 - }  
95 -  
96 - index = $cur.index();  
97 -  
98 - $navLi.filter('.active').removeClass('active');  
99 - $cur.addClass('active');  
100 -  
101 - $curContainer.addClass('hide');  
102 - $curContainer = $orderContainer.children(':eq(' + index + ')').removeClass('hide');  
103 -  
104 - activeType = $cur.data('type');  
105 -  
106 - if (orderPage[activeType]) {  
107 - return;  
108 - } else {  
109 - getOrders();  
110 - }  
111 -});  
112 -  
113 //点击订单区域跳转订单详情页 95 //点击订单区域跳转订单详情页
114 orderHammer = new Hammer(document.getElementById('order-container')); 96 orderHammer = new Hammer(document.getElementById('order-container'));
115 orderHammer.on('tap', function(e) { 97 orderHammer.on('tap', function(e) {
@@ -154,8 +136,8 @@ orderHammer.on('tap', function(e) { @@ -154,8 +136,8 @@ orderHammer.on('tap', function(e) {
154 success: function(data) { 136 success: function(data) {
155 if (data.code === 200) { 137 if (data.code === 200) {
156 138
157 - //取消订单  
158 - alert('order cancel'); 139 + //取消订单页面刷新
  140 + location.href = location.href;
159 } 141 }
160 } 142 }
161 }); 143 });
@@ -168,9 +150,13 @@ orderHammer.on('tap', function(e) { @@ -168,9 +150,13 @@ orderHammer.on('tap', function(e) {
168 }); 150 });
169 151
170 $(window).scroll(function() { 152 $(window).scroll(function() {
171 - if ($(window).scrollTop() + winH > 153 + if (order.end === false && $(window).scrollTop() + winH >
172 $(document).height() - 0.25 * $orderContainer.height()) { 154 $(document).height() - 0.25 * $orderContainer.height()) {
173 - getOrders(); 155 +
  156 + //下拉请求时不显示mask
  157 + getOrders({
  158 + noLoadingMask: true
  159 + });
174 } 160 }
175 }); 161 });
176 162
@@ -12,20 +12,16 @@ var $ = require('jquery'), @@ -12,20 +12,16 @@ var $ = require('jquery'),
12 require('./jquery.uploadifive'); 12 require('./jquery.uploadifive');
13 13
14 $('#upload-img').uploadifive({ 14 $('#upload-img').uploadifive({
15 - 'auto': false,  
16 - 'buttonClass': 'nav-btn',  
17 - 'formData': {  
18 -  
19 - },  
20 - 'fileType': 'image/*',  
21 - 'uploadScript': 'url',  
22 - 'fileObjName': 'imgName',  
23 - 'fileSizeLimit': 1024,  
24 - 'onAddQueueItem': function (file) { 15 + auto: true,
  16 + buttonClass: 'nav-btn',
  17 + fileType: 'image/*',
  18 + uploadScript: '/home/suggestimgUpload',
  19 + fileObjName: 'fileData',
  20 + fileSizeLimit: 1024,
  21 + onAddQueueItem: function (file) {
25 console.log(file); 22 console.log(file);
26 - alert(1);  
27 }, 23 },
28 - 'onQueueComplete': function (file) {  
29 - 24 + onQueueComplete: function (file) {
  25 + console.log(file);
30 } 26 }
31 }); 27 });
@@ -11,7 +11,8 @@ var page = 1, @@ -11,7 +11,8 @@ var page = 1,
11 navSwiper, 11 navSwiper,
12 notab = 0, 12 notab = 0,
13 sort = '', 13 sort = '',
14 - id = ''; 14 + id = '',
  15 + noResult = '<p class="no-result">未找到相关搜索结果</p>';
15 16
16 function hotrank(page, sort, tabId, notab) { 17 function hotrank(page, sort, tabId, notab) {
17 loading.showLoadingMask(); 18 loading.showLoadingMask();
@@ -28,7 +29,11 @@ function hotrank(page, sort, tabId, notab) { @@ -28,7 +29,11 @@ function hotrank(page, sort, tabId, notab) {
28 if (page === 1) { 29 if (page === 1) {
29 $('.rank-main').remove(); 30 $('.rank-main').remove();
30 } 31 }
31 - $('#hotRank').append(data); 32 + if (data === ' ') {
  33 + $('#hotRank').html(noResult);
  34 + } else {
  35 + $('#hotRank').append(data);
  36 + }
32 lazyLoad($('img.lazy')); 37 lazyLoad($('img.lazy'));
33 $('.rank-main ul li:gt(2)').find('.item-content i').removeClass('top'); 38 $('.rank-main ul li:gt(2)').find('.item-content i').removeClass('top');
34 winH = $(window).height(); 39 winH = $(window).height();
@@ -102,7 +102,7 @@ @@ -102,7 +102,7 @@
102 .my-edit-address-page { 102 .my-edit-address-page {
103 position: absolute; 103 position: absolute;
104 bottom: 0; 104 bottom: 0;
105 - top: pxToRem(90px); 105 + top: 0;
106 width: 100%; 106 width: 100%;
107 color: #d0d0d0; 107 color: #d0d0d0;
108 background: #f0f0f0; 108 background: #f0f0f0;
@@ -142,8 +142,8 @@ @@ -142,8 +142,8 @@
142 input, textarea { 142 input, textarea {
143 position: absolute; 143 position: absolute;
144 top: 0; 144 top: 0;
145 - right: 0;  
146 - width: pxToRem(400px); 145 + right: pxToRem(40px);
  146 + width: pxToRem(360px);
147 height: pxToRem(88px); 147 height: pxToRem(88px);
148 color: #444; 148 color: #444;
149 padding: 0; 149 padding: 0;
@@ -156,8 +156,10 @@ @@ -156,8 +156,10 @@
156 } 156 }
157 157
158 textarea { 158 textarea {
  159 + right: 0;
  160 + width: pxToRem(400px);
159 height: pxToRem(58px) * 2; 161 height: pxToRem(58px) * 2;
160 - padding: pxToRem(20px) pxToRem(10px); 162 + padding: pxToRem(20px) 0;
161 } 163 }
162 } 164 }
163 165
@@ -171,4 +173,32 @@ @@ -171,4 +173,32 @@
171 font-size: pxToRem(32px); 173 font-size: pxToRem(32px);
172 line-height: pxToRem(88px); 174 line-height: pxToRem(88px);
173 } 175 }
174 -}  
  176 +}
  177 +
  178 +.my-address-list-page {
  179 + position: absolute;
  180 + bottom: 0;
  181 + top: 0;
  182 + width: 100%;
  183 + color: #444;
  184 + background: #fff;
  185 +
  186 + li {
  187 + padding: 0 pxToRem(30px);
  188 + font-size: pxToRem(32px);
  189 + line-height: pxToRem(88px);
  190 + border-bottom: 1px solid #e0e0e0;
  191 + .iconfont {
  192 + float: right;
  193 + color: #d0d0d0;
  194 + }
  195 + ul {
  196 + display: none;
  197 + position: absolute;
  198 + top: 0;
  199 + left: 0;
  200 + background: #fff;
  201 + width: 100%;
  202 + }
  203 + }
  204 +}
@@ -45,9 +45,8 @@ @@ -45,9 +45,8 @@
45 p{ 45 p{
46 width: 55.517241%; 46 width: 55.517241%;
47 height: auto; 47 height: auto;
48 - padding: 0 5% 10em / $pxConvertRem;; 48 + padding: 0 5% 18em / $pxConvertRem;;
49 float: left; 49 float: left;
50 - font-size: 44em / $pxConvertRem;  
51 &:first-of-type{ 50 &:first-of-type{
52 padding-top:30em / $pxConvertRem; 51 padding-top:30em / $pxConvertRem;
53 font-size: 60em / $pxConvertRem; 52 font-size: 60em / $pxConvertRem;
@@ -184,9 +184,12 @@ $fav: sprite-map("me/fav/*.png",$spacing: 5px); @@ -184,9 +184,12 @@ $fav: sprite-map("me/fav/*.png",$spacing: 5px);
184 .fav-brand-swiper { 184 .fav-brand-swiper {
185 185
186 .swiper-header { 186 .swiper-header {
187 - height: pxToRem(60px); 187 + height: pxToRem(100px);
188 padding: pxToRem(20px) pxToRem(30px); 188 padding: pxToRem(20px) pxToRem(30px);
189 display: inline-block; 189 display: inline-block;
  190 + position: relative;
  191 + width: 100%;
  192 + @include box-sizing();
190 193
191 .swiper-logo { 194 .swiper-logo {
192 height: 100%; 195 height: 100%;
@@ -229,6 +232,19 @@ $fav: sprite-map("me/fav/*.png",$spacing: 5px); @@ -229,6 +232,19 @@ $fav: sprite-map("me/fav/*.png",$spacing: 5px);
229 } 232 }
230 } 233 }
231 } 234 }
  235 + .fav-more {
  236 + $width: pxToRem(image_width(sprite-file($fav, fav-more)));
  237 + $height: pxToRem(image_height(sprite-file($fav, fav-more)));
  238 +
  239 + @include rem-sprite($fav, fav-more);
  240 + width: $width;
  241 + height: $height;
  242 +
  243 + position: absolute;
  244 + top: 50%;
  245 + right: pxToRem(30px);
  246 + margin-top: -$height / 2;
  247 + }
232 } 248 }
233 .swiper-container { 249 .swiper-container {
234 height: pxToRem(300px); 250 height: pxToRem(300px);
@@ -5,19 +5,20 @@ @@ -5,19 +5,20 @@
5 position: relative; 5 position: relative;
6 padding: 0 pxToRem(30px); 6 padding: 0 pxToRem(30px);
7 color: #fff; 7 color: #fff;
8 - background: #ccc;  
9 font-size: pxToRem(34px); 8 font-size: pxToRem(34px);
10 - line-height: pxToRem(164px);  
11 - height: pxToRem(164px); 9 + line-height: pxToRem(168px);
  10 + height: pxToRem(168px);
  11 + background: image-url("me/index/header-bg.jpg");
  12 + background-size: cover;
12 13
13 .user-avatar { 14 .user-avatar {
14 float: left; 15 float: left;
15 position: relative; 16 position: relative;
16 - top: pxToRem(8px);  
17 - width: pxToRem(132px);  
18 - height: pxToRem(132px); 17 + top: pxToRem(16px);
  18 + width: pxToRem(126px);
  19 + height: pxToRem(126px);
19 border-radius: 50%; 20 border-radius: 50%;
20 - border: pxToRem(8px) solid #a7a8a9; 21 + border: pxToRem(6px) solid #a7a8a9;
21 } 22 }
22 23
23 .username { 24 .username {
@@ -78,7 +79,7 @@ @@ -78,7 +79,7 @@
78 font-size: pxToRem(32px); 79 font-size: pxToRem(32px);
79 line-height: pxToRem(88px); 80 line-height: pxToRem(88px);
80 81
81 - span { 82 + a {
82 color: #e0e0e0; 83 color: #e0e0e0;
83 float: right; 84 float: right;
84 } 85 }
@@ -110,6 +111,7 @@ @@ -110,6 +111,7 @@
110 background: #fff; 111 background: #fff;
111 112
112 .list-item { 113 .list-item {
  114 + display: block;
113 position: relative; 115 position: relative;
114 padding: 0 pxToRem(30px); 116 padding: 0 pxToRem(30px);
115 font-size: pxToRem(32px); 117 font-size: pxToRem(32px);
@@ -106,7 +106,14 @@ @@ -106,7 +106,14 @@
106 border-bottom: 1px solid #e0e0e0; 106 border-bottom: 1px solid #e0e0e0;
107 background: #fff; 107 background: #fff;
108 108
109 - > li{ 109 + a {
  110 + display: block;
  111 + height: 100%;
  112 + width: 100%;
  113 + color: #b0b0b0;
  114 + }
  115 +
  116 + > li {
110 float: left; 117 float: left;
111 height: 90rem / $pxConvertRem; 118 height: 90rem / $pxConvertRem;
112 width: 25%; 119 width: 25%;
@@ -115,7 +122,7 @@ @@ -115,7 +122,7 @@
115 font-size: 26rem / $pxConvertRem; 122 font-size: 26rem / $pxConvertRem;
116 text-align: center; 123 text-align: center;
117 124
118 - &.active { 125 + &.active a {
119 color: #000; 126 color: #000;
120 } 127 }
121 } 128 }
@@ -36,13 +36,14 @@ @@ -36,13 +36,14 @@
36 } 36 }
37 37
38 .price { 38 .price {
  39 + position: relative;
39 margin-top: pxToRem(20px); 40 margin-top: pxToRem(20px);
40 font-size: pxToRem(20px); 41 font-size: pxToRem(20px);
41 line-height: 1; 42 line-height: 1;
42 43
43 span { 44 span {
44 - // chrome 最小支持12px  
45 - transform: scale(0.875); 45 + // chrome 最小支持12px, 设计图是 10px ,用CSS3变换
  46 + @include transform(scale(0.875));
46 } 47 }
47 48
48 .sale-price { 49 .sale-price {
@@ -50,7 +51,9 @@ @@ -50,7 +51,9 @@
50 } 51 }
51 52
52 .old-price { 53 .old-price {
53 - float: right; 54 + position: absolute;
  55 + top: 0;
  56 + right: 0;
54 color: #ededed; 57 color: #ededed;
55 } 58 }
56 59
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <span class="tel">{{mobile}}</span> 6 <span class="tel">{{mobile}}</span>
7 <p class="address-info">{{area}} {{address}}</p> 7 <p class="address-info">{{area}} {{address}}</p>
8 <div class="action iconfont"> 8 <div class="action iconfont">
9 - <a href="/home/address/edit?id={{address_id}}" class="edit">&#xe61e;</a> 9 + <span class="edit" data-id="{{address_id}}" data-consignee="{{consignee}}" data-mobile="{{mobile}}" data-area-code="{{area_code}}" data-area="{{area}}" data-address="{{address}}">&#xe61e;</span>
10 <span class="del" data-id="{{address_id}}">&#xe621;</span> 10 <span class="del" data-id="{{address_id}}">&#xe621;</span>
11 </div> 11 </div>
12 </div> 12 </div>
@@ -30,5 +30,7 @@ @@ -30,5 +30,7 @@
30 </div> 30 </div>
31 </div> 31 </div>
32 </div> 32 </div>
  33 + {{> me/address/edit-address}}
  34 + {{> me/address/address-list}}
33 </div> 35 </div>
34 {{> layout/footer}} 36 {{> layout/footer}}
@@ -3,18 +3,25 @@ @@ -3,18 +3,25 @@
3 <span class="active">未使用</span> 3 <span class="active">未使用</span>
4 <span>已使用</span> 4 <span>已使用</span>
5 </div> 5 </div>
  6 +{{# couponsUrl}}
6 <div class="employ-list"> 7 <div class="employ-list">
  8 +
  9 +{{# unused}}
7 <div class="employ-main"> 10 <div class="employ-main">
8 <span>50</span> 11 <span>50</span>
9 <p>【summer sale】下装满¥399减¥50券</p> 12 <p>【summer sale】下装满¥399减¥50券</p>
10 <p>有效期:2014.07.28 - 2014.09.15</p> 13 <p>有效期:2014.07.28 - 2014.09.15</p>
11 </div> 14 </div>
  15 +{{/ unused}}
12 </div> 16 </div>
13 <div class="employ-list not none"> 17 <div class="employ-list not none">
  18 +{{# used}}
14 <div class="employ-main"> 19 <div class="employ-main">
15 - <span>60</span>  
16 - <p>【summer sale】下装满¥399减¥60券</p>  
17 - <p>有效期:2014.07.28 - 2014.09.15</p> 20 + <span>{{ money }}</span>
  21 + <p>{{ coupon_name }}</p>
  22 + <p>{{ couponValidity }}</p>
18 </div> 23 </div>
  24 +{{/ used}}
19 </div> 25 </div>
  26 +{{/ couponsUrl}}
20 {{> layout/footer}} 27 {{> layout/footer}}
@@ -66,7 +66,7 @@ @@ -66,7 +66,7 @@
66 {{/ discount}} 66 {{/ discount}}
67 </div> 67 </div>
68 </div> 68 </div>
69 - <a href="{{link}}"></a> 69 + <a class="fav-more" href="{{link}}"></a>
70 </div> 70 </div>
71 <div id="swiper-container-{{id}}" class="swiper-container" data-id="{{id}}"> 71 <div id="swiper-container-{{id}}" class="swiper-container" data-id="{{id}}">
72 <ul class="swiper-wrapper swiper-wrapper-{{id}}"> 72 <ul class="swiper-wrapper swiper-wrapper-{{id}}">
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="my-page yoho-page"> 2 <div class="my-page yoho-page">
3 <div class="my-header"> 3 <div class="my-header">
4 - <div class="user-info"> 4 + <div class="user-info"><!--/home/personaldetails-->
5 <img class="user-avatar" src="{{head_ico}}"> 5 <img class="user-avatar" src="{{head_ico}}">
6 <span class="username">{{profile_name}}</span> 6 <span class="username">{{profile_name}}</span>
7 {{#vip_info}} 7 {{#vip_info}}
@@ -11,15 +11,15 @@ @@ -11,15 +11,15 @@
11 </div> 11 </div>
12 </div> 12 </div>
13 <div class="my-link clearfix"> 13 <div class="my-link clearfix">
14 - <a class="link-item" href="/home"> 14 + <a class="link-item" href="/home/favorite">
15 {{product_favorite_total}} 15 {{product_favorite_total}}
16 <p>收藏的商品</p> 16 <p>收藏的商品</p>
17 </a> 17 </a>
18 - <a class="link-item" href="/home"> 18 + <a class="link-item" href="/home/favoritebrand">
19 {{brand_favorite_total}} 19 {{brand_favorite_total}}
20 <p>收藏的品牌</p> 20 <p>收藏的品牌</p>
21 </a> 21 </a>
22 - <a class="link-item" href="/home"> 22 + <a class="link-item" href="/home/">
23 {{product_browse}} 23 {{product_browse}}
24 <p>浏览记录</p> 24 <p>浏览记录</p>
25 </a> 25 </a>
@@ -27,9 +27,9 @@ @@ -27,9 +27,9 @@
27 <div class="my-order"> 27 <div class="my-order">
28 <div class="order-title"> 28 <div class="order-title">
29 我的订单 29 我的订单
30 - <span class="iconfont"> 30 + <a class="iconfont" href="/home/order">
31 查看全部订单 &#xe604; 31 查看全部订单 &#xe604;
32 - </span> 32 + </a>
33 </div> 33 </div>
34 <div class="order-type clearfix"> 34 <div class="order-type clearfix">
35 <a class="type-item" href="/home/order"> 35 <a class="type-item" href="/home/order">
@@ -47,44 +47,44 @@ @@ -47,44 +47,44 @@
47 </div> 47 </div>
48 </div> 48 </div>
49 <div class="group-list"> 49 <div class="group-list">
50 - <div class="list-item"> 50 + <a class="list-item" href="/home/address">
51 <span class="iconfont icon">&#xe637;</span> 51 <span class="iconfont icon">&#xe637;</span>
52 地址管理 52 地址管理
53 - <span class="iconfont num">3 &#xe604;</span>  
54 - </div> 53 + <span class="iconfont num">{{address_num}} &#xe604;</span>
  54 + </a>
55 </div> 55 </div>
56 <div class="group-list"> 56 <div class="group-list">
57 - <div class="list-item"> 57 + <a class="list-item" href="/home/coupons">
58 <span class="iconfont icon">&#xe63a;</span> 58 <span class="iconfont icon">&#xe63a;</span>
59 优惠券 59 优惠券
60 <span class="iconfont num">{{coupon_num}} &#xe604;</span> 60 <span class="iconfont num">{{coupon_num}} &#xe604;</span>
61 - </div>  
62 - <div class="list-item"> 61 + </a>
  62 + <a class="list-item" href="/home/currency">
63 <span class="iconfont icon">&#xe635;</span> 63 <span class="iconfont icon">&#xe635;</span>
64 YOHO 64 YOHO
65 <span class="iconfont num">{{yoho_coin_num}} &#xe604;</span> 65 <span class="iconfont num">{{yoho_coin_num}} &#xe604;</span>
66 - </div> 66 + </a>
67 </div> 67 </div>
68 <div class="group-list"> 68 <div class="group-list">
69 - <div class="list-item"> 69 + <a class="list-item" href="/home/message">
70 <span class="iconfont icon">&#xe636;</span> 70 <span class="iconfont icon">&#xe636;</span>
71 消息 71 消息
72 <span class="iconfont num">{{inbox_total}} &#xe604;</span> 72 <span class="iconfont num">{{inbox_total}} &#xe604;</span>
73 - </div> 73 + </a>
74 </div> 74 </div>
75 <div class="group-list"> 75 <div class="group-list">
76 - <div class="list-item"> 76 + <a class="list-item" href="/home/onlineService">
77 <span class="iconfont icon">&#xe63c;</span> 77 <span class="iconfont icon">&#xe63c;</span>
78 在线客服 78 在线客服
79 <span class="iconfont num">&#xe604;</span> 79 <span class="iconfont num">&#xe604;</span>
80 - </div> 80 + </a>
81 </div> 81 </div>
82 <div class="group-list"> 82 <div class="group-list">
83 - <div class="list-item"> 83 + <a class="list-item" href="/home/">
84 <span class="iconfont icon">&#xe639;</span> 84 <span class="iconfont icon">&#xe639;</span>
85 帮助 85 帮助
86 <span class="iconfont num">&#xe604;</span> 86 <span class="iconfont num">&#xe604;</span>
87 - </div> 87 + </a>
88 </div> 88 </div>
89 89
90 {{> product/recommend-for-you}} 90 {{> product/recommend-for-you}}
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="my-guang-page yoho-page"> 2 <div class="my-guang-page yoho-page">
3 - <div class="info-list"> 3 + <div id="info-list" class="info-list">
4 {{# myGuang}} 4 {{# myGuang}}
5 {{> guang/info}} 5 {{> guang/info}}
6 {{/ myGuang}} 6 {{/ myGuang}}
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <ul id="order-nav" class="order-nav clearfix"> 4 <ul id="order-nav" class="order-nav clearfix">
5 {{#each navs}} 5 {{#each navs}}
6 <li {{#if active}}class="active"{{/if}} data-type="{{typeId}}"> 6 <li {{#if active}}class="active"{{/if}} data-type="{{typeId}}">
7 - {{name}} 7 + <a href="{{url}}">{{name}}</a>
8 </li> 8 </li>
9 {{/each}} 9 {{/each}}
10 </ul> 10 </ul>
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="yoho-suggest-sub-page yoho-page"> 2 <div class="yoho-suggest-sub-page yoho-page">
3 {{# suggestSub}} 3 {{# suggestSub}}
4 - <div class="suggest-sub-form"> 4 + <div class="suggest-sub-form"
  5 + data-version="{{param.app_version}}"
  6 + data-type="{{param.client_type}}"
  7 + data-os-version="{{param.os_version}}"
  8 + data-screen-size="{{param.screen_size}}"
  9 + data-v="{{param.v}}"
  10 + data-project="{{param.project}}"
  11 + data-client-secret="{{param.client_secret}}">
5 <textarea name="" id="suggest-textarea" placeholder="请输入意见反馈,我们会以消息形式回复您的建议或意见,改进产品体验,谢谢!"></textarea> 12 <textarea name="" id="suggest-textarea" placeholder="请输入意见反馈,我们会以消息形式回复您的建议或意见,改进产品体验,谢谢!"></textarea>
6 <div class="img-form"> 13 <div class="img-form">
7 <span class="img-add"> 14 <span class="img-add">
@@ -237,4 +237,14 @@ @@ -237,4 +237,14 @@
237 <script> 237 <script>
238 seajs.use('js/me/online-service'); 238 seajs.use('js/me/online-service');
239 </script> 239 </script>
  240 +{{/if}}
  241 +{{#if addressPage}}
  242 +<script>
  243 + seajs.use('js/me/address');
  244 +</script>
  245 +{{/if}}
  246 +{{#if myGuangPage}}
  247 +<script>
  248 + seajs.use('js/me/my-guang');
  249 +</script>
240 {{/if}} 250 {{/if}}
  1 +<div class="my-address-list-page hide">
  2 + <ul class="address-list">
  3 + {{# addressList}}
  4 + <li class="address">
  5 + <span class="caption">{{caption}}</span>
  6 + <span class="iconfont">&#xe604;</span>
  7 + <ul>
  8 + {{# sub}}
  9 + <li class="address">
  10 + <span class="caption">{{caption}}</span>
  11 + <span class="iconfont">&#xe604;</span>
  12 + <ul class="address-list">
  13 + {{# sub}}
  14 + <li class="address-last" data-id="{{code}}">
  15 + <span class="caption">{{caption}}</span>
  16 + </li>
  17 + {{/ sub}}
  18 + </ul>
  19 + </li>
  20 + {{/ sub}}
  21 + </ul>
  22 + </li>
  23 + {{/ addressList}}
  24 + </ul>
  25 +</div>
1 -{{> layout/header}}  
2 -<div class="my-edit-address-page yoho-page"> 1 +<div class="my-edit-address-page hide">
3 <form class="edit-address"> 2 <form class="edit-address">
  3 + <input type="hidden" name="id" value="">
4 <label class="username"> 4 <label class="username">
5 - 用户名  
6 - <input type="text" name="name" value="张三"> 5 + 收件人
  6 + <input type="text" name="consignee" value="">
7 </label> 7 </label>
8 <label class="mobile"> 8 <label class="mobile">
9 手机号码 9 手机号码
10 - <input type="text" name="mobile" value="18911110110"> 10 + <input type="text" name="mobile" value="">
11 </label> 11 </label>
12 <label class="area"> 12 <label class="area">
13 省市区 13 省市区
14 - <input type="text" name="area" value="江苏省南京市栖霞区"> 14 + <input type="hidden" name="area_code" value="">
  15 + <input type="text" name="area" value="" readonly>
15 <span class="iconfont">&#xe604;</span> 16 <span class="iconfont">&#xe604;</span>
16 </label> 17 </label>
17 <label class="address"> 18 <label class="address">
18 详细地址 19 详细地址
19 - <textarea name="address">东大街西大66号茶馆东大街西大66号茶馆东大街西大66号茶馆</textarea> 20 + <textarea name="address"></textarea>
20 </label> 21 </label>
21 22
22 </form> 23 </form>
@@ -24,5 +25,4 @@ @@ -24,5 +25,4 @@
24 <div class="submit"> 25 <div class="submit">
25 确认 26 确认
26 </div> 27 </div>
27 -</div>  
28 -{{> layout/footer}}  
  28 +</div>
@@ -7,8 +7,8 @@ @@ -7,8 +7,8 @@
7 <li class="swiper-slider"> 7 <li class="swiper-slider">
8 <img class="img-box" src="{{thumb}}"> 8 <img class="img-box" src="{{thumb}}">
9 <div class="price"> 9 <div class="price">
10 - <span class="sale-price"{{salePrice}}</span>  
11 - <span class="old-price"{{price}}</span> 10 + <span class="sale-price {{^price}}no-price{{/price}}"{{salePrice}}</span>
  11 + {{#price}}<span class="old-price"{{.}}</span>{{/price}}
12 </div> 12 </div>
13 </li> 13 </li>
14 {{/recommendList}} 14 {{/recommendList}}
1 <?php 1 <?php
2 2
3 use Action\AbstractAction; 3 use Action\AbstractAction;
  4 +use home\GradeModel;
  5 +use home\OrderModel;
4 use Plugin\Helpers; 6 use Plugin\Helpers;
5 use LibModels\Wap\Home\OrderData; 7 use LibModels\Wap\Home\OrderData;
6 8
@@ -11,11 +13,13 @@ use LibModels\Wap\Home\OrderData; @@ -11,11 +13,13 @@ use LibModels\Wap\Home\OrderData;
11 * @package 13 * @package
12 * @copyright yoho.inc 14 * @copyright yoho.inc
13 * @version 1.0 (2015-10-28 16:28:32) 15 * @version 1.0 (2015-10-28 16:28:32)
  16 + * @author fei.hong <fei.hong@yoho.cn>
14 */ 17 */
15 class HomeController extends AbstractAction 18 class HomeController extends AbstractAction
16 { 19 {
  20 +
17 protected $_uid; 21 protected $_uid;
18 - 22 +
19 // /** 23 // /**
20 // * 初始化 24 // * 初始化
21 // */ 25 // */
@@ -29,7 +33,7 @@ class HomeController extends AbstractAction @@ -29,7 +33,7 @@ class HomeController extends AbstractAction
29 // 33 //
30 // parent::init(); 34 // parent::init();
31 // } 35 // }
32 - 36 +
33 /** 37 /**
34 * 个人中心入口 38 * 个人中心入口
35 */ 39 */
@@ -37,7 +41,7 @@ class HomeController extends AbstractAction @@ -37,7 +41,7 @@ class HomeController extends AbstractAction
37 { 41 {
38 // 设置网站标题 42 // 设置网站标题
39 $this->setTitle('个人中心'); 43 $this->setTitle('个人中心');
40 - $this->setNavHeader('个人中心'); 44 + $this->setNavHeader('个人中心', true, SITE_MAIN);
41 45
42 // $uid = $this->getUid(); 46 // $uid = $this->getUid();
43 $uid = 8826435; 47 $uid = 8826435;
@@ -60,118 +64,48 @@ class HomeController extends AbstractAction @@ -60,118 +64,48 @@ class HomeController extends AbstractAction
60 */ 64 */
61 public function favoriteAction() 65 public function favoriteAction()
62 { 66 {
  67 + // 设置网站标题
  68 + $this->setTitle('我的收藏');
  69 + $this->setNavHeader('我的收藏', true, SITE_MAIN);
  70 +
63 $uid = $this->getUid(); 71 $uid = $this->getUid();
  72 + $uid = 8826435;
  73 + $gender = Helpers::getGenderByCookie();
64 74
65 $favProducts = \Index\UserModel::getFavProductData($uid); 75 $favProducts = \Index\UserModel::getFavProductData($uid);
66 -  
67 - //print_r($favProducts); 76 + $favBrands = \Index\UserModel::getFavBrandData($uid, $gender);
68 77
69 $this->_view->display('favorite', array( 78 $this->_view->display('favorite', array(
70 'favPage' => true, //加载js 79 'favPage' => true, //加载js
71 - 'pageHeader' => array(  
72 - 'navBack' => true,  
73 - 'navTitle' => '我的收藏',  
74 - 'navHome' => true  
75 - ),  
76 'pageFooter' => true, 80 'pageFooter' => true,
77 'favorite' => true, 81 'favorite' => true,
78 - 'hasFavProduct' => array(  
79 - '0' => array(  
80 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
81 - 'title' => 'adidas Originals ZX FLUXM22508 ',  
82 - 'price' => '¥800',  
83 - 'discountPrice' => false,  
84 - 'savePrice' => false,  
85 - 'sellOut' => true  
86 - ),  
87 - '1' => array(  
88 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
89 - 'title' => 'adidas Originals ZX FLUXM22508 ',  
90 - 'price' => '¥800',  
91 - 'discountPrice' => '¥500',  
92 - 'savePrice' => '¥300',  
93 - 'sellOut' => false  
94 - )  
95 - ),  
96 - 'hasFavBrand' => array(  
97 - '0' => array(  
98 - 'id' => '1',  
99 - 'brandImg' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
100 - 'brandName' => 'VANS',  
101 - 'update' => 12,  
102 - 'discount' => 10,  
103 - 'link' => '#',  
104 - 'productList' => array(  
105 - '0' => array(  
106 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
107 - 'price' => '¥240',  
108 - 'discount' => '¥240'  
109 - ),  
110 - '1' => array(  
111 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
112 - 'price' => '¥240',  
113 - 'discount' => '¥240'  
114 - ),  
115 - '2' => array(  
116 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
117 - 'price' => '¥240',  
118 - 'discount' => '¥240'  
119 - ),  
120 - '3' => array(  
121 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
122 - 'price' => '¥240',  
123 - 'discount' => '¥240'  
124 - )  
125 - )  
126 - ),  
127 - '1' => array(  
128 - 'id' => '2',  
129 - 'brandImg' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
130 - 'brandName' => 'VANS',  
131 - 'update' => 12,  
132 - 'discount' => 10,  
133 - 'link' => '#',  
134 - 'productList' => array(  
135 - '0' => array(  
136 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
137 - 'price' => '¥240',  
138 - 'discount' => '¥240'  
139 - ),  
140 - '1' => array(  
141 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
142 - 'price' => '¥240',  
143 - 'discount' => '¥240'  
144 - ),  
145 - '2' => array(  
146 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
147 - 'price' => '¥240',  
148 - 'discount' => '¥240'  
149 - ),  
150 - '3' => array(  
151 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
152 - 'price' => '¥240',  
153 - 'discount' => '¥240'  
154 - )  
155 - )  
156 - ),  
157 - '2' => array(  
158 - 'id' => '3',  
159 - 'brandImg' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
160 - 'brandName' => 'VANS',  
161 - 'update' => 12,  
162 - 'discount' => 10,  
163 - 'link' => '#',  
164 - 'productList' => array(  
165 - 'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
166 - 'price' => '¥240',  
167 - 'discount' => false  
168 - )  
169 - )  
170 - ) 82 + 'hasFavProduct' => $favProducts,
  83 + 'hasFavBrand' => $favBrands
171 )); 84 ));
172 } 85 }
173 86
174 /** 87 /**
  88 + * 用户收藏的商品-删除
  89 + */
  90 + public function favoriteDelAction()
  91 + {
  92 + $result = array();
  93 +
  94 + if ($this->isAjax()) {
  95 + $uid = $this->getUid();
  96 + $fav_id = $this->post('fav_id', 0);
  97 +
  98 + $result = \Index\UserModel::favoriteDelete($uid, $fav_id);
  99 + }
  100 +
  101 + if (empty($result)) {
  102 + echo ' ';
  103 + } else {
  104 + $this->echoJson($result);
  105 + }
  106 + }
  107 +
  108 + /**
175 * 用户收藏的品牌 109 * 用户收藏的品牌
176 */ 110 */
177 public function favoritebrandAction() 111 public function favoritebrandAction()
@@ -185,12 +119,12 @@ class HomeController extends AbstractAction @@ -185,12 +119,12 @@ class HomeController extends AbstractAction
185 } 119 }
186 120
187 /** 121 /**
188 - * 我的个人信息 122 + * 个人信息
189 */ 123 */
190 - public function mydetailsAction() 124 + public function personalDetailsAction()
191 { 125 {
192 $this->setTitle('个人信息'); 126 $this->setTitle('个人信息');
193 - $this->setNavHeader('个人信息'); 127 + $this->setNavHeader('个人信息', true, SITE_MAIN);
194 128
195 // $uid = $this->getUid(); 129 // $uid = $this->getUid();
196 $uid = 967016; 130 $uid = 967016;
@@ -205,9 +139,10 @@ class HomeController extends AbstractAction @@ -205,9 +139,10 @@ class HomeController extends AbstractAction
205 public function currencyAction() 139 public function currencyAction()
206 { 140 {
207 $this->setTitle('YOHO币'); 141 $this->setTitle('YOHO币');
208 - $this->setNavHeader('优惠券'); 142 + $this->setNavHeader('YOHO币', true, false);
209 143
210 - $uid = 967016; 144 + // $uid = $this->getUid();
  145 + $uid = 8826435;
211 $currency = \Index\UserModel::getYohoCoinData($uid); 146 $currency = \Index\UserModel::getYohoCoinData($uid);
212 147
213 $currency['pageFooter'] = true; 148 $currency['pageFooter'] = true;
@@ -221,7 +156,7 @@ class HomeController extends AbstractAction @@ -221,7 +156,7 @@ class HomeController extends AbstractAction
221 { 156 {
222 157
223 $this->setTitle('优惠券'); 158 $this->setTitle('优惠券');
224 - $this->setNavHeader('优惠券'); 159 + $this->setNavHeader('优惠券', true, SITE_MAIN);
225 // $uid = $this->getUid(); 160 // $uid = $this->getUid();
226 $uid = 8826435; 161 $uid = 8826435;
227 $status = $this->get('status', 0); 162 $status = $this->get('status', 0);
@@ -229,8 +164,6 @@ class HomeController extends AbstractAction @@ -229,8 +164,6 @@ class HomeController extends AbstractAction
229 'couponsUrl' => \Index\UserModel::getCouponData($uid, $status), 164 'couponsUrl' => \Index\UserModel::getCouponData($uid, $status),
230 'couponsPage' => true 165 'couponsPage' => true
231 ); 166 );
232 -  
233 - print_r($coupons);  
234 $this->_view->display('coupons', $coupons); 167 $this->_view->display('coupons', $coupons);
235 } 168 }
236 169
@@ -243,7 +176,7 @@ class HomeController extends AbstractAction @@ -243,7 +176,7 @@ class HomeController extends AbstractAction
243 $page = $this->get('page', 0); 176 $page = $this->get('page', 0);
244 $size = $this->get('size', 10); 177 $size = $this->get('size', 10);
245 178
246 - $uid = 967016; 179 + $uid = 8826435;
247 $messages = \Index\UserModel::getMessageData($uid, $page, $size); 180 $messages = \Index\UserModel::getMessageData($uid, $page, $size);
248 181
249 print_r($messages); 182 print_r($messages);
@@ -256,15 +189,15 @@ class HomeController extends AbstractAction @@ -256,15 +189,15 @@ class HomeController extends AbstractAction
256 { 189 {
257 // 设置网站标题 190 // 设置网站标题
258 $this->setTitle('地址管理'); 191 $this->setTitle('地址管理');
259 - $this->setNavHeader('地址管理'); 192 + $this->setNavHeader('地址管理', true, SITE_MAIN);
260 193
261 // $uid = $this->getUid(); 194 // $uid = $this->getUid();
262 - $uid = 967016; 195 + $uid = 8826435;
263 196
264 $address = \Index\UserModel::getAddressData($uid); 197 $address = \Index\UserModel::getAddressData($uid);
265 $addressList = \Index\UserModel::getAddressListData($uid); 198 $addressList = \Index\UserModel::getAddressListData($uid);
266 199
267 - // print_r($address); 200 + // print_r($addressList);
268 201
269 $this->_view->display('address', array( 202 $this->_view->display('address', array(
270 'addressPage' => true, 203 'addressPage' => true,
@@ -283,7 +216,7 @@ class HomeController extends AbstractAction @@ -283,7 +216,7 @@ class HomeController extends AbstractAction
283 216
284 if ($this->isAjax()) { 217 if ($this->isAjax()) {
285 // $uid = $this->getUid(); 218 // $uid = $this->getUid();
286 - $uid = 967016; 219 + $uid = 8826435;
287 $address = $this->post('address', ''); 220 $address = $this->post('address', '');
288 $area_code = $this->post('area_code', ''); 221 $area_code = $this->post('area_code', '');
289 $consignee = $this->post('consignee', ''); 222 $consignee = $this->post('consignee', '');
@@ -311,7 +244,7 @@ class HomeController extends AbstractAction @@ -311,7 +244,7 @@ class HomeController extends AbstractAction
311 244
312 if ($this->isAjax()) { 245 if ($this->isAjax()) {
313 // $uid = $this->getUid(); 246 // $uid = $this->getUid();
314 - $uid = 967016; 247 + $uid = 8826435;
315 $id = $this->post('id', ''); 248 $id = $this->post('id', '');
316 249
317 $result = \Index\UserModel::setDefaultAddress($uid, $id); 250 $result = \Index\UserModel::setDefaultAddress($uid, $id);
@@ -324,16 +257,38 @@ class HomeController extends AbstractAction @@ -324,16 +257,38 @@ class HomeController extends AbstractAction
324 } 257 }
325 } 258 }
326 259
  260 + /**
  261 + * 删除地址
  262 + */
  263 + public function addressDelAction()
  264 + {
  265 + $result = array();
  266 +
  267 + if ($this->isAjax()) {
  268 + // $uid = $this->getUid();
  269 + $uid = 8826435;
  270 + $id = $this->post('id', '');
  271 +
  272 + $result = \Index\UserModel::deleteAddress($uid, $id);
  273 + }
  274 +
  275 + if (empty($result)) {
  276 + echo ' ';
  277 + } else {
  278 + $this->echoJson($result);
  279 + }
  280 + }
  281 +
327 //在线客服 282 //在线客服
328 public function onlineServiceAction() 283 public function onlineServiceAction()
329 { 284 {
330 // 设置网站标题 285 // 设置网站标题
331 $this->setTitle('在线客服'); 286 $this->setTitle('在线客服');
332 - $this->setNavHeader('在线客服'); 287 + $this->setNavHeader('在线客服', true, SITE_MAIN);
333 288
334 - $service = \Home\OnlineModel::getOnlineServiceInfo(); 289 + $service = home\OnlineModel::getOnlineServiceInfo();
335 290
336 - $this->_view->display('online_service', array( 291 + $this->_view->display('online-service', array(
337 'onlineServicePage' => true, 292 'onlineServicePage' => true,
338 // 'pageFooter' => true, 293 // 'pageFooter' => true,
339 'service' => $service 294 'service' => $service
@@ -347,11 +302,11 @@ class HomeController extends AbstractAction @@ -347,11 +302,11 @@ class HomeController extends AbstractAction
347 $cateId = $this->get('cateId', 0); 302 $cateId = $this->get('cateId', 0);
348 $cateName = $this->get('cateName', ''); 303 $cateName = $this->get('cateName', '');
349 if ($cateId > 0) { 304 if ($cateId > 0) {
350 - $service = \Home\OnlineModel::getOnlineServiceDetail($cateId); 305 + $service = home\OnlineModel::getOnlineServiceDetail($cateId);
351 } 306 }
352 $this->setTitle('在线客服'); 307 $this->setTitle('在线客服');
353 $this->setNavHeader($cateName, true, ''); 308 $this->setNavHeader($cateName, true, '');
354 - $this->_view->display('online_service_detail', $service); 309 + $this->_view->display('online-service-detail', $service);
355 } 310 }
356 311
357 /** 312 /**
@@ -369,7 +324,7 @@ class HomeController extends AbstractAction @@ -369,7 +324,7 @@ class HomeController extends AbstractAction
369 { 324 {
370 // 设置网站标题 325 // 设置网站标题
371 $this->setTitle('意见反馈'); 326 $this->setTitle('意见反馈');
372 - $this->setNavHeader('意见反馈'); 327 + $this->setNavHeader('意见反馈', true, SITE_MAIN);
373 328
374 $udid = $this->getUdid(); 329 $udid = $this->getUdid();
375 $page = $this->get('page', 1); 330 $page = $this->get('page', 1);
@@ -377,56 +332,52 @@ class HomeController extends AbstractAction @@ -377,56 +332,52 @@ class HomeController extends AbstractAction
377 332
378 $suggest = \Index\UserModel::getSuggestData($udid, $page, $limit); 333 $suggest = \Index\UserModel::getSuggestData($udid, $page, $limit);
379 334
380 - print_r($suggest);  
381 $this->_view->display('suggest', array( 335 $this->_view->display('suggest', array(
382 'suggestPage' => true, //加载js 336 'suggestPage' => true, //加载js
383 'pageFooter' => true, 337 'pageFooter' => true,
384 'suggest' => true, 338 'suggest' => true,
385 - 'suggestContent' => array(  
386 - 0 => array(  
387 - 'imgUrl' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/12/06/0115bdfeb4a7dca4b4bfdf0e850f82f2a1.jpg?imageView/2/w/640/h/240',  
388 - 'title' => '为什么手机不能退换货?',  
389 - 'content' => 'YOHO!有货的退换货承诺:自您签收商品7日内可以退货,15日内可以换货,在商品吊牌、标签、包装完整,不影响二次销售的情况下,YOHO!有货将为您办理退换货服务。',  
390 - 'good' => true,  
391 - 'bad' => false),  
392 - 1 => array(  
393 - 'imgUrl' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/12/06/0115bdfeb4a7dca4b4bfdf0e850f82f2a1.jpg?imageView/2/w/640/h/240',  
394 - 'title' => '为什么手机不能退换货?',  
395 - 'content' => 'YOHO!有货的退换货承诺:自您签收商品7日内可以退货,15日内可以换货,在商品吊牌、标签、包装完整,不影响二次销售的情况下,YOHO!有货将为您办理退换货服务。',  
396 - 'good' => false,  
397 - 'bad' => true),  
398 - 2 => array(  
399 - 'imgUrl' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/12/06/0115bdfeb4a7dca4b4bfdf0e850f82f2a1.jpg?imageView/2/w/640/h/240',  
400 - 'title' => '为什么手机不能退换货?',  
401 - 'content' => 'YOHO!有货的退换货承诺:自您签收商品7日内可以退货,15日内可以换货,在商品吊牌、标签、包装完整,不影响二次销售的情况下,YOHO!有货将为您办理退换货服务。',  
402 - 'good' => false,  
403 - 'bad' => false)  
404 - ) 339 + 'suggestContent' => $suggest
405 )); 340 ));
406 } 341 }
407 342
408 /** 343 /**
409 - * 意见反馈-提交表单 344 + * 意见反馈-提交表单页面
410 */ 345 */
411 - public function suggest_subAction() 346 + public function suggestSubAction()
412 { 347 {
413 - $udid = $this->getUdid();  
414 - $page = $this->get('page', 1);  
415 - $limit = $this->get('limit', 30);  
416 348
417 - $suggest = \Index\UserModel::getSuggestData($udid, $page, $limit); 349 + // 设置网站标题
  350 + $this->setTitle('反馈问题');
418 351
419 - //print_r($suggest);  
420 - $this->_view->display('suggest_sub', array( 352 + $param = \Api\Yohobuy::param();
  353 + unset($param['private_key']);
  354 + $param['project'] = 'suggest';
  355 + $param['client_secret'] = 'e7807a9522ab99af8b8fd926e1ebbd9a';
  356 + $data = array(
421 'suggestPage' => true, //加载js 357 'suggestPage' => true, //加载js
422 'pageHeader' => array( 358 'pageHeader' => array(
423 'navBack' => true, 359 'navBack' => true,
424 'navTitle' => '反馈问题', 360 'navTitle' => '反馈问题',
425 'navBtn' => '提交' 361 'navBtn' => '提交'
426 ), 362 ),
  363 + 'param' => $param,
427 'suggestSub' => true, 364 'suggestSub' => true,
428 'pageFooter' => true 365 'pageFooter' => true
429 - )); 366 + );
  367 + //print_r($data);
  368 +
  369 + $this->_view->display('suggest_sub', $data);
  370 + }
  371 +
  372 + /**
  373 + * 异步上传图片
  374 + */
  375 + public function suggestimgUploadAction()
  376 + {
  377 + $filename = $this->post('filename', '');
  378 + $result = \Index\UserModel::saveSuggestImg($filename);
  379 +
  380 + $this->echoJson($result);
430 } 381 }
431 382
432 /** 383 /**
@@ -457,7 +408,7 @@ class HomeController extends AbstractAction @@ -457,7 +408,7 @@ class HomeController extends AbstractAction
457 $gender = Helpers::getGenderByCookie(); 408 $gender = Helpers::getGenderByCookie();
458 $channel = Helpers::getChannelByCookie(); 409 $channel = Helpers::getChannelByCookie();
459 $uid = $this->getUid(); 410 $uid = $this->getUid();
460 - $uid = '7566245'; //临时测试用 411 + $uid = '10267443'; //临时测试用
461 $data = GradeModel::getGrade($gender, $channel, $uid); 412 $data = GradeModel::getGrade($gender, $channel, $uid);
462 $data['pageFooter'] = true; 413 $data['pageFooter'] = true;
463 $this->_view->display('vip-grade', $data); 414 $this->_view->display('vip-grade', $data);
@@ -476,7 +427,7 @@ class HomeController extends AbstractAction @@ -476,7 +427,7 @@ class HomeController extends AbstractAction
476 427
477 $channel = Helpers::getChannelByCookie(); 428 $channel = Helpers::getChannelByCookie();
478 $uid = $this->getUid(); 429 $uid = $this->getUid();
479 - $data = \Home\GradeModel::getPreferential($channel, $uid); 430 + $data = GradeModel::getPreferential($channel, $uid);
480 $data['pageFooter'] = true; 431 $data['pageFooter'] = true;
481 $this->_view->display('privilege', $data); 432 $this->_view->display('privilege', $data);
482 } 433 }
@@ -494,19 +445,19 @@ class HomeController extends AbstractAction @@ -494,19 +445,19 @@ class HomeController extends AbstractAction
494 $data = OrderModel::getNavs($type); 445 $data = OrderModel::getNavs($type);
495 if (!empty($data)) { 446 if (!empty($data)) {
496 $order['navs'] = $data; 447 $order['navs'] = $data;
497 - $order['orderPage'] = true;  
498 } else { 448 } else {
499 $this->error(); 449 $this->error();
500 } 450 }
501 451
502 $this->_view->display('order', array( 452 $this->_view->display('order', array(
503 'order' => $order, 453 'order' => $order,
504 - 'pageFooter' => true 454 + 'pageFooter' => true,
  455 + 'orderPage' => true
505 )); 456 ));
506 } 457 }
507 458
508 //ajax请求订单页面 459 //ajax请求订单页面
509 - public function getOrderAction() 460 + public function getOrdersAction()
510 { 461 {
511 //判断是不是ajax请求 462 //判断是不是ajax请求
512 if (!$this->isAjax()) { 463 if (!$this->isAjax()) {
@@ -519,7 +470,7 @@ class HomeController extends AbstractAction @@ -519,7 +470,7 @@ class HomeController extends AbstractAction
519 $gender = Helpers::getGenderByCookie(); 470 $gender = Helpers::getGenderByCookie();
520 $yh_channel = $this->get('yh_channel', 1); 471 $yh_channel = $this->get('yh_channel', 1);
521 $uid = $this->getUid(); 472 $uid = $this->getUid();
522 - $uid = '7566245'; //测试用 473 + $uid = '10267443'; //测试用
523 //调用模型层getOrder方法获得并处理数据 474 //调用模型层getOrder方法获得并处理数据
524 $data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid); 475 $data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid);
525 //如果没有订单数据,就给一个随便逛逛链接 476 //如果没有订单数据,就给一个随便逛逛链接
@@ -527,7 +478,11 @@ class HomeController extends AbstractAction @@ -527,7 +478,11 @@ class HomeController extends AbstractAction
527 if (!empty($data)) { 478 if (!empty($data)) {
528 $order['orders'] = $data; 479 $order['orders'] = $data;
529 } else { 480 } else {
530 - $order['walkwayUrl'] = 'http://www.baidu.com'; 481 + if ($page > 1) {
  482 + echo " ";
  483 + } else {
  484 + $order['walkwayUrl'] = 'http://www.baidu.com';
  485 + }
531 } 486 }
532 //渲染模板 487 //渲染模板
533 $this->_view->display('order-content', $order); 488 $this->_view->display('order-content', $order);
@@ -552,32 +507,28 @@ class HomeController extends AbstractAction @@ -552,32 +507,28 @@ class HomeController extends AbstractAction
552 $yh_channel = $this->get('yh_channel', 1); 507 $yh_channel = $this->get('yh_channel', 1);
553 $method = 'app.SpaceOrders.close'; 508 $method = 'app.SpaceOrders.close';
554 $data = OrderData::cancelOrderData($order_code, $uid, $gender, $yh_channel, $method); 509 $data = OrderData::cancelOrderData($order_code, $uid, $gender, $yh_channel, $method);
555 - if ($data['code'] == 200) {  
556 - echo $data['message'];  
557 - } 510 + $this->echoJson($data);
558 } 511 }
559 512
560 /* 513 /*
561 * 我的订单-删除订单 514 * 我的订单-删除订单
562 */ 515 */
563 516
564 - public function deleteOrderAction() 517 + public function delOrderAction()
565 { 518 {
566 //判断是不是ajax请求 519 //判断是不是ajax请求
567 if (!$this->isAjax()) { 520 if (!$this->isAjax()) {
568 $this->error(); 521 $this->error();
569 } 522 }
570 //传入order_code和uid以删除订单 523 //传入order_code和uid以删除订单
571 - $order_code = $this->get('orderCode'); 524 + $order_code = $this->get('id');
572 $uid = $this->getUid(); 525 $uid = $this->getUid();
573 $uid = '10267443'; //测试用 526 $uid = '10267443'; //测试用
574 $gender = Helpers::getGenderByCookie(); 527 $gender = Helpers::getGenderByCookie();
575 $yh_channel = $this->get('yh_channel', 1); 528 $yh_channel = $this->get('yh_channel', 1);
576 $method = 'app.SpaceOrders.delOrderByCode'; 529 $method = 'app.SpaceOrders.delOrderByCode';
577 $data = OrderData::deleteOrderData($order_code, $uid, $gender, $yh_channel, $method); 530 $data = OrderData::deleteOrderData($order_code, $uid, $gender, $yh_channel, $method);
578 - if ($data['code'] == 200) {  
579 - echo $data['message'];  
580 - } 531 + $this->echoJson($data);
581 } 532 }
582 533
583 /** 534 /**
@@ -121,55 +121,61 @@ class OrderModel @@ -121,55 +121,61 @@ class OrderModel
121 } 121 }
122 return $arr; 122 return $arr;
123 } 123 }
124 - 124 +
125 //根据type值设置nav属性 125 //根据type值设置nav属性
126 - public function getNavs($type){ 126 + public function getNavs($type) {
127 $nav = array( 127 $nav = array(
128 array( 128 array(
129 'name' => '全部', 129 'name' => '全部',
130 - 'typeId' => '1' 130 + 'typeId' => '1',
  131 + 'url' => '/home/order?type=1'
131 ), 132 ),
132 array( 133 array(
133 'name' => '待付款', 134 'name' => '待付款',
134 - 'typeId' => '2' 135 + 'typeId' => '2',
  136 + 'url' => '/home/order?type=2'
135 ), 137 ),
136 array( 138 array(
137 'name' => '待发货', 139 'name' => '待发货',
138 - 'typeId' => '3' 140 + 'typeId' => '3',
  141 + 'url' => '/home/order?type=3'
139 ), 142 ),
140 array( 143 array(
141 'name' => '待收货', 144 'name' => '待收货',
142 - 'typeId' => '4' 145 + 'typeId' => '4',
  146 + 'url' => '/home/order?type=4'
143 ) 147 )
144 ); 148 );
145 - foreach($nav as $key => $vo){  
146 - switch ($type) {  
147 - case 1:  
148 - if($vo['typeId'] == 1){  
149 - $nav[$key]['active'] = true;  
150 - }  
151 - break;  
152 - case 2:  
153 - if($vo['typeId'] == 2){  
154 - $nav[$key]['active'] = true;  
155 - }  
156 - break;  
157 - case 3:  
158 - if($vo['typeId'] == 3){  
159 - $nav[$key]['active'] = true;  
160 - }  
161 - break;  
162 - case 4:  
163 - if($vo['typeId'] == 4){  
164 - $nav[$key]['active'] = true;  
165 - }  
166 - break;  
167 - default:  
168 - break;  
169 - } 149 + foreach ($nav as $key => $vo) {
  150 + switch ($type) {
  151 + case 1:
  152 + if ($vo['typeId'] == 1) {
  153 + $nav[$key]['active'] = true;
  154 + }
  155 + break;
  156 + case 2:
  157 + if ($vo['typeId'] == 2) {
  158 + $nav[$key]['active'] = true;
  159 + }
  160 + break;
  161 + case 3:
  162 + if ($vo['typeId'] == 3) {
  163 + $nav[$key]['active'] = true;
  164 + }
  165 + break;
  166 + case 4:
  167 + if ($vo['typeId'] == 4) {
  168 + $nav[$key]['active'] = true;
  169 + }
  170 + break;
  171 + default:
  172 + break;
  173 + }
170 } 174 }
171 return $nav; 175 return $nav;
172 -  
173 } 176 }
  177 +
  178 + //获得支付链接
  179 +
174 180
175 } 181 }
@@ -30,7 +30,7 @@ class UserModel @@ -30,7 +30,7 @@ class UserModel
30 // 调用接口获取个人详情 30 // 调用接口获取个人详情
31 $userData = UserData::userData($uid); 31 $userData = UserData::userData($uid);
32 32
33 - // 处理个人详情数 33 + // 处理个人详情数
34 if (isset($userData['data']) && !empty($userData['data'])) { 34 if (isset($userData['data']) && !empty($userData['data'])) {
35 $result = $userData['data']; 35 $result = $userData['data'];
36 $result['gender'] = $result['gender'] == 1 ? '男' : '女'; 36 $result['gender'] = $result['gender'] == 1 ? '男' : '女';
@@ -59,7 +59,11 @@ class UserModel @@ -59,7 +59,11 @@ class UserModel
59 foreach ($infoNumData['data'] as &$val) { 59 foreach ($infoNumData['data'] as &$val) {
60 empty($val) && $val = 0; 60 empty($val) && $val = 0;
61 } 61 }
  62 +
62 $result = $infoNumData['data']; 63 $result = $infoNumData['data'];
  64 +
  65 + // 默认没有返回用户地址的数据,添加这块儿数据
  66 + $result['address_num'] = count(self::getAddressData($uid));
63 } 67 }
64 68
65 return $result; 69 return $result;
@@ -150,7 +154,19 @@ class UserModel @@ -150,7 +154,19 @@ class UserModel
150 154
151 // 处理用户收藏的商品数据 155 // 处理用户收藏的商品数据
152 if (isset($favProduct['data']) && !empty($favProduct['data'])) { 156 if (isset($favProduct['data']) && !empty($favProduct['data'])) {
153 - $result = $favProduct['data']; 157 + $product = array();
  158 + foreach ($favProduct['data']['product_list'] as $val) {
  159 + $product = array();
  160 + $product['imgUrl'] = $val['image'];
  161 + $product['title'] = $val['product_name'];
  162 + $product['price'] = '¥'.$val['market_price'];
  163 + $product['discountPrice'] = '¥'.$val['sales_price'];
  164 + $product['savePrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥'.($val['market_price'] - $val['sales_price']) : false;
  165 + $product['sellOut'] = boolval($val['price_down']);
  166 +
  167 + $result[] = $product;
  168 + }
  169 +
154 } 170 }
155 171
156 return $result; 172 return $result;
@@ -172,7 +188,43 @@ class UserModel @@ -172,7 +188,43 @@ class UserModel
172 188
173 // 处理用户收藏的品牌数据 189 // 处理用户收藏的品牌数据
174 if (isset($favBrand['data']) && !empty($favBrand['data'])) { 190 if (isset($favBrand['data']) && !empty($favBrand['data'])) {
175 - $result = $favBrand['data']; 191 + $brand = array();
  192 + foreach ($favBrand['data']['brand_list'] as $val) {
  193 + $brand = array();
  194 + $brand['id'] = $val['brand_id'];
  195 + $brand['brandImg'] = Images::getImageUrl($val['brand_ico'], 235, 314);
  196 + $brand['brandName'] = $val['brand_name'];
  197 + $brand['update'] = $val['new_product_num'];
  198 + $brand['discount'] = $val['product_discount_num'];
  199 + $brand['link'] = '#';
  200 +
  201 + // 处理品牌产品
  202 + $product = array();
  203 + foreach ($val['new_product'] as $one) {
  204 + $product = array();
  205 + $product['imgUrl'] = Images::getImageUrl($one['default_images'], 235, 314);
  206 + $product['price'] = '¥'.$one['market_price'];
  207 + $product['discount'] = '¥'.$one['sales_price'];
  208 +
  209 + $brand['productList'][] = $product;
  210 + }
  211 +
  212 + $result[] = $brand;
  213 + }
  214 + }
  215 +
  216 + return $result;
  217 + }
  218 +
  219 + public static function favoriteDelete($uid, $fav_id)
  220 + {
  221 + $result = array();
  222 +
  223 + if (empty($fav_id)) {
  224 + $result['code'] = 400;
  225 + $result['message'] = '取消的商品不可用';
  226 + } else {
  227 + $result = UserData::favoriteDelete($uid, $fav_id);
176 } 228 }
177 229
178 return $result; 230 return $result;
@@ -213,8 +265,11 @@ class UserModel @@ -213,8 +265,11 @@ class UserModel
213 $coupons = UserData::couponData($uid, $status); 265 $coupons = UserData::couponData($uid, $status);
214 266
215 // 处理优惠券数据 267 // 处理优惠券数据
216 - if (isset($coupons['data']) && !empty($coupons['data'])) {  
217 - $result = $coupons['data']['info']; 268 + if (!empty($coupons['unused'])) {
  269 + $result['unused'] = $coupons['unused']['info'];
  270 + }
  271 + if (!empty($coupons['used'])) {
  272 + $result['used'] = $coupons['used']['info'];
218 } 273 }
219 274
220 return $result; 275 return $result;
@@ -333,6 +388,27 @@ class UserModel @@ -333,6 +388,27 @@ class UserModel
333 } 388 }
334 389
335 /** 390 /**
  391 + * 删除地址
  392 + *
  393 + * @param int $uid 用户ID
  394 + * @param int $id 地址唯一标识符id
  395 + * @return array|mixed 处理之后的返回数据
  396 + */
  397 + public static function deleteAddress($uid, $id)
  398 + {
  399 + $result = array('code' => 400, 'message' => '错误');
  400 +
  401 + // 调用接口删除地址
  402 + $address = UserData::deleteAddress($uid, $id);
  403 + // 处理返回结果
  404 + if ($address && isset($address['code'])) {
  405 + $result = $address;
  406 + }
  407 +
  408 + return $result;
  409 + }
  410 +
  411 + /**
336 * 处理意见反馈数据 412 * 处理意见反馈数据
337 * 413 *
338 * @param string $udid 客户端唯一标识 414 * @param string $udid 客户端唯一标识
@@ -353,14 +429,11 @@ class UserModel @@ -353,14 +429,11 @@ class UserModel
353 $one = array(); 429 $one = array();
354 foreach ($suggest['data']['list'] as $val) { 430 foreach ($suggest['data']['list'] as $val) {
355 $one = array(); 431 $one = array();
356 - $one['hasImage'] = $val['has_image'];  
357 $one['imgUrl'] = Helpers::getImageUrl($val['cover_image'], 640, 240); 432 $one['imgUrl'] = Helpers::getImageUrl($val['cover_image'], 640, 240);
358 $one['title'] = $val['filter_content']; 433 $one['title'] = $val['filter_content'];
359 $one['content'] = $val['reply_content']; 434 $one['content'] = $val['reply_content'];
360 - $one['good'] = $val['is_reliable'];  
361 - $one['bad'] = !$val['is_reliable'];  
362 - $one['goodNum'] = $val['reliable'];  
363 - $one['badNum'] = $val['unreliable']; 435 + $one['good'] = boolval($val['is_reliable']);
  436 + $one['bad'] = !$one['good'];
364 437
365 $result[] = $one; 438 $result[] = $one;
366 } 439 }
@@ -370,6 +443,25 @@ class UserModel @@ -370,6 +443,25 @@ class UserModel
370 } 443 }
371 444
372 /** 445 /**
  446 + * 图片上传
  447 + *
  448 + * @return array|mixed 保存意见反馈数据之后的返回
  449 + */
  450 + public static function saveSuggestImg($filename)
  451 + {
  452 + $result = array();
  453 +
  454 + if (!isset($_FILES[$filename])) {
  455 + $result['code'] = 400;
  456 + $result['message'] = '文件上传错误';
  457 + } else {
  458 + $result = Images::saveImage($filename);
  459 + }
  460 +
  461 + return $result;
  462 + }
  463 +
  464 + /**
373 * 保存意见反馈数据 465 * 保存意见反馈数据
374 * 466 *
375 * @param int $uid 用户ID 467 * @param int $uid 用户ID