Created
March 16, 2017 09:18
-
-
Save cismous/7eb1008e8af1118c2fc9b47bb53c1aa9 to your computer and use it in GitHub Desktop.
代码
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<section class="page-commend-add page-commend-common"> | |
<div class="page-content"> | |
<div class="tips">服务</div> | |
<div class="text"> | |
<textarea v-model="message" placeholder="评价更多内容可获得更多积分奖励"/> | |
</div> | |
</div> | |
<div class="page-footer"> | |
<div class="tips">完成评价即可获得积分奖励</div> | |
<div class="action-go" @click="submitComment()">提交评价</div> | |
</div> | |
</section> | |
</template> | |
<script type="text/babel"> | |
import orderUtil from '../../modules/order'; | |
export default { | |
data() { | |
return { | |
score: 0, | |
order: {}, | |
message: '', | |
} | |
}, | |
created() { | |
const {id} = this.$route.params; | |
orderUtil.fetchOrderDetail(id).then(res => { | |
const {success, data} = res.body; | |
if (success) this.order = data; // 订单数据 | |
}) | |
}, | |
methods: { | |
rate(score) { | |
this.score = score; | |
}, | |
submitComment() { | |
const order = this.order; | |
const data = { | |
orderId: order.orderId, | |
content: this.message, | |
serviceAppraises: [ | |
{ | |
lv1: order.lv1ServiceType, | |
lv2: order.lv2ServiceType, | |
score: this.score, | |
} | |
], | |
}; | |
Vue.http.post('comment/add', data).then(res => { | |
const {success} = res.body; | |
if (success) this.$router.push({name: 'commentSuccess', params: {id: order.orderId}}); | |
}); | |
}, | |
}, | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment