addEvaluation.vue 7.4 KB

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