|
|
@@ -0,0 +1,255 @@
|
|
|
+<config>
|
|
|
+{
|
|
|
+'navigationBarTitleText': '发表评价',
|
|
|
+}
|
|
|
+</config>
|
|
|
+<template>
|
|
|
+ <div class="detail">
|
|
|
+ <div class="card">
|
|
|
+ <van-cell-group>
|
|
|
+ <van-cell icon="shop-o" :title="info.storeName"></van-cell>
|
|
|
+
|
|
|
+ <div class="content">
|
|
|
+ <div class="start">
|
|
|
+ <span class="name">描述相符</span>
|
|
|
+ <van-rate
|
|
|
+ :value="descScore"
|
|
|
+ :size="20"
|
|
|
+ color="#ee0a24"
|
|
|
+ void-color="#eee"
|
|
|
+ void-icon="star"
|
|
|
+ @change="descScore = $event.detail"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="start">
|
|
|
+ <span class="name">卖家服务</span>
|
|
|
+ <van-rate
|
|
|
+ :value="sellerScore"
|
|
|
+ :size="20"
|
|
|
+ color="#ee0a24"
|
|
|
+ void-color="#eee"
|
|
|
+ void-icon="star"
|
|
|
+ @change="sellerScore = $event.detaill"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="start">
|
|
|
+ <span class="name">物流服务</span>
|
|
|
+ <van-rate
|
|
|
+ :value="logisticsScore"
|
|
|
+ :size="20"
|
|
|
+ color="#ee0a24"
|
|
|
+ void-color="#eee"
|
|
|
+ void-icon="star"
|
|
|
+ @change="logisticsScore = $event.detail"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </van-cell-group>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="card" v-for="item in orderSkus" :key="item.skuId">
|
|
|
+ <div class="top">
|
|
|
+ <van-image width="60" height="60" :src="item.skuImage" />
|
|
|
+ <div class="right">
|
|
|
+ <div class="name">商品满意度</div>
|
|
|
+ <van-rate
|
|
|
+ :value="item.score"
|
|
|
+ :size="20"
|
|
|
+ color="#ee0a24"
|
|
|
+ void-color="#eee"
|
|
|
+ void-icon="star"
|
|
|
+ @change="item.score = $event.detail"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <van-field
|
|
|
+ type="textarea"
|
|
|
+ placeholder="写下购买体会和使用感受来帮助其他小伙伴"
|
|
|
+ @change="item.comment = $event.detail"
|
|
|
+ :maxlength="100"
|
|
|
+ show-word-limit
|
|
|
+ :autosize="true"
|
|
|
+ />
|
|
|
+ <van-cell title="添加晒单图片(最多上传5张)" use-label-slot>
|
|
|
+ <div style="padding:10px 0 5px" slot="label">
|
|
|
+ <van-uploader multiple :file-list="item.commentPics" :max-count="5" @after-read="afterRead" />
|
|
|
+ </div>
|
|
|
+ </van-cell>
|
|
|
+ <van-cell>
|
|
|
+ <div slot="title">
|
|
|
+ <van-checkbox
|
|
|
+ :checked-color="$colors.prim"
|
|
|
+ shape="square"
|
|
|
+ :value="item.isAnonymous"
|
|
|
+ @change="item.isAnonymous = $event.detail"
|
|
|
+ >匿名评价</van-checkbox
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </van-cell>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="btnList">
|
|
|
+ <van-button @click="submit" block square :color="$colors.prim">发表评价</van-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ info: {
|
|
|
+ storeName: ''
|
|
|
+ },
|
|
|
+ descScore: 5,
|
|
|
+ sellerScore: 5,
|
|
|
+ logisticsScore: 5,
|
|
|
+ orderSkus: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ onLoad() {
|
|
|
+ this.$http
|
|
|
+ .get('/applets/orderdetail', {
|
|
|
+ orderId: this.$mp.query.orderId
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.info = res.data;
|
|
|
+
|
|
|
+ this.orderSkus = res.data.orderSkus.map(item => {
|
|
|
+ return {
|
|
|
+ skuId: item.skuId,
|
|
|
+ score: 5,
|
|
|
+ comment: '',
|
|
|
+ isAnonymous: false,
|
|
|
+ commentPics: [],
|
|
|
+ skuImage: item.skuImage
|
|
|
+ };
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ afterRead(event) {
|
|
|
+ const { file } = event.detail;
|
|
|
+ console.log(event);
|
|
|
+ // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
|
|
|
+ // wx.uploadFile({
|
|
|
+ // url: 'https://example.weixin.qq.com/upload', // 仅为示例,非真实的接口地址
|
|
|
+ // filePath: file.path,
|
|
|
+ // name: 'file',
|
|
|
+ // formData: { user: 'test' },
|
|
|
+ // success(res) {
|
|
|
+ // // 上传完成需要更新 fileList
|
|
|
+ // const { fileList = [] } = this.data;
|
|
|
+ // fileList.push({ ...file, url: res.data });
|
|
|
+ // this.setData({ fileList });
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ },
|
|
|
+ submit() {
|
|
|
+ let orderSkus = [...this.orderSkus];
|
|
|
+ orderSkus = orderSkus.map(item => {
|
|
|
+ return {
|
|
|
+ skuId: item.skuId,
|
|
|
+ score: item.score,
|
|
|
+ comment: item.comment,
|
|
|
+ isAnonymous: item.isAnonymous ? '1' : '0',
|
|
|
+ commentPics: []
|
|
|
+ };
|
|
|
+ });
|
|
|
+ this.$http
|
|
|
+ .post(
|
|
|
+ '/applets/addorderevaluation',
|
|
|
+ {
|
|
|
+ orderId: this.$mp.query.orderId,
|
|
|
+ storeComment: {
|
|
|
+ descScore: this.descScore,
|
|
|
+ sellerScore: this.sellerScore,
|
|
|
+ logisticsScore: this.logisticsScore
|
|
|
+ },
|
|
|
+ comments: [...orderSkus]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ header: {
|
|
|
+ 'Content-Type': 'application/json'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ if (res.data > 0) {
|
|
|
+ this.showToastError('评价发表成功', 'success');
|
|
|
+ this.navigateBack(500);
|
|
|
+ } else {
|
|
|
+ this.showToastError('评价发表失败');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less">
|
|
|
+.start {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ padding: 5px 15px;
|
|
|
+ .name {
|
|
|
+ margin-right: 10px;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.detail {
|
|
|
+ padding: 15px;
|
|
|
+}
|
|
|
+page {
|
|
|
+ background: @bg2;
|
|
|
+}
|
|
|
+.card {
|
|
|
+ border: 1px solid #ebebeb;
|
|
|
+ border-radius: 5px;
|
|
|
+ background: #ffffff;
|
|
|
+ box-shadow: 0 0 10px 2px #ebebeb;
|
|
|
+ padding: 0 10px;
|
|
|
+}
|
|
|
+.card + .card {
|
|
|
+ margin-top: 10px;
|
|
|
+}
|
|
|
+.btnList {
|
|
|
+ position: fixed;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ display: flex;
|
|
|
+
|
|
|
+ ._van-button {
|
|
|
+ flex-grow: 1;
|
|
|
+ }
|
|
|
+ .van-button {
|
|
|
+ height: 55px;
|
|
|
+ }
|
|
|
+}
|
|
|
+.content {
|
|
|
+ padding: 10px 0;
|
|
|
+}
|
|
|
+.top {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin: 0 15px;
|
|
|
+ padding: 15px 0;
|
|
|
+ border-bottom: 1px solid #ebedf0;
|
|
|
+
|
|
|
+ ._van-image {
|
|
|
+ border: 1px solid #ebedf0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .right {
|
|
|
+ flex-grow: 1;
|
|
|
+ margin-left: 15px;
|
|
|
+
|
|
|
+ .name {
|
|
|
+ font-size: 12px;
|
|
|
+ margin-bottom: 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|