Authored by TaoHuang

add pay info

@@ -118,15 +118,15 @@ export default { @@ -118,15 +118,15 @@ export default {
118 type: 'txt' 118 type: 'txt'
119 }).show(); 119 }).show();
120 }, 120 },
121 - onSuccess() { 121 + onSuccess(result) {
122 this.hide(); 122 this.hide();
123 this.$emit('on-pay-success'); 123 this.$emit('on-pay-success');
124 124
125 this.$router.push({ 125 this.$router.push({
126 name: 'OrderPay', 126 name: 'OrderPay',
127 query: { 127 query: {
128 - order_code: this.orderCode,  
129 - payment: PAYMENTS.ALIPAY + '_platform' 128 + orderCode: this.orderCode,
  129 + payParams: result.data.payParams
130 } 130 }
131 }); 131 });
132 } 132 }
@@ -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();
@@ -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
  19 + console.log(url);
17 } 20 }
  21 + },
  22 + methods: {}
18 }; 23 };
19 </script> 24 </script>
20 25
@@ -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
@@ -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 }) {
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,
@@ -326,6 +297,7 @@ module.exports = { @@ -326,6 +297,7 @@ module.exports = {
326 '/api/order/pay': { 297 '/api/order/pay': {
327 ufo: true, 298 ufo: true,
328 auth: true, 299 auth: true,
  300 + path: 'payment',
329 api: 'ufo.order.pay', 301 api: 'ufo.order.pay',
330 params: {} 302 params: {}
331 }, 303 },