Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
31 changed files
with
465 additions
and
167 deletions
@@ -29,7 +29,6 @@ class GuangData | @@ -29,7 +29,6 @@ class GuangData | ||
29 | $param['limit'] = $limit; | 29 | $param['limit'] = $limit; |
30 | $param['yh_channel'] = $yh_channel; | 30 | $param['yh_channel'] = $yh_channel; |
31 | $param['client_secret'] = Sign::getSign($param); | 31 | $param['client_secret'] = Sign::getSign($param); |
32 | -// return Yohobuy::post(Yohobuy::API_URL, $param); | ||
33 | return Yohobuy::post(Yohobuy::SERVICE_URL . self::GUANG_URI . 'getUserFavArticleList', $param); | 32 | return Yohobuy::post(Yohobuy::SERVICE_URL . self::GUANG_URI . 'getUserFavArticleList', $param); |
34 | } | 33 | } |
35 | 34 |
@@ -46,6 +46,7 @@ class OrderData | @@ -46,6 +46,7 @@ class OrderData | ||
46 | */ | 46 | */ |
47 | 47 | ||
48 | static function cancelOrderData($order_code, $uid, $gender, $yh_channel, $method) { | 48 | static function cancelOrderData($order_code, $uid, $gender, $yh_channel, $method) { |
49 | + //构建必传参数 | ||
49 | $param = Yohobuy::param(); | 50 | $param = Yohobuy::param(); |
50 | $param['order_code'] = $order_code; | 51 | $param['order_code'] = $order_code; |
51 | $param['uid'] = $uid; | 52 | $param['uid'] = $uid; |
@@ -53,6 +54,7 @@ class OrderData | @@ -53,6 +54,7 @@ class OrderData | ||
53 | $param['yh_channel'] = $yh_channel; | 54 | $param['yh_channel'] = $yh_channel; |
54 | $param['method'] = $method; | 55 | $param['method'] = $method; |
55 | $param['client_secret'] = Sign::getSign($param); | 56 | $param['client_secret'] = Sign::getSign($param); |
57 | + //调用接口获得数据 | ||
56 | return Yohobuy::get(Yohobuy::API_URL, $param); | 58 | return Yohobuy::get(Yohobuy::API_URL, $param); |
57 | } | 59 | } |
58 | 60 | ||
@@ -63,6 +65,7 @@ class OrderData | @@ -63,6 +65,7 @@ class OrderData | ||
63 | */ | 65 | */ |
64 | 66 | ||
65 | static function deleteOrderData($order_code, $uid, $gender, $yh_channel, $method) { | 67 | static function deleteOrderData($order_code, $uid, $gender, $yh_channel, $method) { |
68 | + //构建必传参数 | ||
66 | $param = Yohobuy::param(); | 69 | $param = Yohobuy::param(); |
67 | $param['order_code'] = $order_code; | 70 | $param['order_code'] = $order_code; |
68 | $param['uid'] = $uid; | 71 | $param['uid'] = $uid; |
@@ -70,23 +73,56 @@ class OrderData | @@ -70,23 +73,56 @@ class OrderData | ||
70 | $param['yh_channel'] = $yh_channel; | 73 | $param['yh_channel'] = $yh_channel; |
71 | $param['method'] = $method; | 74 | $param['method'] = $method; |
72 | $param['client_secret'] = Sign::getSign($param); | 75 | $param['client_secret'] = Sign::getSign($param); |
73 | - | 76 | + //调用接口删除订单 |
74 | return Yohobuy::get(Yohobuy::API_URL, $param); | 77 | return Yohobuy::get(Yohobuy::API_URL, $param); |
75 | } | 78 | } |
76 | 79 | ||
77 | /* | 80 | /* |
78 | - * 支付订单 | 81 | + * 我的订单-查看物流 |
79 | * To change this template file, choose Tools | Templates | 82 | * To change this template file, choose Tools | Templates |
80 | * and open the template in the editor. | 83 | * and open the template in the editor. |
81 | */ | 84 | */ |
82 | 85 | ||
83 | - static function getPaymentData($contentCode, $gender, $yh_channel) { | 86 | + static function LogisticsData() { |
87 | + //构建必传参数 | ||
88 | + $param = Yohobuy::param(); | ||
89 | + $param['method'] = 'app.express.li'; | ||
90 | + //$param['gender'] = $gender; | ||
91 | + //$param['yh_channel'] = $yh_channel; | ||
92 | + $param['client_secret'] = Sign::getSign($param); | ||
93 | + //调用接口获得数据 | ||
94 | + return Yohobuy::get('http://api.open.yohobuy.com/', $param); | ||
95 | + } | ||
96 | + | ||
97 | + /* | ||
98 | + * 支付url | ||
99 | + * To change this template file, choose Tools | Templates | ||
100 | + */ | ||
101 | + | ||
102 | + static function paymentData($gender, $yh_channel, $code) { | ||
103 | + //构建必传参数 | ||
84 | $param = Yohobuy::param(); | 104 | $param = Yohobuy::param(); |
85 | - $param['content_code'] = $contentCode; | 105 | + $param['content_code'] = $code; |
86 | $param['gender'] = $gender; | 106 | $param['gender'] = $gender; |
87 | $param['yh_channel'] = $yh_channel; | 107 | $param['yh_channel'] = $yh_channel; |
88 | $param['client_secret'] = Sign::getSign($param); | 108 | $param['client_secret'] = Sign::getSign($param); |
89 | - //print_r($param); | 109 | + //调用接口获得数据 |
110 | + return Yohobuy::get(Yohobuy::SERVICE_URL . '/operations/api/v5/resource/get', $param); | ||
111 | + } | ||
112 | + | ||
113 | + /* | ||
114 | + * 随便逛逛url | ||
115 | + * To change this template file, choose Tools | Templates | ||
116 | + */ | ||
117 | + | ||
118 | + static function strollData($gender, $yh_channel, $code) { | ||
119 | + //构建必传参数 | ||
120 | + $param = Yohobuy::param(); | ||
121 | + $param['content_code'] = $code; | ||
122 | + $param['gender'] = $gender; | ||
123 | + $param['yh_channel'] = $yh_channel; | ||
124 | + $param['client_secret'] = Sign::getSign($param); | ||
125 | + //调用接口获得数据 | ||
90 | return Yohobuy::get(Yohobuy::SERVICE_URL . '/operations/api/v5/resource/get', $param); | 126 | return Yohobuy::get(Yohobuy::SERVICE_URL . '/operations/api/v5/resource/get', $param); |
91 | } | 127 | } |
92 | 128 |
@@ -329,11 +329,12 @@ class UserData | @@ -329,11 +329,12 @@ class UserData | ||
329 | * @param int $suggest_type 意见类型 | 329 | * @param int $suggest_type 意见类型 |
330 | * @return array 意见反馈接口返回的数据 | 330 | * @return array 意见反馈接口返回的数据 |
331 | */ | 331 | */ |
332 | - public static function savesuggestData($uid, $content, $suggest_type, $limit = 30) | 332 | + public static function savesuggestData($uid, $content, $suggest_type) |
333 | { | 333 | { |
334 | $param = Yohobuy::param(); | 334 | $param = Yohobuy::param(); |
335 | $param['uid'] = $uid; | 335 | $param['uid'] = $uid; |
336 | $param['content'] = $content; | 336 | $param['content'] = $content; |
337 | + $param['suggest_type'] = $suggest_type; | ||
337 | $param['client_secret'] = Sign::getSign($param); | 338 | $param['client_secret'] = Sign::getSign($param); |
338 | 339 | ||
339 | return Yohobuy::get(Yohobuy::SERVICE_URL . 'suggest/api/v1/suggest/saveSuggest', $param); | 340 | return Yohobuy::get(Yohobuy::SERVICE_URL . 'suggest/api/v1/suggest/saveSuggest', $param); |
@@ -24,9 +24,6 @@ class Images | @@ -24,9 +24,6 @@ class Images | ||
24 | ), | 24 | ), |
25 | 'yhb-head' => 'head.static.yhbimg.com' | 25 | 'yhb-head' => 'head.static.yhbimg.com' |
26 | ); | 26 | ); |
27 | - private static $staticDomain = array( | ||
28 | - 'bucket' => '' | ||
29 | - ); | ||
30 | private static $qiniuDomain = 'yhfair.qiniudn.com'; | 27 | private static $qiniuDomain = 'yhfair.qiniudn.com'; |
31 | 28 | ||
32 | /** | 29 | /** |
@@ -171,7 +168,7 @@ class Images | @@ -171,7 +168,7 @@ class Images | ||
171 | $stream .= $twoHyphens.$boundary.$end; | 168 | $stream .= $twoHyphens.$boundary.$end; |
172 | $stream .="Content-Disposition: form-data; "."name=\"project\"".$end; | 169 | $stream .="Content-Disposition: form-data; "."name=\"project\"".$end; |
173 | $stream .= $end; | 170 | $stream .= $end; |
174 | - $stream .= "sns";//project sns | 171 | + $stream .= "suggest";//project sns |
175 | $stream .= $end; | 172 | $stream .= $end; |
176 | $stream .= $twoHyphens .$boundary .$twoHyphens .$end; | 173 | $stream .= $twoHyphens .$boundary .$twoHyphens .$end; |
177 | $opts = array( | 174 | $opts = array( |
@@ -185,7 +182,18 @@ class Images | @@ -185,7 +182,18 @@ class Images | ||
185 | $result = json_decode(file_get_contents('http://upload.static.yohobuy.com', false, $context), true); | 182 | $result = json_decode(file_get_contents('http://upload.static.yohobuy.com', false, $context), true); |
186 | if(!empty($result['data']['imagesList'])) | 183 | if(!empty($result['data']['imagesList'])) |
187 | { | 184 | { |
188 | - return count($file) == 1 || !is_array($file) ? current($result['data']['imagesList']) : $result['data']['imagesList'] ; | 185 | + if(count($file) == 1 || !is_array($file)) |
186 | + { | ||
187 | + return self::getSourceUrl(current($result['data']['imagesList']), 'suggest'); | ||
188 | + } | ||
189 | + else | ||
190 | + { | ||
191 | + foreach ($result['data']['imagesList'] as &$val) { | ||
192 | + $val = self::getSourceUrl($val, 'suggest'); | ||
193 | + } | ||
194 | + | ||
195 | + return $result['data']['imagesList']; | ||
196 | + } | ||
189 | } | 197 | } |
190 | else | 198 | else |
191 | { | 199 | { |
@@ -5,7 +5,8 @@ | @@ -5,7 +5,8 @@ | ||
5 | */ | 5 | */ |
6 | var $ = require('jquery'); | 6 | var $ = require('jquery'); |
7 | 7 | ||
8 | -var $footer = $('#yoho-footer'); | 8 | +var $footer = $('#yoho-footer'), |
9 | + $header = $('.yoho-header'); | ||
9 | 10 | ||
10 | function cookie(name) { | 11 | function cookie(name) { |
11 | var cookies = document.cookie, | 12 | var cookies = document.cookie, |
@@ -152,6 +153,13 @@ function rePosFooter() { | @@ -152,6 +153,13 @@ function rePosFooter() { | ||
152 | } | 153 | } |
153 | }()); | 154 | }()); |
154 | 155 | ||
156 | +$header.on('touchstart', 'a', function() { | ||
157 | + $header.find('a').removeClass('highlight'); | ||
158 | + $(this).addClass('highlight'); | ||
159 | +}).on('touchend touchcancel', 'a', function() { | ||
160 | + $(this).removeClass('highlight'); | ||
161 | +}); | ||
162 | + | ||
155 | 163 | ||
156 | //暴露公共接口 | 164 | //暴露公共接口 |
157 | window.cookie = cookie; | 165 | window.cookie = cookie; |
@@ -130,8 +130,11 @@ function initInfosEvt($container) { | @@ -130,8 +130,11 @@ function initInfosEvt($container) { | ||
130 | 130 | ||
131 | /** | 131 | /** |
132 | * 资讯LoadMore | 132 | * 资讯LoadMore |
133 | + * @param $container 资讯容器 jqyeryObject | ||
134 | + * @param opt 请求参数 | ||
135 | + * @param url[可选], 扩展请求的url而不使用默认值 | ||
133 | */ | 136 | */ |
134 | -function loadMore($container, opt) { | 137 | +function loadMore($container, opt, url) { |
135 | var num; | 138 | var num; |
136 | 139 | ||
137 | if (searching) { | 140 | if (searching) { |
@@ -152,7 +155,7 @@ function loadMore($container, opt) { | @@ -152,7 +155,7 @@ function loadMore($container, opt) { | ||
152 | searching = true; | 155 | searching = true; |
153 | $.ajax({ | 156 | $.ajax({ |
154 | type: 'GET', | 157 | type: 'GET', |
155 | - url: ' /guang/index/page', | 158 | + url: url ? url : '/guang/index/page',//对于指定url的使用指定url(存在不同的控制器) |
156 | data: opt, | 159 | data: opt, |
157 | success: function(data) { | 160 | success: function(data) { |
158 | var $newItems; | 161 | var $newItems; |
@@ -214,8 +214,13 @@ function tsAnimate() { | @@ -214,8 +214,13 @@ function tsAnimate() { | ||
214 | 214 | ||
215 | setTimeout(tsAnimate, 3000); | 215 | setTimeout(tsAnimate, 3000); |
216 | 216 | ||
217 | -// 底部留出tab 的高度 | 217 | +$('.home-header .search-btn').on('touchstart', function() { |
218 | + $(this).addClass('highlight'); | ||
219 | +}).on('touchend touchcancel', function() { | ||
220 | + $(this).removeClass('highlight'); | ||
221 | +}); | ||
218 | 222 | ||
223 | +// 底部留出tab 的高度 | ||
219 | $('#yoho-footer').css({ | 224 | $('#yoho-footer').css({ |
220 | 'margin-bottom': '2.5rem' | 225 | 'margin-bottom': '2.5rem' |
221 | }); | 226 | }); |
@@ -6,28 +6,22 @@ | @@ -6,28 +6,22 @@ | ||
6 | 6 | ||
7 | var $ = require('jquery'), | 7 | var $ = require('jquery'), |
8 | Hammer = require('yoho.hammer'), | 8 | Hammer = require('yoho.hammer'), |
9 | - lazyLoad = require('yoho.lazyload'), | ||
10 | Swiper = require('yoho.iswiper'); | 9 | Swiper = require('yoho.iswiper'); |
11 | 10 | ||
12 | -//导航 | ||
13 | var $navLi = $('#fav-tab > li'), | 11 | var $navLi = $('#fav-tab > li'), |
14 | - $favContainer = $('.fav-content'); | ||
15 | - | ||
16 | -var $curContainer = $favContainer.children('.fav-type').first();//保存当前显示的$favContainer | ||
17 | - | ||
18 | -var favTabHammer; | ||
19 | - | ||
20 | -//轮播图 | ||
21 | -var $swiperList = $('.swiper-container'), | ||
22 | - swiperArray = [], | ||
23 | - swiperObj = {}; | ||
24 | - | ||
25 | -//lazyLoad(); | 12 | + $favContainer = $('.fav-content'), |
13 | + $curContainer = $favContainer.children('.fav-type').first(), | ||
14 | + $swiperList = $('.swiper-container'), | ||
15 | + swiperObj = {}, | ||
16 | + favTabHammer, | ||
17 | + favContentHammer; | ||
26 | 18 | ||
27 | favTabHammer = new Hammer(document.getElementById('fav-tab')); | 19 | favTabHammer = new Hammer(document.getElementById('fav-tab')); |
28 | favTabHammer.on('tap', function(e) { | 20 | favTabHammer.on('tap', function(e) { |
29 | var $cur = $(e.target).closest('li'), | 21 | var $cur = $(e.target).closest('li'), |
30 | - index; | 22 | + index, |
23 | + id, | ||
24 | + i; | ||
31 | 25 | ||
32 | if ($cur.length === 0 || $cur.hasClass('active')) { | 26 | if ($cur.length === 0 || $cur.hasClass('active')) { |
33 | return; | 27 | return; |
@@ -42,9 +36,10 @@ favTabHammer.on('tap', function(e) { | @@ -42,9 +36,10 @@ favTabHammer.on('tap', function(e) { | ||
42 | $curContainer = $favContainer.children(':eq(' + index + ')').removeClass('hide'); | 36 | $curContainer = $favContainer.children(':eq(' + index + ')').removeClass('hide'); |
43 | 37 | ||
44 | if (index === 1) { | 38 | if (index === 1) { |
39 | + | ||
45 | //导航 | 40 | //导航 |
46 | - for (var i = 0; i < $swiperList.length; i++) { | ||
47 | - var id = $swiperList.eq(i).attr('data-id'); | 41 | + for (i = 0; i < $swiperList.length; i++) { |
42 | + id = $swiperList.eq(i).attr('data-id'); | ||
48 | swiperObj[id] = new Swiper('#swiper-container-' + id, { | 43 | swiperObj[id] = new Swiper('#swiper-container-' + id, { |
49 | slidesPerView: 'auto', | 44 | slidesPerView: 'auto', |
50 | grabCursor: true, | 45 | grabCursor: true, |
@@ -57,3 +52,31 @@ favTabHammer.on('tap', function(e) { | @@ -57,3 +52,31 @@ favTabHammer.on('tap', function(e) { | ||
57 | 52 | ||
58 | } | 53 | } |
59 | }); | 54 | }); |
55 | + | ||
56 | +//删除收藏的商品 | ||
57 | +favContentHammer = new Hammer(document.getElementById('fav-content')); | ||
58 | + | ||
59 | +favContentHammer.on('tap', function (e) { | ||
60 | + var id = ''; | ||
61 | + | ||
62 | + | ||
63 | + if ($(e.target).hasClass('del-fav')) { | ||
64 | + id = $(e.target).closest('li').attr('data-id'); | ||
65 | + $.ajax({ | ||
66 | + method: 'post', | ||
67 | + url: '/home/favoriteDel', | ||
68 | + data: { | ||
69 | + id: id | ||
70 | + } | ||
71 | + }).then(function (data) { | ||
72 | + | ||
73 | + | ||
74 | + if (data.code === 200) { | ||
75 | + $(e.target).closest('li').remove(); | ||
76 | + } | ||
77 | + }).fail(function () { | ||
78 | + | ||
79 | + //TODO | ||
80 | + }); | ||
81 | + } | ||
82 | +}); |
@@ -18,10 +18,13 @@ var setting = { | @@ -18,10 +18,13 @@ var setting = { | ||
18 | end: false | 18 | end: false |
19 | }; | 19 | }; |
20 | 20 | ||
21 | -info.initInfoEvt($infoList); | 21 | +//对于有逛收藏的页面进行事件处理 |
22 | +if ($infoList.length > 0) { | ||
23 | + info.initInfosEvt($infoList); | ||
22 | 24 | ||
23 | -$(window).scroll(function() { | 25 | + $(window).scroll(function() { |
24 | if ($(window).scrollTop() + winH >= $(document).height() - 0.25 * $infoList.height()) { | 26 | if ($(window).scrollTop() + winH >= $(document).height() - 0.25 * $infoList.height()) { |
25 | - loadMore($infoList, setting); | 27 | + loadMore($infoList, setting, '/home/myguang'); |
26 | } | 28 | } |
27 | -}); | ||
29 | + }); | ||
30 | +} |
@@ -7,21 +7,59 @@ | @@ -7,21 +7,59 @@ | ||
7 | 7 | ||
8 | var $ = require('jquery'), | 8 | var $ = require('jquery'), |
9 | Hammer = require('yoho.hammer'), | 9 | Hammer = require('yoho.hammer'), |
10 | - lazyLoad = require('yoho.lazyload'); | 10 | + Handlebars = require('yoho.handlebars'); |
11 | + | ||
12 | +var $uploadImgList = $('.upload-img-list'), | ||
13 | + headerNavHammer, | ||
14 | + imgTpl, | ||
15 | + template; | ||
11 | 16 | ||
12 | require('./jquery.uploadifive'); | 17 | require('./jquery.uploadifive'); |
13 | 18 | ||
14 | $('#upload-img').uploadifive({ | 19 | $('#upload-img').uploadifive({ |
15 | auto: true, | 20 | auto: true, |
16 | - buttonClass: 'nav-btn', | ||
17 | - fileType: 'image/*', | 21 | + fileType: 'image*/*', |
18 | uploadScript: '/home/suggestimgUpload', | 22 | uploadScript: '/home/suggestimgUpload', |
19 | fileObjName: 'fileData', | 23 | fileObjName: 'fileData', |
20 | fileSizeLimit: 1024, | 24 | fileSizeLimit: 1024, |
21 | - onAddQueueItem: function (file) { | ||
22 | - console.log(file); | 25 | + height: '100%', |
26 | + width: '100%', | ||
27 | + onAddQueueItem: function (files) { | ||
28 | + | ||
29 | + //TODO | ||
23 | }, | 30 | }, |
24 | - onQueueComplete: function (file) { | ||
25 | - console.log(file); | 31 | + onUploadComplete: function (file, data) { |
32 | + $uploadImgList.html(template(data)); | ||
33 | + } | ||
34 | +}); | ||
35 | + | ||
36 | + | ||
37 | +imgTpl = '{{# imgList}}' + | ||
38 | + '<li><img src="{{imgUrl}}" /></li>' + | ||
39 | + '{{/ imgList}}'; | ||
40 | + | ||
41 | +template = Handlebars.compile(imgTpl); | ||
42 | + | ||
43 | +headerNavHammer = new Hammer(document.getElementById('yoho-header')); | ||
44 | + | ||
45 | +headerNavHammer.on('tap', function (e) { | ||
46 | + var suggestText = $('#suggest-textarea').val(); | ||
47 | + | ||
48 | + | ||
49 | + if ($(e.target).hasClass('nav-btn')) { | ||
50 | + | ||
51 | + $.ajax({ | ||
52 | + method: 'post', | ||
53 | + url: '/home/savesuggest', | ||
54 | + data: { | ||
55 | + content: suggestText | ||
56 | + } | ||
57 | + }).then(function (data) { | ||
58 | + | ||
59 | + //TODO | ||
60 | + }).fail(function () { | ||
61 | + | ||
62 | + //TODO | ||
63 | + }); | ||
26 | } | 64 | } |
27 | }); | 65 | }); |
@@ -79,19 +79,4 @@ | @@ -79,19 +79,4 @@ | ||
79 | .info-list.hide { | 79 | .info-list.hide { |
80 | display: none; | 80 | display: none; |
81 | } | 81 | } |
82 | - | ||
83 | - .load-more-info { | ||
84 | - width: 100%; | ||
85 | - height: 70rem / $pxConvertRem; | ||
86 | - line-height: 70rem / $pxConvertRem; | ||
87 | - text-align: center; | ||
88 | - font-size: 14px; | ||
89 | - overflow: hidden; | ||
90 | - | ||
91 | - .status { | ||
92 | - &.hide { | ||
93 | - display: none; | ||
94 | - } | ||
95 | - } | ||
96 | - } | ||
97 | } | 82 | } |
@@ -63,11 +63,21 @@ | @@ -63,11 +63,21 @@ | ||
63 | 63 | ||
64 | .search-btn { | 64 | .search-btn { |
65 | position: absolute; | 65 | position: absolute; |
66 | - right: 32rem / $pxConvertRem; | 66 | + right: 0; |
67 | top: 0; | 67 | top: 0; |
68 | - bottom: 0; | ||
69 | - a{ | 68 | + width: 90rem / $pxConvertRem; |
69 | + height: 90rem / $pxConvertRem; | ||
70 | + text-align: center; | ||
71 | + | ||
72 | + a { | ||
73 | + display: block; | ||
70 | color: #fff; | 74 | color: #fff; |
75 | + font-size: 40rem / $pxConvertRem; | ||
76 | + line-height: 90rem / $pxConvertRem; | ||
77 | + } | ||
78 | + | ||
79 | + &.highlight { | ||
80 | + background: rgba(200,200,200,.4); | ||
71 | } | 81 | } |
72 | } | 82 | } |
73 | } | 83 | } |
@@ -51,20 +51,6 @@ | @@ -51,20 +51,6 @@ | ||
51 | color: #000; | 51 | color: #000; |
52 | } | 52 | } |
53 | } | 53 | } |
54 | - .load-more-info { | ||
55 | - width: 100%; | ||
56 | - height: 70rem / $pxConvertRem; | ||
57 | - line-height: 70rem / $pxConvertRem; | ||
58 | - text-align: center; | ||
59 | - font-size: 14px; | ||
60 | - overflow: hidden; | ||
61 | - | ||
62 | - .status { | ||
63 | - &.hide { | ||
64 | - display: none; | ||
65 | - } | ||
66 | - } | ||
67 | - } | ||
68 | } | 54 | } |
69 | 55 | ||
70 | .load-more-img { | 56 | .load-more-img { |
@@ -108,6 +108,21 @@ a { | @@ -108,6 +108,21 @@ a { | ||
108 | @include border-radius(10px); | 108 | @include border-radius(10px); |
109 | } | 109 | } |
110 | 110 | ||
111 | +.load-more-info { | ||
112 | + width: 100%; | ||
113 | + height: 70rem / $pxConvertRem; | ||
114 | + line-height: 70rem / $pxConvertRem; | ||
115 | + text-align: center; | ||
116 | + font-size: 14px; | ||
117 | + overflow: hidden; | ||
118 | + | ||
119 | + .status { | ||
120 | + &.hide { | ||
121 | + display: none; | ||
122 | + } | ||
123 | + } | ||
124 | +} | ||
125 | + | ||
111 | /*px转化rem*/ | 126 | /*px转化rem*/ |
112 | @function pxToRem($px) { | 127 | @function pxToRem($px) { |
113 | $pxConvertRem: 40px; | 128 | $pxConvertRem: 40px; |
@@ -24,26 +24,31 @@ | @@ -24,26 +24,31 @@ | ||
24 | background: #4f4138; | 24 | background: #4f4138; |
25 | } | 25 | } |
26 | 26 | ||
27 | - .nav-back { | 27 | + a.highlight { |
28 | + background: rgba(200,200,200,.1); | ||
29 | + } | ||
30 | + | ||
31 | + %nav { | ||
32 | + display: block; | ||
28 | position: absolute; | 33 | position: absolute; |
29 | - left: 34rem / $pxConvertRem; | ||
30 | - top: 28rem / $pxConvertRem; | ||
31 | - width: 18rem / $pxConvertRem; | ||
32 | - height: 32rem / $pxConvertRem; | ||
33 | - background: image-url('layout/back.png') no-repeat; | ||
34 | - background-size: 100% 100%; | 34 | + top: 0; |
35 | + width: 90rem / $pxConvertRem; | ||
36 | + height: 90rem / $pxConvertRem; | ||
37 | + font-size: 40rem / $pxConvertRem; | ||
38 | + line-height: 90rem / $pxConvertRem; | ||
39 | + color: #fff; | ||
40 | + text-align: center; | ||
35 | outline: none; | 41 | outline: none; |
36 | } | 42 | } |
37 | 43 | ||
44 | + .nav-back { | ||
45 | + @extend %nav; | ||
46 | + left: 0; | ||
47 | + } | ||
48 | + | ||
38 | .nav-home { | 49 | .nav-home { |
39 | - position: absolute; | ||
40 | - top: 28rem / $pxConvertRem; | ||
41 | - right: 34rem / $pxConvertRem; | ||
42 | - width: 20px; | ||
43 | - height: 20px; | ||
44 | - background: image-url('layout/home.png') no-repeat; | ||
45 | - background-size: 100% 100%; | ||
46 | - outline: none; | 50 | + @extend %nav; |
51 | + right: 0; | ||
47 | } | 52 | } |
48 | 53 | ||
49 | .nav-title { | 54 | .nav-title { |
1 | $vip: sprite-map("me/vip/*.png", $spacing: 10px); | 1 | $vip: sprite-map("me/vip/*.png", $spacing: 10px); |
2 | +$fav: sprite-map("me/fav/*.png", $spacing: 5px); | ||
2 | 3 | ||
3 | -@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "fav", "suggest", "address", "online-service"; | 4 | +@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "fav", "suggest", "address", "online-service", "my-guang"; |
4 | 5 |
static/sass/me/_my-guang.scss
0 → 100644
1 | +.my-guang-page { | ||
2 | + | ||
3 | + .null { | ||
4 | + height: 240rem / $pxConvertRem; | ||
5 | + width: 100%; | ||
6 | + position: absolute; | ||
7 | + text-align: center; | ||
8 | + top: 50%; | ||
9 | + margin-top: -120rem / $pxConvertRem; | ||
10 | + | ||
11 | + span { | ||
12 | + color: #b0b0b0; | ||
13 | + font-size: 24rem / $pxConvertRem; | ||
14 | + margin-top: 20rem / $pxConvertRem; | ||
15 | + } | ||
16 | + } | ||
17 | + | ||
18 | + .icon-null { | ||
19 | + width: pxToRem(188px); | ||
20 | + height: pxToRem(171px); | ||
21 | + @include rem-sprite($fav, fav-null); | ||
22 | + margin: 0 auto; | ||
23 | + margin-bottom: 30rem / $pxConvertRem; | ||
24 | + } | ||
25 | +} |
@@ -156,12 +156,34 @@ $suggest: sprite-map("me/suggest/*.png",$spacing: 5px); | @@ -156,12 +156,34 @@ $suggest: sprite-map("me/suggest/*.png",$spacing: 5px); | ||
156 | .img-form { | 156 | .img-form { |
157 | padding: 0 pxToRem(30px); | 157 | padding: 0 pxToRem(30px); |
158 | 158 | ||
159 | + .upload-img-list { | ||
160 | + float: left; | ||
161 | + | ||
162 | + > li { | ||
163 | + display: block; | ||
164 | + width: pxToRem(130px); | ||
165 | + height: pxToRem(130px); | ||
166 | + overflow: hidden; | ||
167 | + float: left; | ||
168 | + margin-right: pxToRem(30px); | ||
169 | + | ||
170 | + > img { | ||
171 | + display: block; | ||
172 | + width: 100%; | ||
173 | + height: 100%; | ||
174 | + overflow: hidden; | ||
175 | + } | ||
176 | + } | ||
177 | + } | ||
178 | + | ||
159 | .img-add { | 179 | .img-add { |
160 | display: block; | 180 | display: block; |
161 | width: pxToRem(130px); | 181 | width: pxToRem(130px); |
162 | height: pxToRem(130px); | 182 | height: pxToRem(130px); |
163 | border: 1px dashed #e0e0e0; | 183 | border: 1px dashed #e0e0e0; |
164 | position: relative; | 184 | position: relative; |
185 | + text-indent: -1000px; | ||
186 | + float: left; | ||
165 | 187 | ||
166 | &:after { | 188 | &:after { |
167 | $width: pxToRem(image_width(sprite-file($suggest, suggest-add))); | 189 | $width: pxToRem(image_width(sprite-file($suggest, suggest-add))); |
@@ -180,7 +202,7 @@ $suggest: sprite-map("me/suggest/*.png",$spacing: 5px); | @@ -180,7 +202,7 @@ $suggest: sprite-map("me/suggest/*.png",$spacing: 5px); | ||
180 | margin-left: -$width / 2; | 202 | margin-left: -$width / 2; |
181 | } | 203 | } |
182 | 204 | ||
183 | - > input[type="file"] { | 205 | + input[type="file"], { |
184 | position: absolute; | 206 | position: absolute; |
185 | //@include stretch(); | 207 | //@include stretch(); |
186 | @include opacity(0.2); | 208 | @include opacity(0.2); |
@@ -5,11 +5,11 @@ | @@ -5,11 +5,11 @@ | ||
5 | <li class="active">收藏的商品</li> | 5 | <li class="active">收藏的商品</li> |
6 | <li>收藏的品牌</li> | 6 | <li>收藏的品牌</li> |
7 | </ul> | 7 | </ul> |
8 | - <div class="fav-content"> | 8 | + <div class="fav-content" id="fav-content"> |
9 | <div class="fav-type"> | 9 | <div class="fav-type"> |
10 | <ul class="fav-product-list"> | 10 | <ul class="fav-product-list"> |
11 | {{# hasFavProduct}} | 11 | {{# hasFavProduct}} |
12 | - <li> | 12 | + <li data-id="{{fav_id}}"> |
13 | <div class="fav-img-box"> | 13 | <div class="fav-img-box"> |
14 | <img src="{{imgUrl}}" alt=""/> | 14 | <img src="{{imgUrl}}" alt=""/> |
15 | </div> | 15 | </div> |
1 | +{{> me/my-guang/infos}} |
1 | {{> layout/header}} | 1 | {{> layout/header}} |
2 | <div class="my-guang-page yoho-page"> | 2 | <div class="my-guang-page yoho-page"> |
3 | - <div id="info-list" class="info-list"> | ||
4 | {{# myGuang}} | 3 | {{# myGuang}} |
5 | - {{> guang/info}} | ||
6 | - {{/ myGuang}} | 4 | + {{#if infos}} |
5 | + <div id="info-list" class="info-list"> | ||
6 | + {{> me/my-guang/infos}} | ||
7 | + </div> | ||
8 | + <div id="load-more-info" class="load-more-info"> | ||
9 | + <div class="loading status hide"> | ||
10 | + 正在加载... | ||
7 | </div> | 11 | </div> |
12 | + <span class="no-more status">没有更多啦</span> | ||
13 | + </div> | ||
14 | + {{^}} | ||
15 | + <div class="null"> | ||
16 | + <div class="icon-null"></div> | ||
17 | + <span>您当前还未收藏任何资讯!</span> | ||
18 | + </div> | ||
19 | + {{/if}} | ||
20 | + {{/ myGuang}} | ||
8 | </div> | 21 | </div> |
9 | {{> layout/footer}} | 22 | {{> layout/footer}} |
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" | ||
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}}"> | 4 | + <div class="suggest-sub-form"> |
12 | <textarea name="" id="suggest-textarea" placeholder="请输入意见反馈,我们会以消息形式回复您的建议或意见,改进产品体验,谢谢!"></textarea> | 5 | <textarea name="" id="suggest-textarea" placeholder="请输入意见反馈,我们会以消息形式回复您的建议或意见,改进产品体验,谢谢!"></textarea> |
13 | <div class="img-form"> | 6 | <div class="img-form"> |
7 | + <ul class="upload-img-list"></ul> | ||
14 | <span class="img-add"> | 8 | <span class="img-add"> |
15 | - <input id="upload-img" type="file" name="fileselect[]" multiple /> | 9 | + <input id="upload-img" type="file" multiple /> |
16 | </span> | 10 | </span> |
17 | </div> | 11 | </div> |
18 | </div> | 12 | </div> |
@@ -16,8 +16,8 @@ | @@ -16,8 +16,8 @@ | ||
16 | <script src="http://static.buy.test.yoho.cn/dist/myohobuy/{{version}}/index-debug.js"></script> | 16 | <script src="http://static.buy.test.yoho.cn/dist/myohobuy/{{version}}/index-debug.js"></script> |
17 | {{/if}} | 17 | {{/if}} |
18 | {{#if devEnv}} | 18 | {{#if devEnv}} |
19 | -<script src="http://localhost:8000/static/js/sea.js?nowrap"></script> | ||
20 | -<script>seajs.config({base: 'http://localhost:8000/'});</script> | 19 | +<script src="http://172.16.6.204:8000/static/js/sea.js?nowrap"></script> |
20 | +<script>seajs.config({base: 'http://172.16.6.204:8000/'});</script> | ||
21 | {{/if}} | 21 | {{/if}} |
22 | <script type="text/javascript"> | 22 | <script type="text/javascript"> |
23 | (function(w,d,s,j,f){ | 23 | (function(w,d,s,j,f){ |
1 | {{#pageHeader}} | 1 | {{#pageHeader}} |
2 | -<header class="yoho-header{{#if boys}} boys{{/if}}{{#if girls}} girls{{/if}}{{#if kids}} kids{{/if}}{{#if lifeStyle}} life-style{{/if}}"> | 2 | +<header id="yoho-header" class="yoho-header{{#if boys}} boys{{/if}}{{#if girls}} girls{{/if}}{{#if kids}} kids{{/if}}{{#if lifeStyle}} life-style{{/if}}"> |
3 | {{#if navBack}} | 3 | {{#if navBack}} |
4 | - <a href="javascript:history.go(-1);" class="nav-back"></a> | 4 | + <a href="javascript:history.go(-1);" class="iconfont nav-back"></a> |
5 | {{/if}} | 5 | {{/if}} |
6 | {{#navHome}} | 6 | {{#navHome}} |
7 | - <a href="{{.}}" class="nav-home"></a> | 7 | + <a href="{{.}}" class="iconfont nav-home"></a> |
8 | {{/navHome}} | 8 | {{/navHome}} |
9 | {{#navTitle}} | 9 | {{#navTitle}} |
10 | <p class="nav-title">{{.}}</p> | 10 | <p class="nav-title">{{.}}</p> |
@@ -75,6 +75,7 @@ class HomeController extends AbstractAction | @@ -75,6 +75,7 @@ class HomeController extends AbstractAction | ||
75 | 75 | ||
76 | $favProducts = \Index\UserModel::getFavProductData($uid); | 76 | $favProducts = \Index\UserModel::getFavProductData($uid); |
77 | $favBrands = \Index\UserModel::getFavBrandData($uid, $gender); | 77 | $favBrands = \Index\UserModel::getFavBrandData($uid, $gender); |
78 | + | ||
78 | $data = array( | 79 | $data = array( |
79 | 'favPage' => true, //加载js | 80 | 'favPage' => true, //加载js |
80 | 'pageFooter' => true, | 81 | 'pageFooter' => true, |
@@ -82,7 +83,7 @@ class HomeController extends AbstractAction | @@ -82,7 +83,7 @@ class HomeController extends AbstractAction | ||
82 | 'hasFavProduct' => $favProducts, | 83 | 'hasFavProduct' => $favProducts, |
83 | 'hasFavBrand' => $favBrands | 84 | 'hasFavBrand' => $favBrands |
84 | ); | 85 | ); |
85 | - // 判断时候为品牌页 | 86 | + // 判断是否为品牌收藏页 |
86 | if ($tab === 'brand') { | 87 | if ($tab === 'brand') { |
87 | $data['brandTab'] = true; | 88 | $data['brandTab'] = true; |
88 | } | 89 | } |
@@ -97,16 +98,20 @@ class HomeController extends AbstractAction | @@ -97,16 +98,20 @@ class HomeController extends AbstractAction | ||
97 | { | 98 | { |
98 | $result = array(); | 99 | $result = array(); |
99 | 100 | ||
100 | - if ($this->isAjax()) { | 101 | + if ($this->isAjax()) |
102 | + { | ||
101 | $uid = $this->getUid(); | 103 | $uid = $this->getUid(); |
102 | $fav_id = $this->post('fav_id', 0); | 104 | $fav_id = $this->post('fav_id', 0); |
103 | 105 | ||
104 | $result = \Index\UserModel::favoriteDelete($uid, $fav_id); | 106 | $result = \Index\UserModel::favoriteDelete($uid, $fav_id); |
105 | } | 107 | } |
106 | 108 | ||
107 | - if (empty($result)) { | 109 | + if (empty($result)) |
110 | + { | ||
108 | echo ' '; | 111 | echo ' '; |
109 | - } else { | 112 | + } |
113 | + else | ||
114 | + { | ||
110 | $this->echoJson($result); | 115 | $this->echoJson($result); |
111 | } | 116 | } |
112 | } | 117 | } |
@@ -207,7 +212,8 @@ class HomeController extends AbstractAction | @@ -207,7 +212,8 @@ class HomeController extends AbstractAction | ||
207 | { | 212 | { |
208 | $result = array(); | 213 | $result = array(); |
209 | 214 | ||
210 | - if ($this->isAjax()) { | 215 | + if ($this->isAjax()) |
216 | + { | ||
211 | // $uid = $this->getUid(); | 217 | // $uid = $this->getUid(); |
212 | $uid = 8826435; | 218 | $uid = 8826435; |
213 | $address = $this->post('address', ''); | 219 | $address = $this->post('address', ''); |
@@ -221,9 +227,12 @@ class HomeController extends AbstractAction | @@ -221,9 +227,12 @@ class HomeController extends AbstractAction | ||
221 | $result = \Index\UserModel::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code); | 227 | $result = \Index\UserModel::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code); |
222 | } | 228 | } |
223 | 229 | ||
224 | - if (empty($result)) { | 230 | + if (empty($result)) |
231 | + { | ||
225 | echo ' '; | 232 | echo ' '; |
226 | - } else { | 233 | + } |
234 | + else | ||
235 | + { | ||
227 | $this->echoJson($result); | 236 | $this->echoJson($result); |
228 | } | 237 | } |
229 | } | 238 | } |
@@ -235,7 +244,8 @@ class HomeController extends AbstractAction | @@ -235,7 +244,8 @@ class HomeController extends AbstractAction | ||
235 | { | 244 | { |
236 | $result = array(); | 245 | $result = array(); |
237 | 246 | ||
238 | - if ($this->isAjax()) { | 247 | + if ($this->isAjax()) |
248 | + { | ||
239 | // $uid = $this->getUid(); | 249 | // $uid = $this->getUid(); |
240 | $uid = 8826435; | 250 | $uid = 8826435; |
241 | $id = $this->post('id', ''); | 251 | $id = $this->post('id', ''); |
@@ -243,9 +253,12 @@ class HomeController extends AbstractAction | @@ -243,9 +253,12 @@ class HomeController extends AbstractAction | ||
243 | $result = \Index\UserModel::setDefaultAddress($uid, $id); | 253 | $result = \Index\UserModel::setDefaultAddress($uid, $id); |
244 | } | 254 | } |
245 | 255 | ||
246 | - if (empty($result)) { | 256 | + if (empty($result)) |
257 | + { | ||
247 | echo ' '; | 258 | echo ' '; |
248 | - } else { | 259 | + } |
260 | + else | ||
261 | + { | ||
249 | $this->echoJson($result); | 262 | $this->echoJson($result); |
250 | } | 263 | } |
251 | } | 264 | } |
@@ -257,7 +270,8 @@ class HomeController extends AbstractAction | @@ -257,7 +270,8 @@ class HomeController extends AbstractAction | ||
257 | { | 270 | { |
258 | $result = array(); | 271 | $result = array(); |
259 | 272 | ||
260 | - if ($this->isAjax()) { | 273 | + if ($this->isAjax()) |
274 | + { | ||
261 | // $uid = $this->getUid(); | 275 | // $uid = $this->getUid(); |
262 | $uid = 8826435; | 276 | $uid = 8826435; |
263 | $id = $this->post('id', ''); | 277 | $id = $this->post('id', ''); |
@@ -265,9 +279,12 @@ class HomeController extends AbstractAction | @@ -265,9 +279,12 @@ class HomeController extends AbstractAction | ||
265 | $result = \Index\UserModel::deleteAddress($uid, $id); | 279 | $result = \Index\UserModel::deleteAddress($uid, $id); |
266 | } | 280 | } |
267 | 281 | ||
268 | - if (empty($result)) { | 282 | + if (empty($result)) |
283 | + { | ||
269 | echo ' '; | 284 | echo ' '; |
270 | - } else { | 285 | + } |
286 | + else | ||
287 | + { | ||
271 | $this->echoJson($result); | 288 | $this->echoJson($result); |
272 | } | 289 | } |
273 | } | 290 | } |
@@ -294,7 +311,8 @@ class HomeController extends AbstractAction | @@ -294,7 +311,8 @@ class HomeController extends AbstractAction | ||
294 | $service = array(); | 311 | $service = array(); |
295 | $cateId = $this->get('cateId', 0); | 312 | $cateId = $this->get('cateId', 0); |
296 | $cateName = $this->get('cateName', ''); | 313 | $cateName = $this->get('cateName', ''); |
297 | - if ($cateId > 0) { | 314 | + if ($cateId > 0) |
315 | + { | ||
298 | $service = home\OnlineModel::getOnlineServiceDetail($cateId); | 316 | $service = home\OnlineModel::getOnlineServiceDetail($cateId); |
299 | } | 317 | } |
300 | $this->setTitle('在线客服'); | 318 | $this->setTitle('在线客服'); |
@@ -310,12 +328,26 @@ class HomeController extends AbstractAction | @@ -310,12 +328,26 @@ class HomeController extends AbstractAction | ||
310 | $page = $this->get('page', 1); | 328 | $page = $this->get('page', 1); |
311 | $limit = $this->get('limit', 10); | 329 | $limit = $this->get('limit', 10); |
312 | $uid = $this->getUid(); | 330 | $uid = $this->getUid(); |
331 | + $uid=5687179; | ||
313 | $gender = Helpers::getGenderByCookie(); | 332 | $gender = Helpers::getGenderByCookie(); |
314 | $yh_channel = Helpers::getChannelByCookie(); | 333 | $yh_channel = Helpers::getChannelByCookie(); |
315 | - $guangInfo = \home\GuangModel::getMyGuang($uid, $page,$yh_channel,$gender, $limit); | 334 | + $guangInfo = \home\GuangModel::getMyGuang($uid, $page, $yh_channel, $gender, $limit); |
335 | + $totalPage = $guangInfo['totalPage']; | ||
336 | + unset($guangInfo['totalPage']); | ||
337 | + if ($page == 1) | ||
338 | + { | ||
316 | $this->setTitle('我收藏的'); | 339 | $this->setTitle('我收藏的'); |
317 | $this->setNavHeader('我收藏的', true, ''); | 340 | $this->setNavHeader('我收藏的', true, ''); |
318 | - $this->_view->display('my-guang', array( 'myGuangPage' => true,'myGuang'=>$guangInfo,'pageFooter' => true)); | 341 | + $this->_view->display('my-guang', array('myGuangPage' => true, 'myGuang' => array('infos' => $guangInfo), 'pageFooter' => true)); |
342 | + } | ||
343 | + else if ($page > 1 && $page<=$totalPage) | ||
344 | + { | ||
345 | + $this->_view->display('my-guang-partial', array('infos' => $guangInfo)); | ||
346 | + } | ||
347 | + else if ($page > 1 && $page>$totalPage) | ||
348 | + { | ||
349 | + echo ' ';//退出循环 | ||
350 | + } | ||
319 | } | 351 | } |
320 | 352 | ||
321 | /** | 353 | /** |
@@ -350,10 +382,6 @@ class HomeController extends AbstractAction | @@ -350,10 +382,6 @@ class HomeController extends AbstractAction | ||
350 | // 设置网站标题 | 382 | // 设置网站标题 |
351 | $this->setTitle('反馈问题'); | 383 | $this->setTitle('反馈问题'); |
352 | 384 | ||
353 | - $param = \Api\Yohobuy::param(); | ||
354 | - unset($param['private_key']); | ||
355 | - $param['project'] = 'suggest'; | ||
356 | - $param['client_secret'] = 'e7807a9522ab99af8b8fd926e1ebbd9a'; | ||
357 | $data = array( | 385 | $data = array( |
358 | 'suggestPage' => true, //加载js | 386 | 'suggestPage' => true, //加载js |
359 | 'pageHeader' => array( | 387 | 'pageHeader' => array( |
@@ -361,11 +389,9 @@ class HomeController extends AbstractAction | @@ -361,11 +389,9 @@ class HomeController extends AbstractAction | ||
361 | 'navTitle' => '反馈问题', | 389 | 'navTitle' => '反馈问题', |
362 | 'navBtn' => '提交' | 390 | 'navBtn' => '提交' |
363 | ), | 391 | ), |
364 | - 'param' => $param, | ||
365 | 'suggestSub' => true, | 392 | 'suggestSub' => true, |
366 | 'pageFooter' => true | 393 | 'pageFooter' => true |
367 | ); | 394 | ); |
368 | - //print_r($data); | ||
369 | 395 | ||
370 | $this->_view->display('suggest_sub', $data); | 396 | $this->_view->display('suggest_sub', $data); |
371 | } | 397 | } |
@@ -375,8 +401,8 @@ class HomeController extends AbstractAction | @@ -375,8 +401,8 @@ class HomeController extends AbstractAction | ||
375 | */ | 401 | */ |
376 | public function suggestimgUploadAction() | 402 | public function suggestimgUploadAction() |
377 | { | 403 | { |
378 | - $filename = $this->post('filename', ''); | ||
379 | - $result = \Index\UserModel::saveSuggestImg($filename); | 404 | + //$filename = $this->post('filename', ''); |
405 | + $result = \Index\UserModel::saveSuggestImg('fileData'); | ||
380 | 406 | ||
381 | $this->echoJson($result); | 407 | $this->echoJson($result); |
382 | } | 408 | } |
@@ -386,10 +412,11 @@ class HomeController extends AbstractAction | @@ -386,10 +412,11 @@ class HomeController extends AbstractAction | ||
386 | */ | 412 | */ |
387 | public function savesuggestAction() | 413 | public function savesuggestAction() |
388 | { | 414 | { |
389 | - if ($this->isAjax()) { | 415 | + if ($this->isAjax()) |
416 | + { | ||
390 | $uid = $this->getUid(); | 417 | $uid = $this->getUid(); |
391 | $content = $this->post('content', ''); | 418 | $content = $this->post('content', ''); |
392 | - $suggest_type = $this->get('suggest_type', 2); | 419 | + $suggest_type = $this->post('suggest_type', 2); |
393 | $result = \Index\UserModel::saveSuggestData($uid, $content, $suggest_type); | 420 | $result = \Index\UserModel::saveSuggestData($uid, $content, $suggest_type); |
394 | 421 | ||
395 | $this->echoJson($result); | 422 | $this->echoJson($result); |
@@ -434,22 +461,25 @@ class HomeController extends AbstractAction | @@ -434,22 +461,25 @@ class HomeController extends AbstractAction | ||
434 | } | 461 | } |
435 | 462 | ||
436 | /* | 463 | /* |
437 | - * 我的订单页面 | 464 | + * 我的订单页面,获得nav导航条焦点。并且异步请求订单详情列表页(getOrders) |
438 | */ | 465 | */ |
439 | 466 | ||
440 | public function orderAction() | 467 | public function orderAction() |
441 | { | 468 | { |
442 | - //获得type值 | 469 | + //获得type值,type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论。 |
443 | $type = $this->get('type', 1); | 470 | $type = $this->get('type', 1); |
444 | $this->setTitle('我的订单'); | 471 | $this->setTitle('我的订单'); |
445 | $this->setNavHeader('我的订单'); | 472 | $this->setNavHeader('我的订单'); |
446 | $data = OrderModel::getNavs($type); | 473 | $data = OrderModel::getNavs($type); |
447 | - if (!empty($data)) { | 474 | + if (!empty($data)) |
475 | + { | ||
448 | $order['navs'] = $data; | 476 | $order['navs'] = $data; |
449 | - } else { | 477 | + } |
478 | + else | ||
479 | + { | ||
450 | $this->error(); | 480 | $this->error(); |
451 | } | 481 | } |
452 | - | 482 | + //渲染模板 |
453 | $this->_view->display('order', array( | 483 | $this->_view->display('order', array( |
454 | 'order' => $order, | 484 | 'order' => $order, |
455 | 'pageFooter' => true, | 485 | 'pageFooter' => true, |
@@ -461,7 +491,8 @@ class HomeController extends AbstractAction | @@ -461,7 +491,8 @@ class HomeController extends AbstractAction | ||
461 | public function getOrdersAction() | 491 | public function getOrdersAction() |
462 | { | 492 | { |
463 | //判断是不是ajax请求 | 493 | //判断是不是ajax请求 |
464 | - if (!$this->isAjax()) { | 494 | + if (!$this->isAjax()) |
495 | + { | ||
465 | $this->error(); | 496 | $this->error(); |
466 | } | 497 | } |
467 | //获取基本参数:type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论 | 498 | //获取基本参数:type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论 |
@@ -474,15 +505,24 @@ class HomeController extends AbstractAction | @@ -474,15 +505,24 @@ class HomeController extends AbstractAction | ||
474 | $uid = '10267443'; //测试用 | 505 | $uid = '10267443'; //测试用 |
475 | //调用模型层getOrder方法获得并处理数据 | 506 | //调用模型层getOrder方法获得并处理数据 |
476 | $data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid); | 507 | $data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid); |
477 | - //如果没有订单数据,就给一个随便逛逛链接 | 508 | + /* 如果取不到订单数据时,分两种情况: |
509 | + 1、page>1时,echo一个空格字符串到浏览器。 | ||
510 | + 2、page=1时,就给一个随便逛逛的链接。 | ||
511 | + * */ | ||
478 | $order = array(); | 512 | $order = array(); |
479 | - if (!empty($data)) { | 513 | + if (!empty($data)) |
514 | + { | ||
480 | $order['orders'] = $data; | 515 | $order['orders'] = $data; |
481 | - } else { | ||
482 | - if ($page > 1) { | 516 | + } |
517 | + else | ||
518 | + { | ||
519 | + if ($page > 1) | ||
520 | + { | ||
483 | echo " "; | 521 | echo " "; |
484 | - } else { | ||
485 | - $order['walkwayUrl'] = 'http://www.baidu.com'; | 522 | + } |
523 | + elseif ($page = 1) | ||
524 | + { | ||
525 | + $order['walkwayUrl'] = self::strollAction(); | ||
486 | } | 526 | } |
487 | } | 527 | } |
488 | //渲染模板 | 528 | //渲染模板 |
@@ -497,17 +537,20 @@ class HomeController extends AbstractAction | @@ -497,17 +537,20 @@ class HomeController extends AbstractAction | ||
497 | { | 537 | { |
498 | 538 | ||
499 | //判断是不是ajax请求 | 539 | //判断是不是ajax请求 |
500 | - if (!$this->isAjax()) { | 540 | + if (!$this->isAjax()) |
541 | + { | ||
501 | $this->error(); | 542 | $this->error(); |
502 | } | 543 | } |
503 | //传入order_code和uid以取消订单 | 544 | //传入order_code和uid以取消订单 |
504 | - $order_code = $this->get('orderCode'); | 545 | + $order_code = $this->get('id'); |
505 | $uid = $this->getUid(); | 546 | $uid = $this->getUid(); |
506 | $uid = '10267443'; //测试用 | 547 | $uid = '10267443'; //测试用 |
507 | $gender = Helpers::getGenderByCookie(); | 548 | $gender = Helpers::getGenderByCookie(); |
508 | $yh_channel = $this->get('yh_channel', 1); | 549 | $yh_channel = $this->get('yh_channel', 1); |
509 | $method = 'app.SpaceOrders.close'; | 550 | $method = 'app.SpaceOrders.close'; |
551 | + //调用取消订单接口,返回订单取消状态 | ||
510 | $data = OrderData::cancelOrderData($order_code, $uid, $gender, $yh_channel, $method); | 552 | $data = OrderData::cancelOrderData($order_code, $uid, $gender, $yh_channel, $method); |
553 | + //将取消状态返回至浏览器 | ||
511 | $this->echoJson($data); | 554 | $this->echoJson($data); |
512 | } | 555 | } |
513 | 556 | ||
@@ -518,7 +561,8 @@ class HomeController extends AbstractAction | @@ -518,7 +561,8 @@ class HomeController extends AbstractAction | ||
518 | public function delOrderAction() | 561 | public function delOrderAction() |
519 | { | 562 | { |
520 | //判断是不是ajax请求 | 563 | //判断是不是ajax请求 |
521 | - if (!$this->isAjax()) { | 564 | + if (!$this->isAjax()) |
565 | + { | ||
522 | $this->error(); | 566 | $this->error(); |
523 | } | 567 | } |
524 | //传入order_code和uid以删除订单 | 568 | //传入order_code和uid以删除订单 |
@@ -528,10 +572,37 @@ class HomeController extends AbstractAction | @@ -528,10 +572,37 @@ class HomeController extends AbstractAction | ||
528 | $gender = Helpers::getGenderByCookie(); | 572 | $gender = Helpers::getGenderByCookie(); |
529 | $yh_channel = $this->get('yh_channel', 1); | 573 | $yh_channel = $this->get('yh_channel', 1); |
530 | $method = 'app.SpaceOrders.delOrderByCode'; | 574 | $method = 'app.SpaceOrders.delOrderByCode'; |
575 | + //调用接口删除订单,并返回订单删除状态 | ||
531 | $data = OrderData::deleteOrderData($order_code, $uid, $gender, $yh_channel, $method); | 576 | $data = OrderData::deleteOrderData($order_code, $uid, $gender, $yh_channel, $method); |
577 | + //将订单删除状态返回至浏览器 | ||
532 | $this->echoJson($data); | 578 | $this->echoJson($data); |
533 | } | 579 | } |
534 | 580 | ||
581 | + /* | ||
582 | + * 我的订单-支付链接获取 | ||
583 | + */ | ||
584 | + | ||
585 | + private function paymentAction() | ||
586 | + { | ||
587 | + $gender = Helpers::getGenderByCookie(); | ||
588 | + $yh_channel = $this->get('yh_channel', 1); | ||
589 | + OrderModel::payment($gender, $yh_channel); | ||
590 | + } | ||
591 | + | ||
592 | + /* | ||
593 | + * 我的订单-随便逛逛链接获取 | ||
594 | + */ | ||
595 | + | ||
596 | + private function strollAction() | ||
597 | + { | ||
598 | + //获取性别、频道数据 | ||
599 | + $gender = Helpers::getGenderByCookie(); | ||
600 | + $yh_channel = $this->get('yh_channel', 1); | ||
601 | + //调用接口获取随便逛逛url地址,并return数据 | ||
602 | + $data = OrderModel::stroll($gender, $yh_channel); | ||
603 | + return $data; | ||
604 | + } | ||
605 | + | ||
535 | /** | 606 | /** |
536 | * 订单详情页 | 607 | * 订单详情页 |
537 | */ | 608 | */ |
@@ -18,6 +18,7 @@ class GuangModel | @@ -18,6 +18,7 @@ class GuangModel | ||
18 | $result = array(); | 18 | $result = array(); |
19 | //调用接口获取数据 | 19 | //调用接口获取数据 |
20 | $res = GuangData::getGuangInfo($uid, $page, $yh_channel, $gender, $limit); | 20 | $res = GuangData::getGuangInfo($uid, $page, $yh_channel, $gender, $limit); |
21 | + $result['totalPage']=intval($res['data']['totalPage']); | ||
21 | if (!empty($res['data']['data'])) | 22 | if (!empty($res['data']['data'])) |
22 | { | 23 | { |
23 | foreach ($res['data']['data'] as $k => $v) | 24 | foreach ($res['data']['data'] as $k => $v) |
@@ -18,11 +18,16 @@ use Configs\CacheConfig; | @@ -18,11 +18,16 @@ use Configs\CacheConfig; | ||
18 | */ | 18 | */ |
19 | class OrderModel | 19 | class OrderModel |
20 | { | 20 | { |
21 | + /* 频道选择页取背景图片的位置码 */ | ||
22 | + | ||
23 | + const CODE_PAYMENT = '04cf5abaa7c20178325a07c4a833782c'; //支付订单资源码 | ||
24 | + const CODE_STROLL = 'a7989369aa86681c678bc40f171b8f1d'; //随便逛逛url地址资源码 | ||
21 | 25 | ||
22 | /** | 26 | /** |
23 | * 订单相关数据处理 | 27 | * 订单相关数据处理 |
24 | */ | 28 | */ |
25 | - public function getOrder($type = 1, $page = 1, $limit, $gender, $yh_channel, $uid) { | 29 | + |
30 | + static function getOrder($type = 1, $page = 1, $limit, $gender, $yh_channel, $uid) { | ||
26 | $result = array(); | 31 | $result = array(); |
27 | if (USE_CACHE) { | 32 | if (USE_CACHE) { |
28 | $key = CacheConfig::KEY_ACTION_HOME_ORDER_ORDER; | 33 | $key = CacheConfig::KEY_ACTION_HOME_ORDER_ORDER; |
@@ -37,32 +42,37 @@ class OrderModel | @@ -37,32 +42,37 @@ class OrderModel | ||
37 | //检查数据返回是否正常,正常则处理数据 | 42 | //检查数据返回是否正常,正常则处理数据 |
38 | if ($data['code'] == 200 && isset($data['data'])) { | 43 | if ($data['code'] == 200 && isset($data['data'])) { |
39 | foreach ($data['data']['order_list'] as $key => $vo) { | 44 | foreach ($data['data']['order_list'] as $key => $vo) { |
40 | - //订单号,支付状态,订单商品数量,订单总价格 | 45 | + //订单号,支付状态,订单商品数量,订单总价格(订单总价加上运费) |
41 | $result[$key]['orderNum'] = $vo['order_code']; | 46 | $result[$key]['orderNum'] = $vo['order_code']; |
42 | $result[$key]['orderStatus'] = $vo['status_str']; | 47 | $result[$key]['orderStatus'] = $vo['status_str']; |
43 | $result[$key]['count'] = count($vo['order_goods']); | 48 | $result[$key]['count'] = count($vo['order_goods']); |
44 | $result[$key]['sumCost'] = $vo['amount'] + $vo['shipping_cost']; | 49 | $result[$key]['sumCost'] = $vo['amount'] + $vo['shipping_cost']; |
45 | - //订单商品列表数据 | 50 | + //类内调用格式化订单商品数据方法 |
46 | $result[$key]['goods'] = self::formatOrderGoods($vo['order_goods']); | 51 | $result[$key]['goods'] = self::formatOrderGoods($vo['order_goods']); |
47 | - //订单status判断订单处于什么状态。 | 52 | + //根据订单status判断订单处于什么状态。 |
48 | do { | 53 | do { |
49 | - //订单取消状态 | 54 | + //订单取消状态 = Y 时,跳出判断订单状态循环,并设置订单状态为已取消。 |
50 | if ($vo['is_cancel'] === 'Y') { | 55 | if ($vo['is_cancel'] === 'Y') { |
51 | $result[$key]['canceled'] = true; | 56 | $result[$key]['canceled'] = true; |
52 | break; | 57 | break; |
53 | } | 58 | } |
54 | - //支付方式不是货到付款时,计算订单状态 | 59 | + /* 先判断订单付款方式,根据不同的付款方式计算订单状态。(注:货到付款没有待付款状态) |
60 | + * 付款方式:1 => 在线支付,2 => 货到付款,3 => 现金支付,4 => 抵消支付; | ||
61 | + */ | ||
62 | + //支付方式为非货到付款时,计算订单状态。 | ||
55 | if ($vo['payment_type'] != 2) { | 63 | if ($vo['payment_type'] != 2) { |
56 | switch ($vo['status']) { | 64 | switch ($vo['status']) { |
57 | case 0: | 65 | case 0: |
58 | $result[$key]['unpaid'] = true; | 66 | $result[$key]['unpaid'] = true; |
59 | break; | 67 | break; |
68 | + //未发货&未收货 状态,统一合并到待收货状态。 | ||
60 | case 1: | 69 | case 1: |
61 | case 2: | 70 | case 2: |
62 | case 3: | 71 | case 3: |
63 | case 4: | 72 | case 4: |
64 | case 5: | 73 | case 5: |
65 | $result[$key]['unreceived'] = true; | 74 | $result[$key]['unreceived'] = true; |
75 | + //待收货状态,给查看物流url | ||
66 | $result[$key]['logisticsUrl'] = "暂无logisticsUrl数据"; | 76 | $result[$key]['logisticsUrl'] = "暂无logisticsUrl数据"; |
67 | break; | 77 | break; |
68 | case 6: | 78 | case 6: |
@@ -72,11 +82,11 @@ class OrderModel | @@ -72,11 +82,11 @@ class OrderModel | ||
72 | break; | 82 | break; |
73 | } | 83 | } |
74 | } elseif ($vo['payment_type'] == 2) { | 84 | } elseif ($vo['payment_type'] == 2) { |
75 | - //订单为货到付款订单时,订单没有未支付状态 | 85 | + //订单为货到付款订单时,计算订单状态。(货到付款没有待付款状态) |
76 | switch ($vo['status']) { | 86 | switch ($vo['status']) { |
77 | case 0 || 1 || 2 || 3 || 4 || 5: | 87 | case 0 || 1 || 2 || 3 || 4 || 5: |
78 | $result[$key]['unreceived'] = true; | 88 | $result[$key]['unreceived'] = true; |
79 | - //此处备注,接口没有返回logisticsUrl数据 | 89 | + //待收货状态,给查看物流url |
80 | $resault[$key]['logisticsUrl'] = "备注:暂无logisticsUrl数据"; | 90 | $resault[$key]['logisticsUrl'] = "备注:暂无logisticsUrl数据"; |
81 | break; | 91 | break; |
82 | case 6: | 92 | case 6: |
@@ -113,6 +123,7 @@ class OrderModel | @@ -113,6 +123,7 @@ class OrderModel | ||
113 | $arr[$key]['size'] = $vo['size_name']; | 123 | $arr[$key]['size'] = $vo['size_name']; |
114 | $arr[$key]['price'] = $vo['goods_price']; | 124 | $arr[$key]['price'] = $vo['goods_price']; |
115 | $arr[$key]['count'] = $vo['buy_number']; | 125 | $arr[$key]['count'] = $vo['buy_number']; |
126 | + //gift=>是否赠品,advanceBuy=>是否加价购; | ||
116 | if ($vo['goods_type'] == 'gift') { | 127 | if ($vo['goods_type'] == 'gift') { |
117 | $arr[$key]['gift'] = true; | 128 | $arr[$key]['gift'] = true; |
118 | } elseif ($vo['goods_type'] == 'price_gift') { | 129 | } elseif ($vo['goods_type'] == 'price_gift') { |
@@ -123,7 +134,7 @@ class OrderModel | @@ -123,7 +134,7 @@ class OrderModel | ||
123 | } | 134 | } |
124 | 135 | ||
125 | //根据type值设置nav属性 | 136 | //根据type值设置nav属性 |
126 | - public function getNavs($type) { | 137 | + static function getNavs($type) { |
127 | $nav = array( | 138 | $nav = array( |
128 | array( | 139 | array( |
129 | 'name' => '全部', | 140 | 'name' => '全部', |
@@ -176,6 +187,27 @@ class OrderModel | @@ -176,6 +187,27 @@ class OrderModel | ||
176 | } | 187 | } |
177 | 188 | ||
178 | //获得支付链接 | 189 | //获得支付链接 |
190 | + static function payment($gender, $yh_channel) { | ||
191 | + $code = self::CODE_PAYMENT; | ||
192 | + $data = OrderData::paymentData($gender, $yh_channel, $code); | ||
193 | + } | ||
179 | 194 | ||
195 | + //查看物流 | ||
196 | +// static function Logistics(){ | ||
197 | +// OrderData::LogisticsData(); | ||
198 | +// } | ||
199 | + //随便逛逛url获取 | ||
200 | + static function stroll($gender, $yh_channel) { | ||
201 | + //获取随便逛逛url资源码 | ||
202 | + $code = self::CODE_STROLL; | ||
203 | + //调用接口获得数据 | ||
204 | + $data = OrderData::strollData($gender, $yh_channel, $code); | ||
205 | + $stroll = 1; | ||
206 | + //检查数据返回是否正常,正常则处理数据 | ||
207 | + if ($data['code'] == 200) { | ||
208 | + $strollUrl = $data['data'][0]['data'][0]['url']; | ||
209 | + } | ||
210 | + return $strollUrl; | ||
211 | + } | ||
180 | 212 | ||
181 | } | 213 | } |
@@ -472,8 +472,17 @@ class UserModel | @@ -472,8 +472,17 @@ class UserModel | ||
472 | */ | 472 | */ |
473 | public static function saveSuggestData($uid, $content, $suggest_type) | 473 | public static function saveSuggestData($uid, $content, $suggest_type) |
474 | { | 474 | { |
475 | + $result = array('code' => 400, 'message' => '保存出错'); | ||
476 | + | ||
475 | // 调用接口保存意见反馈数据 | 477 | // 调用接口保存意见反馈数据 |
476 | - return UserData::savesuggestData($uid, $content, $suggest_type); | 478 | + $save = UserData::savesuggestData($uid, $content, $suggest_type); |
479 | + | ||
480 | + if (isset($save['code']) && $save['code'] == 200) { | ||
481 | + $result['code'] = 200; | ||
482 | + $result['message'] = '谢谢您的反馈'; | ||
483 | + } | ||
484 | + | ||
485 | + return $result; | ||
477 | } | 486 | } |
478 | 487 | ||
479 | /** | 488 | /** |
-
Please register or login to post a comment