feedback.vue 10 KB

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