addEvaluation.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <view class="page_pingjia4">
  3. <view class="kuang">
  4. <view class="order-row flex flex-space-between">
  5. <view class="flex">
  6. <view>订单:{{objData.orderNo}}</view>
  7. <view>{{objData.goodName}}</view>
  8. </view>
  9. <view class="flex align-center">
  10. <image :src="objData.driverPortrait" mode="widthFix" class="tx-img"></image>
  11. <view>{{objData.driverName}}</view>
  12. </view>
  13. </view>
  14. <view class="xkuang">
  15. <view style="display: flex;" class="flex-space-between" v-for="(item,index) in rate"
  16. @click="clickStar(index)">
  17. <view class="flex" style="margin: 10rpx 0;">
  18. <view class="ziti">{{item.name}}</view>
  19. <start :count="item.count" style="" size="35" activeIcon="heart-fill" inactiveIcon="heart"
  20. activeColor="#ffaa00" v-model="item.value1" @change="getVal" :size="22">
  21. </start>
  22. </view>
  23. <view class="">
  24. {{item.level}}
  25. </view>
  26. </view>
  27. </view>
  28. <view>
  29. <u--textarea style="margin-top: 20px;" background-color="#6d6d6d" v-model="value3"
  30. placeholder="评价一下这单发运任务~">
  31. </u--textarea>
  32. </view>
  33. <u-upload class="uview-upload" :fileList="fileList1" @afterRead="afterRead($event)" @delete="deletePic"
  34. name="1" multiple :maxCount="9" style="margin-bottom: 80rpx;"></u-upload>
  35. <u-line></u-line>
  36. <view class="niming">
  37. <u-checkbox-group v-model="checkboxValue1" placement="column" @change="checkboxChange">
  38. <u-checkbox :customStyle="{marginBottom: '8px'}" v-for="(item, index) in checkboxList1" :key="index"
  39. :label="item.name" :name="item.name">
  40. </u-checkbox>
  41. </u-checkbox-group>
  42. </view>
  43. </view>
  44. <!-- <view class="anniu" v-for="(item,index) in button">
  45. <u-button type="warning">{{item.name}}</u-button>
  46. </view> -->
  47. <u-toast ref="uToast"></u-toast>
  48. </view>
  49. </template>
  50. <script>
  51. var that
  52. import {
  53. mapState
  54. } from 'vuex';
  55. import start from '../../common/components/uni-rate.vue'
  56. import uploadImage from '@/components/ossutil/uploadFile.js';
  57. export default {
  58. components: {
  59. start
  60. },
  61. computed: {
  62. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication'])
  63. },
  64. data() {
  65. return {
  66. imageList: [],
  67. objData: {},
  68. starIndex: '',
  69. checkboxValue1: [],
  70. checkboxList1: [{
  71. name: '匿名评论',
  72. disabled: false
  73. }],
  74. count: "5",
  75. value: '',
  76. value3: '',
  77. fileList1: [],
  78. por: [{
  79. title: '"无可挑剔"',
  80. }],
  81. rate: [{
  82. name: "司机信用",
  83. count: "5",
  84. value1: '0',
  85. level: ''
  86. },
  87. {
  88. name: "运输效率",
  89. count: "5",
  90. value1: '0',
  91. level: ''
  92. },
  93. {
  94. name: "运输安全",
  95. count: "5",
  96. value1: '0',
  97. level: ''
  98. },
  99. {
  100. name: "服务质量",
  101. count: "5",
  102. value1: '0',
  103. level: ''
  104. },
  105. {
  106. name: "满意度",
  107. count: "5",
  108. value1: '0',
  109. level: ''
  110. }
  111. ],
  112. button: [{
  113. name: '提交'
  114. }],
  115. hidden: [{
  116. name: '匿名评论',
  117. disabled: false
  118. }],
  119. }
  120. },
  121. onNavigationBarButtonTap() {
  122. // console.log(12121,uni.$u,this)
  123. // debugger
  124. uni.$u.throttle(this.submit, 500)
  125. // uni.$u.debounce(this.submit, 500)
  126. },
  127. onLoad(options) {
  128. that = this
  129. this.objData = JSON.parse(options.val)
  130. console.log(this.objData)
  131. that.imageList = []
  132. },
  133. methods: {
  134. submit(){
  135. // console.log(11111111)
  136. let _data = {
  137. evaluatoredId: this.objData.commonId,
  138. evaluatorId: this.objData.cargoCommonId,
  139. ownerName: this.checkboxValue1 ? this.objData.cargoOwner : '',
  140. driverName: this.objData.driverName,
  141. ownerPortrait: this.checkboxValue1 ? this.userInfo.avatarUrl : '',
  142. orderId: this.objData.id,
  143. orderNumber: this.objData.orderNo,
  144. driverCredit: this.rate[0].value1,
  145. tranEfficiency: this.rate[1].value1,
  146. tranSafety: this.rate[2].value1,
  147. serviceQuality: this.rate[3].value1,
  148. satisfaction: this.rate[4].value1,
  149. ownerContent: this.value3,
  150. ownerUrl: this.imageList.toString(),
  151. ownerAnonymous: this.checkboxValue1.length != 0 ? 1 : 0
  152. }
  153. that.$request.baseRequest('post', '/evaluateInfo/api/addEvaluateInfo', _data).then(res => {
  154. if (res.code == 200) {
  155. this.$refs.uToast.show({
  156. type: 'success',
  157. message: "评价成功",
  158. complete() {
  159. uni.navigateBack({
  160. delta:1
  161. })
  162. }
  163. })
  164. } else {
  165. this.$refs.uToast.show({
  166. type: 'error',
  167. message: "评价失败",
  168. })
  169. }
  170. })
  171. },
  172. clickStar(index) {
  173. console.log(index)
  174. this.selectStar = index
  175. if (index == 0 || index == 1 || index == 2 || index == 3) {
  176. if (this.starIndex == '1') {
  177. this.rate[index].level = '极差'
  178. } else if (this.starIndex == '2') {
  179. this.rate[index].level = '差'
  180. } else if (this.starIndex == '3') {
  181. this.rate[index].level = '一般'
  182. } else if (this.starIndex == '4') {
  183. this.rate[index].level = '较好'
  184. } else if (this.starIndex == '5') {
  185. this.rate[index].level = '非常好'
  186. }
  187. } else {
  188. if (this.starIndex == '1') {
  189. this.rate[index].level = '极不满意'
  190. } else if (this.starIndex == '2') {
  191. this.rate[index].level = '不满意'
  192. } else if (this.starIndex == '3') {
  193. this.rate[index].level = '尚可'
  194. } else if (this.starIndex == '4') {
  195. this.rate[index].level = '满意'
  196. } else if (this.starIndex == '5') {
  197. this.rate[index].level = '非常满意'
  198. }
  199. }
  200. },
  201. getVal(e) {
  202. // debugger
  203. this.starIndex = e.value
  204. console.log(e)
  205. },
  206. checkboxChange(n) {
  207. console.log('change', n);
  208. },
  209. // 删除图片
  210. deletePic(event) {
  211. this[`fileList${event.name}`].splice(event.index, 1)
  212. },
  213. // 新增图片
  214. async afterRead(event) {
  215. // console.log(this[`fileList${event.name}`])
  216. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  217. let lists = [].concat(event.file)
  218. let fileListLen = this[`fileList${event.name}`].length
  219. lists.map((item) => {
  220. this[`fileList${event.name}`].push({
  221. ...item,
  222. status: 'uploading',
  223. message: '上传中'
  224. })
  225. })
  226. for (let i = 0; i < lists.length; i++) {
  227. const result = await this.uploadFilePromise(lists[i], lists[i].url)
  228. // console.log(result)
  229. let item = this[`fileList${event.name}`][fileListLen]
  230. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  231. status: 'success',
  232. message: '',
  233. url: result
  234. }))
  235. fileListLen++
  236. }
  237. },
  238. uploadFilePromise(file, url) {
  239. uploadImage('image', url, 'appData/',
  240. result => {
  241. // 上传成功回调函数
  242. console.log('图片地址', result)
  243. that.imageList.push(result)
  244. // this.dataDetails.certificateAddressUrl=this.dataDetails.certificateAddressUrl +',' +result
  245. }
  246. )
  247. },
  248. // 删除图片
  249. deletePic(event) {
  250. this[`fileList${event.name}`].splice(event.index, 1)
  251. },
  252. }
  253. }
  254. </script>
  255. <style lang="scss">
  256. .page_pingjia4 {
  257. background-color: #ffffff;
  258. padding: 20rpx;
  259. .anniu {
  260. margin-top: 48px;
  261. margin-left: 20px;
  262. }
  263. .niming {
  264. margin-top: 20px;
  265. }
  266. .ziti {
  267. color: #909090;
  268. margin-right: 20rpx;
  269. width: 160rpx;
  270. }
  271. .xkuang {
  272. margin-top: 20px;
  273. }
  274. .xx {
  275. margin-left: 24%;
  276. padding-top: 10px;
  277. }
  278. .biaoti {
  279. width: 80%;
  280. margin: 0 auto;
  281. text-align: center;
  282. margin-top: 20px;
  283. }
  284. .kuang {
  285. background-color: #ffffff;
  286. }
  287. }
  288. .tx-img {
  289. width: 40rpx;
  290. margin-right: 20rpx;
  291. }
  292. </style>