您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

order-confirm-receipt.vue 3.5KB

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