logistics.vue
2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<template>
<div class="edit-logistics-page">
<header-box title="商品寄回" ref="header"></header-box>
<div class="edit-logistics">
<label @click="companylist">
选择快递公司<input class="company-val" type="text" :value="company_name" readonly>
<span class="icon icon-right"></span>
</label>
<label>
快递单号
<input class="num" maxlength="20" v-model='num'>
</label>
</div>
<div class="submit" @click="submit">确认</div>
</div>
</template>
<script>
import $ from 'jquery';
import tip from 'common/tip';
import yoho from 'yoho';
import modal from 'common/modal';
import HeaderBox from 'component/header.vue';
export default {
props: ['applyid', 'type', 'company_id', 'company_name'],
data() {
return {
num: '',
};
},
methods: {
companylist() {
this.$emit('change-view', {
view: 'logisticsCompany'
});
},
submit() {
if (!this.company_name) {
tip('请选择快递公司');
return false;
}
if (!this.num || !/^[0-9]*$/.test(this.num)) {
tip('请输入正确的快递单号');
return false;
}
const text = `快递公司:${this.company_name} <br>单号:${this.num}`;
const _this = this;
modal.confirm(text, '请确认寄回信息是否正确?', function() {
this.hide();
$.ajax({
url: '/me/return/save-logistics',
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) {
tip(res.message || '网络错误');
} else {
yoho.goBack();
yoho.store.set('refundStatus', true);
return false;
}
});
});
}
},
components: {HeaderBox}
};
</script>
<style>
@import "../../../scss/me/_logistics.css";
</style>