order_detail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. <template>
  2. <view class="verification-container">
  3. <!-- 内容区域 -->
  4. <view class="content">
  5. <!-- 用户信息卡片 -->
  6. <view class="info-card1">
  7. <view class="address-item">
  8. <view class="img-status-text">
  9. <image src="/static/img/icon-send.png" mode="" class="img"></image>
  10. <!-- <view class="status-text">{{getStatusText}}</view> -->
  11. </view>
  12. <view class="user-info">
  13. <AddressInfo :address="addressSend"/>
  14. </view>
  15. </view>
  16. <view class="address-item">
  17. <view class="img-status-text">
  18. <image src="/static/img/icon-receive.png" mode="" class="img"></image>
  19. <!-- <view class="status-text">{{getStatusText}}</view> -->
  20. </view>
  21. <view class="user-info">
  22. <AddressInfo :address="addressReceive"/>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="action-title">运单信息</view>
  27. <OrderInfo :order-detail="orderInfo"></OrderInfo>
  28. <view class="action-title">费用信息</view>
  29. <OrderFeesInfo :order-detail="orderInfo"/>
  30. </view>
  31. </view>
  32. </template>
  33. <script setup>
  34. import {
  35. ref,
  36. computed
  37. } from 'vue'
  38. import {
  39. onLoad,
  40. onShow
  41. } from '@dcloudio/uni-app'
  42. import OrderInfo from './components/OrderInfo.vue'
  43. import OrderFeesInfo from './components/OrderFeesInfo.vue'
  44. import AddressInfo from '@/components/AddressInfo.vue'
  45. import {
  46. useAppStore
  47. } from '@/stores/app'
  48. const appStore = useAppStore()
  49. const shopOrderId = ref('')
  50. const addressSend = ref({
  51. id: 1,
  52. name: '张三',
  53. phone: '132****5678',
  54. address: '广东省深圳市罗湖区贝丽北路广东省深圳市罗湖区贝丽北路广东省深圳市罗湖区贝丽北路广东省深圳市罗湖区贝丽北路广东省深圳市罗湖区贝丽北路广东省深圳市罗湖区贝丽北路97号',
  55. isDefault: true
  56. })
  57. const addressReceive = ref({
  58. id: 1,
  59. name: '张三',
  60. phone: '132****5678',
  61. address: '广东省深圳市罗湖区贝丽北路广东省深圳市罗湖区贝丽北路广东省深圳市罗湖区贝丽北路广东省深圳市罗湖区贝丽北路广东省深圳市罗湖区贝丽北路广东省深圳市罗湖区贝丽北路97号',
  62. isDefault: true
  63. })
  64. const orderInfo = ref({
  65. createTime: null,
  66. goodsInfo: null,
  67. goodsMainImage: null,
  68. goodsName: "",
  69. serviceAvatar: null,
  70. serviceBelongShop: "",
  71. serviceCommission: "",
  72. serviceName: "",
  73. servicePhone: "",
  74. shopOrderAmount: "",
  75. shopOrderId: "",
  76. shopOrderNum: 1,
  77. userName: "",
  78. userPhone: "",
  79. dispatchInfo: {},
  80. goodsInfo: {},
  81. grabInfo: {},
  82. userInfo: {}
  83. })
  84. const showOrderCofirmBtn = ref(false)
  85. const showOrderDispatchBtn = ref(false)
  86. const showOrderRefundBtn = ref(false)
  87. const showCallUserBtn = ref(true)
  88. onLoad((option) => {
  89. shopOrderId.value = option.id
  90. })
  91. onShow(() => {
  92. // getOrderInfo()
  93. })
  94. const getOrderInfo = () => {
  95. const param = {
  96. shopOrderId: shopOrderId.value
  97. }
  98. getOrderInfoApi(param).then(res => {
  99. if (res.code == 200) {
  100. console.log('getOrderInfoApi=========', res)
  101. orderInfo.value = res.data
  102. }
  103. })
  104. }
  105. // 返回按钮点击事件
  106. const handleBack = () => {
  107. uni.navigateBack()
  108. }
  109. // 确认核销按钮点击事件
  110. const handleVerification = () => {
  111. uni.showModal({
  112. title: '确认核销',
  113. content: '确定要核销此订单吗?',
  114. success: (res) => {
  115. if (res.confirm) {
  116. uni.showToast({
  117. title: '核销成功',
  118. icon: 'success'
  119. })
  120. // 这里可以添加核销成功的后续逻辑
  121. }
  122. }
  123. })
  124. }
  125. const makePhoneCall = (phoneNum) => {
  126. // 这里以拨打10086为例,实际使用时可以替换为动态获取的电话号码
  127. uni.makePhoneCall({
  128. phoneNumber: phoneNum, // 电话号码
  129. success: () => {
  130. console.log('拨打电话成功')
  131. },
  132. fail: (err) => {
  133. console.log('拨打电话失败:', err)
  134. }
  135. })
  136. }
  137. //确认订单是去派单状态
  138. const updateOrderDispatch = () => {
  139. if (!appStore.userInfo.orderDispatch) {
  140. uni.showToast({
  141. title: "当前会员不能使用此功,请升级为SVIP会员",
  142. icon: "none"
  143. })
  144. return
  145. }
  146. uni.showModal({
  147. title: '去派单',
  148. content: '是否确认去派单?',
  149. success: (res) => {
  150. if (res.confirm) {
  151. const params = {
  152. shopOrderId: orderInfo.value.shopOrderId,
  153. dispatchVerifyStatus: "0"
  154. }
  155. updateOrderDispatchApi(params).then(res => {
  156. if (res.code == 200) {
  157. uni.showToast({
  158. title: '操作成功',
  159. icon: 'success'
  160. })
  161. uni.navigateBack()
  162. }
  163. })
  164. }
  165. }
  166. })
  167. }
  168. //直接核销订单
  169. const updateOrderVerify = () => {
  170. const params = {
  171. shopOrderId: orderInfo.value.shopOrderId
  172. }
  173. updateOrderVerifyApi(params).then(res => {
  174. if (res.code == 200) {
  175. uni.showToast({
  176. title: '操作成功',
  177. icon: 'success'
  178. })
  179. uni.navigateBack()
  180. }
  181. })
  182. }
  183. //0 待服务 1 服务中 2 服务完成 3 待接单
  184. const startServe = () => {
  185. // 在实际UniApp项目中,使用以下代码:
  186. uni.scanCode({
  187. success: (res) => {
  188. console.log(res, '=============scanCode==startServe=')
  189. if (res.result == orderInfo.value.shopOrderId) {
  190. //这里判断 grabId 是否相同 相同的话直接更新
  191. updateOrderVerify()
  192. } else {
  193. uni.showModal({
  194. content: "服务订单与扫码订单不一致",
  195. confirmText: "确认",
  196. showCancel: false
  197. })
  198. }
  199. },
  200. fail: (err) => {
  201. uni.showToast({
  202. title: '扫码失败',
  203. icon: 'none'
  204. })
  205. }
  206. })
  207. }
  208. const handleOrderRefund = (status) => {
  209. if (status == '2') {
  210. uni.showModal({
  211. title: '拒绝退款',
  212. content: '是否确认拒绝退款?',
  213. success: (res) => {
  214. if (res.confirm) {
  215. updateOrderRefund(status)
  216. }
  217. }
  218. })
  219. return
  220. }
  221. uni.showModal({
  222. title: '确认退款',
  223. content: '是否确认退款?',
  224. success: (res) => {
  225. if (res.confirm) {
  226. updateOrderRefundSure(status)
  227. }
  228. }
  229. })
  230. }
  231. //处理退款订单 0 待审核 1 审核通过 2 审核拒绝
  232. const updateOrderRefundSure = (status) => {
  233. const params = {
  234. shopOrderId: orderInfo.value.shopOrderId
  235. }
  236. updateOrderRefundSureApi(params).then(res => {
  237. if (res.code == 200) {
  238. uni.showToast({
  239. title: '操作成功',
  240. icon: 'success'
  241. })
  242. uni.navigateBack()
  243. // emit('success');
  244. }
  245. })
  246. }
  247. //处理退款订单 0 待审核 1 审核通过 2 审核拒绝
  248. const updateOrderRefund = (status) => {
  249. const params = {
  250. shopOrderId: orderInfo.value.shopOrderId,
  251. reviewResult: status
  252. }
  253. updateOrderRefundApi(params).then(res => {
  254. if (res.code == 200) {
  255. uni.showToast({
  256. title: '操作成功',
  257. icon: 'success'
  258. })
  259. uni.navigateBack()
  260. }
  261. })
  262. }
  263. // 发布抢单
  264. const publishOrder = () => {
  265. uni.navigateTo({
  266. url: '/pages/dispatchOrders/publishOrder?id=' + orderInfo.value.shopOrderId
  267. })
  268. }
  269. // 直接派单
  270. const assignOrder = () => {
  271. uni.navigateTo({
  272. url: '/pages/dispatchOrders/dispatch?id=' + orderInfo.value.shopOrderId
  273. })
  274. }
  275. const reSetBtnStatus = () => {
  276. showOrderCofirmBtn.value = false
  277. showOrderDispatchBtn.value = false
  278. showOrderRefundBtn.value = false
  279. showCallUserBtn.value = false
  280. }
  281. //orderType: 订单类型(1-全部订单, 2-待确认, 3-待核销, 4-已完成, 5-申请退款, 6-服务中)
  282. const getStatusText = computed(() => {
  283. // shop_order_status 商品订单状态(0 待支付 1 待使用 2 退款中 3 退款成功 4 退款失败 5 服务完成)
  284. // shop_evaluate_status 评价状态(0 待评价 1 已评价)
  285. // shop_refund_review_status 订单退款审核状态(0 待审核 1 审核通过 2 审核拒绝)
  286. // shop_service_status 服务状态:0=待服务,1=正在服务中,2=服务完成
  287. // shop_confirm_status 确认状态:0=待确认,1=已确认
  288. // shop_dispatch_verify_status 派单核销状态:0=待派单,1=待核销,2=已派单,3=已核销
  289. //dispatchInfo.shopOrderServiceStatus 0 待派单 1 已派单 2 待抢单 3 已抢单
  290. reSetBtnStatus()
  291. if (orderInfo.value.shopOrderStatus == '2') {
  292. showOrderRefundBtn.value = true
  293. return '申请退款'
  294. }
  295. if (orderInfo.value.shopOrderStatus == '3') {
  296. showCallUserBtn.value = true
  297. return '退款成功'
  298. }
  299. if (orderInfo.value.shopOrderStatus == '4') {
  300. showCallUserBtn.value = true
  301. return '退款失败'
  302. }
  303. if (orderInfo.value.shopOrderStatus == '0') {
  304. showCallUserBtn.value = true
  305. return '待支付'
  306. }
  307. if (orderInfo.value.shopConfirmStatus == '0') {
  308. showOrderCofirmBtn.value = true
  309. return '待确认'
  310. }
  311. if (orderInfo.value.shopOrderStatus == '5') {
  312. if (orderInfo.value.shopEvaluateStatus == '0') {
  313. showCallUserBtn.value = true
  314. return '待评价'
  315. }
  316. if (orderInfo.value.shopEvaluateStatus == '1') {
  317. showCallUserBtn.value = true
  318. return '已评价'
  319. }
  320. return '服务完成'
  321. }
  322. //orderDetail.shopConfirmStatus == '1' 的时候才会有下边的状态值
  323. if (orderInfo.value.shopOrderStatus == '1' && orderInfo.value.shopConfirmStatus == '1') {
  324. if (orderInfo.value.dispatchInfo && orderInfo.value.dispatchInfo.shopOrderServiceStatus == '2') {
  325. showCallUserBtn.value = true
  326. return '待抢单'
  327. }
  328. if (orderInfo.value.dispatchInfo && orderInfo.value.dispatchInfo.shopOrderServiceStatus == '3') {
  329. showCallUserBtn.value = true
  330. return '已抢单'
  331. }
  332. switch (orderInfo.value.shopDispatchVerifyStatus) {
  333. case '0':
  334. //这里需要看下是否是有会员 派单权限
  335. showOrderDispatchBtn.value = true
  336. return '待派单' // 待派单
  337. case '1':
  338. showCallUserBtn.value = true
  339. return '待核销' // 待核销
  340. case '2':
  341. showCallUserBtn.value = true
  342. return '已派单' // 已派单
  343. case '3':
  344. showCallUserBtn.value = true
  345. return '已核销' // 已核销
  346. }
  347. return '待使用'
  348. }
  349. })
  350. </script>
  351. <style lang="scss" scoped>
  352. .verification-container {
  353. min-height: 100vh;
  354. background-color: #F5F7FA;
  355. position: relative;
  356. padding-bottom: 140rpx;
  357. /* 为底部固定按钮预留空间 */
  358. .content {
  359. padding: 20rpx;
  360. }
  361. .verification-status {
  362. height: 72rpx;
  363. background: #FFF7EC;
  364. border-radius: 16rpx 16rpx 16rpx 16rpx;
  365. align-items: center;
  366. display: flex;
  367. padding-left: 16rpx;
  368. image {
  369. width: 28rpx;
  370. height: 28rpx;
  371. }
  372. .status-text {
  373. margin-left: 8rpx;
  374. height: 40rpx;
  375. font-weight: 400;
  376. font-size: 24rpx;
  377. color: #FFAF41;
  378. line-height: 40rpx;
  379. }
  380. }
  381. .action-title {
  382. height: 48rpx;
  383. font-weight: bold;
  384. font-size: 32rpx;
  385. color: #333333;
  386. line-height: 48rpx;
  387. margin: 20rpx 0rpx;
  388. }
  389. .info-card1 {
  390. background: #fff;
  391. border-radius: 32rpx;
  392. padding: 20rpx;
  393. margin-bottom: 16rpx;
  394. // F1F3F8
  395. .address-item{
  396. display: flex;
  397. &:first-child {
  398. border-bottom: 2rpx solid #F1F3F8;
  399. padding-bottom: 20rpx;
  400. }
  401. &:last-child {
  402. padding-top: 20rpx;
  403. }
  404. }
  405. .user-info {
  406. flex: 1;
  407. margin-left: 26rpx;
  408. }
  409. .img-status-text {
  410. align-self: center;
  411. text-align: center;
  412. flex-shrink: 0;
  413. .img {
  414. width: 56rpx;
  415. height: 56rpx;
  416. }
  417. .status-text {
  418. font-size: 24rpx;
  419. color: #0089FF;
  420. font-size: 500;
  421. }
  422. }
  423. }
  424. .info-card {
  425. background-color: #ffffff;
  426. border-radius: 16rpx;
  427. overflow: hidden;
  428. padding: 16rpx;
  429. margin-top: 16rpx;
  430. .card-header {
  431. display: flex;
  432. align-items: center;
  433. image {
  434. width: 35rpx;
  435. height: 35rpx;
  436. }
  437. .card-title {
  438. height: 48rpx;
  439. line-height: 48rpx;
  440. font-weight: 400;
  441. font-size: 32rpx;
  442. font-weight: bold;
  443. color: #333;
  444. margin-left: 10rpx;
  445. }
  446. }
  447. }
  448. .verification-card-body {
  449. display: flex;
  450. flex-direction: column;
  451. align-items: center;
  452. justify-content: center;
  453. image {
  454. margin-top: 16rpx;
  455. width: 320rpx;
  456. height: 320rpx;
  457. }
  458. }
  459. .verification-code {
  460. padding: 20rpx 0;
  461. display: flex;
  462. align-items: center;
  463. .code-label {
  464. font-size: 28rpx;
  465. color: #666;
  466. }
  467. .code-value {
  468. font-size: 32rpx;
  469. color: #333;
  470. font-weight: bold;
  471. }
  472. }
  473. .fixed-footer {
  474. position: fixed;
  475. bottom: 0;
  476. left: 0;
  477. right: 0;
  478. background-color: #ffffff;
  479. box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.1);
  480. .footer-buttons {
  481. display: flex;
  482. justify-content: center;
  483. padding: 22rpx;
  484. .back {
  485. width: 238rpx;
  486. height: 88rpx;
  487. background: rgba(0, 137, 255, 0.1);
  488. border-radius: 8rpx 8rpx 8rpx 8rpx;
  489. font-family: PingFang SC, PingFang SC;
  490. font-weight: 400;
  491. font-size: 32rpx;
  492. color: #0089FF;
  493. line-height: 88rpx;
  494. text-align: center;
  495. }
  496. .confirm {
  497. width: 416rpx;
  498. height: 88rpx;
  499. margin-left: 32rpx;
  500. align-items: center;
  501. background: #0089FF;
  502. border-radius: 16rpx 16rpx 16rpx 16rpx;
  503. font-family: PingFang SC Bold, PingFang SC Bold;
  504. font-weight: 400;
  505. font-size: 32rpx;
  506. color: #FFFFFF;
  507. line-height: 88rpx;
  508. text-align: center;
  509. }
  510. .call {
  511. width: 327rpx;
  512. height: 88rpx;
  513. border-radius: 16rpx 16rpx 16rpx 16rpx;
  514. font-family: PingFang SC, PingFang SC;
  515. font-weight: 400;
  516. font-size: 32rpx;
  517. line-height: 88rpx;
  518. text-align: center;
  519. }
  520. .call-user {
  521. width: 100%;
  522. height: 88rpx;
  523. border-radius: 16rpx 16rpx 16rpx 16rpx;
  524. font-family: PingFang SC, PingFang SC;
  525. font-weight: 400;
  526. font-size: 32rpx;
  527. line-height: 88rpx;
  528. text-align: center;
  529. background: #0089FF;
  530. color: #FFFFFF;
  531. margin: 0rpx 32rpx;
  532. }
  533. .shop {
  534. background: rgba(0, 137, 255, 0.1);
  535. color: #0089FF;
  536. }
  537. .user {
  538. margin-left: 32rpx;
  539. background: #0089FF;
  540. color: #FFFFFF;
  541. }
  542. }
  543. }
  544. }
  545. </style>