index.vue 7.7 KB

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