feedback.vue 16 KB

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