handle.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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 } 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. detaile.value = {
  54. ...res.data,
  55. address: ad_res.data.address,
  56. name: ad_res.data.name,
  57. telephone: ad_res.data.telephone
  58. };
  59. } catch (error) {
  60. console.log('error', error);
  61. uni.showToast({
  62. title: error.msg,
  63. icon: 'error',
  64. })
  65. } finally {
  66. uni.hideLoading();
  67. }
  68. }
  69. const change = (e) => {
  70. console.log('验证信息:', e)
  71. console.log('验证是否成功:' + e.state)
  72. console.log('验证次数:' + e.verification)
  73. if (e.state && !orderStatus.value) {
  74. setTimeout(() => {
  75. verify.value.initialization();
  76. // 验证成功
  77. orderStatus.value = true;
  78. }, 1000)
  79. }
  80. if (e.state && orderStatus.value) {
  81. console.log('完成任务')
  82. uni.redirectTo({ url: `/pages/order/order?orderId=${orderId.value}` });
  83. }
  84. }
  85. const onSubmit = () => {
  86. console.log('submit', fileList.value);
  87. }
  88. onLoad((options) => {
  89. console.log('options', options);
  90. orderId.value = options.orderId;
  91. getOrderDetail();
  92. })
  93. </script>
  94. <style lang="scss" scoped>
  95. .order-detail {
  96. position: fixed;
  97. top: 0;
  98. left: 0;
  99. right: 0;
  100. bottom: 0;
  101. padding: 12px 12px 24px;
  102. background: rgba(245, 245, 245, 1);
  103. .order-card {
  104. border-radius: 8px;
  105. background: rgba(255, 255, 255, 1);
  106. padding: 12px;
  107. margin-bottom: 12px;
  108. }
  109. .font-title {
  110. margin-bottom: 12px;
  111. }
  112. .user-box {
  113. display: flex;
  114. .user-img {
  115. width: 65.8px;
  116. height: 65.8px;
  117. margin-right: 12px;
  118. }
  119. }
  120. .register-box {
  121. display: flex;
  122. margin-bottom: 12px;
  123. .register-img {
  124. width: 90px;
  125. height: 90px;
  126. margin-right: 12px;
  127. }
  128. }
  129. .info-list {
  130. flex: 1;
  131. font-size: 14px;
  132. font-weight: 500;
  133. letter-spacing: 0px;
  134. line-height: 23.27px;
  135. color: rgba(51, 51, 51, 1);
  136. }
  137. .price {
  138. font-size: 18px;
  139. font-weight: 500;
  140. color: rgba(246, 74, 31, 1);
  141. .price-yuan {
  142. font-size: 13px;
  143. font-weight: 700;
  144. color: rgba(246, 74, 31, 1);
  145. }
  146. }
  147. .footer-g {
  148. padding: 12px;
  149. position: absolute;
  150. bottom: 18px;
  151. left: 0px;
  152. right: 0px;
  153. background: rgba(255, 255, 255, 1);
  154. }
  155. .upload-img {
  156. height: 68px;
  157. width: 68px;
  158. margin-right: 12px;
  159. margin-bottom: 12px;
  160. }
  161. .upload-box {
  162. display: flex;
  163. flex-wrap: wrap;
  164. .upload-img-item {
  165. position: relative;
  166. .delete-icon {
  167. position: absolute;
  168. top: -7px;
  169. right: 7px;
  170. z-index: 1;
  171. }
  172. }
  173. }
  174. .phone {
  175. color: #3c9cff;
  176. }
  177. }
  178. </style>