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

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