...
|
...
|
@@ -56,7 +56,7 @@ |
|
|
<button v-if="order.isSupportRefund == 'Y' || order.isSupportExchange == 'Y'" class="normal" @click="applyRefund()">申请售后</button>
|
|
|
</template>
|
|
|
</div>
|
|
|
<select id="cancel-reason" class="cancel-reason" @blur="reasonChange" @change="reasonChange" v-model="selected">
|
|
|
<select id="cancel-reason" class="cancel-reason" @change="reasonChange" v-model="selected">
|
|
|
<option v-for="option in options" :value="{id:option.id,reason:option.reason}">{{option.reason}}</option>
|
|
|
</select>
|
|
|
</template>
|
...
|
...
|
@@ -79,8 +79,7 @@ |
|
|
order: {},
|
|
|
options: [],
|
|
|
selected: {},
|
|
|
genderSel: {},
|
|
|
cancelbusy: false
|
|
|
genderSel: {}
|
|
|
};
|
|
|
},
|
|
|
created() {
|
...
|
...
|
@@ -113,7 +112,6 @@ |
|
|
this.show = false;
|
|
|
this.order = {};
|
|
|
this.selected = {};
|
|
|
this.cancelbusy = false;
|
|
|
|
|
|
this.getOrderData();
|
|
|
},
|
...
|
...
|
@@ -158,31 +156,34 @@ |
|
|
});
|
|
|
},
|
|
|
reasonChange() {
|
|
|
if (this.cancelbusy) {
|
|
|
return false;
|
|
|
}
|
|
|
setTimeout(() => {
|
|
|
if (!this.selected.id || document.hidden) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
this.cancelbusy = true;
|
|
|
this.orderDetail().cancel({
|
|
|
orderCode: this.order.orderCode,
|
|
|
reasonId: this.selected.id || this.options[0].id,
|
|
|
reason: this.selected.reason || this.options[0].reason
|
|
|
}, (result) => {
|
|
|
if (result.code === 200) {
|
|
|
tip('取消成功');
|
|
|
this.orderDetail().cancel({
|
|
|
orderCode: this.order.orderCode,
|
|
|
reasonId: this.selected.id,
|
|
|
reason: this.selected.reason
|
|
|
}, (result) => {
|
|
|
if (result.code === 200) {
|
|
|
tip({
|
|
|
delay: 500,
|
|
|
txt: '取消成功'
|
|
|
});
|
|
|
|
|
|
setTimeout(() => {
|
|
|
this.reload();
|
|
|
}, 1000);
|
|
|
setTimeout(() => {
|
|
|
this.reload();
|
|
|
}, 300);
|
|
|
|
|
|
yoho.store.set('orderReload', true);
|
|
|
} else if (result.code !== 500) {
|
|
|
tip(result.message);
|
|
|
}
|
|
|
this.cancelbusy = false;
|
|
|
}, () => {
|
|
|
tip('操作失败');
|
|
|
});
|
|
|
yoho.store.set('orderReload', true);
|
|
|
} else if (result.code !== 500) {
|
|
|
tip(result.message);
|
|
|
}
|
|
|
}, () => {
|
|
|
tip('操作失败');
|
|
|
});
|
|
|
}, 700);
|
|
|
},
|
|
|
getCancelReason() {
|
|
|
$.ajax({
|
...
|
...
|
@@ -190,6 +191,12 @@ |
|
|
}).then(result => {
|
|
|
if (result.data.length > 0) {
|
|
|
this.options = result.data;
|
|
|
if (yoho.isiOS) {
|
|
|
this.options.unshift({
|
|
|
id: 0,
|
|
|
reason: '请选择'
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
}).fail(() => {
|
|
|
tip('操作失败');
|
...
|
...
|
@@ -208,10 +215,21 @@ |
|
|
},
|
|
|
autoCancel(code) {
|
|
|
return () => {
|
|
|
let reasonId;
|
|
|
let reason;
|
|
|
|
|
|
if (yoho.isiOS && this.options.length > 1) {
|
|
|
reasonId = this.options[1].id;
|
|
|
reason = this.options[1].reason;
|
|
|
} else if (this.options.length) {
|
|
|
reasonId = this.options[0].id;
|
|
|
reason = this.options[0].reason;
|
|
|
}
|
|
|
|
|
|
this.orderDetail().cancel({
|
|
|
orderCode: code,
|
|
|
reasonId: this.options.length ? this.options[0].id : null,
|
|
|
reason: this.options.length ? this.options[0].reason : null
|
|
|
reasonId: reasonId,
|
|
|
reason: reason
|
|
|
}, (result) => {
|
|
|
if (result.code === 200) {
|
|
|
this.reload();
|
...
|
...
|
|