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

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