feedbacks.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  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. let token = uni.getStorageSync('token')
  135. getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
  136. uni.showLoading({
  137. title: '上传中'
  138. })
  139. uni.uploadFile({
  140. url: configUrl.APIHOST + '/app/new-file/upload',
  141. filePath: resPath,
  142. header: {
  143. token: token
  144. },
  145. name: 'file',
  146. success: (uploadFileRes) => {
  147. if (that.shopBanner.length < 9) {
  148. if (JSON.parse(uploadFileRes.data).data) {
  149. that.shopBanner.push(JSON.parse(uploadFileRes.data).data)
  150. } else {
  151. uni.showToast({
  152. title: '图片上传失败,请重试',
  153. icon: 'none'
  154. })
  155. }
  156. }
  157. console.log(that.shopBanner)
  158. uni.hideLoading()
  159. },
  160. fail: () => {
  161. uni.showToast({
  162. title: '上传失败',
  163. icon: 'error'
  164. })
  165. }
  166. })
  167. })
  168. }
  169. }
  170. })
  171. },
  172. // 评价图删除
  173. removeImg(index) {
  174. this.shopBanner.splice(index, 1)
  175. },
  176. close(e) {
  177. this.imageList.splice(e, 1)
  178. },
  179. chooseMsg() {
  180. //快速输入
  181. uni.showActionSheet({
  182. itemList: this.msgContents,
  183. success: (res) => {
  184. console.log(res.tapIndex)
  185. this.satisfactionFlagName = this.msgContents[res.tapIndex]
  186. this.satisfactionFlag = res.tapIndex
  187. }
  188. })
  189. },
  190. chooseStar(e) {
  191. //点击评星
  192. this.sendDate.score = e
  193. },
  194. previewImage() {
  195. //预览图片
  196. uni.previewImage({
  197. urls: this.imageList
  198. })
  199. },
  200. send() {
  201. //发送反馈
  202. // console.log(this.sendDate,'111111111');
  203. // console.log(this.shopBanner.join(','),'22222222222222222')
  204. if (!this.satisfactionFlagName) {
  205. uni.showToast({
  206. icon: 'none',
  207. title: '请选择是否满意'
  208. })
  209. return
  210. }
  211. if (!this.sendDate.content) {
  212. uni.showToast({
  213. icon: 'none',
  214. title: '请输入评价内容'
  215. })
  216. return
  217. }
  218. // if(!this.shopBanner.length){
  219. // uni.showToast({
  220. // icon: 'none',
  221. // title: '请上传评价图'
  222. // });
  223. // return;
  224. // }
  225. this.$queue.showLoading('加载中...')
  226. // console.log(this.orderNumber)
  227. this.$Request
  228. .postJson('/app/apperrandevaluate/userEvaluate', {
  229. indentNumber: this.indentNumber,
  230. evaluateMessage: this.sendDate.content,
  231. satisfactionFlag: this.satisfactionFlag
  232. })
  233. .then((res) => {
  234. if (res.code === 0) {
  235. uni.showToast({
  236. title: '评价成功'
  237. })
  238. setTimeout(function () {
  239. uni.navigateBack()
  240. }, 1000)
  241. } else {
  242. uni.hideLoading()
  243. uni.showModal({
  244. showCancel: false,
  245. title: '评价失败',
  246. content: res.msg
  247. })
  248. }
  249. })
  250. }
  251. }
  252. }
  253. </script>
  254. <style>
  255. @font-face {
  256. font-family: uniicons;
  257. font-weight: normal;
  258. font-style: normal;
  259. src: url('https://img-cdn-qiniu.dcloud.net.cn/fonts/uni.ttf') format('truetype');
  260. }
  261. page {
  262. background-color: #ffffff;
  263. }
  264. view {
  265. font-size: 28upx;
  266. }
  267. .input-view {
  268. font-size: 28upx;
  269. }
  270. .close-view {
  271. text-align: center;
  272. line-height: 14px;
  273. height: 16px;
  274. width: 16px;
  275. border-radius: 50%;
  276. background: #ff5053;
  277. color: #ffffff;
  278. position: absolute;
  279. top: -6px;
  280. right: -4px;
  281. font-size: 12px;
  282. }
  283. /* 上传 */
  284. .uni-uploader {
  285. flex: 1;
  286. flex-direction: column;
  287. }
  288. .uni-uploader-head {
  289. display: flex;
  290. flex-direction: row;
  291. justify-content: space-between;
  292. }
  293. .uni-uploader-info {
  294. color: #b2b2b2;
  295. }
  296. .uni-uploader-body {
  297. margin-top: 16upx;
  298. }
  299. .uni-uploader__files {
  300. display: flex;
  301. flex-direction: row;
  302. flex-wrap: wrap;
  303. }
  304. .uni-uploader__file {
  305. margin: 10upx;
  306. width: 210upx;
  307. height: 210upx;
  308. }
  309. .uni-uploader__img {
  310. display: block;
  311. width: 210upx;
  312. height: 210upx;
  313. }
  314. .uni-uploader__input-box {
  315. position: relative;
  316. margin: 10upx;
  317. width: 208upx;
  318. height: 208upx;
  319. border: 2upx solid #d9d9d9;
  320. }
  321. .uni-uploader__input-box:before,
  322. .uni-uploader__input-box:after {
  323. content: ' ';
  324. position: absolute;
  325. top: 50%;
  326. left: 50%;
  327. -webkit-transform: translate(-50%, -50%);
  328. transform: translate(-50%, -50%);
  329. background-color: #d9d9d9;
  330. }
  331. .uni-uploader__input-box:before {
  332. width: 4upx;
  333. height: 79upx;
  334. }
  335. .uni-uploader__input-box:after {
  336. width: 79upx;
  337. height: 4upx;
  338. }
  339. .uni-uploader__input-box:active {
  340. border-color: #999999;
  341. }
  342. .uni-uploader__input-box:active:before,
  343. .uni-uploader__input-box:active:after {
  344. background-color: #999999;
  345. }
  346. .uni-uploader__input {
  347. position: absolute;
  348. z-index: 1;
  349. top: 0;
  350. left: 0;
  351. width: 100%;
  352. height: 100%;
  353. opacity: 0;
  354. }
  355. /*问题反馈*/
  356. .feedback-title {
  357. display: flex;
  358. flex-direction: row;
  359. justify-content: space-between;
  360. align-items: center;
  361. padding: 20upx;
  362. color: #333333;
  363. font-size: 28upx;
  364. }
  365. .feedback-star-view.feedback-title {
  366. justify-content: flex-start;
  367. margin: 0;
  368. }
  369. .feedback-quick {
  370. position: relative;
  371. padding-right: 40upx;
  372. }
  373. .feedback-quick:after {
  374. font-family: uniicons;
  375. font-size: 40upx;
  376. content: '\e581';
  377. position: absolute;
  378. right: 0;
  379. top: 50%;
  380. color: #bbb;
  381. -webkit-transform: translateY(-50%);
  382. transform: translateY(-50%);
  383. }
  384. .feedback-body {
  385. font-size: 32upx;
  386. padding: 16upx;
  387. margin: 16upx;
  388. border-radius: 16upx;
  389. background: #f2f2f2;
  390. color: #fff;
  391. }
  392. .feedback-textare {
  393. height: 200upx;
  394. font-size: 30upx;
  395. line-height: 50upx;
  396. width: 100%;
  397. box-sizing: border-box;
  398. padding: 10upx 0upx 0;
  399. color: #8f8f94;
  400. }
  401. .feedback-input {
  402. font-size: 32upx;
  403. height: 60upx;
  404. padding: 15upx 20upx;
  405. line-height: 60upx;
  406. }
  407. .feedback-uploader {
  408. padding: 22upx 20upx;
  409. }
  410. .feedback-star {
  411. font-family: uniicons;
  412. font-size: 40upx;
  413. margin-left: 6upx;
  414. }
  415. .feedback-star-view {
  416. margin-left: 20upx;
  417. }
  418. .feedback-star:after {
  419. content: '\e408';
  420. }
  421. .feedback-star.active {
  422. color: #ffb400;
  423. }
  424. .feedback-star.active:after {
  425. content: '\e438';
  426. }
  427. .feedback-submit {
  428. background: #007aff;
  429. color: #ffffff;
  430. margin: 20upx;
  431. }
  432. </style>