details.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. <template>
  2. <Theme>
  3. <Navbar fixed>
  4. <template #center>
  5. <view class="nav_title">
  6. <trans _t="tabbar.订单详情" />
  7. </view>
  8. </template>
  9. </Navbar>
  10. <view class="content">
  11. <view class="overview">
  12. <view class="img_box">
  13. <image
  14. class="img"
  15. mode="aspectFit"
  16. :src="queryData?.goods[0]['pic_url']"
  17. ></image>
  18. </view>
  19. <view class="information">
  20. <text class="name">{{ queryData?.goods[0]["goodTitle"] }}</text>
  21. <view>
  22. {{ queryData?.goods[0]["sku_desc"] }}
  23. </view>
  24. <view class="num">x{{ queryData?.goods[0]["total"] }}</view>
  25. </view>
  26. </view>
  27. <view class="price_box">
  28. <text class="currency">{{ symbol.symbol }}:</text>
  29. <rich-text
  30. class="texts"
  31. :nodes="Moneyhtml(queryData?.goods[0]['price'])"
  32. ></rich-text>
  33. </view>
  34. <view class="dashed"></view>
  35. <view class="text_box">
  36. <trans class="title" _t="实付"></trans>
  37. <view class="price_box">
  38. <text class="currency">{{ symbol.symbol }}</text>
  39. <rich-text
  40. class="texts"
  41. :nodes="Moneyhtml(queryData?.amount)"
  42. ></rich-text>
  43. </view>
  44. </view>
  45. <view class="text_box" v-if="queryData?.payType">
  46. <trans class="title" _t="支付方式"></trans>
  47. <text>{{ queryData?.payType }}</text>
  48. </view>
  49. <view class="text_box">
  50. <trans class="title" _t="订单状态"></trans>
  51. <text>{{ queryData?.status_txt }}</text>
  52. </view>
  53. <view class="text_box">
  54. <trans class="title" _t="平台订单号"></trans>
  55. <up-copy
  56. :content="queryData?.orderNo"
  57. :notice="t('复制成功')"
  58. class="right_value"
  59. >
  60. <up-icon name="file-text" size="16px"></up-icon>
  61. <text>{{ queryData?.orderNo }}</text>
  62. </up-copy>
  63. </view>
  64. <view class="text_box" v-if="queryData?.payDate">
  65. <trans class="title" _t="订单时间"></trans>
  66. <text>{{ useGlobal().$format(queryData?.payDate) }}</text>
  67. </view>
  68. <view class="dashed" v-if="queryData?.checkImg.length"></view>
  69. <view class="check_box" v-if="queryData?.checkImg.length">
  70. <trans class="title" _t="质检照片"></trans>
  71. <scroll-view class="image-scroll" scroll-x show-scrollbar="false">
  72. <view class="image-row">
  73. <view
  74. class="image-item"
  75. v-for="(img, index) in queryData?.checkImg"
  76. :key="index"
  77. @click="previewImage(index)"
  78. >
  79. <image :src="img" mode="cover" class="img"></image>
  80. </view>
  81. </view>
  82. </scroll-view>
  83. </view>
  84. <view class="dashed"></view>
  85. <view class="title_box">
  86. <trans _t="五项服务全面呵护你的包裹号"></trans>
  87. </view>
  88. <view class="hint">
  89. <trans _t="点击步骤即可查看详情哦~"></trans>
  90. <scroll-view
  91. :scroll-x="true"
  92. :scroll-left="flexdw"
  93. :scroll-with-animation="true"
  94. class="steps-scroll-view"
  95. >
  96. <up-steps
  97. class="custom-steps"
  98. :current="currentStatus"
  99. activeColor="#000"
  100. inactiveColor="#d8d8d8"
  101. direction="row"
  102. >
  103. <up-steps-item
  104. class="step-item"
  105. v-for="(item, index) in queryData?.bzList"
  106. :key="item.id || index"
  107. :title="item.name"
  108. >
  109. </up-steps-item>
  110. </up-steps>
  111. </scroll-view>
  112. </view>
  113. <view class="quality_inspection" v-if="queryData?.checkStatus > 0">
  114. <view class="head">
  115. <text class="state">{{ t("当前状态") }}:</text>
  116. <view class="progress">
  117. <text class="text_red">{{ currentStatus + 1 }}</text>
  118. <text class="icon">/</text>
  119. <text class="sum">{{
  120. !queryData?.bzList.length ? 0 : queryData?.bzList.length
  121. }}</text>
  122. </view>
  123. <text class="hint">{{ t("专业质检") }}</text>
  124. <!-- <up-icon class="icon" color="#FF0000" name="info-circle"></up-icon> -->
  125. </view>
  126. <view class="body">
  127. <text>{{ queryData?.checkRemark }}</text>
  128. </view>
  129. <view class="foot">
  130. <view class="button" @click="noLook">
  131. <trans _t="查看" />
  132. </view>
  133. </view>
  134. </view>
  135. <view v-if="checkstatus" class="popup_close" @click="toPay">
  136. <trans class="menu_text" _t="去支付" />
  137. </view>
  138. <view
  139. v-if="queryData?.status > 300"
  140. class="popup_cancle"
  141. @click="logisticsPop"
  142. >
  143. <trans class="menu_text" _t="查看物流" />
  144. </view>
  145. <view
  146. class="popup_cancle"
  147. @click="orderCancel"
  148. v-if="queryData?.status == 100"
  149. >
  150. <trans class="menu_text" _t="取消" />
  151. </view>
  152. <view class="popup_cancle" @click="onClose">
  153. <trans class="menu_text" _t="返回" />
  154. </view>
  155. <Popup ref="popRef" mode="center" isClose>
  156. <template #content>
  157. <view class="popup_content">
  158. <view class="img_box">
  159. <Swiper
  160. :listArr="queryData?.checkImg"
  161. urlName=""
  162. autoplay
  163. indicatorDots
  164. circular
  165. />
  166. </view>
  167. <view class="hint" @click="openKf">
  168. <text class="text"
  169. >{{ t("kf_hint")
  170. }}<up-icon
  171. class="icon"
  172. color="#EB3A68"
  173. name="kefu-ermai"
  174. ></up-icon
  175. ></text>
  176. </view>
  177. <view class="checkbox" v-if="queryData?.checkStatus != 10">
  178. <Tip title="同意并已阅读免责说明" :show="tipShow">
  179. <view class="confirm_box" style="">
  180. <up-checkbox
  181. activeColor="var(--black)"
  182. labelSize="14"
  183. labelColor="#000000"
  184. iconSize="16"
  185. size="16"
  186. name="agree"
  187. usedAlone
  188. v-model:checked="aloneChecked"
  189. shape="circle"
  190. >
  191. <template #label>
  192. <trans class="text" _t="同意并已阅读免责说明" />
  193. </template>
  194. </up-checkbox>
  195. </view>
  196. </Tip>
  197. </view>
  198. </view>
  199. </template>
  200. <template #footer>
  201. <view class="footer_button">
  202. <template v-if="queryData?.checkStatus != 10">
  203. <view class="accept" @click="accept">{{ t("接受瑕疵") }}</view>
  204. <view class="refund" @click="refund">{{ t("退款") }}</view>
  205. </template>
  206. <view class="refund" @click="close" v-else>{{ t("关闭") }}</view>
  207. </view>
  208. </template>
  209. </Popup>
  210. <popup ref="popRefExpress" :title="t('物流详细')" isClose>
  211. <template #content>
  212. <up-steps direction="column" current="0">
  213. <up-steps-item v-for="(item, index) in detail" :key="index">
  214. <template #content>
  215. <view class="default" :class="index == 0 ? 'express' : ''">
  216. <view class="slot-title">{{ item.status }}</view>
  217. <view class="slot-time">{{ item.time }}</view>
  218. <view class="slot-desc">{{ item.context }}</view>
  219. </view>
  220. </template>
  221. </up-steps-item>
  222. </up-steps>
  223. </template>
  224. </popup>
  225. </view>
  226. <cancelModel ref="cancelModelRef" />
  227. </Theme>
  228. </template>
  229. <script setup>
  230. import { ref, watchEffect, computed, watch, onMounted, nextTick } from "vue";
  231. import { $post, useGlobal } from "@/utils";
  232. import { useSystemStore } from "@/store";
  233. import { Moneyhtml, Modal, Toast } from "@/utils";
  234. import { t } from "@/locale";
  235. import Navbar from "@/components/navbar";
  236. import Popup from "@/components/popup.vue";
  237. import { onLoad } from "@dcloudio/uni-app";
  238. import { SHOP_ORDER_GETPAY, SHOP_ACTION, SHOP_ORDER_DETAIL } from "@/api";
  239. import Swiper from "@/components/swiper";
  240. import Tip from "@/components/tooltip";
  241. import cancelModel from "@/pages/dashboard/components/cancelModel.vue";
  242. import { SHOP_ORDER_EXPRESS } from "@/api";
  243. const popRef = ref(null);
  244. const parmes = ref();
  245. const useSystem = useSystemStore();
  246. const queryData = ref();
  247. const currentStatus = ref(-1);
  248. const flexdw = ref(0);
  249. const symbol = computed(() => useSystem.getSymbol);
  250. const tipShow = ref(false);
  251. const aloneChecked = ref(false);
  252. const popRefExpress = ref(null);
  253. const detail = ref({});
  254. watch(aloneChecked, (newVal) => {
  255. if (newVal) tipShow.value = false;
  256. });
  257. const checkstatus = ref(false);
  258. watchEffect(async () => {
  259. try {
  260. const res = await SHOP_ORDER_DETAIL(parmes.value.oid);
  261. queryData.value = res.data;
  262. res.data.payStatus == 100
  263. ? (checkstatus.value = true)
  264. : (checkstatus.value = false);
  265. res.data?.bzList?.forEach((item) => {
  266. if (item.checked == 1) {
  267. currentStatus.value += item.checked;
  268. return;
  269. }
  270. });
  271. nextTick(() => {
  272. if (currentStatus.value >= 3) {
  273. flexdw.value = currentStatus.value * 90;
  274. }
  275. });
  276. } catch (err) {}
  277. });
  278. const noLook = () => {
  279. popRef.value && popRef.value.open();
  280. };
  281. const close = () => {
  282. popRef.value && popRef.value.close();
  283. };
  284. const openKf = () => {
  285. uni.navigateTo({ url: "/pages/setting/system" });
  286. };
  287. const onClose = () => {
  288. uni.navigateBack();
  289. };
  290. const previewImage = (index) => {
  291. uni.previewImage({
  292. current: index,
  293. urls: queryData.value.checkImg,
  294. indicator: "number",
  295. loop: true,
  296. });
  297. };
  298. const oids = ref("");
  299. const buyCart = async (oid) => {
  300. const res = await SHOP_ORDER_GETPAY(oid);
  301. oids.value = res.data.oid;
  302. };
  303. const toPay = () => {
  304. uni.navigateTo({ url: `/pages/shop/payment?oid=${oids.value}&type=order` });
  305. };
  306. const accept = () => {
  307. if (aloneChecked.value == false) {
  308. tipShow.value = true;
  309. } else {
  310. acfun(30);
  311. }
  312. };
  313. const acfun = async (val) => {
  314. try {
  315. const res = await SHOP_ACTION({
  316. orderid: parmes.value.oid,
  317. type: val,
  318. });
  319. Toast(res.msg, 1000).then(() => {
  320. let timer = setTimeout(() => {
  321. popRef.value && popRef.value.close();
  322. clearTimeout(timer);
  323. }, 1000);
  324. });
  325. } catch (error) {
  326. Toast(error.msg);
  327. }
  328. };
  329. const logisticsPop = async () => {
  330. try {
  331. const res = await SHOP_ORDER_EXPRESS(queryData.value.id);
  332. detail.value = res.data;
  333. nextTick(() => {
  334. popRefExpress.value && popRefExpress.value.open();
  335. });
  336. } catch (error) {
  337. Toast(error.msg);
  338. }
  339. };
  340. const cancelModelRef = ref(null);
  341. const orderCancel = () => {
  342. cancelModelRef.value && cancelModelRef.value.open(queryData.value.id);
  343. };
  344. const refund = () => {
  345. acfun(40);
  346. };
  347. onLoad((options) => {
  348. parmes.value = options;
  349. buyCart(options.oid);
  350. });
  351. </script>
  352. <style lang="less" scoped>
  353. @import url("@/style.less");
  354. .scroll-Y {
  355. height: 300rpx;
  356. }
  357. .scroll-view_H {
  358. width: 280%;
  359. }
  360. .scroll-view-item_H {
  361. width: 35%;
  362. }
  363. .content {
  364. padding: 15rpx 5%;
  365. border-top: 1rpx solid #ccc;
  366. .popup_close {
  367. background-color: var(--black);
  368. color: var(--light);
  369. .flex_center();
  370. padding: 28rpx 0;
  371. border-radius: 20rpx;
  372. }
  373. .popup_cancle {
  374. background-color: var(--white);
  375. color: var(--black);
  376. .flex_center();
  377. border-radius: 20rpx;
  378. margin-top: 15rpx;
  379. padding: 28rpx 0;
  380. border: 1px solid var(--black);
  381. }
  382. .steps_box {
  383. width: 100%;
  384. overflow-x: scroll;
  385. margin: 20rpx 0;
  386. border: 1px solid #ccc;
  387. padding: 10rpx 0;
  388. }
  389. .overview {
  390. color: var(--text);
  391. .flex();
  392. gap: 24rpx;
  393. .img_box {
  394. flex: 4;
  395. border-radius: 20rpx;
  396. .img {
  397. width: 100%;
  398. height: 100%;
  399. }
  400. }
  401. .information {
  402. flex: 6;
  403. .size(24rpx);
  404. .name {
  405. // .ellipsis(2);
  406. margin-bottom: 26rpx;
  407. .size(28rpx);
  408. }
  409. .num {
  410. text-align: right;
  411. }
  412. }
  413. }
  414. .orginal_price {
  415. .hor(end);
  416. }
  417. .text_box {
  418. .flex_position(space-between, flex-end);
  419. margin: 8rpx 0;
  420. .size(24rpx);
  421. .title {
  422. color: var(--text-01);
  423. }
  424. .currency,
  425. .texts {
  426. color: var(--red);
  427. .size(28rpx);
  428. font-weight: 500;
  429. }
  430. .right_value {
  431. .flex();
  432. }
  433. }
  434. .price_box {
  435. .flex_position(end, flex-end);
  436. color: var(--black);
  437. .size(28rpx);
  438. .currency {
  439. margin-right: 10rpx;
  440. }
  441. }
  442. .texts /deep/ {
  443. .price {
  444. .size();
  445. }
  446. }
  447. .check_box {
  448. .image-scroll {
  449. width: 100%;
  450. margin: 20rpx 0;
  451. white-space: nowrap;
  452. .image-row {
  453. display: inline-flex;
  454. gap: 12rpx;
  455. .image-item {
  456. width: 140rpx;
  457. height: 140rpx;
  458. border-radius: 12rpx;
  459. overflow: hidden;
  460. box-shadow: 0 2rpx 5rpx rgba(0, 0, 0, 0.1);
  461. .img {
  462. width: 100%;
  463. height: 100%;
  464. object-fit: cover;
  465. }
  466. }
  467. }
  468. }
  469. // 图片行容器
  470. // 图片项
  471. }
  472. .title_box {
  473. .size(28rpx);
  474. font-weight: 500;
  475. color: var(--text);
  476. }
  477. .hint {
  478. .size(24rpx);
  479. color: var(--text-01);
  480. margin-top: 10rpx;
  481. .steps-scroll-view {
  482. flex: 1;
  483. width: 100%;
  484. white-space: nowrap;
  485. padding: 24rpx 0;
  486. scroll-behavior: smooth;
  487. .custom-steps {
  488. display: inline-flex;
  489. min-width: 100%;
  490. .step-item {
  491. min-width: 120px;
  492. max-width: 180px;
  493. padding: 0 12rpx;
  494. box-sizing: border-box;
  495. white-space: normal;
  496. word-break: break-word;
  497. cursor: pointer;
  498. transition: all 0.3s;
  499. &:deep(.up-steps-item-title) {
  500. .size(28rpx);
  501. color: #333;
  502. font-weight: 500;
  503. // text-align: center;
  504. }
  505. }
  506. }
  507. }
  508. }
  509. .quality_inspection {
  510. margin-top: 10rpx;
  511. background-color: var(--bor-color);
  512. padding: 0 20rpx;
  513. border-radius: 20rpx;
  514. .head {
  515. .ver(flex-end);
  516. .icon {
  517. margin-left: 5rpx;
  518. }
  519. .state {
  520. .size(20rpx);
  521. }
  522. .progress {
  523. .ver(baseline);
  524. .text_red {
  525. color: var(--red);
  526. .size(28rpx);
  527. margin-left: 10rpx;
  528. }
  529. .icon,
  530. .sum {
  531. .size(24rpx);
  532. color: var(--text);
  533. }
  534. }
  535. .hint {
  536. .size(24rpx);
  537. font-weight: 500;
  538. margin-left: 10rpx;
  539. }
  540. }
  541. .body {
  542. .size(24rpx);
  543. color: var(--text);
  544. margin-top: 16rpx;
  545. }
  546. .foot {
  547. margin-top: 26rpx;
  548. .hor(end);
  549. .button {
  550. .size(24rpx);
  551. color: var(--light);
  552. background-color: var(--black);
  553. padding: 14rpx 28rpx;
  554. border-radius: 20rpx;
  555. margin-bottom: 16rpx;
  556. }
  557. }
  558. }
  559. /deep/ .u-popup__content {
  560. width: 80vw !important;
  561. position: relative;
  562. }
  563. .popup_content {
  564. .img_box {
  565. height: 400rpx;
  566. border-radius: 20rpx;
  567. .img {
  568. max-width: 100%;
  569. max-height: 100%;
  570. }
  571. }
  572. .hint {
  573. .ver(flex-start);
  574. .text {
  575. flex: 1;
  576. word-break: break-word;
  577. padding-right: 40rpx;
  578. position: relative;
  579. }
  580. .icon {
  581. position: absolute;
  582. right: 40rpx;
  583. bottom: 0;
  584. margin-left: 8rpx;
  585. }
  586. }
  587. .checkbox {
  588. margin-top: 44rpx;
  589. /deep/ .u-checkbox {
  590. .ver(baseline);
  591. }
  592. }
  593. }
  594. .footer_button {
  595. .hor(space-between);
  596. .size(28rpx);
  597. gap: 50rpx;
  598. text-align: center;
  599. .accept {
  600. flex: 1;
  601. color: var(--text);
  602. padding: 24rpx 0;
  603. border: 2rpx solid var(--black);
  604. border-radius: 20rpx;
  605. }
  606. .refund {
  607. flex: 1;
  608. color: var(--light);
  609. padding: 24rpx 0rpx;
  610. background-color: var(--black);
  611. border-radius: 20rpx;
  612. }
  613. }
  614. // .popup_close {
  615. // position: absolute;
  616. // top: -50rpx;
  617. // right: 4rpx;
  618. // padding: 6rpx;
  619. // .flex_position(center, center);
  620. // background-color: var(--light);
  621. // border-radius: 50%;
  622. // }
  623. }
  624. .default {
  625. color: var(--text-02);
  626. &.express {
  627. color: var(--black);
  628. }
  629. .slot-title {
  630. .size(28rpx);
  631. font-weight: 600;
  632. }
  633. .slot-desc {
  634. .size(20rpx);
  635. }
  636. .slot-time {
  637. .size(22rpx);
  638. }
  639. }
  640. </style>