Merge branch 'feature/home' into develop
Showing
20 changed files
with
237 additions
and
136 deletions
@@ -23,10 +23,7 @@ const fav = { | @@ -23,10 +23,7 @@ const fav = { | ||
23 | } | 23 | } |
24 | }, | 24 | }, |
25 | favpaging: (req, res, next) => { | 25 | favpaging: (req, res, next) => { |
26 | - let uid = req.user.uid; | ||
27 | - | ||
28 | - uid = 20000134; // 测试uid | ||
29 | - | 26 | + const uid = req.user.uid || 14459668; |
30 | const tab = req.query.tab; | 27 | const tab = req.query.tab; |
31 | const page = req.query.page; | 28 | const page = req.query.page; |
32 | 29 | ||
@@ -43,10 +40,7 @@ const fav = { | @@ -43,10 +40,7 @@ const fav = { | ||
43 | } | 40 | } |
44 | }, | 41 | }, |
45 | deletefav: (req, res, next) => { | 42 | deletefav: (req, res, next) => { |
46 | - let uid = req.user.uid; | ||
47 | - | ||
48 | - uid = 20000134; // 测试uid | ||
49 | - | 43 | + const uid = req.user.uid || 14459668; |
50 | const favId = req.body.favId; | 44 | const favId = req.body.favId; |
51 | const type = req.body.type; | 45 | const type = req.body.type; |
52 | 46 |
@@ -13,9 +13,7 @@ const helpers = global.yoho.helpers; | @@ -13,9 +13,7 @@ const helpers = global.yoho.helpers; | ||
13 | */ | 13 | */ |
14 | const component = { | 14 | const component = { |
15 | index: (req, res, next) => { | 15 | index: (req, res, next) => { |
16 | - let uid = req.user.uid; | ||
17 | - | ||
18 | - uid = 8050378; // 测试uid | 16 | + const uid = req.user.uid || 14459668; |
19 | 17 | ||
20 | if (!uid && req.xhr) { | 18 | if (!uid && req.xhr) { |
21 | return res.json({ | 19 | return res.json({ |
@@ -29,13 +27,10 @@ const component = { | @@ -29,13 +27,10 @@ const component = { | ||
29 | const result = { | 27 | const result = { |
30 | module: 'home', | 28 | module: 'home', |
31 | page: 'index', | 29 | page: 'index', |
32 | - noLocalJS: true, | ||
33 | noLocalCSS: true, | 30 | noLocalCSS: true, |
34 | head_ico: proData && proData.head_ico ? helpers.image(proData.head_ico, 200, 200) : '', | 31 | head_ico: proData && proData.head_ico ? helpers.image(proData.head_ico, 200, 200) : '', |
35 | profile_name: proData ? proData.profile_name : '登录/注册', | 32 | profile_name: proData ? proData.profile_name : '登录/注册', |
36 | - userinfourl: proData ? '/home/mydetails' : helpers.urlFormat('/signin.html', { | ||
37 | - refer: req.originalUrl | ||
38 | - }), | 33 | + userinfourl: proData ? '/home/mydetails' : '', |
39 | serviceUrl: 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&' | 34 | serviceUrl: 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&' |
40 | }; | 35 | }; |
41 | 36 | ||
@@ -43,9 +38,7 @@ const component = { | @@ -43,9 +38,7 @@ const component = { | ||
43 | }).catch(next); | 38 | }).catch(next); |
44 | }, | 39 | }, |
45 | mydetails: (req, res) => { | 40 | mydetails: (req, res) => { |
46 | - let uid = req.user.uid; | ||
47 | - | ||
48 | - uid = 14459668; // 测试uid | 41 | + const uid = req.user.uid || 14459668; |
49 | 42 | ||
50 | homeModel.getUserProfileData(uid).then(data => { | 43 | homeModel.getUserProfileData(uid).then(data => { |
51 | res.render('mydetails', { | 44 | res.render('mydetails', { |
@@ -56,7 +49,7 @@ const component = { | @@ -56,7 +49,7 @@ const component = { | ||
56 | gender: data.gender === '1' ? 'men' : 'women', | 49 | gender: data.gender === '1' ? 'men' : 'women', |
57 | birthday: data.birthday | 50 | birthday: data.birthday |
58 | }); | 51 | }); |
59 | - }) | 52 | + }); |
60 | }, | 53 | }, |
61 | help: (req, res, next) => { | 54 | help: (req, res, next) => { |
62 | homeModel.getHelpInfo().then(helpList => { | 55 | homeModel.getHelpInfo().then(helpList => { |
@@ -91,11 +84,11 @@ const component = { | @@ -91,11 +84,11 @@ const component = { | ||
91 | page: 'feedback', | 84 | page: 'feedback', |
92 | suggestSub: true, | 85 | suggestSub: true, |
93 | noLocalCSS: true | 86 | noLocalCSS: true |
94 | - }) | 87 | + }); |
95 | }, | 88 | }, |
96 | saveFeedback: (req, res, next) => { | 89 | saveFeedback: (req, res, next) => { |
97 | let saveFeedbackPara = { | 90 | let saveFeedbackPara = { |
98 | - uid: '13549737', | 91 | + uid: '14459668', |
99 | content: req.body.content, | 92 | content: req.body.content, |
100 | suggest_type: 2 | 93 | suggest_type: 2 |
101 | }; | 94 | }; |
@@ -113,8 +106,6 @@ const component = { | @@ -113,8 +106,6 @@ const component = { | ||
113 | } | 106 | } |
114 | 107 | ||
115 | homeModel.saveFeedback(saveFeedbackPara).then(result => { | 108 | homeModel.saveFeedback(saveFeedbackPara).then(result => { |
116 | - console.log(result); | ||
117 | - | ||
118 | if (result.code === 200) { | 109 | if (result.code === 200) { |
119 | return res.json({ | 110 | return res.json({ |
120 | code: 200, | 111 | code: 200, |
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | const orderModel = require('../models/order'); | 7 | const orderModel = require('../models/order'); |
8 | const notLoginCode = 400; | 8 | const notLoginCode = 400; |
9 | const notLoginTip = '抱歉,您暂未登录!'; | 9 | const notLoginTip = '抱歉,您暂未登录!'; |
10 | -const testUid = 8050378;// 测试uid | 10 | +const testUid = 8041886;// 8039836; //8050882;// 测试uid |
11 | const isBLK = 1; | 11 | const isBLK = 1; |
12 | 12 | ||
13 | const order = { | 13 | const order = { |
@@ -44,7 +44,7 @@ const order = { | @@ -44,7 +44,7 @@ const order = { | ||
44 | let page = req.query.page; | 44 | let page = req.query.page; |
45 | let type = req.query.type; | 45 | let type = req.query.type; |
46 | let limit = req.query.limit; | 46 | let limit = req.query.limit; |
47 | - let isend = true; | 47 | + let isEnd = true; |
48 | 48 | ||
49 | uid = testUid; | 49 | uid = testUid; |
50 | if (!uid && req.xhr) { | 50 | if (!uid && req.xhr) { |
@@ -62,10 +62,10 @@ const order = { | @@ -62,10 +62,10 @@ const order = { | ||
62 | }; | 62 | }; |
63 | 63 | ||
64 | orderModel.getOrders(param).then(result => { | 64 | orderModel.getOrders(param).then(result => { |
65 | - if (result && page < result.page_total) { | ||
66 | - isend = false; | 65 | + if (result && page < result.data.pageTotal) { |
66 | + isEnd = false; | ||
67 | } | 67 | } |
68 | - return res.json(Object.assign({isend: isend}, result)); | 68 | + return res.json(Object.assign({isEnd: isEnd}, result)); |
69 | }); | 69 | }); |
70 | }, | 70 | }, |
71 | getOrderDetailData: (req, res) => { | 71 | getOrderDetailData: (req, res) => { |
@@ -122,7 +122,10 @@ const order = { | @@ -122,7 +122,10 @@ const order = { | ||
122 | coin: (req, res, next) => { | 122 | coin: (req, res, next) => { |
123 | let uid = req.user.id; | 123 | let uid = req.user.id; |
124 | 124 | ||
125 | + uid = testUid; | ||
126 | + | ||
125 | orderModel.getCoins(uid).then(result => { | 127 | orderModel.getCoins(uid).then(result => { |
128 | + // console.log(result) | ||
126 | res.render('coin', { | 129 | res.render('coin', { |
127 | module: 'home', | 130 | module: 'home', |
128 | page: 'coin', | 131 | page: 'coin', |
@@ -24,7 +24,7 @@ const _ = require('lodash'); | @@ -24,7 +24,7 @@ const _ = require('lodash'); | ||
24 | exports.getOrders = (param) => { | 24 | exports.getOrders = (param) => { |
25 | param = Object.assign({method: 'app.SpaceOrders.get'}, param); | 25 | param = Object.assign({method: 'app.SpaceOrders.get'}, param); |
26 | 26 | ||
27 | - return api.get('978c6bad6c379086.json', param).then(camelCase); | 27 | + return api.get('', param).then(camelCase); |
28 | }; | 28 | }; |
29 | 29 | ||
30 | /** | 30 | /** |
@@ -34,7 +34,7 @@ exports.getOrders = (param) => { | @@ -34,7 +34,7 @@ exports.getOrders = (param) => { | ||
34 | * @returns {Promise.<T>|*} | 34 | * @returns {Promise.<T>|*} |
35 | */ | 35 | */ |
36 | exports.getOrderDetail = (uid, orderCode) => { | 36 | exports.getOrderDetail = (uid, orderCode) => { |
37 | - return api.get('621e0b505983ac8a.json', { | 37 | + return api.get('', { |
38 | method: 'app.SpaceOrders.detail', | 38 | method: 'app.SpaceOrders.detail', |
39 | order_code: orderCode, | 39 | order_code: orderCode, |
40 | uid: uid | 40 | uid: uid |
@@ -127,9 +127,9 @@ exports.getOrderLogisticdate = (params) => { | @@ -127,9 +127,9 @@ exports.getOrderLogisticdate = (params) => { | ||
127 | * @returns {*|Promise.<T>} | 127 | * @returns {*|Promise.<T>} |
128 | */ | 128 | */ |
129 | exports.getCoins = (uid) => { | 129 | exports.getCoins = (uid) => { |
130 | - return api.get('978c6bad6c379086.json', { | 130 | + return api.get('', { |
131 | uid: uid, | 131 | uid: uid, |
132 | - app_type: 'app.yohocoin.total' | 132 | + method: 'app.yohocoin.total' |
133 | }).then(camelCase); | 133 | }).then(camelCase); |
134 | }; | 134 | }; |
135 | 135 | ||
@@ -141,7 +141,7 @@ exports.getCoins = (uid) => { | @@ -141,7 +141,7 @@ exports.getCoins = (uid) => { | ||
141 | * @returns {*|Promise.<T>} | 141 | * @returns {*|Promise.<T>} |
142 | */ | 142 | */ |
143 | exports.getCoinDetail = (uid, page, limit) => { | 143 | exports.getCoinDetail = (uid, page, limit) => { |
144 | - return api.get('26573a88a2958702.json', { | 144 | + return api.get('', { |
145 | uid: uid, | 145 | uid: uid, |
146 | page: page, | 146 | page: page, |
147 | limit: limit, | 147 | limit: limit, |
1 | <div class="my-page"> | 1 | <div class="my-page"> |
2 | <div class="my-header"> | 2 | <div class="my-header"> |
3 | - <a class="user-info" href={{userinfourl}}> | 3 | + <a class="user-info" id="user-info" {{#if userinfourl}} href='{{userinfourl}}' {{/if}}> |
4 | <span class="user-avatar" {{#if head_ico}} style="background-image: url('{{head_ico}}');" {{/if}}></span> | 4 | <span class="user-avatar" {{#if head_ico}} style="background-image: url('{{head_ico}}');" {{/if}}></span> |
5 | <br><span class="username">{{profile_name}}</span> | 5 | <br><span class="username">{{profile_name}}</span> |
6 | </a> | 6 | </a> |
7 | </div> | 7 | </div> |
8 | <div class="my-order"> | 8 | <div class="my-order"> |
9 | - <a class="order-title" href="/home/orders"> | 9 | + <a class="order-title" href="/home/orders?type=1"> |
10 | 我的订单 | 10 | 我的订单 |
11 | <span class="read-order"> | 11 | <span class="read-order"> |
12 | 查看全部订单 <span class="icon icon-right"></span> | 12 | 查看全部订单 <span class="icon icon-right"></span> |
@@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
44 | </div> | 44 | </div> |
45 | </div> | 45 | </div> |
46 | <div class="group-list"> | 46 | <div class="group-list"> |
47 | - <a class="list-item" href="/home/address"> | 47 | + <a class="list-item" id="address"> |
48 | 地址管理 | 48 | 地址管理 |
49 | <span class="num">{{address_num}} <span class="icon icon-right"></span></span> | 49 | <span class="num">{{address_num}} <span class="icon icon-right"></span></span> |
50 | </a> | 50 | </a> |
doraemon/views/layout.hbs
deleted
100644 → 0
1 | -<!DOCTYPE html> | ||
2 | -<html> | ||
3 | - <head> | ||
4 | - <meta charset="utf-8"> | ||
5 | - <title>{{title}} {{#unless noYohoTitle}}{{yohoTitle}}{{/unless}}</title> | ||
6 | - <meta name="keywords" content="{{keywords}}"> | ||
7 | - <meta name="description" content="{{description}}"> | ||
8 | - <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> | ||
9 | - <meta name="apple-mobile-web-app-status-bar-style" content="black"> | ||
10 | - <meta content="telephone=no" name="format-detection"> | ||
11 | - <meta content="email=no" name="format-detection"> | ||
12 | - <link rel="dns-prefetch" href="//cdn.yoho.cn"> | ||
13 | - <link rel="dns-prefetch" href="//static.yohobuy.com"> | ||
14 | - <script type="text/javascript"> | ||
15 | - (function(d,c){var e=d.documentElement,a="orientationchange" in window?"orientationchange":"resize",b=function(){var f=e.clientWidth;if(!f){return}if(f>=750){e.style.fontSize="40px"}else{e.style.fontSize=40*(f/750)+"px"}};if(!d.addEventListener){return}b();c.addEventListener(a,b,false);d.addEventListener("DOMContentLoaded",b,false)})(document,window); | ||
16 | - </script> | ||
17 | - {{#if devEnv}} | ||
18 | - <link rel="stylesheet" href="//localhost:5004/css/index.css"> | ||
19 | - {{#unless noLocalCSS}} | ||
20 | - <link rel="stylesheet" href="//localhost:5004/{{module}}.{{page}}.css"> | ||
21 | - {{/unless}} | ||
22 | - {{^}} | ||
23 | - <link rel="stylesheet" href="//cdn.yoho.cn/yohoblk-wap/{{version}}/index.css"> | ||
24 | - {{#unless noLocalCSS}} | ||
25 | - <link rel="stylesheet" href="//cdn.yoho.cn/yohoblk-wap/{{version}}/{{module}}.{{page}}.css"> | ||
26 | - {{/unless}} | ||
27 | - {{/if}} | ||
28 | - </head> | ||
29 | - <body {{#if isPassportPage}}class=passport-body{{/if}} {{#if isStarIndexPage}} class="star-index-bg"{{/if}} {{#if isStarDetailPage}}class="star-class-body"{{/if}}> | ||
30 | - <div class="main-wrap"> | ||
31 | - {{{body}}} | ||
32 | - </div> | ||
33 | - | ||
34 | - {{#wechatShare}} | ||
35 | - <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script> | ||
36 | - {{/wechatShare}} | ||
37 | - {{#if devEnv}} | ||
38 | - <script src="//localhost:5004/libs.js"></script> | ||
39 | - {{#unless noLocalJS}} | ||
40 | - <script src="//localhost:5004/{{module}}.{{page}}.js"></script> | ||
41 | - {{/unless}} | ||
42 | - {{^}} | ||
43 | - <script src="//cdn.yoho.cn/yohoblk-wap/{{version}}/libs.js"></script> | ||
44 | - {{#unless noLocalJS}} | ||
45 | - <script src="//cdn.yoho.cn/yohoblk-wap/{{version}}/{{module}}.{{page}}.js"></script> | ||
46 | - {{/unless}} | ||
47 | - {{/if}} | ||
48 | - {{#unless devEnv}} | ||
49 | - {{> analysis}} | ||
50 | - {{/unless}} | ||
51 | - </body> | ||
52 | -</html> |
public/img/home/fav/fav-del-btn.png
deleted
100644 → 0
1.02 KB
This diff could not be displayed because it is too large.
public/js/common/count-down.js
0 → 100644
1 | +/** | ||
2 | + * countDown.js. | ||
3 | + * @author hgwang | ||
4 | + * @date 2016-07-27 | ||
5 | + */ | ||
6 | +'use strict'; | ||
7 | +let Vue = require('yoho-vue'); | ||
8 | + | ||
9 | +Vue.directive('countDown', { | ||
10 | + acceptStatement: true, | ||
11 | + params: ['left-time', 'callback', 'end-time'], | ||
12 | + update: function() { | ||
13 | + // 结束时间 | ||
14 | + let value = this.params.endTime || 0; | ||
15 | + let callbackFn = this.params.callback; | ||
16 | + | ||
17 | + // 如果不为0的话根据剩余的秒数计算时间 | ||
18 | + let leftTime = parseInt(this.params.leftTime); | ||
19 | + let newValue; | ||
20 | + | ||
21 | + if (leftTime !== 0) { | ||
22 | + newValue = new Date() - 0 + leftTime * 1000; | ||
23 | + } else { | ||
24 | + if (value) { | ||
25 | + newValue = value.replace(/-/g, '/').substring(0, 19); | ||
26 | + } else { | ||
27 | + return ''; | ||
28 | + } | ||
29 | + } | ||
30 | + | ||
31 | + if (new Date(newValue) === 'Invalid Date') { | ||
32 | + return console.error('The param of directive "v-time-down" must be a date string!'); | ||
33 | + } | ||
34 | + let timerSS = null; | ||
35 | + let el = this.el; | ||
36 | + let hDom = document.createElement('span'); | ||
37 | + | ||
38 | + hDom.setAttribute('class', 'timeDown-H'); | ||
39 | + | ||
40 | + el.appendChild(hDom); | ||
41 | + | ||
42 | + let last = 0; | ||
43 | + | ||
44 | + function format(val) { | ||
45 | + let result = '00:00:00'; | ||
46 | + | ||
47 | + if (val === 0) { | ||
48 | + return result; | ||
49 | + } | ||
50 | + let h = parseInt(val / 3600); | ||
51 | + let m = parseInt((val - h * 3600) / 60); | ||
52 | + let s = parseInt(val - h * 3600 - m * 60); | ||
53 | + | ||
54 | + h = h < 10 ? '0' + h : h; | ||
55 | + m = m < 10 ? '0' + m : m; | ||
56 | + s = s < 10 ? '0' + s : s; | ||
57 | + if (h === 0) { | ||
58 | + result = m + ':' + s; | ||
59 | + } else { | ||
60 | + result = h + ':' + m + ':' + s; | ||
61 | + } | ||
62 | + return result; | ||
63 | + } | ||
64 | + | ||
65 | + function countdown() { | ||
66 | + last = (new Date(newValue)).getTime() - (new Date()).getTime(); | ||
67 | + last = last / 1000; | ||
68 | + if (last <= 0) { | ||
69 | + clearInterval(timerSS); | ||
70 | + last = 0; | ||
71 | + callbackFn && callbackFn(); | ||
72 | + } | ||
73 | + el.querySelector('.timeDown-H').innerHTML = format(last); | ||
74 | + } | ||
75 | + | ||
76 | + countdown(); | ||
77 | + timerSS = setInterval(countdown, 1000); | ||
78 | + } | ||
79 | +}); |
@@ -69,7 +69,7 @@ Vue.filter('goodsUrl', productId => { | @@ -69,7 +69,7 @@ Vue.filter('goodsUrl', productId => { | ||
69 | Vue.filter('convertOrderState', (value) => { | 69 | Vue.filter('convertOrderState', (value) => { |
70 | let stateTxt = ''; | 70 | let stateTxt = ''; |
71 | 71 | ||
72 | - if (typeof value === 'undefined') { | 72 | + if (typeof value !== 'undefined') { |
73 | value = parseInt(value, 10); | 73 | value = parseInt(value, 10); |
74 | } | 74 | } |
75 | switch (value) { | 75 | switch (value) { |
public/js/home/index.page.js
0 → 100644
1 | +var yoho = require('yoho'); | ||
2 | +var $ = require('yoho-jquery'); | ||
3 | +var interceptClick = require('common/intercept-click'); | ||
4 | + | ||
5 | +$('.my-page').on('click', 'a', function() { | ||
6 | + // 拦截跳转 | ||
7 | + var href = $(this).attr('href'); | ||
8 | + if (href) { | ||
9 | + interceptClick(href); | ||
10 | + return false; | ||
11 | + } | ||
12 | +}); | ||
13 | + | ||
14 | +// 跳转登录页 | ||
15 | +$('#user-info').on('click', function() { | ||
16 | + var href = $(this).attr('href'); | ||
17 | + if (!href) { | ||
18 | + yoho.goLogin(); | ||
19 | + } | ||
20 | +}) | ||
21 | + | ||
22 | +// 地址管理 | ||
23 | +$('#address').on('click', function() { | ||
24 | + yoho.goAddress({ | ||
25 | + 'type': '2' | ||
26 | + }); | ||
27 | +}); |
@@ -9,6 +9,7 @@ const Vue = require('yoho-vue'); | @@ -9,6 +9,7 @@ const Vue = require('yoho-vue'); | ||
9 | const OrderDetail = require('home/order-detail.vue'); | 9 | const OrderDetail = require('home/order-detail.vue'); |
10 | 10 | ||
11 | require('common/vue-filter'); | 11 | require('common/vue-filter'); |
12 | +require('common/count-down'); | ||
12 | 13 | ||
13 | new Vue({ | 14 | new Vue({ |
14 | el: '#order-detail', | 15 | el: '#order-detail', |
@@ -12,6 +12,7 @@ const infiniteScroll = require('yoho-vue-infinite-scroll'); | @@ -12,6 +12,7 @@ const infiniteScroll = require('yoho-vue-infinite-scroll'); | ||
12 | Vue.use(infiniteScroll); | 12 | Vue.use(infiniteScroll); |
13 | 13 | ||
14 | require('common/vue-filter'); | 14 | require('common/vue-filter'); |
15 | +require('common/count-down'); | ||
15 | 16 | ||
16 | new Vue({ | 17 | new Vue({ |
17 | el: '#home-order-list', | 18 | el: '#home-order-list', |
1 | $black: #000; | 1 | $black: #000; |
2 | $white: #fff; | 2 | $white: #fff; |
3 | 3 | ||
4 | +html, | ||
5 | +body { | ||
6 | + height: 100%; | ||
7 | +} | ||
8 | + | ||
4 | .main-wrap { | 9 | .main-wrap { |
10 | + height: 100%; | ||
5 | background: #f6f6f6; | 11 | background: #f6f6f6; |
6 | } | 12 | } |
7 | 13 | ||
8 | .order-detail { | 14 | .order-detail { |
15 | + padding-bottom: 170px; | ||
9 | 16 | ||
10 | > div { | 17 | > div { |
11 | background: $white; | 18 | background: $white; |
@@ -152,7 +159,7 @@ $white: #fff; | @@ -152,7 +159,7 @@ $white: #fff; | ||
152 | 159 | ||
153 | label { | 160 | label { |
154 | display: inline-block; | 161 | display: inline-block; |
155 | - width: 150px; | 162 | + width: 180px; |
156 | text-align: left; | 163 | text-align: left; |
157 | color: #b0b0b0; | 164 | color: #b0b0b0; |
158 | } | 165 | } |
@@ -14,13 +14,14 @@ | @@ -14,13 +14,14 @@ | ||
14 | <span class="down" v-if="item.down">品牌已下架</span> | 14 | <span class="down" v-if="item.down">品牌已下架</span> |
15 | </div> | 15 | </div> |
16 | </a> | 16 | </a> |
17 | - <div class="fav-del-right" id="del-{{$index}}" @click="delItem($index, item.fav_id)"> | ||
18 | - <span class="fav-del-btn"></span> | 17 | + <div class="fav-del-right hide" id="del-{{$index}}" @click="delItem($index, item.fav_id)"> |
18 | + <span class="icon icon-delete"></span> | ||
19 | <br/> | 19 | <br/> |
20 | <span class="fav-del-txt">删除</span> | 20 | <span class="fav-del-txt">删除</span> |
21 | </div> | 21 | </div> |
22 | </li> | 22 | </li> |
23 | </ul> | 23 | </ul> |
24 | + | ||
24 | <div class="fav-null-box {{ nullbox }}"> | 25 | <div class="fav-null-box {{ nullbox }}"> |
25 | <span class="fav-null">您暂无收藏任何品牌</span> | 26 | <span class="fav-null">您暂无收藏任何品牌</span> |
26 | <a slot="go-shopping" class="go-shopping" :href="brandUrl">随便逛逛</a> | 27 | <a slot="go-shopping" class="go-shopping" :href="brandUrl">随便逛逛</a> |
@@ -84,10 +85,12 @@ | @@ -84,10 +85,12 @@ | ||
84 | let width = delBtn.width(); | 85 | let width = delBtn.width(); |
85 | 86 | ||
86 | $('#li-' + index).css('transform', 'translateX(-' + width + 'px)'); | 87 | $('#li-' + index).css('transform', 'translateX(-' + width + 'px)'); |
88 | + delBtn.removeClass('hide'); | ||
87 | }, | 89 | }, |
88 | hideDelBth() { | 90 | hideDelBth() { |
89 | this.brandData.forEach(function(d, index) { | 91 | this.brandData.forEach(function(d, index) { |
90 | $('#li-' + index).css('transform', 'translateX(0px)'); | 92 | $('#li-' + index).css('transform', 'translateX(0px)'); |
93 | + $('#del-' + index).addClass('hide'); | ||
91 | }); | 94 | }); |
92 | }, | 95 | }, |
93 | delItem(index, id) { | 96 | delItem(index, id) { |
@@ -134,7 +137,6 @@ | @@ -134,7 +137,6 @@ | ||
134 | li { | 137 | li { |
135 | height: 135px; | 138 | height: 135px; |
136 | overflow: hidden; | 139 | overflow: hidden; |
137 | - margin-top: 20px; | ||
138 | border-bottom: 1px solid #e0e0e0; | 140 | border-bottom: 1px solid #e0e0e0; |
139 | } | 141 | } |
140 | 142 | ||
@@ -168,22 +170,24 @@ | @@ -168,22 +170,24 @@ | ||
168 | right: -126px; | 170 | right: -126px; |
169 | background: #ff3b30; | 171 | background: #ff3b30; |
170 | width: 126px; | 172 | width: 126px; |
171 | - height: 125px; | 173 | + height: 100%; |
172 | text-align: center; | 174 | text-align: center; |
173 | 175 | ||
174 | - .fav-del-btn { | 176 | + .icon-delete { |
175 | display: inline-block; | 177 | display: inline-block; |
176 | - width: 35px; | ||
177 | - height: 43px; | 178 | + color: white; |
179 | + font-size: 35px; | ||
178 | margin-top: 30px; | 180 | margin-top: 30px; |
179 | - background: resolve("home/fav/fav-del-btn.png"); | ||
180 | - background-size: 100%; | ||
181 | } | 181 | } |
182 | 182 | ||
183 | .fav-del-txt { | 183 | .fav-del-txt { |
184 | font-size: 24px; | 184 | font-size: 24px; |
185 | color: #fff; | 185 | color: #fff; |
186 | } | 186 | } |
187 | + | ||
188 | + .hide { | ||
189 | + display: none; | ||
190 | + } | ||
187 | } | 191 | } |
188 | 192 | ||
189 | .fav-img-box { | 193 | .fav-img-box { |
@@ -243,7 +247,7 @@ | @@ -243,7 +247,7 @@ | ||
243 | display: block; | 247 | display: block; |
244 | width: 188px; | 248 | width: 188px; |
245 | height: 171px; | 249 | height: 171px; |
246 | - background: resolve("home/fav/fav-null.png"); | 250 | + background: resolve("home/fav-null.png"); |
247 | background-size: 100% 100%; | 251 | background-size: 100% 100%; |
248 | margin: 0 auto 45px; | 252 | margin: 0 auto 45px; |
249 | } | 253 | } |
@@ -22,8 +22,8 @@ | @@ -22,8 +22,8 @@ | ||
22 | </div> | 22 | </div> |
23 | </div> | 23 | </div> |
24 | </a> | 24 | </a> |
25 | - <div class="fav-del-right" id="del-{{$index}}" @click="delItem($index, item.fav_id)"> | ||
26 | - <span class="fav-del-btn"></span> | 25 | + <div class="fav-del-right hide" id="del-{{$index}}" @click="delItem($index, item.fav_id)"> |
26 | + <span class="icon icon-delete"></span> | ||
27 | <br/> | 27 | <br/> |
28 | <span class="fav-del-txt">删除</span> | 28 | <span class="fav-del-txt">删除</span> |
29 | </div> | 29 | </div> |
@@ -91,10 +91,12 @@ | @@ -91,10 +91,12 @@ | ||
91 | let width = delBtn.width(); | 91 | let width = delBtn.width(); |
92 | 92 | ||
93 | $('#li-' + index).css('transform', 'translateX(-' + width + 'px)'); | 93 | $('#li-' + index).css('transform', 'translateX(-' + width + 'px)'); |
94 | + delBtn.removeClass('hide'); | ||
94 | }, | 95 | }, |
95 | hideDelBth() { | 96 | hideDelBth() { |
96 | this.productData.forEach(function(d, index) { | 97 | this.productData.forEach(function(d, index) { |
97 | $('#li-' + index).css('transform', 'translateX(0px)'); | 98 | $('#li-' + index).css('transform', 'translateX(0px)'); |
99 | + $('#del-' + index).addClass('hide'); | ||
98 | }); | 100 | }); |
99 | }, | 101 | }, |
100 | delItem(index, id) { | 102 | delItem(index, id) { |
@@ -141,7 +143,6 @@ | @@ -141,7 +143,6 @@ | ||
141 | li { | 143 | li { |
142 | height: 205px; | 144 | height: 205px; |
143 | overflow: hidden; | 145 | overflow: hidden; |
144 | - margin-top: 20px; | ||
145 | } | 146 | } |
146 | 147 | ||
147 | .fav-del-left { | 148 | .fav-del-left { |
@@ -177,19 +178,21 @@ | @@ -177,19 +178,21 @@ | ||
177 | height: 200px; | 178 | height: 200px; |
178 | text-align: center; | 179 | text-align: center; |
179 | 180 | ||
180 | - .fav-del-btn { | 181 | + .icon-delete { |
181 | display: inline-block; | 182 | display: inline-block; |
182 | - width: 35px; | ||
183 | - height: 43px; | ||
184 | - margin-top: 50px; | ||
185 | - background: resolve("home/fav/fav-del-btn.png"); | ||
186 | - background-size: 100%; | 183 | + color: white; |
184 | + font-size: 35px; | ||
185 | + margin-top: 55px; | ||
187 | } | 186 | } |
188 | 187 | ||
189 | .fav-del-txt { | 188 | .fav-del-txt { |
190 | font-size: 24px; | 189 | font-size: 24px; |
191 | color: #fff; | 190 | color: #fff; |
192 | } | 191 | } |
192 | + | ||
193 | + .hide { | ||
194 | + display: none; | ||
195 | + } | ||
193 | } | 196 | } |
194 | 197 | ||
195 | .fav-img-box { | 198 | .fav-img-box { |
@@ -211,7 +214,6 @@ | @@ -211,7 +214,6 @@ | ||
211 | font-size: 24px; | 214 | font-size: 24px; |
212 | border-bottom: 1px solid #e0e0e0; | 215 | border-bottom: 1px solid #e0e0e0; |
213 | padding-bottom: 20px; | 216 | padding-bottom: 20px; |
214 | - margin-right: 5px; | ||
215 | height: 203px; | 217 | height: 203px; |
216 | overflow: hidden; | 218 | overflow: hidden; |
217 | position: relative; | 219 | position: relative; |
@@ -269,7 +271,7 @@ | @@ -269,7 +271,7 @@ | ||
269 | display: block; | 271 | display: block; |
270 | width: 188px; | 272 | width: 188px; |
271 | height: 171px; | 273 | height: 171px; |
272 | - background: resolve("home/fav/fav-null.png"); | 274 | + background: resolve("home/fav-null.png"); |
273 | background-size: 100% 100%; | 275 | background-size: 100% 100%; |
274 | margin: 0 auto 45px; | 276 | margin: 0 auto 45px; |
275 | } | 277 | } |
1 | <template> | 1 | <template> |
2 | <div class="order-status"> | 2 | <div class="order-status"> |
3 | <p>{{order.status | convertOrderState}}</p> | 3 | <p>{{order.status | convertOrderState}}</p> |
4 | - <p v-if="order.status == 0">剩余: 订单将被取消</p> | 4 | + <p v-if="order.status == 0 && order.payLefttime != 0">剩余: <span v-count-down v-bind:left-time="order.payLefttime"></span>,订单将被取消</p> |
5 | </div> | 5 | </div> |
6 | <div class="order-address"> | 6 | <div class="order-address"> |
7 | - <p><span>{{order.userName}}</span><span>{{order.phone}}</span></p> | 7 | + <p><span>{{order.userName}}</span><span>{{order.mobile}}</span></p> |
8 | <p>{{order.area}} <br>{{order.address}}</p> | 8 | <p>{{order.area}} <br>{{order.address}}</p> |
9 | </div> | 9 | </div> |
10 | <div class="order-code"> | 10 | <div class="order-code"> |
@@ -34,15 +34,15 @@ | @@ -34,15 +34,15 @@ | ||
34 | </div> | 34 | </div> |
35 | <div class="order-amount"> | 35 | <div class="order-amount"> |
36 | <ul> | 36 | <ul> |
37 | - <li><label>商品:</label><span>{{order.goodsTotalAmount}}</span></li> | ||
38 | - <li><label>YOHO币:</label><span>{{order.yohoCoinNum}}</span></li> | ||
39 | - <li><label>运费:</label><span>{{order.shippingCost}}</span></li> | ||
40 | - <li><label>总计:</label><span>¥{{order.paymentAmount}}</span></li> | 37 | + <li v-for="promotion in order.promotionFormulas"> |
38 | + <label>{{promotion.promotion}}:</label><span>{{promotion.promotionAmount}}</span> | ||
39 | + </li> | ||
40 | + <li><label>总计:</label><span>{{order.amount}}</span></li> | ||
41 | </ul> | 41 | </ul> |
42 | </div> | 42 | </div> |
43 | - <div class="order-button"> | 43 | + <div class="order-button" v-show="order.status != 1 && order.status != 2 && order.status != 3"> |
44 | <button v-if="order.status == 0" @click="cancelOrder(order.orderCode)">取消订单</button> | 44 | <button v-if="order.status == 0" @click="cancelOrder(order.orderCode)">取消订单</button> |
45 | - <button v-if="order.status == 0 " class="countdown" @click="goBuy()">去支付 11:58:12</button> | 45 | + <button v-if="order.status == 0 " class="countdown" @click="goBuy(order.orderCode)">去支付 <span v-count-down v-bind:left-time="order.payLefttime" v-bind:callback="autoCancel(order.orderCode)"></span></button> |
46 | <button v-if="order.status == 4 || order.status == 5 ">查看物流</button> | 46 | <button v-if="order.status == 4 || order.status == 5 ">查看物流</button> |
47 | <button v-if="order.status == 4 || order.status == 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button> | 47 | <button v-if="order.status == 4 || order.status == 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button> |
48 | <button v-if="order.status == 6" @click="deleteOrder(order,index)">删除订单</button> | 48 | <button v-if="order.status == 6" @click="deleteOrder(order,index)">删除订单</button> |
@@ -55,6 +55,7 @@ | @@ -55,6 +55,7 @@ | ||
55 | const $ = require('yoho-jquery'); | 55 | const $ = require('yoho-jquery'); |
56 | const tip = require('common/tip'); | 56 | const tip = require('common/tip'); |
57 | const Modal = require('common/modal'); | 57 | const Modal = require('common/modal'); |
58 | + const yohoAPI = require('yoho'); | ||
58 | 59 | ||
59 | module.exports = { | 60 | module.exports = { |
60 | data() { | 61 | data() { |
@@ -73,28 +74,50 @@ | @@ -73,28 +74,50 @@ | ||
73 | orderCode: this.$parent.$data.orderCode | 74 | orderCode: this.$parent.$data.orderCode |
74 | } | 75 | } |
75 | }).then(result => { | 76 | }).then(result => { |
76 | - if (result) { | 77 | + if (result.code === 200) { |
77 | this.$set('order', result.data); | 78 | this.$set('order', result.data); |
79 | + } else { | ||
80 | + tip(result.message); | ||
78 | } | 81 | } |
79 | }).fail(() => { | 82 | }).fail(() => { |
80 | tip('网络错误'); | 83 | tip('网络错误'); |
81 | }); | 84 | }); |
82 | }, | 85 | }, |
83 | - cancelOrder(code) { | ||
84 | - Modal.confirm('订单取消后不能恢复,确认取消订单吗?', '', function() { | 86 | + orderDetail() { |
87 | + return { | ||
88 | + cancel(code, success, fail) { | ||
85 | $.ajax({ | 89 | $.ajax({ |
86 | url: '/home/cancel-order', | 90 | url: '/home/cancel-order', |
87 | type: 'post', | 91 | type: 'post', |
88 | data: { | 92 | data: { |
89 | orderCode: code | 93 | orderCode: code |
90 | } | 94 | } |
91 | - }).then(result => { | 95 | + }).then(success).fail(fail); |
96 | + } | ||
97 | + }; | ||
98 | + }, | ||
99 | + autoCancel(code) { | ||
100 | + let _that = this; | ||
101 | + | ||
102 | + return () => { | ||
103 | + _that.orderDetail().cancel(code, (result) => { | ||
92 | if (result.code === 200) { | 104 | if (result.code === 200) { |
93 | - location.href = '/home/orders'; | 105 | + location.href = '/home/orders?type=2'; |
106 | + } | ||
107 | + }); | ||
108 | + }; | ||
109 | + }, | ||
110 | + cancelOrder(code) { | ||
111 | + let _that = this; | ||
112 | + | ||
113 | + Modal.confirm('订单取消后不能恢复,确认取消订单吗?', '', function() { | ||
114 | + _that.orderDetail().cancel(code, (result) => { | ||
115 | + if (result.code === 200) { | ||
116 | + location.href = '/home/orders?type=2'; | ||
94 | } else { | 117 | } else { |
95 | tip(result.message); | 118 | tip(result.message); |
96 | } | 119 | } |
97 | - }).fail(() => { | 120 | + }, () => { |
98 | tip('操作失敗'); | 121 | tip('操作失敗'); |
99 | }); | 122 | }); |
100 | }); | 123 | }); |
@@ -135,8 +158,8 @@ | @@ -135,8 +158,8 @@ | ||
135 | tip('操作失敗'); | 158 | tip('操作失敗'); |
136 | }); | 159 | }); |
137 | }, | 160 | }, |
138 | - goBuy() { | ||
139 | - location.href = ''; | 161 | + goBuy(code) { |
162 | + yohoAPI.goPay({orderid: code}); | ||
140 | }, | 163 | }, |
141 | seeExpress() { | 164 | seeExpress() { |
142 | location.href = ''; | 165 | location.href = ''; |
@@ -29,7 +29,7 @@ | @@ -29,7 +29,7 @@ | ||
29 | <div class="goods-total">合计: <b>¥{{order.amount}}</b></div> | 29 | <div class="goods-total">合计: <b>¥{{order.amount}}</b></div> |
30 | <div class="options"> | 30 | <div class="options"> |
31 | <button v-if="order.status === 0" @click="cancelOrder(order.orderCode)">取消订单</button> | 31 | <button v-if="order.status === 0" @click="cancelOrder(order.orderCode)">取消订单</button> |
32 | - <button v-if="order.status === 0 " class="countdown" @click="goBuy()">去支付 11:58:12</button> | 32 | + <button v-if="order.status === 0 " class="countdown" @click="goBuy(order.orderCode)">去支付 <span v-count-down v-bind:left-time="order.payLefttime" v-bind:callback="autoCancel(order.orderCode)"></span></button> |
33 | <button v-if="order.status === 4 || order.status === 5 ">查看物流</button> | 33 | <button v-if="order.status === 4 || order.status === 5 ">查看物流</button> |
34 | <button v-if="order.status === 4 || order.status === 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button> | 34 | <button v-if="order.status === 4 || order.status === 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button> |
35 | <button v-if="order.status === 6" @click="deleteOrder(order,index)">删除订单</button> | 35 | <button v-if="order.status === 6" @click="deleteOrder(order,index)">删除订单</button> |
@@ -47,6 +47,7 @@ | @@ -47,6 +47,7 @@ | ||
47 | const $ = require('yoho-jquery'); | 47 | const $ = require('yoho-jquery'); |
48 | const tip = require('common/tip'); | 48 | const tip = require('common/tip'); |
49 | const Modal = require('common/modal'); | 49 | const Modal = require('common/modal'); |
50 | + const yohoAPI = require('yoho'); | ||
50 | 51 | ||
51 | module.exports = { | 52 | module.exports = { |
52 | data() { | 53 | data() { |
@@ -77,7 +78,7 @@ | @@ -77,7 +78,7 @@ | ||
77 | } | 78 | } |
78 | }).then(result => { | 79 | }).then(result => { |
79 | if (result.code === 200) { | 80 | if (result.code === 200) { |
80 | - if (result.isend) { | 81 | + if (result.isEnd) { |
81 | _that.busy = true; | 82 | _that.busy = true; |
82 | } else { | 83 | } else { |
83 | _that.busy = false; | 84 | _that.busy = false; |
@@ -90,21 +91,41 @@ | @@ -90,21 +91,41 @@ | ||
90 | tip('网络错误'); | 91 | tip('网络错误'); |
91 | }); | 92 | }); |
92 | }, | 93 | }, |
93 | - cancelOrder(code) { | ||
94 | - Modal.confirm('订单取消后不能恢复,确认取消订单吗?', '', function() { | 94 | + autoCancel(code) { |
95 | + let _that = this; | ||
96 | + | ||
97 | + return () => { | ||
98 | + _that.order().cancel(code, (result) => { | ||
99 | + if (result.code === 200) { | ||
100 | + location.reload(); | ||
101 | + } | ||
102 | + }); | ||
103 | + }; | ||
104 | + }, | ||
105 | + order() { | ||
106 | + return { | ||
107 | + cancel(code, success, fail) { | ||
95 | $.ajax({ | 108 | $.ajax({ |
96 | url: '/home/cancel-order', | 109 | url: '/home/cancel-order', |
97 | type: 'post', | 110 | type: 'post', |
98 | data: { | 111 | data: { |
99 | orderCode: code | 112 | orderCode: code |
100 | } | 113 | } |
101 | - }).then(result => { | 114 | + }).then(success).fail(fail); |
115 | + } | ||
116 | + }; | ||
117 | + }, | ||
118 | + cancelOrder(code) { | ||
119 | + let _that = this; | ||
120 | + | ||
121 | + Modal.confirm('订单取消后不能恢复,确认取消订单吗?', '', function() { | ||
122 | + _that.order().cancel(code, (result) => { | ||
102 | if (result.code === 200) { | 123 | if (result.code === 200) { |
103 | location.reload(); | 124 | location.reload(); |
104 | } else { | 125 | } else { |
105 | tip(result.message); | 126 | tip(result.message); |
106 | } | 127 | } |
107 | - }).fail(() => { | 128 | + }, () => { |
108 | tip('操作失敗'); | 129 | tip('操作失敗'); |
109 | }); | 130 | }); |
110 | }); | 131 | }); |
@@ -147,8 +168,8 @@ | @@ -147,8 +168,8 @@ | ||
147 | tip('操作失敗'); | 168 | tip('操作失敗'); |
148 | }); | 169 | }); |
149 | }, | 170 | }, |
150 | - goBuy() { | ||
151 | - location.href = ''; | 171 | + goBuy(code) { |
172 | + yohoAPI.goPay({orderid: code}); | ||
152 | }, | 173 | }, |
153 | seeExpress() { | 174 | seeExpress() { |
154 | location.href = ''; | 175 | location.href = ''; |
-
Please register or login to post a comment