addEvaluation.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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: '5',
  85. level: '非常好'
  86. },
  87. {
  88. name: "运输效率",
  89. count: "5",
  90. value1: '5',
  91. level: '非常好'
  92. },
  93. {
  94. name: "运输安全",
  95. count: "5",
  96. value1: '5',
  97. level: '非常好'
  98. },
  99. {
  100. name: "运输安全",
  101. count: "5",
  102. value1: '5',
  103. level: '非常好'
  104. },
  105. {
  106. name: "满意度",
  107. count: "5",
  108. value1: '5',
  109. level: '非常满意'
  110. }
  111. ],
  112. button: [{
  113. name: '提交'
  114. }],
  115. hidden: [{
  116. name: '匿名评论',
  117. disabled: false
  118. }],
  119. }
  120. },
  121. onNavigationBarButtonTap() {
  122. debugger
  123. let _data = {
  124. evaluatoredId: this.objData.commonId,
  125. evaluatorId: this.objData.cargoCommonId,
  126. ownerName: this.checkboxValue1 ? this.objData.cargoOwner : '',
  127. driverName: this.objData.driverName,
  128. ownerPortrait: this.checkboxValue1 ? this.userInfo.avatarUrl : '',
  129. orderId: this.objData.id,
  130. orderNumber: this.objData.orderNo,
  131. driverCredit: this.rate[0].value1,
  132. tranEfficiency: this.rate[1].value1,
  133. tranSafety: this.rate[2].value1,
  134. serviceQuality: this.rate[3].value1,
  135. satisfaction: this.rate[4].value1,
  136. ownerContent: this.value3,
  137. ownerUrl: this.imageList.toString(),
  138. ownerAnonymous: this.checkboxValue1.length != 0 ? 1 : 0
  139. }
  140. that.$request.baseRequest('post', '/evaluateInfo/api/addEvaluateInfo', _data).then(res => {
  141. if (res.code == 200) {
  142. this.$refs.uToast.show({
  143. type: 'success',
  144. message: "评价成功",
  145. complete() {
  146. uni.navigateTo({
  147. url: '/pages/order/index'
  148. })
  149. }
  150. })
  151. } else {
  152. this.$refs.uToast.show({
  153. type: 'error',
  154. message: "评价失败",
  155. })
  156. }
  157. })
  158. },
  159. onLoad(options) {
  160. that = this
  161. this.objData = JSON.parse(options.val)
  162. console.log(this.objData)
  163. that.imageList = []
  164. },
  165. methods: {
  166. clickStar(index) {
  167. console.log(index)
  168. this.selectStar = index
  169. if (index == 0 || index == 1 || index == 2 || index == 3) {
  170. if (this.starIndex == '1') {
  171. this.rate[index].level = '极差'
  172. } else if (this.starIndex == '2') {
  173. this.rate[index].level = '差'
  174. } else if (this.starIndex == '3') {
  175. this.rate[index].level = '一般'
  176. } else if (this.starIndex == '4') {
  177. this.rate[index].level = '较好'
  178. } else if (this.starIndex == '5') {
  179. this.rate[index].level = '非常好'
  180. }
  181. } else {
  182. if (this.starIndex == '1') {
  183. this.rate[index].level = '极不满意'
  184. } else if (this.starIndex == '2') {
  185. this.rate[index].level = '不满意'
  186. } else if (this.starIndex == '3') {
  187. this.rate[index].level = '尚可'
  188. } else if (this.starIndex == '4') {
  189. this.rate[index].level = '满意'
  190. } else if (this.starIndex == '5') {
  191. this.rate[index].level = '非常满意'
  192. }
  193. }
  194. },
  195. getVal(e) {
  196. debugger
  197. this.starIndex = e.value
  198. console.log(e)
  199. },
  200. checkboxChange(n) {
  201. console.log('change', n);
  202. },
  203. // 删除图片
  204. deletePic(event) {
  205. this[`fileList${event.name}`].splice(event.index, 1)
  206. },
  207. // 新增图片
  208. async afterRead(event) {
  209. // console.log(this[`fileList${event.name}`])
  210. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  211. let lists = [].concat(event.file)
  212. let fileListLen = this[`fileList${event.name}`].length
  213. lists.map((item) => {
  214. this[`fileList${event.name}`].push({
  215. ...item,
  216. status: 'uploading',
  217. message: '上传中'
  218. })
  219. })
  220. for (let i = 0; i < lists.length; i++) {
  221. const result = await this.uploadFilePromise(lists[i], lists[i].url)
  222. // console.log(result)
  223. let item = this[`fileList${event.name}`][fileListLen]
  224. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  225. status: 'success',
  226. message: '',
  227. url: result
  228. }))
  229. fileListLen++
  230. }
  231. },
  232. uploadFilePromise(file, url) {
  233. debugger
  234. uploadImage('image', url, 'appData/',
  235. result => {
  236. debugger
  237. // 上传成功回调函数
  238. console.log('图片地址', result)
  239. that.imageList.push(result)
  240. // this.dataDetails.certificateAddressUrl=this.dataDetails.certificateAddressUrl +',' +result
  241. }
  242. )
  243. },
  244. // 删除图片
  245. deletePic(event) {
  246. this[`fileList${event.name}`].splice(event.index, 1)
  247. },
  248. }
  249. }
  250. </script>
  251. <style lang="scss">
  252. .page_pingjia4 {
  253. background-color: #ffffff;
  254. padding: 20rpx;
  255. .anniu {
  256. margin-top: 48px;
  257. margin-left: 20px;
  258. }
  259. .niming {
  260. margin-top: 20px;
  261. }
  262. .ziti {
  263. color: #909090;
  264. margin-right: 20rpx;
  265. width: 160rpx;
  266. }
  267. .xkuang {
  268. margin-top: 20px;
  269. }
  270. .xx {
  271. margin-left: 24%;
  272. padding-top: 10px;
  273. }
  274. .biaoti {
  275. width: 80%;
  276. margin: 0 auto;
  277. text-align: center;
  278. margin-top: 20px;
  279. }
  280. .kuang {
  281. background-color: #ffffff;
  282. }
  283. }
  284. .tx-img {
  285. width: 40rpx;
  286. margin-right: 20rpx;
  287. }
  288. </style>