猫妈狗爸伴宠师小程序前端代码
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.

584 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 v-if="showSecondButton" @click="toMyOrder" color="#FFBF60" text="到我的订单查看" shape="circle"></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 showSecondButton = ref(false); // 控制第二个按钮的显示
  285. const userInfo = computed(() => {
  286. return store.getters.userInfo
  287. })
  288. const configList = computed(() => {
  289. return store.getters.configList;
  290. })
  291. // 抢单
  292. const rushToBuyAnOrder = () => {
  293. open()
  294. }
  295. const typeInfo = [
  296. {
  297. title : '系统派单',
  298. content : '订单为系统派发,请确认订单信息后再抢单',
  299. },
  300. {
  301. title : '个人订单',
  302. content : '订单为系统派发,请确认订单信息后再抢单',
  303. },
  304. {
  305. title : '流失订单',
  306. content : '订单为系统派发,请确认订单信息后再抢单',
  307. },
  308. ]
  309. // 查看宠物信息
  310. const petInfo = () => {
  311. uni.navigateTo({
  312. url: "/otherPages/orderTakingManage/pet/index"
  313. })
  314. }
  315. const open = () => {
  316. showConfirmOrder.value = true;
  317. }
  318. const close = () => {
  319. showConfirmOrder.value = false;
  320. }
  321. const orderSuccessClose = () => {
  322. showOrderSuccess.value = false;
  323. };
  324. const orderSuccessOpen = () => {
  325. showOrderSuccess.value = true;
  326. // 重置按钮显示状态,初始只显示复制订单编号按钮
  327. showSecondButton.value = false;
  328. };
  329. // 处理确认按钮点击事件
  330. const handleConfirm = (index) => {
  331. confirmStatus.value[index] = true;
  332. }
  333. const conform = async () => {
  334. if(confirmStatus.value.includes(false)){
  335. uni.showToast({
  336. title: '请点击确认',
  337. icon: "none"
  338. });
  339. return
  340. }
  341. close();
  342. // 重置确认状态
  343. confirmStatus.value = [false, false, false];
  344. let response = await startByOrderId({
  345. id: orderId.value,
  346. userId: userInfo.value.userId
  347. })
  348. if (response.code == 200 && response.data) {
  349. uni.showToast({
  350. title: '接单成功~',
  351. icon: "none"
  352. });
  353. orderSuccessOpen();
  354. }
  355. }
  356. const getDetail = async () => {
  357. let response = await getByOrderId({
  358. id: orderId.value,
  359. userId: userInfo.value.userId,
  360. });
  361. if (response.code == 200 && response.data) {
  362. orderDetail.value = response.data;
  363. orderDetail.value.order.h5OrderVO.petVOList.forEach(pet => {
  364. pet.productNameText = getProductNameText(pet.id, orderDetail.value.order.h5OrderVO.orderItemList,
  365. orderDetail.value.order.h5OrderVO.orderServiceList)
  366. })
  367. }
  368. }
  369. function getOrderServiceText(petId, orderServiceList){
  370. let YYYY = undefined
  371. return orderServiceList
  372. .filter(service => service.petId == petId)//过滤
  373. .map(service => dayjs(service.serviceDate))//转成时间
  374. .sort((a, b) => a.valueOf() - b.valueOf())//排序
  375. .map((service, i) => {
  376. // if(YYYY && YYYY.format('YYYY-MM') == service.format('YYYY-MM')){
  377. // return service.format('DD')
  378. // }
  379. // if(YYYY && YYYY.format('YYYY') == service.format('YYYY')){
  380. // return service.format('MM-DD')
  381. // }
  382. // YYYY = service
  383. return service.format('MM-DD')
  384. })
  385. }
  386. function getProductNameText(petId, productList, orderServiceList){
  387. let orderService = orderServiceList.filter(service => service.petId == petId)
  388. // return productList
  389. // .filter(product => orderService.filter(service => service.id == product.orderServiceId).length > 0)
  390. // .map(product => {
  391. // return {
  392. // time : dayjs(orderService.filter(service => service.id == product.orderServiceId)
  393. // .serviceDate).format('MM-DD'),
  394. // name : product.productName,
  395. // }
  396. // })
  397. return orderService.map(item => {
  398. let name = ''
  399. productList.forEach(product => {
  400. if(item.id == product.orderServiceId){
  401. name = product.productName
  402. }
  403. })
  404. return {
  405. time : dayjs(item.serviceDate).format('MM-DD'),
  406. name,
  407. }
  408. })
  409. }
  410. function getTextList(){
  411. return orderDetail.value.order?.h5OrderVO
  412. .orderServiceList.map(item =>
  413. dayjs(item.serviceDate).format('MM-DD'))
  414. }
  415. const toDetail = (id) => {
  416. uni.navigateTo({
  417. url: `/otherPages/orderTakingManage/pet/detail?id=${id}`
  418. })
  419. }
  420. // 复制订单编号
  421. const noneOrder = () => {
  422. uni.setClipboardData({
  423. data: orderDetail.value.order.orderSn,
  424. success: function() {
  425. uni.showToast({
  426. title: '复制成功',
  427. icon: 'none'
  428. });
  429. // 点击复制按钮后显示第二个按钮
  430. showSecondButton.value = true;
  431. }
  432. });
  433. }
  434. // 跳转到我的订单页面
  435. const toMyOrder = () => {
  436. orderSuccessClose();
  437. uni.switchTab({
  438. url: '/pages/myOrdersManage/index'
  439. });
  440. }
  441. </script>
  442. <style scoped lang="scss">
  443. @import "index";
  444. .line1 {
  445. position: relative;
  446. margin: 10rpx 0 20rpx 0;
  447. &::before {
  448. position: absolute;
  449. top: 10rpx;
  450. left: -10rpx;
  451. content: "";
  452. width: 690rpx;
  453. height: 0.5rpx;
  454. background-color: #EFEFEF;
  455. // background-color: red;
  456. }
  457. }
  458. .time-content {
  459. max-height: 120rpx;
  460. overflow-y: auto;
  461. word-break: break-word;
  462. line-height: 1.5;
  463. padding: 4rpx 0;
  464. }
  465. .order-confirmation {
  466. .confirmation-item {
  467. display: flex;
  468. justify-content: space-between;
  469. align-items: center;
  470. background: white;
  471. padding: 20rpx;
  472. border-radius: 20rpx;
  473. overflow: hidden;
  474. margin: 20rpx 0rpx;
  475. .confirmation-base {
  476. width: 75%;
  477. .title {
  478. font-size: 34rpx;
  479. }
  480. .desc {
  481. color: #999999;
  482. }
  483. }
  484. .ok {
  485. display: flex;
  486. justify-content: center;
  487. width: 25%;
  488. .btn {
  489. display: flex;
  490. align-items: center;
  491. justify-content: center;
  492. background: #FFBF60;
  493. color: white;
  494. width: 100%;
  495. height: 60rpx;
  496. border-radius: 30rpx;
  497. }
  498. }
  499. }
  500. }
  501. .handbook {
  502. color: #999999;
  503. margin: 10rpx 0rpx;
  504. .text {
  505. color: #FFBF60;
  506. }
  507. }
  508. .success-desc {
  509. text-align: center;
  510. color: #787878;
  511. font-size: 32rpx;
  512. }
  513. .qr-code {
  514. display: flex;
  515. justify-content: center;
  516. margin: 40rpx 0rpx;
  517. .code-img {
  518. width: 160rpx;
  519. height: 160rpx;
  520. }
  521. }
  522. .input {
  523. margin-bottom: 40rpx;
  524. }
  525. .button-group {
  526. display: flex;
  527. align-items: center;
  528. gap: 20rpx;
  529. }
  530. .btn-confirmed {
  531. background: #CCCCCC !important; /* 灰色背景 */
  532. }
  533. </style>