appraise.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  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="20"
  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="20"
  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="20"
  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="20"
  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.chooseMedia({
  171. mediaType: ['image'],
  172. sourceType: ['album','camera'],
  173. count:num-length,
  174. sizeType:['compressed'],
  175. camera: 'back',
  176. success: (chooseImageRes) => {
  177. console.log('图片',chooseImageRes);
  178. const tempFiles = chooseImageRes.tempFiles;
  179. tempFiles.forEach(v => {
  180. console.log(that.$request.baseUrl + 'tuhuUploadFile');
  181. uni.uploadFile({
  182. url: that.$request.baseUrl + 'tuhuUploadFile',
  183. filePath: v.tempFilePath,
  184. name: 'file',
  185. formData: {
  186. 'user': 'test'
  187. },
  188. success: (uploadFileRes) => {
  189. console.log(JSON.parse(uploadFileRes.data).data);
  190. that.imgArr = that.imgArr.concat(JSON.parse(
  191. uploadFileRes.data).data);
  192. }
  193. });
  194. })
  195. }
  196. });
  197. },
  198. delimg(index) {
  199. this.imgArr.splice(index, 1)
  200. },
  201. submit() {
  202. uni.showLoading({
  203. title: '保存中'
  204. })
  205. var exeImg = this.imgArr.join(',')
  206. this.$http('openMiniEvaluate/addOpenEvaluate', {
  207. shopID:this.shopID,
  208. sheetID:this.sheetID,
  209. overallEvaluation:this.grade,
  210. serviceEvaluation:this.taiduStar,
  211. constructionEvaluation:this.zhiliangStar,
  212. storeEvaluation:this.huanjingStar,
  213. eContent: this.exeContent,
  214. imgs: exeImg
  215. }, 'POST').then(res => {
  216. //this.submitSuperCheckSheet()
  217. uni.showToast({
  218. title: '提交成功',
  219. icon: 'none',
  220. duration: 2000,
  221. });
  222. let pages = getCurrentPages(); // 当前页面
  223. let beforePage = pages[pages.length - 2]; // 上一页
  224. setTimeout(function() {
  225. uni.navigateBack({
  226. success: function() {
  227. beforePage.onLoad(); // 执行上一页的onLoad方法
  228. }
  229. });
  230. }, 2000);
  231. })
  232. }
  233. }
  234. }
  235. </script>
  236. <style scoped>
  237. .box {
  238. min-height: 100vh;
  239. background: #F4F5F7;
  240. }
  241. .main {
  242. padding: 20rpx 24rpx;
  243. margin-bottom: 120rpx;
  244. }
  245. .population {
  246. margin-top: 20rpx;
  247. background: #FFFFFF;
  248. padding: 30rpx 20rpx;
  249. border-radius: 10rpx;
  250. }
  251. .title {
  252. font-size: 30rpx;
  253. font-weight: 600;
  254. color: #333333;
  255. }
  256. .populationImg {
  257. width: 32rpx;
  258. height: 32rpx;
  259. }
  260. .populationCont {
  261. display: flex;
  262. padding-top: 30rpx;
  263. }
  264. .populationLine {
  265. display: flex;
  266. line-height: 32rpx;
  267. font-size: 28rpx;
  268. color: #999999;
  269. width: 200rpx;
  270. }
  271. .populationTxt {
  272. padding-left: 12rpx;
  273. }
  274. .orangeColor {
  275. color: #FF0000;
  276. }
  277. .rowView {
  278. padding: 30rpx 0rpx 0rpx;
  279. display: flex;
  280. justify-content: space-between;
  281. }
  282. .littleTitle {
  283. font-size: 28rpx;
  284. color: #666666;
  285. line-height: 32rpx;
  286. }
  287. .xxBox {
  288. display: flex;
  289. justify-content: flex-start;
  290. }
  291. .td {
  292. width: 80rpx;
  293. font-size: 24rpx;
  294. margin-left: 10rpx;
  295. }
  296. .firstView,
  297. .secondView {
  298. background-color: #FFFFFF;
  299. border-radius: 10rpx;
  300. }
  301. .firstView {
  302. margin-bottom: 20rpx;
  303. }
  304. .textareaCont {
  305. padding: 20rpx 0rpx;
  306. min-height: 150rpx;
  307. width: 95%;
  308. font-size: 28rpx;
  309. }
  310. .imgBox {
  311. display: flex;
  312. flex-wrap: wrap;
  313. padding: 20rpx 0rpx;
  314. }
  315. .imgLine {
  316. position: relative;
  317. margin-right: 10rpx;
  318. }
  319. .itemImg {
  320. width: 150rpx;
  321. height: 150rpx;
  322. margin-right: 5rpx;
  323. }
  324. /* .img4 {
  325. margin-right: 20rpx;
  326. } */
  327. .delImg {
  328. width: 32rpx;
  329. height: 32rpx;
  330. position: absolute;
  331. right: 0rpx;
  332. top: 0rpx;
  333. }
  334. .bottom {
  335. width: 750rpx;
  336. height: 120rpx;
  337. background: #FFFFFF;
  338. box-shadow: 0px -4px 8px 0px rgba(153, 153, 153, 0.08);
  339. position: fixed;
  340. left: 0;
  341. bottom: 0;
  342. display: flex;
  343. justify-content: space-around;
  344. }
  345. .shoreDz {
  346. width: 702rpx;
  347. height: 74rpx;
  348. background: #D53533;
  349. border-radius: 37rpx;
  350. text-align: center;
  351. line-height: 74rpx;
  352. color: #FFFFFF;
  353. font-size: 30rpx;
  354. margin-top: 24rpx;
  355. }
  356. .populationCont2{
  357. display: flex;
  358. justify-content: space-between;
  359. }
  360. </style>