index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <template>
  2. <view class="serveEva">
  3. <view class="card">
  4. <view class="title">
  5. 服务态度
  6. </view>
  7. <view class="star">
  8. <view v-for="(subItem, indexs) in starList" :key="indexs" @click="changemanner(indexs)">
  9. <image :src="manner==indexs+0.5?subItem.half:(indexs+1)<=manner?subItem.stary:subItem.starsg"
  10. alt="">
  11. </view>
  12. </view>
  13. </view>
  14. <view class="card">
  15. <view class="title">
  16. 服务质量
  17. </view>
  18. <view class="star">
  19. <view v-for="(subItem, indexs) in starList" :key="indexs" @click="changequality(indexs)">
  20. <image :src="quality==indexs+0.5?subItem.half:(indexs+1)<=quality?subItem.stary:subItem.starsg"
  21. alt="">
  22. </view>
  23. </view>
  24. </view>
  25. <view class="body">
  26. <view class="card">
  27. <view class="title">
  28. 综合服务
  29. </view>
  30. <view class="star">
  31. <view v-for="(subItem, indexs) in starList" :key="indexs" @click="changezonghe(indexs)">
  32. <image :src="zonghe==indexs+0.5?subItem.half:(indexs+1)<=zonghe?subItem.stary:subItem.starsg"
  33. alt="">
  34. </view>
  35. </view>
  36. </view>
  37. <view class="content">
  38. <!-- 描述详情 -->
  39. <textarea class="textarea" placeholder="请输入车辆遇到的问题/状况描述" v-model="content"
  40. placeholder-class="classTextarea" maxlength="-1"></textarea>
  41. <!-- 上传图片 -->
  42. <view class="uploadFile">
  43. <view class="uploadView" v-for="(item, index) in uploadFileList" :key="index">
  44. <image @click="del(index)" class="uploadDelete"
  45. :src="require('../../../../static/uploadDelete.png')" alt="">
  46. <image class="uploadImg" :src="item" alt="">
  47. </view>
  48. <view class="uploadView">
  49. <image @click="upload" class="uploadImg" :src="require('../../../../static/upload-pic.png')"
  50. alt="">
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="buttomBtn" @click="evaluateAdd">
  56. 立即评价
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import {
  62. orderEvaluate
  63. } from "@/api/maintain.js"
  64. export default {
  65. components: {},
  66. data: function() {
  67. return {
  68. clickName: false,
  69. manner: 0,
  70. quality: 0,
  71. zonghe: 0,
  72. content: "",
  73. starList: [{
  74. starsg: require('../../../../static/star-s-g.png'),
  75. half: require('../../../../static/half.png'),
  76. stary: require('../../../../static/star-y.png'),
  77. },
  78. {
  79. starsg: require('../../../../static/star-s-g.png'),
  80. half: require('../../../../static/half.png'),
  81. stary: require('../../../../static/star-y.png'),
  82. },
  83. {
  84. starsg: require('../../../../static/star-s-g.png'),
  85. half: require('../../../../static/half.png'),
  86. stary: require('../../../../static/star-y.png'),
  87. },
  88. {
  89. starsg: require('../../../../static/star-s-g.png'),
  90. half: require('../../../../static/half.png'),
  91. stary: require('../../../../static/star-y.png'),
  92. },
  93. {
  94. starsg: require('../../../../static/star-s-g.png'),
  95. half: require('../../../../static/half.png'),
  96. stary: require('../../../../static/star-y.png'),
  97. }
  98. ],
  99. uploadFileList: [],
  100. type: 0,
  101. detailId: "",
  102. imgContent: ""
  103. }
  104. },
  105. onLoad(options) {
  106. this.type = options.type;
  107. this.detailId = options.detailId;
  108. },
  109. methods: {
  110. evaluateAdd() {
  111. if (!this.clickName) {
  112. // 第一次点击
  113. let data = {
  114. type: this.type,
  115. detailId: this.detailId,
  116. serviceScore: this.manner,
  117. satisfiedScore: this.quality,
  118. sumScore: this.zonghe,
  119. content: this.content,
  120. imgContent: this.imgContent
  121. }
  122. orderEvaluate(data).then((res) => {
  123. if (res.code == "00000") {
  124. if (this.type == 1) {
  125. uni.$emit('maintainEvaluateOver', {
  126. data: "评价完成"
  127. })
  128. }
  129. uni.navigateBack({
  130. delta: 1
  131. })
  132. }
  133. })
  134. this.clickName = true;
  135. } else {
  136. console.log(this.clickName);
  137. }
  138. },
  139. changemanner(index) {
  140. if (this.manner == index + 0.5) {
  141. this.manner = index + 1;
  142. } else if (this.manner >= index + 1) {
  143. this.manner = index
  144. } else if (this.manner == index + 1) {
  145. this.manner--
  146. } else {
  147. this.manner = index + 0.5;
  148. }
  149. },
  150. changequality(index) {
  151. if (this.quality == index + 0.5) {
  152. this.quality = index + 1;
  153. } else if (this.quality >= index + 1) {
  154. this.quality = index
  155. } else if (this.quality == index + 1) {
  156. this.quality--
  157. } else {
  158. this.quality = index + 0.5;
  159. }
  160. },
  161. changezonghe(index) {
  162. if (this.zonghe == index + 0.5) {
  163. this.zonghe = index + 1;
  164. } else if (this.zonghe >= index + 1) {
  165. this.zonghe = index
  166. } else if (this.zonghe == index + 1) {
  167. this.zonghe--
  168. } else {
  169. this.zonghe = index + 0.5;
  170. }
  171. },
  172. // 删除图片
  173. del(index) {
  174. this.uploadFileList.splice(index, 1);
  175. console.log(this.uploadFileList);
  176. },
  177. upload() {
  178. let that = this;
  179. uni.chooseImage({
  180. count: 9, //默认9
  181. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  182. sourceType: ['album'], //从相册选择
  183. loop: true,
  184. success: res => {
  185. console.log(res);
  186. if (res.tempFilePaths.length != 0) {
  187. this.uploadFileList.push(res.tempFilePaths[0]);
  188. }
  189. console.log(JSON.stringify(res.tempFilePaths));
  190. var tempFilePaths = res.tempFilePaths;
  191. var tempFiles = res.tempFiles;
  192. console.log(tempFilePaths);
  193. console.log(tempFilePaths[0]);
  194. uni.uploadFile({
  195. url: 'https://api.biaodianfuhao.net/api/common/sysFileInfo/upload',
  196. fileType: 'image',
  197. filePath: tempFilePaths[0],
  198. file: tempFiles[0],
  199. name: 'file',
  200. success: uploadFileRes => {
  201. console.log('上传图片', JSON.parse(uploadFileRes.data));
  202. if (that.imgContent == "") {
  203. that.imgContent = JSON.parse(uploadFileRes.data).data
  204. }
  205. that.imgContent = that.imgContent + "," + JSON.parse(uploadFileRes
  206. .data).data
  207. },
  208. fail(err) {
  209. console.log(err);
  210. }
  211. });
  212. }
  213. });
  214. },
  215. }
  216. }
  217. </script>
  218. <style lang="less">
  219. page {
  220. background: #F5F5F5;
  221. }
  222. .buttomBtn {
  223. width: 690rpx;
  224. height: 90rpx;
  225. background: linear-gradient(0deg, #008EFF 0%, #0036FF 100%);
  226. border-radius: 45rpx;
  227. margin-left: 30rpx;
  228. text-align: center;
  229. font-size: 32rpx;
  230. font-family: PingFang SC;
  231. font-weight: 500;
  232. color: #FFFFFF;
  233. line-height: 90rpx;
  234. margin-top: 282rpx;
  235. }
  236. .body {
  237. margin-top: 20rpx;
  238. background: #FFFFFF;
  239. padding-bottom: 30rpx;
  240. .content {
  241. height: 404rpx;
  242. background: #F7F7F7;
  243. border-radius: 10rpx;
  244. margin: 6rpx 30rpx 30rpx 30rpx;
  245. .textarea {
  246. height: 150rpx;
  247. font-size: 26rpx;
  248. font-family: PingFang SC;
  249. font-weight: 500;
  250. color: #333333;
  251. line-height: 34rpx;
  252. padding-left: 20rpx;
  253. padding-top: 40rpx;
  254. }
  255. }
  256. .uploadFile {
  257. width: 665rpx;
  258. height: 146rpx;
  259. display: flex;
  260. overflow-x: auto;
  261. margin-left: 20rpx;
  262. .uploadView {
  263. position: relative;
  264. .uploadImg {
  265. width: 146rpx;
  266. height: 146rpx;
  267. background: #FFFFFF;
  268. border-radius: 8px;
  269. margin-right: 17rpx;
  270. margin-bottom: 21rpx;
  271. }
  272. .uploadDelete {
  273. width: 26rpx;
  274. height: 26rpx;
  275. border-radius: 0 8px 0 0;
  276. position: absolute;
  277. top: 0;
  278. right: 17rpx;
  279. z-index: 9;
  280. }
  281. }
  282. }
  283. }
  284. .classTextarea {
  285. font-size: 26rpx;
  286. font-family: PingFang SC;
  287. font-weight: 500;
  288. color: #BFBFBF;
  289. line-height: 34rpx;
  290. }
  291. .serveEva {
  292. .card {
  293. background: #FFFFFF;
  294. height: 100rpx;
  295. display: flex;
  296. align-items: center;
  297. justify-content: space-between;
  298. padding: 0 31rpx 0 31rpx;
  299. .title {
  300. font-size: 28rpx;
  301. font-family: PingFang SC;
  302. font-weight: 500;
  303. color: #333333;
  304. line-height: 34rpx;
  305. }
  306. .star {
  307. display: flex;
  308. margin-top: 12rpx;
  309. image {
  310. width: 22rpx;
  311. height: 22rpx;
  312. }
  313. }
  314. }
  315. }
  316. </style>