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.

order-confirm-receipt.vue 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <!-- 订单详情-确认收货 -->
  2. <template>
  3. <view class="card-box">
  4. <view class="as-layout-horizontal as-gravity-center-start title">
  5. <image :src="`${$imgUrl}order/icon-star-green.png`" class="icon"></image>
  6. <text class="txt-title">{{ state.orderInfo.productName }}</text>
  7. </view>
  8. <view style="border-bottom: 1px solid #dcdcdc" />
  9. <!-- 订单信息 -->
  10. <view class="order-box">
  11. <view class="order-item" v-for="(item, index) in state.list" :key="index">
  12. <order-info-item :label="item.label" :value="item.value"></order-info-item>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="hint">请核对实收货物与上述货物编号是否一致!</view>
  17. <view class="btn">
  18. <submit-button title="确认收货" @submit="$util.confirm('是否确认收到货?', confirmReceipt, '收货确认')"></submit-button>
  19. </view>
  20. </template>
  21. <script setup lang="ts">
  22. import orderInfoItem from "./components/order-info-item";
  23. import { reactive } from "vue";
  24. import { onLoad } from "@dcloudio/uni-app";
  25. import { request } from "@/utils/network/request.js";
  26. import { msg, confirm, getOrderStatusName } from "@/utils/utils";
  27. import { orderDetail, receiveOrder } from "@/utils/network/api";
  28. import { getItem, StorageKeys } from "@/utils/storage";
  29. import { stringToJson } from "@/utils/network/encryption";
  30. const state = reactive({
  31. //订单信息
  32. orderInfo: {} as any,
  33. //显示订单信息
  34. list: [
  35. {
  36. label: "订单编号:",
  37. value: "",
  38. },
  39. {
  40. label: "订单车牌:",
  41. value: "",
  42. },
  43. {
  44. label: "订单状态:",
  45. value: "",
  46. },
  47. {
  48. label: "发货卡号:",
  49. value: "",
  50. },
  51. {
  52. label: "发货签号:",
  53. value: "",
  54. },
  55. ],
  56. });
  57. //确认收货
  58. const confirmReceipt = (e) => {
  59. const options = {
  60. type: 2,
  61. data: {
  62. id: state.orderInfo.id,
  63. source: "WECHAT",
  64. opId: getItem(StorageKeys.OpenId),
  65. },
  66. method: "POST",
  67. showLoading: true,
  68. };
  69. request(receiveOrder, options).then((res) => {
  70. confirm(
  71. "您已完成订单收货",
  72. () => {
  73. uni.$emit("refreshOrder");
  74. uni.navigateBack();
  75. },
  76. "收货完成",
  77. false
  78. );
  79. });
  80. };
  81. //获取订单详情
  82. const getOrderDetails = (id) => {
  83. const options = {
  84. type: 2,
  85. data: { id: id },
  86. method: "POST",
  87. showLoading: true,
  88. };
  89. request(orderDetail, options).then((res) => {
  90. state.orderInfo = stringToJson(res.bizContent);
  91. state.list[0].value = state.orderInfo.orderId;
  92. state.list[1].value = state.orderInfo.vehiclePlate;
  93. state.list[2].value = getOrderStatusName(state.orderInfo.orderStep);
  94. state.list[3].value = state.orderInfo.cardId ? state.orderInfo.cardId : "";
  95. state.list[4].value = state.orderInfo.obuId ? state.orderInfo.obuId : "";
  96. });
  97. };
  98. onLoad((options) => {
  99. getOrderDetails(options.id);
  100. });
  101. </script>
  102. <style>
  103. page {
  104. background-color: #eef7f7;
  105. }
  106. </style>
  107. <style lang="scss" scoped>
  108. .card-box {
  109. background-color: white;
  110. border-radius: 20rpx;
  111. box-shadow: 0px 0px 6rpx 2rpx rgba(223, 223, 223, 0.3);
  112. margin: 30rpx;
  113. padding: 20rpx 0;
  114. .title {
  115. padding: 0 20rpx 20rpx;
  116. }
  117. .icon {
  118. width: 48rpx;
  119. height: 48rpx;
  120. margin-right: 10rpx;
  121. }
  122. .txt-title {
  123. font-size: 30rpx;
  124. color: #333333;
  125. }
  126. .order-box {
  127. padding: 0px 30rpx 10rpx;
  128. .order-item {
  129. padding: 28rpx 0px 0px;
  130. }
  131. }
  132. }
  133. .hint {
  134. font-size: 28rpx;
  135. color: #ff8000;
  136. margin-top: 60rpx;
  137. text-align: center;
  138. }
  139. .btn {
  140. margin: 500rpx 40rpx 50rpx;
  141. }
  142. </style>