appraise.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. <template>
  2. <!-- #ifdef H5 -->
  3. <zj-page-layout :hasFooter="true">
  4. <view class="page-container">
  5. <view class="card-container">
  6. <view class="top">
  7. <view class="title"><text>*</text>服务评价</view>
  8. <u-rate count="5" :size="24" v-model="star"></u-rate>
  9. <!-- <view class="text">非常好</view> -->
  10. </view>
  11. <u--textarea
  12. v-model="remarkVal"
  13. height="100"
  14. placeholder="根据本次服务,写出您的真实感受~"
  15. fixed
  16. border="none"
  17. ></u--textarea>
  18. <view class="images">
  19. <block v-for="(item, index) in imageList" :key="index">
  20. <view class="img">
  21. <image :src="item.url" mode="aspectFill" @tap="prevImg(item.url)"></image>
  22. <text class="iconfont icon-guanbi1" @tap="delImage(index)"></text>
  23. </view>
  24. </block>
  25. <view class="add" @tap="addImage" v-if="imageList.length < 3">
  26. <text class="iconfont icon-xiangji"></text>
  27. <text class="text">添加图片</text>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="goods-container" v-if="!noData">
  32. <view class="orderid">
  33. <view class="row" v-if="detail.saleOrderNo">
  34. <view class="ellipsis"
  35. >订单号<text>{{ detail.saleOrderNo }}</text></view
  36. >
  37. <view class="copy" @tap.stop="copy(detail.saleOrderNo)">复制</view>
  38. </view>
  39. <view class="row">
  40. <view class="ellipsis"
  41. >工单号<text>{{ id }}</text></view
  42. >
  43. <view class="copy" @tap.stop="copy(id)">复制</view>
  44. </view>
  45. </view>
  46. <view class="goods" :class="'goods' + idx" v-for="(it, idx) in detail.products" :key="idx">
  47. <image :src="imageUrl + it.mainImg" mode="aspectFill" v-if="it.mainImg"></image>
  48. <image :src="configInfo.minLogo3" mode="aspectFill" v-else></image>
  49. <view class="main">
  50. <view class="name ellipsis-2">{{ it.productName || '' }}</view>
  51. <!-- <view class="des">{{it.small_name}}</view> -->
  52. <view class="tags">
  53. <view class="tag1">{{ detail.orderTypeName }}</view>
  54. <view class="tag2">{{ detail.mainName }}</view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="info" v-show="isShowGoodsMore">
  59. <view class="row" v-if="detail.appointmentTime">
  60. <view class="label">预约时间</view>
  61. <view class="value">{{ detail.appointmentTime }}</view>
  62. </view>
  63. <view class="row" v-if="detail.workerName">
  64. <view class="label">工程师</view>
  65. <view class="value">{{ detail.workerName }}</view>
  66. <text class="iconfont icon-call" @tap="callPhone"></text><text class="call" @tap="callPhone">联系Ta</text>
  67. <block v-if="locationData">
  68. <text class="iconfont icon-dingwei1" @tap="toLocation"></text
  69. ><text class="call" @tap="toLocation">查看位置</text>
  70. </block>
  71. </view>
  72. <view class="row">
  73. <view class="label">用户信息</view>
  74. <view class="value">{{ detail.userName || '' }}-{{ detail.userMobile || '' }}</view>
  75. </view>
  76. <view class="row">
  77. <view class="label">服务地址</view>
  78. <view class="value"
  79. >{{ detail.province }}{{ detail.city }}{{ detail.area }}{{ detail.street }}{{ detail.address }}</view
  80. >
  81. </view>
  82. <view class="row">
  83. <view class="label">备注</view>
  84. <view class="value">{{ detail.remark }}</view>
  85. </view>
  86. </view>
  87. <view class="ctrl" @tap="isShowGoodsMore = !isShowGoodsMore">
  88. <text class="iconfont icon-jinru" :class="isShowGoodsMore ? 'open' : ''"></text>
  89. <text class="text">{{ isShowGoodsMore ? '收起' : '查看更多' }}</text>
  90. </view>
  91. </view>
  92. </view>
  93. <template slot="footer">
  94. <view class="btn-group">
  95. <u-button text="发布" type="primary" size="large" @click="submitData"></u-button>
  96. </view>
  97. </template>
  98. </zj-page-layout>
  99. <!-- #endif -->
  100. <!-- #ifndef H5 -->
  101. <web-view
  102. :src="webViewHref(`/packageWorkorder/pages/appraise`, pam, crossPagePam)"
  103. @message="crossPage.$listener"
  104. ></web-view>
  105. <!-- #endif -->
  106. </template>
  107. <script>
  108. // #ifdef H5
  109. import { uploadImgFull } from '@/common/utils/util.js';
  110. export default {
  111. data() {
  112. return {
  113. configInfo: {},
  114. imageUrl: this.$imageUrl,
  115. id: null,
  116. type: null,
  117. star: 0,
  118. remarkVal: '',
  119. imageList: [],
  120. isShowGoodsMore: false,
  121. detail: {}, // 详情数据
  122. noData: true,
  123. }
  124. },
  125. async onLoad({id, type}) {
  126. this.id = id;
  127. this.type = type;
  128. // this.getOrderDetail();
  129. this.configInfo = await this.$getConfigInfo();
  130. },
  131. methods: {
  132. getOrderDetail() {
  133. this.$api
  134. .post('/order/customer/detail',{
  135. userMobile: this.userInfo.mobile,
  136. id: this.id,
  137. }).then(res => {
  138. if(res.data) {
  139. this.noData = false;
  140. this.detail = res.data;
  141. }else {
  142. this.noData = true;
  143. }
  144. })
  145. },
  146. // 添加图片
  147. async addImage() {
  148. uni.chooseImage({
  149. count: 3 - this.imageList.length,
  150. success: res => {
  151. uni.showLoading();
  152. res.tempFilePaths.forEach(async item => {
  153. let data = await uploadImgFull(item);
  154. this.imageList.push(data);
  155. });
  156. uni.hideLoading();
  157. },
  158. fail: err => {}
  159. })
  160. },
  161. callPhone() {
  162. uni.makePhoneCall({
  163. phoneNumber: this.detail.workerMobile
  164. });
  165. },
  166. // 删除图片
  167. delImage(index) {
  168. this.imageList.splice(index, 1);
  169. },
  170. //预览图片
  171. prevImg(current) {
  172. uni.previewImage({
  173. current,
  174. urls: this.imageList.map(item => {
  175. return item.url
  176. })
  177. })
  178. },
  179. submitData() {
  180. if(!this.star) return this.$toast('请选择服务评价');
  181. this.$api.postJson('/pg/order/base/appraise', {
  182. orderBaseId: this.id,
  183. level: this.star,
  184. appraiseContent: this.remarkVal,
  185. appraiseImgUrl: this.imageList.map(item => {
  186. return item.url
  187. }).join(','),
  188. }).then(res => {
  189. this.$successToast('评价成功');
  190. this.crossPage.$emit('refreshUserWorkorderList', '');
  191. this.$navToPage({
  192. delta: 1
  193. }, 'navigateBack')
  194. })
  195. }
  196. }
  197. }
  198. // #endif
  199. // #ifndef H5
  200. export default {
  201. data() {
  202. return {
  203. pam: {},
  204. }
  205. },
  206. onLoad(pam) {
  207. this.pam = pam;
  208. }
  209. }
  210. // #endif
  211. </script>
  212. <style lang="scss" scoped>
  213. .page-container {
  214. padding: 30rpx;
  215. }
  216. .card-container {
  217. @include zj-card;
  218. padding: 0 30rpx 30rpx;
  219. .top {
  220. height: 100rpx;
  221. display: flex;
  222. align-items: center;
  223. .title {
  224. font-size: 32rpx;
  225. margin-right: 12rpx;
  226. text {
  227. color: $minor-color;
  228. }
  229. }
  230. .text {
  231. color: $sec-font;
  232. margin-left: 8rpx;
  233. }
  234. }
  235. ::v-deep .u-textarea {
  236. padding: 0;
  237. }
  238. .images {
  239. display: flex;
  240. flex-wrap: wrap;
  241. margin-top: 20rpx;
  242. .add {
  243. display: flex;
  244. flex-direction: column;
  245. align-items: center;
  246. justify-content: center;
  247. width: 146rpx;
  248. height: 146rpx;
  249. border: 2rpx dashed #dadada;
  250. border-radius: 10rpx;
  251. margin-top: 20rpx;
  252. .iconfont {
  253. font-size: 48rpx;
  254. color: #999999;
  255. }
  256. .text {
  257. font-size: 24rpx;
  258. color: #999999;
  259. margin-top: 10rpx;
  260. }
  261. }
  262. .img {
  263. position: relative;
  264. margin-right: 20rpx;
  265. margin-top: 20rpx;
  266. &:nth-child(4n) {
  267. margin-right: 0;
  268. }
  269. image {
  270. width: 150rpx;
  271. height: 150rpx;
  272. border-radius: 10rpx;
  273. overflow: hidden;
  274. display: block;
  275. }
  276. text {
  277. position: absolute;
  278. right: -10rpx;
  279. top: -10rpx;
  280. width: 40rpx;
  281. height: 40rpx;
  282. border-radius: 50%;
  283. background: #ff3f42;
  284. font-size: 24rpx;
  285. color: #ffffff;
  286. text-align: center;
  287. line-height: 40rpx;
  288. display: block;
  289. }
  290. }
  291. }
  292. }
  293. .goods-container {
  294. @include zj-card;
  295. margin-top: 30rpx;
  296. padding: 30rpx;
  297. .orderid {
  298. .row {
  299. margin-bottom: 20rpx;
  300. display: flex;
  301. align-items: center;
  302. view {
  303. color: $sec-font;
  304. text {
  305. margin-left: 20rpx;
  306. color: $main-font;
  307. font-weight: 500;
  308. }
  309. }
  310. .copy {
  311. flex-shrink: 0;
  312. margin-left: 10rpx;
  313. font-size: 28rpx;
  314. color: $theme-color;
  315. }
  316. }
  317. }
  318. .goods {
  319. display: flex;
  320. justify-content: space-between;
  321. margin-top: 20rpx;
  322. image {
  323. width: 140rpx;
  324. height: 140rpx;
  325. display: block;
  326. flex-shrink: 0;
  327. margin-right: 20rpx;
  328. }
  329. .main {
  330. flex: 1;
  331. display: flex;
  332. flex-direction: column;
  333. .name {
  334. font-size: 28rpx;
  335. color: #333333;
  336. line-height: 36rpx;
  337. }
  338. .des {
  339. font-size: 28rpx;
  340. color: #999999;
  341. margin-top: 16rpx;
  342. }
  343. .tags {
  344. margin-top: 16rpx;
  345. display: flex;
  346. .tag1 {
  347. font-size: 24rpx;
  348. height: 42rpx;
  349. line-height: 42rpx;
  350. padding: 0 16rpx;
  351. margin-right: 10rpx;
  352. border: 1px solid $minor-color;
  353. color: $minor-color;
  354. box-sizing: border-box;
  355. display: flex;
  356. align-items: center;
  357. flex-direction: row;
  358. border-radius: 10rpx;
  359. }
  360. .tag2 {
  361. height: 42rpx;
  362. padding: 0 16rpx;
  363. line-height: 42rpx;
  364. border-radius: 10rpx;
  365. background: #e8e8e8;
  366. font-size: 24rpx;
  367. color: #666666;
  368. }
  369. }
  370. }
  371. }
  372. .info {
  373. margin-top: 20rpx;
  374. .row {
  375. font-size: 28rpx;
  376. color: #666666;
  377. margin-bottom: 20rpx;
  378. display: flex;
  379. .label {
  380. color: $sec-font;
  381. flex-shrink: 0;
  382. width: 128rpx;
  383. }
  384. .value {
  385. }
  386. .iconfont {
  387. margin-left: 16rpx;
  388. }
  389. text {
  390. color: $theme-color;
  391. }
  392. }
  393. }
  394. .ctrl {
  395. display: flex;
  396. align-items: center;
  397. justify-content: center;
  398. color: $sec-font;
  399. margin-top: 30rpx;
  400. .iconfont {
  401. margin-right: 10rpx;
  402. transform: rotate(90deg);
  403. &.open {
  404. transform: rotate(270deg);
  405. }
  406. }
  407. }
  408. }
  409. .btn-group {
  410. padding: 25rpx 30rpx;
  411. display: flex;
  412. align-items: center;
  413. ::v-deep .u-button {
  414. height: 88rpx;
  415. font-size: 32rpx;
  416. margin-right: 30rpx;
  417. border-radius: 88rpx;
  418. &:last-child {
  419. margin-right: 0;
  420. }
  421. }
  422. }
  423. </style>