feedbacks.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. <template>
  2. <view class="page">
  3. <view class="feedback-title">
  4. <text>是否满意</text>
  5. <text @tap="chooseMsg">{{ satisfactionFlagName ? satisfactionFlagName : '请选择是否满意' }}</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-sm">
  13. <view>
  14. <view class="text-lg 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 class="flex"
  19. style="width: 200rpx;height: 200rpx;margin-right: 2rpx;position: relative;"
  20. v-for="(image,index) in shopBanner" :key="index">
  21. <image :src="image" style="width: 100%;height: 100%;"></image>
  22. <view style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
  23. @click="removeImg(index)">
  24. <u-icon name="close-circle-fill" color="#2979ff" size="50rpx"></u-icon>
  25. </view>
  26. </view>
  27. <view class="flex"
  28. style="width: 200rpx;height: 200rpx;margin-right: 2rpx;position: relative;" @click="addImages(2)" v-if="shopBanner.length<9">
  29. <view style="width: 200rpx;height: 200rpx;background: #f4f5f6;"
  30. class="flex justify-center align-center">
  31. <view>
  32. <view class="text-center">
  33. <image src="https://mxys.chuanghai-tech.com/wmfile/20250814/5d7863a9adcd45df89497a870f764f15.png" style="width: 65rpx;height: 55rpx;">
  34. </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="count" 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">提交</button>
  52. <!-- 用于图片压缩的canvas画布 -->
  53. <canvas
  54. :style="{
  55. width: cw + 'px',
  56. height: cw + 'px',
  57. position: 'absolute',
  58. zIndex: -1,
  59. left: '-10000rpx',
  60. top: '-10000rpx'
  61. }"
  62. canvas-id="zipCanvas"
  63. ></canvas>
  64. <!--画布结束-->
  65. </view>
  66. </template>
  67. <script>
  68. import configUrl from '../../common/config.js'
  69. import getLessLimitSizeImage from '@/utils/imageCompress.js'
  70. export default {
  71. data() {
  72. return {
  73. satisfactionFlag: 0,
  74. satisfactionFlagName: '满意',
  75. shopBanner: [],
  76. msgContents: ['满意', '不满意'],
  77. stars: [1, 2, 3, 4, 5],
  78. imageList: [],
  79. sendDate: {
  80. score: 5,
  81. content: '',
  82. contact: '',
  83. goodsId: '',
  84. ordersId: '',
  85. orderNumber: '',
  86. shopId: ''
  87. },
  88. count: 5,
  89. value: 5,
  90. goodsId: '',
  91. ordersId: '',
  92. orderNumber: '',
  93. indentNumber: '',
  94. //画板边长默认是屏幕宽度,正方形画布
  95. cw: uni.getSystemInfoSync().windowWidth
  96. }
  97. },
  98. onLoad(e) {
  99. this.indentNumber = e.indentNumber
  100. // this.sendDate.goodsId = e.goodsId
  101. // this.sendDate.ordersId = e.ordersId
  102. // this.sendDate.orderNumber = e.orderNumber
  103. // this.sendDate.shopId = e.shopId
  104. // let deviceInfo = {
  105. // appid: plus.runtime.appid,
  106. // imei: plus.device.imei, //设备标识
  107. // p: plus.os.name === 'Android' ? 'a' : 'i', //平台类型,i表示iOS平台,a表示Android平台。
  108. // md: plus.device.model, //设备型号
  109. // app_version: plus.runtime.version,
  110. // plus_version: plus.runtime.innerVersion, //基座版本号
  111. // os: plus.os.version,
  112. // net: '' + plus.networkinfo.getCurrentType()
  113. // };
  114. // this.sendDate = Object.assign(deviceInfo, this.sendDate);
  115. },
  116. methods: {
  117. // 图片上传
  118. addImages(e) {
  119. let that = this
  120. uni.chooseImage({
  121. count: 9,
  122. sourceType: ['album', 'camera'],
  123. success: (res) => {
  124. for (let i = 0; i < res.tempFiles.length; i++) {
  125. //这里的id和页面中写的html代码的canvas的id要一致
  126. let canvasId = 'zipCanvas'
  127. //原图的路径
  128. let imagePath = res.tempFiles[i].path
  129. //大小限制
  130. let limitSize = 1024 * 2
  131. //初始绘画区域是画布自身的宽度也就是屏幕宽度
  132. let drawWidth = uni.getSystemInfoSync().windowWidth
  133. let that = this
  134. getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
  135. uni.showLoading({
  136. title: '上传中'
  137. })
  138. uni.uploadFile({
  139. url: configUrl.APIHOST + '/alioss/upload',
  140. filePath: resPath,
  141. name: 'file',
  142. success: (uploadFileRes) => {
  143. if (that.shopBanner.length < 9) {
  144. if (JSON.parse(uploadFileRes.data).data) {
  145. that.shopBanner.push(JSON.parse(uploadFileRes.data).data)
  146. } else {
  147. uni.showToast({
  148. title: '图片上传失败,请重试',
  149. icon: 'none'
  150. })
  151. }
  152. }
  153. console.log(that.shopBanner)
  154. uni.hideLoading()
  155. },
  156. fail: () => {
  157. uni.showToast({
  158. title: '上传失败',
  159. icon: 'error'
  160. })
  161. }
  162. })
  163. })
  164. }
  165. }
  166. })
  167. },
  168. // 评价图删除
  169. removeImg(index) {
  170. this.shopBanner.splice(index, 1)
  171. },
  172. close(e) {
  173. this.imageList.splice(e, 1)
  174. },
  175. chooseMsg() {
  176. //快速输入
  177. uni.showActionSheet({
  178. itemList: this.msgContents,
  179. success: (res) => {
  180. console.log(res.tapIndex)
  181. this.satisfactionFlagName = this.msgContents[res.tapIndex]
  182. this.satisfactionFlag = res.tapIndex
  183. }
  184. })
  185. },
  186. chooseStar(e) {
  187. //点击评星
  188. this.sendDate.score = e
  189. },
  190. previewImage() {
  191. //预览图片
  192. uni.previewImage({
  193. urls: this.imageList
  194. })
  195. },
  196. send() {
  197. //发送反馈
  198. // console.log(this.sendDate,'111111111');
  199. // console.log(this.shopBanner.join(','),'22222222222222222')
  200. if (!this.satisfactionFlagName) {
  201. uni.showToast({
  202. icon: 'none',
  203. title: '请选择是否满意'
  204. })
  205. return
  206. }
  207. if (!this.sendDate.content) {
  208. uni.showToast({
  209. icon: 'none',
  210. title: '请输入评价内容'
  211. })
  212. return
  213. }
  214. // if(!this.shopBanner.length){
  215. // uni.showToast({
  216. // icon: 'none',
  217. // title: '请上传评价图'
  218. // });
  219. // return;
  220. // }
  221. this.$queue.showLoading('加载中...')
  222. // console.log(this.orderNumber)
  223. this.$Request
  224. .postJson('/app/apperrandevaluate/userEvaluate', {
  225. indentNumber: this.indentNumber,
  226. evaluateMessage: this.sendDate.content,
  227. satisfactionFlag: this.satisfactionFlag
  228. })
  229. .then((res) => {
  230. if (res.code === 0) {
  231. uni.showToast({
  232. title: '评价成功'
  233. })
  234. setTimeout(function () {
  235. uni.navigateBack()
  236. }, 1000)
  237. } else {
  238. uni.hideLoading()
  239. uni.showModal({
  240. showCancel: false,
  241. title: '评价失败',
  242. content: res.msg
  243. })
  244. }
  245. })
  246. }
  247. }
  248. }
  249. </script>
  250. <style>
  251. @font-face {
  252. font-family: uniicons;
  253. font-weight: normal;
  254. font-style: normal;
  255. src: url('https://img-cdn-qiniu.dcloud.net.cn/fonts/uni.ttf') format('truetype');
  256. }
  257. page {
  258. background-color: #ffffff;
  259. }
  260. view {
  261. font-size: 28upx;
  262. }
  263. .input-view {
  264. font-size: 28upx;
  265. }
  266. .close-view {
  267. text-align: center;
  268. line-height: 14px;
  269. height: 16px;
  270. width: 16px;
  271. border-radius: 50%;
  272. background: #ff5053;
  273. color: #ffffff;
  274. position: absolute;
  275. top: -6px;
  276. right: -4px;
  277. font-size: 12px;
  278. }
  279. /* 上传 */
  280. .uni-uploader {
  281. flex: 1;
  282. flex-direction: column;
  283. }
  284. .uni-uploader-head {
  285. display: flex;
  286. flex-direction: row;
  287. justify-content: space-between;
  288. }
  289. .uni-uploader-info {
  290. color: #b2b2b2;
  291. }
  292. .uni-uploader-body {
  293. margin-top: 16upx;
  294. }
  295. .uni-uploader__files {
  296. display: flex;
  297. flex-direction: row;
  298. flex-wrap: wrap;
  299. }
  300. .uni-uploader__file {
  301. margin: 10upx;
  302. width: 210upx;
  303. height: 210upx;
  304. }
  305. .uni-uploader__img {
  306. display: block;
  307. width: 210upx;
  308. height: 210upx;
  309. }
  310. .uni-uploader__input-box {
  311. position: relative;
  312. margin: 10upx;
  313. width: 208upx;
  314. height: 208upx;
  315. border: 2upx solid #d9d9d9;
  316. }
  317. .uni-uploader__input-box:before,
  318. .uni-uploader__input-box:after {
  319. content: ' ';
  320. position: absolute;
  321. top: 50%;
  322. left: 50%;
  323. -webkit-transform: translate(-50%, -50%);
  324. transform: translate(-50%, -50%);
  325. background-color: #d9d9d9;
  326. }
  327. .uni-uploader__input-box:before {
  328. width: 4upx;
  329. height: 79upx;
  330. }
  331. .uni-uploader__input-box:after {
  332. width: 79upx;
  333. height: 4upx;
  334. }
  335. .uni-uploader__input-box:active {
  336. border-color: #999999;
  337. }
  338. .uni-uploader__input-box:active:before,
  339. .uni-uploader__input-box:active:after {
  340. background-color: #999999;
  341. }
  342. .uni-uploader__input {
  343. position: absolute;
  344. z-index: 1;
  345. top: 0;
  346. left: 0;
  347. width: 100%;
  348. height: 100%;
  349. opacity: 0;
  350. }
  351. /*问题反馈*/
  352. .feedback-title {
  353. display: flex;
  354. flex-direction: row;
  355. justify-content: space-between;
  356. align-items: center;
  357. padding: 20upx;
  358. color: #333333;
  359. font-size: 28upx;
  360. }
  361. .feedback-star-view.feedback-title {
  362. justify-content: flex-start;
  363. margin: 0;
  364. }
  365. .feedback-quick {
  366. position: relative;
  367. padding-right: 40upx;
  368. }
  369. .feedback-quick:after {
  370. font-family: uniicons;
  371. font-size: 40upx;
  372. content: '\e581';
  373. position: absolute;
  374. right: 0;
  375. top: 50%;
  376. color: #bbb;
  377. -webkit-transform: translateY(-50%);
  378. transform: translateY(-50%);
  379. }
  380. .feedback-body {
  381. font-size: 32upx;
  382. padding: 16upx;
  383. margin: 16upx;
  384. border-radius: 16upx;
  385. background: #f2f2f2;
  386. color: #fff;
  387. }
  388. .feedback-textare {
  389. height: 200upx;
  390. font-size: 30upx;
  391. line-height: 50upx;
  392. width: 100%;
  393. box-sizing: border-box;
  394. padding: 10upx 0upx 0;
  395. color: #8f8f94;
  396. }
  397. .feedback-input {
  398. font-size: 32upx;
  399. height: 60upx;
  400. padding: 15upx 20upx;
  401. line-height: 60upx;
  402. }
  403. .feedback-uploader {
  404. padding: 22upx 20upx;
  405. }
  406. .feedback-star {
  407. font-family: uniicons;
  408. font-size: 40upx;
  409. margin-left: 6upx;
  410. }
  411. .feedback-star-view {
  412. margin-left: 20upx;
  413. }
  414. .feedback-star:after {
  415. content: '\e408';
  416. }
  417. .feedback-star.active {
  418. color: #ffb400;
  419. }
  420. .feedback-star.active:after {
  421. content: '\e438';
  422. }
  423. .feedback-submit {
  424. background: #007aff;
  425. color: #ffffff;
  426. margin: 20upx;
  427. }
  428. </style>