Authored by TaoHuang

fix order confirm

1 const config = { 1 const config = {
2 development: { 2 development: {
3 - axiosBaseUrl: 'http://m.yohobuy.com:6001/xianyu', 3 + axiosBaseUrl: 'http://m.yohobuy.com/xianyu',
4 axiosResponseType: 'json', 4 axiosResponseType: 'json',
5 reportUrl: '//badjs.yoho.cn/apm/yas2.gif' 5 reportUrl: '//badjs.yoho.cn/apm/yas2.gif'
6 }, 6 },
@@ -24,8 +24,17 @@ import OrderMargin from './components/confirm/order-margin'; @@ -24,8 +24,17 @@ import OrderMargin from './components/confirm/order-margin';
24 import OrderFee from './components/confirm/order-fee'; 24 import OrderFee from './components/confirm/order-fee';
25 import OrderAgree from './components/confirm/agree'; 25 import OrderAgree from './components/confirm/agree';
26 26
  27 +import { createNamespacedHelpers } from 'vuex';
  28 +const { mapState, mapActions, mapMutations } = createNamespacedHelpers('order/orderConfirm');
  29 +
27 export default { 30 export default {
28 name: 'OrderConfirm', 31 name: 'OrderConfirm',
  32 + props: {
  33 + orderCode: {
  34 + type: String,
  35 + default: ''
  36 + }
  37 + },
29 components: { 38 components: {
30 ProductInfo, 39 ProductInfo,
31 AddressInfo, 40 AddressInfo,
@@ -41,6 +50,12 @@ export default { @@ -41,6 +50,12 @@ export default {
41 txt: '提交', 50 txt: '提交',
42 agree: false 51 agree: false
43 }; 52 };
  53 + },
  54 + mounted() {
  55 + this.fetchOrderDetail({orderCode: this.orderCode})
  56 + },
  57 + methods: {
  58 + ...mapActions(['fetchOrderDetail'])
44 } 59 }
45 }; 60 };
46 </script> 61 </script>
@@ -9,8 +9,9 @@ export default [ @@ -9,8 +9,9 @@ export default [
9 }, 9 },
10 { 10 {
11 name: 'OrderConfirm', 11 name: 'OrderConfirm',
12 - path: '/xianyu/order/confirm.html', 12 + path: '/xianyu/order/confirm/:orderCode.html',
13 component: () => import(/* webpackChunkName: "order" */ './confirm'), 13 component: () => import(/* webpackChunkName: "order" */ './confirm'),
  14 + props: true
14 }, 15 },
15 ...PriceChange, 16 ...PriceChange,
16 ...OrderList, 17 ...OrderList,
1 import priceChange from './price-change'; 1 import priceChange from './price-change';
2 -import { get } from 'lodash';  
3 -import { getImgUrl } from '../../common/utils';  
4 import orderList from './order-list'; 2 import orderList from './order-list';
  3 +import orderConfirm from './order-confirm';
5 4
6 export default function() { 5 export default function() {
7 return { 6 return {
@@ -9,55 +8,7 @@ export default function() { @@ -9,55 +8,7 @@ export default function() {
9 modules: { 8 modules: {
10 priceChange: priceChange(), 9 priceChange: priceChange(),
11 orderList: orderList(), 10 orderList: orderList(),
12 - },  
13 - state: {  
14 - list: [],  
15 - resource: '',  
16 - page: 1,  
17 - size: 10,  
18 - },  
19 - mutations: {  
20 - addList(state, { list }) {  
21 - state.list = state.list.concat(list);  
22 - },  
23 - addResource(state, { url }) {  
24 - state.resource = url;  
25 - },  
26 - changePage(state, { page }) {  
27 - state.page = page;  
28 - },  
29 - },  
30 - actions: {  
31 - async fetchList({ commit, state }) {  
32 - let page = state.page;  
33 -  
34 - const result = await this.$api.get('/api/union/inviteList', {  
35 - page: page,  
36 - size: state.size,  
37 - });  
38 -  
39 - if (result.code === 200) {  
40 - commit('addList', { list: result.data.list });  
41 - commit('changePage', { page: ++page }); 11 + orderConfirm: orderConfirm()
42 } 12 }
43 -  
44 - return result.data ? result.data.length : 0;  
45 - },  
46 - async fetchResource({ commit }) {  
47 - const result = await this.$api.get('/api/yoho/resource', {  
48 - content_code: 'a51c8222d21b3d88faa4a49c01c9c93e',  
49 - });  
50 -  
51 - commit('addResource', {  
52 - url: getImgUrl(get(result, 'data[0].data.src') || '', 1000, 1000),  
53 - });  
54 - },  
55 -  
56 - async fetchUnionStatus() {  
57 - const result = await this.$api.get('/api/union/queryUnion');  
58 -  
59 - return result;  
60 - },  
61 - },  
62 }; 13 };
63 } 14 }
@@ -27,7 +27,7 @@ export default function() { @@ -27,7 +27,7 @@ export default function() {
27 async fetchOrderDetail({ commit }, { tabType = 'sell', orderCode } = {}) { 27 async fetchOrderDetail({ commit }, { tabType = 'sell', orderCode } = {}) {
28 commit(Types.FETCH_ORDER_DETAIL_REQUEST); 28 commit(Types.FETCH_ORDER_DETAIL_REQUEST);
29 29
30 - const result = await this.$api.post('', { 30 + const result = await this.$api.post('/api/order/detail', {
31 tabType, 31 tabType,
32 orderCode: orderCode 32 orderCode: orderCode
33 }); 33 });
@@ -16,6 +16,7 @@ module.exports = { @@ -16,6 +16,7 @@ module.exports = {
16 // 订单详情 16 // 订单详情
17 '/api/order/detail': { 17 '/api/order/detail': {
18 ufo: true, 18 ufo: true,
  19 + auth: true,
19 api: 'ufo.order.detail', 20 api: 'ufo.order.detail',
20 params: { 21 params: {
21 tabType: { type: Number, require: true }, // 订单来源 22 tabType: { type: Number, require: true }, // 订单来源