evaluate.vue 9.0 KB

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