index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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. detaile.value = {...res.data.secondOrder,...res.data.address}
  127. // if (data.volunteerPicture) {
  128. // fileList.value = data.volunteerPicture.split(',').map(item => {
  129. // return { url: item }
  130. // });
  131. // }
  132. // detaile.value = data;
  133. console.log('detaile.value', detaile.value);
  134. } catch (error) {
  135. console.log('error', error);
  136. uni.showToast({
  137. title: error.msg,
  138. icon: 'error',
  139. })
  140. } finally {
  141. uni.hideLoading();
  142. }
  143. }
  144. const onSubmit = () => {
  145. const img_urls = fileList.value.map(item => item.url).join(',');
  146. console.log('submit', fileList.value, img_urls);
  147. getVolunteerFinishSecondOrder({
  148. secondOrderId: orderId.value,
  149. volunteerPicture: img_urls,
  150. volunteerId: detaile.value.volunteerId,
  151. volunteerReview: detaile.value.volunteerReview
  152. }).then(res => {
  153. if (res.code === 200) {
  154. uni.showToast({
  155. title: '服务结束',
  156. icon: 'success',
  157. success: () => {
  158. setTimeout(() => {
  159. uni.switchTab({
  160. url: '/pages/classify'
  161. });
  162. }, 800)
  163. }
  164. })
  165. } else {
  166. uni.showToast({
  167. title: res.data,
  168. icon: 'error',
  169. })
  170. }
  171. })
  172. }
  173. onLoad((options) => {
  174. console.log('options', options);
  175. orderId.value = options.orderId;
  176. // orderId.value = '1911685346559660034';
  177. getOrderDetail();
  178. })
  179. </script>
  180. <style lang="scss" scoped>
  181. .order-detail {
  182. position: fixed;
  183. top: 0;
  184. left: 0;
  185. right: 0;
  186. bottom: 0;
  187. padding: 12px 12px 24px;
  188. background: rgba(245, 245, 245, 1);
  189. overflow-y: auto;
  190. .order-card {
  191. border-radius: 8px;
  192. background: rgba(255, 255, 255, 1);
  193. padding: 12px;
  194. margin-bottom: 12px;
  195. }
  196. .font-title {
  197. margin-bottom: 12px;
  198. }
  199. .user-box {
  200. display: flex;
  201. .user-img {
  202. width: 65.8px;
  203. height: 65.8px;
  204. margin-right: 12px;
  205. }
  206. }
  207. .register-box {
  208. display: flex;
  209. margin-bottom: 12px;
  210. .register-img {
  211. width: 90px;
  212. height: 90px;
  213. margin-right: 12px;
  214. }
  215. }
  216. .info-list {
  217. flex: 1;
  218. font-size: 14px;
  219. font-weight: 500;
  220. letter-spacing: 0px;
  221. line-height: 23.27px;
  222. color: rgba(51, 51, 51, 1);
  223. }
  224. .price {
  225. font-size: 18px;
  226. font-weight: 500;
  227. color: rgba(246, 74, 31, 1);
  228. .price-yuan {
  229. font-size: 13px;
  230. font-weight: 700;
  231. color: rgba(246, 74, 31, 1);
  232. }
  233. }
  234. .footer-g {
  235. padding: 12px;
  236. position: absolute;
  237. bottom: 18px;
  238. left: 0px;
  239. right: 0px;
  240. }
  241. .upload-img {
  242. height: 68px;
  243. width: 68px;
  244. margin-right: 12px;
  245. margin-bottom: 12px;
  246. }
  247. .upload-box {
  248. display: flex;
  249. flex-wrap: wrap;
  250. .upload-img-item {
  251. position: relative;
  252. .delete-icon {
  253. position: absolute;
  254. top: -7px;
  255. right: 7px;
  256. z-index: 1;
  257. }
  258. }
  259. }
  260. .phone {
  261. color: #3c9cff;
  262. }
  263. .info-item {
  264. margin-bottom: 12px;
  265. }
  266. }
  267. </style>