cancel-reason.vue 1.65 KB
<template>
    <div>
        <header-box title="取消订单理由" ref="header"></header-box>
        <div class="reason-list">
            <span v-for="val in options" :key="val.id" @click="select(val.id, val.reason)">{{val.reason}}</span>
        </div>
    </div>
</template>

<script>
    'use strict';

    import $ from 'jquery';
    import yoho from 'yoho';
    import tip from 'common/tip';
    import HeaderBox from 'component/header.vue';

    export default {
        data() {
            return {
                options: [],
            };
        },
        created() {
            yoho.store.set('cancelReason', {
                iscancel: true
            });

            $.ajax({
                url: '/me/getCancelOrderReason',
            }).then(result => {
                if (result && result.data) {
                    this.options = result.data;
                }
            }).fail(() => {
                tip('操作失败');
            });
        },
        methods: {
            select(id, reason) {
                yoho.store.set('cancelReason', Object.assign(yoho.store.get('cancelReason'), {
                    id: id,
                    reason: reason
                }));

                yoho.goBack();
            }
        },
        components: {HeaderBox}
    };
</script>

<style>
    .cancel-reason {
        width: 100%;

        .reason-list {
            width: 100%;
            margin-left: 30px;

            span {
                display: block;
                height: 90px;
                line-height: 90px;
                font-size: 34px;
                border-bottom: 1px solid #eee;
            }
        }
    }
</style>