feedback.vue
4.6 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<!-- 问题反馈 -->
<template>
<u-form :model="model" ref="uForm">
<view class="feedback-wrap u-p-30">
<!-- 选择类型 -->
<u-form-item label-position="top" :border-bottom="false" :labelStyle="labelStyle" label="请选择类型" prop="type" label-width="150">
<u-radio-group v-model="model.type" width="100%" active-color="#f37b1d">
<u-radio shape="circle" v-for="(item, index) in typeList" :key="index" :name="item.code">{{ item.name }}</u-radio>
</u-radio-group>
</u-form-item>
<!-- 相关描述 -->
<view class="form-item">
<label>
<view class="inp-title">相关描述</view>
<view class="area-box">
<textarea
class="inp-area"
v-model="model.content"
name="message"
placeholder="客官~您对我们的服务还满意吗,请给予我们你的意见我们将做的更好~"
placeholder-class="pl-style"
/>
<view class="img-box">
<u-upload
:showProgress="false"
@on-uploaded="uploadSuccess"
@on-remove="uploadRemove"
:action="`${$BASE_URL}/api/common/upload`"
:header="{token: token}"
width="140"
height="140"
maxCount="9"
></u-upload>
</view>
</view>
</label>
</view>
<!-- 联系方式 -->
<view class="form-item">
<label>
<view class="inp-title">联系方式</view>
<input class="inp" v-model="model.phone" name="phone" type="number" placeholder="请输入您的联系电话" placeholder-class="pl-style" />
</label>
</view>
<!-- 底部按钮 -->
<view class="foot_box u-flex u-row-between u-col-center">
<button class="u-reset-button post-btn" @tap="addFeedback">提交</button>
<button class="u-reset-button contact-btn" @tap="onService">联系客服</button>
</view>
</view>
</u-form>
</template>
<script>
export default {
components: {},
data() {
return {
model: {
type: '',
content: '',
phone: '',
images: []
},
labelStyle: {
'font-size': '30rpx',
'font-weight': '600',
color: '#333'
},
imgList: [], //图片
typeList: [] ,//类型列表
token: uni.getStorageSync('token')
};
},
computed: {},
onLoad() {
this.getFeedbackType();
},
methods: {
// 跳转客服
onService() {
this.$Router.push('/pages/public/chat/index');
},
// 获取意见分类
getFeedbackType() {
let that = this;
that.$http('other.feedbackType').then(res => {
if (res.code === 1) {
that.typeList = res.data;
}
});
},
// 上传图片成功
uploadSuccess(e) {
this.model.images = [];
e.forEach(item => {
this.model.images.push(item.response.data.url);
});
},
// 移除图片
uploadRemove(index) {
this.model.images.splice(index, 1);
},
// 提交意见
addFeedback() {
let that = this;
that.$http('other.feedbackAdd', that.model, '提交中...').then(res => {
uni.hideKeyboard();
if (res.code === 1) {
that.$u.toast('提交成功');
that.$Router.back();
}
});
}
}
};
</script>
<style lang="scss">
.feedback-wrap {
background: #fff;
}
.form-item {
margin-top: 30rpx;
.inp-title {
font-size: 30rpx;
font-weight: bold;
color: rgba(51, 51, 51, 1);
align-items: center;
margin-bottom: 30rpx;
}
.inp {
width: 690rpx;
height: 84rpx;
background: rgba(249, 250, 251, 1);
border-radius: 20rpx;
padding: 0 30rpx;
font-size: 26rpx;
font-weight: 500;
color: #333;
margin-bottom: 38rpx;
}
.area-inp {
height: 190upx;
padding: 30rpx;
}
.pl-style {
font-size: 26rpx;
color: rgba(177, 179, 199, 1);
}
}
.area-box {
width: 690rpx;
min-height: 306rpx;
background: rgba(249, 250, 251, 1);
border-radius: 20rpx;
padding: 20rpx;
.pl-style {
font-size: 26rpx;
font-weight: 500;
color: rgba(177, 179, 199, 1);
line-height: 50rpx;
}
.inp-area {
font-size: 26rpx;
font-weight: 500;
color: #333;
line-height: 50rpx;
width: 100%;
}
.img-box {
display: flex;
align-items: center;
flex-wrap: wrap;
margin-top: 20rpx;
}
}
// 底部按钮
.foot_box {
height: 100rpx;
width: 100%;
margin-top: 100rpx;
.contact-btn {
width: 340rpx;
line-height: 74rpx;
background: linear-gradient(90deg, rgba(103, 104, 105, 1), rgba(82, 82, 82, 1));
box-shadow: 0px 2rpx 5rpx 0px rgba(102, 103, 104, 0.46);
border-radius: 35rpx;
font-size: 28rpx;
font-weight: 500;
color: rgba(255, 255, 255, 1);
}
.post-btn {
width: 340rpx;
line-height: 74rpx;
background: linear-gradient(90deg, rgba(233, 180, 97, 1), rgba(238, 204, 137, 1));
box-shadow: 0px 7rpx 6rpx 0rpx rgba(229, 138, 0, 0.22);
border-radius: 37rpx;
font-size: 28rpx;
font-weight: 500;
color: rgba(255, 255, 255, 1);
}
}
</style>