Merge branch 'feature/home' of git.yoho.cn:fe/yohoblk-wap into feature/home
Showing
9 changed files
with
79 additions
and
58 deletions
apps/home/controllers/exchange.js
0 → 100644
@@ -45,7 +45,7 @@ exports.getFavProductData = (uid, page, limit) => { | @@ -45,7 +45,7 @@ exports.getFavProductData = (uid, page, limit) => { | ||
45 | title: d.product_name, | 45 | title: d.product_name, |
46 | price: '¥' + Number(Math.max(d.market_price, 0)).toFixed(2), | 46 | price: '¥' + Number(Math.max(d.market_price, 0)).toFixed(2), |
47 | discountPrice: discountPrice, | 47 | discountPrice: discountPrice, |
48 | - sellOut: d.storage < 0, | 48 | + sellOut: d.storage <= 0, |
49 | invalidGoods: d.status === 0 | 49 | invalidGoods: d.status === 0 |
50 | }); | 50 | }); |
51 | }); | 51 | }); |
@@ -12,6 +12,7 @@ const home = require(cRoot); | @@ -12,6 +12,7 @@ const home = require(cRoot); | ||
12 | const favorite = require(cRoot + '/favorite'); | 12 | const favorite = require(cRoot + '/favorite'); |
13 | const refund = require(cRoot + '/refund'); | 13 | const refund = require(cRoot + '/refund'); |
14 | const order = require(cRoot + '/order'); | 14 | const order = require(cRoot + '/order'); |
15 | +const exchange = require(cRoot + '/exchange'); | ||
15 | 16 | ||
16 | const router = expressRouter(); | 17 | const router = expressRouter(); |
17 | 18 | ||
@@ -44,6 +45,9 @@ router.get('/refund/logistics', refund.logistics); // 退换货 - 商品寄回 | @@ -44,6 +45,9 @@ router.get('/refund/logistics', refund.logistics); // 退换货 - 商品寄回 | ||
44 | router.get('/refund/companylist', refund.companylist); // 退换货 - 物流公司列表信息 | 45 | router.get('/refund/companylist', refund.companylist); // 退换货 - 物流公司列表信息 |
45 | router.post('/save-logistics', refund.saveLogistics); // 退换货 - 添加寄回物流信息 | 46 | router.post('/save-logistics', refund.saveLogistics); // 退换货 - 添加寄回物流信息 |
46 | 47 | ||
48 | +// 换货 | ||
49 | +router.get('/exchange', exchange.exchange); | ||
50 | + | ||
47 | 51 | ||
48 | router.get('/about-us', home.aboutUs); // 个人中心 - 关于我们 | 52 | router.get('/about-us', home.aboutUs); // 个人中心 - 关于我们 |
49 | 53 |
apps/home/views/action/exchange.hbs
0 → 100644
@@ -167,7 +167,7 @@ | @@ -167,7 +167,7 @@ | ||
167 | width: 35px; | 167 | width: 35px; |
168 | height: 35px; | 168 | height: 35px; |
169 | margin-right: 15px; | 169 | margin-right: 15px; |
170 | - margin-top: 35px; | 170 | + margin-top: 50px; |
171 | background: resolve("home/fav/fav-del.png"); | 171 | background: resolve("home/fav/fav-del.png"); |
172 | background-size: 100%; | 172 | background-size: 100%; |
173 | } | 173 | } |
public/vue/home/exchange.vue
0 → 100644
@@ -54,39 +54,34 @@ | @@ -54,39 +54,34 @@ | ||
54 | 54 | ||
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'); | ||
58 | - const overlay = require('common/overlay'); | 57 | + const Modal = require('common/modal'); |
59 | 58 | ||
60 | module.exports = { | 59 | module.exports = { |
61 | data() { | 60 | data() { |
62 | return { | 61 | return { |
63 | - order:{} | 62 | + order: {} |
64 | }; | 63 | }; |
65 | }, | 64 | }, |
66 | - ready(){ | 65 | + ready() { |
67 | this.getOrderData(); | 66 | this.getOrderData(); |
68 | }, | 67 | }, |
69 | - methods:{ | ||
70 | - getOrderData(){ | ||
71 | - // let _that = this; | 68 | + methods: { |
69 | + getOrderData() { | ||
72 | $.ajax({ | 70 | $.ajax({ |
73 | url: '/home/get-order', | 71 | url: '/home/get-order', |
74 | data: { | 72 | data: { |
75 | orderCode: this.$parent.$data.orderCode | 73 | orderCode: this.$parent.$data.orderCode |
76 | } | 74 | } |
77 | }).then(result => { | 75 | }).then(result => { |
78 | - if(result){ | 76 | + if (result) { |
79 | this.$set('order', result.data); | 77 | this.$set('order', result.data); |
80 | - //_that.orderList = result.data.orderList; | ||
81 | - } else { | ||
82 | - | ||
83 | } | 78 | } |
84 | }).fail(() => { | 79 | }).fail(() => { |
85 | tip('网络错误'); | 80 | tip('网络错误'); |
86 | }); | 81 | }); |
87 | }, | 82 | }, |
88 | - cancelOrder(code){ | ||
89 | - $.modal.confirm('', '订单取消后不能恢复,确认取消订单吗?', function() { | 83 | + cancelOrder(code) { |
84 | + Modal.confirm('订单取消后不能恢复,确认取消订单吗?', '', function() { | ||
90 | $.ajax({ | 85 | $.ajax({ |
91 | url: '/home/cancel-order', | 86 | url: '/home/cancel-order', |
92 | type: 'post', | 87 | type: 'post', |
@@ -94,18 +89,18 @@ | @@ -94,18 +89,18 @@ | ||
94 | orderCode: code | 89 | orderCode: code |
95 | } | 90 | } |
96 | }).then(result => { | 91 | }).then(result => { |
97 | - if(result.code === 200 ){ | 92 | + if (result.code === 200) { |
98 | location.href = '/home/orders'; | 93 | location.href = '/home/orders'; |
99 | } else { | 94 | } else { |
100 | tip(result.message); | 95 | tip(result.message); |
101 | } | 96 | } |
102 | }).fail(() => { | 97 | }).fail(() => { |
103 | - tip('操作失敗'); | 98 | + tip('操作失敗'); |
104 | }); | 99 | }); |
105 | }); | 100 | }); |
106 | }, | 101 | }, |
107 | - deleteOrder(code){ | ||
108 | - $.modal.confirm('', '确认删除订单?', function() { | 102 | + deleteOrder(code) { |
103 | + Modal.confirm('确认删除订单?', '', function() { | ||
109 | $.ajax({ | 104 | $.ajax({ |
110 | url: '/home/delete-order', | 105 | url: '/home/delete-order', |
111 | type: 'post', | 106 | type: 'post', |
@@ -113,17 +108,17 @@ | @@ -113,17 +108,17 @@ | ||
113 | orderCode: code | 108 | orderCode: code |
114 | } | 109 | } |
115 | }).then(result => { | 110 | }).then(result => { |
116 | - if(result.code === 200 ){ | 111 | + if (result.code === 200) { |
117 | location.href = '/home/orders'; | 112 | location.href = '/home/orders'; |
118 | } else { | 113 | } else { |
119 | tip(result.message); | 114 | tip(result.message); |
120 | } | 115 | } |
121 | }).fail(() => { | 116 | }).fail(() => { |
122 | - tip('操作失敗'); | 117 | + tip('操作失敗'); |
123 | }); | 118 | }); |
124 | }); | 119 | }); |
125 | }, | 120 | }, |
126 | - confirmGoods(code){ | 121 | + confirmGoods(code) { |
127 | $.ajax({ | 122 | $.ajax({ |
128 | url: '/home/confirm-order', | 123 | url: '/home/confirm-order', |
129 | type: 'post', | 124 | type: 'post', |
@@ -131,20 +126,20 @@ | @@ -131,20 +126,20 @@ | ||
131 | orderCode: code | 126 | orderCode: code |
132 | } | 127 | } |
133 | }).then(result => { | 128 | }).then(result => { |
134 | - if(result.code === 200 ){ | 129 | + if (result.code === 200) { |
135 | location.reload(); | 130 | location.reload(); |
136 | } else { | 131 | } else { |
137 | tip(result.message); | 132 | tip(result.message); |
138 | } | 133 | } |
139 | }).fail(() => { | 134 | }).fail(() => { |
140 | - tip('操作失敗'); | 135 | + tip('操作失敗'); |
141 | }); | 136 | }); |
142 | }, | 137 | }, |
143 | - goBuy(){ | ||
144 | - | 138 | + goBuy() { |
139 | + location.href = ''; | ||
145 | }, | 140 | }, |
146 | - see(){ | ||
147 | - | 141 | + seeExpress() { |
142 | + location.href = ''; | ||
148 | } | 143 | } |
149 | } | 144 | } |
150 | }; | 145 | }; |
@@ -46,8 +46,7 @@ | @@ -46,8 +46,7 @@ | ||
46 | 46 | ||
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'); | ||
50 | - const overlay = require('common/overlay'); | 49 | + const Modal = require('common/modal'); |
51 | 50 | ||
52 | module.exports = { | 51 | module.exports = { |
53 | data() { | 52 | data() { |
@@ -59,40 +58,40 @@ | @@ -59,40 +58,40 @@ | ||
59 | busy: false, | 58 | busy: false, |
60 | }; | 59 | }; |
61 | }, | 60 | }, |
62 | - ready(){ | 61 | + |
62 | + ready() { | ||
63 | this.getOrderData(); | 63 | this.getOrderData(); |
64 | }, | 64 | }, |
65 | - methods:{ | ||
66 | - getOrderData(){ | 65 | + |
66 | + methods: { | ||
67 | + getOrderData() { | ||
67 | let _that = this; | 68 | let _that = this; |
69 | + | ||
68 | this.busy = true; | 70 | this.busy = true; |
69 | $.ajax({ | 71 | $.ajax({ |
70 | url: '/home/get-orders', | 72 | url: '/home/get-orders', |
71 | data: { | 73 | data: { |
72 | - page : ++ this.page, | ||
73 | - limit : this.limit, | 74 | + page: ++this.page, |
75 | + limit: this.limit, | ||
74 | type: this.type | 76 | type: this.type |
75 | } | 77 | } |
76 | }).then(result => { | 78 | }).then(result => { |
77 | - if(result.code === 200){ | 79 | + if (result.code === 200) { |
78 | if (result.isend) { | 80 | if (result.isend) { |
79 | _that.busy = true; | 81 | _that.busy = true; |
80 | } else { | 82 | } else { |
81 | _that.busy = false; | 83 | _that.busy = false; |
82 | } | 84 | } |
83 | - if(result.data.orderList.length > 0){ | 85 | + if (result.data.orderList.length > 0) { |
84 | this.$set('orderList', result.data.orderList); | 86 | this.$set('orderList', result.data.orderList); |
85 | - //_that.orderList = result.data.orderList; | ||
86 | - } else { | ||
87 | - | ||
88 | } | 87 | } |
89 | } | 88 | } |
90 | }).fail(() => { | 89 | }).fail(() => { |
91 | tip('网络错误'); | 90 | tip('网络错误'); |
92 | }); | 91 | }); |
93 | }, | 92 | }, |
94 | - cancelOrder(code){ | ||
95 | - $.modal.confirm('', '订单取消后不能恢复,确认取消订单吗?', function() { | 93 | + cancelOrder(code) { |
94 | + Modal.confirm('订单取消后不能恢复,确认取消订单吗?', '', function() { | ||
96 | $.ajax({ | 95 | $.ajax({ |
97 | url: '/home/cancel-order', | 96 | url: '/home/cancel-order', |
98 | type: 'post', | 97 | type: 'post', |
@@ -100,7 +99,7 @@ | @@ -100,7 +99,7 @@ | ||
100 | orderCode: code | 99 | orderCode: code |
101 | } | 100 | } |
102 | }).then(result => { | 101 | }).then(result => { |
103 | - if(result.code === 200 ){ | 102 | + if (result.code === 200) { |
104 | location.reload(); | 103 | location.reload(); |
105 | } else { | 104 | } else { |
106 | tip(result.message); | 105 | tip(result.message); |
@@ -110,9 +109,10 @@ | @@ -110,9 +109,10 @@ | ||
110 | }); | 109 | }); |
111 | }); | 110 | }); |
112 | }, | 111 | }, |
113 | - deleteOrder(order, index){ | ||
114 | - var that = this; | ||
115 | - $.modal.confirm('', '确认删除订单?', function() { | 112 | + deleteOrder(order, index) { |
113 | + let that = this; | ||
114 | + | ||
115 | + Modal.confirm('确认删除订单?', '', function() { | ||
116 | $.ajax({ | 116 | $.ajax({ |
117 | url: '/home/delete-order', | 117 | url: '/home/delete-order', |
118 | type: 'post', | 118 | type: 'post', |
@@ -120,9 +120,8 @@ | @@ -120,9 +120,8 @@ | ||
120 | orderCode: order.orderCode | 120 | orderCode: order.orderCode |
121 | } | 121 | } |
122 | }).then(result => { | 122 | }).then(result => { |
123 | - if(result.code === 200 ){ | ||
124 | - //location.reload(); | ||
125 | - that.$el.querySelectorAll('.order-item')[index].remove() | 123 | + if (result.code === 200) { |
124 | + that.$el.querySelectorAll('.order-item')[index].remove(); | ||
126 | } else { | 125 | } else { |
127 | tip(result.message); | 126 | tip(result.message); |
128 | } | 127 | } |
@@ -131,7 +130,7 @@ | @@ -131,7 +130,7 @@ | ||
131 | }); | 130 | }); |
132 | }); | 131 | }); |
133 | }, | 132 | }, |
134 | - confirmGoods(code){ | 133 | + confirmGoods(code) { |
135 | $.ajax({ | 134 | $.ajax({ |
136 | url: '/home/confirm-order', | 135 | url: '/home/confirm-order', |
137 | type: 'post', | 136 | type: 'post', |
@@ -139,20 +138,20 @@ | @@ -139,20 +138,20 @@ | ||
139 | orderCode: code | 138 | orderCode: code |
140 | } | 139 | } |
141 | }).then(result => { | 140 | }).then(result => { |
142 | - if(result.code === 200 ){ | 141 | + if (result.code === 200) { |
143 | location.reload(); | 142 | location.reload(); |
144 | } else { | 143 | } else { |
145 | tip(result.message); | 144 | tip(result.message); |
146 | } | 145 | } |
147 | }).fail(() => { | 146 | }).fail(() => { |
148 | - tip('操作失敗'); | 147 | + tip('操作失敗'); |
149 | }); | 148 | }); |
150 | }, | 149 | }, |
151 | - goBuy(){ | ||
152 | - | 150 | + goBuy() { |
151 | + location.href = ''; | ||
153 | }, | 152 | }, |
154 | - see(){ | ||
155 | - | 153 | + seeExpress() { |
154 | + location.href = ''; | ||
156 | } | 155 | } |
157 | } | 156 | } |
158 | }; | 157 | }; |
@@ -160,15 +159,20 @@ | @@ -160,15 +159,20 @@ | ||
160 | </script> | 159 | </script> |
161 | 160 | ||
162 | <style> | 161 | <style> |
163 | -html,body{height:100%;} | 162 | +html, |
163 | +body { | ||
164 | + height: 100%; | ||
165 | +} | ||
166 | + | ||
167 | +@import "../../scss/home/_order.css"; | ||
164 | 168 | ||
165 | .order-wrapper { | 169 | .order-wrapper { |
166 | height: 100%; | 170 | height: 100%; |
171 | + | ||
167 | ul { | 172 | ul { |
168 | height: 100%; | 173 | height: 100%; |
169 | overflow-y: auto; | 174 | overflow-y: auto; |
170 | -webkit-overflow-scrolling: touch; | 175 | -webkit-overflow-scrolling: touch; |
171 | } | 176 | } |
172 | } | 177 | } |
173 | -@import "../../scss/home/_order.css"; | ||
174 | </style> | 178 | </style> |
-
Please register or login to post a comment