evaluate.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  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="16" :margin="5"
  10. @change="zhiliang" />
  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="16" :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="16" :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="16" :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. huanjing(e) {
  155. console.log(e)
  156. this.huanjingStar = e.value
  157. },
  158. feedDone(e) {
  159. this.exeContent = e.target.value
  160. },
  161. previewImage(index, arr) {
  162. // 预览图片
  163. uni.previewImage({
  164. urls: arr,
  165. current: index,
  166. longPressActions: {
  167. itemList: ['发送给朋友', '保存图片', '收藏'],
  168. success: function(data) {
  169. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  170. },
  171. fail: function(err) {
  172. console.log(err.errMsg);
  173. }
  174. }
  175. });
  176. },
  177. uploadImg() {
  178. var that = this;
  179. var num=9;
  180. var length=this.imgArr.length;
  181. if(length==9){
  182. uni.showToast({
  183. title: '最多上传9张图片',
  184. icon: 'none',
  185. duration: 2000,
  186. });
  187. return false;
  188. }
  189. uni.chooseImage({
  190. sourceType: ['album','camera'],
  191. count:num-length,
  192. success: (chooseImageRes) => {
  193. const tempFilePaths = chooseImageRes.tempFilePaths;
  194. /* uni.uploadFile({
  195. url: that.$request.baseUrl+'accompany/SuperCheckSheet/uploadFile', //仅为示例,非真实的接口地址
  196. filePath: tempFilePaths[0],
  197. name: 'file',
  198. formData: {
  199. 'user': 'test'
  200. },
  201. success: (uploadFileRes) => {
  202. console.log(JSON.parse(uploadFileRes.data).data );
  203. that.imgArr=that.imgArr.concat(JSON.parse(uploadFileRes.data).data) ;
  204. }
  205. }); */
  206. tempFilePaths.forEach(v => {
  207. console.log(that.$request.baseUrl + 'tuhuUploadFile');
  208. uni.uploadFile({
  209. url: that.$request.baseUrl + 'tuhuUploadFile',
  210. filePath: v,
  211. name: 'file',
  212. formData: {
  213. 'user': 'test'
  214. },
  215. success: (uploadFileRes) => {
  216. console.log(JSON.parse(uploadFileRes.data).data);
  217. that.imgArr = that.imgArr.concat(JSON.parse(
  218. uploadFileRes.data).data);
  219. }
  220. });
  221. })
  222. /* that.$http('accompany/SuperCheckSheet/uploadFile', tempFilePaths[0], 'POST').then(res => {
  223. }) */
  224. }
  225. });
  226. },
  227. delimg(index) {
  228. this.imgArr.splice(index, 1)
  229. },
  230. submit() {
  231. uni.showLoading({});
  232. var exeImg = this.imgArr.join(',')
  233. this.$http('worldKeepCar/keepCarMy/addTMEvaluate', {
  234. shopID:this.shopID,
  235. sheetID:this.sheetID,
  236. overallevaluation:this.grade,
  237. serviceevaluation:this.taiduStar,
  238. constructionevaluation:this.zhiliangStar,
  239. storeevaluation:this.huanjingStar,
  240. eContent: this.exeContent,
  241. imgs: exeImg
  242. }, 'POST').then(res => {
  243. //this.submitSuperCheckSheet()
  244. uni.showToast({
  245. title: '提交成功',
  246. icon: 'none',
  247. duration: 2000,
  248. });
  249. let pages = getCurrentPages(); // 当前页面
  250. let beforePage = pages[pages.length - 2]; // 上一页
  251. setTimeout(function() {
  252. uni.navigateBack({
  253. /* success: function() {
  254. beforePage.onLoad(); // 执行上一页的onLoad方法
  255. } */
  256. });
  257. }, 2000);
  258. })
  259. }
  260. }
  261. }
  262. </script>
  263. <style scoped>
  264. .box {
  265. min-height: 100vh;
  266. background: #F4F5F7;
  267. }
  268. .main {
  269. padding: 20rpx 24rpx;
  270. margin-bottom: 120rpx;
  271. }
  272. .population {
  273. margin-top: 20rpx;
  274. background: #FFFFFF;
  275. padding: 30rpx 20rpx;
  276. border-radius: 10rpx;
  277. }
  278. .title {
  279. font-size: 30rpx;
  280. font-weight: 600;
  281. color: #333333;
  282. }
  283. .populationImg {
  284. width: 32rpx;
  285. height: 32rpx;
  286. }
  287. .populationCont {
  288. display: flex;
  289. padding-top: 30rpx;
  290. }
  291. .populationLine {
  292. display: flex;
  293. line-height: 32rpx;
  294. font-size: 28rpx;
  295. color: #999999;
  296. width: 200rpx;
  297. }
  298. .populationTxt {
  299. padding-left: 12rpx;
  300. }
  301. .orangeColor {
  302. color: #FF4F00;
  303. }
  304. .rowView {
  305. padding: 30rpx 0rpx 0rpx;
  306. display: flex;
  307. justify-content: space-between;
  308. }
  309. .littleTitle {
  310. font-size: 28rpx;
  311. color: #666666;
  312. line-height: 32rpx;
  313. }
  314. .xxBox {
  315. display: flex;
  316. justify-content: flex-start;
  317. }
  318. .td {
  319. width: 80rpx;
  320. font-size: 24rpx;
  321. margin-left: 10rpx;
  322. }
  323. .firstView,
  324. .secondView {
  325. background-color: #FFFFFF;
  326. border-radius: 10rpx;
  327. }
  328. .firstView {
  329. margin-bottom: 20rpx;
  330. }
  331. .textareaCont {
  332. padding: 20rpx 0rpx;
  333. min-height: 150rpx;
  334. width: 95%;
  335. font-size: 28rpx;
  336. }
  337. .imgBox {
  338. display: flex;
  339. flex-wrap: wrap;
  340. padding: 20rpx 0rpx;
  341. }
  342. .imgLine {
  343. position: relative;
  344. margin-right: 10rpx;
  345. }
  346. .itemImg {
  347. width: 150rpx;
  348. height: 150rpx;
  349. margin-right: 5rpx;
  350. }
  351. /* .img4 {
  352. margin-right: 20rpx;
  353. } */
  354. .delImg {
  355. width: 32rpx;
  356. height: 32rpx;
  357. position: absolute;
  358. right: 0rpx;
  359. top: 0rpx;
  360. }
  361. .bottom {
  362. width: 750rpx;
  363. height: 120rpx;
  364. background: #FFFFFF;
  365. box-shadow: 0px -4px 8px 0px rgba(153, 153, 153, 0.08);
  366. position: fixed;
  367. left: 0;
  368. bottom: 0;
  369. display: flex;
  370. justify-content: space-around;
  371. }
  372. .shoreDz {
  373. width: 702rpx;
  374. height: 74rpx;
  375. background: linear-gradient(124deg, #FF8700 0%, #FF4F00 100%);
  376. border-radius: 37rpx;
  377. text-align: center;
  378. line-height: 74rpx;
  379. color: #FFFFFF;
  380. font-size: 30rpx;
  381. margin-top: 24rpx;
  382. }
  383. .populationCont2{
  384. display: flex;
  385. justify-content: space-between;
  386. }
  387. </style>