index.vue 6.3 KB

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