| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576 |
- <template>
- <view>
- <view class="mar-t-10">
- </view>
- <CustomToast ref="customToast" />
- <view class="region mar-t-20" v-if="order.isAfter!=3">
- <view>
- <uni-steps active-color="#e29c6d" :options="list1" :active="active" :key="activeKey"
- v-if="orderAfter.type==1" />
- <uni-steps active-color="#e29c6d" :options="list2" :active="active" :key="activeKey"
- v-if="orderAfter.type==2" />
- </view>
- </view>
- <view class="region pad-24">
- <view v-if="orderAfter.status==1">
- <view class="font38 font-bold ">
- 请寄回商品
- </view>
- <view class="mar-tb-20 font28">
- 商家已同意退款,请您在
- <text class="font-red font28 pad-lr-10">
- {{remainingTime}}
- </text>
- 内寄回商品
- </view>
- <view class="flex flex-sp-between mar-t-20 ">
- <view class="nowrap mar-r-20 ">
- 商家地址信息
- </view>
- <view>
- <view class="flex-end">
- <text>
- {{merchantAddress.name}}
- </text>
- <text>
- {{merchantAddress.mobile}}
- </text>
- </view>
- <view>
- {{merchantAddress.address}}
- </view>
- </view>
- </view>
- <view class="flex-end mar-t-20">
- <text class="font-blue " @tap="copyContent">复制</text>
- </view>
- <view class="gray-line mar-tb-8"></view>
- </view>
- <view class="font38 font-bold " v-if="orderAfter.status==0">
- 请等待商家审核
- </view>
- <view class="font38 font-bold " v-if="orderAfter.status==1">
- 请寄回商品
- </view>
- <view class="font38 font-bold " v-if="orderAfter.status==2">
- 等待商家退款
- </view>
- <view v-if="orderAfter.status==3">
- <view class="flex-items-plus">
- <uni-icons color="#63b43d" type="checkbox-filled" size="30"></uni-icons>
- <view class="font38 font-bold ">
- 退款完成
- </view>
- </view>
- <view class="text-align mar-t-10">
- 钱款{{orderAfter.afterPrice}}元已退回到你**账户
- </view>
- </view>
- <view @tap="checkAfterSaleStatus" class="flex-items-between">
- <view>
- <view v-if="orderAfter.status==4">
- <view class="font-red">
- 售后已关闭
- </view>
- <view class="font38 font-bold ">
- 商家审核不通过
- </view>
- <view class="font28">
- 原因:{{orderAfter.approveRemark}}
- </view>
- </view>
- <view v-if="orderAfter.status==5">
- <view class="font-red">
- 售后已关闭
- </view>
- <view class="font38 font-bold ">
- 商家不同意退款
- </view>
- <view class="font28">
- 原因:{{orderAfter.approveRemark}}
- </view>
- </view>
- <view v-if="orderAfter.status==6">
- <view class="font-red">
- 售后已关闭
- </view>
- <view class="font38 font-bold ">
- 您已取消售后
- </view>
- </view>
- </view>
- </view>
- <view class="flex-items-between mar-t-20">
- <view>
- <view class="font28" v-if="order.isAfter==1&&(orderAfter.status==1||orderAfter.status==2)">
- 我已寄出
- </view>
- <view class="font-gray" v-if="order.isAfter==1&&(orderAfter.status==1)">
- 填写物流单号
- </view>
- </view>
- <view>
- <text class="copy-btn " @tap="logistics"
- v-if="orderAfter.status==2||orderAfter.status==3">查询物流</text>
- <text class="copy-btn " @tap="showExpressNumberPopup" v-if="orderAfter.status==1">填写单号</text>
- </view>
- </view>
- </view>
- <view class="region2">
- <view class="font32 pad-16 ">
- 退货信息
- </view>
- <view class="flex-items">
- <view>
- <image class=" mar-l-20 productImg" :src="orderAfter.productImg" mode="cover"></image>
- </view>
- <view class="mar-l-20 mar-r-20">
- <view class="font28 pad-b-10 ">
- {{orderAfter.productName}}
- </view>
- <view class="pad-tb-16 font-gray">
- <text class="font28">
- 规格: {{orderAfter.skuName}}
- </text>
- </view>
- </view>
- </view>
- <view class="flex-items-between pad-24">
- <view>
- 退货件数
- </view>
- <view>
- {{orderAfter.count}}件
- </view>
- </view>
- <view class="flex-items-between pad-24">
- <view>
- 退款金额
- </view>
- <view>
- {{orderAfter.afterPrice}}
- </view>
- </view>
- <view class="flex-items-between pad-24">
- <view>
- 退货类型
- </view>
- <view>
- {{orderAfter.type==1?'退货退款':'仅退款'}}
- </view>
- </view>
- <view class="flex-items-between pad-24">
- <view>
- 退货原因
- </view>
- <view>
- {{reasonRange[orderAfter.reason].text}}
- </view>
- </view>
- <view class="flex-items-between pad-24">
- <view>
- 申请时间
- </view>
- <view>
- {{orderAfter.createTime}}
- </view>
- </view>
- <view class="flex-items-between pad-24">
- <view>
- 订单编号
- </view>
- <view>
- {{orderAfter.orderCode}}
- </view>
- </view>
- <view class="pad-24">
- <view>
- 凭证
- </view>
- <view class="image-item mar-tb-16">
- <view v-for="(image, imageIndex) in imagesList" :key="imageIndex" class="mar-r-20 "
- v-if="imagesList.length>0">
- <image @tap="detailPreviewImage(imageIndex)" :src="image" class="images">
- </image>
- </view>
- </view>
- </view>
- </view>
- <uni-popup ref="dialog" type="dialog">
- <uni-popup-dialog type="warn" cancelText="取消" confirmText="确认" title="提示" content="确认要取消退货?"
- @confirm="cancel()"></uni-popup-dialog>
- </uni-popup>
- <!-- 底部弹窗 -->
- <uni-popup ref="expressNumberPopup" borderRadius="20rpx 20rpx 0 0 " background-color="#fff">
- <view class="popup-content">
- <view class="popup-title">填写物流单号</view>
- <input v-model="orderAfter.expressCode" focus class="popup-input" placeholder="请输入物流单号" />
- <view class="popup-buttons">
- <button class="popup-cancel" @click="hideExpressNumberPopup">取消</button>
- <button class="popup-confirm" @click="submitExpressNumber">确定</button>
- </view>
- </view>
- </uni-popup>
- <view class="navigation">
- <view class="flex-items-between">
- <view class="mar-l-20" @click="$Router.pushTab({name: 'index'})">
- <u-icon name="chat" color="#F95B5B" size="22"></u-icon>
- <view>客服</view>
- </view>
- <view class="flex-items">
- <button class="grayBut mar-r-20 " @click="onCancelAfter" v-if="order.isAfter==1">取消售后</button>
- <button class="grayBut mar-r-20 " @click="submitAfterSale " v-if="order.isAfter==3">再次申请售后</button>
- <button class="grayBut mar-r-20" @click="afterRecord" v-if="historyDetail!=1">售后记录</button>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- merchantAddressDetail,
- orderDetail,
- orderAfterDetail,
- orderAfterDetailById,
- updateExpressCode,
- cancelAfter
- } from '../../config/api.js';
- import CustomToast from '../../components/CustomToast.vue';
- export default {
- components: {
- CustomToast,
- },
- data() {
- return {
- activeKey: 0,
- remainingTime: "", // 剩余时间
- merchantAddress: {},
- active: 0,
- imagesList: [],
- order: {},
- orderAfter: {
- reason: 0,
- expressCode: ""
- },
- list1: [{
- title: '商家审核'
- }, {
- title: '寄回商品'
- }, {
- title: '商家退款'
- }, {
- title: '退款完成'
- }],
- list2: [{
- title: '商家审核'
- }, {
- title: '退款完成'
- }],
- orderId: "",
- historyDetail: "",
- reasonRange: [{
- value: 1,
- text: "不喜欢,效果不好"
- },
- {
- value: 2,
- text: "不想要了"
- },
- {
- value: 3,
- text: "材质与商品描述不符"
- },
- {
- value: 4,
- text: "大小尺寸与商品描述不符"
- },
- {
- value: 5,
- text: "安装质量问题"
- },
- {
- value: 6,
- text: "做工瑕疵"
- },
- {
- value: 7,
- text: "颜色、款式、图案与描述不符"
- },
- {
- value: 8,
- text: "商品破损或污渍"
- },
- {
- value: 9,
- text: "其他原因"
- },
- ],
- }
- },
- onLoad(op) {
- if (op.orderId) {
- this.orderId = op.orderId
- this.getDetail()
- this.getOrderDetail()
- }
- if (op.id) {
- this.getDetailById(op.id)
- }
- if (op.historyDetail) {
- this.historyDetail = op.historyDetail
- }
- this.getAddress()
- },
- methods: {
- getOrderDetail() {
- orderDetail({
- id: this.orderId
- }).then((res) => {
- this.order = res.data
- })
- },
- afterRecord() {
- this.$route('/pages/order/history-after?orderId=' + this.orderId);
- },
- submitAfterSale() {
- this.$route('/pages/order/after?id=' + this.orderId);
- },
- detailPreviewImage(currentIndex) {
- uni.previewImage({
- current: this.imagesList[currentIndex], // 当前显示图片的链接
- urls: this.imagesList // 需要预览的图片链接列表
- });
- },
- // 计算并格式化倒计时
- formatRemainingTime() {
- const currentTime = new Date(); // 当前时间
- const createTime = new Date(this.orderAfter.createTime.replace(/-/g, '/')); // 转换为 Date 对象
- const deadline = new Date(createTime.getTime() + 7 * 24 * 60 * 60 * 1000); // 7天后的截止时间
- console.log("currentTime", currentTime);
- console.log("createTime", createTime);
- console.log("deadline", deadline);
- let remainingTime = deadline - currentTime; // 剩余时间(毫秒)
- if (remainingTime <= 0) {
- this.remainingTime = "已超过退货期限";
- clearInterval(this.timer); // 清除定时器
- return;
- }
- // 计算剩余天、小时和分钟
- const days = Math.floor(remainingTime / (1000 * 60 * 60 * 24));
- const hours = Math.floor((remainingTime % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
- const minutes = Math.floor((remainingTime % (1000 * 60 * 60)) / (1000 * 60));
- this.remainingTime = `${days}天${hours}小时${minutes}分钟`;
- },
- onCancelAfter() {
- this.$refs.dialog.open()
- },
- cancel() {
- cancelAfter({
- id: this.orderAfter.id
- }).then((res) => {
- if (res.code == 200) {
- this.$refs.customToast.showToast('操作成功');
- this.$refs.dialog.close()
- setTimeout(() => {
- uni.navigateBack({
- delta: 1
- })
- }, 1000)
- }
- })
- },
- // 启动倒计时
- startCountdown() {
- this.formatRemainingTime(); // 初始化倒计时
- // 每分钟更新一次倒计时
- this.timer = setInterval(() => {
- this.formatRemainingTime();
- }, 60000); // 每分钟更新一次
- },
- logistics() {
- this.$route('/pages/order/logistics?expressCode=' + this.orderAfter.expressCode);
- },
- showExpressNumberPopup() {
- this.$refs.expressNumberPopup.open("bottom");
- },
- hideExpressNumberPopup() {
- this.$refs.expressNumberPopup.close();
- },
- submitExpressNumber() {
- if (this.orderAfter.expressCode) {
- updateExpressCode(this.orderAfter).then((res) => {
- if (res.code == 200) {
- this.$refs.customToast.showToast('提交成功');
- this.getDetail();
- this.hideExpressNumberPopup();
- }
- });
- } else {
- uni.showToast({
- title: '请输入物流单号',
- icon: 'none'
- });
- }
- },
- copyContent() {
- uni.setClipboardData({
- data: this.merchantAddress.address + " " + this.merchantAddress.mobile + " " + this
- .merchantAddress.name,
- success() {
- // 复制成功的提示
- uni.showToast({
- title: '复制成功',
- icon: 'success'
- });
- },
- });
- },
- getDetail() {
- orderAfterDetail({
- orderId: this.orderId
- }).then((res) => {
- this.orderAfter = res.data
- this.imagesList = this.orderAfter.images.split(',');
- this.active = this.orderAfter.status
- this.activeKey = Date.now(); // 更新 activeKey
- this.$set(this, "active", this.orderAfter.status)
- if (this.orderAfter.status == 1) {
- this.startCountdown(); // 启动倒计时
- }
- })
- },
- getDetailById(id) {
- orderAfterDetailById({
- id: id
- }).then((res) => {
- this.orderAfter = res.data
- this.orderId = this.orderAfter.orderId
- this.getOrderDetail()
- this.imagesList = this.orderAfter.images.split(',');
- this.active = this.orderAfter.status
- this.activeKey = Date.now(); // 更新 activeKey
- this.$set(this, "active", this.orderAfter.status)
- if (this.orderAfter.status == 1) {
- this.startCountdown(); // 启动倒计时
- }
- })
- },
- getAddress() {
- merchantAddressDetail().then((res) => {
- this.merchantAddress = res.data
- })
- }
- }
- }
- </script>
- <style>
- .navigation {
- position: fixed;
- bottom: 0;
- width: 100%;
- border: solid 2rpx #f2f2f2;
- background-color: #ffffff;
- padding: 16rpx 0;
- }
- button::after {
- border: none;
- }
- .copy-btn {
- background-color: #ffffff;
- border: 1px solid #999999;
- color: #333333;
- padding: 5rpx 10rpx;
- /* 减少按钮的内边距 */
- border-radius: 8rpx;
- font-size: 28rpx;
- }
- .productImg {
- border-radius: 20rpx;
- width: 120rpx;
- height: 120rpx;
- }
- .grayBut {
- background-color: #f2f2f2;
- padding: 5rpx 30rpx 5rpx 30rpx;
- font-size: 26rpx;
- color: #1b1b1b;
- }
- .popup-content {
- padding: 20rpx;
- }
- .popup-title {
- font-size: 32rpx;
- font-weight: bold;
- text-align: center;
- margin-bottom: 20rpx;
- }
- .popup-input {
- border: 1px solid #ccc;
- border-radius: 8rpx;
- margin-bottom: 20rpx;
- height: 80rpx;
- }
- .popup-buttons {
- display: flex;
- justify-content: space-around;
- }
- .popup-cancel,
- .popup-confirm {
- padding: 10rpx 30rpx;
- border-radius: 8rpx;
- font-size: 28rpx;
- }
- .popup-cancel {
- background-color: #f2f2f2;
- color: #333;
- width: 40%;
- }
- .popup-confirm {
- background-color: #e29c6d;
- color: #fff;
- width: 40%;
- }
- .image-item {
- margin-bottom: 10rpx;
- display: flex;
- /* 设置子元素垂直排列 */
- align-items: center;
- /* 水平居中对齐子元素 */
- }
- .images {
- width: 100rpx;
- height: 100rpx;
- }
- </style>
|