details.vue 17 KB

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