index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <!-- 订单详情 -->
  2. <template>
  3. <view class="order-detail">
  4. <view class="service-info order-card">
  5. <PositioningMap :address="detaile.address" />
  6. </view>
  7. <view class="user-info order-card">
  8. <view class="user-box">
  9. <view class="info-list">
  10. <view>被服务人员:{{ detaile.name }}</view>
  11. <view style="display: flex;">服务类别: <dict-tag :options="lrr_service_category"
  12. :value="detaile.serviceCategory" /></view>
  13. <view @click="onPhone">电话号码:<label class="phone">{{ detaile.telephone }}</label></view>
  14. <view>地址:{{ detaile.address }}</view>
  15. <view>是否有传染疾病:{{ detaile.isContagion === 1 ? '是' : '否' }}</view>
  16. <view v-if="detaile.isContagion === 1">疾病备注:{{ detaile.haveContagion }}</view>
  17. <view>备注信息:{{ detaile.remark }}</view>
  18. </view>
  19. </view>
  20. </view>
  21. <view class=" footer-g">
  22. <Slide ref="verify" @change='change' :sliderText="slideData" />
  23. </view>
  24. </view>
  25. </template>
  26. <script setup>
  27. import { ref } from 'vue';
  28. import { onLoad } from '@dcloudio/uni-app';
  29. import { getVolunteerOrderInfo, getTimesByDate, } from '@/api/volunteer.js'
  30. import { getAddress } from '@/api/address.js'
  31. import PositioningMap from '@/components/PositioningMap/index.vue'
  32. import Slide from '@/components/Slide/index.vue'
  33. import { useDict } from '@/utils/dict.js';
  34. import DictTag from '@/components/DictTag/index.vue'
  35. import { wxMakePhoneCall } from '@/utils/wxRequest.js'
  36. import { computed } from 'vue';
  37. const fileList = ref([]);
  38. const orderId = ref('');
  39. const detaile = ref({});
  40. const verify = ref(null);
  41. const {
  42. lrr_service_category
  43. } = useDict('lrr_service_category');
  44. const orderStatus = ref(false);//false:未开始服务 true:服务已开始,待上传图片
  45. const onPhone = (phone) => {
  46. wxMakePhoneCall(phone)
  47. }
  48. const slideData = computed(() => {
  49. //服务已开始,待上传图片
  50. if (orderStatus.value) {
  51. return { successText: '服务已完成', startText: '拖动滑块结束服务', successColor: '#f64a1f', btnText: '上传照片' }
  52. }
  53. return { successText: '服务已开始', startText: '拖动滑块开始服务', successColor: '#72c13f', btnText: '开始' }
  54. })
  55. const getOrderDetail = async () => {
  56. try {
  57. uni.showLoading({
  58. title: '数据加载中...'
  59. });
  60. const res = await getVolunteerOrderInfo({ orderId: orderId.value });
  61. // const ad_res = await getAddress(res.data.secondOrder.addressId);
  62. console.log('res',res.data);
  63. let data = res.data.secondOrder;
  64. detaile.value = {...res.data.secondOrder,...res.data.address};
  65. // if (data.address) {
  66. // data = {
  67. // ...data,
  68. // telephone: data.address.telephone,
  69. // isContagion: data.address.isContagion,
  70. // haveContagion: data.address.haveContagion,
  71. // address: data.address.address,
  72. // name: data.address.name,
  73. // }
  74. // }
  75. // detaile.value = data;
  76. if (data.orderStatus === 1) {
  77. orderStatus.value = true;
  78. }
  79. console.log('xxxx', detaile.value);
  80. } catch (error) {
  81. console.log('error', error);
  82. uni.showToast({
  83. title: error.msg,
  84. icon: 'error',
  85. })
  86. } finally {
  87. uni.hideLoading();
  88. }
  89. }
  90. const change = (e) => {
  91. console.log('验证信息:', e)
  92. console.log('验证是否成功:' + e.state)
  93. console.log('验证次数:' + e.verification)
  94. if (e.state && !orderStatus.value) {
  95. getTimesByDate(orderId.value).then(res => {
  96. if (res.code === 200) {
  97. uni.showToast({
  98. title: '已开始服务',
  99. icon: 'success',
  100. success: () => {
  101. verify.value.initialization();
  102. // 验证成功
  103. orderStatus.value = true;
  104. }
  105. })
  106. }
  107. })
  108. }
  109. if (e.state && orderStatus.value) {
  110. uni.showToast({
  111. title: '操作成功',
  112. icon: 'success',
  113. success: () => {
  114. setTimeout(()=>{
  115. uni.redirectTo({ url: `/pages_classify/pages/order/index?orderId=${orderId.value}` });
  116. },800)
  117. }
  118. })
  119. }
  120. }
  121. onLoad((options) => {
  122. console.log('options', options);
  123. orderId.value = options.orderId;
  124. getOrderDetail();
  125. })
  126. </script>
  127. <style lang="scss" scoped>
  128. .order-detail {
  129. position: fixed;
  130. top: 0;
  131. left: 0;
  132. right: 0;
  133. bottom: 0;
  134. padding: 12px 12px 24px;
  135. background: rgba(245, 245, 245, 1);
  136. .order-card {
  137. border-radius: 8px;
  138. background: rgba(255, 255, 255, 1);
  139. padding: 12px;
  140. margin-bottom: 12px;
  141. }
  142. .font-title {
  143. margin-bottom: 12px;
  144. }
  145. .user-box {
  146. display: flex;
  147. .user-img {
  148. width: 65.8px;
  149. height: 65.8px;
  150. margin-right: 12px;
  151. }
  152. }
  153. .register-box {
  154. display: flex;
  155. margin-bottom: 12px;
  156. .register-img {
  157. width: 90px;
  158. height: 90px;
  159. margin-right: 12px;
  160. }
  161. }
  162. .info-list {
  163. flex: 1;
  164. font-size: 14px;
  165. font-weight: 500;
  166. letter-spacing: 0px;
  167. line-height: 23.27px;
  168. color: rgba(51, 51, 51, 1);
  169. }
  170. .price {
  171. font-size: 18px;
  172. font-weight: 500;
  173. color: rgba(246, 74, 31, 1);
  174. .price-yuan {
  175. font-size: 13px;
  176. font-weight: 700;
  177. color: rgba(246, 74, 31, 1);
  178. }
  179. }
  180. .footer-g {
  181. padding: 12px;
  182. position: absolute;
  183. bottom: 18px;
  184. left: 0px;
  185. right: 0px;
  186. background: rgba(255, 255, 255, 1);
  187. }
  188. .upload-img {
  189. height: 68px;
  190. width: 68px;
  191. margin-right: 12px;
  192. margin-bottom: 12px;
  193. }
  194. .upload-box {
  195. display: flex;
  196. flex-wrap: wrap;
  197. .upload-img-item {
  198. position: relative;
  199. .delete-icon {
  200. position: absolute;
  201. top: -7px;
  202. right: 7px;
  203. z-index: 1;
  204. }
  205. }
  206. }
  207. .phone {
  208. color: #3c9cff;
  209. }
  210. }
  211. </style>