index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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 @click="onPhone">电话号码:<label class="phone">{{ detaile.telephone }}</label></view>
  10. <view>地址:{{ detaile.address }}</view>
  11. </view>
  12. </view>
  13. </view>
  14. <view class="service-info order-card">
  15. <view class="font-title ">备注信息</view>
  16. <view class="info-list">
  17. {{ detaile.remark }}
  18. </view>
  19. </view>
  20. <view class="service-info order-card">
  21. <view class="font-title">图片上传</view>
  22. <view class="upload-box">
  23. <view class="upload-img-item" v-for="(item, index) in fileList" :key="item.url">
  24. <view class="delete-icon" @click="deletePic(index)"><up-icon name="close-circle-fill"
  25. color="#f64a1f" size="18"></up-icon></view>
  26. <img class="upload-img" :src="item.url" :alt="item.fileName" srcset="">
  27. </view>
  28. <img src="/static/img/upload.png" alt="" class="upload-img" @click="uploadClick('img')"
  29. v-if="fileList.length < 10">
  30. </view>
  31. </view>
  32. <view class=" footer-g">
  33. <up-button type="primary" text="确定结束" @click="onSubmit"></up-button>
  34. </view>
  35. </view>
  36. </template>
  37. <script setup>
  38. import { ref, toRaw } from 'vue';
  39. import { onLoad } from '@dcloudio/uni-app';
  40. import { getVolunteerOrderInfo, getVolunteerFinishSecondOrder } from '@/api/volunteer.js'
  41. import { getAddress } from '@/api/address.js'
  42. import { wxUploadFile, wxMakePhoneCall } from '@/utils/wxRequest.js'
  43. const fileList = ref([]);
  44. const orderId = ref('');
  45. const detaile = ref({});
  46. // 删除图片
  47. const deletePic = (index) => {
  48. fileList.value.splice(index, 1);
  49. };
  50. const uploadClick = async (type) => {
  51. const res = await wxUploadFile(type);
  52. fileList.value = [...fileList.value, ...res];
  53. console.log('xxxxres', res, fileList.value);
  54. }
  55. const onPhone = (phone) => {
  56. wxMakePhoneCall(phone)
  57. }
  58. const getOrderDetail = async () => {
  59. try {
  60. uni.showLoading({
  61. title: '数据加载中...'
  62. });
  63. const res = await getVolunteerOrderInfo({ orderId: orderId.value });
  64. const ad_res = await getAddress(res.data.addressId);
  65. let data = res.data;
  66. if (ad_res.data) {
  67. data = {
  68. ...data,
  69. address: ad_res.data.address,
  70. name: ad_res.data.name,
  71. telephone: ad_res.data.telephone
  72. }
  73. }
  74. detaile.value = data;
  75. console.log('detaile.value', detaile.value);
  76. } catch (error) {
  77. console.log('error', error);
  78. uni.showToast({
  79. title: error.msg,
  80. icon: 'error',
  81. })
  82. } finally {
  83. uni.hideLoading();
  84. }
  85. }
  86. const onSubmit = () => {
  87. const img_urls = fileList.value.map(item => item.url).join(',');
  88. console.log('submit', fileList.value,img_urls);
  89. getVolunteerFinishSecondOrder({
  90. secondOrderId:orderId.value,
  91. serviceLog:img_urls,
  92. volunteerId: detaile.value.volunteerId
  93. }).then(res=> {
  94. if(res.code === 200){
  95. uni.switchTab({
  96. url: '/pages/classify'
  97. });
  98. }
  99. })
  100. }
  101. onLoad((options) => {
  102. console.log('options', options);
  103. orderId.value = options.orderId;
  104. // orderId.value = '1911685346559660034';
  105. getOrderDetail();
  106. })
  107. </script>
  108. <style lang="scss" scoped>
  109. .order-detail {
  110. position: fixed;
  111. top: 0;
  112. left: 0;
  113. right: 0;
  114. bottom: 0;
  115. padding: 12px 12px 24px;
  116. background: rgba(245, 245, 245, 1);
  117. .order-card {
  118. border-radius: 8px;
  119. background: rgba(255, 255, 255, 1);
  120. padding: 12px;
  121. margin-bottom: 12px;
  122. }
  123. .font-title {
  124. margin-bottom: 12px;
  125. }
  126. .user-box {
  127. display: flex;
  128. .user-img {
  129. width: 65.8px;
  130. height: 65.8px;
  131. margin-right: 12px;
  132. }
  133. }
  134. .register-box {
  135. display: flex;
  136. margin-bottom: 12px;
  137. .register-img {
  138. width: 90px;
  139. height: 90px;
  140. margin-right: 12px;
  141. }
  142. }
  143. .info-list {
  144. flex: 1;
  145. font-size: 14px;
  146. font-weight: 500;
  147. letter-spacing: 0px;
  148. line-height: 23.27px;
  149. color: rgba(51, 51, 51, 1);
  150. }
  151. .price {
  152. font-size: 18px;
  153. font-weight: 500;
  154. color: rgba(246, 74, 31, 1);
  155. .price-yuan {
  156. font-size: 13px;
  157. font-weight: 700;
  158. color: rgba(246, 74, 31, 1);
  159. }
  160. }
  161. .footer-g {
  162. padding: 12px;
  163. position: absolute;
  164. bottom: 18px;
  165. left: 0px;
  166. right: 0px;
  167. }
  168. .upload-img {
  169. height: 68px;
  170. width: 68px;
  171. margin-right: 12px;
  172. margin-bottom: 12px;
  173. }
  174. .upload-box {
  175. display: flex;
  176. flex-wrap: wrap;
  177. .upload-img-item {
  178. position: relative;
  179. .delete-icon {
  180. position: absolute;
  181. top: -7px;
  182. right: 7px;
  183. z-index: 1;
  184. }
  185. }
  186. }
  187. .phone {
  188. color: #3c9cff;
  189. }
  190. }
  191. </style>