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

537 lines
13 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">伴宠师手册</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. <up-button @click="noneOrder" color="#FFBF60" text="复制订单编号" shape="circle"></up-button>
  239. </view>
  240. </up-popup>
  241. </template>
  242. <script setup>
  243. import {
  244. ref,
  245. computed
  246. } from 'vue'
  247. import {
  248. onLoad
  249. } from '@dcloudio/uni-app'
  250. import {
  251. getByOrderId
  252. } from "@/api/receivingHall/index.js"
  253. import {
  254. onShow
  255. } from '@dcloudio/uni-app'
  256. import order from '../../../api/order/order'
  257. import {
  258. startByOrderId
  259. } from "@/api/receivingHall/index.js"
  260. import {
  261. useStore
  262. } from "vuex"
  263. import dayjs from "dayjs";
  264. onLoad((options) => {
  265. orderId.value = options.id || null;
  266. });
  267. onShow(() => {
  268. getDetail();
  269. })
  270. const store = useStore();
  271. const orderId = ref(null);
  272. const orderDetail = ref({});
  273. const showConfirmOrder = ref(false);
  274. const showOrderSuccess = ref(false);
  275. const value = ref("45619491656")
  276. const petList = ref([])
  277. const confirmStatus = ref([false, false, false]); // 添加确认状态数组,分别对应三个确认项
  278. const userInfo = computed(() => {
  279. return store.getters.userInfo
  280. })
  281. const configList = computed(() => {
  282. return store.getters.configList;
  283. })
  284. // 抢单
  285. const rushToBuyAnOrder = () => {
  286. open()
  287. }
  288. const typeInfo = [
  289. {
  290. title : '系统派单',
  291. content : '订单为系统派发,请确认订单信息后再抢单',
  292. },
  293. {
  294. title : '个人订单',
  295. content : '订单为系统派发,请确认订单信息后再抢单',
  296. },
  297. {
  298. title : '流失订单',
  299. content : '订单为系统派发,请确认订单信息后再抢单',
  300. },
  301. ]
  302. // 查看宠物信息
  303. const petInfo = () => {
  304. uni.navigateTo({
  305. url: "/otherPages/orderTakingManage/pet/index"
  306. })
  307. }
  308. const open = () => {
  309. showConfirmOrder.value = true;
  310. }
  311. const close = () => {
  312. showConfirmOrder.value = false;
  313. }
  314. const orderSuccessClose = () => {
  315. showOrderSuccess.value = false;
  316. };
  317. const orderSuccessOpen = () => {
  318. showOrderSuccess.value = true;
  319. };
  320. // 处理确认按钮点击事件
  321. const handleConfirm = (index) => {
  322. confirmStatus.value[index] = true;
  323. }
  324. const conform = async () => {
  325. close();
  326. // 重置确认状态
  327. confirmStatus.value = [false, false, false];
  328. let response = await startByOrderId({
  329. id: orderId.value,
  330. userId: userInfo.value.userId
  331. })
  332. if (response.code == 200 && response.data) {
  333. uni.showToast({
  334. title: '接单成功~',
  335. icon: "none"
  336. });
  337. orderSuccessOpen();
  338. }
  339. }
  340. const getDetail = async () => {
  341. let response = await getByOrderId({
  342. id: orderId.value,
  343. userId: userInfo.value.userId,
  344. });
  345. if (response.code == 200 && response.data) {
  346. orderDetail.value = response.data;
  347. orderDetail.value.order.h5OrderVO.petVOList.forEach(pet => {
  348. pet.productNameText = getProductNameText(pet.id, orderDetail.value.order.h5OrderVO.orderItemList,
  349. orderDetail.value.order.h5OrderVO.orderServiceList)
  350. })
  351. }
  352. }
  353. function getOrderServiceText(petId, orderServiceList){
  354. let YYYY = undefined
  355. return orderServiceList
  356. .filter(service => service.petId == petId)//过滤
  357. .map(service => dayjs(service.serviceDate))//转成时间
  358. .sort((a, b) => a.valueOf() - b.valueOf())//排序
  359. .map((service, i) => {
  360. // if(YYYY && YYYY.format('YYYY-MM') == service.format('YYYY-MM')){
  361. // return service.format('DD')
  362. // }
  363. // if(YYYY && YYYY.format('YYYY') == service.format('YYYY')){
  364. // return service.format('MM-DD')
  365. // }
  366. // YYYY = service
  367. return service.format('MM-DD')
  368. })
  369. }
  370. function getProductNameText(petId, productList, orderServiceList){
  371. let orderService = orderServiceList.filter(service => service.petId == petId)
  372. // return productList
  373. // .filter(product => orderService.filter(service => service.id == product.orderServiceId).length > 0)
  374. // .map(product => {
  375. // return {
  376. // time : dayjs(orderService.filter(service => service.id == product.orderServiceId)
  377. // .serviceDate).format('MM-DD'),
  378. // name : product.productName,
  379. // }
  380. // })
  381. return orderService.map(item => {
  382. let name = ''
  383. productList.forEach(product => {
  384. if(item.id == product.orderServiceId){
  385. name = product.productName
  386. }
  387. })
  388. return {
  389. time : dayjs(item.serviceDate).format('MM-DD'),
  390. name,
  391. }
  392. })
  393. }
  394. function getTextList(){
  395. return orderDetail.value.order?.h5OrderVO
  396. .orderServiceList.map(item =>
  397. dayjs(item.serviceDate).format('MM-DD'))
  398. }
  399. const toDetail = (id) => {
  400. uni.navigateTo({
  401. url: `/otherPages/orderTakingManage/pet/detail?id=${id}`
  402. })
  403. }
  404. </script>
  405. <style scoped lang="scss">
  406. @import "index";
  407. .line1 {
  408. position: relative;
  409. margin: 10rpx 0 20rpx 0;
  410. &::before {
  411. position: absolute;
  412. top: 10rpx;
  413. left: -10rpx;
  414. content: "";
  415. width: 690rpx;
  416. height: 0.5rpx;
  417. background-color: #EFEFEF;
  418. // background-color: red;
  419. }
  420. }
  421. .time-content {
  422. max-height: 120rpx;
  423. overflow-y: auto;
  424. word-break: break-word;
  425. line-height: 1.5;
  426. padding: 4rpx 0;
  427. }
  428. .order-confirmation {
  429. .confirmation-item {
  430. display: flex;
  431. justify-content: space-between;
  432. align-items: center;
  433. background: white;
  434. padding: 20rpx;
  435. border-radius: 20rpx;
  436. overflow: hidden;
  437. margin: 20rpx 0rpx;
  438. .confirmation-base {
  439. width: 75%;
  440. .title {
  441. font-size: 34rpx;
  442. }
  443. .desc {
  444. color: #999999;
  445. }
  446. }
  447. .ok {
  448. display: flex;
  449. justify-content: center;
  450. width: 25%;
  451. .btn {
  452. display: flex;
  453. align-items: center;
  454. justify-content: center;
  455. background: #FFBF60;
  456. color: white;
  457. width: 100%;
  458. height: 60rpx;
  459. border-radius: 30rpx;
  460. }
  461. }
  462. }
  463. }
  464. .handbook {
  465. color: #999999;
  466. margin: 10rpx 0rpx;
  467. .text {
  468. color: #FFBF60;
  469. }
  470. }
  471. .success-desc {
  472. text-align: center;
  473. color: #787878;
  474. font-size: 32rpx;
  475. }
  476. .qr-code {
  477. display: flex;
  478. justify-content: center;
  479. margin: 40rpx 0rpx;
  480. .code-img {
  481. width: 160rpx;
  482. height: 160rpx;
  483. }
  484. }
  485. .input {
  486. margin-bottom: 40rpx;
  487. }
  488. .btn-confirmed {
  489. background: #CCCCCC !important; /* 灰色背景 */
  490. }
  491. </style>