Authored by htoooth

add coupon

  1 +# 有货App优惠券列表
  2 +
  3 +包括:
  4 +
  5 +* 有货优惠券列表
  6 +* UFO优惠券列表
  1 +import Ufo from './ufo';
  2 +import Yoho from './yoho';
  3 +
  4 +export default [...Ufo, ...Yoho];
  1 +export default [{
  2 + path: '/coupon/ufo',
  3 + name: 'ufolist',
  4 + component: () => import(/* webpackChunkName: "coupon" */ './list')
  5 +}];
  1 +<template>
  2 + <LayoutApp>
  3 + <div class="order-page">
  4 + <div class="title">出售中</div>
  5 + <div class="product">
  6 + <p class="name">{{orderProduct}}</p>
  7 + <p>{{orderDetail}}</p>
  8 + </div>
  9 + </div>
  10 + </LayoutApp>
  11 +</template>
  12 +
  13 +<script>
  14 +import {createNamespacedHelpers} from 'vuex';
  15 +
  16 +const {mapState, mapActions} = createNamespacedHelpers('ufo/order');
  17 +
  18 +export default {
  19 + name: 'UfoCouponListPage',
  20 + computed: {
  21 + ...mapState(['orderProduct', 'orderDetail'])
  22 + },
  23 + asyncData({store, router}) {
  24 + return store.dispatch('ufo/order/fetchProduct', {orderId: router.params.orderId});
  25 + },
  26 + created() {
  27 +
  28 + },
  29 + mounted() {
  30 + this.fetchOrderDetail({orderId: this.$route.params.orderId});
  31 + },
  32 + methods: {
  33 + ...mapActions(['fetchOrderDetail'])
  34 + }
  35 +};
  36 +</script>
  37 +
  38 +<style lang="scss" scoped>
  39 +.title {
  40 + text-align: center;
  41 + font-size: 70px;
  42 + line-height: 200px;
  43 +}
  44 +</style>
  1 +export default [{
  2 + path: '/coupon/yoho',
  3 + name: 'yoholist',
  4 + component: () => import(/* webpackChunkName: "coupon" */ './list')
  5 +}];
  1 +<template>
  2 + <LayoutApp>
  3 + <div class="order-page">
  4 + <div class="title">出售中</div>
  5 + <div class="product">
  6 + <p class="name">{{orderProduct}}</p>
  7 + <p>{{orderDetail}}</p>
  8 + </div>
  9 + </div>
  10 + </LayoutApp>
  11 +</template>
  12 +
  13 +<script>
  14 +import {createNamespacedHelpers} from 'vuex';
  15 +
  16 +const {mapState, mapActions} = createNamespacedHelpers('ufo/order');
  17 +
  18 +export default {
  19 + name: 'YohoCouponListPage',
  20 + computed: {
  21 + ...mapState(['orderProduct', 'orderDetail'])
  22 + },
  23 + asyncData({store, router}) {
  24 + return store.dispatch('ufo/order/fetchProduct', {orderId: router.params.orderId});
  25 + },
  26 + created() {
  27 +
  28 + },
  29 + mounted() {
  30 + this.fetchOrderDetail({orderId: this.$route.params.orderId});
  31 + },
  32 + methods: {
  33 + ...mapActions(['fetchOrderDetail'])
  34 + }
  35 +};
  36 +</script>
  37 +
  38 +<style lang="scss" scoped>
  39 +.title {
  40 + text-align: center;
  41 + font-size: 70px;
  42 + line-height: 200px;
  43 +}
  44 +</style>
1 import Vue from 'vue'; 1 import Vue from 'vue';
2 import Components from './components'; 2 import Components from './components';
3 import Ufo from './ufo'; 3 import Ufo from './ufo';
  4 +import Coupon from './coupon';
4 5
5 Components.forEach(component => Vue.component(component.name, component)); 6 Components.forEach(component => Vue.component(component.name, component));
6 7
7 8
8 -export default [...Ufo]; 9 +export default [...Ufo, ...Coupon];
@@ -40,7 +40,7 @@ exports.devServer = (app, cb) => { @@ -40,7 +40,7 @@ exports.devServer = (app, cb) => {
40 }; 40 };
41 41
42 clientConfig.entry.app = ['./build/client-hot.js', clientConfig.entry.app]; 42 clientConfig.entry.app = ['./build/client-hot.js', clientConfig.entry.app];
43 - clientConfig.output.publicPath = 'http://m.yohoblk.com:6005/'; 43 + clientConfig.output.publicPath = 'http://localhost:6005/';
44 clientConfig.output.filename = '[name].js'; 44 clientConfig.output.filename = '[name].js';
45 clientConfig.plugins.push( 45 clientConfig.plugins.push(
46 new webpack.HotModuleReplacementPlugin(), 46 new webpack.HotModuleReplacementPlugin(),
@@ -6,5 +6,13 @@ module.exports = [ @@ -6,5 +6,13 @@ module.exports = [
6 { 6 {
7 route: /ufo\/order/, 7 route: /ufo\/order/,
8 cache: true, 8 cache: true,
  9 + },
  10 + {
  11 + route: /coupon\/ufo/,
  12 + cache: true
  13 + },
  14 + {
  15 + route: /coupon\/yoho/,
  16 + cache: true
9 } 17 }
10 ]; 18 ];
@@ -75,7 +75,7 @@ exports.createApp = async(app) => { @@ -75,7 +75,7 @@ exports.createApp = async(app) => {
75 75
76 // listener 76 // listener
77 app.listen(config.port, function() { 77 app.listen(config.port, function() {
78 - logger.info(`worker is started at ${config.port}`); 78 + logger.info(`worker is started at http://localhost:${config.port}`);
79 }); 79 });
80 } catch (err) { 80 } catch (err) {
81 logger.error(err); 81 logger.error(err);