evaluate.vue
4.3 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<template>
<view class="evaCon">
<view class="purNav">
<view class="purNavBody" @click="goGoodDetail(dataList.goods_id)">
<view class="">
<image :src="dataList.images[0]" style="width: 200rpx;height: 200rpx;border-radius: 16rpx;border-radius: 16rpx;" mode=""></image>
</view>
<view class="">
<view class="purBotText">
<text class="purBodyText">{{dataList.goods_name}}</text>
</view>
<view class="purMoney">
<text class="purFu">¥</text><text class="purFuSum">{{dataList.price}}</text>
</view>
</view>
</view>
</view>
<view class="evaNav">
<view class="evaNavBody">
<view class="evaPadding">
<text class="evaXz">请选择</text>
</view>
<view class="evaImgAll">
<view class="evaImg" data-goodType='goodType' @click="selectType(1)">
<image src="../../../static/image/Frame_17@2x.png" style="width: 88rpx;height: 88rpx;" mode="" v-if="typeIndex!==1"></image>
<image src="../../../static/image/Frame_5@2x.png" style="width: 88rpx;height: 88rpx;" mode="" v-if="typeIndex==1"></image>
<text>好评</text>
</view>
<view class="evaImg" data-middleType='middleType' @click="selectType(2)">
<image src="../../../static/image/Frame_15@2x.png" style="width: 88rpx;height: 88rpx;" mode="" v-if="typeIndex!==2"></image>
<image src="../../../static/image/Frame_3@2x.png" style="width: 88rpx;height: 88rpx;" mode="" v-if="typeIndex==2"></image>
<text>中评</text>
</view>
<view class="evaImg" data-chaType='chaType' @click="selectType(3)">
<image src="../../../static/image/Frame_13@2x.png" style="width: 88rpx;height: 88rpx;" mode="" v-if="typeIndex!==3"></image>
<image src="../../../static/image/Frame_1@2x.png" style="width: 88rpx;height: 88rpx;" mode="" v-if="typeIndex==3"></image>
<text>差评</text>
</view>
</view>
</view>
</view>
<view class="evaContent">
<view class="evaContentText">
<textarea value="" class="zd_textarea" placeholder="请填写评价" @input="textareaInput" v-model="areaValue"/>
</view>
</view>
<view class="evaBtn">
<view class="evaBtnon" @click="publish">
<text class="evaFa">发布</text>
</view>
</view>
</view>
</template>
<script>
// import request from '../../utils/request.js'
import request from '../../../utils/request.js'
export default {
onLoad(options) {
this.id=options.id
this.indexs=options.index
this.detailData()
},
data() {
return {
id:'',
indexs:'',
areaValue:'',
typeIndex:1,
dataList:'',
}
},
created() {
},
methods:{
selectType(index){
this.typeIndex=index
},
textareaInput(e){
this.areaValue=e.target.value
},
//商品详情
detailData(){
if(this.indexs==1){
request.get('/api/personal/detailBuy',{
buy_id:this.id
}).then(res=>{
this.dataList=res.data.info[0].goods
}).catch(err=>{
})
}else{
request.get('/api/personal/detailSell',{
sell_id:this.id
}).then(res=>{
this.dataList=res.data.info[0].goods
}).catch(err=>{
})
}
},
//商品详情
goGoodDetail(id){
uni.navigateTo({
url:'/pages/index/good-details?goos_id='+id
})
},
publish(){
// if(this.typeIndex==''){
// uni.showToast({
// title:'请选择评价类型',
// icon:'none'
// })
// }else
if(this.areaValue==''){
uni.showToast({
title:'请填写评价内容',
icon:'none'
})
}else{
if(this.indexs==1){
request.get('/api/personal/faAssess',{
buy_id:this.id,
ping_status:this.typeIndex-1,
content:this.areaValue
}).then(res=>{
uni.navigateTo({
url:'/myPackage/pages/me/purchase'
})
}).catch(err=>{
uni.showToast({
title:err.msg,
icon:'none'
})
})
}else{
request.get('/api/personal/maiAssess',{
sell_id:this.id,
ping_status:this.typeIndex,
content:this.areaValue
}).then(res=>{
uni.navigateBack({
delta:-1
})
}).catch(err=>{
console.log(err,'err')
uni.showToast({
title:err.msg,
icon:'none'
})
})
}
}
}
}
}
</script>
<style>
@import url("/common/uni.css");
@import url("/common/evaluate.css");
</style>