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-details-obu.vue 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. <!-- 增补OBU-订单详情 -->
  2. <template>
  3. <view class="wrapper">
  4. <!-- 只有审核中、待发货订单有地址信息显示 -->
  5. <template v-if="state.orderInfo.orderStatus != OrderStatus.已取消">
  6. <view class="address-box as-gravity-center-start as-layout-horizontal" v-if="
  7. state.orderInfo.orderStep == OrderStatus.待审核 ||
  8. state.orderInfo.orderStep == OrderStatus.待发货
  9. ">
  10. <view class="avatar as-gravity-center">
  11. {{
  12. state.orderInfo.orderInfoExt.consignee != null
  13. ? state.orderInfo.orderInfoExt.consignee.charAt(0)
  14. : ""
  15. }}
  16. </view>
  17. <view class="center" style="flex: 1">
  18. <view class="as-layout-horizontal">
  19. <view class="name">{{
  20. state.orderInfo.orderInfoExt.consignee ?? ""
  21. }}</view>
  22. <view class="phone">{{
  23. state.orderInfo.orderInfoExt.consigneeTel ?? ""
  24. }}</view>
  25. </view>
  26. <view class="addr">{{ state.orderInfo.orderInfoExt.region ?? "" }}
  27. {{ state.orderInfo.orderInfoExt.address ?? "" }}
  28. </view>
  29. </view>
  30. <image :src="`${$imgUrl}applyCard/edit.png`" mode="" class="edit"
  31. @click="gotoEditAddress(state.orderInfo)"></image>
  32. </view>
  33. </template>
  34. <view class="detail-box">
  35. <view class="detail-header">
  36. <image class="d-img" :src="`${$imgUrl}order/icon-star-green.png`"></image>
  37. <text class="detail-name">{{ state.orderInfo.productName ?? "" }}</text>
  38. </view>
  39. <view class="detail-content">
  40. <view class="base-info-box">
  41. <!-- 卡签信息 -->
  42. <view class="base-info">
  43. <view class="d-row">
  44. <text class="d-label">订单编号:</text>
  45. <text class="d-value">{{ state.orderInfo.orderId }}</text>
  46. </view>
  47. <view class="d-row">
  48. <text class="d-label">用户名称:</text>
  49. <text class="d-value">{{ state.orderInfo.vehiclePlate }}</text>
  50. </view>
  51. <view class="d-row">
  52. <text class="d-label">用户证件类型:</text>
  53. <text class="d-value">{{
  54. state.orderInfo.userType === "UNIT_USER" ? "单位" : "个人"
  55. }}</text>
  56. </view>
  57. <view class="d-row">
  58. <text class="d-label">用户证件号:</text>
  59. <text class="d-value">{{ state.orderInfo.vehicleType }}</text>
  60. </view>
  61. <view class="d-row">
  62. <text class="d-label">订单车牌号:</text>
  63. <text class="d-value text-orange">{{
  64. state.orderInfo.vehiclePlate
  65. }}</text>
  66. </view>
  67. <view class="d-row">
  68. <text class="d-label">收费车型:</text>
  69. <text class="d-value text-green">{{
  70. state.orderInfo.vehicleType
  71. }}</text>
  72. </view>
  73. <view class="d-row">
  74. <text class="d-label">卡号:</text>
  75. <text class="d-value">{{
  76. state.orderInfo.insertTime ?? ""
  77. }}</text>
  78. </view>
  79. <view class="d-row">
  80. <text class="d-label">卡状态:</text>
  81. <text class="d-value">{{
  82. state.orderInfo.insertTime ?? ""
  83. }}</text>
  84. </view>
  85. </view>
  86. <!-- 售后信息 -->
  87. <view class="post-sale">
  88. <!-- 通用信息 -->
  89. <view class="d-row">
  90. <text class="d-label">售后单号:</text>
  91. <text class="d-value">{{
  92. state.orderInfo.XX ?? "没有这个字段"
  93. }}</text>
  94. </view>
  95. <view class="d-row">
  96. <text class="d-label">业务类型:</text>
  97. <text class="d-value">{{ state.orderInfo.orderType ?? "" }}</text>
  98. </view>
  99. <view class="d-row">
  100. <text class="d-label">订单状态:</text>
  101. <text class="d-value text-green">{{
  102. getOrderStatusName(state.orderInfo.orderStep)
  103. }}</text>
  104. </view>
  105. <view class="d-row">
  106. <text class="d-label">订单金额:</text>
  107. <text class="d-value text-orange">{{
  108. state.orderInfo.amount / 100 ?? "0.00"
  109. }}</text>
  110. </view>
  111. <view class="d-row">
  112. <text class="d-label">创建时间:</text>
  113. <text class="d-value">{{
  114. state.orderInfo.insertTime ?? ""
  115. }}</text>
  116. </view>
  117. <!-- 根据状态显示不同信息 -->
  118. <template>
  119. <!-- 已取消 -->
  120. <view v-if="state.orderInfo.orderStatus == OrderStatus.已取消">
  121. <view class="d-row">
  122. <text class="d-label">发货时间:</text>
  123. <text class="d-value">{{
  124. state.orderInfo.orderInfoExt.deliveryTime ?? ""
  125. }}</text>
  126. </view>
  127. <view class="d-row">
  128. <text class="d-label">取消时间:</text>
  129. <text class="d-value">{{
  130. state.orderInfo.orderInfoExt.cancelTime ?? ""
  131. }}</text>
  132. </view>
  133. <view class="d-row">
  134. <text class="d-label">取消原因:</text>
  135. <text class="d-value">{{
  136. state.orderInfo.orderInfoExt.cancelReason ?? ""
  137. }}</text>
  138. </view>
  139. </view>
  140. <template v-else>
  141. <!-- 审核中、待发货 -->
  142. <view v-if="
  143. state.orderInfo.orderStep == OrderStatus.待审核 ||
  144. state.orderInfo.orderStep == OrderStatus.待发货
  145. ">
  146. <view class="d-row">
  147. <text class="d-label">付款时间:</text>
  148. <text class="d-value">{{
  149. state.orderInfo.orderInfoExt.payTime ?? ""
  150. }}</text>
  151. </view>
  152. </view>
  153. <!-- 待收货 -->
  154. <view v-if="state.orderInfo.orderStep == OrderStatus.待收货">
  155. <view class="d-row">
  156. <text class="d-label">付款时间:</text>
  157. <text class="d-value">{{
  158. state.orderInfo.orderInfoExt.payTime ?? ""
  159. }}</text>
  160. </view>
  161. <view class="d-row">
  162. <text class="d-label">发货时间:</text>
  163. <text class="d-value">{{
  164. state.orderInfo.orderInfoExt.deliveryTime ?? ""
  165. }}</text>
  166. </view>
  167. <view class="d-row">
  168. <text class="d-label">快递单号:</text>
  169. <text class="d-value">{{
  170. state.orderInfo.trackingNumber ?? ""
  171. }}</text>
  172. </view>
  173. <view class="d-row">
  174. <text class="d-label">物流公司:</text>
  175. <text class="d-value">{{
  176. state.orderInfo.courierCompany ?? ""
  177. }}</text>
  178. </view>
  179. </view>
  180. <!-- 待激活 -->
  181. <view v-if="state.orderInfo.orderStep == OrderStatus.待激活">
  182. <view class="d-row">
  183. <text class="d-label">付款时间:</text>
  184. <text class="d-value">{{
  185. state.orderInfo.orderInfoExt.payTime ?? ""
  186. }}</text>
  187. </view>
  188. <view class="d-row">
  189. <text class="d-label">发货时间:</text>
  190. <text class="d-value">{{
  191. state.orderInfo.orderInfoExt.deliveryTime ?? ""
  192. }}</text>
  193. </view>
  194. <view class="d-row">
  195. <text class="d-label">收货时间:</text>
  196. <text class="d-value">{{
  197. state.orderInfo.orderInfoExt.receivingTime ?? ""
  198. }}</text>
  199. </view>
  200. <view class="d-row">
  201. <text class="d-label">快递单号:</text>
  202. <text class="d-value">{{
  203. state.orderInfo.trackingNumber ?? ""
  204. }}</text>
  205. </view>
  206. <view class="d-row">
  207. <text class="d-label">物流公司:</text>
  208. <text class="d-value">{{
  209. state.orderInfo.courierCompany ?? ""
  210. }}</text>
  211. </view>
  212. </view>
  213. <!-- 已完成 -->
  214. <view v-if="state.orderInfo.orderStep == OrderStatus.已完成">
  215. <view class="d-row">
  216. <text class="d-label">付款时间:</text>
  217. <text class="d-value">{{
  218. state.orderInfo.orderInfoExt.payTime ?? ""
  219. }}</text>
  220. </view>
  221. <view class="d-row">
  222. <text class="d-label">发货时间:</text>
  223. <text class="d-value">{{
  224. state.orderInfo.orderInfoExt.deliveryTime ?? ""
  225. }}</text>
  226. </view>
  227. <view class="d-row">
  228. <text class="d-label">收货时间:</text>
  229. <text class="d-value">{{
  230. state.orderInfo.orderInfoExt.receivingTime ?? ""
  231. }}</text>
  232. </view>
  233. <view class="d-row">
  234. <text class="d-label">激活时间:</text>
  235. <text class="d-value">{{
  236. state.orderInfo.cardEnableTime ?? ""
  237. }}</text>
  238. </view>
  239. <view class="d-row">
  240. <text class="d-label">快递单号:</text>
  241. <text class="d-value">{{
  242. state.orderInfo.trackingNumber ?? ""
  243. }}</text>
  244. </view>
  245. <view class="d-row">
  246. <text class="d-label">物流公司:</text>
  247. <text class="d-value">{{
  248. state.orderInfo.courierCompany ?? ""
  249. }}</text>
  250. </view>
  251. </view>
  252. </template>
  253. </template>
  254. <!-- 增补OBU时展示字段 -->
  255. <view class="d-row">
  256. <text class="d-label">收货方式:</text>
  257. <text class="d-value">{{ state.orderInfo.XXX ?? "" }}</text>
  258. </view>
  259. <!-- 如果是自提收的时候显示 -->
  260. <view class="d-row" v-if="true">
  261. <text class="d-label">自提网点:</text>
  262. <text class="d-value">{{ state.orderInfo.XXX ?? "" }}</text>
  263. </view>
  264. </view>
  265. </view>
  266. <!-- 按钮区 -->
  267. <view class="btn-view" v-if="state.orderInfo.orderStatus != OrderStatus.已取消">
  268. <!-- 审核中 、待发货-->
  269. <view v-if="
  270. state.orderInfo.orderStep == OrderStatus.待审核 ||
  271. state.orderInfo.orderStep == OrderStatus.待发货
  272. " class="btn-status">
  273. <view class="btn space" @click="gotoEditAddress(state.orderInfo)">修改地址</view>
  274. <view class="btn-green" @click="gotoCancelOrder(state.orderInfo)">取消订单</view>
  275. </view>
  276. <!-- 待支付 -->
  277. <view v-if="state.orderInfo.orderStep == OrderStatus.待支付" class="btn-status">
  278. <view class="btn space" @click="gotoCancelOrder(state.orderInfo)">取消订单</view>
  279. <view class="btn-green width-num-1" @click="gotoPay(state.orderInfo)">支付</view>
  280. </view>
  281. <!-- 待收货 -->
  282. <view v-if="state.orderInfo.orderStep == OrderStatus.待收货" class="btn-status">
  283. <view class="btn space" @click="gotoCheckLogistics(state.orderInfo)">查看物流</view>
  284. <view class="btn-green" @click="gotoConfirmReceipt(state.orderInfo)">确认收货</view>
  285. </view>
  286. <!-- 待激活 -->
  287. <view v-if="state.orderInfo.orderStep == OrderStatus.待激活" class="btn-status">
  288. <view class="btn-green" @click="gotoActiveOrder(state.orderInfo)">去激活</view>
  289. </view>
  290. <!-- 订单完成 -->
  291. <view v-if="state.orderInfo.orderStep == OrderStatus.已完成" class="btn-status">
  292. <view class="btn space" @click="gotoEvaluateOrder(state.orderInfo)">去评价</view>
  293. </view>
  294. </view>
  295. </view>
  296. </view>
  297. </view>
  298. </template>
  299. <script setup lang="ts">
  300. import {
  301. reactive
  302. } from "vue";
  303. import {
  304. onLoad,
  305. onUnload
  306. } from "@dcloudio/uni-app";
  307. import {
  308. request
  309. } from "@/utils/network/request";
  310. import {
  311. orderDetail
  312. } from "@/utils/network/api";
  313. import {
  314. stringToJson
  315. } from "@/utils/network/encryption";
  316. import useOrderSkip from "@/composables/order/useOrderSkip";
  317. import {
  318. getETCStatusName,
  319. getOBUStatusName,
  320. getOrderStatusName,
  321. } from "@/utils/utils";
  322. import {
  323. OrderStatus
  324. } from "@/datas/enum";
  325. const state = reactive({
  326. orderInfo: {} as any, //订单信息
  327. });
  328. //按钮跳转业务逻辑
  329. const {
  330. gotoEditAddress,
  331. gotoCancelOrder,
  332. gotoEditUserOrUnitInfo,
  333. gotoConfirmReceipt,
  334. gotoCheckLogistics,
  335. gotoEvaluateOrder,
  336. gotoActiveOrder,
  337. gotoReturnOrder,
  338. gotoExchangeOrder,
  339. gotoPay,
  340. } = useOrderSkip();
  341. //获取订单详情
  342. const getOrderDetails = (id) => {
  343. const options = {
  344. type: 2,
  345. data: {
  346. id: id
  347. },
  348. method: "POST",
  349. showLoading: true,
  350. };
  351. request(orderDetail, options).then((res) => {
  352. state.orderInfo = stringToJson(res.bizContent);
  353. //测试
  354. // state.orderInfo.orderStep = OrderStatus.完成填写基本信息;
  355. });
  356. };
  357. onLoad((options) => {
  358. getOrderDetails(options.id);
  359. //刷新订单信息
  360. uni.$on("refreshOrder", (data) => {
  361. getOrderDetails(options.id);
  362. });
  363. //回显修改的地址 TODO 缺少修改订单详情地址接口
  364. uni.$on("selectAddressSuccess", (addr) => {
  365. (state.orderInfo.orderInfoExt.id = addr.id),
  366. (state.orderInfo.orderInfoExt.consignee = addr.consignee);
  367. state.orderInfo.orderInfoExt.consigneeTel = addr.consigneeTel;
  368. state.orderInfo.orderInfoExt.region = addr.region;
  369. state.orderInfo.orderInfoExt.address = addr.address;
  370. state.orderInfo.orderInfoExt.postalCode = addr.postalCode;
  371. });
  372. });
  373. onUnload(() => {
  374. uni.$off("refreshOrder");
  375. uni.$off("selectAddressSuccess");
  376. });
  377. </script>
  378. <style>
  379. page {
  380. background: #eef7f7;
  381. padding-bottom: 30rpx;
  382. }
  383. </style>
  384. <style lang="scss" scoped>
  385. .address-box {
  386. background: #ffffff;
  387. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  388. border-radius: 20rpx;
  389. margin: 30rpx 30rpx 0rpx;
  390. padding: 30rpx;
  391. .avatar {
  392. background: rgba(0, 179, 139, 0.2);
  393. border-radius: 50%;
  394. color: #00b38b;
  395. font-size: 26rpx;
  396. width: 80rpx;
  397. height: 80rpx;
  398. }
  399. .center {
  400. margin-left: 20rpx;
  401. margin-right: 20rpx;
  402. display: flex;
  403. flex-direction: column;
  404. justify-content: center;
  405. .name {
  406. font-size: 30rpx;
  407. font-family: Microsoft YaHei;
  408. font-weight: 400;
  409. color: #333333;
  410. }
  411. .phone {
  412. font-size: 24rpx;
  413. font-family: Microsoft YaHei;
  414. font-weight: 400;
  415. color: #999999;
  416. margin-left: 20rpx;
  417. }
  418. .addr {
  419. margin-top: 18rpx;
  420. font-size: 26rpx;
  421. font-family: Microsoft YaHei;
  422. font-weight: 400;
  423. color: #333333;
  424. line-height: 36rpx;
  425. }
  426. }
  427. .edit {
  428. width: 60rpx;
  429. height: 55rpx;
  430. }
  431. }
  432. .detail-box {
  433. background: #ffffff;
  434. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  435. border-radius: 20rpx;
  436. margin: 30rpx;
  437. .detail-header {
  438. display: flex;
  439. border-bottom: 1rpx solid #dcdcdc;
  440. padding: 30rpx;
  441. align-items: center;
  442. .d-img {
  443. width: 48rpx;
  444. height: 48rpx;
  445. }
  446. .detail-name {
  447. font-size: 30rpx;
  448. font-weight: 400;
  449. color: #333333;
  450. margin-left: 12rpx;
  451. }
  452. }
  453. .detail-content {
  454. padding: 28rpx 29rpx 10rpx 29rpx;
  455. .post-sale {
  456. border-top: 1rpx solid #dcdcdc;
  457. padding-top: 38rpx;
  458. }
  459. .d-row {
  460. display: flex;
  461. margin-bottom: 32rpx;
  462. .d-label {
  463. font-size: 26rpx;
  464. //width: 135rpx;
  465. color: #999999;
  466. text-align: right;
  467. }
  468. .d-value {
  469. font-size: 26rpx;
  470. color: #333333;
  471. flex: 1;
  472. overflow: hidden;
  473. }
  474. }
  475. .btn-view {
  476. .btn-status {
  477. display: flex;
  478. justify-content: flex-end;
  479. padding: 20rpx 0;
  480. border-top: 1rpx solid #dcdcdc;
  481. }
  482. .space {
  483. margin-right: 19rpx;
  484. }
  485. .btn {
  486. border: 1px solid #dcdcdc;
  487. border-radius: 30rpx;
  488. color: #333333;
  489. font-size: 26rpx;
  490. height: 61rpx;
  491. width: 141rpx;
  492. display: flex;
  493. justify-content: center;
  494. align-items: center;
  495. font-size: 26rpx;
  496. }
  497. .btn-green {
  498. border: 1px solid #00b38b;
  499. border-radius: 30rpx;
  500. color: #00b38b;
  501. height: 61rpx;
  502. width: 141rpx;
  503. display: flex;
  504. justify-content: center;
  505. align-items: center;
  506. font-size: 26rpx;
  507. }
  508. .width-num-1 {
  509. width: 115rpx;
  510. }
  511. .width-num-2 {
  512. width: 221rpx;
  513. }
  514. .width-num-3 {
  515. width: 201rpx;
  516. }
  517. }
  518. }
  519. }
  520. .text-orange {
  521. color: #ff8000 !important;
  522. }
  523. .text-green {
  524. color: #00b38b !important;
  525. }
  526. </style>