evaluate.vue 11 KB

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