evaluate.vue 7.8 KB

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