feedback.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  1. <template>
  2. <view class="page">
  3. <!-- <view class="feedback-title"> -->
  4. <!-- <text>评价</text> -->
  5. <!-- <text @tap="chooseMsg">快速键入</text> -->
  6. <!-- </view> -->
  7. <!-- <view class="feedback-body">
  8. <textarea placeholder="请输入你的评价..." v-model="sendDate.content" class="feedback-textare" />
  9. </view> -->
  10. <!-- <view class="feedback-title"><text>QQ/邮箱</text></view> -->
  11. <!-- <view class="feedback-body"><input class="feedback-input" v-model="sendDate.mail" placeholder="方便我们联系你 " /></view> -->
  12. <!-- <view class="text-white padding bg radius margin-tb">
  13. <view>
  14. <view class="text-lg margin-top-sm text-black">商品评价图(可多张)</view>
  15. <view class="flex" style="overflow: hidden; flex-wrap: wrap">
  16. <view>
  17. <view class="margin-top flex margin-right-sm flex-wrap">
  18. <view
  19. class="flex"
  20. style="width: 200rpx; height: 200rpx; margin-right: 2rpx; position: relative"
  21. v-for="(image, index) in shopBanner"
  22. :key="index"
  23. @click="viewImg(index, shopBanner)"
  24. >
  25. <image :src="image" mode="aspectFill" style="width: 100%; height: 100%"></image>
  26. <view style="z-index: 9; position: absolute; top: -15rpx; right: -15rpx" @click.stop="removeImg(index)">
  27. <u-icon name="close-circle-fill" color="#2979ff" size="50rpx"></u-icon>
  28. </view>
  29. </view>
  30. <view class="flex" style="width: 200rpx; height: 200rpx; margin-right: 2rpx; position: relative" @click="addImages(2)" v-if="shopBanner.length < 9">
  31. <view style="width: 200rpx; height: 200rpx; background: #f4f5f6" class="flex justify-center align-center">
  32. <view>
  33. <view class="text-center">
  34. <image src="https://mxys.chuanghai-tech.com/wmfile/20250814/5d7863a9adcd45df89497a870f764f15.png" style="width: 65rpx; height: 55rpx"></image>
  35. </view>
  36. <view class="text-center text-black">添加图片</view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view> -->
  45. <!-- <view class="feedback-title feedback-star-view">
  46. <text>订单评分</text>
  47. <view class="feedback-star-view">
  48. </view>
  49. <u-rate :count="5" min-count="1" active-color="#FCD202" v-model="value"></u-rate>
  50. </view>
  51. <button type="primary" style="background: #fcd202; margin-top: 32upx" class="feedback-submit" @tap="send_throttle">提交</button> -->
  52. <!-- 店铺评价区域 -->
  53. <view class="store">
  54. <view class="store_box">
  55. <image class="store_box_img" :src="info.shopCover" mode="aspectFill"></image>
  56. {{ info.shopName }}
  57. </view>
  58. <view class="store_rate">
  59. <u-rate :count="5" min-count="1" active-color="#FF5733" size="50" gutter="50" v-model="value"></u-rate>
  60. <view v-if="value == 1" class="store_rate_text">非常差</view>
  61. <view v-if="value == 2" class="store_rate_text">差</view>
  62. <view v-if="value == 3" class="store_rate_text">一般</view>
  63. <view v-if="value == 4" class="store_rate_text">好</view>
  64. <view v-if="value == 5" class="store_rate_text">非常好</view>
  65. </view>
  66. <view class="store_pop" v-if="value">
  67. <textarea placeholder="请输入你的评价..." v-model="sendDate.content" class="feedback-textare" />
  68. <view>
  69. <view class="text-lg margin-top-sm text-black">商品评价图(可多张)</view>
  70. <view class="flex" style="overflow: hidden; flex-wrap: wrap">
  71. <view>
  72. <view class="margin-top flex margin-right-sm flex-wrap">
  73. <view
  74. class="flex"
  75. style="width: 200rpx; height: 200rpx; margin-right: 2rpx; position: relative"
  76. v-for="(image, index) in shopBanner"
  77. :key="index"
  78. @click="viewImg(index, shopBanner)"
  79. >
  80. <image :src="image" mode="aspectFill" style="width: 100%; height: 100%"></image>
  81. <view style="z-index: 9; position: absolute; top: -15rpx; right: -15rpx" @click.stop="removeImg(index)">
  82. <u-icon name="close-circle-fill" color="#2979ff" size="50rpx"></u-icon>
  83. </view>
  84. </view>
  85. <view class="flex" style="width: 200rpx; height: 200rpx; margin-right: 2rpx; position: relative" @click="addImages(2)" v-if="shopBanner.length < 9">
  86. <view style="width: 200rpx; height: 200rpx; background: #f4f5f6" class="flex justify-center align-center">
  87. <view>
  88. <view class="text-center">
  89. <image
  90. src="https://mxys.chuanghai-tech.com/wmfile/20250814/5d7863a9adcd45df89497a870f764f15.png"
  91. style="width: 65rpx; height: 55rpx"
  92. ></image>
  93. </view>
  94. <view class="text-center text-black">添加图片</view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. <!-- 骑手评价区域 -->
  105. <view class="store" style="margin-top: 20rpx" v-if="orderTypeExtra == 2">
  106. <view class="store_box">
  107. <image class="store_box_img" src="https://mxys.chuanghai-tech.com/wmfile/20250814/fff4dc5d02ea4af881db9685f2e1e61d.png" mode="aspectFill"></image>
  108. <view class="store_box_msg">
  109. 骑手配送
  110. <view class="store_box_name">{{ info.riderNickName }}</view>
  111. </view>
  112. </view>
  113. <view class="store_rate">
  114. <u-rate :count="5" min-count="1" active-color="#FF5733" size="50" gutter="50" v-model="valueRider" @change="changeRate"></u-rate>
  115. <view v-if="valueRider == 1" class="store_rate_text">非常差</view>
  116. <view v-if="valueRider == 2" class="store_rate_text">差</view>
  117. <view v-if="valueRider == 3" class="store_rate_text">一般</view>
  118. <view v-if="valueRider == 4" class="store_rate_text">好</view>
  119. <view v-if="valueRider == 5" class="store_rate_text">非常好</view>
  120. </view>
  121. <view class="store_pop" v-if="valueRider">
  122. <view class="tag_list">
  123. <view class="tag" :class="{ active: index == activeIndex }" v-for="(item, index) in tagList" :key="index" @click="activeIndex = index">{{ item }}</view>
  124. </view>
  125. </view>
  126. </view>
  127. <!-- 提交按钮区域 -->
  128. <view class="btnBox">
  129. <view class="btn" :class="{ active_btn: value || valueRider }" @tap="send_throttle">提交评价</view>
  130. </view>
  131. <!-- 用于图片压缩的canvas画布 -->
  132. <canvas
  133. :style="{
  134. width: cw + 'px',
  135. height: cw + 'px',
  136. position: 'absolute',
  137. zIndex: -1,
  138. left: '-10000rpx',
  139. top: '-10000rpx'
  140. }"
  141. canvas-id="zipCanvas"
  142. ></canvas>
  143. <!--画布结束-->
  144. </view>
  145. </template>
  146. <script>
  147. import configUrl from '../../common/config.js'
  148. import getLessLimitSizeImage from '@/utils/imageCompress.js'
  149. import { throttle } from '@/utils/throttle.js'
  150. export default {
  151. data() {
  152. return {
  153. shopBanner: [],
  154. msgContents: ['界面显示错乱', '启动缓慢,卡出翔了', 'UI无法直视,丑哭了', '偶发性崩溃'],
  155. tagList: [],
  156. stars: [1, 2, 3, 4, 5],
  157. imageList: [],
  158. sendDate: {
  159. score: 5,
  160. content: '',
  161. contact: '',
  162. goodsId: '',
  163. ordersId: '',
  164. orderNumber: '',
  165. shopId: '',
  166. riderUserId: ''
  167. },
  168. activeIndex: 0,
  169. value: 0,
  170. valueRider: 0,
  171. goodsId: '',
  172. ordersId: '',
  173. orderTypeExtra: '',
  174. info: {},
  175. //画板边长默认是屏幕宽度,正方形画布
  176. cw: uni.getSystemInfoSync().windowWidth
  177. }
  178. },
  179. onLoad(e) {
  180. // console.log(e)
  181. this.sendDate.goodsId = e.goodsId
  182. this.sendDate.ordersId = e.ordersId
  183. this.sendDate.orderNumber = e.orderNumber
  184. this.sendDate.shopId = e.shopId
  185. this.sendDate.riderUserId = e.riderUserId
  186. this.orderTypeExtra = e.orderTypeExtra
  187. this.info = JSON.parse(decodeURIComponent(e.info))
  188. // let deviceInfo = {
  189. // appid: plus.runtime.appid,
  190. // imei: plus.device.imei, //设备标识
  191. // p: plus.os.name === 'Android' ? 'a' : 'i', //平台类型,i表示iOS平台,a表示Android平台。
  192. // md: plus.device.model, //设备型号
  193. // app_version: plus.runtime.version,
  194. // plus_version: plus.runtime.innerVersion, //基座版本号
  195. // os: plus.os.version,
  196. // net: '' + plus.networkinfo.getCurrentType()
  197. // };
  198. // this.sendDate = Object.assign(deviceInfo, this.sendDate);
  199. },
  200. methods: {
  201. // 图片上传
  202. addImages(e) {
  203. uni.chooseImage({
  204. count: 9,
  205. sourceType: ['album', 'camera'],
  206. success: (res) => {
  207. for (let i = 0; i < res.tempFiles.length; i++) {
  208. //这里的id和页面中写的html代码的canvas的id要一致
  209. let canvasId = 'zipCanvas'
  210. //原图的路径
  211. let imagePath = res.tempFiles[i].path
  212. //大小限制
  213. let limitSize = 1024 * 2
  214. //初始绘画区域是画布自身的宽度也就是屏幕宽度
  215. let drawWidth = uni.getSystemInfoSync().windowWidth
  216. let that = this
  217. let token = uni.getStorageSync('token')
  218. getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
  219. uni.showLoading({
  220. title: '上传中'
  221. })
  222. uni.uploadFile({
  223. url: configUrl.APIHOST + '/app/new-file/upload',
  224. filePath: resPath,
  225. header: {
  226. token: token
  227. },
  228. name: 'file',
  229. success: (uploadFileRes) => {
  230. if (this.shopBanner.length < 9) {
  231. if (JSON.parse(uploadFileRes.data).data) {
  232. this.shopBanner.push(JSON.parse(uploadFileRes.data).data)
  233. } else {
  234. uni.showToast({
  235. title: '图片上传失败,请重试',
  236. icon: 'none'
  237. })
  238. }
  239. }
  240. console.log(this.shopBanner)
  241. uni.hideLoading()
  242. },
  243. fail: () => {
  244. uni.showToast({
  245. title: '上传失败',
  246. icon: 'error'
  247. })
  248. }
  249. })
  250. })
  251. }
  252. }
  253. })
  254. },
  255. // 评价图删除
  256. removeImg(index) {
  257. this.shopBanner.splice(index, 1)
  258. },
  259. chooseMsg() {
  260. //快速输入
  261. uni.showActionSheet({
  262. itemList: this.msgContents,
  263. success: (res) => {
  264. this.sendDate.content = this.msgContents[res.tapIndex]
  265. }
  266. })
  267. },
  268. send_throttle: throttle(function () {
  269. this.send()
  270. }, 2000),
  271. send() {
  272. // console.log(this.orderTypeExtra)
  273. if (this.orderTypeExtra == 1 || this.orderTypeExtra == 3||this.orderTypeExtra==0) {
  274. // 到店取餐
  275. if (!this.value) {
  276. uni.showToast({
  277. icon: 'none',
  278. title: '请选择评价星级'
  279. })
  280. return
  281. }
  282. if (!this.sendDate.content) {
  283. uni.showToast({
  284. icon: 'none',
  285. title: '请输入评价内容'
  286. })
  287. return
  288. }
  289. if (!this.shopBanner.length) {
  290. uni.showToast({
  291. icon: 'none',
  292. title: '请上传商品评价图'
  293. })
  294. return
  295. }
  296. this.sendReq()
  297. } else if (this.orderTypeExtra == 2) {
  298. // 外卖配送
  299. if (!this.value && !this.valueRider) {
  300. uni.showToast({
  301. icon: 'none',
  302. title: '请选择评价星级'
  303. })
  304. return
  305. }
  306. if (this.value && !this.sendDate.content) {
  307. uni.showToast({
  308. icon: 'none',
  309. title: '请输入评价内容'
  310. })
  311. return
  312. }
  313. if (this.value && !this.shopBanner.length) {
  314. uni.showToast({
  315. icon: 'none',
  316. title: '请上传商品评价图'
  317. })
  318. return
  319. }
  320. this.sendReq()
  321. }
  322. },
  323. sendReq() {
  324. this.$queue.showLoading('加载中...')
  325. this.$Request
  326. .postJson('/app/order/insertEvaluate', {
  327. goodsId: this.sendDate.goodsId,
  328. ordersId: this.sendDate.ordersId,
  329. orderNumber: this.sendDate.orderNumber,
  330. evaluateMessage: this.sendDate.content,
  331. score: this.value,
  332. shopId: this.sendDate.shopId,
  333. pictures: this.shopBanner.length > 0 ? this.shopBanner.join(',') : '',
  334. riderUserId: this.sendDate.riderUserId,
  335. evaluateRiderMessage: this.tagList[this.activeIndex],
  336. riderScore: this.valueRider
  337. })
  338. .then((res) => {
  339. if (res.code === 0) {
  340. uni.showToast({
  341. title: '评价成功'
  342. })
  343. setTimeout(function () {
  344. uni.navigateBack()
  345. }, 1000)
  346. } else {
  347. uni.hideLoading()
  348. uni.showModal({
  349. showCancel: false,
  350. title: '评价失败',
  351. content: res.msg
  352. })
  353. }
  354. })
  355. },
  356. viewImg(i, list) {
  357. uni.previewImage({
  358. urls: list,
  359. current: i
  360. })
  361. },
  362. changeRate(value) {
  363. this.valueRider = value
  364. this.activeIndex = 0
  365. if (this.valueRider == 1 || this.valueRider == 2) {
  366. this.tagList = ['态度恶劣', '餐品洒了', '货物丢失', '配送超时']
  367. } else if (this.valueRider == 3) {
  368. this.tagList = ['一般']
  369. } else if (this.valueRider == 4 || this.valueRider == 5) {
  370. this.tagList = ['服务热情', '快速准时', '东西很好', '价格实惠', '文明礼貌', '餐品完好']
  371. }
  372. }
  373. }
  374. }
  375. </script>
  376. <style>
  377. @font-face {
  378. font-family: uniicons;
  379. font-weight: normal;
  380. font-style: normal;
  381. src: url('https://img-cdn-qiniu.dcloud.net.cn/fonts/uni.ttf') format('truetype');
  382. }
  383. page {
  384. background-color: #e6e6e6;
  385. }
  386. .store {
  387. box-sizing: border-box;
  388. padding: 20rpx;
  389. background-color: #fff9ed;
  390. }
  391. .store_box {
  392. display: flex;
  393. align-items: center;
  394. font-size: 32rpx;
  395. }
  396. .store_box_img {
  397. margin-right: 22rpx;
  398. width: 100rpx;
  399. height: 100rpx;
  400. border-radius: 50%;
  401. }
  402. .store_box_msg {
  403. font-size: 32rpx;
  404. }
  405. .store_box_name {
  406. font-size: 28rpx;
  407. color: #808080;
  408. }
  409. .store_rate {
  410. display: flex;
  411. align-items: center;
  412. height: 130rpx;
  413. }
  414. .store_rate_text {
  415. margin-left: 30rpx;
  416. }
  417. .tag_list {
  418. display: flex;
  419. flex-wrap: wrap;
  420. }
  421. .tag {
  422. margin-right: 30rpx;
  423. margin-bottom: 30rpx;
  424. padding: 0 20rpx;
  425. height: 68rpx;
  426. line-height: 68rpx;
  427. text-align: center;
  428. font-size: 24rpx;
  429. border-radius: 8rpx;
  430. background-color: #f2f2f2;
  431. }
  432. .active {
  433. border: 2rpx solid #ff5733;
  434. color: #ff5733;
  435. background-color: #fff;
  436. }
  437. .btnBox {
  438. display: flex;
  439. align-items: center;
  440. justify-content: center;
  441. height: 250rpx;
  442. /* background-color: #fff; */
  443. }
  444. .btn {
  445. display: flex;
  446. align-items: center;
  447. justify-content: center;
  448. width: 626rpx;
  449. height: 90rpx;
  450. font-size: 32rpx;
  451. color: #000;
  452. border-radius: 110rpx;
  453. border: 2rpx solid rgba(95, 152, 139, 1);
  454. background-color: rgba(178, 213, 198, 1);
  455. }
  456. .active_btn {
  457. background-color: #f18731;
  458. }
  459. view {
  460. font-size: 28upx;
  461. }
  462. .input-view {
  463. font-size: 28upx;
  464. }
  465. .close-view {
  466. text-align: center;
  467. line-height: 14px;
  468. height: 16px;
  469. width: 16px;
  470. border-radius: 50%;
  471. background: #ff5053;
  472. color: #ffffff;
  473. position: absolute;
  474. top: -6px;
  475. right: -4px;
  476. font-size: 12px;
  477. }
  478. /* 上传 */
  479. .uni-uploader {
  480. flex: 1;
  481. flex-direction: column;
  482. }
  483. .uni-uploader-head {
  484. display: flex;
  485. flex-direction: row;
  486. justify-content: space-between;
  487. }
  488. .uni-uploader-info {
  489. color: #b2b2b2;
  490. }
  491. .uni-uploader-body {
  492. margin-top: 16upx;
  493. }
  494. .uni-uploader__files {
  495. display: flex;
  496. flex-direction: row;
  497. flex-wrap: wrap;
  498. }
  499. .uni-uploader__file {
  500. margin: 10upx;
  501. width: 210upx;
  502. height: 210upx;
  503. }
  504. .uni-uploader__img {
  505. display: block;
  506. width: 210upx;
  507. height: 210upx;
  508. }
  509. .uni-uploader__input-box {
  510. position: relative;
  511. margin: 10upx;
  512. width: 208upx;
  513. height: 208upx;
  514. border: 2upx solid #d9d9d9;
  515. }
  516. .uni-uploader__input-box:before,
  517. .uni-uploader__input-box:after {
  518. content: ' ';
  519. position: absolute;
  520. top: 50%;
  521. left: 50%;
  522. -webkit-transform: translate(-50%, -50%);
  523. transform: translate(-50%, -50%);
  524. background-color: #d9d9d9;
  525. }
  526. .uni-uploader__input-box:before {
  527. width: 4upx;
  528. height: 79upx;
  529. }
  530. .uni-uploader__input-box:after {
  531. width: 79upx;
  532. height: 4upx;
  533. }
  534. .uni-uploader__input-box:active {
  535. border-color: #999999;
  536. }
  537. .uni-uploader__input-box:active:before,
  538. .uni-uploader__input-box:active:after {
  539. background-color: #999999;
  540. }
  541. .uni-uploader__input {
  542. position: absolute;
  543. z-index: 1;
  544. top: 0;
  545. left: 0;
  546. width: 100%;
  547. height: 100%;
  548. opacity: 0;
  549. }
  550. /*问题反馈*/
  551. .feedback-title {
  552. display: flex;
  553. flex-direction: row;
  554. justify-content: space-between;
  555. align-items: center;
  556. padding: 20upx;
  557. color: #8f8f94;
  558. font-size: 28upx;
  559. }
  560. .feedback-star-view.feedback-title {
  561. justify-content: flex-start;
  562. margin: 0;
  563. }
  564. .feedback-quick {
  565. position: relative;
  566. padding-right: 40upx;
  567. }
  568. .feedback-quick:after {
  569. font-family: uniicons;
  570. font-size: 40upx;
  571. content: '\e581';
  572. position: absolute;
  573. right: 0;
  574. top: 50%;
  575. color: #bbb;
  576. -webkit-transform: translateY(-50%);
  577. transform: translateY(-50%);
  578. }
  579. .feedback-body {
  580. font-size: 32upx;
  581. padding: 16upx;
  582. margin: 16upx;
  583. border-radius: 16upx;
  584. background: #f2f2f2;
  585. color: #fff;
  586. }
  587. .feedback-textare {
  588. height: 200upx;
  589. font-size: 30upx;
  590. line-height: 50upx;
  591. width: 100%;
  592. box-sizing: border-box;
  593. padding: 20upx 30upx;
  594. color: #8f8f94;
  595. border-radius: 12rpx;
  596. background-color: #f5f5f5;
  597. }
  598. .feedback-input {
  599. font-size: 32upx;
  600. height: 60upx;
  601. padding: 15upx 20upx;
  602. line-height: 60upx;
  603. }
  604. .feedback-uploader {
  605. padding: 22upx 20upx;
  606. }
  607. .feedback-star {
  608. font-family: uniicons;
  609. font-size: 40upx;
  610. margin-left: 6upx;
  611. }
  612. .feedback-star-view {
  613. margin-left: 20upx;
  614. }
  615. .feedback-star:after {
  616. content: '\e408';
  617. }
  618. .feedback-star.active {
  619. color: #ffb400;
  620. }
  621. .feedback-star.active:after {
  622. content: '\e438';
  623. }
  624. .feedback-submit {
  625. background: #007aff;
  626. color: #ffffff;
  627. margin: 20upx;
  628. }
  629. </style>