comments.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. <template>
  2. <!-- style="background: #FFFFFF;" -->
  3. <view class="page" style="background: #f0f0f0; padding-top: 7rpx;">
  4. <!-- <view class="feedback-title">
  5. <view>问题和意见</view>
  6. <view class="feedback-quick" @tap="chooseMsg">
  7. <text>快速键入</text>
  8. <u-icon name="arrow-right"></u-icon>
  9. </view>
  10. </view> -->
  11. <view style="background: #FFFFFF;" class="feedback-body">
  12. <view class="flex align-center padding-tb-sm">
  13. <view>
  14. <image :src="UsertList.avatar" style="width: 100rpx;height: 100rpx;border-radius: 50%;" mode=""></image>
  15. </view>
  16. <view style="margin-left: 30rpx; line-height: 40rpx;">
  17. <view style="color: #999;">{{ UsertList.nickName }}</view>
  18. <view>{{ data.endTime }}</view>
  19. </view>
  20. </view>
  21. <view class="flex align-center add_name" style="margin: 30rpx 0rpx 4rpx;">
  22. <view class="green"></view>出发地点:{{ data.shipProvince }}{{ data.shipCity }}{{ data.shipDistrict }}{{ data.deliveryAddress }}
  23. </view>
  24. <image v-if="globalImages" :src="globalImages + 'images/static/upload/up.png'" class="order_up"></image>
  25. <view class="flex align-center add_name">
  26. <view class="orgin"></view>到达地点:{{ data.deliveryProvince }}{{ data.deliveryCity }}{{ data.deliveryDistrict }}{{ data.shipAddress }}
  27. </view>
  28. </view>
  29. <view style="background: #FFFFFF;" class="feedback-body">
  30. <view class="titls" style="text-align: center;">
  31. 为本次服务评分
  32. </view>
  33. <view style="display: flex; justify-content: center; margin-bottom: 30rpx;">
  34. <u-rate
  35. :allow-half="false"
  36. :disabled="false"
  37. size="58"
  38. active-color="#fe6b01"
  39. :is-fill="false"
  40. v-model="ratevalue"
  41. @change="handleRateChange"
  42. />
  43. </view>
  44. <view style="font-size: 24rpx;color: #ccc;text-align: center;">点击星星评分</view>
  45. </view>
  46. <view style="background: #FFFFFF;margin-top: 30rpx;" class="feedback-body">
  47. <view class="titls">
  48. 快速评价
  49. </view>
  50. <view class="flex-container">
  51. <view class="item" v-for="(item, index) in CreditList" :key="index" :class="{ selected: item.selected }" @click="toggleSelect(index)">
  52. <image v-if="globalImages" :src="globalImages + item.icon" style="width: 25rpx;height: 25rpx; margin-right: 10rpx;" mode=""></image>
  53. {{ item.description }}
  54. </view>
  55. </view>
  56. </view>
  57. <view style="background: #FFFFFF;" class="feedback-body">
  58. <view class="titls">
  59. 详细评价
  60. </view>
  61. <textarea placeholder="说说这次乘车体验吧..." v-model="sendDate.content" class="feedback-textare" />
  62. </view>
  63. <!-- <view class="feedback-title"><text>QQ/邮箱</text></view> -->
  64. <!-- <view class="feedback-body"><input class="feedback-input" v-model="sendDate.contact" placeholder="方便我们联系你 " />
  65. </view> -->
  66. <!-- <view class="feedback-title feedback-star-view">
  67. <text>我的评价:</text>
  68. <view style="margin-left: 20rpx;">
  69. <u-radio-group v-model="value" @change="radioGroupChange">
  70. <u-radio @change="radioChange" v-for="(item, index) in list" :key="index" :name="item.id"
  71. :disabled="item.disabled" active-color="#346EF6">
  72. {{item.name}}
  73. </u-radio>
  74. </u-radio-group>
  75. </view>
  76. <view class="feedback-star-view">
  77. <text class="feedback-star" v-for="(value, key) in stars" :key="key" :class="key < sendDate.score ? 'active' : ''" @tap="chooseStar(value)"></text>
  78. </view>
  79. </view> -->
  80. <view style="text-align: center; color: #999;">
  81. <view style="font-size: 24rpx;">评价信息仅供平台服务改进使用</view>
  82. <view style="font-size: 24rpx;">双峰均不可见具体评价内容</view>
  83. </view>
  84. <button type="primary" style="background: #fe6b01; margin-bottom: 30rpx;" class="feedback-submit" @tap="send">提交评价</button>
  85. </view>
  86. </template>
  87. <script>
  88. import { waitForGlobalImages } from '@/utils/globalImageLoader'
  89. export default {
  90. data() {
  91. return {
  92. msgContents: ['界面显示错乱', '启动缓慢,卡出翔了', 'UI无法直视,丑哭了', '偶发性崩溃'],
  93. // stars: [1, 2, 3, 4, 5],
  94. // count: 5,
  95. // value: 0,
  96. list: [{
  97. id: 0,
  98. name: '满意',
  99. disabled: false
  100. }, {
  101. id:1,
  102. name: '不满意',
  103. disabled: false
  104. }],
  105. // u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
  106. value: 0,
  107. imageList: [],
  108. sendDate: {
  109. score: 0,
  110. content: '',
  111. contact: ''
  112. },
  113. // riderUserId: '',
  114. // indentNumber: '',
  115. satisfactionFlag: '',
  116. globalImages: '',
  117. CreditList: [],
  118. // userId: '',
  119. // ordersNo: '',
  120. // ordersId: '',
  121. ratevalue: 0,
  122. data: {},
  123. UsertList: {}
  124. };
  125. },
  126. onLoad(option) {
  127. waitForGlobalImages().then((path) => {
  128. console.log('✅ 全局图片路径:', path)
  129. this.globalImages = path
  130. })
  131. // this.riderUserId = e.riderUserId
  132. // this.indentNumber = e.indentNumber
  133. // this.userId = e.userId
  134. // this.ordersNo = e.ordersNo
  135. // this.ordersId = e.ordersId
  136. this.data = JSON.parse(decodeURIComponent(option.data))
  137. // console.log(this.riderUserId,'........',this.indentNumber)
  138. // let deviceInfo = {
  139. // appid: plus.runtime.appid,
  140. // imei: plus.device.imei, //设备标识
  141. // p: plus.os.name === 'Android' ? 'a' : 'i', //平台类型,i表示iOS平台,a表示Android平台。
  142. // md: plus.device.model, //设备型号
  143. // app_version: plus.runtime.version,
  144. // plus_version: plus.runtime.innerVersion, //基座版本号
  145. // os: plus.os.version,
  146. // net: '' + plus.networkinfo.getCurrentType()
  147. // };
  148. // this.sendDate = Object.assign(deviceInfo, this.sendDate);
  149. this.$Request.getT('/app/credit/getCreditList?isDriver=0').then(res => {
  150. if (res.code === 0) {
  151. this.CreditList = res.data
  152. }
  153. });
  154. this.$Request.getT('/user/getUserById?id=' + this.data.driverUserId).then(res => {
  155. if (res.code === 0) {
  156. this.UsertList = res.data
  157. }
  158. });
  159. },
  160. methods: {
  161. close(e) {
  162. this.imageList.splice(e, 1);
  163. },
  164. chooseMsg() {
  165. //快速输入
  166. uni.showActionSheet({
  167. itemList: this.msgContents,
  168. success: res => {
  169. this.sendDate.content = this.msgContents[res.tapIndex];
  170. }
  171. });
  172. },
  173. chooseImg() {
  174. //选择图片
  175. uni.chooseImage({
  176. sourceType: ['camera', 'album'],
  177. sizeType: 'compressed',
  178. count: 8 - this.imageList.length,
  179. success: res => {
  180. this.imageList = this.imageList.concat(res.tempFilePaths);
  181. }
  182. });
  183. },
  184. // 选中某个单选框时,由radio时触发
  185. radioChange(e) {
  186. console.log(e);
  187. if (this.value == "满意" && e == "满意") {
  188. this.satisfactionFlag = 1
  189. } else if (this.value == '不满意' && e == "不满意") {
  190. this.satisfactionFlag = 2
  191. }
  192. },
  193. // 选中任一radio时,由radio-group触发
  194. radioGroupChange(e) {
  195. // console.log(e);
  196. },
  197. // chooseStar(e) {
  198. // //点击评星
  199. // this.sendDate.score = e;
  200. // },
  201. // previewImage() {
  202. // //预览图片
  203. // uni.previewImage({
  204. // urls: this.imageList
  205. // });
  206. // },
  207. handleRateChange(value) {
  208. console.log('用户评分:', value);
  209. this.ratevalue = value
  210. // 你可以这里处理逻辑,比如赋值给 sendData.content、上传等
  211. },
  212. toggleSelect(index) {
  213. const item = this.CreditList[index];
  214. item.selected = !item.selected;
  215. // 更新 textarea 内容
  216. const selectedDescriptions = this.CreditList
  217. .filter(i => i.selected)
  218. .map(i => i.description);
  219. this.sendDate.content = selectedDescriptions.join(',');
  220. },
  221. send() {
  222. //发送反馈
  223. // console.log(JSON.stringify(this.sendDate), '11111');
  224. if (!this.sendDate.content) {
  225. uni.showToast({
  226. icon: 'none',
  227. title: '请输入反馈内容'
  228. });
  229. return;
  230. }
  231. const selectedItems = this.CreditList.filter(i => i.selected);
  232. const totalScore = selectedItems.reduce((sum, i) => sum + i.score, 0);
  233. const types = totalScore >= 0 ? 1 : 0;
  234. const data = {
  235. userId: this.data.userId,
  236. type: types,
  237. score: totalScore,
  238. remark: this.sendDate.content,
  239. orderNo: this.data.ordersNo,
  240. isDriver: 1,
  241. ordersId: this.data.ordersId,
  242. star: this.ratevalue
  243. }
  244. this.$Request.postT("/user/updateUserCredit", data).then(res => {
  245. if (res.code == 0) {
  246. uni.showModal({
  247. title: '提示',
  248. content: '评价成功',
  249. showCancel: false
  250. });
  251. } else {
  252. uni.showModal({
  253. title: '提示',
  254. content: res.msg,
  255. showCancel: false
  256. });
  257. }
  258. }).catch(err => {
  259. uni.showModal({
  260. title: '提示',
  261. content: '网络错误,请重试',
  262. showCancel: false
  263. });
  264. });
  265. // if (this.value = 0) {
  266. // uni.showToast({
  267. // icon: 'none',
  268. // title: '请评论是否满意'
  269. // });
  270. // return;
  271. // }
  272. // uni.report( this.sendDate,'意见反馈');
  273. // console.log("uni.report( '意见反馈',this.sendDate)", uni.report('意见反馈', this.sendDate))
  274. // uni.report('意见反馈', this.sendDate);
  275. // console.log(this.indentNumber, this.satisfactionFlag)
  276. // this.$queue.showLoading('加载中...');
  277. // this.$Request
  278. // .postJson('/app/indent/userEvaluate', {
  279. // // state: this.value,
  280. // // title: this.sendDate.contact,
  281. // // evaluateMessage: JSON.stringify(this.sendDate.content),
  282. // evaluateMessage: this.sendDate.content,
  283. // // riderUserId: this.riderUserId,
  284. // indentNumber: this.indentNumber,
  285. // satisfactionFlag: this.value
  286. // })
  287. // .then(res => {
  288. // if (res.code == 0) {
  289. // uni.showToast({
  290. // title: '评论成功'
  291. // });
  292. // setTimeout(function() {
  293. // uni.navigateBack();
  294. // }, 1000);
  295. // } else {
  296. // uni.hideLoading();
  297. // uni.showModal({
  298. // showCancel: false,
  299. // title: '评论失败',
  300. // content: res.msg
  301. // });
  302. // }
  303. // });
  304. }
  305. }
  306. };
  307. </script>
  308. <style>
  309. /* @font-face {
  310. font-family: uniicons;
  311. font-weight: normal;
  312. font-style: normal;
  313. src: url('https://img-cdn-qiniu.dcloud.net.cn/fonts/uni.ttf') format('truetype');
  314. } */
  315. page {
  316. background-color: #FFFFFF;
  317. }
  318. view {
  319. font-size: 28upx;
  320. }
  321. .input-view {
  322. font-size: 28upx;
  323. }
  324. .close-view {
  325. text-align: center;
  326. line-height: 14px;
  327. height: 16px;
  328. width: 16px;
  329. border-radius: 50%;
  330. background: #ff5053;
  331. color: #ffffff;
  332. position: absolute;
  333. top: -6px;
  334. right: -4px;
  335. font-size: 12px;
  336. }
  337. /* 上传 */
  338. .uni-uploader {
  339. flex: 1;
  340. flex-direction: column;
  341. }
  342. .uni-uploader-head {
  343. display: flex;
  344. flex-direction: row;
  345. justify-content: space-between;
  346. }
  347. .uni-uploader-info {
  348. color: #b2b2b2;
  349. }
  350. .uni-uploader-body {
  351. margin-top: 16upx;
  352. }
  353. .uni-uploader__files {
  354. display: flex;
  355. flex-direction: row;
  356. flex-wrap: wrap;
  357. }
  358. .uni-uploader__file {
  359. margin: 10upx;
  360. width: 210upx;
  361. height: 210upx;
  362. }
  363. .uni-uploader__img {
  364. display: block;
  365. width: 210upx;
  366. height: 210upx;
  367. }
  368. .uni-uploader__input-box {
  369. position: relative;
  370. margin: 10upx;
  371. width: 208upx;
  372. height: 208upx;
  373. border: 2upx solid #d9d9d9;
  374. }
  375. .uni-uploader__input-box:before,
  376. .uni-uploader__input-box:after {
  377. content: ' ';
  378. position: absolute;
  379. top: 50%;
  380. left: 50%;
  381. -webkit-transform: translate(-50%, -50%);
  382. transform: translate(-50%, -50%);
  383. background-color: #d9d9d9;
  384. }
  385. .uni-uploader__input-box:before {
  386. width: 4upx;
  387. height: 79upx;
  388. }
  389. .uni-uploader__input-box:after {
  390. width: 79upx;
  391. height: 4upx;
  392. }
  393. .uni-uploader__input-box:active {
  394. border-color: #999999;
  395. }
  396. .uni-uploader__input-box:active:before,
  397. .uni-uploader__input-box:active:after {
  398. background-color: #999999;
  399. }
  400. .uni-uploader__input {
  401. position: absolute;
  402. z-index: 1;
  403. top: 0;
  404. left: 0;
  405. width: 100%;
  406. height: 100%;
  407. opacity: 0;
  408. }
  409. /*问题反馈*/
  410. .feedback-title {
  411. display: flex;
  412. flex-direction: row;
  413. justify-content: space-between;
  414. align-items: center;
  415. padding: 20upx;
  416. color: #8f8f94;
  417. font-size: 28upx;
  418. }
  419. .feedback-star-view.feedback-title {
  420. justify-content: flex-start;
  421. margin: 0;
  422. }
  423. .feedback-quick {
  424. /* position: relative; */
  425. /* padding-right: 40upx; */
  426. }
  427. /* .feedback-quick:after {
  428. font-family: uniicons;
  429. font-size: 40upx;
  430. content: '\e581';
  431. position: absolute;
  432. right: 0;
  433. top: 50%;
  434. color: #bbb;
  435. -webkit-transform: translateY(-50%);
  436. transform: translateY(-50%);
  437. } */
  438. .feedback-body {
  439. font-size: 32upx;
  440. padding: 30upx;
  441. margin: 30upx 30upx;
  442. border-radius: 16upx;
  443. background: #F8F8F8;
  444. }
  445. .feedback-textare {
  446. height: 200upx;
  447. font-size: 24upx;
  448. line-height: 50upx;
  449. width: 100%;
  450. box-sizing: border-box;
  451. padding:20upx 20upx 0;
  452. border: #e4e7ed 1rpx solid;
  453. background: #f5f5f5;
  454. border-radius: 15rpx;
  455. }
  456. .feedback-input {
  457. font-size: 32upx;
  458. height: 60upx;
  459. padding: 15upx 20upx;
  460. line-height: 60upx;
  461. }
  462. .feedback-uploader {
  463. padding: 22upx 20upx;
  464. }
  465. .feedback-star {
  466. font-family: uniicons;
  467. font-size: 40upx;
  468. margin-left: 6upx;
  469. }
  470. .feedback-star-view {
  471. margin-left: 20upx;
  472. }
  473. .feedback-star:after {
  474. content: '\e408';
  475. }
  476. .feedback-star.active {
  477. color: #ffb400;
  478. }
  479. .feedback-star.active:after {
  480. content: '\e438';
  481. }
  482. .feedback-submit {
  483. background: #007aff;
  484. color: #ffffff;
  485. margin: 20upx;
  486. }
  487. .titls {
  488. font-size: 32rpx;
  489. font-family: PingFang SC;
  490. color: #333333;
  491. padding-bottom: 30rpx;
  492. }
  493. .order_up {
  494. width: 6rpx;
  495. height: 24rpx;
  496. margin-left: 6rpx;
  497. }
  498. .add_name {
  499. font-family: PingFang SC;
  500. font-weight: 500;
  501. font-size: 28rpx;
  502. color: #1F1F1F;
  503. }
  504. .green {
  505. width: 16rpx;
  506. height: 16rpx;
  507. background: #1FC657;
  508. border-radius: 50%;
  509. margin-right: 20rpx;
  510. }
  511. .orgin {
  512. width: 16rpx;
  513. height: 16rpx;
  514. background: #FBAC04;
  515. border-radius: 50%;
  516. margin-right: 20rpx;
  517. }
  518. .flex-container {
  519. display: flex;
  520. flex-wrap: wrap; /* 允许换行 */
  521. }
  522. .item {
  523. /* flex-basis: calc(33.33% - 30rpx); */
  524. text-align: center;
  525. border-radius: 8rpx;
  526. border: 1px solid #999; /* 为了便于观察布局,添加边框 */
  527. padding: 10rpx 15rpx;
  528. margin: 15rpx 10rpx;
  529. line-height: 50rpx;
  530. }
  531. .selected {
  532. background-color: #fcf6ec;
  533. border: 1rpx solid #fe6b01;
  534. }
  535. </style>