index.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389
  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="buyPlay"
  328. v-if="!orderInfo.paid"
  329. @tap="pay_open(orderInfo.orderId)"
  330. >
  331. <view class="buyPlay-left">
  332. <view class="buyPlay-left-top">
  333. <text>合计:</text>
  334. <text>{{
  335. orderInfo.mallType === 0
  336. ? `¥${orderInfo.payPrice}`
  337. : `${Number(orderInfo.proTotalPrice)}贝币`
  338. }}</text>
  339. </view>
  340. <view class="buyPlay-left-bot" v-if="orderInfo.mallType === 0"
  341. >共减¥{{ orderInfo.vipLevelDis }}</view
  342. >
  343. </view>
  344. <view class="buyPlay-btn">立即付款</view>
  345. </view>
  346. <view class="qs-btn" v-if="orderInfo.status == 3" @tap="delOrder">
  347. <image src="@/static/images/shop/delorder@2x.png" mode=""></image>
  348. <view class="">删除订单</view>
  349. </view>
  350. <navigator
  351. class="wuliu align-center"
  352. v-if="orderInfo.deliveryType == 'express' && orderInfo.status > 0"
  353. hover-class="none"
  354. :url="`/pages/users/goods_logistics/index?orderId=${orderInfo.orderId}`"
  355. >查看物流
  356. </navigator>
  357. <view
  358. class="wuliu align-center buy"
  359. v-if="orderInfo.status == 3 && orderInfo.type !== 1"
  360. @click="goOrderConfirm"
  361. >再次购买
  362. </view>
  363. <view
  364. class="align-center shouhuo"
  365. v-if="orderInfo.status == 1"
  366. @tap="confirmOrder"
  367. style="width: 100%"
  368. >确认收货</view
  369. >
  370. </view>
  371. </view>
  372. </template>
  373. <payment
  374. :payMode="payMode"
  375. :showPopup="showPopup"
  376. @payComplete="payComplete"
  377. @close="payClose"
  378. :order_id="pay_order_id"
  379. :totalPrice="totalPrice"
  380. :mallType="orderInfo.mallType"
  381. ></payment>
  382. <WechatPayment ref="wechatPaymentRef" />
  383. <!-- 申请换货弹窗-->
  384. <up-popup
  385. :show="changeProductShow"
  386. @close="changeProductShow = false"
  387. closeable
  388. >
  389. <view class="changeProductReasonPopup">
  390. <view class="title">理由</view>
  391. <up-textarea
  392. class="text-area"
  393. v-model="changeProductReason"
  394. placeholder="请输入换货理由"
  395. ></up-textarea>
  396. <view class="btnView">
  397. <button class="sure" @click="changeProductSure">确定</button>
  398. <button class="cancel" @click="changeProductShow = false">
  399. 取消
  400. </button>
  401. </view>
  402. </view>
  403. </up-popup>
  404. </view>
  405. </template>
  406. <script setup>
  407. import { ref, reactive, computed } from "vue";
  408. import { useAppStore } from "@/stores/app.js";
  409. import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
  410. import {
  411. getOrderDetail,
  412. orderTake,
  413. orderDel,
  414. orderCancel,
  415. qrcodeApi,
  416. applyExchange,
  417. } from "@/api/order.js";
  418. import { openOrderRefundSubscribe } from "@/utils/SubscribeMessage.js";
  419. import payment from "@/components/payment";
  420. import WechatPayment from "@/components/payment/WechatPayment.vue";
  421. import orderGoods from "@/components/orderGoods";
  422. import { toLogin } from "@/libs/login.js";
  423. import { useToast } from "@/hooks/useToast";
  424. import { getPreOrder } from "@/libs/order";
  425. const appStore = useAppStore();
  426. const { Toast } = useToast();
  427. const codeImg = ref("");
  428. const order_id = ref("");
  429. const evaluate = ref(0);
  430. const cartInfo = ref([]);
  431. const orderInfo = reactive({
  432. systemStore: {},
  433. pstatus: {},
  434. });
  435. const system_store = ref({});
  436. const isGoodsReturn = ref(false);
  437. const status = ref({});
  438. const isClose = ref(false);
  439. const payMode = ref([
  440. {
  441. name: "微信支付",
  442. icon: "icon-wechat",
  443. value: "weixin",
  444. title: "微信快捷支付",
  445. payChannel: "routine",
  446. number: 0,
  447. },
  448. // {
  449. // name: "余额支付",
  450. // icon: "icon-balance",
  451. // value: "yue",
  452. // title: "可用余额:",
  453. // payChannel: "yue",
  454. // number: 0,
  455. // },
  456. ]);
  457. const showPopup = ref(false);
  458. const pay_order_id = ref("");
  459. const totalPrice = ref("0");
  460. const id = ref(0);
  461. const uniId = ref("");
  462. const type = ref("normal");
  463. const wechatPaymentRef = ref(null);
  464. const WX_PAY_STATUS = {
  465. SUCCESS: "支付成功",
  466. FAIL: "支付失败",
  467. CANCEL: "用户取消支付",
  468. };
  469. const changeProductShow = ref(false);
  470. const changeProductReason = ref("");
  471. function payComplete() {
  472. showPopup.value = false;
  473. pay_order_id.value = "";
  474. getOrderInfo();
  475. }
  476. function openSubcribe(page) {
  477. uni.showLoading({
  478. title: "正在加载",
  479. });
  480. openOrderRefundSubscribe()
  481. .then(() => {
  482. uni.hideLoading();
  483. uni.navigateTo({
  484. url: page,
  485. });
  486. })
  487. .catch(() => {
  488. uni.hideLoading();
  489. });
  490. }
  491. function makePhone() {
  492. uni.makePhoneCall({
  493. phoneNumber: system_store.value.phone,
  494. });
  495. }
  496. function payClose() {
  497. showPopup.value = false;
  498. }
  499. function pay_open() {
  500. const orderNo = orderInfo.orderId;
  501. const price = orderInfo.payPrice;
  502. const goPages = "/pages/order_pay_status/index?order_id=" + orderNo;
  503. uni.showActionSheet({
  504. itemList: ["微信支付"],
  505. success: async (res) => {
  506. if (res.tapIndex === 0) {
  507. // 微信支付
  508. uni.showLoading({ title: "订单支付中" });
  509. try {
  510. await wechatPaymentRef.value.createUniPay({
  511. amount: Number(price) * 100,
  512. description: `商品(¥${price})`,
  513. openId: appStore.$userInfo.openId,
  514. orderNo: orderNo,
  515. orderPrefix: "SHOP",
  516. onUniPaySuccess: async () => {
  517. try {
  518. return Toast(
  519. { title: "支付成功", icon: "success" },
  520. { tab: 4, url: goPages }
  521. );
  522. } catch (err) {
  523. console.error("支付失败:", err);
  524. uni.showToast({ title: "支付失败,请重试", icon: "none" });
  525. }
  526. },
  527. onUniPayCancel: () => {
  528. uni.showToast({ title: "用户取消支付", icon: "none" });
  529. },
  530. onUniPayFail: (err) => {
  531. uni.showToast({ title: "支付失败,请重试", icon: "none" });
  532. },
  533. });
  534. uni.hideLoading();
  535. } catch (wxErr) {
  536. uni.hideLoading();
  537. const errMsg = wxErr?.errMsg || "";
  538. if (errMsg.includes("cancel") || errMsg.includes("取消")) {
  539. return Toast(
  540. { title: WX_PAY_STATUS.CANCEL },
  541. { tab: 5, url: `${goPages}&msg=${WX_PAY_STATUS.CANCEL}` }
  542. );
  543. }
  544. return Toast(
  545. { title: WX_PAY_STATUS.FAIL },
  546. { tab: 5, url: `${goPages}&msg=${errMsg || WX_PAY_STATUS.FAIL}` }
  547. );
  548. }
  549. } else if (res.tapIndex === 1) {
  550. // 余额支付,沿用原有弹窗
  551. showPopup.value = true;
  552. pay_order_id.value = orderNo;
  553. totalPrice.value = price;
  554. }
  555. },
  556. });
  557. }
  558. function getRefundStatus() {
  559. const statusMap = {
  560. 1: "商家审核中",
  561. 2: "商家已退款",
  562. 3: "商家退款中",
  563. };
  564. return orderInfo?.refundStatus ? statusMap[orderInfo.refundStatus] : "";
  565. }
  566. function getRefundReason() {
  567. if (orderInfo.refundStatus == 1) {
  568. return "您已成功发起退款申请,请耐心等待商家处理;退款前请与商家协商一致,有助于更好的处理售后问题";
  569. } else if (orderInfo.refundStatus == 2) {
  570. return "退款已成功受理,如商家已寄出商品请尽快退回;感谢您的支持";
  571. } else if (orderInfo?.refundReason) {
  572. return "拒绝原因:" + orderInfo?.refundReason;
  573. }
  574. }
  575. // 订单步骤配置
  576. const orderSteps = ref([
  577. {
  578. title: "待付款",
  579. },
  580. {
  581. title: "待发货",
  582. },
  583. {
  584. title: "待收货",
  585. },
  586. {
  587. title: "已完成",
  588. },
  589. ]);
  590. // 当前的订单状态
  591. const curOrderStep = computed(() => {
  592. let step = 0;
  593. if (!orderInfo.paid) {
  594. step = 0; // 待付款
  595. } else if (orderInfo.status === 0) {
  596. step = 1; // 待发货
  597. } else if (orderInfo.status === 1) {
  598. step = 2; // 待收货
  599. } else if (orderInfo.status === 2 || orderInfo.status === 3) {
  600. step = 3; // 已完成
  601. }
  602. return step;
  603. });
  604. // 当前的订单状态
  605. const curOrderStepTxt = computed(() => {
  606. let step = "";
  607. if (!orderInfo.paid) {
  608. step = "待付款"; // 待付款
  609. } else if (orderInfo.status === 0) {
  610. step = "待发货"; // 待发货
  611. } else if (orderInfo.status === 1) {
  612. step = "待收货"; // 待收货
  613. } else if (orderInfo.status === 2 || orderInfo.status === 3) {
  614. step = "已完成"; // 已完成
  615. }
  616. return step;
  617. });
  618. function getOrderInfo() {
  619. uni.showLoading({
  620. title: "正在加载中",
  621. });
  622. getOrderDetail(order_id.value)
  623. .then((res) => {
  624. uni.hideLoading();
  625. Object.assign(orderInfo, res.data);
  626. evaluate.value = res.data.status == 2 ? 2 : 0;
  627. system_store.value = res.data.systemStore;
  628. id.value = res.data.id;
  629. cartInfo.value = res.data.orderInfoList;
  630. if (res.data.refundStatus != 0) isGoodsReturn.value = true;
  631. if (orderInfo.shippingType == 2 && orderInfo.paid)
  632. markCode(res.data.verifyCode);
  633. if (orderInfo.refundStatus > 0) {
  634. // uni.setNavigationBarColor({
  635. // frontColor: "#ffffff",
  636. // backgroundColor: "#666666",
  637. // });
  638. }
  639. })
  640. .catch((err) => {
  641. uni.hideLoading();
  642. Toast(
  643. {
  644. title: err,
  645. },
  646. "/pages/users/order_list/index"
  647. );
  648. });
  649. }
  650. function markCode(text) {
  651. qrcodeApi({
  652. height: "145",
  653. text: text,
  654. width: "145",
  655. }).then((res) => {
  656. codeImg.value = res.data.code;
  657. });
  658. }
  659. // #ifndef H5
  660. function copy() {
  661. uni.setClipboardData({
  662. data: orderInfo.orderId,
  663. });
  664. }
  665. // #endif
  666. function goTel() {
  667. uni.makePhoneCall({
  668. phoneNumber: orderInfo.deliveryId,
  669. });
  670. }
  671. function getOrderStatus() {
  672. let _orderInfo = orderInfo || {},
  673. _status = _orderInfo.pstatus || {
  674. type: 0,
  675. },
  676. _statusObj = {};
  677. let typeVal = parseInt(_status.type),
  678. delivery_type = _orderInfo.deliveryType,
  679. seckill_id = _orderInfo.seckillId ? parseInt(_orderInfo.seckillId) : 0,
  680. bargain_id = _orderInfo.bargainId ? parseInt(_orderInfo.bargainId) : 0,
  681. combination_id = _orderInfo.combinationId
  682. ? parseInt(_orderInfo.combinationId)
  683. : 0;
  684. _statusObj = {
  685. type: typeVal == 9 ? -9 : typeVal,
  686. class_status: 0,
  687. };
  688. if (typeVal == 1 && combination_id > 0) _statusObj.class_status = 1;
  689. if (typeVal == 2 && delivery_type == "express") _statusObj.class_status = 2;
  690. if (typeVal == 2) _statusObj.class_status = 3;
  691. if (typeVal == 4 || typeVal == 0) _statusObj.class_status = 4;
  692. if (
  693. !seckill_id &&
  694. !bargain_id &&
  695. !combination_id &&
  696. (typeVal == 3 || typeVal == 4)
  697. )
  698. _statusObj.class_status = 5;
  699. status.value = _statusObj;
  700. }
  701. function goJoinPink() {
  702. uni.navigateTo({
  703. url:
  704. "/pages/activity/goods_combination_status/index?id=" + orderInfo.pinkId,
  705. });
  706. }
  707. function goOrderConfirm() {
  708. const params = {
  709. mallType: orderInfo.mallType,
  710. preOrderType: "again",
  711. orderDetails: [
  712. {
  713. orderNo: order_id.value,
  714. },
  715. ],
  716. };
  717. getPreOrder(params);
  718. }
  719. function confirmOrder() {
  720. uni.showModal({
  721. title: "确认收货",
  722. content: "为保障权益,请收到货确认无误后,再确认收货",
  723. success: function (res) {
  724. if (res.confirm) {
  725. orderTake(id.value)
  726. .then(() => {
  727. Toast(
  728. {
  729. title: "操作成功",
  730. icon: "success",
  731. },
  732. function () {
  733. getOrderInfo();
  734. }
  735. );
  736. })
  737. .catch((err) => {
  738. Toast({
  739. title: err,
  740. });
  741. });
  742. }
  743. },
  744. });
  745. }
  746. function delOrder() {
  747. orderDel(id.value)
  748. .then(() => {
  749. Toast(
  750. {
  751. title: "删除成功",
  752. icon: "success",
  753. },
  754. {
  755. tab: 3,
  756. url: 1,
  757. }
  758. );
  759. })
  760. .catch((err) => {
  761. Toast({
  762. title: err,
  763. });
  764. });
  765. }
  766. function cancelOrder() {
  767. uni.showModal({
  768. title: "提示",
  769. content: "确认取消该订单?",
  770. success: function (res) {
  771. if (res.confirm) {
  772. orderCancel(orderInfo.id)
  773. .then(() => {
  774. Toast({
  775. title: "取消成功",
  776. });
  777. uni.navigateTo({
  778. url: "/pages/order_list/index",
  779. });
  780. })
  781. .catch((err) => {
  782. Toast({
  783. title: err,
  784. });
  785. getOrderInfo();
  786. });
  787. }
  788. },
  789. });
  790. }
  791. // 生命周期
  792. onLoad((options) => {
  793. type.value =
  794. options.type == undefined || options.type == null ? "normal" : options.type;
  795. if (!options.order_id && !options.uniId) {
  796. Toast(
  797. {
  798. title: "缺少参数",
  799. },
  800. {
  801. tab: 3,
  802. url: 1,
  803. }
  804. );
  805. return;
  806. }
  807. order_id.value = options.order_id;
  808. });
  809. onShow(() => {
  810. if (appStore.isLogin) {
  811. getOrderInfo();
  812. payMode.value[0].number = appStore.$userInfo.nowMoney;
  813. payMode.value = [...payMode.value];
  814. } else {
  815. toLogin();
  816. }
  817. });
  818. onHide(() => {
  819. isClose.value = true;
  820. });
  821. const setOrderId = () => {
  822. uni.setClipboardData({
  823. data: orderInfo.orderId,
  824. success: function () {
  825. Toast({
  826. title: "复制成功",
  827. });
  828. },
  829. });
  830. };
  831. // 申请换货
  832. const changeProduct = () => {
  833. changeProductShow.value = true;
  834. changeProductReason.value = "";
  835. };
  836. // 换货申请确认
  837. const changeProductSure = async () => {
  838. if (!changeProductReason.value) {
  839. uni.showToast({ title: "请输入换货理由", icon: "none" });
  840. return;
  841. }
  842. let obj = {
  843. text: changeProductReason.value,
  844. uni: orderInfo.orderId,
  845. };
  846. const res = await applyExchange(obj);
  847. if (res.code == 200) {
  848. changeProductShow.value = false;
  849. getOrderInfo();
  850. payMode.value[0].number = appStore.$userInfo.nowMoney;
  851. payMode.value = [...payMode.value];
  852. }
  853. };
  854. </script>
  855. <style>
  856. page {
  857. background: #f9f7f0;
  858. }
  859. </style>
  860. <style scoped lang="scss">
  861. .order-details {
  862. padding: 16rpx;
  863. .header {
  864. padding: 16rpx;
  865. border-radius: 16rpx;
  866. background: #ffffff;
  867. .picTxt {
  868. margin-bottom: 16rpx;
  869. display: flex;
  870. font-size: 28rpx;
  871. align-items: center;
  872. image {
  873. width: 40rpx;
  874. height: 40rpx;
  875. }
  876. .data {
  877. margin: 0 8rpx;
  878. color: #f8c008;
  879. font-weight: bold;
  880. }
  881. }
  882. .header-bot {
  883. display: flex;
  884. color: #333333;
  885. font-size: 28rpx;
  886. .header-bot-right {
  887. flex: 1;
  888. }
  889. image {
  890. width: 40rpx;
  891. height: 40rpx;
  892. margin-right: 8rpx;
  893. }
  894. .header-bot-address {
  895. font-weight: bold;
  896. }
  897. .header-bot-name {
  898. text {
  899. &:first-child {
  900. margin-right: 32rpx;
  901. }
  902. }
  903. }
  904. }
  905. }
  906. .nav {
  907. background-color: #fff;
  908. font-size: 26rpx;
  909. color: #282828;
  910. padding: 27rpx 0;
  911. width: 100%;
  912. border-radius: 14rpx;
  913. }
  914. .address {
  915. font-size: 26rpx;
  916. color: #868686;
  917. background-color: #fff;
  918. margin-top: 15rpx;
  919. padding: 30rpx 24rpx;
  920. .name {
  921. font-size: 30rpx;
  922. color: #282828;
  923. margin-bottom: 15rpx;
  924. .phone {
  925. margin-left: 40rpx;
  926. }
  927. .iconfont {
  928. font-size: 34rpx;
  929. margin-left: 10rpx;
  930. }
  931. }
  932. }
  933. .line {
  934. width: 100%;
  935. height: 3rpx;
  936. image {
  937. width: 100%;
  938. height: 100%;
  939. display: block;
  940. }
  941. }
  942. .wrapper {
  943. background-color: #ffffff;
  944. margin-top: 16rpx;
  945. padding: 16rpx;
  946. border-radius: 16rpx;
  947. .wrapper-return {
  948. display: flex;
  949. margin-top: 16rpx;
  950. justify-content: flex-end;
  951. .cancel {
  952. color: #333333;
  953. width: 190rpx;
  954. height: 60rpx;
  955. display: flex;
  956. align-items: center;
  957. justify-content: center;
  958. font-size: 28rpx;
  959. background: #f1f3f8;
  960. border-radius: 8rpx;
  961. }
  962. }
  963. .wrapper-title {
  964. color: #333333;
  965. font-size: 32rpx;
  966. font-weight: bold;
  967. }
  968. .item {
  969. font-size: 28rpx;
  970. color: #666666;
  971. display: flex;
  972. margin-top: 16rpx;
  973. justify-content: space-between;
  974. view {
  975. &:last-child {
  976. color: #333333;
  977. }
  978. &.red {
  979. color: #fd5f3c;
  980. font-weight: bold;
  981. }
  982. &.txt {
  983. font-weight: bold;
  984. }
  985. }
  986. .conter {
  987. flex: 1;
  988. text-align: right;
  989. margin-left: 16rpx;
  990. .copy {
  991. font-size: 28rpx;
  992. color: #f8c008;
  993. font-weight: bold;
  994. margin-left: 8rpx;
  995. padding-left: 8rpx;
  996. border-left: 2rpx solid #d8d8d8;
  997. }
  998. }
  999. }
  1000. .actualPay {
  1001. border-top: 1rpx solid #eee;
  1002. margin-top: 30rpx;
  1003. padding-top: 30rpx;
  1004. .money {
  1005. font-weight: bold;
  1006. font-size: 30rpx;
  1007. }
  1008. }
  1009. }
  1010. .writeOff {
  1011. background-color: #fff;
  1012. margin-top: 15rpx;
  1013. padding-bottom: 50rpx;
  1014. .title {
  1015. font-size: 30rpx;
  1016. color: #282828;
  1017. height: 87rpx;
  1018. border-bottom: 1px solid #f0f0f0;
  1019. padding: 0 24rpx;
  1020. line-height: 87rpx;
  1021. }
  1022. .grayBg {
  1023. background-color: #f2f5f7;
  1024. width: 590rpx;
  1025. height: 384rpx;
  1026. border-radius: 20rpx 20rpx 0 0;
  1027. margin: 50rpx auto 0 auto;
  1028. padding-top: 55rpx;
  1029. .pictrue {
  1030. width: 290rpx;
  1031. height: 290rpx;
  1032. margin: 0 auto;
  1033. image {
  1034. width: 100%;
  1035. height: 100%;
  1036. display: block;
  1037. }
  1038. }
  1039. }
  1040. .gear {
  1041. width: 590rpx;
  1042. height: 30rpx;
  1043. margin: 0 auto;
  1044. image {
  1045. width: 100%;
  1046. height: 100%;
  1047. display: block;
  1048. }
  1049. }
  1050. .num {
  1051. background-color: #f0c34c;
  1052. width: 590rpx;
  1053. height: 84rpx;
  1054. color: #282828;
  1055. font-size: 48rpx;
  1056. margin: 0 auto;
  1057. border-radius: 0 0 20rpx 20rpx;
  1058. text-align: center;
  1059. padding-top: 4rpx;
  1060. }
  1061. .rules {
  1062. margin: 46rpx 30rpx 0 30rpx;
  1063. border-top: 1px solid #f0f0f0;
  1064. padding-top: 10rpx;
  1065. .item {
  1066. margin-top: 20rpx;
  1067. .rulesTitle {
  1068. font-size: 28rpx;
  1069. color: #282828;
  1070. .iconfont {
  1071. font-size: 30rpx;
  1072. color: #333;
  1073. margin-right: 8rpx;
  1074. margin-top: 5rpx;
  1075. }
  1076. }
  1077. .info {
  1078. font-size: 28rpx;
  1079. color: #999;
  1080. margin-top: 7rpx;
  1081. .time {
  1082. margin-left: 20rpx;
  1083. }
  1084. }
  1085. }
  1086. }
  1087. }
  1088. .map {
  1089. height: 86rpx;
  1090. font-size: 30rpx;
  1091. color: #282828;
  1092. line-height: 86rpx;
  1093. border-bottom: 1px solid #f0f0f0;
  1094. margin-top: 15rpx;
  1095. background-color: #fff;
  1096. padding: 0 24rpx;
  1097. .place {
  1098. font-size: 26rpx;
  1099. width: 176rpx;
  1100. height: 50rpx;
  1101. border-radius: 25rpx;
  1102. line-height: 50rpx;
  1103. text-align: center;
  1104. .iconfont {
  1105. font-size: 27rpx;
  1106. height: 27rpx;
  1107. line-height: 27rpx;
  1108. margin: 2rpx 3rpx 0 0;
  1109. }
  1110. }
  1111. }
  1112. .refund {
  1113. padding: 0 !important;
  1114. margin-top: 15rpx;
  1115. background-color: #fff;
  1116. .title {
  1117. display: flex;
  1118. align-items: center;
  1119. font-size: 30rpx;
  1120. color: #333;
  1121. height: 86rpx;
  1122. border-bottom: 1px solid #f5f5f5;
  1123. font-weight: 400;
  1124. padding: 0 24rpx;
  1125. image {
  1126. width: 32rpx;
  1127. height: 32rpx;
  1128. margin-right: 10rpx;
  1129. }
  1130. }
  1131. .con {
  1132. font-size: 25rpx;
  1133. color: #666666;
  1134. padding: 30rpx 24rpx;
  1135. }
  1136. }
  1137. }
  1138. .goodCall {
  1139. color: $theme-color;
  1140. text-align: center;
  1141. width: 100%;
  1142. height: 86rpx;
  1143. padding: 0 30rpx;
  1144. border-bottom: 1rpx solid #eee;
  1145. font-size: 30rpx;
  1146. line-height: 86rpx;
  1147. background: #fff;
  1148. .icon-kefu {
  1149. font-size: 36rpx;
  1150. margin-right: 15rpx;
  1151. }
  1152. /* #ifdef MP */
  1153. button {
  1154. display: flex;
  1155. align-items: center;
  1156. justify-content: center;
  1157. height: 86rpx;
  1158. font-size: 30rpx;
  1159. color: $theme-color;
  1160. }
  1161. /* #endif */
  1162. }
  1163. .kong {
  1164. height: calc(132rpx + constant(safe-area-inset-bottom));
  1165. height: calc(132rpx + env(safe-area-inset-bottom));
  1166. }
  1167. .footer {
  1168. position: fixed;
  1169. bottom: 0;
  1170. width: 100%;
  1171. padding-bottom: constant(safe-area-inset-bottom);
  1172. padding-bottom: env(safe-area-inset-bottom);
  1173. z-index: 9;
  1174. background: #ffffff;
  1175. box-shadow: inset 0rpx 1rpx 0rpx 0rpx #f1f3f8;
  1176. .footer-box {
  1177. display: flex;
  1178. align-items: center;
  1179. justify-content: space-between;
  1180. padding: 22rpx 32rpx;
  1181. padding: 22rpx 32rpx;
  1182. }
  1183. .qs-btn {
  1184. display: flex;
  1185. align-items: center;
  1186. justify-content: center;
  1187. flex-direction: column;
  1188. image {
  1189. width: 40rpx;
  1190. height: 40rpx;
  1191. }
  1192. view {
  1193. color: #333333;
  1194. font-size: 20rpx;
  1195. line-height: 36rpx;
  1196. }
  1197. }
  1198. .buyPlay {
  1199. display: flex;
  1200. align-items: center;
  1201. .buyPlay-left {
  1202. text-align: right;
  1203. .buyPlay-left-top {
  1204. text {
  1205. color: #333333;
  1206. font-size: 24rpx;
  1207. font-weight: bold;
  1208. &:last-child {
  1209. color: #fd5f3c;
  1210. }
  1211. }
  1212. }
  1213. .buyPlay-left-bot {
  1214. color: #fd5f3c;
  1215. font-size: 24rpx;
  1216. line-height: 40rpx;
  1217. }
  1218. }
  1219. .buyPlay-btn {
  1220. color: #333333;
  1221. width: 224rpx;
  1222. height: 88rpx;
  1223. display: flex;
  1224. font-size: 32rpx;
  1225. font-weight: bold;
  1226. align-items: center;
  1227. justify-content: center;
  1228. background: #f8c008;
  1229. border-radius: 16rpx;
  1230. margin-left: 16rpx;
  1231. }
  1232. }
  1233. .wuliu {
  1234. width: 252rpx;
  1235. background: rgba(248, 192, 8, 0.1);
  1236. }
  1237. .shouhuo {
  1238. width: 418rpx;
  1239. background: #f8c008;
  1240. }
  1241. .align-center {
  1242. height: 88rpx;
  1243. border-radius: 16rpx;
  1244. color: #333333;
  1245. font-size: 32rpx;
  1246. font-weight: bold;
  1247. display: flex;
  1248. align-items: center;
  1249. justify-content: center;
  1250. }
  1251. .buy {
  1252. background: #f8c008;
  1253. }
  1254. }
  1255. .changeProductReasonPopup {
  1256. padding: 20rpx;
  1257. box-sizing: border-box;
  1258. .title {
  1259. font-size: 28rpx;
  1260. color: #333;
  1261. text-align: center;
  1262. padding: 10rpx 20rpx;
  1263. }
  1264. .text-area {
  1265. border: 2rpx solid #dedede;
  1266. border-radius: 20rpx;
  1267. padding: 20rpx;
  1268. margin-top: 20rpx;
  1269. }
  1270. .btnView {
  1271. display: flex;
  1272. width: 100%;
  1273. gap: 20rpx;
  1274. align-items: center;
  1275. justify-content: center;
  1276. margin-top: 40rpx;
  1277. .sure {
  1278. background: #f8c008;
  1279. color: #fff;
  1280. width: 200rpx;
  1281. height: 60rpx;
  1282. line-height: 60rpx;
  1283. }
  1284. .cancel {
  1285. background-color: #f1f3f8;
  1286. color: #333333;
  1287. width: 200rpx;
  1288. height: 60rpx;
  1289. line-height: 60rpx;
  1290. }
  1291. }
  1292. }
  1293. </style>