feedback.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  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. getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
  218. uni.showLoading({
  219. title: '上传中'
  220. })
  221. uni.uploadFile({
  222. url: configUrl.APIHOST + '/alioss/upload',
  223. filePath: resPath,
  224. name: 'file',
  225. success: (uploadFileRes) => {
  226. if (this.shopBanner.length < 9) {
  227. if (JSON.parse(uploadFileRes.data).data) {
  228. this.shopBanner.push(JSON.parse(uploadFileRes.data).data)
  229. } else {
  230. uni.showToast({
  231. title: '图片上传失败,请重试',
  232. icon: 'none'
  233. })
  234. }
  235. }
  236. console.log(this.shopBanner)
  237. uni.hideLoading()
  238. },
  239. fail: () => {
  240. uni.showToast({
  241. title: '上传失败',
  242. icon: 'error'
  243. })
  244. }
  245. })
  246. })
  247. }
  248. }
  249. })
  250. },
  251. // 评价图删除
  252. removeImg(index) {
  253. this.shopBanner.splice(index, 1)
  254. },
  255. chooseMsg() {
  256. //快速输入
  257. uni.showActionSheet({
  258. itemList: this.msgContents,
  259. success: (res) => {
  260. this.sendDate.content = this.msgContents[res.tapIndex]
  261. }
  262. })
  263. },
  264. send_throttle: throttle(function () {
  265. this.send()
  266. }, 2000),
  267. send() {
  268. // console.log(this.orderTypeExtra)
  269. if (this.orderTypeExtra == 1 || this.orderTypeExtra == 3) {
  270. // 到店取餐
  271. if (!this.value) {
  272. uni.showToast({
  273. icon: 'none',
  274. title: '请选择评价星级'
  275. })
  276. return
  277. }
  278. if (!this.sendDate.content) {
  279. uni.showToast({
  280. icon: 'none',
  281. title: '请输入评价内容'
  282. })
  283. return
  284. }
  285. if (!this.shopBanner.length) {
  286. uni.showToast({
  287. icon: 'none',
  288. title: '请上传商品评价图'
  289. })
  290. return
  291. }
  292. this.sendReq()
  293. } else if (this.orderTypeExtra == 2) {
  294. // 外卖配送
  295. if (!this.value && !this.valueRider) {
  296. uni.showToast({
  297. icon: 'none',
  298. title: '请选择评价星级'
  299. })
  300. return
  301. }
  302. if (this.value && !this.sendDate.content) {
  303. uni.showToast({
  304. icon: 'none',
  305. title: '请输入评价内容'
  306. })
  307. return
  308. }
  309. if (this.value && !this.shopBanner.length) {
  310. uni.showToast({
  311. icon: 'none',
  312. title: '请上传商品评价图'
  313. })
  314. return
  315. }
  316. this.sendReq()
  317. }
  318. },
  319. sendReq() {
  320. this.$queue.showLoading('加载中...')
  321. this.$Request
  322. .postJson('/app/order/insertEvaluate', {
  323. goodsId: this.sendDate.goodsId,
  324. ordersId: this.sendDate.ordersId,
  325. orderNumber: this.sendDate.orderNumber,
  326. evaluateMessage: this.sendDate.content,
  327. score: this.value,
  328. shopId: this.sendDate.shopId,
  329. pictures: this.shopBanner.length > 0 ? this.shopBanner.join(',') : '',
  330. riderUserId: this.sendDate.riderUserId,
  331. evaluateRiderMessage: this.tagList[this.activeIndex],
  332. riderScore: this.valueRider
  333. })
  334. .then((res) => {
  335. if (res.code === 0) {
  336. uni.showToast({
  337. title: '评价成功'
  338. })
  339. setTimeout(function () {
  340. uni.navigateBack()
  341. }, 1000)
  342. } else {
  343. uni.hideLoading()
  344. uni.showModal({
  345. showCancel: false,
  346. title: '评价失败',
  347. content: res.msg
  348. })
  349. }
  350. })
  351. },
  352. viewImg(i, list) {
  353. uni.previewImage({
  354. urls: list,
  355. current: i
  356. })
  357. },
  358. changeRate(value) {
  359. this.valueRider = value
  360. this.activeIndex = 0
  361. if (this.valueRider == 1 || this.valueRider == 2) {
  362. this.tagList = ['态度恶劣', '餐品洒了', '货物丢失', '配送超时']
  363. } else if (this.valueRider == 3) {
  364. this.tagList = ['一般']
  365. } else if (this.valueRider == 4 || this.valueRider == 5) {
  366. this.tagList = ['服务热情', '快速准时', '东西很好', '价格实惠', '文明礼貌', '餐品完好']
  367. }
  368. }
  369. }
  370. }
  371. </script>
  372. <style>
  373. @font-face {
  374. font-family: uniicons;
  375. font-weight: normal;
  376. font-style: normal;
  377. src: url('https://img-cdn-qiniu.dcloud.net.cn/fonts/uni.ttf') format('truetype');
  378. }
  379. page {
  380. background-color: #e6e6e6;
  381. }
  382. .store {
  383. box-sizing: border-box;
  384. padding: 20rpx;
  385. background-color: #fff;
  386. }
  387. .store_box {
  388. display: flex;
  389. align-items: center;
  390. font-size: 32rpx;
  391. }
  392. .store_box_img {
  393. margin-right: 22rpx;
  394. width: 100rpx;
  395. height: 100rpx;
  396. border-radius: 50%;
  397. }
  398. .store_box_msg {
  399. font-size: 32rpx;
  400. }
  401. .store_box_name {
  402. font-size: 28rpx;
  403. color: #808080;
  404. }
  405. .store_rate {
  406. display: flex;
  407. align-items: center;
  408. height: 130rpx;
  409. }
  410. .store_rate_text {
  411. margin-left: 30rpx;
  412. }
  413. .tag_list {
  414. display: flex;
  415. flex-wrap: wrap;
  416. }
  417. .tag {
  418. margin-right: 30rpx;
  419. margin-bottom: 30rpx;
  420. padding: 0 20rpx;
  421. height: 68rpx;
  422. line-height: 68rpx;
  423. text-align: center;
  424. font-size: 24rpx;
  425. border-radius: 8rpx;
  426. background-color: #f2f2f2;
  427. }
  428. .active {
  429. border: 2rpx solid #ff5733;
  430. color: #ff5733;
  431. background-color: #fff;
  432. }
  433. .btnBox {
  434. display: flex;
  435. align-items: center;
  436. justify-content: center;
  437. height: 250rpx;
  438. background-color: #fff;
  439. }
  440. .btn {
  441. display: flex;
  442. align-items: center;
  443. justify-content: center;
  444. width: 626rpx;
  445. height: 90rpx;
  446. font-size: 32rpx;
  447. color: #000;
  448. border-radius: 110rpx;
  449. border: 2rpx solid rgba(95, 152, 139, 1);
  450. background-color: rgba(178, 213, 198, 1);
  451. }
  452. .active_btn {
  453. background-color: #f18731;
  454. }
  455. view {
  456. font-size: 28upx;
  457. }
  458. .input-view {
  459. font-size: 28upx;
  460. }
  461. .close-view {
  462. text-align: center;
  463. line-height: 14px;
  464. height: 16px;
  465. width: 16px;
  466. border-radius: 50%;
  467. background: #ff5053;
  468. color: #ffffff;
  469. position: absolute;
  470. top: -6px;
  471. right: -4px;
  472. font-size: 12px;
  473. }
  474. /* 上传 */
  475. .uni-uploader {
  476. flex: 1;
  477. flex-direction: column;
  478. }
  479. .uni-uploader-head {
  480. display: flex;
  481. flex-direction: row;
  482. justify-content: space-between;
  483. }
  484. .uni-uploader-info {
  485. color: #b2b2b2;
  486. }
  487. .uni-uploader-body {
  488. margin-top: 16upx;
  489. }
  490. .uni-uploader__files {
  491. display: flex;
  492. flex-direction: row;
  493. flex-wrap: wrap;
  494. }
  495. .uni-uploader__file {
  496. margin: 10upx;
  497. width: 210upx;
  498. height: 210upx;
  499. }
  500. .uni-uploader__img {
  501. display: block;
  502. width: 210upx;
  503. height: 210upx;
  504. }
  505. .uni-uploader__input-box {
  506. position: relative;
  507. margin: 10upx;
  508. width: 208upx;
  509. height: 208upx;
  510. border: 2upx solid #d9d9d9;
  511. }
  512. .uni-uploader__input-box:before,
  513. .uni-uploader__input-box:after {
  514. content: ' ';
  515. position: absolute;
  516. top: 50%;
  517. left: 50%;
  518. -webkit-transform: translate(-50%, -50%);
  519. transform: translate(-50%, -50%);
  520. background-color: #d9d9d9;
  521. }
  522. .uni-uploader__input-box:before {
  523. width: 4upx;
  524. height: 79upx;
  525. }
  526. .uni-uploader__input-box:after {
  527. width: 79upx;
  528. height: 4upx;
  529. }
  530. .uni-uploader__input-box:active {
  531. border-color: #999999;
  532. }
  533. .uni-uploader__input-box:active:before,
  534. .uni-uploader__input-box:active:after {
  535. background-color: #999999;
  536. }
  537. .uni-uploader__input {
  538. position: absolute;
  539. z-index: 1;
  540. top: 0;
  541. left: 0;
  542. width: 100%;
  543. height: 100%;
  544. opacity: 0;
  545. }
  546. /*问题反馈*/
  547. .feedback-title {
  548. display: flex;
  549. flex-direction: row;
  550. justify-content: space-between;
  551. align-items: center;
  552. padding: 20upx;
  553. color: #8f8f94;
  554. font-size: 28upx;
  555. }
  556. .feedback-star-view.feedback-title {
  557. justify-content: flex-start;
  558. margin: 0;
  559. }
  560. .feedback-quick {
  561. position: relative;
  562. padding-right: 40upx;
  563. }
  564. .feedback-quick:after {
  565. font-family: uniicons;
  566. font-size: 40upx;
  567. content: '\e581';
  568. position: absolute;
  569. right: 0;
  570. top: 50%;
  571. color: #bbb;
  572. -webkit-transform: translateY(-50%);
  573. transform: translateY(-50%);
  574. }
  575. .feedback-body {
  576. font-size: 32upx;
  577. padding: 16upx;
  578. margin: 16upx;
  579. border-radius: 16upx;
  580. background: #f2f2f2;
  581. color: #fff;
  582. }
  583. .feedback-textare {
  584. height: 200upx;
  585. font-size: 30upx;
  586. line-height: 50upx;
  587. width: 100%;
  588. box-sizing: border-box;
  589. padding: 20upx 30upx;
  590. color: #8f8f94;
  591. border-radius: 12rpx;
  592. background-color: #f5f5f5;
  593. }
  594. .feedback-input {
  595. font-size: 32upx;
  596. height: 60upx;
  597. padding: 15upx 20upx;
  598. line-height: 60upx;
  599. }
  600. .feedback-uploader {
  601. padding: 22upx 20upx;
  602. }
  603. .feedback-star {
  604. font-family: uniicons;
  605. font-size: 40upx;
  606. margin-left: 6upx;
  607. }
  608. .feedback-star-view {
  609. margin-left: 20upx;
  610. }
  611. .feedback-star:after {
  612. content: '\e408';
  613. }
  614. .feedback-star.active {
  615. color: #ffb400;
  616. }
  617. .feedback-star.active:after {
  618. content: '\e438';
  619. }
  620. .feedback-submit {
  621. background: #007aff;
  622. color: #ffffff;
  623. margin: 20upx;
  624. }
  625. </style>