index.vue 6.4 KB

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