step1.vue 2.18 KB
<template>
  <div>
    <Row>
      <order-goods-info
        :table-data="tableData"
        :coupons-data="couponsData"
        :goods-promos="goodsPromos"
        :order-info="orderInfo"
        :order-promos="orderPromos"
      >
      </order-goods-info>
    </Row>
    <i-button type="primary" @click="nextStep(orderCode)">下一步</i-button>
  </div>
</template>

<script>
import { orderGoodsInfo } from '../../components';
import OrderService from 'services/order/order-service';
import { OrderConfig } from '../../configs';
import _ from 'lodash';
export default {
  components: { orderGoodsInfo },
  props: ['current', 'orderCode', 'orderInfo'],
  data() {
    return {
      couponsData: [],
      tableData: [],
      goodsPromos: [],
      orderPromos: [],
      feeSharingType: OrderConfig.feeSharingType,
    };
  },
  created() {
    this.$emit('nextStep', 0);
    this.orderService = new OrderService();
    this.getOrderGoods();
    this.getGoodsPromos();
    this.getOrderCoupons();
    this.getOrderPromos();
  },
  methods: {
    nextStep(code) {
      this.$router.push({
        name: 'order.deliver.step2',
        params: {},
        query: {
          orderCode: code,
        },
      });
    },
    //获取订单商品
    getOrderGoods() {
      this.orderService.queryOrderGoods({ orderCode: +this.orderCode }).then(ret => {
        this.tableData = _.get(ret, 'data', []);
      });
    },
    //获取订单商品促销信息
    getGoodsPromos() {
      this.orderService.queryOrderGoodsPromos({ orderCode: +this.orderCode }).then(ret => {
        this.goodsPromos = _.get(ret, 'data', []);
      });
    },
    //获取订单优惠券
    getOrderCoupons() {
      this.orderService.queryOrderCoupons({ orderCode: +this.orderCode }).then(ret => {
        this.couponsData = _.get(ret, 'data', {});
        _.each(this.couponsData, coupons => {
          coupons['feeSharingTypeStr'] = this.feeSharingType[coupons.feeSharingType] || '无';
        });
      });
    },
    //获取订单促销信息
    getOrderPromos() {
      this.orderService.queryOrderPromos({ orderCode: +this.orderCode }).then(ret => {
        this.orderPromos = _.get(ret, 'data', {});
      });
    },
  },
};
</script>