feedbacks.vue 10 KB

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