addEvaluation.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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="objData.cargoOwnerPortrait" mode="" 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 :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 permision from "@/js_sdk/wa-permission/permission.js"
  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. console.log(12112)
  111. uni.$u.debounce(this.submit, 500)
  112. },
  113. onLoad(options) {
  114. that = this
  115. this.get_camera_permission()
  116. this.objData = JSON.parse(options.val)
  117. console.log(this.objData)
  118. },
  119. methods: {
  120. async get_camera_permission() {
  121. var photol=await permision.requestAndroidPermission("android.permission.CAMERA")
  122. if(photol == false){
  123. uni.showModal({
  124. title: '提示',
  125. content: '您已经关闭相册权限,去设置',
  126. success: function (res) {
  127. if (res.confirm) {
  128. permision.gotoAppPermissionSetting()
  129. // plus.runtime.openURL("app-settings:");
  130. } else if (res.cancel) {
  131. console.log('用户点击取消');
  132. }
  133. }
  134. });
  135. }
  136. },
  137. submit(){
  138. let _data = {
  139. evaluatoredId: this.objData.cargoCommonId,
  140. evaluatorId: this.objData.commonId,
  141. ownerName: this.objData.cargoOwner,
  142. driverName: this.checkboxValue1 ? this.objData.driverName : '',
  143. driverPortrait: this.checkboxValue1 ? this.userInfo.avatarUrl : '',
  144. orderId: this.objData.id,
  145. orderNumber: this.objData.orderNo,
  146. ownerCredit: this.rate[0].value1,
  147. freightPayment: this.rate[1].value1,
  148. comprehensiveSatisfaction: this.rate[2].value1,
  149. driverContent: this.value3,
  150. driverUrl: this.imageList.toString(),
  151. driverAnonymous: this.checkboxValue1.length != 0 ? 1 : 0
  152. }
  153. that.$request.baseRequest('post', '/evaluateInfo/api/addEvaluateInfo', _data).then(res => {
  154. if (res.code == 200) {
  155. this.$refs.uToast.show({
  156. type: 'success',
  157. message: "评价成功",
  158. complete() {
  159. uni.navigateBack({
  160. delta:1
  161. })
  162. }
  163. })
  164. } else {
  165. this.$refs.uToast.show({
  166. type: 'error',
  167. message: "评价失败",
  168. })
  169. }
  170. })
  171. },
  172. clickStar(index) {
  173. console.log(index)
  174. this.selectStar = index
  175. if (index == 0 || index == 1) {
  176. if (this.starIndex == '1') {
  177. this.rate[index].level = '极差'
  178. } else if (this.starIndex == '2') {
  179. this.rate[index].level = '差'
  180. } else if (this.starIndex == '3') {
  181. this.rate[index].level = '一般'
  182. } else if (this.starIndex == '4') {
  183. this.rate[index].level = '较好'
  184. } else if (this.starIndex == '5') {
  185. this.rate[index].level = '非常好'
  186. }
  187. } else {
  188. if (this.starIndex == '1') {
  189. this.rate[index].level = '极不满意'
  190. } else if (this.starIndex == '2') {
  191. this.rate[index].level = '不满意'
  192. } else if (this.starIndex == '3') {
  193. this.rate[index].level = '尚可'
  194. } else if (this.starIndex == '4') {
  195. this.rate[index].level = '满意'
  196. } else if (this.starIndex == '5') {
  197. this.rate[index].level = '非常满意'
  198. }
  199. }
  200. },
  201. getVal(e) {
  202. this.starIndex = e.value
  203. console.log(e)
  204. },
  205. checkboxChange(n) {
  206. console.log('change', n);
  207. },
  208. // 删除图片
  209. deletePic(event) {
  210. this[`fileList${event.name}`].splice(event.index, 1)
  211. },
  212. // 新增图片
  213. async afterRead(event) {
  214. // console.log(this[`fileList${event.name}`])
  215. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  216. let lists = [].concat(event.file)
  217. let fileListLen = this[`fileList${event.name}`].length
  218. lists.map((item) => {
  219. this[`fileList${event.name}`].push({
  220. ...item,
  221. status: 'uploading',
  222. message: '上传中'
  223. })
  224. })
  225. for (let i = 0; i < lists.length; i++) {
  226. const result = await this.uploadFilePromise(lists[i], lists[i].url)
  227. // console.log(result)
  228. let item = this[`fileList${event.name}`][fileListLen]
  229. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  230. status: 'success',
  231. message: '',
  232. url: result
  233. }))
  234. fileListLen++
  235. }
  236. },
  237. uploadFilePromise(file, url) {
  238. uploadImage('image', url, 'appData/',
  239. result => {
  240. // 上传成功回调函数
  241. console.log('图片地址', result)
  242. that.imageList.push(result)
  243. // this.dataDetails.certificateAddressUrl=this.dataDetails.certificateAddressUrl +',' +result
  244. }
  245. )
  246. },
  247. // 删除图片
  248. deletePic(event) {
  249. this[`fileList${event.name}`].splice(event.index, 1)
  250. },
  251. }
  252. }
  253. </script>
  254. <style lang="scss">
  255. .page_pingjia4 {
  256. background-color: #ffffff;
  257. padding: 20rpx;
  258. .anniu {
  259. margin-top: 48px;
  260. margin-left: 20px;
  261. }
  262. .niming {
  263. margin-top: 20px;
  264. }
  265. .ziti {
  266. color: #909090;
  267. margin-right: 20rpx;
  268. width: 160rpx;
  269. }
  270. .xkuang {
  271. margin-top: 20px;
  272. }
  273. .xx {
  274. margin-left: 24%;
  275. padding-top: 10px;
  276. }
  277. .biaoti {
  278. width: 80%;
  279. margin: 0 auto;
  280. text-align: center;
  281. margin-top: 20px;
  282. }
  283. .kuang {
  284. background-color: #ffffff;
  285. }
  286. }
  287. .tx-img {
  288. width: 40rpx;
  289. height: 40rpx;
  290. border-radius: 20rpx;
  291. }
  292. </style>