index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <script setup lang="ts">
  2. import { StaticUrl } from '@/config'
  3. import router from '@/router'
  4. definePage({
  5. name: 'djk-orderDetaile',
  6. islogin: true,
  7. style: {
  8. navigationBarTitleText: '订单详情',
  9. navigationStyle: 'custom',
  10. },
  11. })
  12. const orderInfo = ref<Api.xsbOrderList>()
  13. const orderNum = ref()
  14. const { refreshOrderList } = storeToRefs(useSysStore())
  15. onLoad((options: any) => {
  16. orderNum.value = options.id
  17. getDetail(options.id)
  18. })
  19. async function getDetail(id: string) {
  20. const { data } = await Apis.xsb.orderInfo({
  21. data: {
  22. orderNo: id,
  23. },
  24. })
  25. orderInfo.value = data
  26. }
  27. async function handleCancel() {
  28. await useUserStore().handleCommonCancelOrder(orderInfo.value as Api.xsbOrderList)
  29. refreshOrderList.value = true
  30. getDetail(String(unref(orderInfo)?.orderNumber))
  31. }
  32. async function handlePay() {
  33. const payMent = await useUserStore().getPayMent(String(unref(orderInfo)?.orderNumber))
  34. if (payMent.payType !== 'point') {
  35. // #ifdef MP-WEIXIN
  36. const res = await useUserStore().handleCommonPayMent(String(unref(orderInfo)?.orderNumber))
  37. await useUserStore().getWxCommonPayment(res)
  38. getDetail(String(unref(orderInfo)?.orderNumber))
  39. // #endif
  40. // #ifdef H5
  41. useUserStore().handleCommonWechatPay(String(unref(orderInfo)?.orderNumber))
  42. // #endif
  43. }
  44. else {
  45. await useUserStore().handleCommonPayMent(String(unref(orderInfo)?.orderNumber))
  46. getDetail(String(unref(orderInfo)?.orderNumber))
  47. }
  48. refreshOrderList.value = true
  49. }
  50. async function handelDel() {
  51. await useUserStore().handleCommonDeleteOrder(unref(orderInfo) as Api.xsbOrderList)
  52. refreshOrderList.value = true
  53. router.back()
  54. }
  55. async function handleFinish() {
  56. uni.showLoading({ mask: true })
  57. setTimeout(async () => {
  58. await getDetail(String(unref(orderInfo)?.orderNumber))
  59. uni.hideLoading()
  60. }, 2000)
  61. }
  62. function handleCopy() {
  63. uni.setClipboardData({
  64. data: String(orderInfo.value?.orderNumber),
  65. showToast: true,
  66. })
  67. }
  68. async function handleAfterSale() {
  69. router.push({
  70. name: 'djk-afterSales',
  71. params: { data: JSON.stringify(orderInfo.value) },
  72. })
  73. }
  74. function handleNav() {
  75. uni.openLocation({
  76. latitude: Number(orderInfo.value?.shopInfo?.shopLat),
  77. longitude: Number(orderInfo.value?.shopInfo?.shopLng),
  78. })
  79. }
  80. function handlePhone() {
  81. uni.makePhoneCall({
  82. phoneNumber: String(orderInfo.value?.shopInfo?.tel),
  83. })
  84. }
  85. </script>
  86. <template>
  87. <view
  88. v-if="orderInfo" class="page-xsb"
  89. >
  90. <wd-navbar
  91. title="订单详情" :bordered="false" :z-index="99" safe-area-inset-top placeholder left-arrow fixed
  92. @click-left="router.back()"
  93. />
  94. <view class="relative z-90 box-border bg-[#f6f6f6] px-24rpx">
  95. <view class="pt-20rpx">
  96. <view class="text-36rpx font-semibold">
  97. <view v-if="orderInfo.hbOrderStatus === OrderStatus.PaddingPay">
  98. <view class="flex items-center">
  99. 请在
  100. <wd-count-down format="mm:ss" :time="useUserStore().handleXSBCommonOrderStatusText(orderInfo)" @finish="handleFinish">
  101. <template #default="{ current }">
  102. <view class="flex items-center">
  103. <view> {{ current.minutes }} 分</view>
  104. <view> {{ current.seconds }} 秒</view>
  105. </view>
  106. </template>
  107. </wd-count-down>
  108. 内支付
  109. </view>
  110. <!-- <view class="mt-20rpx text-28rpx text-[#AAAAAA]">
  111. 现在支付:预计10:40-10:55送达
  112. </view> -->
  113. <view class="btn mt-20rpx flex items-center justify-between">
  114. <view class="info-btn mr-20rpx w-226rpx">
  115. <wd-button type="info" @click="handleCancel">
  116. 取消订单
  117. </wd-button>
  118. </view>
  119. <view class="ml-20rpx flex-1">
  120. <wd-button @click="handlePay">
  121. 立即支付¥{{ orderInfo.actualTotal }}
  122. </wd-button>
  123. </view>
  124. </view>
  125. </view>
  126. <view
  127. v-if="orderInfo.hbOrderStatus !== OrderStatus.PaddingPay" class="flex items-center"
  128. >
  129. {{ useUserStore().handleDjkCommonOrderStatusText(orderInfo) }}
  130. </view>
  131. <view v-if="orderInfo.hbOrderStatus === OrderStatus.OrderCancel" class="mt-20rpx text-28rpx text-[#AAAAAA]">
  132. 取消原因:{{ orderInfo.cancelReason }}
  133. </view>
  134. </view>
  135. </view>
  136. <view class="mt-20rpx rounded-16rpx bg-white p-24rpx">
  137. <view class="grid grid-cols-5 text-28rpx text-[#222]">
  138. <view
  139. v-if="[OrderStatus.OrderCancel, OrderStatus.OrderCompleted].includes(Number(orderInfo.hbOrderStatus))"
  140. class="flex flex-col items-center" @click="handelDel"
  141. >
  142. <image :src="`${StaticUrl}/orderDetaile-del.png`" class="h-40rpx w-40rpx" />
  143. <view class="mt-40rpx">
  144. 删除订单
  145. </view>
  146. </view>
  147. <view class="contact relative flex flex-col items-center">
  148. <image :src="`${StaticUrl}/orderDetaile-wx.png`" class="h-40rpx w-40rpx" />
  149. <Zcontact>
  150. <view class="mt-40rpx text-28rpx">
  151. 联系客服
  152. </view>
  153. </Zcontact>
  154. </view>
  155. <view
  156. v-if="orderInfo.hbOrderStatus == OrderStatus.OrderAccepted && orderInfo.djkOrderAttachInfo?.djkOrderType == 0 "
  157. class="flex flex-col items-center" @click="handleAfterSale"
  158. >
  159. <image :src="`${StaticUrl}/orderDetaile-shou.png`" class="h-40rpx w-40rpx" />
  160. <view class="mt-40rpx">
  161. 申请退款
  162. </view>
  163. </view>
  164. </view>
  165. </view>
  166. <view class="mt-20rpx flex items-center rounded-16rpx bg-white p-24rpx">
  167. <image
  168. :src="orderInfo.djkOrderAttachInfo?.goodsImg?.split(',')[0]"
  169. class="h160rpx w160rpx flex-shrink-0 rounded-16rpx"
  170. />
  171. <view class="ml20rpx flex-1">
  172. <view class="text-32rpx font-semibold">
  173. {{ orderInfo.djkOrderAttachInfo?.goodsName }}
  174. </view>
  175. <view class="mt16rpx text-24rpx text-gray">
  176. 有效期{{ orderInfo.djkOrderAttachInfo?.effectiveTime }}天·需提前{{ orderInfo.djkOrderAttachInfo?.advanceBookingTime }}天预约
  177. </view>
  178. <view class="mt16rpx flex items-center justify-between">
  179. <view class="text-36rpx text-#FF4D3A font-semibold">
  180. <text class="text-20rpx">
  181. </text> {{ orderInfo.djkOrderAttachInfo?.price }}
  182. </view>
  183. <view class="text-24rpx text-gray">
  184. x{{ orderInfo.djkOrderAttachInfo?.goodsNum }}
  185. </view>
  186. </view>
  187. </view>
  188. </view>
  189. <view class="mt-20rpx rounded-16rpx bg-white p-24rpx">
  190. <view class="flex items-center justify-between">
  191. <view class="text-28rpx text-gray">
  192. 商品金额
  193. </view>
  194. <view class="text-28rpx font-semibold">
  195. ¥{{ orderInfo.djkOrderAttachInfo?.price }}
  196. </view>
  197. </view>
  198. <view class="mt20rpx flex items-center justify-between">
  199. <view class="text-28rpx text-gray">
  200. 积分{{ orderInfo.offsetPoints ? `(${orderInfo.offsetPoints})` : '' }}
  201. </view>
  202. <view class="text-28rpx text-#FF4D3A font-semibold">
  203. -¥{{ Number(orderInfo.offsetPoints) / 100 }}
  204. </view>
  205. </view>
  206. <view class="my20rpx h2rpx w-full bg-#F0F0F0" />
  207. <view class="mt20rpx flex items-center justify-between">
  208. <view class="text-28rpx text-gray">
  209. 总计
  210. </view>
  211. <view class="text-28rpx font-semibold">
  212. ¥{{ orderInfo.actualTotal }}
  213. </view>
  214. </view>
  215. </view>
  216. <view class="mt20rpx rounded-16rpx bg-white p24rpx">
  217. <view class="mt20rpx h160rpx flex items-center justify-between bg-cover bg-center px24rpx" :style="{ backgroundImage: `url(${StaticUrl}/djk-shop-nav-bg.png)` }">
  218. <view class="flex items-center">
  219. {{ orderInfo.shopInfo?.shopName }}
  220. </view>
  221. <view class="flex items-center">
  222. <view class="mr40rpx flex flex-col items-center justify-center" @click="handleNav">
  223. <image
  224. :src="`${StaticUrl}/djk-shop-dh.png`"
  225. class="h40rpx w40rpx"
  226. />
  227. <view class="mt20rpx text-28rpx">
  228. 导航
  229. </view>
  230. </view>
  231. <view class="flex flex-col items-center justify-center" @click="handlePhone">
  232. <image
  233. :src="`${StaticUrl}/film-phone.png`"
  234. class="h40rpx w40rpx"
  235. />
  236. <view class="mt20rpx text-28rpx">
  237. 电话
  238. </view>
  239. </view>
  240. </view>
  241. </view>
  242. </view>
  243. <view class="mt20rpx rounded-16rpx bg-white p24rpx">
  244. <view class="text-32rpx font-semibold">
  245. 客户信息
  246. </view>
  247. <view class="mt20rpx text-24rpx">
  248. {{ phoneFormat(String(orderInfo.consigneeMobile)) }}
  249. </view>
  250. </view>
  251. <view class="mt20rpx rounded-16rpx bg-white p24rpx">
  252. <view class="text-32rpx font-semibold">
  253. 退款规则
  254. </view>
  255. <view class="mt20rpx text-24rpx">
  256. 支付成功后,服务有效期为{{ orderInfo.djkOrderAttachInfo?.effectiveTime }}天
  257. </view>
  258. <view class="mt20rpx text-24rpx">
  259. 有效期内可自主申请退款
  260. </view>
  261. <view class="mt20rpx text-24rpx">
  262. 过期未使用将自动退款,无需申请
  263. </view>
  264. <view class="mt20rpx text-24rpx text-gray">
  265. (积分支付的,退还后积分过期后,也将不可使用)
  266. </view>
  267. <view class="mt20rpx text-24rpx">
  268. 已核销服务不可退款
  269. </view>
  270. </view>
  271. <view class="mt-20rpx rounded-16rpx bg-white p-24rpx">
  272. <view class="mb-24rpx text-28rpx font-semibold">
  273. 订单信息
  274. </view>
  275. <view class="pb-20rpx">
  276. <view class="mb-28rpx flex items-center justify-between">
  277. <view class="text-28rpx text-[#AAAAAA]">
  278. 订单号
  279. </view>
  280. <view class="flex items-center">
  281. <text class="text-[#222]">
  282. {{ orderInfo?.orderNumber }}
  283. </text>
  284. <view class="ml-10rpx" @click="handleCopy">
  285. <wd-icon name="file-copy" size="22px" />
  286. </view>
  287. </view>
  288. </view>
  289. <view class="mb-28rpx flex items-center justify-between">
  290. <view class="text-28rpx text-[#AAAAAA]">
  291. 下单时间
  292. </view>
  293. <view class="text-[#222]">
  294. {{ orderInfo?.createTime }}
  295. </view>
  296. </view>
  297. </view>
  298. </view>
  299. <view class="h-80rpx" />
  300. </view>
  301. </view>
  302. </template>
  303. <style scoped lang="scss">
  304. .page-xsb {
  305. :deep() {
  306. .info-btn .wd-button {
  307. background: #fff !important;
  308. color: #aaa !important;
  309. }
  310. .btn .wd-button {
  311. width: 100% !important;
  312. }
  313. .wd-count-down {
  314. color: #FF4D3A !important;
  315. font-size: 36rpx !important;
  316. }
  317. .contact .wd-button {
  318. font-size: 28rpx !important;
  319. height: 40rpx !important;
  320. padding: 0 !important;
  321. margin-top: 40rpx !important;
  322. }
  323. }
  324. }
  325. </style>