Merge branch 'develop' of http://git.yoho.cn/fe/xianyu-ufo-app-web into develop
Showing
13 changed files
with
126 additions
and
85 deletions
@@ -56,6 +56,12 @@ export default { | @@ -56,6 +56,12 @@ export default { | ||
56 | desc: { | 56 | desc: { |
57 | type: String, | 57 | type: String, |
58 | default: '' | 58 | default: '' |
59 | + }, | ||
60 | + extra: { | ||
61 | + type: Object, | ||
62 | + default() { | ||
63 | + return {}; | ||
64 | + } | ||
59 | } | 65 | } |
60 | }, | 66 | }, |
61 | components: { | 67 | components: { |
@@ -76,7 +82,7 @@ export default { | @@ -76,7 +82,7 @@ export default { | ||
76 | async mounted() { | 82 | async mounted() { |
77 | }, | 83 | }, |
78 | methods: { | 84 | methods: { |
79 | - ...mapOrderAction(['fetchPayList']), | 85 | + ...mapOrderAction(['payAction']), |
80 | show() { | 86 | show() { |
81 | this.$refs.actionSheet.show(); | 87 | this.$refs.actionSheet.show(); |
82 | }, | 88 | }, |
@@ -90,11 +96,37 @@ export default { | @@ -90,11 +96,37 @@ export default { | ||
90 | pay() { | 96 | pay() { |
91 | this.$emit('confirmAction'); | 97 | this.$emit('confirmAction'); |
92 | 98 | ||
99 | + const toast = this.$createToast({ | ||
100 | + txt: '正在调起支付宝' | ||
101 | + }).show(); | ||
102 | + | ||
103 | + this.payAction({ | ||
104 | + orderCode: this.orderCode | ||
105 | + }).then((result) => { | ||
106 | + toast.hide(); | ||
107 | + this.onSuccess(result); | ||
108 | + }).catch((result) => { | ||
109 | + toast.hide(); | ||
110 | + this.onError(result); | ||
111 | + }); | ||
112 | + }, | ||
113 | + onError(result) { | ||
114 | + this.$emit('on-pay-error'); | ||
115 | + this.$createToast({ | ||
116 | + txt: result.message, | ||
117 | + time: 1500, | ||
118 | + type: 'txt' | ||
119 | + }).show(); | ||
120 | + }, | ||
121 | + onSuccess(result) { | ||
122 | + this.hide(); | ||
123 | + this.$emit('on-pay-success'); | ||
124 | + | ||
93 | this.$router.push({ | 125 | this.$router.push({ |
94 | name: 'OrderPay', | 126 | name: 'OrderPay', |
95 | query: { | 127 | query: { |
96 | - order_code: this.orderCode, | ||
97 | - payment: PAYMENTS.ALIPAY + '_platform' | 128 | + orderCode: this.orderCode, |
129 | + payParams: result.data.payParams | ||
98 | } | 130 | } |
99 | }); | 131 | }); |
100 | } | 132 | } |
@@ -52,8 +52,15 @@ yoho.auth = async(loginUrl) => { | @@ -52,8 +52,15 @@ yoho.auth = async(loginUrl) => { | ||
52 | if (user && user.uid) { | 52 | if (user && user.uid) { |
53 | return user; | 53 | return user; |
54 | } else { | 54 | } else { |
55 | - cookie.set('third_backurl', location.href); | ||
56 | - location.href = loginUrl || `${location.origin}/xianyu/passport/login/taobao`; | 55 | + cookie.set('third_backurl', location.href, { |
56 | + domain: '.yohobuy.com', | ||
57 | + path: '/' | ||
58 | + }); | ||
59 | + console.log(location.href) | ||
60 | + | ||
61 | + setTimeout(() => { | ||
62 | + location.href = loginUrl || `${location.origin}/xianyu/passport/login/taobao`; | ||
63 | + }, 100); | ||
57 | return; | 64 | return; |
58 | } | 65 | } |
59 | } | 66 | } |
@@ -107,7 +107,7 @@ export default { | @@ -107,7 +107,7 @@ export default { | ||
107 | } | 107 | } |
108 | }, | 108 | }, |
109 | activated() { | 109 | activated() { |
110 | - this.selectedAddressId = this.$route.query.addressId; | 110 | + this.selectedAddressId = this.$route.query.address_id; |
111 | this.fetchUserAddressList(); | 111 | this.fetchUserAddressList(); |
112 | }, | 112 | }, |
113 | beforeRouteEnter(to, from, next) { | 113 | beforeRouteEnter(to, from, next) { |
@@ -61,7 +61,15 @@ export default { | @@ -61,7 +61,15 @@ export default { | ||
61 | storageId: this.storageId | 61 | storageId: this.storageId |
62 | }); | 62 | }); |
63 | 63 | ||
64 | - await this.fetchPayment({ skup: this.productDetail.skup }); | 64 | + const payInfo = await this.fetchPayment({ skup: this.productDetail.skup }); |
65 | + | ||
66 | + if (payInfo?.code !== 200) { | ||
67 | + this.$createToast({ | ||
68 | + time: 2000, | ||
69 | + txt: payInfo.message, | ||
70 | + type: 'txt' | ||
71 | + }).show(); | ||
72 | + } | ||
65 | 73 | ||
66 | if (this.address.address_id) { | 74 | if (this.address.address_id) { |
67 | await this.compute(); | 75 | await this.compute(); |
@@ -154,37 +162,31 @@ export default { | @@ -154,37 +162,31 @@ export default { | ||
154 | 162 | ||
155 | await this.compute(); | 163 | await this.compute(); |
156 | 164 | ||
157 | - const { data: { orderCode, message } } = await this.buyPayAction({ | 165 | + const result = await this.buyPayAction({ |
158 | skup: this.productDetail.skup, | 166 | skup: this.productDetail.skup, |
159 | addressId: this.address.address_id, | 167 | addressId: this.address.address_id, |
160 | couponCode: get(this.orderDetail, 'recommendedCouponInfo.coupon_code', ''), | 168 | couponCode: get(this.orderDetail, 'recommendedCouponInfo.coupon_code', ''), |
161 | promotionId: get(this.orderDetail, 'promotionTips.promotionIds', '') | 169 | promotionId: get(this.orderDetail, 'promotionTips.promotionIds', '') |
162 | }); | 170 | }); |
163 | 171 | ||
164 | - if (!orderCode) { | 172 | + if (!result?.data?.orderCode) { |
165 | this.$createToast({ | 173 | this.$createToast({ |
166 | time: 1500, | 174 | time: 1500, |
167 | - txt: message, | 175 | + txt: result?.message, |
168 | type: 'txt' | 176 | type: 'txt' |
169 | }).show(); | 177 | }).show(); |
170 | return; | 178 | return; |
171 | } | 179 | } |
172 | 180 | ||
173 | this.$createOrderPayType({ | 181 | this.$createOrderPayType({ |
174 | - orderCode, | 182 | + orderCode: result.data.orderCode, |
175 | price: this.orderDetail.amount, | 183 | price: this.orderDetail.amount, |
176 | desc: '金额', | 184 | desc: '金额', |
177 | onCloseAction() { | 185 | onCloseAction() { |
178 | - vm.onClose(orderCode); | 186 | + vm.onClose(result.data.orderCode); |
179 | }, | 187 | }, |
180 | - onPayAction() { | ||
181 | - vm.onPay(); | ||
182 | - } | ||
183 | }).show(); | 188 | }).show(); |
184 | }, | 189 | }, |
185 | - onPay() { | ||
186 | - console.log('ok'); | ||
187 | - }, | ||
188 | onClose(orderCode) { | 190 | onClose(orderCode) { |
189 | this.$router.push({ | 191 | this.$router.push({ |
190 | name: 'orderDetail', | 192 | name: 'orderDetail', |
@@ -199,8 +201,6 @@ export default { | @@ -199,8 +201,6 @@ export default { | ||
199 | </script> | 201 | </script> |
200 | 202 | ||
201 | <style lang="scss" scoped> | 203 | <style lang="scss" scoped> |
202 | -@import '~statics/scss/variable.scss'; | ||
203 | - | ||
204 | .footer { | 204 | .footer { |
205 | position: absolute; | 205 | position: absolute; |
206 | bottom: 0; | 206 | bottom: 0; |
@@ -36,7 +36,10 @@ export default { | @@ -36,7 +36,10 @@ export default { | ||
36 | methods: { | 36 | methods: { |
37 | onClick() { | 37 | onClick() { |
38 | this.$router.push({ | 38 | this.$router.push({ |
39 | - name: 'address' | 39 | + name: 'address', |
40 | + query: { | ||
41 | + address_id: this.data.address_id | ||
42 | + } | ||
40 | }); | 43 | }); |
41 | } | 44 | } |
42 | } | 45 | } |
@@ -87,6 +87,8 @@ export default { | @@ -87,6 +87,8 @@ export default { | ||
87 | this.canScan = true; | 87 | this.canScan = true; |
88 | } | 88 | } |
89 | 89 | ||
90 | + this.$yoho.auth(); | ||
91 | + | ||
90 | this.fetchAppraiseAddressChangeNotice({orderCode: this.orderCode}).then(res => { | 92 | this.fetchAppraiseAddressChangeNotice({orderCode: this.orderCode}).then(res => { |
91 | let isChanged = get(res, 'data.isChanged'); | 93 | let isChanged = get(res, 'data.isChanged'); |
92 | let isForceShow = get(res, 'data.isForceShow'); | 94 | let isForceShow = get(res, 'data.isForceShow'); |
@@ -17,8 +17,8 @@ export default [ | @@ -17,8 +17,8 @@ export default [ | ||
17 | path: '/xianyu/order/pay.html', | 17 | path: '/xianyu/order/pay.html', |
18 | component: () => import(/* webpackChunkName: "order" */ './pay'), | 18 | component: () => import(/* webpackChunkName: "order" */ './pay'), |
19 | props: route => ({ | 19 | props: route => ({ |
20 | - orderCode: route.query.order_code, | ||
21 | - payment: route.query.payment, | 20 | + orderCode: route.query.orderCode, |
21 | + payParams: route.query.payParams, | ||
22 | }), | 22 | }), |
23 | }, | 23 | }, |
24 | { | 24 | { |
1 | <template> | 1 | <template> |
2 | <div> | 2 | <div> |
3 | -{{orderCode}} | ||
4 | - | ||
5 | - {{payment}} | 3 | +{{orderCode}} <====> |
4 | + {{payParams}} | ||
6 | </div> | 5 | </div> |
7 | </template> | 6 | </template> |
8 | 7 | ||
9 | <script> | 8 | <script> |
9 | + | ||
10 | +const ALIPAY_DOMAIN = 'https://mapi.alipay.com/gateway.do'; | ||
11 | + | ||
10 | export default { | 12 | export default { |
11 | name: 'PayPage', | 13 | name: 'PayPage', |
12 | - props: ['orderCode', 'payment'], | 14 | + props: ['orderCode', 'payParams'], |
13 | mounted() { | 15 | mounted() { |
14 | - }, | ||
15 | - methods: { | 16 | + if (this.payParams) { |
17 | + const url = ALIPAY_DOMAIN + '?' + encodeURIComponent(this.payParams); | ||
16 | 18 | ||
17 | - } | 19 | + console.log(url); |
20 | + } | ||
21 | + }, | ||
22 | + methods: {} | ||
18 | }; | 23 | }; |
19 | </script> | 24 | </script> |
20 | 25 |
@@ -128,33 +128,24 @@ export default { | @@ -128,33 +128,24 @@ export default { | ||
128 | return; | 128 | return; |
129 | } | 129 | } |
130 | 130 | ||
131 | - const { orderCode } = orderResult.data; | ||
132 | - | ||
133 | this.orderPay = this.$createOrderPayType({ | 131 | this.orderPay = this.$createOrderPayType({ |
134 | price: this.fee.earnestMoneyStr, | 132 | price: this.fee.earnestMoneyStr, |
135 | desc: '保证金', | 133 | desc: '保证金', |
136 | - orderCode, | 134 | + orderCode: orderResult.data.orderCode, |
137 | onCloseAction() { | 135 | onCloseAction() { |
138 | - vm.onClose(); | ||
139 | - vm.$router.push({ | ||
140 | - name: 'orderDetail', | ||
141 | - params: { | ||
142 | - owner: UserType.sell, | ||
143 | - code: orderCode | ||
144 | - } | ||
145 | - }); | ||
146 | - }, | ||
147 | - onPayAction() { | ||
148 | - vm.onPay(); | 136 | + vm.onClose(orderResult.data.orderCode); |
149 | } | 137 | } |
150 | }).show(); | 138 | }).show(); |
151 | }, | 139 | }, |
152 | - onClose() { | ||
153 | - console.log('close'); | 140 | + onClose(orderCode) { |
141 | + this.$router.push({ | ||
142 | + name: 'orderDetail', | ||
143 | + params: { | ||
144 | + owner: UserType.sell, | ||
145 | + code: orderCode | ||
146 | + } | ||
147 | + }); | ||
154 | }, | 148 | }, |
155 | - onPay() { | ||
156 | - console.log('pay'); | ||
157 | - } | ||
158 | } | 149 | } |
159 | }; | 150 | }; |
160 | </script> | 151 | </script> |
@@ -18,5 +18,8 @@ export default { | @@ -18,5 +18,8 @@ export default { | ||
18 | }, | 18 | }, |
19 | [Types.SET_USER_ADDRESS_INFO](state, addressInfo) { | 19 | [Types.SET_USER_ADDRESS_INFO](state, addressInfo) { |
20 | state.addressInfo = addressInfo || {}; | 20 | state.addressInfo = addressInfo || {}; |
21 | + | ||
22 | + // 修改根状态 | ||
23 | + this.state.order.orderConfirm.address = addressInfo; | ||
21 | } | 24 | } |
22 | }; | 25 | }; |
@@ -117,9 +117,13 @@ export default function() { | @@ -117,9 +117,13 @@ export default function() { | ||
117 | } | 117 | } |
118 | }, | 118 | }, |
119 | actions: { | 119 | actions: { |
120 | - async fetchOrderAddress({ commit }, payload) { | 120 | + async fetchOrderAddress({ commit, state }, payload) { |
121 | const orderCount = await this.$api.get('/api/order/confirm/count', payload); | 121 | const orderCount = await this.$api.get('/api/order/confirm/count', payload); |
122 | 122 | ||
123 | + if (state.address?.address_id) { | ||
124 | + return; | ||
125 | + } | ||
126 | + | ||
123 | if (get(orderCount, 'data.cnt', 0)) { | 127 | if (get(orderCount, 'data.cnt', 0)) { |
124 | const addressInfo = await this.$api.get('/api/order/confirm/address'); | 128 | const addressInfo = await this.$api.get('/api/order/confirm/address'); |
125 | 129 | ||
@@ -143,8 +147,8 @@ export default function() { | @@ -143,8 +147,8 @@ export default function() { | ||
143 | }, | 147 | }, |
144 | 148 | ||
145 | async fetchUserStatus() { | 149 | async fetchUserStatus() { |
146 | - const alipayStatus = await this.$api.get('/api/order/alipay/status'); | ||
147 | - const userStatus = await this.$api.get('/api/order/user/status'); | 150 | + // const alipayStatus = await this.$api.get('/api/order/alipay/status'); |
151 | + // const userStatus = await this.$api.get('/api/order/user/status'); | ||
148 | }, | 152 | }, |
149 | 153 | ||
150 | async submitOrder({ commit }, payload) { | 154 | async submitOrder({ commit }, payload) { |
@@ -159,10 +163,12 @@ export default function() { | @@ -159,10 +163,12 @@ export default function() { | ||
159 | const orderInfo = await this.$api.post('/api/order/confirm/buypayment', { skup, api_version: 1 }); | 163 | const orderInfo = await this.$api.post('/api/order/confirm/buypayment', { skup, api_version: 1 }); |
160 | 164 | ||
161 | if (orderInfo.code !== 200) { | 165 | if (orderInfo.code !== 200) { |
162 | - return; | 166 | + return orderInfo; |
163 | } | 167 | } |
164 | 168 | ||
165 | commit(Types.FETCH_ORDER_BUY_ORDER, orderInfo.data); | 169 | commit(Types.FETCH_ORDER_BUY_ORDER, orderInfo.data); |
170 | + | ||
171 | + return orderInfo; | ||
166 | }, | 172 | }, |
167 | 173 | ||
168 | async computeOrder({ commit }, { skup, couponCode, addressId, promotionId }) { | 174 | async computeOrder({ commit }, { skup, couponCode, addressId, promotionId }) { |
@@ -193,6 +199,19 @@ export default function() { | @@ -193,6 +199,19 @@ export default function() { | ||
193 | }); | 199 | }); |
194 | 200 | ||
195 | return order; | 201 | return order; |
202 | + }, | ||
203 | + | ||
204 | + async payAction(ctx, { orderCode }) { | ||
205 | + const payResult = await this.$api.post('/api/order/pay', { | ||
206 | + orderCode, | ||
207 | + payment: 2 | ||
208 | + }); | ||
209 | + | ||
210 | + if (payResult.code !== 200) { | ||
211 | + return Promise.reject(payResult); | ||
212 | + } | ||
213 | + | ||
214 | + return payResult; | ||
196 | } | 215 | } |
197 | }, | 216 | }, |
198 | getters: {}, | 217 | getters: {}, |
1 | module.exports = { | 1 | module.exports = { |
2 | - '/api/ufo/invite/friendList': { | ||
3 | - ufo: true, | ||
4 | - api: 'ufo.invite.code', | ||
5 | - params: {}, | ||
6 | - }, | ||
7 | - '/api/ufo/invite/recordDetailList': { | ||
8 | - ufo: true, | ||
9 | - api: 'ufo.invite.getInviteSettlementItemList', | ||
10 | - params: {}, | ||
11 | - }, | ||
12 | - '/api/yoho/resource': { | ||
13 | - service: true, | ||
14 | - api: 'operations/api/v5/resource/get', | ||
15 | - params: { | ||
16 | - content_code: { type: String }, | ||
17 | - }, | ||
18 | - }, | ||
19 | - '/api/union/inviteList': { | ||
20 | - api: 'app.union.shareOrder.queryInviteYohoList', | ||
21 | - params: { | ||
22 | - page: { type: Number }, | ||
23 | - size: { type: Number }, | ||
24 | - }, | ||
25 | - }, | ||
26 | - '/api/union/queryUnion': { | ||
27 | - api: 'app.union.shareOrder.queryUnionTypeByUid', | ||
28 | - params: {}, | ||
29 | - }, | ||
30 | - | ||
31 | // 获取调价商品及尺码信息 | 2 | // 获取调价商品及尺码信息 |
32 | '/api/ufo/seller/entryGoodsSizeList': { | 3 | '/api/ufo/seller/entryGoodsSizeList': { |
33 | auth: true, | 4 | auth: true, |
@@ -322,6 +293,15 @@ module.exports = { | @@ -322,6 +293,15 @@ module.exports = { | ||
322 | params: {}, | 293 | params: {}, |
323 | }, | 294 | }, |
324 | 295 | ||
296 | + // 支付下单 | ||
297 | + '/api/order/pay': { | ||
298 | + ufo: true, | ||
299 | + auth: true, | ||
300 | + path: 'payment', | ||
301 | + api: 'ufo.order.pay', | ||
302 | + params: {} | ||
303 | + }, | ||
304 | + | ||
325 | // 订单物流信息 | 305 | // 订单物流信息 |
326 | '/api/order/express': { | 306 | '/api/order/express': { |
327 | ufo: true, | 307 | ufo: true, |
1 | 1 | ||
2 | const _ = require('lodash'); | 2 | const _ = require('lodash'); |
3 | -const url = require('url'); | ||
4 | const uuid = require('uuid'); | 3 | const uuid = require('uuid'); |
5 | const passport = require('passport'); | 4 | const passport = require('passport'); |
6 | const TaobaoStrategy = require('./passport-taobao'); | 5 | const TaobaoStrategy = require('./passport-taobao'); |
@@ -150,7 +149,7 @@ const login = { | @@ -150,7 +149,7 @@ const login = { | ||
150 | 149 | ||
151 | if (result.code === 200) { | 150 | if (result.code === 200) { |
152 | if (_.get(result, 'data.is_bind') === 'N') { | 151 | if (_.get(result, 'data.is_bind') === 'N') { |
153 | - redirectUrl = req.cookies.third_backurl ? url.parse(req.cookies.third_backurl) : homePage; | 152 | + redirectUrl = req.cookies.third_backurl ? req.cookies.third_backurl : homePage; |
154 | redirectUrl += redirectUrl.indexOf('?') > 0 ? '&' : '?'; | 153 | redirectUrl += redirectUrl.indexOf('?') > 0 ? '&' : '?'; |
155 | redirectUrl += 'bind_code=' + encodeURIComponent(aes.dynamicEncryption(`taobao::${user.open_uid}`)); | 154 | redirectUrl += 'bind_code=' + encodeURIComponent(aes.dynamicEncryption(`taobao::${user.open_uid}`)); |
156 | } else if (+_.get(result, 'data.uid') > 0) { | 155 | } else if (+_.get(result, 'data.uid') > 0) { |
@@ -160,7 +159,7 @@ const login = { | @@ -160,7 +159,7 @@ const login = { | ||
160 | req, | 159 | req, |
161 | res | 160 | res |
162 | }).finally(() => { | 161 | }).finally(() => { |
163 | - let refer = req.cookies.third_backurl ? url.parse(req.cookies.third_backurl) : homePage; | 162 | + let refer = req.cookies.third_backurl ? req.cookies.third_backurl : homePage; |
164 | 163 | ||
165 | return res.redirect(refer); | 164 | return res.redirect(refer); |
166 | }); | 165 | }); |
-
Please register or login to post a comment