Merge remote-tracking branch 'origin/develop' into develop
Showing
24 changed files
with
473 additions
and
80 deletions
@@ -72,8 +72,8 @@ const fav = { | @@ -72,8 +72,8 @@ const fav = { | ||
72 | link: link, | 72 | link: link, |
73 | imgUrl: d.image ? helpers.image(d.image) : '', | 73 | imgUrl: d.image ? helpers.image(d.image) : '', |
74 | title: d.product_name, | 74 | title: d.product_name, |
75 | - price: '¥' + Number(d.market_price).toFixed(2), | ||
76 | - discountPrice: (Number(d.market_price) - Number(d.sales_price) > 0) ? '¥' + Number(d.sales_price).toFixed(2) : false, | 75 | + price: '¥' + Number(Math.max(d.market_price, 0)).toFixed(2), |
76 | + discountPrice: (Number(d.market_price) - Number(d.sales_price) > 0) ? '¥' + Number(Math.max(d.sales_price, 0)).toFixed(2) : false, | ||
77 | sellOut: d.storage < 0, | 77 | sellOut: d.storage < 0, |
78 | invalidGoods: d.status == 0 | 78 | invalidGoods: d.status == 0 |
79 | }); | 79 | }); |
@@ -90,7 +90,7 @@ const fav = { | @@ -90,7 +90,7 @@ const fav = { | ||
90 | }).catch(next); | 90 | }).catch(next); |
91 | } | 91 | } |
92 | }, | 92 | }, |
93 | - favdel: (req, res, next) => { | 93 | + deletefav: (req, res, next) => { |
94 | let uid = req.user.uid; | 94 | let uid = req.user.uid; |
95 | uid = 20000134; // 测试uid | 95 | uid = 20000134; // 测试uid |
96 | 96 |
@@ -30,8 +30,8 @@ const component = { | @@ -30,8 +30,8 @@ const component = { | ||
30 | let result = { | 30 | let result = { |
31 | module: 'home', | 31 | module: 'home', |
32 | page: 'index', | 32 | page: 'index', |
33 | - head_ico: proData.head_ico ? helpers.image(proData.head_ico, 200, 200) : '', | ||
34 | - profile_name: uid ? proData.profile_name : '登录/注册', | 33 | + head_ico: proData && proData.head_ico ? helpers.image(proData.head_ico, 200, 200) : '', |
34 | + profile_name: uid && proData ? proData.profile_name : '登录/注册', | ||
35 | userinfourl: uid ? '/home/mydetails' : helpers.urlFormat('/signin.html', { | 35 | userinfourl: uid ? '/home/mydetails' : helpers.urlFormat('/signin.html', { |
36 | refer: req.originalUrl | 36 | refer: req.originalUrl |
37 | }), | 37 | }), |
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | * 退换货 | 2 | * 退换货 |
3 | * @type {Object} | 3 | * @type {Object} |
4 | */ | 4 | */ |
5 | +'use strict'; | ||
5 | const refundModel = require('../models/refund'); | 6 | const refundModel = require('../models/refund'); |
6 | 7 | ||
7 | const refund = { | 8 | const refund = { |
@@ -9,18 +10,42 @@ const refund = { | @@ -9,18 +10,42 @@ const refund = { | ||
9 | res.render('refund'); | 10 | res.render('refund'); |
10 | }, | 11 | }, |
11 | order(req, res, next) { | 12 | order(req, res, next) { |
12 | - const uid = 8050882; | ||
13 | - const orderId = 160181661; | 13 | + const uid = req.user.uid || 8050882; |
14 | + const orderId = req.query.orderId; | ||
15 | + | ||
16 | + if (!orderId) { | ||
17 | + return next(); | ||
18 | + } | ||
14 | 19 | ||
15 | refundModel.getOrderData(uid, orderId).then(result => { | 20 | refundModel.getOrderData(uid, orderId).then(result => { |
16 | res.json(result); | 21 | res.json(result); |
17 | }).catch(next); | 22 | }).catch(next); |
18 | }, | 23 | }, |
24 | + submit(req, res, next) { | ||
25 | + const uid = req.user.uid || 8050882; | ||
26 | + | ||
27 | + refundModel.submitRefundData(uid, req.body).then(result => { | ||
28 | + res.json(result); | ||
29 | + }).catch(next); | ||
30 | + }, | ||
19 | logistics(req, res) { | 31 | logistics(req, res) { |
20 | res.render('logistics', { | 32 | res.render('logistics', { |
21 | module: 'home', | 33 | module: 'home', |
22 | page: 'logistics' | 34 | page: 'logistics' |
23 | }); | 35 | }); |
36 | + }, | ||
37 | + companylist(req, res, next) { | ||
38 | + refundModel.getExpressCompany().then(result => { | ||
39 | + res.json(result); | ||
40 | + }).catch(next); | ||
41 | + }, | ||
42 | + saveLogistics(req, res, next) { | ||
43 | + const company = req.body.company; | ||
44 | + const num = req.body.num; | ||
45 | + | ||
46 | + res.json({ | ||
47 | + code: 200 | ||
48 | + }); | ||
24 | } | 49 | } |
25 | }; | 50 | }; |
26 | 51 |
@@ -46,8 +46,8 @@ const _getInfoNumData = (uid) => { | @@ -46,8 +46,8 @@ const _getInfoNumData = (uid) => { | ||
46 | 46 | ||
47 | if (data[0].data) { | 47 | if (data[0].data) { |
48 | for (let k in data[0].data) { | 48 | for (let k in data[0].data) { |
49 | - if (res[k] !== undefined) { | ||
50 | - res[k] = data[0].data[k] ? data[0].data[k] : ""; | 49 | + if (res[k] !== null) { |
50 | + res[k] = data[0].data[k] ? data[0].data[k] : ''; | ||
51 | if (k !== 'yoho_coin_num' && res[k] > 99) { | 51 | if (k !== 'yoho_coin_num' && res[k] > 99) { |
52 | res[k] = '99+'; | 52 | res[k] = '99+'; |
53 | } | 53 | } |
@@ -56,11 +56,11 @@ const _getInfoNumData = (uid) => { | @@ -56,11 +56,11 @@ const _getInfoNumData = (uid) => { | ||
56 | } | 56 | } |
57 | if (data[1].data) { | 57 | if (data[1].data) { |
58 | res = _.merge(res, { | 58 | res = _.merge(res, { |
59 | - address_num: data[1].data.length ? data[1].data.length : "" | 59 | + address_num: data[1].data.length ? data[1].data.length : '' |
60 | }); | 60 | }); |
61 | } | 61 | } |
62 | return res; | 62 | return res; |
63 | - }) | 63 | + }); |
64 | }; | 64 | }; |
65 | 65 | ||
66 | 66 | ||
@@ -87,15 +87,15 @@ exports.getHelpInfo = (data) => { | @@ -87,15 +87,15 @@ exports.getHelpInfo = (data) => { | ||
87 | infoData = Object.assign(defaultParam, data); | 87 | infoData = Object.assign(defaultParam, data); |
88 | 88 | ||
89 | return api.get('', infoData).then(result => { | 89 | return api.get('', infoData).then(result => { |
90 | - const helpData = result.data; | ||
91 | - const formatData = []; | 90 | + var helpData = result.data; |
91 | + var formatData = []; | ||
92 | 92 | ||
93 | helpData = helpData || []; | 93 | helpData = helpData || []; |
94 | _.forEach(helpData, (item) => { | 94 | _.forEach(helpData, (item) => { |
95 | formatData.push({ | 95 | formatData.push({ |
96 | name: item.caption, | 96 | name: item.caption, |
97 | code: item.code, | 97 | code: item.code, |
98 | - url: helpers.urlFormat('/home/helpDetail', { | 98 | + url: helpers.urlFormat('/home/help-detail', { |
99 | code: item.code, | 99 | code: item.code, |
100 | caption: item.caption, | 100 | caption: item.caption, |
101 | }) | 101 | }) |
@@ -136,4 +136,4 @@ exports.saveFeedback = (data) => { | @@ -136,4 +136,4 @@ exports.saveFeedback = (data) => { | ||
136 | 136 | ||
137 | // 参考接口数据 | 137 | // 参考接口数据 |
138 | }); | 138 | }); |
139 | -}; | ||
139 | +}; |
@@ -14,7 +14,22 @@ const refund = { | @@ -14,7 +14,22 @@ const refund = { | ||
14 | cache: true, | 14 | cache: true, |
15 | code: 200 | 15 | code: 200 |
16 | }).then(global.yoho.camelCase); | 16 | }).then(global.yoho.camelCase); |
17 | + }, | ||
18 | + submitRefundData(uid, params) { | ||
19 | + console.log(Object.assign({ | ||
20 | + method: 'app.refund.submit', | ||
21 | + uid: uid, | ||
22 | + }, params)); | ||
23 | + return api.post('', Object.assign({ | ||
24 | + method: 'app.refund.submit', | ||
25 | + uid: uid, | ||
26 | + }, params)).then(global.yoho.camelCase); | ||
27 | + }, | ||
28 | + getExpressCompany() { | ||
29 | + return api.get('', { | ||
30 | + method: 'app.express.getExpressCompany' | ||
31 | + }); | ||
17 | } | 32 | } |
18 | }; | 33 | }; |
19 | 34 | ||
20 | -module.exports = refund; | 35 | +module.exports = refund; |
@@ -21,20 +21,23 @@ router.get('/mycurrency', home.coin); // yoho币 | @@ -21,20 +21,23 @@ router.get('/mycurrency', home.coin); // yoho币 | ||
21 | router.get('/orderDetail', home.orderDetail); // yoho币 | 21 | router.get('/orderDetail', home.orderDetail); // yoho币 |
22 | 22 | ||
23 | router.get('/help', home.help); // 帮助中心列表页 | 23 | router.get('/help', home.help); // 帮助中心列表页 |
24 | -router.get('/helpDetail', home.helpDetail); // 帮助中心详情页 | 24 | +router.get('/help-detail', home.helpDetail); // 帮助中心详情页 |
25 | router.get('/feedback', home.feedback); // 个人中心-意见反馈 | 25 | router.get('/feedback', home.feedback); // 个人中心-意见反馈 |
26 | router.post('/save-feedback', home.saveFeedback); // 个人中心-提交意见反馈 | 26 | router.post('/save-feedback', home.saveFeedback); // 个人中心-提交意见反馈 |
27 | 27 | ||
28 | router.get('/favorite', favorite.favorite); // 个人中心 - 收藏 | 28 | router.get('/favorite', favorite.favorite); // 个人中心 - 收藏 |
29 | router.get('/favorite/favpaging', favorite.favpaging); // 个人中心 - 收藏商品/品牌(翻页) | 29 | router.get('/favorite/favpaging', favorite.favpaging); // 个人中心 - 收藏商品/品牌(翻页) |
30 | -router.post('/favorite/favdel', favorite.favdel); // 个人中心 - 收藏商品/品牌(刪除) | 30 | +router.post('/del-favdel', favorite.deletefav); // 个人中心 - 收藏商品/品牌(刪除) |
31 | 31 | ||
32 | -router.get('/refund', refund.refund); | ||
33 | -router.get('/refund/order', refund.order); | 32 | +router.get('/refund', refund.refund); // 退换货 |
33 | +router.get('/refund/order', refund.order); // 查询订单数据 | ||
34 | +router.post('/refund/submit', refund.submit); // 提交信息 | ||
34 | router.get('/refund/logistics', refund.logistics); // 退换货 - 商品寄回信息 | 35 | router.get('/refund/logistics', refund.logistics); // 退换货 - 商品寄回信息 |
36 | +router.get('/refund/companylist', refund.companylist); // 退换货 - 物流公司列表信息 | ||
37 | +router.post('/save-logistics', refund.saveLogistics); // 退换货 - 添加寄回物流信息 | ||
35 | 38 | ||
36 | 39 | ||
37 | router.get('/about-us', home.aboutUs); // 个人中心 - 关于我们 | 40 | router.get('/about-us', home.aboutUs); // 个人中心 - 关于我们 |
38 | 41 | ||
39 | 42 | ||
40 | -module.exports = router; | ||
43 | +module.exports = router; |
1 | <div class="about-us"> | 1 | <div class="about-us"> |
2 | <div class="description"> | 2 | <div class="description"> |
3 | - <p>From yoho! 2015 high-end store </p> | ||
4 | - <p>i fancy, you like.</p> | ||
5 | </div> | 3 | </div> |
6 | <div class="icon-container"> | 4 | <div class="icon-container"> |
7 | <div class="blk-icon"></div> | 5 | <div class="blk-icon"></div> |
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" href={{userinfourl}}> |
4 | - <span class="user-avatar" data-avatar="{{head_ico}}"></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> |
1 | -<div class="logistics-page"> | ||
2 | - <div class="edit-logistics-page"> | ||
3 | - <form class="edit-logistics"> | ||
4 | - <label class="company"> | ||
5 | - 选择快递公司 | ||
6 | - <input type="text" name="company" value="{{company}}" readonly> | ||
7 | - <span class="icon icon-right"></span> | ||
8 | - </label> | ||
9 | - <label class="num"> | ||
10 | - 快递单号 | ||
11 | - <input type="text" name="num" value="{{num}}"> | ||
12 | - </label> | ||
13 | - </form> | ||
14 | - <div class="submit">确认</div> | ||
15 | - </div> | 1 | +<div class="logistics-page" id="logistics"> |
2 | + <components :is="currentView" :company="company" keep-alive></components> | ||
16 | </div> | 3 | </div> |
public/img/home/about-us-tip.png
0 → 100644

2.38 KB
1 | +const Vue = require('yoho-vue'); | ||
2 | +const infiniteScroll = require('yoho-vue-infinite-scroll'); | ||
3 | +const Logistics = require('home/refund/logistics.vue'); | ||
4 | +const LogisticsCompany = require('home/refund/logistics-company.vue'); | ||
5 | + | ||
6 | +Vue.use(infiniteScroll); | ||
7 | + | ||
8 | +new Vue({ | ||
9 | + el: '#logistics', | ||
10 | + data: { | ||
11 | + company: '', | ||
12 | + currentView: 'logistics', | ||
13 | + }, | ||
14 | + components: { | ||
15 | + logistics: Logistics, | ||
16 | + logisticsCompany: LogisticsCompany | ||
17 | + }, | ||
18 | + events: { | ||
19 | + changeView: function(obj) { | ||
20 | + this.currentView = obj.view; | ||
21 | + this.company = obj.company; | ||
22 | + } | ||
23 | + } | ||
24 | +}); |
@@ -16,7 +16,6 @@ | @@ -16,7 +16,6 @@ | ||
16 | html, | 16 | html, |
17 | body { | 17 | body { |
18 | width: 100%; | 18 | width: 100%; |
19 | - height: 100%; | ||
20 | font-size: 24px; | 19 | font-size: 24px; |
21 | font-family: Helvetica, Roboto, "Heiti SC", "黑体", Arial; | 20 | font-family: Helvetica, Roboto, "Heiti SC", "黑体", Arial; |
22 | line-height: 1.4; | 21 | line-height: 1.4; |
@@ -28,6 +27,15 @@ a { | @@ -28,6 +27,15 @@ a { | ||
28 | text-decoration: none; | 27 | text-decoration: none; |
29 | } | 28 | } |
30 | 29 | ||
30 | +input { | ||
31 | + border: 0; | ||
32 | +} | ||
33 | + | ||
34 | +ol, | ||
35 | +ul { | ||
36 | + list-style: none; | ||
37 | +} | ||
38 | + | ||
31 | *:focus { | 39 | *:focus { |
32 | outline: none; | 40 | outline: none; |
33 | } | 41 | } |
@@ -38,17 +46,12 @@ a { | @@ -38,17 +46,12 @@ a { | ||
38 | margin-left: auto; | 46 | margin-left: auto; |
39 | width: 100%; | 47 | width: 100%; |
40 | max-width: 750px; | 48 | max-width: 750px; |
41 | - min-height: 100%; | ||
42 | } | 49 | } |
43 | 50 | ||
44 | .text-center { | 51 | .text-center { |
45 | text-align: center; | 52 | text-align: center; |
46 | } | 53 | } |
47 | 54 | ||
48 | -ol, ul { | ||
49 | - list-style: none | ||
50 | -} | ||
51 | - | ||
52 | .hide { | 55 | .hide { |
53 | display: none; | 56 | display: none; |
54 | } | 57 | } |
@@ -2,17 +2,23 @@ | @@ -2,17 +2,23 @@ | ||
2 | width: 100%; | 2 | width: 100%; |
3 | height: 100%; | 3 | height: 100%; |
4 | background: #fff; | 4 | background: #fff; |
5 | - position: relative; | ||
6 | 5 | ||
7 | .description { | 6 | .description { |
8 | - position:absolute; | 7 | + position: absolute; |
9 | top: 30%; | 8 | top: 30%; |
10 | - width: 100%; | 9 | + width: 411px; |
10 | + height: 75px; | ||
11 | + background: resolve("home/about-us-tip.png") no-repeat; | ||
12 | + background-size: 100%; | ||
13 | + left: 0; | ||
14 | + right: 0; | ||
15 | + margin-left: auto; | ||
16 | + margin-right: auto; | ||
11 | } | 17 | } |
12 | - | 18 | + |
13 | .icon-container { | 19 | .icon-container { |
14 | position: absolute; | 20 | position: absolute; |
15 | - top: 45%; | 21 | + top: 43%; |
16 | left: 0; | 22 | left: 0; |
17 | right: 0; | 23 | right: 0; |
18 | margin-left: auto; | 24 | margin-left: auto; |
@@ -21,8 +27,8 @@ | @@ -21,8 +27,8 @@ | ||
21 | 27 | ||
22 | .blk-icon { | 28 | .blk-icon { |
23 | background: resolve("home/app-icon.png") no-repeat; | 29 | background: resolve("home/app-icon.png") no-repeat; |
24 | - width: 160px; | ||
25 | - height: 160px; | 30 | + width: 180px; |
31 | + height: 180px; | ||
26 | left: 0; | 32 | left: 0; |
27 | right: 0; | 33 | right: 0; |
28 | margin-left: auto; | 34 | margin-left: auto; |
@@ -31,6 +37,7 @@ | @@ -31,6 +37,7 @@ | ||
31 | } | 37 | } |
32 | 38 | ||
33 | .icon-label { | 39 | .icon-label { |
40 | + margin-top: 10px; | ||
34 | font-size: 30px; | 41 | font-size: 30px; |
35 | left: 0; | 42 | left: 0; |
36 | right: 0; | 43 | right: 0; |
@@ -41,5 +48,6 @@ | @@ -41,5 +48,6 @@ | ||
41 | p { | 48 | p { |
42 | text-align: center; | 49 | text-align: center; |
43 | font-size: 24px; | 50 | font-size: 24px; |
51 | + font-family: BrownStd Regular; | ||
44 | } | 52 | } |
45 | -} | ||
53 | +} |
@@ -5,15 +5,17 @@ | @@ -5,15 +5,17 @@ | ||
5 | .edit-logistics-page { | 5 | .edit-logistics-page { |
6 | width: 100%; | 6 | width: 100%; |
7 | color: #d0d0d0; | 7 | color: #d0d0d0; |
8 | - background: #f0f0f0; | ||
9 | 8 | ||
10 | .edit-logistics { | 9 | .edit-logistics { |
10 | + display: inline-block; | ||
11 | + margin-top: 20px; | ||
11 | padding: 0 30px; | 12 | padding: 0 30px; |
13 | + width: 100%; | ||
12 | background: #fff; | 14 | background: #fff; |
13 | font-size: 30px; | 15 | font-size: 30px; |
14 | line-height: 88px; | 16 | line-height: 88px; |
15 | border-bottom: 1px solid #e0e0e0; | 17 | border-bottom: 1px solid #e0e0e0; |
16 | - | 18 | + |
17 | label { | 19 | label { |
18 | display: block; | 20 | display: block; |
19 | position: relative; | 21 | position: relative; |
@@ -25,9 +27,15 @@ | @@ -25,9 +27,15 @@ | ||
25 | content: none; | 27 | content: none; |
26 | } | 28 | } |
27 | 29 | ||
28 | - input { | 30 | + .company-val { |
29 | direction: rtl; | 31 | direction: rtl; |
30 | - } | 32 | + margin-right: 10px; |
33 | + } | ||
34 | + .icon { | ||
35 | + margin-top: 27px; | ||
36 | + margin-right: 10px; | ||
37 | + float: right; | ||
38 | + } | ||
31 | } | 39 | } |
32 | 40 | ||
33 | input { | 41 | input { |
@@ -42,32 +50,57 @@ | @@ -42,32 +50,57 @@ | ||
42 | -webkit-appearance: none; | 50 | -webkit-appearance: none; |
43 | } | 51 | } |
44 | 52 | ||
45 | - p { | ||
46 | - position: absolute; | ||
47 | - top: 0; | ||
48 | - right: 40px; | ||
49 | - width: 360px; | ||
50 | - height: 88px; | ||
51 | - color: #444; | ||
52 | - padding: 0; | ||
53 | - border: none; | 53 | + .num { |
54 | + width: 440px; | ||
55 | + text-align: right; | ||
54 | } | 56 | } |
55 | } | 57 | } |
56 | 58 | ||
57 | .submit { | 59 | .submit { |
58 | - margin: auto 30px; | ||
59 | - width: 100%; | 60 | + position: fixed; |
61 | + bottom: 20px; | ||
62 | + width: 92%; | ||
63 | + margin: 0 4%; | ||
60 | height: 100px; | 64 | height: 100px; |
61 | color: #fff; | 65 | color: #fff; |
62 | background: #000; | 66 | background: #000; |
63 | text-align: center; | 67 | text-align: center; |
64 | font-size: 28px; | 68 | font-size: 28px; |
65 | - line-height: 88px; | 69 | + line-height: 100px; |
66 | 70 | ||
67 | &.highlight { | 71 | &.highlight { |
68 | background: rgba(0, 0, 0, 0.6); | 72 | background: rgba(0, 0, 0, 0.6); |
69 | } | 73 | } |
70 | } | 74 | } |
71 | } | 75 | } |
76 | + | ||
77 | + .companylist-page { | ||
78 | + width: 100%; | ||
79 | + color: #d0d0d0; | ||
80 | + | ||
81 | + .search-input { | ||
82 | + position: relative; | ||
83 | + padding: 14px 22px; | ||
84 | + background: #f8f8f8; | ||
85 | + | ||
86 | + .icon { | ||
87 | + position: absolute; | ||
88 | + font-size: 24px; | ||
89 | + top: 26px; | ||
90 | + left: 36px; | ||
91 | + color: #b2b2b2; | ||
92 | + } | ||
93 | + | ||
94 | + input { | ||
95 | + height: 56px; | ||
96 | + width: 378px; | ||
97 | + border-radius: 28px; | ||
98 | + padding: 0 52px; | ||
99 | + font-size: 24px; | ||
100 | + background: #fff; | ||
101 | + border: none; | ||
102 | + } | ||
103 | + } | ||
104 | + } | ||
72 | } | 105 | } |
73 | 106 |
@@ -73,8 +73,8 @@ | @@ -73,8 +73,8 @@ | ||
73 | delItem(index, id) { | 73 | delItem(index, id) { |
74 | let _this = this; | 74 | let _this = this; |
75 | $.ajax({ | 75 | $.ajax({ |
76 | - method: 'post', | ||
77 | - url: '/home/favorite/favdel', | 76 | + method: 'POST', |
77 | + url: '/home/del-favdel', | ||
78 | data: { | 78 | data: { |
79 | favId: id, | 79 | favId: id, |
80 | type: 'brand' | 80 | type: 'brand' |
@@ -80,8 +80,8 @@ | @@ -80,8 +80,8 @@ | ||
80 | delItem(index, id) { | 80 | delItem(index, id) { |
81 | let _this = this; | 81 | let _this = this; |
82 | $.ajax({ | 82 | $.ajax({ |
83 | - method: 'post', | ||
84 | - url: '/home/favorite/favdel', | 83 | + method: 'POST', |
84 | + url: '/home/del-favdel', | ||
85 | data: { | 85 | data: { |
86 | favId: id, | 86 | favId: id, |
87 | type: 'product' | 87 | type: 'product' |
1 | <template> | 1 | <template> |
2 | <div class="refund"> | 2 | <div class="refund"> |
3 | <product-list v-bind:title="title" v-bind:list="list" v-bind:refund-data="refundData"></product-list> | 3 | <product-list v-bind:title="title" v-bind:list="list" v-bind:refund-data="refundData"></product-list> |
4 | + <div class="return-amount"> | ||
5 | + <div class="return-amount-item"> | ||
6 | + 退款方法 | ||
7 | + | ||
8 | + <span class="icon icon-right"></span> | ||
9 | + <select v-model="amount.return_amount_mode" name="amount-mode"> | ||
10 | + <option v-for="mode in refundData.returnAmountMode" v-bind:value="mode.id">{{mode.name}}</option> | ||
11 | + </select> | ||
12 | + </div> | ||
13 | + | ||
14 | + <template v-if="amount.return_amount_mode === 2"> | ||
15 | + <div class="return-amount-item"> | ||
16 | + <span class="name">银行</span> | ||
17 | + | ||
18 | + <input v-model="amount.bank_name" type="text" placeholder="请填写银行名称"> | ||
19 | + </div> | ||
20 | + <div class="return-amount-item"> | ||
21 | + <span class="name">卡号</span> | ||
22 | + | ||
23 | + <input v-model="amount.bank_card" type="text" placeholder="请填写银行卡卡号"> | ||
24 | + </div> | ||
25 | + <div class="return-amount-item"> | ||
26 | + <span class="name">姓名</span> | ||
27 | + | ||
28 | + <input v-model="amount.payee_name" type="text" placeholder="收款人姓名"> | ||
29 | + </div> | ||
30 | + </template> | ||
31 | + <template v-if="amount.return_amount_mode === 3"> | ||
32 | + <div class="return-amount-item"> | ||
33 | + <span class="name">帐号</span> | ||
34 | + | ||
35 | + <input v-model="amount.alipay_account" type="text" placeholder="请填写支付宝帐号"> | ||
36 | + </div> | ||
37 | + <div class="return-amount-item"> | ||
38 | + <span class="name">姓名</span> | ||
39 | + | ||
40 | + <input v-model="amount.alipay_name" type="text" placeholder="收款人姓名"> | ||
41 | + </div> | ||
42 | + </template> | ||
43 | + </div> | ||
44 | + <div v-if="refundData.returnAmountInfo" class="return-amount-info"> | ||
45 | + {{refundData.returnAmountInfo}} | ||
46 | + </div> | ||
4 | </div> | 47 | </div> |
5 | </template> | 48 | </template> |
6 | 49 | ||
7 | <script> | 50 | <script> |
8 | const $ = require('yoho-jquery'); | 51 | const $ = require('yoho-jquery'); |
52 | + const qs = require('yoho-qs'); | ||
9 | 53 | ||
10 | const productList = require('home/refund/product-list.vue'); | 54 | const productList = require('home/refund/product-list.vue'); |
11 | 55 | ||
@@ -14,12 +58,42 @@ | @@ -14,12 +58,42 @@ | ||
14 | return { | 58 | return { |
15 | title: '请选择退货商品', | 59 | title: '请选择退货商品', |
16 | list: [], | 60 | list: [], |
61 | + amount: {}, | ||
17 | refundData: {} | 62 | refundData: {} |
18 | }; | 63 | }; |
19 | }, | 64 | }, |
65 | + computed: { | ||
66 | + submitData() { | ||
67 | + let goods = []; | ||
68 | + | ||
69 | + this.list.forEach(product => { | ||
70 | + if (product.checked) { | ||
71 | + goods.push({ | ||
72 | + last_price: product.lastPrice, | ||
73 | + remark: product.remark || '', | ||
74 | + returned_reason: this.refundData.returnReason[product.reason.id].id + '', | ||
75 | + evidence_images: product.imageList || [], | ||
76 | + goods_type: product.goodsTypeId + '', | ||
77 | + product_skn: product.productSkn, | ||
78 | + product_skc: product.productSkc, | ||
79 | + product_sku: product.productSku | ||
80 | + }); | ||
81 | + } | ||
82 | + }); | ||
83 | + | ||
84 | + return { | ||
85 | + order_code: qs.orderId, | ||
86 | + goods: JSON.stringify(goods), | ||
87 | + payment: JSON.stringify(this.amount) | ||
88 | + }; | ||
89 | + } | ||
90 | + }, | ||
20 | created() { | 91 | created() { |
21 | $.ajax({ | 92 | $.ajax({ |
22 | - url: '/home/refund/order' | 93 | + url: '/home/refund/order', |
94 | + data: { | ||
95 | + orderId: qs.orderId | ||
96 | + } | ||
23 | }).then(res => { | 97 | }).then(res => { |
24 | if (res.data && res.data.goodsList) { | 98 | if (res.data && res.data.goodsList) { |
25 | res.data.goodsList.forEach(product => { | 99 | res.data.goodsList.forEach(product => { |
@@ -27,13 +101,59 @@ | @@ -27,13 +101,59 @@ | ||
27 | product.reason = { | 101 | product.reason = { |
28 | id: 0 | 102 | id: 0 |
29 | }; | 103 | }; |
104 | + product.imageList = []; | ||
105 | + }); | ||
106 | + res.data.returnAmountMode.forEach(mode => { | ||
107 | + if (mode.isDefault === 'Y') { | ||
108 | + this.$set('amount.return_amount_mode', mode.id); | ||
109 | + } | ||
30 | }); | 110 | }); |
31 | this.list = res.data.goodsList; | 111 | this.list = res.data.goodsList; |
32 | this.refundData = res.data; | 112 | this.refundData = res.data; |
33 | } | 113 | } |
34 | }); | 114 | }); |
35 | }, | 115 | }, |
36 | - methods: {}, | 116 | + methods: { |
117 | + checkSubmitData() { | ||
118 | + const data = this.submitData; | ||
119 | + | ||
120 | + if (!data.order_code) { | ||
121 | + return false; | ||
122 | + } | ||
123 | + | ||
124 | + // 退到银行卡 | ||
125 | + if (this.amount.return_amount_mode === 2) { | ||
126 | + if (!this.amount.bank_name || !this.amount.bank_card || !this.amount.payee_name) { | ||
127 | + return false; | ||
128 | + } | ||
129 | + } | ||
130 | + | ||
131 | + // 退到支付宝 | ||
132 | + if (this.amount.return_amount_mode === 3) { | ||
133 | + if (!this.amount.alipay_account || !this.amount.alipay_name) { | ||
134 | + return false; | ||
135 | + } | ||
136 | + } | ||
137 | + | ||
138 | + return true; | ||
139 | + }, | ||
140 | + submit() { | ||
141 | + if (!this.checkSubmitData()) { | ||
142 | + alert('请填写完整退换货信息'); | ||
143 | + } | ||
144 | + $.ajax({ | ||
145 | + method: 'POST', | ||
146 | + url: '/home/refund/submit', | ||
147 | + data: this.submitData | ||
148 | + }).then(result => { | ||
149 | + if (result.code === 200) { | ||
150 | + console.log(result); | ||
151 | + } else { | ||
152 | + alert(result.message); | ||
153 | + } | ||
154 | + }); | ||
155 | + } | ||
156 | + }, | ||
37 | components: { | 157 | components: { |
38 | productList | 158 | productList |
39 | } | 159 | } |
@@ -44,4 +164,61 @@ | @@ -44,4 +164,61 @@ | ||
44 | .main-wrap { | 164 | .main-wrap { |
45 | background: #f6f6f6; | 165 | background: #f6f6f6; |
46 | } | 166 | } |
167 | + | ||
168 | + .refund { | ||
169 | + .return-amount { | ||
170 | + padding: 0 30px; | ||
171 | + font-size: 32px; | ||
172 | + line-height: 90px; | ||
173 | + background: #fff; | ||
174 | + border-top: 1px solid #eee; | ||
175 | + border-bottom: 1px solid #eee; | ||
176 | + } | ||
177 | + | ||
178 | + .return-amount-info { | ||
179 | + padding: 0 30px 30px; | ||
180 | + font-size: 24px; | ||
181 | + line-height: 2.5; | ||
182 | + color: #b0b0b0; | ||
183 | + } | ||
184 | + | ||
185 | + .return-amount-item { | ||
186 | + position: relative; | ||
187 | + width: 100%; | ||
188 | + height: 90px; | ||
189 | + | ||
190 | + &:after { | ||
191 | + content: ""; | ||
192 | + position: absolute; | ||
193 | + left: 0; | ||
194 | + bottom: -1px; | ||
195 | + width: 690px; | ||
196 | + height: 0; | ||
197 | + border-bottom: 1px solid #eee; | ||
198 | + z-index: 1; | ||
199 | + } | ||
200 | + | ||
201 | + .name { | ||
202 | + float: left; | ||
203 | + width: 160px; | ||
204 | + color: #000; | ||
205 | + } | ||
206 | + | ||
207 | + input { | ||
208 | + width: 500px; | ||
209 | + } | ||
210 | + | ||
211 | + span, | ||
212 | + select { | ||
213 | + float: right; | ||
214 | + height: 90px; | ||
215 | + line-height: 90px; | ||
216 | + color: #b0b0b0; | ||
217 | + } | ||
218 | + | ||
219 | + select { | ||
220 | + direction: rtl; | ||
221 | + } | ||
222 | + } | ||
223 | + } | ||
47 | </style> | 224 | </style> |
public/vue/home/refund/logistics-company.vue
0 → 100644
1 | +<template> | ||
2 | + <div class="companylist-page"> | ||
3 | + <div class="search-input"> | ||
4 | + <input class="buriedpoint icon" type="text" placeholder="搜索快递公司"> | ||
5 | + </div> | ||
6 | + <ul class="search-associate"></ul> | ||
7 | + </div> | ||
8 | +</template> | ||
9 | + | ||
10 | +<script> | ||
11 | + module.exports = { | ||
12 | + data() { | ||
13 | + return { | ||
14 | + companyData: {}, | ||
15 | + }; | ||
16 | + }, | ||
17 | + methods: { | ||
18 | + submit: function(){ | ||
19 | + console.log(this.num); | ||
20 | + this.$dispatch('changeView', { | ||
21 | + view: 'logistics', | ||
22 | + company: "aaaf啊啊啊" | ||
23 | + }); | ||
24 | + } | ||
25 | + }, | ||
26 | + activate: function(done) { | ||
27 | + $.ajax({ | ||
28 | + url: '/home/refund/companylist' | ||
29 | + }).then(function(res) { | ||
30 | + if ($.type(res) !== 'object') { | ||
31 | + res = {}; | ||
32 | + } | ||
33 | + if (res.code === 200) { | ||
34 | + | ||
35 | + } | ||
36 | + | ||
37 | + done(); | ||
38 | + }).fail(function() { | ||
39 | + tip('网络错误'); | ||
40 | + done(); | ||
41 | + }); | ||
42 | + | ||
43 | + } | ||
44 | + }; | ||
45 | +</script> |
public/vue/home/refund/logistics.vue
0 → 100644
1 | +<template> | ||
2 | + <div class="edit-logistics-page"> | ||
3 | + <form class="edit-logistics"> | ||
4 | + <label @click="companylist"> | ||
5 | + 选择快递公司<input class="company-val" type="text" name="company" value="{{company}}" readonly> | ||
6 | + <span class="icon icon-right"></span> | ||
7 | + </label> | ||
8 | + <label> | ||
9 | + 快递单号 | ||
10 | + <input class="num" type="number" name="num" v-model='num'> | ||
11 | + </label> | ||
12 | + </form> | ||
13 | + <div class="submit" @click="submit">确认</div> | ||
14 | + </div> | ||
15 | +</template> | ||
16 | + | ||
17 | +<script> | ||
18 | + const $ = require('yoho-jquery'); | ||
19 | + const tip = require('common/tip'); | ||
20 | + | ||
21 | + module.exports = { | ||
22 | + props: ['company'], | ||
23 | + data() { | ||
24 | + return { | ||
25 | + num: '', | ||
26 | + }; | ||
27 | + }, | ||
28 | + methods: { | ||
29 | + companylist: function(){ | ||
30 | + this.$dispatch('changeView', { | ||
31 | + view: 'logisticsCompany' | ||
32 | + }); | ||
33 | + }, | ||
34 | + submit: function(){ | ||
35 | + if (!this.company) { | ||
36 | + tip("请选择快递公司"); | ||
37 | + return false; | ||
38 | + } | ||
39 | + if (!/^[0-9]*$/.test(this.num)) { | ||
40 | + tip("请输入正确的快递单号"); | ||
41 | + return false; | ||
42 | + } | ||
43 | + | ||
44 | + $.ajax({ | ||
45 | + method: 'POST', | ||
46 | + url: '/home/save-logistics', | ||
47 | + data: { | ||
48 | + company: company, | ||
49 | + num: num | ||
50 | + } | ||
51 | + }).then(function(res) { | ||
52 | + if ($.type(res) !== 'object') { | ||
53 | + res = {}; | ||
54 | + } | ||
55 | + if (res.code !== 200) { | ||
56 | + tip(res.message || '网络出了点问题~'); | ||
57 | + } else { | ||
58 | + // todo 跳转到什么页面呢? | ||
59 | + // window.location.href | ||
60 | + } | ||
61 | + }).fail(function() { | ||
62 | + tip('网络错误'); | ||
63 | + }); | ||
64 | + return false; | ||
65 | + } | ||
66 | + } | ||
67 | + }; | ||
68 | + | ||
69 | +</script> |
-
Please register or login to post a comment