appraise.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. <template>
  2. <view class="box">
  3. <view class="main">
  4. <!-- 总体评价-->
  5. <view class="population populationCont2">
  6. <view class="title">总体评价</view>
  7. <view class=" " style="padding-left: 30rpx;">
  8. <view class="xxBox">
  9. <uni-rate v-model="grade" :max="5" color="#EEEEEE" active-color="#FF0000" :size="20" :margin="5"
  10. @change="gradeCl" />
  11. <view class="td orangeColor" v-if="grade==5">非常好</view>
  12. <view class="td orangeColor" v-if="grade==4">很好</view>
  13. <view class="td orangeColor" v-if="grade==3">好</view>
  14. <view class="td orangeColor" v-if="grade==2">一般</view>
  15. <view class="td orangeColor" v-if="grade==1">差</view>
  16. </view>
  17. </view>
  18. </view>
  19. <!-- 商家服务评价-->
  20. <view class="population">
  21. <view class="title">商家服务评价</view>
  22. <view class="rowView">
  23. <view class="littleTitle">服务态度</view>
  24. <view class="xxBox">
  25. <uni-rate v-model="xx" :max="5" color="#EEEEEE" active-color="#FF4F00" :size="20" :margin="5"
  26. @change="taidu" />
  27. <view class="td orangeColor" v-if="taiduStar==5">非常好</view>
  28. <view class="td orangeColor" v-if="taiduStar==4">很好</view>
  29. <view class="td orangeColor" v-if="taiduStar==3">好</view>
  30. <view class="td orangeColor" v-if="taiduStar==2">一般</view>
  31. <view class="td orangeColor" v-if="taiduStar==1">差</view>
  32. </view>
  33. </view>
  34. <view class="rowView">
  35. <view class="littleTitle">施工质量</view>
  36. <view class="xxBox">
  37. <uni-rate v-model="yy" :max="5" color="#EEEEEE" active-color="#FF4F00" :size="20" :margin="5"
  38. @change="zhiliang" />
  39. <view class="td orangeColor" v-if="zhiliangStar==5">非常好</view>
  40. <view class="td orangeColor" v-if="zhiliangStar==4">很好</view>
  41. <view class="td orangeColor" v-if="zhiliangStar==3">好</view>
  42. <view class="td orangeColor" v-if="zhiliangStar==2">一般</view>
  43. <view class="td orangeColor" v-if="zhiliangStar==1">差</view>
  44. </view>
  45. </view>
  46. <view class="rowView">
  47. <view class="littleTitle">店面环境</view>
  48. <view class="xxBox">
  49. <uni-rate v-model="zz" :max="5" color="#EEEEEE" active-color="#FF4F00" :size="20" :margin="5"
  50. @change="huanjing" />
  51. <view class="td orangeColor" v-if="huanjingStar==5">非常好</view>
  52. <view class="td orangeColor" v-if="huanjingStar==4">很好</view>
  53. <view class="td orangeColor" v-if="huanjingStar==3">好</view>
  54. <view class="td orangeColor" v-if="huanjingStar==2">一般</view>
  55. <view class="td orangeColor" v-if="huanjingStar==1">差</view>
  56. </view>
  57. </view>
  58. </view>
  59. <!-- 评价内容 和图片 -->
  60. <view class="population">
  61. <!-- 建议 -->
  62. <view class="firstView">
  63. <view>
  64. <textarea placeholder-style="color:#999999" placeholder="说说哪里满意,帮大家选择~" v-model="exeContent"
  65. class="textareaCont" maxlength="-1" auto-height="true" @confirm="feedDone" />
  66. </view>
  67. </view>
  68. <!-- 图片 -->
  69. <view class="secondView">
  70. <view class="imgBox">
  71. <view class="imgLine" v-for="(img,imgindex) in imgArr">
  72. <image :class="{img4:(imgindex+1)%4==0}" :src="img" mode="" class="itemImg" @click="previewImage(imgindex,imgArr)"></image>
  73. <image src="../../static/img/icon_del_red.png" mode="" class="delImg"
  74. @click="delimg(imgindex)"></image>
  75. </view>
  76. <view class="imgLine" @click="uploadImg">
  77. <image src="../../static/img/btn_pic.png" mode="" class="itemImg"></image>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. <view class="bottom">
  83. <view class="shoreDz" @click="submit">发表评论</view>
  84. </view>
  85. </view>
  86. </view>
  87. </template>
  88. <script>
  89. export default {
  90. data() {
  91. return {
  92. grade: '5',
  93. xx: 5,
  94. yy: 5,
  95. zz: 5,
  96. taiduStar: 5,
  97. zhiliangStar: 5,
  98. huanjingStar: 5,
  99. imgArr: [],
  100. exeContent: '',
  101. shopID:'',
  102. sheetID:'',
  103. }
  104. },
  105. onLoad(opt) {
  106. console.log('opt++',opt);
  107. this.shopID = opt.shopID
  108. this.sheetID = opt.sheetID
  109. // uni.setStorage({
  110. // key: 'evaluate',
  111. // data: 1,
  112. // success: function () {
  113. // }
  114. // });
  115. },
  116. onShow() {
  117. },
  118. methods: {
  119. changeGrade(v) {
  120. console.log(v);
  121. this.grade = v
  122. },
  123. taidu(e) {
  124. console.log(e)
  125. this.taiduStar = e.value
  126. },
  127. zhiliang(e) {
  128. console.log(e)
  129. this.zhiliangStar = e.value
  130. },
  131. gradeCl(e) {
  132. console.log(e)
  133. this.grade = e.value
  134. },
  135. huanjing(e) {
  136. console.log(e)
  137. this.huanjingStar = e.value
  138. },
  139. feedDone(e) {
  140. this.exeContent = e.target.value
  141. },
  142. previewImage(index, arr) {
  143. // 预览图片
  144. uni.previewImage({
  145. urls: arr,
  146. current: index,
  147. longPressActions: {
  148. itemList: ['发送给朋友', '保存图片', '收藏'],
  149. success: function(data) {
  150. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  151. },
  152. fail: function(err) {
  153. console.log(err.errMsg);
  154. }
  155. }
  156. });
  157. },
  158. uploadImg() {
  159. var that = this;
  160. var num=9;
  161. var length=this.imgArr.length;
  162. if(length==9){
  163. uni.showToast({
  164. title: '最多上传9张图片',
  165. icon: 'none',
  166. duration: 2000,
  167. });
  168. return false;
  169. }
  170. uni.chooseImage({
  171. sourceType: ['album','camera'],
  172. count:num-length,
  173. success: (chooseImageRes) => {
  174. const tempFilePaths = chooseImageRes.tempFilePaths;
  175. /* uni.uploadFile({
  176. url: that.$request.baseUrl+'accompany/SuperCheckSheet/uploadFile', //仅为示例,非真实的接口地址
  177. filePath: tempFilePaths[0],
  178. name: 'file',
  179. formData: {
  180. 'user': 'test'
  181. },
  182. success: (uploadFileRes) => {
  183. console.log(JSON.parse(uploadFileRes.data).data );
  184. that.imgArr=that.imgArr.concat(JSON.parse(uploadFileRes.data).data) ;
  185. }
  186. }); */
  187. tempFilePaths.forEach(v => {
  188. console.log(that.$request.baseUrl + 'tuhuUploadFile');
  189. uni.uploadFile({
  190. url: that.$request.baseUrl + 'tuhuUploadFile',
  191. filePath: v,
  192. name: 'file',
  193. formData: {
  194. 'user': 'test'
  195. },
  196. success: (uploadFileRes) => {
  197. console.log(JSON.parse(uploadFileRes.data).data);
  198. that.imgArr = that.imgArr.concat(JSON.parse(
  199. uploadFileRes.data).data);
  200. }
  201. });
  202. })
  203. /* that.$http('accompany/SuperCheckSheet/uploadFile', tempFilePaths[0], 'POST').then(res => {
  204. }) */
  205. }
  206. });
  207. },
  208. delimg(index) {
  209. this.imgArr.splice(index, 1)
  210. },
  211. submit() {
  212. uni.showLoading({
  213. title: '保存中'
  214. })
  215. var exeImg = this.imgArr.join(',')
  216. this.$http('openMiniEvaluate/addOpenEvaluate', {
  217. shopID:this.shopID,
  218. sheetID:this.sheetID,
  219. overallEvaluation:this.grade,
  220. serviceEvaluation:this.taiduStar,
  221. constructionEvaluation:this.zhiliangStar,
  222. storeEvaluation:this.huanjingStar,
  223. eContent: this.exeContent,
  224. imgs: exeImg
  225. }, 'POST').then(res => {
  226. //this.submitSuperCheckSheet()
  227. uni.showToast({
  228. title: '提交成功',
  229. icon: 'none',
  230. duration: 2000,
  231. });
  232. let pages = getCurrentPages(); // 当前页面
  233. let beforePage = pages[pages.length - 2]; // 上一页
  234. setTimeout(function() {
  235. uni.navigateBack({
  236. success: function() {
  237. beforePage.onLoad(); // 执行上一页的onLoad方法
  238. }
  239. });
  240. }, 2000);
  241. })
  242. }
  243. }
  244. }
  245. </script>
  246. <style scoped>
  247. .box {
  248. min-height: 100vh;
  249. background: #F4F5F7;
  250. }
  251. .main {
  252. padding: 20rpx 24rpx;
  253. margin-bottom: 120rpx;
  254. }
  255. .population {
  256. margin-top: 20rpx;
  257. background: #FFFFFF;
  258. padding: 30rpx 20rpx;
  259. border-radius: 10rpx;
  260. }
  261. .title {
  262. font-size: 30rpx;
  263. font-weight: 600;
  264. color: #333333;
  265. }
  266. .populationImg {
  267. width: 32rpx;
  268. height: 32rpx;
  269. }
  270. .populationCont {
  271. display: flex;
  272. padding-top: 30rpx;
  273. }
  274. .populationLine {
  275. display: flex;
  276. line-height: 32rpx;
  277. font-size: 28rpx;
  278. color: #999999;
  279. width: 200rpx;
  280. }
  281. .populationTxt {
  282. padding-left: 12rpx;
  283. }
  284. .orangeColor {
  285. color: #FF0000;
  286. }
  287. .rowView {
  288. padding: 30rpx 0rpx 0rpx;
  289. display: flex;
  290. justify-content: space-between;
  291. }
  292. .littleTitle {
  293. font-size: 28rpx;
  294. color: #666666;
  295. line-height: 32rpx;
  296. }
  297. .xxBox {
  298. display: flex;
  299. justify-content: flex-start;
  300. }
  301. .td {
  302. width: 80rpx;
  303. font-size: 24rpx;
  304. margin-left: 10rpx;
  305. }
  306. .firstView,
  307. .secondView {
  308. background-color: #FFFFFF;
  309. border-radius: 10rpx;
  310. }
  311. .firstView {
  312. margin-bottom: 20rpx;
  313. }
  314. .textareaCont {
  315. padding: 20rpx 0rpx;
  316. min-height: 150rpx;
  317. width: 95%;
  318. font-size: 28rpx;
  319. }
  320. .imgBox {
  321. display: flex;
  322. flex-wrap: wrap;
  323. padding: 20rpx 0rpx;
  324. }
  325. .imgLine {
  326. position: relative;
  327. margin-right: 10rpx;
  328. }
  329. .itemImg {
  330. width: 150rpx;
  331. height: 150rpx;
  332. margin-right: 5rpx;
  333. }
  334. /* .img4 {
  335. margin-right: 20rpx;
  336. } */
  337. .delImg {
  338. width: 32rpx;
  339. height: 32rpx;
  340. position: absolute;
  341. right: 0rpx;
  342. top: 0rpx;
  343. }
  344. .bottom {
  345. width: 750rpx;
  346. height: 120rpx;
  347. background: #FFFFFF;
  348. box-shadow: 0px -4px 8px 0px rgba(153, 153, 153, 0.08);
  349. position: fixed;
  350. left: 0;
  351. bottom: 0;
  352. display: flex;
  353. justify-content: space-around;
  354. }
  355. .shoreDz {
  356. width: 702rpx;
  357. height: 74rpx;
  358. background: #D53533;
  359. border-radius: 37rpx;
  360. text-align: center;
  361. line-height: 74rpx;
  362. color: #FFFFFF;
  363. font-size: 30rpx;
  364. margin-top: 24rpx;
  365. }
  366. .populationCont2{
  367. display: flex;
  368. justify-content: space-between;
  369. }
  370. </style>