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

494 lines
11 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
2 months ago
2 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() }}
  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. 共两天:12-09,01-09
  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. xxx省xx市
  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 >
  199. 中华田园犬
  200. </view>
  201. <view >
  202. 中华田园犬2
  203. </view>
  204. </view>
  205. </view>
  206. <view class="ok">
  207. <view class="btn">
  208. 点击确定
  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 userInfo = computed(() => {
  278. return store.getters.userInfo
  279. })
  280. const configList = computed(() => {
  281. return store.getters.configList;
  282. })
  283. // 抢单
  284. const rushToBuyAnOrder = () => {
  285. open()
  286. }
  287. const typeInfo = [
  288. {
  289. title : '系统派单',
  290. content : '订单为系统派发,请确认订单信息后再抢单',
  291. },
  292. {
  293. title : '个人订单',
  294. content : '订单为系统派发,请确认订单信息后再抢单',
  295. },
  296. {
  297. title : '流失订单',
  298. content : '订单为系统派发,请确认订单信息后再抢单',
  299. },
  300. ]
  301. // 查看宠物信息
  302. const petInfo = () => {
  303. uni.navigateTo({
  304. url: "/otherPages/orderTakingManage/pet/index"
  305. })
  306. }
  307. const open = () => {
  308. showConfirmOrder.value = true;
  309. }
  310. const close = () => {
  311. showConfirmOrder.value = false;
  312. }
  313. const orderSuccessClose = () => {
  314. showOrderSuccess.value = false;
  315. };
  316. const orderSuccessOpen = () => {
  317. showOrderSuccess.value = true;
  318. };
  319. const conform = async () => {
  320. close();
  321. let response = await startByOrderId({
  322. id: orderId.value,
  323. userId: userInfo.value.userId
  324. })
  325. if (response.code == 200 && response.data) {
  326. uni.showToast({
  327. title: '接单成功~',
  328. icon: "none"
  329. });
  330. orderSuccessOpen();
  331. }
  332. }
  333. const getDetail = async () => {
  334. let response = await getByOrderId({
  335. id: orderId.value
  336. });
  337. if (response.code == 200 && response.data) {
  338. orderDetail.value = response.data;
  339. orderDetail.value.order.h5OrderVO.petVOList.forEach(pet => {
  340. pet.productNameText = getProductNameText(pet.id, orderDetail.value.order.h5OrderVO.orderItemList,
  341. orderDetail.value.order.h5OrderVO.orderServiceList)
  342. })
  343. }
  344. }
  345. function getOrderServiceText(petId, orderServiceList){
  346. let YYYY = undefined
  347. return orderServiceList
  348. .filter(service => service.petId == petId)//过滤
  349. .map(service => dayjs(service.serviceDate))//转成时间
  350. .sort((a, b) => a.valueOf() - b.valueOf())//排序
  351. .map((service, i) => {
  352. // if(YYYY && YYYY.format('YYYY-MM') == service.format('YYYY-MM')){
  353. // return service.format('DD')
  354. // }
  355. // if(YYYY && YYYY.format('YYYY') == service.format('YYYY')){
  356. // return service.format('MM-DD')
  357. // }
  358. // YYYY = service
  359. return service.format('MM-DD')
  360. })
  361. }
  362. function getProductNameText(petId, productList, orderServiceList){
  363. let orderService = orderServiceList.filter(service => service.petId == petId)
  364. return productList
  365. .filter(product => orderService.filter(service => service.id == product.orderServiceId).length > 0)
  366. .map(product => {
  367. return {
  368. time : dayjs(orderService.filter(service => service.id == product.orderServiceId)
  369. .serviceDate).format('MM-DD'),
  370. name : product.productName,
  371. }
  372. })
  373. }
  374. function getTextList(){
  375. return orderDetail.value.order?.h5OrderVO
  376. .orderServiceList.map(item =>
  377. dayjs(item.serviceDate).format('MM-DD')).join(',')
  378. }
  379. </script>
  380. <style scoped lang="scss">
  381. @import "index";
  382. .line1 {
  383. position: relative;
  384. margin: 10rpx 0 20rpx 0;
  385. &::before {
  386. position: absolute;
  387. top: 10rpx;
  388. left: -10rpx;
  389. content: "";
  390. width: 690rpx;
  391. height: 0.5rpx;
  392. background-color: #EFEFEF;
  393. // background-color: red;
  394. }
  395. }
  396. .order-confirmation {
  397. .confirmation-item {
  398. display: flex;
  399. justify-content: space-between;
  400. align-items: center;
  401. background: white;
  402. padding: 20rpx;
  403. border-radius: 20rpx;
  404. overflow: hidden;
  405. margin: 20rpx 0rpx;
  406. .confirmation-base {
  407. width: 75%;
  408. .title {
  409. font-size: 34rpx;
  410. }
  411. .desc {
  412. color: #999999;
  413. }
  414. }
  415. .ok {
  416. display: flex;
  417. justify-content: center;
  418. width: 25%;
  419. .btn {
  420. display: flex;
  421. align-items: center;
  422. justify-content: center;
  423. background: #FFBF60;
  424. color: white;
  425. width: 100%;
  426. height: 60rpx;
  427. border-radius: 30rpx;
  428. }
  429. }
  430. }
  431. }
  432. .handbook {
  433. color: #999999;
  434. margin: 10rpx 0rpx;
  435. .text {
  436. color: #FFBF60;
  437. }
  438. }
  439. .success-desc {
  440. text-align: center;
  441. color: #787878;
  442. font-size: 32rpx;
  443. }
  444. .qr-code {
  445. display: flex;
  446. justify-content: center;
  447. margin: 40rpx 0rpx;
  448. .code-img {
  449. width: 160rpx;
  450. height: 160rpx;
  451. }
  452. }
  453. .input {
  454. margin-bottom: 40rpx;
  455. }
  456. </style>