Blame view

public/vue/home/refund/logistics.vue 2.68 KB
1 2 3
<template>
    <div class="edit-logistics-page">
        <div class="edit-logistics">
郭成尧 authored
4 5
            <label @click="companylist">选择快递公司<input class="company-val" type="text" :value="company_name" readonly><span class="iconfont">&#xe604;</span></label>
            <label>快递单号<input class="num" maxlength="20" v-model='num'></label>
6 7 8 9 10 11 12 13
        </div>
        <div class="submit" @click="submit">确认</div>
    </div>
</template>

<script>
    const $ = require('yoho-jquery');
    const tip = require('plugin/tip');
郭成尧 authored
14
    const modal = require('plugin/modal2');
郭成尧 authored
15
    const bus = require('plugin/vue-bus');
16 17 18 19 20 21 22 23 24 25

    module.exports = {
        props: ['applyid', 'type', 'company_id', 'company_name'],
        data() {
            return {
                num: '',
            };
        },
        methods: {
            companylist() {
郭成尧 authored
26
                bus.$emit('changeView', {
27 28 29 30 31
                    view: 'logisticsCompany'
                });
            },
            submit() {
                if (!this.company_name) {
郭成尧 authored
32
                    tip.show('请选择快递公司');
33 34 35
                    return false;
                }
                if (!this.num || !/^[0-9]*$/.test(this.num)) {
郭成尧 authored
36
                    tip.show('请输入正确的快递单号');
37 38 39 40 41 42 43 44 45
                    return false;
                }

                const text = `快递公司:${this.company_name} <br>单号:${this.num}`;
                const _this = this;

                modal.confirm(text, '请确认寄回信息是否正确?', function() {
                    this.hide();
                    $.ajax({
郭成尧 authored
46
                        url: '/home/return/save-logistics',
47 48 49 50 51 52 53 54 55 56 57 58 59
                        type: 'post',
                        data: {
                            applyid: _this.applyid,
                            type: _this.type,
                            expressId: _this.company_id,
                            expressCompany: _this.company_name,
                            expressNumber: _this.num
                        }
                    }).then(res => {
                        if ($.type(res) !== 'object') {
                            res = {};
                        }
                        if (res.code !== 200) {
郭成尧 authored
60
                            tip.show(res.message || '网络错误');
61
                        } else {
郭成尧 authored
62 63 64
                            let type = _this.type === 'change' ? 'exchange' : _this.type;

                            location.href = `http://m.yohobuy.com/home/return/${type}/detail/${_this.applyid}`;
65 66 67 68 69 70 71 72 73 74
                            return false;
                        }
                    });
                });
            }
        }
    };
</script>

<style>
郭成尧 authored
75
    @import "home/refund/_logistics.css";
76
</style>