index.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420
  1. <template>
  2. <view>
  3. <view class="order-details">
  4. <view class="header" v-if="orderInfo.shippingType === 1">
  5. <view class="picTxt" v-if="orderInfo.status != 6">
  6. <image
  7. v-if="!orderInfo.paid"
  8. src="@/static/images/shop/daifukuan@2x.png"
  9. mode=""
  10. ></image>
  11. <image
  12. v-else-if="orderInfo.status === 0 || orderInfo.status === 1"
  13. src="@/static/images/shop/daifahuo@2x.png"
  14. mode=""
  15. ></image>
  16. <image
  17. v-else-if="orderInfo.status === 3"
  18. src="@/static/images/shop/yiwancheng@2x.png"
  19. mode=""
  20. ></image>
  21. <view class="data">{{ curOrderStepTxt }}</view>
  22. <view class="state">{{ orderInfo.orderStatusMsg }}</view>
  23. </view>
  24. <view class="header-bot">
  25. <image src="@/static/images/shop/dingwei@2x.png" mode=""></image>
  26. <view class="header-bot-right">
  27. <view class="header-bot-address">{{ orderInfo.userAddress }}</view>
  28. <view class="header-bot-name">
  29. <text>{{ orderInfo.realName }}</text>
  30. <text>{{ orderInfo.userPhone }}</text>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. <view v-if="!isGoodsReturn">
  36. <view
  37. v-if="orderInfo.shippingType == 2 && orderInfo.paid"
  38. class="writeOff borRadius14"
  39. >
  40. <view class="title">核销信息</view>
  41. <view class="grayBg">
  42. <view class="pictrue">
  43. <image :src="codeImg"></image>
  44. </view>
  45. </view>
  46. <view class="gear">
  47. <image src="@/static/images/writeOff.jpg"></image>
  48. </view>
  49. <view class="num">{{ orderInfo.verifyCode }}</view>
  50. <view class="rules" v-if="orderInfo.systemStore">
  51. <view class="item">
  52. <view class="rulesTitle acea-row row-middle">
  53. <text class="iconfont icon-shijian"></text>核销时间
  54. </view>
  55. <view class="info">
  56. 每日:<text class="time">{{
  57. orderInfo.systemStore.dayTime.replace(",", "-")
  58. }}</text>
  59. </view>
  60. </view>
  61. <view class="item">
  62. <view class="rulesTitle acea-row row-middle">
  63. <text class="iconfont icon-shuoming1"></text>使用说明
  64. </view>
  65. <view class="info">可将二维码出示给店员扫描或提供数字核销码</view>
  66. </view>
  67. </view>
  68. </view>
  69. <view v-if="orderInfo.shippingType === 1" class=""></view>
  70. <view v-else class="address" style="margin-top: 15rpx">
  71. <view class="name" @tap="makePhone"
  72. >{{ orderInfo.systemStore ? orderInfo.systemStore.name : ""
  73. }}<text class="phone">{{
  74. orderInfo.systemStore ? orderInfo.systemStore.phone : ""
  75. }}</text
  76. ><text class="iconfont icon-tonghua font-color"></text
  77. ></view>
  78. <view>{{
  79. orderInfo.systemStore ? orderInfo.systemStore.detailedAddress : ""
  80. }}</view>
  81. </view>
  82. </view>
  83. <view class="wrapper">
  84. <orderGoods
  85. :mallType="orderInfo.mallType"
  86. :evaluate="evaluate"
  87. :productType="orderInfo.type"
  88. :orderId="order_id"
  89. :ids="id"
  90. :uniId="uniId"
  91. :cartInfo="cartInfo"
  92. :sbMerchant="orderInfo.sbMerchant"
  93. ></orderGoods>
  94. <view
  95. class="wrapper-return"
  96. v-if="
  97. orderInfo.paid === true &&
  98. orderInfo.type !== 1 &&
  99. orderInfo.mallType !== 1 &&
  100. type === 'normal'
  101. "
  102. >
  103. <view v-if="orderInfo.status == 3">
  104. <view
  105. hover-class="none"
  106. @click="changeProduct"
  107. class="cancel"
  108. style="margin-right: 10rpx"
  109. v-if="
  110. orderInfo.exchangeStatus === 0 &&
  111. orderInfo.refundStatus === 0 &&
  112. isGoodsReturn == false
  113. "
  114. >
  115. 申请换货
  116. </view>
  117. <navigator
  118. hover-class="none"
  119. :url="
  120. '/pages/users/goods_change/index?orderId=' + orderInfo.orderId
  121. "
  122. class="cancel"
  123. style="margin-right: 10rpx"
  124. v-if="
  125. orderInfo.exchangeStatus === 2 &&
  126. orderInfo.refundStatus === 0 &&
  127. isGoodsReturn == false
  128. "
  129. >
  130. 退货信息填写
  131. </navigator>
  132. <view
  133. hover-class="none"
  134. class="cancel"
  135. style="margin-right: 10rpx"
  136. v-if="
  137. orderInfo.exchangeStatus === 4 &&
  138. orderInfo.refundStatus === 0 &&
  139. isGoodsReturn == false
  140. "
  141. >
  142. 换货中
  143. </view>
  144. <view
  145. hover-class="none"
  146. class="cancel"
  147. style="margin-right: 10rpx"
  148. v-if="
  149. orderInfo.exchangeStatus === 1 &&
  150. orderInfo.refundStatus === 0 &&
  151. isGoodsReturn == false
  152. "
  153. >
  154. 换货申请中
  155. </view>
  156. </view>
  157. <navigator
  158. hover-class="none"
  159. :url="
  160. '/pages/users/goods_return/index?orderId=' + orderInfo.orderId
  161. "
  162. class="cancel"
  163. v-if="
  164. orderInfo.refundStatus === 0 &&
  165. isGoodsReturn == false &&
  166. orderInfo.exchangeStatus === 0
  167. "
  168. >
  169. 申请退款
  170. </navigator>
  171. </view>
  172. <view class="wrapper-list">
  173. <view class="item">
  174. <view class="">商品总价</view>
  175. <view class="txt">¥{{ orderInfo.proTotalPrice }}</view>
  176. </view>
  177. <view class="item" v-if="orderInfo.payPostage > 0">
  178. <view class="">运费</view>
  179. <view class="txt">¥{{ orderInfo.payPostage }}</view>
  180. </view>
  181. <view
  182. class="item"
  183. v-if="orderInfo.payPostage > 0 && orderInfo?.additionalAmount"
  184. >
  185. <view class="">附加费</view>
  186. <view class="txt">¥{{ orderInfo.additionalAmount }}</view>
  187. </view>
  188. <view class="item" v-if="orderInfo.mallType === 0">
  189. <view class="">会员折扣</view>
  190. <view class="red">-¥{{ orderInfo.vipLevelDis }}</view>
  191. </view>
  192. <view class="item">
  193. <view class="">实付款</view>
  194. <view class="txt">
  195. {{
  196. orderInfo.mallType === 0
  197. ? `¥${orderInfo.payPrice}`
  198. : `${Number(orderInfo.proTotalPrice)}贝币`
  199. }}
  200. </view>
  201. </view>
  202. </view>
  203. </view>
  204. <view class="wrapper">
  205. <view class="wrapper-title">订单信息</view>
  206. <view class="item">
  207. <view>订单编号</view>
  208. <view class="conter acea-row row-middle row-right"
  209. >{{ orderInfo.orderId }}
  210. <!-- #ifndef H5 -->
  211. <text class="copy" @tap="copy">复制</text>
  212. <!-- #endif -->
  213. <!-- #ifdef H5 -->
  214. <text class="copy copy-data" @click="setOrderId">复制</text>
  215. <!-- #endif -->
  216. </view>
  217. </view>
  218. <view class="item">
  219. <view>下单时间</view>
  220. <view class="conter">{{ orderInfo.createTime || 0 }}</view>
  221. </view>
  222. <view class="item">
  223. <view>支付状态</view>
  224. <view class="conter" v-if="orderInfo.paid">已支付</view>
  225. <view class="conter" v-else>未支付</view>
  226. </view>
  227. <view class="item">
  228. <view>支付方式</view>
  229. <view class="conter" v-if="orderInfo.mallType === 0">{{
  230. orderInfo.payTypeStr
  231. }}</view>
  232. <view class="conter" v-else>贝币</view>
  233. </view>
  234. <view class="item" v-if="orderInfo.mark">
  235. <view>买家留言</view>
  236. <view class="conter">{{ orderInfo.mark }}</view>
  237. </view>
  238. </view>
  239. <view class="">
  240. <view class="nav refund" v-if="orderInfo.refundStatus > 0">
  241. <view class="title">
  242. <image src="@/static/images/shuoming.png" mode=""></image>
  243. {{ getRefundStatus() }}
  244. </view>
  245. <view class="con pad30">{{ getRefundReason() }}</view>
  246. </view>
  247. <!-- 退款订单详情 "-->
  248. <view v-if="isGoodsReturn" class="wrapper">
  249. <view class="wrapper-title">退款信息</view>
  250. <view class="item">
  251. <view>收货人</view>
  252. <view class="conter">{{ orderInfo.realName }}</view>
  253. </view>
  254. <view class="item">
  255. <view>联系电话</view>
  256. <view class="conter">{{ orderInfo.userPhone }}</view>
  257. </view>
  258. <view class="item">
  259. <view>收货地址</view>
  260. <view class="conter">{{ orderInfo.userAddress }}</view>
  261. </view>
  262. <view class="item">
  263. <view>退款快递单号</view>
  264. <view class="conter">{{ orderInfo.refundExpressNum }}</view>
  265. </view>
  266. </view>
  267. <view v-if="orderInfo.status > 0">
  268. <view class="wrapper" v-if="orderInfo.deliveryType == 'express'">
  269. <view class="wrapper-title">物流信息</view>
  270. <view class="item">
  271. <view>配送方式</view>
  272. <view class="conter">发货</view>
  273. </view>
  274. <view class="item">
  275. <view>快递公司</view>
  276. <view class="conter">{{ orderInfo.deliveryName || "" }}</view>
  277. </view>
  278. <view class="item">
  279. <view>快递号</view>
  280. <view class="conter">{{ orderInfo.deliveryId || "" }}</view>
  281. </view>
  282. </view>
  283. <view class="wrapper" v-else-if="orderInfo.deliveryType == 'send'">
  284. <view class="item acea-row row-between">
  285. <view>配送方式:</view>
  286. <view class="conter">送货</view>
  287. </view>
  288. <view class="item acea-row row-between">
  289. <view>配送人姓名:</view>
  290. <view class="conter">{{ orderInfo.deliveryName || "" }}</view>
  291. </view>
  292. <view class="item acea-row row-between">
  293. <view>联系电话:</view>
  294. <view class="conter acea-row row-middle row-right"
  295. >{{ orderInfo.deliveryId || ""
  296. }}<text class="copy" @tap="goTel">拨打</text></view
  297. >
  298. </view>
  299. </view>
  300. <view
  301. class="wrapper borRadius14"
  302. v-else-if="orderInfo.deliveryType == 'fictitious'"
  303. >
  304. <view class="item acea-row row-between">
  305. <view>虚拟发货:</view>
  306. <view class="conter">已发货,请注意查收</view>
  307. </view>
  308. </view>
  309. </view>
  310. </view>
  311. </view>
  312. <!-- && orderInfo.status != 0 -->
  313. <template
  314. v-if="
  315. (isGoodsReturn == false && orderInfo.status != 0) ||
  316. (orderInfo.status == 0 && !orderInfo.paid)
  317. "
  318. >
  319. <view class="kong"></view>
  320. <view class="footer" v-if="orderInfo.status != 6">
  321. <view class="footer-box">
  322. <view class="qs-btn" v-if="!orderInfo.paid" @click.stop="cancelOrder">
  323. <image src="@/static/images/shop/closeOrder@2x.png" mode=""></image>
  324. <view class="">取消订单</view>
  325. </view>
  326. <view
  327. class="qs-btn"
  328. v-if="!orderInfo.paid"
  329. @click.stop="refreshPayStatus"
  330. >
  331. <image src="@/static/images/shop/daifukuan@2x.png" mode=""></image>
  332. <view class="">更新状态</view>
  333. </view>
  334. <view
  335. class="buyPlay"
  336. v-if="!orderInfo.paid"
  337. @tap="pay_open(orderInfo.orderId)"
  338. >
  339. <view class="buyPlay-left">
  340. <view class="buyPlay-left-top">
  341. <text>合计:</text>
  342. <text>{{
  343. orderInfo.mallType === 0
  344. ? `¥${orderInfo.payPrice}`
  345. : `${Number(orderInfo.proTotalPrice)}贝币`
  346. }}</text>
  347. </view>
  348. <view class="buyPlay-left-bot" v-if="orderInfo.mallType === 0"
  349. >共减¥{{ orderInfo.vipLevelDis }}</view
  350. >
  351. </view>
  352. <view class="buyPlay-btn">立即付款</view>
  353. </view>
  354. <view class="qs-btn" v-if="orderInfo.status == 3" @tap="delOrder">
  355. <image src="@/static/images/shop/delorder@2x.png" mode=""></image>
  356. <view class="">删除订单</view>
  357. </view>
  358. <navigator
  359. class="wuliu align-center"
  360. v-if="orderInfo.deliveryType == 'express' && orderInfo.status > 0"
  361. hover-class="none"
  362. :url="`/pages/users/goods_logistics/index?orderId=${orderInfo.orderId}`"
  363. >查看物流
  364. </navigator>
  365. <view
  366. class="wuliu align-center buy"
  367. v-if="orderInfo.status == 3 && orderInfo.type !== 1"
  368. @click="goOrderConfirm"
  369. >再次购买
  370. </view>
  371. <view
  372. class="align-center shouhuo"
  373. v-if="orderInfo.status == 1"
  374. @tap="confirmOrder"
  375. style="width: 100%"
  376. >确认收货</view
  377. >
  378. </view>
  379. </view>
  380. </template>
  381. <payment
  382. :payMode="payMode"
  383. :showPopup="showPopup"
  384. @payComplete="payComplete"
  385. @close="payClose"
  386. :order_id="pay_order_id"
  387. :totalPrice="totalPrice"
  388. :mallType="orderInfo.mallType"
  389. ></payment>
  390. <WechatPayment ref="wechatPaymentRef" />
  391. <!-- 申请换货弹窗-->
  392. <up-popup
  393. :show="changeProductShow"
  394. @close="changeProductShow = false"
  395. closeable
  396. >
  397. <view class="changeProductReasonPopup">
  398. <view class="title">理由</view>
  399. <up-textarea
  400. class="text-area"
  401. v-model="changeProductReason"
  402. placeholder="请输入换货理由"
  403. ></up-textarea>
  404. <view class="btnView">
  405. <button class="sure" @click="changeProductSure">确定</button>
  406. <button class="cancel" @click="changeProductShow = false">
  407. 取消
  408. </button>
  409. </view>
  410. </view>
  411. </up-popup>
  412. </view>
  413. </template>
  414. <script setup>
  415. import { ref, reactive, computed } from "vue";
  416. import { useAppStore } from "@/stores/app.js";
  417. import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
  418. import {
  419. getOrderDetail,
  420. orderTake,
  421. orderDel,
  422. orderCancel,
  423. qrcodeApi,
  424. applyExchange,
  425. } from "@/api/order.js";
  426. import { queryPaymentStatus } from "@/api/payment.js";
  427. import { openOrderRefundSubscribe } from "@/utils/SubscribeMessage.js";
  428. import payment from "@/components/payment";
  429. import WechatPayment from "@/components/payment/WechatPayment.vue";
  430. import orderGoods from "@/components/orderGoods";
  431. import { toLogin } from "@/libs/login.js";
  432. import { useToast } from "@/hooks/useToast";
  433. import { getPreOrder } from "@/libs/order";
  434. const appStore = useAppStore();
  435. const { Toast } = useToast();
  436. const codeImg = ref("");
  437. const order_id = ref("");
  438. const evaluate = ref(0);
  439. const cartInfo = ref([]);
  440. const orderInfo = reactive({
  441. systemStore: {},
  442. pstatus: {},
  443. });
  444. const system_store = ref({});
  445. const isGoodsReturn = ref(false);
  446. const status = ref({});
  447. const isClose = ref(false);
  448. const payMode = ref([
  449. {
  450. name: "微信支付",
  451. icon: "icon-wechat",
  452. value: "weixin",
  453. title: "微信快捷支付",
  454. payChannel: "routine",
  455. number: 0,
  456. },
  457. // {
  458. // name: "余额支付",
  459. // icon: "icon-balance",
  460. // value: "yue",
  461. // title: "可用余额:",
  462. // payChannel: "yue",
  463. // number: 0,
  464. // },
  465. ]);
  466. const showPopup = ref(false);
  467. const pay_order_id = ref("");
  468. const totalPrice = ref("0");
  469. const id = ref(0);
  470. const uniId = ref("");
  471. const type = ref("normal");
  472. const wechatPaymentRef = ref(null);
  473. const WX_PAY_STATUS = {
  474. SUCCESS: "支付成功",
  475. FAIL: "支付失败",
  476. CANCEL: "用户取消支付",
  477. };
  478. const changeProductShow = ref(false);
  479. const changeProductReason = ref("");
  480. function payComplete() {
  481. showPopup.value = false;
  482. pay_order_id.value = "";
  483. getOrderInfo();
  484. }
  485. function openSubcribe(page) {
  486. uni.showLoading({
  487. title: "正在加载",
  488. });
  489. openOrderRefundSubscribe()
  490. .then(() => {
  491. uni.hideLoading();
  492. uni.navigateTo({
  493. url: page,
  494. });
  495. })
  496. .catch(() => {
  497. uni.hideLoading();
  498. });
  499. }
  500. function makePhone() {
  501. uni.makePhoneCall({
  502. phoneNumber: system_store.value.phone,
  503. });
  504. }
  505. function payClose() {
  506. showPopup.value = false;
  507. }
  508. function pay_open() {
  509. const orderNo = orderInfo.orderId;
  510. const price = orderInfo.payPrice;
  511. const goPages = "/pages/order_pay_status/index?order_id=" + orderNo;
  512. uni.showActionSheet({
  513. itemList: ["微信支付"],
  514. success: async (res) => {
  515. if (res.tapIndex === 0) {
  516. // 微信支付
  517. uni.showLoading({ title: "订单支付中" });
  518. try {
  519. await wechatPaymentRef.value.createUniPay({
  520. amount: Number(price) * 100,
  521. description: `商品(¥${price})`,
  522. openId: appStore.$userInfo.openId,
  523. orderNo: orderNo,
  524. orderPrefix: "SHOP",
  525. onUniPaySuccess: async () => {
  526. try {
  527. return Toast(
  528. { title: "支付成功", icon: "success" },
  529. { tab: 4, url: goPages }
  530. );
  531. } catch (err) {
  532. console.error("支付失败:", err);
  533. uni.showToast({ title: "支付失败,请重试", icon: "none" });
  534. }
  535. },
  536. onUniPayCancel: () => {
  537. uni.showToast({ title: "用户取消支付", icon: "none" });
  538. },
  539. onUniPayFail: (err) => {
  540. uni.showToast({ title: "支付失败,请重试", icon: "none" });
  541. },
  542. });
  543. uni.hideLoading();
  544. } catch (wxErr) {
  545. uni.hideLoading();
  546. const errMsg = wxErr?.errMsg || "";
  547. if (errMsg.includes("cancel") || errMsg.includes("取消")) {
  548. return Toast(
  549. { title: WX_PAY_STATUS.CANCEL },
  550. { tab: 5, url: `${goPages}&msg=${WX_PAY_STATUS.CANCEL}` }
  551. );
  552. }
  553. return Toast(
  554. { title: WX_PAY_STATUS.FAIL },
  555. { tab: 5, url: `${goPages}&msg=${errMsg || WX_PAY_STATUS.FAIL}` }
  556. );
  557. }
  558. } else if (res.tapIndex === 1) {
  559. // 余额支付,沿用原有弹窗
  560. showPopup.value = true;
  561. pay_order_id.value = orderNo;
  562. totalPrice.value = price;
  563. }
  564. },
  565. });
  566. }
  567. function getRefundStatus() {
  568. const statusMap = {
  569. 1: "商家审核中",
  570. 2: "商家已退款",
  571. 3: "商家退款中",
  572. };
  573. return orderInfo?.refundStatus ? statusMap[orderInfo.refundStatus] : "";
  574. }
  575. function getRefundReason() {
  576. if (orderInfo.refundStatus == 1) {
  577. return "您已成功发起退款申请,请耐心等待商家处理;退款前请与商家协商一致,有助于更好的处理售后问题";
  578. } else if (orderInfo.refundStatus == 2) {
  579. return "退款已成功受理,如商家已寄出商品请尽快退回;感谢您的支持";
  580. } else if (orderInfo?.refundReason) {
  581. return "拒绝原因:" + orderInfo?.refundReason;
  582. }
  583. }
  584. // 订单步骤配置
  585. const orderSteps = ref([
  586. {
  587. title: "待付款",
  588. },
  589. {
  590. title: "待发货",
  591. },
  592. {
  593. title: "待收货",
  594. },
  595. {
  596. title: "已完成",
  597. },
  598. ]);
  599. // 当前的订单状态
  600. const curOrderStep = computed(() => {
  601. let step = 0;
  602. if (!orderInfo.paid) {
  603. step = 0; // 待付款
  604. } else if (orderInfo.status === 0) {
  605. step = 1; // 待发货
  606. } else if (orderInfo.status === 1) {
  607. step = 2; // 待收货
  608. } else if (orderInfo.status === 2 || orderInfo.status === 3) {
  609. step = 3; // 已完成
  610. }
  611. return step;
  612. });
  613. // 当前的订单状态
  614. const curOrderStepTxt = computed(() => {
  615. let step = "";
  616. if (!orderInfo.paid) {
  617. step = "待付款"; // 待付款
  618. } else if (orderInfo.status === 0) {
  619. step = "待发货"; // 待发货
  620. } else if (orderInfo.status === 1) {
  621. step = "待收货"; // 待收货
  622. } else if (orderInfo.status === 2 || orderInfo.status === 3) {
  623. step = "已完成"; // 已完成
  624. }
  625. return step;
  626. });
  627. function getOrderInfo() {
  628. uni.showLoading({
  629. title: "正在加载中",
  630. });
  631. getOrderDetail(order_id.value)
  632. .then((res) => {
  633. uni.hideLoading();
  634. Object.assign(orderInfo, res.data);
  635. evaluate.value = res.data.status == 2 ? 2 : 0;
  636. system_store.value = res.data.systemStore;
  637. id.value = res.data.id;
  638. cartInfo.value = res.data.orderInfoList;
  639. if (res.data.refundStatus != 0) isGoodsReturn.value = true;
  640. if (orderInfo.shippingType == 2 && orderInfo.paid)
  641. markCode(res.data.verifyCode);
  642. if (orderInfo.refundStatus > 0) {
  643. // uni.setNavigationBarColor({
  644. // frontColor: "#ffffff",
  645. // backgroundColor: "#666666",
  646. // });
  647. }
  648. })
  649. .catch((err) => {
  650. uni.hideLoading();
  651. Toast(
  652. {
  653. title: err,
  654. },
  655. "/pages/users/order_list/index"
  656. );
  657. });
  658. }
  659. function markCode(text) {
  660. qrcodeApi({
  661. height: "145",
  662. text: text,
  663. width: "145",
  664. }).then((res) => {
  665. codeImg.value = res.data.code;
  666. });
  667. }
  668. // #ifndef H5
  669. function copy() {
  670. uni.setClipboardData({
  671. data: orderInfo.orderId,
  672. });
  673. }
  674. // #endif
  675. function goTel() {
  676. uni.makePhoneCall({
  677. phoneNumber: orderInfo.deliveryId,
  678. });
  679. }
  680. function getOrderStatus() {
  681. let _orderInfo = orderInfo || {},
  682. _status = _orderInfo.pstatus || {
  683. type: 0,
  684. },
  685. _statusObj = {};
  686. let typeVal = parseInt(_status.type),
  687. delivery_type = _orderInfo.deliveryType,
  688. seckill_id = _orderInfo.seckillId ? parseInt(_orderInfo.seckillId) : 0,
  689. bargain_id = _orderInfo.bargainId ? parseInt(_orderInfo.bargainId) : 0,
  690. combination_id = _orderInfo.combinationId
  691. ? parseInt(_orderInfo.combinationId)
  692. : 0;
  693. _statusObj = {
  694. type: typeVal == 9 ? -9 : typeVal,
  695. class_status: 0,
  696. };
  697. if (typeVal == 1 && combination_id > 0) _statusObj.class_status = 1;
  698. if (typeVal == 2 && delivery_type == "express") _statusObj.class_status = 2;
  699. if (typeVal == 2) _statusObj.class_status = 3;
  700. if (typeVal == 4 || typeVal == 0) _statusObj.class_status = 4;
  701. if (
  702. !seckill_id &&
  703. !bargain_id &&
  704. !combination_id &&
  705. (typeVal == 3 || typeVal == 4)
  706. )
  707. _statusObj.class_status = 5;
  708. status.value = _statusObj;
  709. }
  710. function goJoinPink() {
  711. uni.navigateTo({
  712. url:
  713. "/pages/activity/goods_combination_status/index?id=" + orderInfo.pinkId,
  714. });
  715. }
  716. function goOrderConfirm() {
  717. const params = {
  718. mallType: orderInfo.mallType,
  719. preOrderType: "again",
  720. orderDetails: [
  721. {
  722. orderNo: order_id.value,
  723. },
  724. ],
  725. };
  726. getPreOrder(params);
  727. }
  728. function confirmOrder() {
  729. uni.showModal({
  730. title: "确认收货",
  731. content: "为保障权益,请收到货确认无误后,再确认收货",
  732. success: function (res) {
  733. if (res.confirm) {
  734. orderTake(id.value)
  735. .then(() => {
  736. Toast(
  737. {
  738. title: "操作成功",
  739. icon: "success",
  740. },
  741. function () {
  742. getOrderInfo();
  743. }
  744. );
  745. })
  746. .catch((err) => {
  747. Toast({
  748. title: err,
  749. });
  750. });
  751. }
  752. },
  753. });
  754. }
  755. function delOrder() {
  756. orderDel(id.value)
  757. .then(() => {
  758. Toast(
  759. {
  760. title: "删除成功",
  761. icon: "success",
  762. },
  763. {
  764. tab: 3,
  765. url: 1,
  766. }
  767. );
  768. })
  769. .catch((err) => {
  770. Toast({
  771. title: err,
  772. });
  773. });
  774. }
  775. function cancelOrder() {
  776. uni.showModal({
  777. title: "提示",
  778. content: "确认取消该订单?",
  779. success: function (res) {
  780. if (res.confirm) {
  781. orderCancel(orderInfo.id)
  782. .then(() => {
  783. Toast({
  784. title: "取消成功",
  785. });
  786. uni.navigateTo({
  787. url: "/pages/order_list/index",
  788. });
  789. })
  790. .catch((err) => {
  791. Toast({
  792. title: err,
  793. });
  794. getOrderInfo();
  795. });
  796. }
  797. },
  798. });
  799. }
  800. function refreshPayStatus() {
  801. const orderId = orderInfo.orderId;
  802. if (!orderId) return Toast({ title: "缺少订单号" });
  803. uni.showLoading({ title: "查询中..." });
  804. queryPaymentStatus(orderId)
  805. .then((res) => {
  806. uni.hideLoading();
  807. const isPaid = res.data?.tradeState === "SUCCESS";
  808. if (isPaid) {
  809. Toast({ title: "支付成功,订单已更新", icon: "success" }, () => {
  810. getOrderInfo();
  811. });
  812. } else {
  813. Toast({ title: "订单未支付,状态未变更" });
  814. }
  815. })
  816. .catch((err) => {
  817. uni.hideLoading();
  818. Toast({ title: err || "查询失败,请稍后重试" });
  819. });
  820. }
  821. // 生命周期
  822. onLoad((options) => {
  823. type.value =
  824. options.type == undefined || options.type == null ? "normal" : options.type;
  825. if (!options.order_id && !options.uniId) {
  826. Toast(
  827. {
  828. title: "缺少参数",
  829. },
  830. {
  831. tab: 3,
  832. url: 1,
  833. }
  834. );
  835. return;
  836. }
  837. order_id.value = options.order_id;
  838. });
  839. onShow(() => {
  840. if (appStore.isLogin) {
  841. getOrderInfo();
  842. payMode.value[0].number = appStore.$userInfo.nowMoney;
  843. payMode.value = [...payMode.value];
  844. } else {
  845. toLogin();
  846. }
  847. });
  848. onHide(() => {
  849. isClose.value = true;
  850. });
  851. const setOrderId = () => {
  852. uni.setClipboardData({
  853. data: orderInfo.orderId,
  854. success: function () {
  855. Toast({
  856. title: "复制成功",
  857. });
  858. },
  859. });
  860. };
  861. // 申请换货
  862. const changeProduct = () => {
  863. changeProductShow.value = true;
  864. changeProductReason.value = "";
  865. };
  866. // 换货申请确认
  867. const changeProductSure = async () => {
  868. if (!changeProductReason.value) {
  869. uni.showToast({ title: "请输入换货理由", icon: "none" });
  870. return;
  871. }
  872. let obj = {
  873. text: changeProductReason.value,
  874. uni: orderInfo.orderId,
  875. };
  876. const res = await applyExchange(obj);
  877. if (res.code == 200) {
  878. changeProductShow.value = false;
  879. getOrderInfo();
  880. payMode.value[0].number = appStore.$userInfo.nowMoney;
  881. payMode.value = [...payMode.value];
  882. }
  883. };
  884. </script>
  885. <style>
  886. page {
  887. background: #f9f7f0;
  888. }
  889. </style>
  890. <style scoped lang="scss">
  891. .order-details {
  892. padding: 16rpx;
  893. .header {
  894. padding: 16rpx;
  895. border-radius: 16rpx;
  896. background: #ffffff;
  897. .picTxt {
  898. margin-bottom: 16rpx;
  899. display: flex;
  900. font-size: 28rpx;
  901. align-items: center;
  902. image {
  903. width: 40rpx;
  904. height: 40rpx;
  905. }
  906. .data {
  907. margin: 0 8rpx;
  908. color: #f8c008;
  909. font-weight: bold;
  910. }
  911. }
  912. .header-bot {
  913. display: flex;
  914. color: #333333;
  915. font-size: 28rpx;
  916. .header-bot-right {
  917. flex: 1;
  918. }
  919. image {
  920. width: 40rpx;
  921. height: 40rpx;
  922. margin-right: 8rpx;
  923. }
  924. .header-bot-address {
  925. font-weight: bold;
  926. }
  927. .header-bot-name {
  928. text {
  929. &:first-child {
  930. margin-right: 32rpx;
  931. }
  932. }
  933. }
  934. }
  935. }
  936. .nav {
  937. background-color: #fff;
  938. font-size: 26rpx;
  939. color: #282828;
  940. padding: 27rpx 0;
  941. width: 100%;
  942. border-radius: 14rpx;
  943. }
  944. .address {
  945. font-size: 26rpx;
  946. color: #868686;
  947. background-color: #fff;
  948. margin-top: 15rpx;
  949. padding: 30rpx 24rpx;
  950. .name {
  951. font-size: 30rpx;
  952. color: #282828;
  953. margin-bottom: 15rpx;
  954. .phone {
  955. margin-left: 40rpx;
  956. }
  957. .iconfont {
  958. font-size: 34rpx;
  959. margin-left: 10rpx;
  960. }
  961. }
  962. }
  963. .line {
  964. width: 100%;
  965. height: 3rpx;
  966. image {
  967. width: 100%;
  968. height: 100%;
  969. display: block;
  970. }
  971. }
  972. .wrapper {
  973. background-color: #ffffff;
  974. margin-top: 16rpx;
  975. padding: 16rpx;
  976. border-radius: 16rpx;
  977. .wrapper-return {
  978. display: flex;
  979. margin-top: 16rpx;
  980. justify-content: flex-end;
  981. .cancel {
  982. color: #333333;
  983. width: 190rpx;
  984. height: 60rpx;
  985. display: flex;
  986. align-items: center;
  987. justify-content: center;
  988. font-size: 28rpx;
  989. background: #f1f3f8;
  990. border-radius: 8rpx;
  991. }
  992. }
  993. .wrapper-title {
  994. color: #333333;
  995. font-size: 32rpx;
  996. font-weight: bold;
  997. }
  998. .item {
  999. font-size: 28rpx;
  1000. color: #666666;
  1001. display: flex;
  1002. margin-top: 16rpx;
  1003. justify-content: space-between;
  1004. view {
  1005. &:last-child {
  1006. color: #333333;
  1007. }
  1008. &.red {
  1009. color: #fd5f3c;
  1010. font-weight: bold;
  1011. }
  1012. &.txt {
  1013. font-weight: bold;
  1014. }
  1015. }
  1016. .conter {
  1017. flex: 1;
  1018. text-align: right;
  1019. margin-left: 16rpx;
  1020. .copy {
  1021. font-size: 28rpx;
  1022. color: #f8c008;
  1023. font-weight: bold;
  1024. margin-left: 8rpx;
  1025. padding-left: 8rpx;
  1026. border-left: 2rpx solid #d8d8d8;
  1027. }
  1028. }
  1029. }
  1030. .actualPay {
  1031. border-top: 1rpx solid #eee;
  1032. margin-top: 30rpx;
  1033. padding-top: 30rpx;
  1034. .money {
  1035. font-weight: bold;
  1036. font-size: 30rpx;
  1037. }
  1038. }
  1039. }
  1040. .writeOff {
  1041. background-color: #fff;
  1042. margin-top: 15rpx;
  1043. padding-bottom: 50rpx;
  1044. .title {
  1045. font-size: 30rpx;
  1046. color: #282828;
  1047. height: 87rpx;
  1048. border-bottom: 1px solid #f0f0f0;
  1049. padding: 0 24rpx;
  1050. line-height: 87rpx;
  1051. }
  1052. .grayBg {
  1053. background-color: #f2f5f7;
  1054. width: 590rpx;
  1055. height: 384rpx;
  1056. border-radius: 20rpx 20rpx 0 0;
  1057. margin: 50rpx auto 0 auto;
  1058. padding-top: 55rpx;
  1059. .pictrue {
  1060. width: 290rpx;
  1061. height: 290rpx;
  1062. margin: 0 auto;
  1063. image {
  1064. width: 100%;
  1065. height: 100%;
  1066. display: block;
  1067. }
  1068. }
  1069. }
  1070. .gear {
  1071. width: 590rpx;
  1072. height: 30rpx;
  1073. margin: 0 auto;
  1074. image {
  1075. width: 100%;
  1076. height: 100%;
  1077. display: block;
  1078. }
  1079. }
  1080. .num {
  1081. background-color: #f0c34c;
  1082. width: 590rpx;
  1083. height: 84rpx;
  1084. color: #282828;
  1085. font-size: 48rpx;
  1086. margin: 0 auto;
  1087. border-radius: 0 0 20rpx 20rpx;
  1088. text-align: center;
  1089. padding-top: 4rpx;
  1090. }
  1091. .rules {
  1092. margin: 46rpx 30rpx 0 30rpx;
  1093. border-top: 1px solid #f0f0f0;
  1094. padding-top: 10rpx;
  1095. .item {
  1096. margin-top: 20rpx;
  1097. .rulesTitle {
  1098. font-size: 28rpx;
  1099. color: #282828;
  1100. .iconfont {
  1101. font-size: 30rpx;
  1102. color: #333;
  1103. margin-right: 8rpx;
  1104. margin-top: 5rpx;
  1105. }
  1106. }
  1107. .info {
  1108. font-size: 28rpx;
  1109. color: #999;
  1110. margin-top: 7rpx;
  1111. .time {
  1112. margin-left: 20rpx;
  1113. }
  1114. }
  1115. }
  1116. }
  1117. }
  1118. .map {
  1119. height: 86rpx;
  1120. font-size: 30rpx;
  1121. color: #282828;
  1122. line-height: 86rpx;
  1123. border-bottom: 1px solid #f0f0f0;
  1124. margin-top: 15rpx;
  1125. background-color: #fff;
  1126. padding: 0 24rpx;
  1127. .place {
  1128. font-size: 26rpx;
  1129. width: 176rpx;
  1130. height: 50rpx;
  1131. border-radius: 25rpx;
  1132. line-height: 50rpx;
  1133. text-align: center;
  1134. .iconfont {
  1135. font-size: 27rpx;
  1136. height: 27rpx;
  1137. line-height: 27rpx;
  1138. margin: 2rpx 3rpx 0 0;
  1139. }
  1140. }
  1141. }
  1142. .refund {
  1143. padding: 0 !important;
  1144. margin-top: 15rpx;
  1145. background-color: #fff;
  1146. .title {
  1147. display: flex;
  1148. align-items: center;
  1149. font-size: 30rpx;
  1150. color: #333;
  1151. height: 86rpx;
  1152. border-bottom: 1px solid #f5f5f5;
  1153. font-weight: 400;
  1154. padding: 0 24rpx;
  1155. image {
  1156. width: 32rpx;
  1157. height: 32rpx;
  1158. margin-right: 10rpx;
  1159. }
  1160. }
  1161. .con {
  1162. font-size: 25rpx;
  1163. color: #666666;
  1164. padding: 30rpx 24rpx;
  1165. }
  1166. }
  1167. }
  1168. .goodCall {
  1169. color: $theme-color;
  1170. text-align: center;
  1171. width: 100%;
  1172. height: 86rpx;
  1173. padding: 0 30rpx;
  1174. border-bottom: 1rpx solid #eee;
  1175. font-size: 30rpx;
  1176. line-height: 86rpx;
  1177. background: #fff;
  1178. .icon-kefu {
  1179. font-size: 36rpx;
  1180. margin-right: 15rpx;
  1181. }
  1182. /* #ifdef MP */
  1183. button {
  1184. display: flex;
  1185. align-items: center;
  1186. justify-content: center;
  1187. height: 86rpx;
  1188. font-size: 30rpx;
  1189. color: $theme-color;
  1190. }
  1191. /* #endif */
  1192. }
  1193. .kong {
  1194. height: calc(132rpx + constant(safe-area-inset-bottom));
  1195. height: calc(132rpx + env(safe-area-inset-bottom));
  1196. }
  1197. .footer {
  1198. position: fixed;
  1199. bottom: 0;
  1200. width: 100%;
  1201. padding-bottom: constant(safe-area-inset-bottom);
  1202. padding-bottom: env(safe-area-inset-bottom);
  1203. z-index: 9;
  1204. background: #ffffff;
  1205. box-shadow: inset 0rpx 1rpx 0rpx 0rpx #f1f3f8;
  1206. .footer-box {
  1207. display: flex;
  1208. align-items: center;
  1209. justify-content: space-between;
  1210. padding: 22rpx 32rpx;
  1211. padding: 22rpx 32rpx;
  1212. }
  1213. .qs-btn {
  1214. display: flex;
  1215. align-items: center;
  1216. justify-content: center;
  1217. flex-direction: column;
  1218. image {
  1219. width: 40rpx;
  1220. height: 40rpx;
  1221. }
  1222. view {
  1223. color: #333333;
  1224. font-size: 20rpx;
  1225. line-height: 36rpx;
  1226. }
  1227. }
  1228. .buyPlay {
  1229. display: flex;
  1230. align-items: center;
  1231. .buyPlay-left {
  1232. text-align: right;
  1233. .buyPlay-left-top {
  1234. text {
  1235. color: #333333;
  1236. font-size: 24rpx;
  1237. font-weight: bold;
  1238. &:last-child {
  1239. color: #fd5f3c;
  1240. }
  1241. }
  1242. }
  1243. .buyPlay-left-bot {
  1244. color: #fd5f3c;
  1245. font-size: 24rpx;
  1246. line-height: 40rpx;
  1247. }
  1248. }
  1249. .buyPlay-btn {
  1250. color: #333333;
  1251. width: 224rpx;
  1252. height: 88rpx;
  1253. display: flex;
  1254. font-size: 32rpx;
  1255. font-weight: bold;
  1256. align-items: center;
  1257. justify-content: center;
  1258. background: #f8c008;
  1259. border-radius: 16rpx;
  1260. margin-left: 16rpx;
  1261. }
  1262. }
  1263. .wuliu {
  1264. width: 252rpx;
  1265. background: rgba(248, 192, 8, 0.1);
  1266. }
  1267. .shouhuo {
  1268. width: 418rpx;
  1269. background: #f8c008;
  1270. }
  1271. .align-center {
  1272. height: 88rpx;
  1273. border-radius: 16rpx;
  1274. color: #333333;
  1275. font-size: 32rpx;
  1276. font-weight: bold;
  1277. display: flex;
  1278. align-items: center;
  1279. justify-content: center;
  1280. }
  1281. .buy {
  1282. background: #f8c008;
  1283. }
  1284. }
  1285. .changeProductReasonPopup {
  1286. padding: 20rpx;
  1287. box-sizing: border-box;
  1288. .title {
  1289. font-size: 28rpx;
  1290. color: #333;
  1291. text-align: center;
  1292. padding: 10rpx 20rpx;
  1293. }
  1294. .text-area {
  1295. border: 2rpx solid #dedede;
  1296. border-radius: 20rpx;
  1297. padding: 20rpx;
  1298. margin-top: 20rpx;
  1299. }
  1300. .btnView {
  1301. display: flex;
  1302. width: 100%;
  1303. gap: 20rpx;
  1304. align-items: center;
  1305. justify-content: center;
  1306. margin-top: 40rpx;
  1307. .sure {
  1308. background: #f8c008;
  1309. color: #fff;
  1310. width: 200rpx;
  1311. height: 60rpx;
  1312. line-height: 60rpx;
  1313. }
  1314. .cancel {
  1315. background-color: #f1f3f8;
  1316. color: #333333;
  1317. width: 200rpx;
  1318. height: 60rpx;
  1319. line-height: 60rpx;
  1320. }
  1321. }
  1322. }
  1323. </style>