comments.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  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 + 'imgs/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="#e6a23c"
  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: #00c18a; 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. // console.log(e)
  132. // this.riderUserId = e.riderUserId
  133. // this.indentNumber = e.indentNumber
  134. // this.userId = e.userId
  135. // this.ordersNo = e.ordersNo
  136. // this.ordersId = e.ordersId
  137. this.data = JSON.parse(decodeURIComponent(option.data))
  138. // console.log(this.riderUserId,'........',this.indentNumber)
  139. // let deviceInfo = {
  140. // appid: plus.runtime.appid,
  141. // imei: plus.device.imei, //设备标识
  142. // p: plus.os.name === 'Android' ? 'a' : 'i', //平台类型,i表示iOS平台,a表示Android平台。
  143. // md: plus.device.model, //设备型号
  144. // app_version: plus.runtime.version,
  145. // plus_version: plus.runtime.innerVersion, //基座版本号
  146. // os: plus.os.version,
  147. // net: '' + plus.networkinfo.getCurrentType()
  148. // };
  149. // this.sendDate = Object.assign(deviceInfo, this.sendDate);
  150. this.$Request.getT('/app/credit/getCreditList?isDriver=1').then(res => {
  151. if (res.code === 0) {
  152. this.CreditList = res.data
  153. }
  154. });
  155. this.$Request.getT('/user/getUserById?id=' + this.data.userId).then(res => {
  156. if (res.code === 0) {
  157. this.UsertList = res.data
  158. }
  159. });
  160. },
  161. methods: {
  162. close(e) {
  163. this.imageList.splice(e, 1);
  164. },
  165. chooseMsg() {
  166. //快速输入
  167. uni.showActionSheet({
  168. itemList: this.msgContents,
  169. success: res => {
  170. this.sendDate.content = this.msgContents[res.tapIndex];
  171. }
  172. });
  173. },
  174. chooseImg() {
  175. //选择图片
  176. uni.chooseImage({
  177. sourceType: ['camera', 'album'],
  178. sizeType: 'compressed',
  179. count: 8 - this.imageList.length,
  180. success: res => {
  181. this.imageList = this.imageList.concat(res.tempFilePaths);
  182. }
  183. });
  184. },
  185. // 选中某个单选框时,由radio时触发
  186. radioChange(e) {
  187. console.log(e);
  188. if (this.value == "满意" && e == "满意") {
  189. this.satisfactionFlag = 1
  190. } else if (this.value == '不满意' && e == "不满意") {
  191. this.satisfactionFlag = 2
  192. }
  193. },
  194. // 选中任一radio时,由radio-group触发
  195. radioGroupChange(e) {
  196. // console.log(e);
  197. },
  198. // chooseStar(e) {
  199. // //点击评星
  200. // this.sendDate.score = e;
  201. // },
  202. // previewImage() {
  203. // //预览图片
  204. // uni.previewImage({
  205. // urls: this.imageList
  206. // });
  207. // },
  208. handleRateChange(value) {
  209. console.log('用户评分:', value);
  210. this.ratevalue = value
  211. // 你可以这里处理逻辑,比如赋值给 sendData.content、上传等
  212. },
  213. toggleSelect(index) {
  214. const item = this.CreditList[index];
  215. item.selected = !item.selected;
  216. // 更新 textarea 内容
  217. const selectedDescriptions = this.CreditList
  218. .filter(i => i.selected)
  219. .map(i => i.description);
  220. this.sendDate.content = selectedDescriptions.join(',');
  221. },
  222. send() {
  223. //发送反馈
  224. // console.log(JSON.stringify(this.sendDate), '11111');
  225. if (!this.sendDate.content) {
  226. uni.showToast({
  227. icon: 'none',
  228. title: '请输入反馈内容'
  229. });
  230. return;
  231. }
  232. const selectedItems = this.CreditList.filter(i => i.selected);
  233. const totalScore = selectedItems.reduce((sum, i) => sum + i.score, 0);
  234. const types = totalScore >= 0 ? 1 : 0;
  235. const data = {
  236. userId: this.data.userId,
  237. type: types,
  238. score: totalScore,
  239. remark: this.sendDate.content,
  240. orderNo: this.data.ordersNo,
  241. isDriver: 0,
  242. ordersId: this.data.ordersId,
  243. star: this.ratevalue
  244. }
  245. this.$Request.postT("/user/updateUserCredit", data).then(res => {
  246. if (res.code == 0) {
  247. uni.showModal({
  248. title: '提示',
  249. content: '评价成功',
  250. showCancel: false
  251. });
  252. } else {
  253. uni.showModal({
  254. title: '提示',
  255. content: res.msg,
  256. showCancel: false
  257. });
  258. }
  259. }).catch(err => {
  260. uni.showModal({
  261. title: '提示',
  262. content: '网络错误,请重试',
  263. showCancel: false
  264. });
  265. });
  266. // if (this.value = 0) {
  267. // uni.showToast({
  268. // icon: 'none',
  269. // title: '请评论是否满意'
  270. // });
  271. // return;
  272. // }
  273. // uni.report( this.sendDate,'意见反馈');
  274. // console.log("uni.report( '意见反馈',this.sendDate)", uni.report('意见反馈', this.sendDate))
  275. // uni.report('意见反馈', this.sendDate);
  276. // console.log(this.indentNumber, this.satisfactionFlag)
  277. // this.$queue.showLoading('加载中...');
  278. // this.$Request
  279. // .postJson('/app/indent/userEvaluate', {
  280. // // state: this.value,
  281. // // title: this.sendDate.contact,
  282. // // evaluateMessage: JSON.stringify(this.sendDate.content),
  283. // evaluateMessage: this.sendDate.content,
  284. // // riderUserId: this.riderUserId,
  285. // indentNumber: this.indentNumber,
  286. // satisfactionFlag: this.value
  287. // })
  288. // .then(res => {
  289. // if (res.code == 0) {
  290. // uni.showToast({
  291. // title: '评论成功'
  292. // });
  293. // setTimeout(function() {
  294. // uni.navigateBack();
  295. // }, 1000);
  296. // } else {
  297. // uni.hideLoading();
  298. // uni.showModal({
  299. // showCancel: false,
  300. // title: '评论失败',
  301. // content: res.msg
  302. // });
  303. // }
  304. // });
  305. }
  306. }
  307. };
  308. </script>
  309. <style>
  310. /* @font-face {
  311. font-family: uniicons;
  312. font-weight: normal;
  313. font-style: normal;
  314. src: url('https://img-cdn-qiniu.dcloud.net.cn/fonts/uni.ttf') format('truetype');
  315. } */
  316. page {
  317. background-color: #FFFFFF;
  318. }
  319. view {
  320. font-size: 28upx;
  321. }
  322. .input-view {
  323. font-size: 28upx;
  324. }
  325. .close-view {
  326. text-align: center;
  327. line-height: 14px;
  328. height: 16px;
  329. width: 16px;
  330. border-radius: 50%;
  331. background: #ff5053;
  332. color: #ffffff;
  333. position: absolute;
  334. top: -6px;
  335. right: -4px;
  336. font-size: 12px;
  337. }
  338. /* 上传 */
  339. .uni-uploader {
  340. flex: 1;
  341. flex-direction: column;
  342. }
  343. .uni-uploader-head {
  344. display: flex;
  345. flex-direction: row;
  346. justify-content: space-between;
  347. }
  348. .uni-uploader-info {
  349. color: #b2b2b2;
  350. }
  351. .uni-uploader-body {
  352. margin-top: 16upx;
  353. }
  354. .uni-uploader__files {
  355. display: flex;
  356. flex-direction: row;
  357. flex-wrap: wrap;
  358. }
  359. .uni-uploader__file {
  360. margin: 10upx;
  361. width: 210upx;
  362. height: 210upx;
  363. }
  364. .uni-uploader__img {
  365. display: block;
  366. width: 210upx;
  367. height: 210upx;
  368. }
  369. .uni-uploader__input-box {
  370. position: relative;
  371. margin: 10upx;
  372. width: 208upx;
  373. height: 208upx;
  374. border: 2upx solid #d9d9d9;
  375. }
  376. .uni-uploader__input-box:before,
  377. .uni-uploader__input-box:after {
  378. content: ' ';
  379. position: absolute;
  380. top: 50%;
  381. left: 50%;
  382. -webkit-transform: translate(-50%, -50%);
  383. transform: translate(-50%, -50%);
  384. background-color: #d9d9d9;
  385. }
  386. .uni-uploader__input-box:before {
  387. width: 4upx;
  388. height: 79upx;
  389. }
  390. .uni-uploader__input-box:after {
  391. width: 79upx;
  392. height: 4upx;
  393. }
  394. .uni-uploader__input-box:active {
  395. border-color: #999999;
  396. }
  397. .uni-uploader__input-box:active:before,
  398. .uni-uploader__input-box:active:after {
  399. background-color: #999999;
  400. }
  401. .uni-uploader__input {
  402. position: absolute;
  403. z-index: 1;
  404. top: 0;
  405. left: 0;
  406. width: 100%;
  407. height: 100%;
  408. opacity: 0;
  409. }
  410. /*问题反馈*/
  411. .feedback-title {
  412. display: flex;
  413. flex-direction: row;
  414. justify-content: space-between;
  415. align-items: center;
  416. padding: 20upx;
  417. color: #8f8f94;
  418. font-size: 28upx;
  419. }
  420. .feedback-star-view.feedback-title {
  421. justify-content: flex-start;
  422. margin: 0;
  423. }
  424. .feedback-quick {
  425. /* position: relative; */
  426. /* padding-right: 40upx; */
  427. }
  428. /* .feedback-quick:after {
  429. font-family: uniicons;
  430. font-size: 40upx;
  431. content: '\e581';
  432. position: absolute;
  433. right: 0;
  434. top: 50%;
  435. color: #bbb;
  436. -webkit-transform: translateY(-50%);
  437. transform: translateY(-50%);
  438. } */
  439. .feedback-body {
  440. font-size: 32upx;
  441. padding: 30upx;
  442. margin: 30upx 30upx;
  443. border-radius: 16upx;
  444. background: #F8F8F8;
  445. }
  446. .feedback-textare {
  447. height: 200upx;
  448. font-size: 24upx;
  449. line-height: 50upx;
  450. width: 100%;
  451. box-sizing: border-box;
  452. padding:20upx 20upx 0;
  453. border: #e4e7ed 1rpx solid;
  454. background: #f5f5f5;
  455. border-radius: 15rpx;
  456. }
  457. .feedback-input {
  458. font-size: 32upx;
  459. height: 60upx;
  460. padding: 15upx 20upx;
  461. line-height: 60upx;
  462. }
  463. .feedback-uploader {
  464. padding: 22upx 20upx;
  465. }
  466. .feedback-star {
  467. font-family: uniicons;
  468. font-size: 40upx;
  469. margin-left: 6upx;
  470. }
  471. .feedback-star-view {
  472. margin-left: 20upx;
  473. }
  474. .feedback-star:after {
  475. content: '\e408';
  476. }
  477. .feedback-star.active {
  478. color: #ffb400;
  479. }
  480. .feedback-star.active:after {
  481. content: '\e438';
  482. }
  483. .feedback-submit {
  484. background: #007aff;
  485. color: #ffffff;
  486. margin: 20upx;
  487. }
  488. .titls {
  489. font-size: 32rpx;
  490. font-family: PingFang SC;
  491. color: #333333;
  492. padding-bottom: 30rpx;
  493. }
  494. .order_up {
  495. width: 6rpx;
  496. height: 24rpx;
  497. margin-left: 6rpx;
  498. }
  499. .add_name {
  500. font-family: PingFang SC;
  501. font-weight: 500;
  502. font-size: 28rpx;
  503. color: #1F1F1F;
  504. }
  505. .green {
  506. width: 16rpx;
  507. height: 16rpx;
  508. background: #1FC657;
  509. border-radius: 50%;
  510. margin-right: 20rpx;
  511. }
  512. .orgin {
  513. width: 16rpx;
  514. height: 16rpx;
  515. background: #FBAC04;
  516. border-radius: 50%;
  517. margin-right: 20rpx;
  518. }
  519. .flex-container {
  520. display: flex;
  521. flex-wrap: wrap; /* 允许换行 */
  522. }
  523. .item {
  524. /* flex-basis: calc(33.33% - 30rpx); */
  525. text-align: center;
  526. border-radius: 8rpx;
  527. border: 1px solid #999; /* 为了便于观察布局,添加边框 */
  528. padding: 8rpx 20rpx;
  529. margin: 15rpx 10rpx;
  530. line-height: 50rpx;
  531. }
  532. .selected {
  533. background-color: #e6fff5;
  534. border: 1rpx solid #00c18a;
  535. }
  536. </style>