index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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 === '3'">
  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 !== '3'">
  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-see">
  37. <view class="upload-img-item" v-for="(item) in volunteerPicture" :key="item.url">
  38. <up-image class="upload-img-see" :show-loading="true" :src="item.url" :alt="item.fileName"></up-image>
  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-see">
  50. <view class="upload-img-item" v-for="(item) in userPicture" :key="item.url">
  51. <up-image class="upload-img-see" :show-loading="true" :src="item.url" :alt="item.fileName"></up-image>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="service-info order-card" v-if="detaile.orderStatus === '3'">
  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 === '3'"></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 === '3'">
  66. </view>
  67. </view>
  68. <view class=" footer-g" v-if="detaile.orderStatus === '3'">
  69. <!-- <up-button type="primary" text="确定结束" @click="onSubmit"></up-button> -->
  70. <view class="status-btn" @click="onSubmit">确定结束</view>
  71. </view>
  72. </view>
  73. </template>
  74. <script setup>
  75. import { ref, toRaw, computed } from 'vue';
  76. import { onLoad } from '@dcloudio/uni-app';
  77. import { getVolunteerOrderInfo, getVolunteerFinishSecondOrder } from '@/api/volunteer.js'
  78. import { getAddress } from '@/api/address.js'
  79. import { wxUploadFile, wxMakePhoneCall } from '@/utils/wxRequest.js'
  80. import { useDict } from '@/utils/dict.js';
  81. import DictTag from '@/components/DictTag/index.vue'
  82. const fileList = ref([]);
  83. const secondOrderId = ref('');
  84. const detaile = ref({
  85. volunteerReview:''
  86. });
  87. const {
  88. lrr_service_category
  89. } = useDict('lrr_service_category');
  90. // 删除图片
  91. const deletePic = (index) => {
  92. fileList.value.splice(index, 1);
  93. };
  94. const uploadClick = async (type) => {
  95. const res = await wxUploadFile(type);
  96. fileList.value = [...fileList.value, ...res];
  97. console.log('xxxxres', res, fileList.value);
  98. }
  99. const onPhone = (phone) => {
  100. wxMakePhoneCall(phone)
  101. }
  102. //志愿者图片反馈
  103. const volunteerPicture = computed(() => {
  104. if (detaile.value.volunteerPicture) {
  105. return detaile.value.volunteerPicture.split(',').map(item => {
  106. return { url: item }
  107. });
  108. }
  109. return [];
  110. })
  111. //用户图片评价
  112. const userPicture = computed(() => {
  113. if (detaile.value.userPicture) {
  114. return detaile.value.userPicture.split(',').map(item => {
  115. return { url: item }
  116. });
  117. }
  118. return [];
  119. })
  120. const getOrderDetail = async () => {
  121. try {
  122. uni.showLoading({
  123. title: '数据加载中...'
  124. });
  125. const res = await getVolunteerOrderInfo({ secondOrderId: secondOrderId.value });
  126. // const ad_res = await getAddress(res.data.addressId);
  127. // detaile.value = {...res.data.secondOrder,...res.data.address}
  128. detaile.value = { ...res.data.secondOrder, address:res.data.address.address,serveTimes:res.data.secondOrder.updateTime }
  129. // if (data.volunteerPicture) {
  130. // fileList.value = data.volunteerPicture.split(',').map(item => {
  131. // return { url: item }
  132. // });
  133. // }
  134. // detaile.value = data;
  135. console.log('detaile.value', detaile.value);
  136. } catch (error) {
  137. console.log('error', error);
  138. uni.showToast({
  139. title: error.msg,
  140. icon: 'error',
  141. })
  142. } finally {
  143. uni.hideLoading();
  144. }
  145. }
  146. const onSubmit = () => {
  147. const img_urls = fileList.value.map(item => item.url).join(',');
  148. console.log('submit', fileList.value, img_urls);
  149. getVolunteerFinishSecondOrder({
  150. secondOrderId: secondOrderId.value,
  151. volunteerPicture: img_urls,
  152. volunteerId: detaile.value.volunteerId,
  153. volunteerReview: detaile.value.volunteerReview
  154. }).then(res => {
  155. if (res.code === 200) {
  156. uni.showToast({
  157. title: '服务结束',
  158. icon: 'success',
  159. success: () => {
  160. setTimeout(() => {
  161. uni.switchTab({
  162. url: '/pages/classify'
  163. });
  164. }, 800)
  165. }
  166. })
  167. } else {
  168. uni.showToast({
  169. title: res.data,
  170. icon: 'error',
  171. })
  172. }
  173. })
  174. }
  175. onLoad((options) => {
  176. console.log('options', options);
  177. secondOrderId.value = options.secondOrderId;
  178. // orderId.value = '1911685346559660034';
  179. getOrderDetail();
  180. })
  181. </script>
  182. <style lang="scss" scoped>
  183. .order-detail {
  184. position: fixed;
  185. top: 0;
  186. left: 0;
  187. right: 0;
  188. bottom: 0;
  189. padding: 12px 12px 24px;
  190. background: rgba(245, 245, 245, 1);
  191. overflow-y: auto;
  192. .order-card {
  193. border-radius: 8px;
  194. background: rgba(255, 255, 255, 1);
  195. padding: 12px;
  196. margin-bottom: 12px;
  197. }
  198. .font-title {
  199. margin-bottom: 12px;
  200. }
  201. .user-box {
  202. display: flex;
  203. .user-img {
  204. width: 65.8px;
  205. height: 65.8px;
  206. margin-right: 12px;
  207. }
  208. }
  209. .register-box {
  210. display: flex;
  211. margin-bottom: 12px;
  212. .register-img {
  213. width: 90px;
  214. height: 90px;
  215. margin-right: 12px;
  216. }
  217. }
  218. .info-list {
  219. flex: 1;
  220. font-size: 14px;
  221. font-weight: 500;
  222. letter-spacing: 0px;
  223. line-height: 23.27px;
  224. color: rgba(51, 51, 51, 1);
  225. }
  226. .price {
  227. font-size: 18px;
  228. font-weight: 500;
  229. color: rgba(246, 74, 31, 1);
  230. .price-yuan {
  231. font-size: 13px;
  232. font-weight: 700;
  233. color: rgba(246, 74, 31, 1);
  234. }
  235. }
  236. .footer-g {
  237. padding: 12px;
  238. position: absolute;
  239. bottom: 18px;
  240. left: 0px;
  241. right: 0px;
  242. }
  243. .upload-img {
  244. height: 68px;
  245. width: 68px;
  246. margin-right: 12px;
  247. margin-bottom: 12px;
  248. }
  249. .upload-box {
  250. display: flex;
  251. flex-wrap: wrap;
  252. // display: flex;
  253. // flex-direction: column;
  254. // align-items: center;
  255. // justify-content: center;
  256. .upload-img-item {
  257. position: relative;
  258. .delete-icon {
  259. position: absolute;
  260. top: -7px;
  261. right: 7px;
  262. z-index: 1;
  263. }
  264. }
  265. }
  266. .upload-box-see {
  267. display: flex;
  268. flex-direction: column;
  269. align-items: center;
  270. justify-content: center;
  271. .upload-img-see{
  272. margin-bottom: 12px;
  273. }
  274. }
  275. .phone {
  276. color: #3c9cff;
  277. }
  278. .info-item {
  279. margin-bottom: 12px;
  280. }
  281. }
  282. .status-btn {
  283. // width: 716rpx;
  284. height: 96rpx;
  285. border-radius: 16rpx;
  286. background: rgba(221, 94, 69, 1);
  287. display: flex;
  288. align-items: center;
  289. justify-content: center;
  290. font-size: 32rpx;
  291. font-weight: 400;
  292. color: rgba(255, 255, 255, 1);
  293. margin-bottom: 88rpx;
  294. }
  295. </style>