index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <!-- 订单详情 -->
  2. <template>
  3. <view class="order-detail">
  4. <view class="user-info order-card">
  5. <view class="font-title">基本信息</view>
  6. <view class="user-box">
  7. <view class="info-list">
  8. <view>被服务人员:{{ detaile.name }}</view>
  9. <view style="display: flex;">服务类别: <dict-tag :options="lrr_service_category"
  10. :value="detaile.serviceCategory" /></view>
  11. <view @click="onPhone">电话号码:<label class="phone">{{ detaile.telephone }}</label></view>
  12. <view>地址:{{ detaile.address }}</view>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="service-info order-card">
  17. <view class="font-title ">备注信息</view>
  18. <view class="info-list">
  19. {{ detaile.remark }}
  20. </view>
  21. </view>
  22. <view class="service-info order-card" v-if="detaile.orderStatus === 1">
  23. <view class="font-title ">反馈信息</view>
  24. <view class="info-list">
  25. <up-textarea v-model="detaile.volunteerReview" placeholder="请输入内容" ></up-textarea>
  26. </view>
  27. </view>
  28. <view v-if="detaile.orderStatus !== 1">
  29. <view class="user-info order-card">
  30. <view class="font-title">志愿者反馈信息</view>
  31. <view class="user-box">
  32. <view class="info-list">
  33. <view class="info-item">{{ detaile.volunteerReview }}</view>
  34. </view>
  35. </view>
  36. <view class="upload-box">
  37. <view class="upload-img-item" v-for="(item) in volunteerPicture" :key="item.url">
  38. <img class="upload-img" :src="item.url" :alt="item.fileName" srcset="">
  39. </view>
  40. </view>
  41. </view>
  42. <view class="user-info order-card">
  43. <view class="font-title">用户评价信息</view>
  44. <view class="user-box">
  45. <view class="info-list">
  46. <view class="info-item">{{ detaile.userReview || '用户未完成评价'}}</view>
  47. </view>
  48. </view>
  49. <view class="upload-box">
  50. <view class="upload-img-item" v-for="(item) in userPicture" :key="item.url">
  51. <img class="upload-img" :src="item.url" :alt="item.fileName" srcset="">
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="service-info order-card" v-if="detaile.orderStatus === 1">
  57. <view class="font-title">图片上传</view>
  58. <view class="upload-box">
  59. <view class="upload-img-item" v-for="(item, index) in fileList" :key="item.url">
  60. <view class="delete-icon" @click="deletePic(index)"><up-icon name="close-circle-fill"
  61. color="#f64a1f" size="18" v-if="detaile.orderStatus === 1"></up-icon></view>
  62. <img class="upload-img" :src="item.url" :alt="item.fileName" srcset="">
  63. </view>
  64. <img src="/static/img/upload.png" alt="" class="upload-img" @click="uploadClick('img')"
  65. v-if="fileList.length < 10 && detaile.orderStatus === 1">
  66. </view>
  67. </view>
  68. <view class=" footer-g" v-if="detaile.orderStatus === 1">
  69. <up-button type="primary" text="确定结束" @click="onSubmit"></up-button>
  70. </view>
  71. </view>
  72. </template>
  73. <script setup>
  74. import { ref, toRaw, computed } from 'vue';
  75. import { onLoad } from '@dcloudio/uni-app';
  76. import { getVolunteerOrderInfo, getVolunteerFinishSecondOrder } from '@/api/volunteer.js'
  77. import { getAddress } from '@/api/address.js'
  78. import { wxUploadFile, wxMakePhoneCall } from '@/utils/wxRequest.js'
  79. import { useDict } from '@/utils/dict.js';
  80. import DictTag from '@/components/DictTag/index.vue'
  81. const fileList = ref([]);
  82. const orderId = ref('');
  83. const detaile = ref({
  84. volunteerReview:''
  85. });
  86. const {
  87. lrr_service_category
  88. } = useDict('lrr_service_category');
  89. // 删除图片
  90. const deletePic = (index) => {
  91. fileList.value.splice(index, 1);
  92. };
  93. const uploadClick = async (type) => {
  94. const res = await wxUploadFile(type);
  95. fileList.value = [...fileList.value, ...res];
  96. console.log('xxxxres', res, fileList.value);
  97. }
  98. const onPhone = (phone) => {
  99. wxMakePhoneCall(phone)
  100. }
  101. //志愿者图片反馈
  102. const volunteerPicture = computed(() => {
  103. if (detaile.value.volunteerPicture) {
  104. return detaile.value.volunteerPicture.split(',').map(item => {
  105. return { url: item }
  106. });
  107. }
  108. return [];
  109. })
  110. //用户图片评价
  111. const userPicture = computed(() => {
  112. if (detaile.value.userPicture) {
  113. return detaile.value.userPicture.split(',').map(item => {
  114. return { url: item }
  115. });
  116. }
  117. return [];
  118. })
  119. const getOrderDetail = async () => {
  120. try {
  121. uni.showLoading({
  122. title: '数据加载中...'
  123. });
  124. const res = await getVolunteerOrderInfo({ orderId: orderId.value });
  125. const ad_res = await getAddress(res.data.addressId);
  126. let data = res.data;
  127. if (ad_res.data) {
  128. data = {
  129. ...data,
  130. address: ad_res.data.address,
  131. name: ad_res.data.name,
  132. telephone: ad_res.data.telephone
  133. }
  134. }
  135. // if (data.volunteerPicture) {
  136. // fileList.value = data.volunteerPicture.split(',').map(item => {
  137. // return { url: item }
  138. // });
  139. // }
  140. detaile.value = data;
  141. console.log('detaile.value', detaile.value);
  142. } catch (error) {
  143. console.log('error', error);
  144. uni.showToast({
  145. title: error.msg,
  146. icon: 'error',
  147. })
  148. } finally {
  149. uni.hideLoading();
  150. }
  151. }
  152. const onSubmit = () => {
  153. const img_urls = fileList.value.map(item => item.url).join(',');
  154. console.log('submit', fileList.value, img_urls);
  155. getVolunteerFinishSecondOrder({
  156. secondOrderId: orderId.value,
  157. volunteerPicture: img_urls,
  158. volunteerId: detaile.value.volunteerId,
  159. volunteerReview: detaile.value.volunteerReview
  160. }).then(res => {
  161. if (res.code === 200) {
  162. uni.showToast({
  163. title: '服务结束',
  164. icon: 'success',
  165. success: () => {
  166. setTimeout(() => {
  167. uni.switchTab({
  168. url: '/pages/classify'
  169. });
  170. }, 800)
  171. }
  172. })
  173. } else {
  174. uni.showToast({
  175. title: res.data,
  176. icon: 'error',
  177. })
  178. }
  179. })
  180. }
  181. onLoad((options) => {
  182. console.log('options', options);
  183. orderId.value = options.orderId;
  184. // orderId.value = '1911685346559660034';
  185. getOrderDetail();
  186. })
  187. </script>
  188. <style lang="scss" scoped>
  189. .order-detail {
  190. position: fixed;
  191. top: 0;
  192. left: 0;
  193. right: 0;
  194. bottom: 0;
  195. padding: 12px 12px 24px;
  196. background: rgba(245, 245, 245, 1);
  197. overflow-y: auto;
  198. .order-card {
  199. border-radius: 8px;
  200. background: rgba(255, 255, 255, 1);
  201. padding: 12px;
  202. margin-bottom: 12px;
  203. }
  204. .font-title {
  205. margin-bottom: 12px;
  206. }
  207. .user-box {
  208. display: flex;
  209. .user-img {
  210. width: 65.8px;
  211. height: 65.8px;
  212. margin-right: 12px;
  213. }
  214. }
  215. .register-box {
  216. display: flex;
  217. margin-bottom: 12px;
  218. .register-img {
  219. width: 90px;
  220. height: 90px;
  221. margin-right: 12px;
  222. }
  223. }
  224. .info-list {
  225. flex: 1;
  226. font-size: 14px;
  227. font-weight: 500;
  228. letter-spacing: 0px;
  229. line-height: 23.27px;
  230. color: rgba(51, 51, 51, 1);
  231. }
  232. .price {
  233. font-size: 18px;
  234. font-weight: 500;
  235. color: rgba(246, 74, 31, 1);
  236. .price-yuan {
  237. font-size: 13px;
  238. font-weight: 700;
  239. color: rgba(246, 74, 31, 1);
  240. }
  241. }
  242. .footer-g {
  243. padding: 12px;
  244. position: absolute;
  245. bottom: 18px;
  246. left: 0px;
  247. right: 0px;
  248. }
  249. .upload-img {
  250. height: 68px;
  251. width: 68px;
  252. margin-right: 12px;
  253. margin-bottom: 12px;
  254. }
  255. .upload-box {
  256. display: flex;
  257. flex-wrap: wrap;
  258. .upload-img-item {
  259. position: relative;
  260. .delete-icon {
  261. position: absolute;
  262. top: -7px;
  263. right: 7px;
  264. z-index: 1;
  265. }
  266. }
  267. }
  268. .phone {
  269. color: #3c9cff;
  270. }
  271. .info-item {
  272. margin-bottom: 12px;
  273. }
  274. }
  275. </style>