after-progress.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. <template>
  2. <view>
  3. <view class="mar-t-10">
  4. </view>
  5. <CustomToast ref="customToast" />
  6. <view class="region mar-t-20" v-if="order.isAfter!=3">
  7. <view>
  8. <uni-steps active-color="#e29c6d" :options="list1" :active="active" :key="activeKey"
  9. v-if="orderAfter.type==1" />
  10. <uni-steps active-color="#e29c6d" :options="list2" :active="active" :key="activeKey"
  11. v-if="orderAfter.type==2" />
  12. </view>
  13. </view>
  14. <view class="region pad-24">
  15. <view v-if="orderAfter.status==1">
  16. <view class="font38 font-bold ">
  17. 请寄回商品
  18. </view>
  19. <view class="mar-tb-20 font28">
  20. 商家已同意退款,请您在
  21. <text class="font-red font28 pad-lr-10">
  22. {{remainingTime}}
  23. </text>
  24. 内寄回商品
  25. </view>
  26. <view class="flex flex-sp-between mar-t-20 ">
  27. <view class="nowrap mar-r-20 ">
  28. 商家地址信息
  29. </view>
  30. <view>
  31. <view class="flex-end">
  32. <text>
  33. {{merchantAddress.name}}
  34. </text>
  35. <text>
  36. {{merchantAddress.mobile}}
  37. </text>
  38. </view>
  39. <view>
  40. {{merchantAddress.address}}
  41. </view>
  42. </view>
  43. </view>
  44. <view class="flex-end mar-t-20">
  45. <text class="font-blue " @tap="copyContent">复制</text>
  46. </view>
  47. <view class="gray-line mar-tb-8"></view>
  48. </view>
  49. <view class="font38 font-bold " v-if="orderAfter.status==0">
  50. 请等待商家审核
  51. </view>
  52. <view class="font38 font-bold " v-if="orderAfter.status==1">
  53. 请寄回商品
  54. </view>
  55. <view class="font38 font-bold " v-if="orderAfter.status==2">
  56. 等待商家退款
  57. </view>
  58. <view v-if="orderAfter.status==3">
  59. <view class="flex-items-plus">
  60. <uni-icons color="#63b43d" type="checkbox-filled" size="30"></uni-icons>
  61. <view class="font38 font-bold ">
  62. 退款完成
  63. </view>
  64. </view>
  65. <view class="text-align mar-t-10">
  66. 钱款{{orderAfter.afterPrice}}元已退回到你**账户
  67. </view>
  68. </view>
  69. <view @tap="checkAfterSaleStatus" class="flex-items-between">
  70. <view>
  71. <view v-if="orderAfter.status==4">
  72. <view class="font-red">
  73. 售后已关闭
  74. </view>
  75. <view class="font38 font-bold ">
  76. 商家审核不通过
  77. </view>
  78. <view class="font28">
  79. 原因:{{orderAfter.approveRemark}}
  80. </view>
  81. </view>
  82. <view v-if="orderAfter.status==5">
  83. <view class="font-red">
  84. 售后已关闭
  85. </view>
  86. <view class="font38 font-bold ">
  87. 商家不同意退款
  88. </view>
  89. <view class="font28">
  90. 原因:{{orderAfter.approveRemark}}
  91. </view>
  92. </view>
  93. <view v-if="orderAfter.status==6">
  94. <view class="font-red">
  95. 售后已关闭
  96. </view>
  97. <view class="font38 font-bold ">
  98. 您已取消售后
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. <view class="flex-items-between mar-t-20">
  104. <view>
  105. <view class="font28" v-if="order.isAfter==1&&(orderAfter.status==1||orderAfter.status==2)">
  106. 我已寄出
  107. </view>
  108. <view class="font-gray" v-if="order.isAfter==1&&(orderAfter.status==1)">
  109. 填写物流单号
  110. </view>
  111. </view>
  112. <view>
  113. <text class="copy-btn " @tap="logistics"
  114. v-if="orderAfter.status==2||orderAfter.status==3">查询物流</text>
  115. <text class="copy-btn " @tap="showExpressNumberPopup" v-if="orderAfter.status==1">填写单号</text>
  116. </view>
  117. </view>
  118. </view>
  119. <view class="region2">
  120. <view class="font32 pad-16 ">
  121. 退货信息
  122. </view>
  123. <view class="flex-items">
  124. <view>
  125. <image class=" mar-l-20 productImg" :src="orderAfter.productImg" mode="cover"></image>
  126. </view>
  127. <view class="mar-l-20 mar-r-20">
  128. <view class="font28 pad-b-10 ">
  129. {{orderAfter.productName}}
  130. </view>
  131. <view class="pad-tb-16 font-gray">
  132. <text class="font28">
  133. 规格: {{orderAfter.skuName}}
  134. </text>
  135. </view>
  136. </view>
  137. </view>
  138. <view class="flex-items-between pad-24">
  139. <view>
  140. 退货件数
  141. </view>
  142. <view>
  143. {{orderAfter.count}}件
  144. </view>
  145. </view>
  146. <view class="flex-items-between pad-24">
  147. <view>
  148. 退款金额
  149. </view>
  150. <view>
  151. {{orderAfter.afterPrice}}
  152. </view>
  153. </view>
  154. <view class="flex-items-between pad-24">
  155. <view>
  156. 退货类型
  157. </view>
  158. <view>
  159. {{orderAfter.type==1?'退货退款':'仅退款'}}
  160. </view>
  161. </view>
  162. <view class="flex-items-between pad-24">
  163. <view>
  164. 退货原因
  165. </view>
  166. <view>
  167. {{reasonRange[orderAfter.reason].text}}
  168. </view>
  169. </view>
  170. <view class="flex-items-between pad-24">
  171. <view>
  172. 申请时间
  173. </view>
  174. <view>
  175. {{orderAfter.createTime}}
  176. </view>
  177. </view>
  178. <view class="flex-items-between pad-24">
  179. <view>
  180. 订单编号
  181. </view>
  182. <view>
  183. {{orderAfter.orderCode}}
  184. </view>
  185. </view>
  186. <view class="pad-24">
  187. <view>
  188. 凭证
  189. </view>
  190. <view class="image-item mar-tb-16">
  191. <view v-for="(image, imageIndex) in imagesList" :key="imageIndex" class="mar-r-20 "
  192. v-if="imagesList.length>0">
  193. <image @tap="detailPreviewImage(imageIndex)" :src="image" class="images">
  194. </image>
  195. </view>
  196. </view>
  197. </view>
  198. </view>
  199. <uni-popup ref="dialog" type="dialog">
  200. <uni-popup-dialog type="warn" cancelText="取消" confirmText="确认" title="提示" content="确认要取消退货?"
  201. @confirm="cancel()"></uni-popup-dialog>
  202. </uni-popup>
  203. <!-- 底部弹窗 -->
  204. <uni-popup ref="expressNumberPopup" borderRadius="20rpx 20rpx 0 0 " background-color="#fff">
  205. <view class="popup-content">
  206. <view class="popup-title">填写物流单号</view>
  207. <input v-model="orderAfter.expressCode" focus class="popup-input" placeholder="请输入物流单号" />
  208. <view class="popup-buttons">
  209. <button class="popup-cancel" @click="hideExpressNumberPopup">取消</button>
  210. <button class="popup-confirm" @click="submitExpressNumber">确定</button>
  211. </view>
  212. </view>
  213. </uni-popup>
  214. <view class="navigation">
  215. <view class="flex-items-between">
  216. <view class="mar-l-20" @click="$Router.pushTab({name: 'index'})">
  217. <u-icon name="chat" color="#F95B5B" size="22"></u-icon>
  218. <view>客服</view>
  219. </view>
  220. <view class="flex-items">
  221. <button class="grayBut mar-r-20 " @click="onCancelAfter" v-if="order.isAfter==1">取消售后</button>
  222. <button class="grayBut mar-r-20 " @click="submitAfterSale " v-if="order.isAfter==3">再次申请售后</button>
  223. <button class="grayBut mar-r-20" @click="afterRecord" v-if="historyDetail!=1">售后记录</button>
  224. </view>
  225. </view>
  226. </view>
  227. </view>
  228. </template>
  229. <script>
  230. import {
  231. merchantAddressDetail,
  232. orderDetail,
  233. orderAfterDetail,
  234. orderAfterDetailById,
  235. updateExpressCode,
  236. cancelAfter
  237. } from '../../config/api.js';
  238. import CustomToast from '../../components/CustomToast.vue';
  239. export default {
  240. components: {
  241. CustomToast,
  242. },
  243. data() {
  244. return {
  245. activeKey: 0,
  246. remainingTime: "", // 剩余时间
  247. merchantAddress: {},
  248. active: 0,
  249. imagesList: [],
  250. order: {},
  251. orderAfter: {
  252. reason: 0,
  253. expressCode: ""
  254. },
  255. list1: [{
  256. title: '商家审核'
  257. }, {
  258. title: '寄回商品'
  259. }, {
  260. title: '商家退款'
  261. }, {
  262. title: '退款完成'
  263. }],
  264. list2: [{
  265. title: '商家审核'
  266. }, {
  267. title: '退款完成'
  268. }],
  269. orderId: "",
  270. historyDetail: "",
  271. reasonRange: [{
  272. value: 1,
  273. text: "不喜欢,效果不好"
  274. },
  275. {
  276. value: 2,
  277. text: "不想要了"
  278. },
  279. {
  280. value: 3,
  281. text: "材质与商品描述不符"
  282. },
  283. {
  284. value: 4,
  285. text: "大小尺寸与商品描述不符"
  286. },
  287. {
  288. value: 5,
  289. text: "安装质量问题"
  290. },
  291. {
  292. value: 6,
  293. text: "做工瑕疵"
  294. },
  295. {
  296. value: 7,
  297. text: "颜色、款式、图案与描述不符"
  298. },
  299. {
  300. value: 8,
  301. text: "商品破损或污渍"
  302. },
  303. {
  304. value: 9,
  305. text: "其他原因"
  306. },
  307. ],
  308. }
  309. },
  310. onLoad(op) {
  311. if (op.orderId) {
  312. this.orderId = op.orderId
  313. this.getDetail()
  314. this.getOrderDetail()
  315. }
  316. if (op.id) {
  317. this.getDetailById(op.id)
  318. }
  319. if (op.historyDetail) {
  320. this.historyDetail = op.historyDetail
  321. }
  322. this.getAddress()
  323. },
  324. methods: {
  325. getOrderDetail() {
  326. orderDetail({
  327. id: this.orderId
  328. }).then((res) => {
  329. this.order = res.data
  330. })
  331. },
  332. afterRecord() {
  333. this.$route('/pages/order/history-after?orderId=' + this.orderId);
  334. },
  335. submitAfterSale() {
  336. this.$route('/pages/order/after?id=' + this.orderId);
  337. },
  338. detailPreviewImage(currentIndex) {
  339. uni.previewImage({
  340. current: this.imagesList[currentIndex], // 当前显示图片的链接
  341. urls: this.imagesList // 需要预览的图片链接列表
  342. });
  343. },
  344. // 计算并格式化倒计时
  345. formatRemainingTime() {
  346. const currentTime = new Date(); // 当前时间
  347. const createTime = new Date(this.orderAfter.createTime.replace(/-/g, '/')); // 转换为 Date 对象
  348. const deadline = new Date(createTime.getTime() + 7 * 24 * 60 * 60 * 1000); // 7天后的截止时间
  349. console.log("currentTime", currentTime);
  350. console.log("createTime", createTime);
  351. console.log("deadline", deadline);
  352. let remainingTime = deadline - currentTime; // 剩余时间(毫秒)
  353. if (remainingTime <= 0) {
  354. this.remainingTime = "已超过退货期限";
  355. clearInterval(this.timer); // 清除定时器
  356. return;
  357. }
  358. // 计算剩余天、小时和分钟
  359. const days = Math.floor(remainingTime / (1000 * 60 * 60 * 24));
  360. const hours = Math.floor((remainingTime % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  361. const minutes = Math.floor((remainingTime % (1000 * 60 * 60)) / (1000 * 60));
  362. this.remainingTime = `${days}天${hours}小时${minutes}分钟`;
  363. },
  364. onCancelAfter() {
  365. this.$refs.dialog.open()
  366. },
  367. cancel() {
  368. cancelAfter({
  369. id: this.orderAfter.id
  370. }).then((res) => {
  371. if (res.code == 200) {
  372. this.$refs.customToast.showToast('操作成功');
  373. this.$refs.dialog.close()
  374. setTimeout(() => {
  375. uni.navigateBack({
  376. delta: 1
  377. })
  378. }, 1000)
  379. }
  380. })
  381. },
  382. // 启动倒计时
  383. startCountdown() {
  384. this.formatRemainingTime(); // 初始化倒计时
  385. // 每分钟更新一次倒计时
  386. this.timer = setInterval(() => {
  387. this.formatRemainingTime();
  388. }, 60000); // 每分钟更新一次
  389. },
  390. logistics() {
  391. this.$route('/pages/order/logistics?expressCode=' + this.orderAfter.expressCode);
  392. },
  393. showExpressNumberPopup() {
  394. this.$refs.expressNumberPopup.open("bottom");
  395. },
  396. hideExpressNumberPopup() {
  397. this.$refs.expressNumberPopup.close();
  398. },
  399. submitExpressNumber() {
  400. if (this.orderAfter.expressCode) {
  401. updateExpressCode(this.orderAfter).then((res) => {
  402. if (res.code == 200) {
  403. this.$refs.customToast.showToast('提交成功');
  404. this.getDetail();
  405. this.hideExpressNumberPopup();
  406. }
  407. });
  408. } else {
  409. uni.showToast({
  410. title: '请输入物流单号',
  411. icon: 'none'
  412. });
  413. }
  414. },
  415. copyContent() {
  416. uni.setClipboardData({
  417. data: this.merchantAddress.address + " " + this.merchantAddress.mobile + " " + this
  418. .merchantAddress.name,
  419. success() {
  420. // 复制成功的提示
  421. uni.showToast({
  422. title: '复制成功',
  423. icon: 'success'
  424. });
  425. },
  426. });
  427. },
  428. getDetail() {
  429. orderAfterDetail({
  430. orderId: this.orderId
  431. }).then((res) => {
  432. this.orderAfter = res.data
  433. this.imagesList = this.orderAfter.images.split(',');
  434. this.active = this.orderAfter.status
  435. this.activeKey = Date.now(); // 更新 activeKey
  436. this.$set(this, "active", this.orderAfter.status)
  437. if (this.orderAfter.status == 1) {
  438. this.startCountdown(); // 启动倒计时
  439. }
  440. })
  441. },
  442. getDetailById(id) {
  443. orderAfterDetailById({
  444. id: id
  445. }).then((res) => {
  446. this.orderAfter = res.data
  447. this.orderId = this.orderAfter.orderId
  448. this.getOrderDetail()
  449. this.imagesList = this.orderAfter.images.split(',');
  450. this.active = this.orderAfter.status
  451. this.activeKey = Date.now(); // 更新 activeKey
  452. this.$set(this, "active", this.orderAfter.status)
  453. if (this.orderAfter.status == 1) {
  454. this.startCountdown(); // 启动倒计时
  455. }
  456. })
  457. },
  458. getAddress() {
  459. merchantAddressDetail().then((res) => {
  460. this.merchantAddress = res.data
  461. })
  462. }
  463. }
  464. }
  465. </script>
  466. <style>
  467. .navigation {
  468. position: fixed;
  469. bottom: 0;
  470. width: 100%;
  471. border: solid 2rpx #f2f2f2;
  472. background-color: #ffffff;
  473. padding: 16rpx 0;
  474. }
  475. button::after {
  476. border: none;
  477. }
  478. .copy-btn {
  479. background-color: #ffffff;
  480. border: 1px solid #999999;
  481. color: #333333;
  482. padding: 5rpx 10rpx;
  483. /* 减少按钮的内边距 */
  484. border-radius: 8rpx;
  485. font-size: 28rpx;
  486. }
  487. .productImg {
  488. border-radius: 20rpx;
  489. width: 120rpx;
  490. height: 120rpx;
  491. }
  492. .grayBut {
  493. background-color: #f2f2f2;
  494. padding: 5rpx 30rpx 5rpx 30rpx;
  495. font-size: 26rpx;
  496. color: #1b1b1b;
  497. }
  498. .popup-content {
  499. padding: 20rpx;
  500. }
  501. .popup-title {
  502. font-size: 32rpx;
  503. font-weight: bold;
  504. text-align: center;
  505. margin-bottom: 20rpx;
  506. }
  507. .popup-input {
  508. border: 1px solid #ccc;
  509. border-radius: 8rpx;
  510. margin-bottom: 20rpx;
  511. height: 80rpx;
  512. }
  513. .popup-buttons {
  514. display: flex;
  515. justify-content: space-around;
  516. }
  517. .popup-cancel,
  518. .popup-confirm {
  519. padding: 10rpx 30rpx;
  520. border-radius: 8rpx;
  521. font-size: 28rpx;
  522. }
  523. .popup-cancel {
  524. background-color: #f2f2f2;
  525. color: #333;
  526. width: 40%;
  527. }
  528. .popup-confirm {
  529. background-color: #e29c6d;
  530. color: #fff;
  531. width: 40%;
  532. }
  533. .image-item {
  534. margin-bottom: 10rpx;
  535. display: flex;
  536. /* 设置子元素垂直排列 */
  537. align-items: center;
  538. /* 水平居中对齐子元素 */
  539. }
  540. .images {
  541. width: 100rpx;
  542. height: 100rpx;
  543. }
  544. </style>