export default [{
name: 'GainShow',
path: '/xianyu/order/show.html',
component: () => import(/* webpackChunkName: "gain" */ './order')
}];
import PriceChange from './price-change';
export default [...PriceChange];
... ...
// 调价首页路由
export default [{
path: '/xianyu/order/priceChange/:orderId(\\d+).html',
name: 'PriceChange',
component: () => import(/* webpackChunkName: "priceChange" */ './list')
}];
... ...
<template>
<LayoutApp :title="title" :class="classes">
<ScrollView ref="scroll" :options="scrollOption" @pulling-up="onPullingUp" @pulling-down="onPullingDown">
<div class="order-page">
<div class="title">出售中</div>
<div class="product" @click="onClickProduct">
<ImgSize class="pro-img" :src="productInfo.imageUrl" :width="200" :height="200"></ImgSize>
</div>
</div>
</ScrollView>
</LayoutApp>
</template>
<script>
import LayoutApp from '../../../components/layout/layout-app';
import ScrollView from '../../../components/layout/scroll-view';
import {createNamespacedHelpers} from 'vuex';
import ImgSize from '../../../components/img-size';
const {mapState, mapActions, mapMutations} = createNamespacedHelpers('order/priceChange')
export default {
components: {ImgSize, ScrollView, LayoutApp},
name: 'PriceChange',
data() {
return {
title: '订单',
classes: {},
scrollOption: {
pullDownRefresh: {
threshold: 70,
stop: 90
},
observeDOM: false,
pullUpLoad: true
},
page: 1,
modalLoad: false,
pageSize: 10,
};
},
asyncData({store, router}) {
return store.dispatch('order/priceChange/fetchProduct', {productId: router.params.orderId});
},
mounted() {
this.modalLoad = true;
},
computed: {
...mapState(['productInfo', 'skcs']),
},
methods: {
...mapMutations(['fetchProduct']),
async onPullingUp() {
},
async onPullingDown() {
},
onClickProduct() {
}
}
};
</script>
<style lang="scss" scoped>
.order-page {
.title {
line-height: 95px;
font-size: 68px;
font-weight: bold;
padding: 24px 40px 0 40px;
}
}
</style>
... ...
export default [{
path: '/xianyu/test/test.html',
name: 'testPage',
component: () => import(/* webpackChunkName: "invite" */ './test'),
}];
... ...
<template>
<div class="page-container">
<LayoutApp :title="title" :show-back="false"></LayoutApp>
</div>
</template>
<script>
import LayoutApp from '../components/layout/layout-app';
export default {
name: 'testPage',
components: {LayoutApp},
mounted() {
},
data() {
return {
title: '测试页面',
};
},
computed: {
},
methods: {
}
};
</script>
<style lang="scss" scoped>
.page-container {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
overflow: hidden;
/deep/ .layout {
.layout-header {
background-color: #444;
color: #fff;
}
}
}
</style>
... ...
import { get } from 'lodash';
import { getImgUrl } from '../../common/utils';
import priceChange from './price-change';
export default function() {
return {
namespaced: true,
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;
}
},
modules: {
priceChange: priceChange()
}
};
}
... ...
import * as Types from './types';
import {first, get, flatten} from 'lodash';
export default {
async fetchProduct({commit}, {productId, page = 1, refresh = false}) {
commit(Types.FETCH_ORDER_PRODUCT_REQUEST);
let result;
if (refresh) {
const results = await Promise.all(Array.from(new Array(page)).map((v, i) => {
return this.$api.get('/api/ufo/seller/entryGoodsSizeList', {
productId,
page: i + 1
});
}));
result = {
code: 200,
data: {
productInfo: get(first(results), 'data.productInfo'),
data: flatten(results.map(r => get(r, 'data.data', [])))
}
};
} else {
result = await this.$api.get('/api/ufo/seller/entryGoodsSizeList', {
productId,
page
});
}
console.log(result);
if (result && result.code === 200) {
commit(Types.FETCH_ORDER_PRODUCT_SUCCESS, {
order: result.data,
refresh
});
} else {
commit(Types.FETCH_ORDER_PRODUCT_FAILED);
}
}
};
... ...
import actions from './actions';
import mutations from './mutations';
export default function() {
return {
namespaced: true,
state: {
fetchingPro: false,
fetchingNoSale: false,
fetchingChangePrice: false,
fetchingCalcPrice: false,
productInfo: {},
skcs: []
},
actions,
mutations
};
}
... ...
import * as Types from './types';
export default {
[Types.FETCH_ORDER_PRODUCT_REQUEST](state) {
state.orderInfo = {};
state.fetchingPro = true;
},
[Types.FETCH_ORDER_PRODUCT_FAILED](state) {
state.fetchingPro = false;
},
[Types.FETCH_ORDER_PRODUCT_SUCCESS](state, {order, refresh}) {
state.fetchingPro = false;
if (order.productInfo && state.productInfo.productId !== order.productInfo.productId || refresh) {
state.productInfo = order.productInfo || state.productInfo;
}
if (refresh) {
state.skcs = order.data;
} else if (order.data) {
state.skcs = state.skcs.concat(order.data);
}
},
};
... ...
export const FETCH_ORDER_PRODUCT_REQUEST = 'FETCH_ORDER_PRODUCT_REQUEST';
export const FETCH_ORDER_PRODUCT_FAILED = 'FETCH_ORDER_PRODUCT_FAILED';
export const FETCH_ORDER_PRODUCT_SUCCESS = 'FETCH_ORDER_PRODUCT_SUCCESS';
export const POST_NOSALE_REQUEST = 'POST_NO_SALE_REQUEST';
export const POST_NOSALE_FAILED = 'POST_NOSALE_FAILED';
export const POST_NOSALE_SUCCESS = 'POST_NOSALE_SUCCESS';
export const POST_CHANGE_PRICE_REQUEST = 'POST_CHANGE_PRICE_REQUEST';
export const POST_CHANGEPRICE_FAILED = 'POST_CHANGEPRICE_FAILED';
export const POST_CHANGEPRICE_SUCCESS = 'POST_CHANGEPRICE_SUCCESS';
export const MERGE_CHANGEPRICE_DATA = 'MERGE_CHANGEPRICE_DATA';
export const POST_CALCPRICE_REQUEST = 'POST_CALCPRICE_REQUEST';
export const POST_CALCPRICE_FAILED = 'POST_CALCPRICE_FAILED';
export const POST_CALCPRICE_SUCCESS = 'POST_CALCPRICE_SUCCESS';
... ...
... ... @@ -28,5 +28,16 @@ module.exports = {
'/api/union/queryUnion': {
api: 'app.union.shareOrder.queryUnionTypeByUid',
params: {}
},
'/api/ufo/seller/entryGoodsSizeList': {
accessLog: true,
checkSign: false,
ufo: true,
api: 'ufo.seller.entryGoodsSizeList',
params: {
productId: {type: Number},
limit: {type: Number},
page: {type: Number}
}
}
};
... ...