index.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <script setup lang="ts">
  2. import router from '@/router'
  3. definePage({
  4. name: 'refueling-orderDetail',
  5. islogin: true,
  6. style: {
  7. navigationBarTitleText: '订单详情',
  8. navigationStyle: 'custom',
  9. },
  10. })
  11. const orderNo = ref('')
  12. const orderInfo = ref<Api.xsbOrderList>()
  13. const oilInfo = computed<Api.OmsOrderOilVO | undefined>(() => orderInfo.value?.omsOrderOilVO)
  14. // 状态映射
  15. const statusMap = new Map([
  16. [1, '待支付'],
  17. [2, '已支付'],
  18. [6, '已退款'],
  19. [9, '已取消'],
  20. ])
  21. const { send } = useRequest(
  22. (no: string) => Apis.xsb.orderInfo({ data: { orderNo: no } }),
  23. { immediate: false },
  24. ).onSuccess((res) => {
  25. orderInfo.value = res.data.data
  26. })
  27. onLoad((options: any) => {
  28. orderNo.value = options.orderNo || ''
  29. if (orderNo.value) {
  30. send(orderNo.value)
  31. }
  32. })
  33. // 计算支付倒计时
  34. function getCountdownTime(): number {
  35. if (!orderInfo.value?.expireTime)
  36. return 0
  37. const expireTime = new Date(orderInfo.value.expireTime).getTime()
  38. const remaining = expireTime - Date.now()
  39. return remaining > 0 ? remaining : 0
  40. }
  41. // 复制订单号
  42. function handleCopy(text?: string) {
  43. if (!text)
  44. return
  45. uni.setClipboardData({
  46. data: text,
  47. success: () => {
  48. useGlobalToast().show('复制成功')
  49. },
  50. })
  51. }
  52. // 取消订单(占位)
  53. // async function handleCancelOrder() {
  54. // await useUserStore().handleCommonCancelOrder(orderInfo.value?.orderNumber as string)
  55. // send(orderNo.value)
  56. // }
  57. // 立即支付(占位)
  58. // function handlePay() {
  59. // useUserStore().handleCommonPath(oilInfo.value?.payUrl as string)
  60. // }
  61. // 跳转首页
  62. // function handleGoHome() {
  63. // router.pushTab({ name: 'home' })
  64. // useTabbar().setTabbarItemActive('home')
  65. // }
  66. // function handleContact() {
  67. // window.location.href = `weixin://dl/business/?appid=wx43b5b906cc30ed0b&path=subPack-xsb/orderDetaile/index&query=${orderInfo.value?.orderNumber}&env_version=release`
  68. // }
  69. </script>
  70. <template>
  71. <wd-navbar
  72. title="订单详情" :bordered="false" :z-index="99" safe-area-inset-top left-arrow placeholder fixed
  73. @click-left="router.back()"
  74. />
  75. <view v-if="orderInfo && oilInfo" class="bg-#f5f5f5 pb200rpx pt20rpx">
  76. <!-- 订单状态头部 -->
  77. <view class="mx24rpx rounded-16rpx bg-white px28rpx py32rpx">
  78. <view class="mb16rpx text-32rpx font-semibold">
  79. 订单状态:{{ statusMap.get(orderInfo.oilOrderStatus as number) || '-' }}
  80. </view>
  81. <!-- 待支付 - 倒计时和按钮 -->
  82. <template v-if="orderInfo.oilOrderStatus === 1">
  83. <view class="mb20rpx flex items-center text-26rpx text-#FF4A39">
  84. 剩余支付时间:<wd-count-down :time="getCountdownTime()" format="mm分ss秒" />
  85. </view>
  86. <!-- <view class="flex items-center gap-24rpx">
  87. <wd-button plain custom-class="flex-1 cancel-btn" @click="handleCancelOrder">
  88. 取消订单
  89. </wd-button>
  90. <wd-button custom-class="flex-1" @click="handlePay">
  91. 立即支付 ¥{{ oilInfo.realMoney }}
  92. </wd-button>
  93. </view> -->
  94. </template>
  95. <!-- 已退款 - 联系客服 -->
  96. <template v-else-if="orderInfo.oilOrderStatus === 6 || orderInfo.oilOrderStatus === 2">
  97. <view class="flex items-center gap-48rpx">
  98. <view class="flex flex-col items-center">
  99. <wd-icon name="chat" size="48rpx" color="#333" />
  100. <Zcontact>
  101. <view class="mt-40rpx text-28rpx">
  102. 联系客服
  103. </view>
  104. </Zcontact>
  105. </view>
  106. </view>
  107. </template>
  108. <!-- 已取消 - 取消原因 -->
  109. <template v-else-if="orderInfo.oilOrderStatus === 9">
  110. <view class="text-26rpx text-#999">
  111. 取消原因:{{ orderInfo.cancelReason || '未按时支付' }}
  112. </view>
  113. </template>
  114. </view>
  115. <!-- 重要提示(已支付) -->
  116. <view v-if="orderInfo.oilOrderStatus === 2" class="mx24rpx mt20rpx rounded-16rpx bg-white px28rpx py32rpx">
  117. <view class="mb16rpx flex items-center text-26rpx text-#ff4d3a">
  118. <wd-icon name="info-circle" size="28rpx" color="#ff4d3a" class="mr8rpx" />
  119. 重要提示
  120. </view>
  121. <view class="text-26rpx text-#666">
  122. 如需加油站线下开票,请向油站工作人员提供以下订单号:
  123. </view>
  124. <view class="mt12rpx flex items-center text-26rpx">
  125. 我方订单号:{{ orderInfo.orderNumber }}
  126. <wd-icon name="content-copy" size="28rpx" color="#999" class="ml12rpx" @click="handleCopy(orderInfo?.orderNumber)" />
  127. </view>
  128. </view>
  129. <!-- 退款信息(已退款) -->
  130. <view v-if="orderInfo.oilOrderStatus === 6" class="mx24rpx mt20rpx rounded-16rpx bg-white px28rpx py32rpx">
  131. <view class="mb20rpx text-30rpx font-semibold">
  132. 退款信息
  133. </view>
  134. <view class="text-26rpx text-#666 leading-48rpx">
  135. <view>退款金额:¥{{ oilInfo.realMoney }}</view>
  136. <view class="text-24rpx text-#999">
  137. 退还金额:¥{{ oilInfo.realMoney }} &nbsp; 退还积分:需联系客服处理
  138. </view>
  139. <view>退款时间:{{ oilInfo.refundTime || '-' }}</view>
  140. <view>退款方式:原路返回</view>
  141. <view>退款状态:退款成功</view>
  142. <view>预计到账:1-3个工作日</view>
  143. </view>
  144. </view>
  145. <!-- 订单编号 -->
  146. <view class="mx24rpx mt20rpx rounded-16rpx bg-white px28rpx py32rpx">
  147. <view class="mb20rpx text-30rpx font-semibold">
  148. 订单编号
  149. </view>
  150. <view class="text-26rpx text-#666 leading-48rpx">
  151. <view>我方订单号:{{ orderInfo.orderNumber || '-' }}</view>
  152. <view>小桔订单号:{{ oilInfo.xjOrderId || '-' }}</view>
  153. </view>
  154. </view>
  155. <!-- 用户信息(已支付/已退款) -->
  156. <view v-if="orderInfo.oilOrderStatus === 2 || orderInfo.oilOrderStatus === 6" class="mx24rpx mt20rpx rounded-16rpx bg-white px28rpx py32rpx">
  157. <view class="mb20rpx text-30rpx font-semibold">
  158. 用户信息
  159. </view>
  160. <view class="text-26rpx text-#666 leading-48rpx">
  161. <view>用户手机:{{ orderInfo.memberMobile || '-' }}</view>
  162. <view>外部用户ID:{{ orderInfo.memberId || '-' }}</view>
  163. <view>下单时间:{{ orderInfo.createTime || '-' }}</view>
  164. <view>支付时间:{{ oilInfo.payTime || '-' }}</view>
  165. </view>
  166. </view>
  167. <!-- 油站信息 -->
  168. <view class="mx24rpx mt20rpx rounded-16rpx bg-white px28rpx py32rpx">
  169. <view class="mb20rpx text-30rpx font-semibold">
  170. 油站信息
  171. </view>
  172. <view class="text-26rpx text-#666 leading-48rpx">
  173. <view>油站名称:{{ oilInfo.brandName }}·{{ oilInfo.storeName }}</view>
  174. <view>油站地址:{{ oilInfo.address || '-' }}</view>
  175. <view>所在城市:{{ oilInfo.cityName || '-' }}</view>
  176. </view>
  177. </view>
  178. <!-- 加油明细 -->
  179. <view class="mx24rpx mt20rpx rounded-16rpx bg-white px28rpx py32rpx">
  180. <view class="mb20rpx text-30rpx font-semibold">
  181. 加油明细
  182. </view>
  183. <view class="text-26rpx text-#666 leading-48rpx">
  184. <view>油品名称:{{ oilInfo.itemName || '-' }}</view>
  185. <view>枪号:{{ oilInfo.gunNo ? `${oilInfo.gunNo}号枪` : '-' }}</view>
  186. <view>加油量:{{ oilInfo.quantity || '-' }}L</view>
  187. </view>
  188. </view>
  189. <!-- 价格明细 -->
  190. <view class="mx24rpx mt20rpx rounded-16rpx bg-white px28rpx py32rpx">
  191. <view class="mb20rpx text-30rpx font-semibold">
  192. 价格明细
  193. </view>
  194. <view class="text-26rpx text-#666 leading-48rpx">
  195. <view>门店价:¥{{ oilInfo.storePrice || '-' }}/L</view>
  196. <view>平台价:¥{{ oilInfo.vipPrice || '-' }}/L</view>
  197. <view>订单金额:¥{{ oilInfo.totalMoney }}</view>
  198. <view>抵扣金额:-¥{{ oilInfo.promotionAmount }}</view>
  199. <view>服务费:+¥{{ oilInfo.serviceFee }}</view>
  200. <view v-if="orderInfo.oilOrderStatus === 6">
  201. 实付金额:¥{{ oilInfo.realMoney }}
  202. </view>
  203. <view v-else-if="orderInfo.oilOrderStatus === 9">
  204. 应付金额:¥{{ oilInfo.realMoney }}
  205. </view>
  206. <view v-else>
  207. 需付金额:¥{{ oilInfo.realMoney }}
  208. </view>
  209. </view>
  210. </view>
  211. <!-- 抵扣信息(已支付/已退款) -->
  212. <view v-if="(orderInfo.oilOrderStatus === 2 || orderInfo.oilOrderStatus === 6) && oilInfo.allowanceId" class="mx24rpx mt20rpx rounded-16rpx bg-white px28rpx py32rpx">
  213. <view class="mb20rpx text-30rpx font-semibold">
  214. 抵扣信息
  215. </view>
  216. <view class="text-26rpx text-#666 leading-48rpx">
  217. <view>抵扣券:{{ oilInfo.allowanceId || '-' }}</view>
  218. <view>优惠描述:{{ oilInfo.activityName || '-' }}</view>
  219. </view>
  220. </view>
  221. <!-- 支付信息(已支付/已退款) -->
  222. <view v-if="orderInfo.oilOrderStatus === 2 || orderInfo.oilOrderStatus === 6" class="mx24rpx mt20rpx rounded-16rpx bg-white px28rpx py32rpx">
  223. <view class="mb20rpx text-30rpx font-semibold">
  224. 支付信息
  225. </view>
  226. <view class="text-26rpx text-#666 leading-48rpx">
  227. <view>支付方式:微信支付</view>
  228. <view>支付状态:成功</view>
  229. <view class="break-all">
  230. 支付流水号:{{ orderInfo.transactionId || '-' }}
  231. </view>
  232. </view>
  233. </view>
  234. <!-- 开票信息(已支付) -->
  235. <view v-if="orderInfo.oilOrderStatus === 2" class="mx24rpx mt20rpx rounded-16rpx bg-white px28rpx py32rpx">
  236. <view class="mb20rpx text-30rpx font-semibold">
  237. 开票信息
  238. </view>
  239. <view class="text-26rpx text-#666 leading-48rpx">
  240. <view>开票方式:线上自助开票</view>
  241. </view>
  242. </view>
  243. </view>
  244. </template>
  245. <style lang="scss" scoped>
  246. :deep(.cancel-btn) {
  247. border-color: var(--them-color) !important;
  248. color: var(--them-color) !important;
  249. }
  250. :deep(.wd-count-down){
  251. color: #FF4A39 !important;
  252. }
  253. </style>