handle.vue 5.1 KB

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