Merge branch 'feature/home' into develop
Showing
6 changed files
with
31 additions
and
42 deletions
@@ -9,6 +9,12 @@ Name | Path | Note | @@ -9,6 +9,12 @@ Name | Path | Note | ||
9 | 品牌店铺分享页面 | /product/shop-share?domain=colormad | | 9 | 品牌店铺分享页面 | /product/shop-share?domain=colormad | |
10 | 商品详情 | /product/{productId} | | 10 | 商品详情 | /product/{productId} | |
11 | 资讯列表 | /news | | 11 | 资讯列表 | /news | |
12 | +yoho币 | /home/mycurrency | | ||
13 | +全部订单 | /home/orders?type=1 | | ||
14 | +待付款 | /home/orders?type=2 | | ||
15 | +待发货 | /home/orders?type=3 | | ||
16 | +待收货 | /home/orders?type=4 | | ||
17 | +订单详情 | /home/order-detail?orderCode=xxx | | ||
12 | 退货申请 | /home/refund?orderId=160181661 | | 18 | 退货申请 | /home/refund?orderId=160181661 | |
13 | 新品抢先看 | /product/new | | 19 | 新品抢先看 | /product/new | |
14 | 20 |
@@ -44,7 +44,6 @@ const order = { | @@ -44,7 +44,6 @@ 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; | ||
48 | 47 | ||
49 | uid = testUid; | 48 | uid = testUid; |
50 | if (!uid && req.xhr) { | 49 | if (!uid && req.xhr) { |
@@ -62,10 +61,7 @@ const order = { | @@ -62,10 +61,7 @@ const order = { | ||
62 | }; | 61 | }; |
63 | 62 | ||
64 | orderModel.getOrders(param).then(result => { | 63 | orderModel.getOrders(param).then(result => { |
65 | - if (result && page < result.data.pageTotal) { | ||
66 | - isEnd = false; | ||
67 | - } | ||
68 | - return res.json(Object.assign({isEnd: isEnd}, result)); | 64 | + return res.json(result); |
69 | }); | 65 | }); |
70 | }, | 66 | }, |
71 | getOrderDetailData: (req, res) => { | 67 | getOrderDetailData: (req, res) => { |
@@ -86,9 +82,9 @@ const order = { | @@ -86,9 +82,9 @@ const order = { | ||
86 | }); | 82 | }); |
87 | }, | 83 | }, |
88 | cancelOrder: (req, res) => { | 84 | cancelOrder: (req, res) => { |
89 | - let orderCode = req.query.orderCode; | ||
90 | - let reasonId = req.query.reasonId; | ||
91 | - let reason = req.query.reason; | 85 | + let orderCode = req.body.orderCode; |
86 | + let reasonId = req.body.reasonId; | ||
87 | + let reason = req.body.reason; | ||
92 | 88 | ||
93 | orderModel.cancelOrder(orderCode, reasonId, reason).then(result => { | 89 | orderModel.cancelOrder(orderCode, reasonId, reason).then(result => { |
94 | return res.json(result); | 90 | return res.json(result); |
@@ -96,14 +92,14 @@ const order = { | @@ -96,14 +92,14 @@ const order = { | ||
96 | 92 | ||
97 | }, | 93 | }, |
98 | confirmOrder: (req, res) => { | 94 | confirmOrder: (req, res) => { |
99 | - let orderode = req.query.orderCode; | 95 | + let orderode = req.body.orderCode; |
100 | 96 | ||
101 | orderModel.confirmOrder(orderode).then(result => { | 97 | orderModel.confirmOrder(orderode).then(result => { |
102 | return res.json(result); | 98 | return res.json(result); |
103 | }); | 99 | }); |
104 | }, | 100 | }, |
105 | deleteOrder: (req, res) => { | 101 | deleteOrder: (req, res) => { |
106 | - let orderCode = req.query.orderCode; | 102 | + let orderCode = req.body.orderCode; |
107 | let uid = req.user.uid; | 103 | let uid = req.user.uid; |
108 | 104 | ||
109 | uid = testUid; // 测试uid | 105 | uid = testUid; // 测试uid |
@@ -125,7 +121,6 @@ const order = { | @@ -125,7 +121,6 @@ const order = { | ||
125 | uid = testUid; | 121 | uid = testUid; |
126 | 122 | ||
127 | orderModel.getCoins(uid).then(result => { | 123 | orderModel.getCoins(uid).then(result => { |
128 | - // console.log(result) | ||
129 | res.render('coin', { | 124 | res.render('coin', { |
130 | module: 'home', | 125 | module: 'home', |
131 | page: 'coin', | 126 | page: 'coin', |
@@ -144,7 +139,6 @@ const order = { | @@ -144,7 +139,6 @@ const order = { | ||
144 | let uid = req.user.id; | 139 | let uid = req.user.id; |
145 | let page = req.query.page; | 140 | let page = req.query.page; |
146 | let limit = req.query.limit; | 141 | let limit = req.query.limit; |
147 | - let isend = true; | ||
148 | 142 | ||
149 | uid = testUid; | 143 | uid = testUid; |
150 | if (!uid && req.xhr) { | 144 | if (!uid && req.xhr) { |
@@ -155,10 +149,7 @@ const order = { | @@ -155,10 +149,7 @@ const order = { | ||
155 | } | 149 | } |
156 | 150 | ||
157 | orderModel.getCoinDetail(uid, page, limit).then(result => { | 151 | orderModel.getCoinDetail(uid, page, limit).then(result => { |
158 | - if (result && page < result.page_total) { | ||
159 | - isend = false; | ||
160 | - } | ||
161 | - return res.json(Object.assign({isEnd: isend}, result)); | 152 | + return res.json(result); |
162 | }); | 153 | }); |
163 | }, | 154 | }, |
164 | 155 |
@@ -89,7 +89,7 @@ const refund = { | @@ -89,7 +89,7 @@ const refund = { | ||
89 | }; | 89 | }; |
90 | 90 | ||
91 | refundModel.getRefundOrders(param).then(result => { | 91 | refundModel.getRefundOrders(param).then(result => { |
92 | - if (result && page < result.page_total) { | 92 | + if (result && page < result.pageTotal) { |
93 | isend = false; | 93 | isend = false; |
94 | } | 94 | } |
95 | return res.json(Object.assign({isend: isend}, result)); | 95 | return res.json(Object.assign({isend: isend}, result)); |
@@ -44,7 +44,7 @@ const refund = { | @@ -44,7 +44,7 @@ const refund = { | ||
44 | getRefundOrders(param) { | 44 | getRefundOrders(param) { |
45 | param = Object.assign({method: 'app.refund.getList'}, param); | 45 | param = Object.assign({method: 'app.refund.getList'}, param); |
46 | 46 | ||
47 | - return api.get('16303b76a9aa7b9b.json', param, { | 47 | + return api.get('', param, { |
48 | cache: true, | 48 | cache: true, |
49 | code: 200 | 49 | code: 200 |
50 | }).then(global.yoho.camelCase); | 50 | }).then(global.yoho.camelCase); |
1 | <template> | 1 | <template> |
2 | <div class="coin-detail"> | 2 | <div class="coin-detail"> |
3 | <p>明细列表</p> | 3 | <p>明细列表</p> |
4 | - <ul class="coin-detail-list"> | 4 | + <ul class="coin-detail-list" v-infinite-scroll="getCoinData()" infinite-scroll-disabled="busy" infinite-scroll-distance="10"> |
5 | <li v-for="coin in coinList"> | 5 | <li v-for="coin in coinList"> |
6 | <div class="coin-source"> | 6 | <div class="coin-source"> |
7 | <p>{{coin.message}}</p> | 7 | <p>{{coin.message}}</p> |
@@ -18,13 +18,12 @@ | @@ -18,13 +18,12 @@ | ||
18 | const $ = require('yoho-jquery'); | 18 | const $ = require('yoho-jquery'); |
19 | const tip = require('common/tip'); | 19 | const tip = require('common/tip'); |
20 | 20 | ||
21 | - // const Modal = require('common/modal'); | ||
22 | - | ||
23 | module.exports = { | 21 | module.exports = { |
24 | data() { | 22 | data() { |
25 | return { | 23 | return { |
26 | page: 0, | 24 | page: 0, |
27 | limit: 15, | 25 | limit: 15, |
26 | + pageTotal: 0, | ||
28 | coinList: [], | 27 | coinList: [], |
29 | busy: false, | 28 | busy: false, |
30 | }; | 29 | }; |
@@ -39,6 +38,9 @@ | @@ -39,6 +38,9 @@ | ||
39 | let _that = this; | 38 | let _that = this; |
40 | 39 | ||
41 | this.busy = true; | 40 | this.busy = true; |
41 | + if (this.page > this.pageTotal) { | ||
42 | + return; | ||
43 | + } | ||
42 | $.ajax({ | 44 | $.ajax({ |
43 | url: '/home/coin-detail', | 45 | url: '/home/coin-detail', |
44 | data: { | 46 | data: { |
@@ -47,13 +49,10 @@ | @@ -47,13 +49,10 @@ | ||
47 | } | 49 | } |
48 | }).then(result => { | 50 | }).then(result => { |
49 | if (result.code === 200) { | 51 | if (result.code === 200) { |
50 | - if (result.isend) { | ||
51 | - _that.busy = true; | ||
52 | - } else { | ||
53 | - _that.busy = false; | ||
54 | - } | 52 | + _that.busy = false; |
55 | if (result.data.coinlist.length > 0) { | 53 | if (result.data.coinlist.length > 0) { |
56 | - this.$set('coinList', result.data.coinlist); | 54 | + this.$set('coinList', _that.coinList.concat(result.data.coinlist)); |
55 | + _that.pageTotal = result.data.pageTotal; | ||
57 | } | 56 | } |
58 | } | 57 | } |
59 | }).fail(() => { | 58 | }).fail(() => { |
1 | <template> | 1 | <template> |
2 | - <ul v-infinite-scroll="getOrderData()" infinite-scroll-disabled="busy" infinite-scroll-distance="10"> | 2 | + <ul id="order-list" v-infinite-scroll="getOrderData()" infinite-scroll-disabled="busy" infinite-scroll-distance="10"> |
3 | <li class="order-item" v-for="(index, order) in orderList"> | 3 | <li class="order-item" v-for="(index, order) in orderList"> |
4 | <div class="order-detail"> | 4 | <div class="order-detail"> |
5 | <div class="order-code"> | 5 | <div class="order-code"> |
@@ -54,6 +54,7 @@ | @@ -54,6 +54,7 @@ | ||
54 | return { | 54 | return { |
55 | page: 0, | 55 | page: 0, |
56 | limit: 10, | 56 | limit: 10, |
57 | + pageTotal: 0, | ||
57 | type: this.$parent.$data.type, | 58 | type: this.$parent.$data.type, |
58 | orderList: [], | 59 | orderList: [], |
59 | busy: false, | 60 | busy: false, |
@@ -69,6 +70,9 @@ | @@ -69,6 +70,9 @@ | ||
69 | let _that = this; | 70 | let _that = this; |
70 | 71 | ||
71 | this.busy = true; | 72 | this.busy = true; |
73 | + if (this.page > this.pageTotal) { | ||
74 | + return; | ||
75 | + } | ||
72 | $.ajax({ | 76 | $.ajax({ |
73 | url: '/home/get-orders', | 77 | url: '/home/get-orders', |
74 | data: { | 78 | data: { |
@@ -78,13 +82,10 @@ | @@ -78,13 +82,10 @@ | ||
78 | } | 82 | } |
79 | }).then(result => { | 83 | }).then(result => { |
80 | if (result.code === 200) { | 84 | if (result.code === 200) { |
81 | - if (result.isEnd) { | ||
82 | - _that.busy = true; | ||
83 | - } else { | ||
84 | - _that.busy = false; | ||
85 | - } | 85 | + _that.busy = false; |
86 | if (result.data.orderList.length > 0) { | 86 | if (result.data.orderList.length > 0) { |
87 | - this.$set('orderList', result.data.orderList); | 87 | + this.$set('orderList', _that.orderList.concat(result.data.orderList)); |
88 | + _that.pageTotal = result.data.pageTotal; | ||
88 | } | 89 | } |
89 | } | 90 | } |
90 | }).fail(() => { | 91 | }).fail(() => { |
@@ -187,13 +188,5 @@ body { | @@ -187,13 +188,5 @@ body { | ||
187 | 188 | ||
188 | @import "../../scss/home/_order.css"; | 189 | @import "../../scss/home/_order.css"; |
189 | 190 | ||
190 | -.order-wrapper { | ||
191 | - height: 100%; | ||
192 | 191 | ||
193 | - ul { | ||
194 | - height: 100%; | ||
195 | - overflow-y: auto; | ||
196 | - -webkit-overflow-scrolling: touch; | ||
197 | - } | ||
198 | -} | ||
199 | </style> | 192 | </style> |
-
Please register or login to post a comment