index.vue 5.6 KB

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