猫妈狗爸伴宠师小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

570 lines
14 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
  1. <template>
  2. <!-- <div>订单详情</div> -->
  3. <view class="box box-size">
  4. <view class="top box-size" :style="{ borderRadius: '16rpx' }">
  5. <view class="top_left box-size">
  6. <view>
  7. 本单客户支付金额
  8. <view class="vertically_center text1">
  9. ¥ {{ orderDetail.order?.h5OrderVO?.payAmount }}
  10. </view>
  11. </view>
  12. X
  13. <view>
  14. 您的分成比例
  15. <view class="vertically_center text1">
  16. <!-- 20% -->
  17. {{ orderDetail.pet_payment_bcs[userInfo.userBcsRole - 1].paramValueText }}
  18. </view>
  19. </view>
  20. =
  21. <view>
  22. 本单酬劳
  23. <view class="vertically_center text1">
  24. ¥ {{ orderDetail.order.orderGive}}
  25. <!-- ¥ {{ orderDetail.pet_payment_bcs[userInfo.userBcsRole - 1].paramValueNo * orderDetail.order?.h5OrderVO?.payAmount }} -->
  26. </view>
  27. </view>
  28. </view>
  29. <view class="top_bottom">
  30. <!-- 订单为系统派发请确认订单信息后再抢单 -->
  31. {{ typeInfo[orderDetail.order.type].content }}
  32. </view>
  33. <view class="top-button" :style="{ borderRadius: '27rpx' }">
  34. {{ typeInfo[orderDetail.order.type].title }}
  35. </view>
  36. </view>
  37. <view class="information box-size" :style="{ borderRadius: '16rpx' }">
  38. <view class="form-title">
  39. 基本信息
  40. </view>
  41. <view class="line1">
  42. </view>
  43. <view class="time">
  44. <view>
  45. 服务日期
  46. </view>
  47. <view v-if="orderDetail.order" class="time-content">
  48. {{ getTextList().join(',') }}
  49. </view>
  50. </view>
  51. <view class="line1">
  52. </view>
  53. <view class="time">
  54. <view>
  55. 服务地址
  56. </view>
  57. <view class="time-content">
  58. {{ orderDetail.order?.address }}
  59. </view>
  60. </view>
  61. </view>
  62. <view class="service box-size" :style="{ borderRadius: '8rpx' }">
  63. <view class="horizontal_distribution service_top">
  64. <view class="form-title">
  65. 服务内容和酬劳
  66. </view>
  67. <view @click="petInfo" class="text2 flex">
  68. 查看宠物信息
  69. <u-icon name="arrow-right-double" color="#F5F5F5" size="10"></u-icon>
  70. </view>
  71. </view>
  72. <view class="line1">
  73. </view>
  74. <view v-for="pet in orderDetail.order.h5OrderVO.petVOList"
  75. @click="toDetail(pet.id)"
  76. :key="pet.id" class="pet_information box-size">
  77. <view class="flex pet_item box-size">
  78. <view class="img" :style="{borderRadius:'100rpx'}">
  79. <image :src="pet.photo" mode=""></image>
  80. </view>
  81. <view >
  82. <view class="flex name">
  83. <view class="name_text">
  84. {{ pet.breed }}
  85. </view>
  86. <image src="" mode=""></image>
  87. </view>
  88. {{ pet.type }}{{ pet.bodyType }}
  89. </view>
  90. </view>
  91. <view class="pet-level" v-for="(it, i) in pet.productNameText">
  92. {{ it.time }}
  93. <text>{{ it.name }}</text>
  94. 上门1次
  95. </view>
  96. <!-- <view class="pet-level">
  97. 12-15
  98. <text>专业喂养</text>
  99. 上门1次
  100. </view> -->
  101. </view>
  102. <view class="line1">
  103. </view>
  104. <view class="flex money_total">
  105. <view>
  106. 合计
  107. </view>
  108. <view class="money_text">
  109. ¥&nbsp;{{ orderDetail.order.price }}
  110. </view>
  111. </view>
  112. </view>
  113. <view class="other_information box-size">
  114. <view class="form-title">
  115. 其他信息
  116. </view>
  117. <view class="line1">
  118. </view>
  119. <view class="horizontal_distribution text3">
  120. <view>
  121. 订单编号
  122. </view>
  123. <view>
  124. {{ orderDetail.order.orderSn }}
  125. </view>
  126. </view>
  127. <view class="line1">
  128. </view>
  129. <view class="horizontal_distribution text3">
  130. <view>
  131. 下单时间
  132. </view>
  133. <view>
  134. {{ orderDetail.order?.createTime }}
  135. </view>
  136. </view>
  137. <view class="line1">
  138. </view>
  139. <view class="horizontal_distribution text3">
  140. <view>
  141. 支付时间
  142. </view>
  143. <view>
  144. {{ orderDetail.order.payTime }}
  145. </view>
  146. </view>
  147. </view>
  148. </view>
  149. <view class="bottom">
  150. <view @click="rushToBuyAnOrder" class="bottom_button level" :style="{ borderRadius: '41rpx' }">
  151. 立即抢单
  152. </view>
  153. </view>
  154. <up-popup :show="showConfirmOrder" mode="bottom" @close="close" @open="open" :round="10" :closeable="true"
  155. :safeAreaInsetBottom="false"
  156. :customStyle="{padding:'60rpx 20rpx 40rpx 20rpx;position:relative;height:auto;background:#F6F5F8;'}">
  157. <view>
  158. <view style="position:absolute;top: 20rpx;left:0;text-align: center;width: 100%;">
  159. 订单信息
  160. </view>
  161. <view style="text-align: center;">
  162. 请全部确认后接单
  163. </view>
  164. <view class="order-confirmation">
  165. <view class="confirmation-item">
  166. <view class="confirmation-base">
  167. <view class="title">
  168. 服务日期
  169. </view>
  170. <view class="desc">
  171. {{ getTextList().length }}:{{ getTextList().join(',') }}
  172. </view>
  173. </view>
  174. <view class="ok">
  175. <view class="btn" @click="handleConfirm(0)" :class="{ 'btn-confirmed': confirmStatus[0] }">
  176. {{ confirmStatus[0] ? '已确认' : '点击确定' }}
  177. </view>
  178. </view>
  179. </view>
  180. <view class="confirmation-item">
  181. <view class="confirmation-base">
  182. <view class="title">
  183. 服务地址
  184. </view>
  185. <view class="desc">
  186. {{ orderDetail.order.address }}
  187. </view>
  188. </view>
  189. <view class="ok">
  190. <view class="btn" @click="handleConfirm(1)" :class="{ 'btn-confirmed': confirmStatus[1] }">
  191. {{ confirmStatus[1] ? '已确认' : '点击确定' }}
  192. </view>
  193. </view>
  194. </view>
  195. <view class="confirmation-item">
  196. <view class="confirmation-base">
  197. <view class="title">
  198. 服务宠物
  199. </view>
  200. <view class="desc">
  201. <view v-for="pet in orderDetail.order.h5OrderVO.petVOList" :key="pet.id">
  202. {{ pet.breed }}
  203. </view>
  204. </view>
  205. </view>
  206. <view class="ok">
  207. <view class="btn" @click="handleConfirm(2)" :class="{ 'btn-confirmed': confirmStatus[2] }">
  208. {{ confirmStatus[2] ? '已确认' : '点击确定' }}
  209. </view>
  210. </view>
  211. </view>
  212. </view>
  213. <view class="handbook">
  214. 接单即接受
  215. <text class="text" @click="configPopupRef.open('pet_platform_introduction')">伴宠师手册</text>
  216. </view>
  217. <up-button @click="conform" color="#FFBF60" text="确定" shape="circle"></up-button>
  218. </view>
  219. </up-popup>
  220. <!-- 抢单成功 -->
  221. <up-popup :show="showOrderSuccess" mode="center" @close="orderSuccessClose" @open="orderSuccessOpen" :zIndex="999"
  222. :round="10" :safeAreaInsetBottom="false" :customStyle="{ width:'80%' , 'background-color': 'transparent' }">
  223. <view>
  224. <image style="width: 100%;" :src="configList?.order_success?.paramValueImage" mode="widthFix"></image>
  225. </view>
  226. <view style="margin-top: -100%;padding: 40rpx;20rpx">
  227. <view class="success-desc">
  228. {{ configList?.order_success?.paramValueText || '请立即添加服务顾问,并提供订单编码' }}
  229. </view>
  230. <view style="position: relative;z-index: 999;" class="qr-code">
  231. <image class="code-img" src="https://img.xjishu.com/img/zl/2018/6/30/1241359458913.gif"
  232. mode="aspectFill"></image>
  233. </view>
  234. <view class="input">
  235. <up-input placeholder="" border="none" v-model="value" disabled
  236. :customStyle="{height:'60rpx','text-indent': '20rem', 'background-color': '#F3F3F3', position : 'relative','z-index' : '999' }"></up-input>
  237. </view>
  238. <view class="button-group">
  239. <up-button @click="noneOrder" color="#FFBF60" text="复制订单编号" shape="circle"></up-button>
  240. <up-button @click="toMyOrder" color="#FFBF60" text="到我的订单查看" shape="circle" style="margin-top: 20rpx;"></up-button>
  241. </view>
  242. </view>
  243. </up-popup>
  244. <configPopup ref="configPopupRef" />
  245. </template>
  246. <script setup>
  247. import {
  248. ref,
  249. computed
  250. } from 'vue'
  251. import {
  252. onLoad
  253. } from '@dcloudio/uni-app'
  254. import {
  255. getByOrderId
  256. } from "@/api/receivingHall/index.js"
  257. import {
  258. onShow
  259. } from '@dcloudio/uni-app'
  260. import order from '../../../api/order/order'
  261. import {
  262. startByOrderId
  263. } from "@/api/receivingHall/index.js"
  264. import {
  265. useStore
  266. } from "vuex"
  267. import dayjs from "dayjs";
  268. import configPopup from '@/components/configPopup.vue'
  269. const configPopupRef = ref(null)
  270. onLoad((options) => {
  271. orderId.value = options.id || null;
  272. });
  273. onShow(() => {
  274. getDetail();
  275. })
  276. const store = useStore();
  277. const orderId = ref(null);
  278. const orderDetail = ref({});
  279. const showConfirmOrder = ref(false);
  280. const showOrderSuccess = ref(false);
  281. const value = ref("45619491656")
  282. const petList = ref([])
  283. const confirmStatus = ref([false, false, false]); // 添加确认状态数组,分别对应三个确认项
  284. const userInfo = computed(() => {
  285. return store.getters.userInfo
  286. })
  287. const configList = computed(() => {
  288. return store.getters.configList;
  289. })
  290. // 抢单
  291. const rushToBuyAnOrder = () => {
  292. open()
  293. }
  294. const typeInfo = [
  295. {
  296. title : '系统派单',
  297. content : '订单为系统派发,请确认订单信息后再抢单',
  298. },
  299. {
  300. title : '个人订单',
  301. content : '订单为系统派发,请确认订单信息后再抢单',
  302. },
  303. {
  304. title : '流失订单',
  305. content : '订单为系统派发,请确认订单信息后再抢单',
  306. },
  307. ]
  308. // 查看宠物信息
  309. const petInfo = () => {
  310. uni.navigateTo({
  311. url: "/otherPages/orderTakingManage/pet/index"
  312. })
  313. }
  314. const open = () => {
  315. showConfirmOrder.value = true;
  316. }
  317. const close = () => {
  318. showConfirmOrder.value = false;
  319. }
  320. const orderSuccessClose = () => {
  321. showOrderSuccess.value = false;
  322. };
  323. const orderSuccessOpen = () => {
  324. showOrderSuccess.value = true;
  325. };
  326. // 处理确认按钮点击事件
  327. const handleConfirm = (index) => {
  328. confirmStatus.value[index] = true;
  329. }
  330. const conform = async () => {
  331. close();
  332. // 重置确认状态
  333. confirmStatus.value = [false, false, false];
  334. let response = await startByOrderId({
  335. id: orderId.value,
  336. userId: userInfo.value.userId
  337. })
  338. if (response.code == 200 && response.data) {
  339. uni.showToast({
  340. title: '接单成功~',
  341. icon: "none"
  342. });
  343. orderSuccessOpen();
  344. }
  345. }
  346. const getDetail = async () => {
  347. let response = await getByOrderId({
  348. id: orderId.value,
  349. userId: userInfo.value.userId,
  350. });
  351. if (response.code == 200 && response.data) {
  352. orderDetail.value = response.data;
  353. orderDetail.value.order.h5OrderVO.petVOList.forEach(pet => {
  354. pet.productNameText = getProductNameText(pet.id, orderDetail.value.order.h5OrderVO.orderItemList,
  355. orderDetail.value.order.h5OrderVO.orderServiceList)
  356. })
  357. }
  358. }
  359. function getOrderServiceText(petId, orderServiceList){
  360. let YYYY = undefined
  361. return orderServiceList
  362. .filter(service => service.petId == petId)//过滤
  363. .map(service => dayjs(service.serviceDate))//转成时间
  364. .sort((a, b) => a.valueOf() - b.valueOf())//排序
  365. .map((service, i) => {
  366. // if(YYYY && YYYY.format('YYYY-MM') == service.format('YYYY-MM')){
  367. // return service.format('DD')
  368. // }
  369. // if(YYYY && YYYY.format('YYYY') == service.format('YYYY')){
  370. // return service.format('MM-DD')
  371. // }
  372. // YYYY = service
  373. return service.format('MM-DD')
  374. })
  375. }
  376. function getProductNameText(petId, productList, orderServiceList){
  377. let orderService = orderServiceList.filter(service => service.petId == petId)
  378. // return productList
  379. // .filter(product => orderService.filter(service => service.id == product.orderServiceId).length > 0)
  380. // .map(product => {
  381. // return {
  382. // time : dayjs(orderService.filter(service => service.id == product.orderServiceId)
  383. // .serviceDate).format('MM-DD'),
  384. // name : product.productName,
  385. // }
  386. // })
  387. return orderService.map(item => {
  388. let name = ''
  389. productList.forEach(product => {
  390. if(item.id == product.orderServiceId){
  391. name = product.productName
  392. }
  393. })
  394. return {
  395. time : dayjs(item.serviceDate).format('MM-DD'),
  396. name,
  397. }
  398. })
  399. }
  400. function getTextList(){
  401. return orderDetail.value.order?.h5OrderVO
  402. .orderServiceList.map(item =>
  403. dayjs(item.serviceDate).format('MM-DD'))
  404. }
  405. const toDetail = (id) => {
  406. uni.navigateTo({
  407. url: `/otherPages/orderTakingManage/pet/detail?id=${id}`
  408. })
  409. }
  410. // 复制订单编号
  411. const noneOrder = () => {
  412. uni.setClipboardData({
  413. data: orderDetail.value.order.orderSn,
  414. success: function() {
  415. uni.showToast({
  416. title: '复制成功',
  417. icon: 'none'
  418. });
  419. }
  420. });
  421. }
  422. // 跳转到我的订单页面
  423. const toMyOrder = () => {
  424. orderSuccessClose();
  425. uni.navigateTo({
  426. url: '/pages/myOrdersManage/list/index'
  427. });
  428. }
  429. </script>
  430. <style scoped lang="scss">
  431. @import "index";
  432. .line1 {
  433. position: relative;
  434. margin: 10rpx 0 20rpx 0;
  435. &::before {
  436. position: absolute;
  437. top: 10rpx;
  438. left: -10rpx;
  439. content: "";
  440. width: 690rpx;
  441. height: 0.5rpx;
  442. background-color: #EFEFEF;
  443. // background-color: red;
  444. }
  445. }
  446. .time-content {
  447. max-height: 120rpx;
  448. overflow-y: auto;
  449. word-break: break-word;
  450. line-height: 1.5;
  451. padding: 4rpx 0;
  452. }
  453. .order-confirmation {
  454. .confirmation-item {
  455. display: flex;
  456. justify-content: space-between;
  457. align-items: center;
  458. background: white;
  459. padding: 20rpx;
  460. border-radius: 20rpx;
  461. overflow: hidden;
  462. margin: 20rpx 0rpx;
  463. .confirmation-base {
  464. width: 75%;
  465. .title {
  466. font-size: 34rpx;
  467. }
  468. .desc {
  469. color: #999999;
  470. }
  471. }
  472. .ok {
  473. display: flex;
  474. justify-content: center;
  475. width: 25%;
  476. .btn {
  477. display: flex;
  478. align-items: center;
  479. justify-content: center;
  480. background: #FFBF60;
  481. color: white;
  482. width: 100%;
  483. height: 60rpx;
  484. border-radius: 30rpx;
  485. }
  486. }
  487. }
  488. }
  489. .handbook {
  490. color: #999999;
  491. margin: 10rpx 0rpx;
  492. .text {
  493. color: #FFBF60;
  494. }
  495. }
  496. .success-desc {
  497. text-align: center;
  498. color: #787878;
  499. font-size: 32rpx;
  500. }
  501. .qr-code {
  502. display: flex;
  503. justify-content: center;
  504. margin: 40rpx 0rpx;
  505. .code-img {
  506. width: 160rpx;
  507. height: 160rpx;
  508. }
  509. }
  510. .input {
  511. margin-bottom: 40rpx;
  512. }
  513. .button-group {
  514. display: flex;
  515. flex-direction: column;
  516. gap: 20rpx;
  517. }
  518. .btn-confirmed {
  519. background: #CCCCCC !important; /* 灰色背景 */
  520. }
  521. </style>