Authored by TaoHuang

fix order confirm

const config = {
development: {
axiosBaseUrl: 'http://m.yohobuy.com:6001/xianyu',
axiosBaseUrl: 'http://m.yohobuy.com/xianyu',
axiosResponseType: 'json',
reportUrl: '//badjs.yoho.cn/apm/yas2.gif'
},
... ...
... ... @@ -24,8 +24,17 @@ import OrderMargin from './components/confirm/order-margin';
import OrderFee from './components/confirm/order-fee';
import OrderAgree from './components/confirm/agree';
import { createNamespacedHelpers } from 'vuex';
const { mapState, mapActions, mapMutations } = createNamespacedHelpers('order/orderConfirm');
export default {
name: 'OrderConfirm',
props: {
orderCode: {
type: String,
default: ''
}
},
components: {
ProductInfo,
AddressInfo,
... ... @@ -41,6 +50,12 @@ export default {
txt: '提交',
agree: false
};
},
mounted() {
this.fetchOrderDetail({orderCode: this.orderCode})
},
methods: {
...mapActions(['fetchOrderDetail'])
}
};
</script>
... ...
... ... @@ -9,8 +9,9 @@ export default [
},
{
name: 'OrderConfirm',
path: '/xianyu/order/confirm.html',
path: '/xianyu/order/confirm/:orderCode.html',
component: () => import(/* webpackChunkName: "order" */ './confirm'),
props: true
},
...PriceChange,
...OrderList,
... ...
import priceChange from './price-change';
import { get } from 'lodash';
import { getImgUrl } from '../../common/utils';
import orderList from './order-list';
import orderConfirm from './order-confirm';
export default function() {
return {
... ... @@ -9,55 +8,7 @@ export default function() {
modules: {
priceChange: priceChange(),
orderList: orderList(),
},
state: {
list: [],
resource: '',
page: 1,
size: 10,
},
mutations: {
addList(state, { list }) {
state.list = state.list.concat(list);
},
addResource(state, { url }) {
state.resource = url;
},
changePage(state, { page }) {
state.page = page;
},
},
actions: {
async fetchList({ commit, state }) {
let page = state.page;
const result = await this.$api.get('/api/union/inviteList', {
page: page,
size: state.size,
});
if (result.code === 200) {
commit('addList', { list: result.data.list });
commit('changePage', { page: ++page });
}
return result.data ? result.data.length : 0;
},
async fetchResource({ commit }) {
const result = await this.$api.get('/api/yoho/resource', {
content_code: 'a51c8222d21b3d88faa4a49c01c9c93e',
});
commit('addResource', {
url: getImgUrl(get(result, 'data[0].data.src') || '', 1000, 1000),
});
},
async fetchUnionStatus() {
const result = await this.$api.get('/api/union/queryUnion');
return result;
},
},
orderConfirm: orderConfirm()
}
};
}
... ...
... ... @@ -27,7 +27,7 @@ export default function() {
async fetchOrderDetail({ commit }, { tabType = 'sell', orderCode } = {}) {
commit(Types.FETCH_ORDER_DETAIL_REQUEST);
const result = await this.$api.post('', {
const result = await this.$api.post('/api/order/detail', {
tabType,
orderCode: orderCode
});
... ...
... ... @@ -16,6 +16,7 @@ module.exports = {
// 订单详情
'/api/order/detail': {
ufo: true,
auth: true,
api: 'ufo.order.detail',
params: {
tabType: { type: Number, require: true }, // 订单来源
... ...