addEvaluation.vue 7.0 KB

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