学员端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

395 lines
10 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="pageBgImg">
  3. <topNavbar title="我要咨询"></topNavbar>
  4. <view class="pad">
  5. <!-- 投诉类别 -->
  6. <view class="card">
  7. <view class="row">
  8. <view class="label">投诉类别</view>
  9. <view class="rightSelect">
  10. <u-radio-group
  11. v-model="form.userType"
  12. >
  13. <u-radio
  14. :customStyle="{marginRight: '24rpx'}"
  15. v-for="(item, index) in radiolist1"
  16. :key="index"
  17. :label="item.name"
  18. :name="item.id"
  19. >
  20. </u-radio>
  21. </u-radio-group>
  22. </view>
  23. </view>
  24. </view>
  25. <!-- 驾校名称 教练名称 -->
  26. <view class="card">
  27. <view class="row">
  28. <view class="label">驾校名称</view>
  29. <view @click="showSchool=true" class="select_row my" >
  30. <input v-model="form.schoolName" placeholder="请选择" @click="showSchool=true" disabled style="pointer-events: none;"/></input>
  31. <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon>
  32. </view>
  33. </view>
  34. <view class="row">
  35. <view class="label">教练名称</view>
  36. <view @click="goCoach" class="select_row" >
  37. <input v-model="form.coachName" placeholder="请选择" @click="goCoach" style="pointer-events: none;" disabled/></input>
  38. <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon>
  39. </view>
  40. </view>
  41. </view>
  42. <!-- 投诉类型 -->
  43. <view class="card">
  44. <view class="row">
  45. <view class="label">投诉类型</view>
  46. <view @click="showComplainType=true" class="select_row" >
  47. <input v-model="form.complainTypeName" placeholder="请选择" @click="showComplainType=true" style="pointer-events: none;" disabled/></input>
  48. <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon>
  49. </view>
  50. </view>
  51. </view>
  52. <!-- 咨询内容 -->
  53. <view class="card" style="padding: 0 24rpx 24rpx 24rpx ;">
  54. <view class="h2">咨询内容</view>
  55. <view class="textareaBg">
  56. <view class="flex">
  57. <view class="icon">
  58. <image src="@/static/images/index/edit.png" mode=""></image>
  59. </view>
  60. <view class="inputBox">
  61. <u-textarea v-model.trim="form.content" ref="textarea" placeholder="详细说明问题,以便获得更好的回答~"></u-textarea>
  62. </view>
  63. </view>
  64. <view class="phoneBox">
  65. <view class="imgBox">
  66. <view class="img" v-for="(item,index) in imgArr" :key="item">
  67. <view class="minusCircle" @click="deleteImg(item)">
  68. <u-icon name="close-circle-fill" size="20" color="#b9061d"></u-icon>
  69. </view>
  70. <image :src="item" mode=""></image>
  71. </view>
  72. </view>
  73. <view class="phone" @click="chooseImages" v-if="imgArr.length<3">
  74. <view class="phoneIcon">
  75. <image src="@/static/images/index/btn_tupian.png" mode=""></image>
  76. </view>
  77. <view class="lab">添加图片</view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. <view class="card">
  83. <view class="phone_row">
  84. <view class="label">联系电话</view>
  85. <view class="uInput my">{{ this.vuex_userInfo.mobile }}</view>
  86. </view>
  87. </view>
  88. <view class="btn" :class="{active: btnActive}" @click="submintFn">提交</view>
  89. </view>
  90. <u-picker :show="showComplainType" :columns="complainTypeArr" keyName="label" @confirm="confirmComplainType" @cancel="showComplainType=false"></u-picker>
  91. <u-popup :show="showSchool" mode="bottom" :round="8" @close="showSchool=false">
  92. <searchSchool @chooseSchool="chooseSchool"/>
  93. </u-popup>
  94. <!-- <u-picker :show="show" :columns="shoolArr" keyName="lab"></u-picker> -->
  95. </view>
  96. </template>
  97. <script>
  98. import { createcomplain, consultationType } from '@/config/api.js'
  99. import { WX_API, H5_API, prefix } from '@/config/site.config.js';
  100. import searchSchool from '@/pages/indexEntry/enroll/registInfo/comp/searchSchool.vue'
  101. var _url = H5_API+ WX_API
  102. export default {
  103. components: { searchSchool },
  104. data() {
  105. return {
  106. showSchool: false,
  107. value: '',
  108. imgArr: [],
  109. showComplainType: false,
  110. // 1、服务态度,2、教学质量、3、退费问题,4、学时问题,5、考试预约,6、转校问题,示例值(1)
  111. complainTypeArr: [],
  112. form: {
  113. value: '投诉驾校',
  114. complainType: '',
  115. complainTypeName: '',
  116. userType: 1,
  117. coachName: '',
  118. schoolName: '',
  119. schoolId: '',
  120. content: '',
  121. type: 2
  122. },
  123. radiolist1: [{
  124. name: '投诉驾校',
  125. id: 1,
  126. disabled: false
  127. },
  128. {
  129. name: '投诉教练',
  130. id: 2,
  131. disabled: false
  132. },
  133. ],
  134. }
  135. },
  136. computed: {
  137. btnActive() {
  138. if(this.form.schoolId&&this.form.complainType&&this.form.content) {
  139. return true
  140. }else {
  141. return false
  142. }
  143. }
  144. },
  145. onLoad() {
  146. uni.$on('upDateCoachItem',(item)=>{
  147. console.log(item)
  148. this.form.coachId = item.id
  149. this.form.coachName = item.name
  150. })
  151. this.consultationTypeFn()
  152. },
  153. methods: {
  154. // 投诉类型
  155. async consultationTypeFn() {
  156. const {data: res} = await consultationType()
  157. this.complainTypeArr = [res]
  158. },
  159. // 选择投诉类型
  160. confirmComplainType(val) {
  161. console.log(val)
  162. let item = val.value[0]
  163. this.form.complainType = item.value
  164. this.form.complainTypeName = item.label
  165. this.showComplainType = false
  166. },
  167. // 选择驾校
  168. chooseSchool(item) {
  169. this.form.schoolName = item.name
  170. this.form.schoolId = item.id
  171. console.log(this.columnsCar)
  172. this.showSchool = false
  173. },
  174. // 跳转到选择教练
  175. goCoach() {
  176. if(!this.form.schoolId) return this.$u.toast('请先选择驾校')
  177. this.$goPage('/pages/indexEntry/enroll/registInfo/chooseCoach/chooseCoach?schoolId=' + this.form.schoolId)
  178. },
  179. deleteImg(item) {
  180. let index = this.imgArr.findIndex(val=>val==item)
  181. this.imgArr.splice(index, 1)
  182. },
  183. //选择图片
  184. chooseImages(type) {
  185. let imgNum = 3 - (this.imgArr.length)
  186. uni.chooseImage({
  187. count: imgNum, //允许选择的数量
  188. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  189. sourceType: ['album', 'camera'], //从相册选择
  190. success: res => {
  191. uni.showLoading({
  192. title: '图片上传中...'
  193. });
  194. console.log(res)
  195. res.tempFiles.forEach( (item,index)=>{
  196. this.uploadImgApi(item.path, item.name)
  197. })
  198. }
  199. })
  200. },
  201. uploadImgApi(filePath, imgName) {
  202. console.log(filePath)
  203. let token = 'Bearer '+ this.$store.state.user.vuex_loginInfo.accessToken
  204. let _this = this
  205. let timer = new Date() * 1
  206. // 上传图片到服务器
  207. uni.uploadFile({
  208. url: _url + 'app-api/infra/file/upload',//接口
  209. filePath: filePath,//要上传的图片的本地路径
  210. name: 'file',
  211. formData: {
  212. path: 'complain/'+ uni.$u.date(name, 'yyyy-mm-dd')+'/'+timer + '-'+ imgName,
  213. type: 1,
  214. fileSuffix: "png"
  215. },
  216. header: {
  217. Authorization: token,
  218. 'tenant-id': 1
  219. },
  220. success(res) {
  221. console.log('上传成功')
  222. let res2 = JSON.parse(res.data)
  223. _this.imgArr.push(res2.data)
  224. console.log(res2)
  225. uni.hideLoading();
  226. },
  227. complete: (err)=> {
  228. console.log(err)
  229. }
  230. })
  231. },
  232. async submintFn() {
  233. if(!this.btnActive) return
  234. if(!this.form.content) return this.$u.toast('请输入内容')
  235. this.form.images = this.imgArr.join(',')
  236. let obj = Object.assign({}, this.form)
  237. delete obj.value
  238. delete obj.complainTypeName
  239. const {data: res} = await createcomplain(this.form)
  240. this.$u.toast('发布成功')
  241. setTimeout(()=>{
  242. this.$goPage('/pages/indexEntry/consult/record/record?tab=2')
  243. },1500)
  244. },
  245. }
  246. }
  247. </script>
  248. <style lang="scss" scoped>
  249. .pageBgImg {
  250. .card {
  251. margin-bottom: 20rpx;
  252. .h2 {
  253. font-size: 28rpx;
  254. font-weight: 600;
  255. line-height: 96rpx;
  256. }
  257. .textareaBg {
  258. min-height: 364rpx;
  259. background: #F8F8F8;
  260. border-radius: 16rpx;
  261. border: 2rpx solid #E8E9EC;
  262. display: flex;
  263. flex-direction: column;
  264. justify-content: space-between;
  265. .flex {
  266. padding: 20rpx;
  267. align-items: flex-start;
  268. .icon {
  269. width: 24rpx;
  270. height: 24rpx;
  271. margin: 0 14rpx 0 24rpx;
  272. }
  273. .inputBox {
  274. flex: 1;
  275. }
  276. /deep/ .inputBox .u-textarea {
  277. padding: 0 !important;
  278. border: none !important;
  279. background: none !important;
  280. }
  281. }
  282. .phoneBox {
  283. display: flex;
  284. padding: 0 10rpx 20rpx 20rpx;
  285. .imgBox {
  286. display: flex;
  287. .img {
  288. margin-right: 14rpx;
  289. position: relative;
  290. width: 160rpx;
  291. height: 160rpx;
  292. image {
  293. width: 160rpx;
  294. height: 160rpx;
  295. border-radius: 8rpx;
  296. overflow: hidden;
  297. }
  298. .minusCircle {
  299. position: absolute;
  300. right: -14rpx;
  301. top: -20rpx;
  302. z-index: 9;
  303. }
  304. }
  305. }
  306. .phone {
  307. border: 2rpx dashed #CDCED0;
  308. width: 160rpx;
  309. height: 160rpx;
  310. background: #F8F8F8;
  311. border-radius: 8rpx;
  312. overflow: hidden;
  313. display: flex;
  314. align-items: center;
  315. justify-content: center;
  316. flex-direction: column;
  317. .phoneIcon {
  318. width: 60rpx;
  319. height: 60rpx;
  320. }
  321. .lab {
  322. font-size: 20rpx;
  323. color: #686B73;
  324. margin-top: 8rpx;
  325. }
  326. }
  327. }
  328. }
  329. }
  330. .phone_row {
  331. display: flex;
  332. height: 104rpx;
  333. padding: 0 28rpx;
  334. line-height: 104rpx;
  335. .label {
  336. font-size: 28rpx;
  337. font-weight: 600;
  338. margin-right: 50rpx;
  339. }
  340. .uInput {
  341. flex: 1;
  342. }
  343. }
  344. .btn {
  345. width: 396rpx;
  346. height: 72rpx;
  347. background: #D1E7FE;
  348. border-radius: 8rpx;
  349. font-size: 28rpx;
  350. text-align: center;
  351. line-height: 72rpx;
  352. margin: 100rpx auto 114rpx auto;
  353. color: #fff;
  354. &.active {
  355. background: $themC;
  356. }
  357. }
  358. }
  359. .row {
  360. height: 120rpx;
  361. display: flex;
  362. align-items: center;
  363. padding-right: 30rpx;
  364. .label {
  365. font-size: 28rpx;
  366. font-weight: 600;
  367. width: 184rpx;
  368. text-align: center;
  369. }
  370. .select_row {
  371. display: flex;
  372. align-items: center;
  373. justify-content: space-between;
  374. flex: 1;
  375. input {
  376. font-size: 28rpx;
  377. color: #333;
  378. }
  379. }
  380. }
  381. </style>