refund-order.vue 3.9 KB
<template>
    <ul v-infinite-scroll="getOrderData()" infinite-scroll-disabled="busy" infinite-scroll-distance="10">
        <li class="order-item" v-for="(index, order) in orderList">
            <div class="order-detail">
                <div class="order-code">
                    <div class="code-time">
                        <p>订单号:{{order.orderCode}}</p>
                        <p>申请时间:{{order.orderCreateTime}}</p>
                    </div>
                    <p>{{order.statusName}}</p>
                </div>
                <div class="order-goods">
                    <div class="goods-info" v-for="product in order.goods">
                        <div class="img-box">
                            <img v-bind:src="product.goodsImage | resize 49 65" alt="{{product.productName}}">
                            <label v-if="product.goodsType == 'gift'">赠品</label>
                        </div>
                        <div class="goods-detail">
                            <p class="name">{{product.productName}}</p>
                            <p class="size">
                                <span>颜色: {{product.colorName}}</span>
                                <span>尺码: {{product.sizeName}}</span>
                            </p>
                        </div>
                        <div class="goods-price">
                            <p>&yen;{{product.salesPrice}}</p>
                            <p>×1</p>
                        </div>
                    </div>
                </div>
                <div class="order-option">
                    <div class="goods-total"></div>
                    <div class="options" v-show="order.canCancel == 'Y'">
                        <button v-if="order.canCancel == 'Y'" class="normal">取消申请</button>
                    </div>
                </div>
            </div>
        </li>
    </ul>
</template>
<script>
    'use strict';

    const $ = require('yoho-jquery');
    const tip = require('common/tip');

    //const Modal = require('common/modal');

    module.exports = {
        data() {
            return {
                page: 0,
                limit: 10,
                orderList: [],
                busy: false,
            };
        },

        ready() {
            this.getOrderData();
        },

        methods: {
            getOrderData() {
                let _that = this;

                this.busy = true;
                $.ajax({
                    url: '/home/refund/get-orders',
                    data: {
                        page: ++this.page,
                        limit: this.limit
                    }
                }).then(result => {
                    if (result.isend) {
                        _that.busy = true;
                    } else {
                        _that.busy = false;
                    }
                    if (result.data.list.length > 0) {
                        this.$set('orderList', result.data.list);
                    }
                }).fail(() => {
                    tip('网络错误');
                });
            },
            cancelApply(code) {
                $.ajax({
                    url: '/home/cancel-apply',
                    type: 'post',
                    data: {
                        orderCode: code
                    }
                }).then(result => {
                    if (result.code === 200) {
                        location.reload();
                    } else {
                        tip(result.message);
                    }
                }).fail(() => {
                    tip('操作失敗');
                });
            }
        }
    };
</script>
<style>
    html,
    body {
        height: 100%;
    }

    @import "../../scss/home/_order.css";

    .order-wrapper {
        height: 100%;

        ul {
            height: 100%;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
    }
</style>