发起退货:100%

pull/36/MERGE
YunaiV 2024-01-06 21:44:25 +08:00
parent b95e711f80
commit 08b6b38c05
5 changed files with 80 additions and 67 deletions

View File

@ -193,6 +193,16 @@
"title": "申请售后" "title": "申请售后"
} }
}, },
{
"path": "aftersale/return-delivery",
"style": {
"navigationBarTitleText": "退货物流"
},
"meta": {
"auth": true,
"title": "退货物流"
}
},
{ {
"path": "aftersale/list", "path": "aftersale/list",
"style": { "style": {

View File

@ -89,10 +89,13 @@
<s-empty v-if="isEmpty(state.info) && state.loading" icon="/static/order-empty.png" text="暂无该订单售后详情" /> <s-empty v-if="isEmpty(state.info) && state.loading" icon="/static/order-empty.png" text="暂无该订单售后详情" />
<su-fixed bottom placeholder bg="bg-white" v-if="!isEmpty(state.info)"> <su-fixed bottom placeholder bg="bg-white" v-if="!isEmpty(state.info)">
<view class="foot_box"> <view class="foot_box">
<!-- TODO 功能缺失填写退货信息 -->
<button class="ss-reset-button btn" v-if="state.info.buttons?.includes('cancel')" <button class="ss-reset-button btn" v-if="state.info.buttons?.includes('cancel')"
@tap="onApply(state.info.id)"> @tap="onApply(state.info.id)">
取消申请 取消申请
</button>
<button class="ss-reset-button btn" v-if="state.info.buttons?.includes('delivery')"
@tap="sheep.$router.go('/pages/order/aftersale/return-delivery', { id: state.info.id })">
填写退货
</button> </button>
<button class="ss-reset-button contcat-btn btn" @tap="sheep.$router.go('/pages/chat/index')"> <button class="ss-reset-button contcat-btn btn" @tap="sheep.$router.go('/pages/chat/index')">
联系客服 联系客服

View File

@ -1,7 +1,5 @@
<template> <template>
<s-layout> <s-layout title="退货物流">
<!-- title='退货物流' -->
<!-- 不知为何加上页面就错误 -->
<view> <view>
<form @submit="subRefund" report-submit='true'> <form @submit="subRefund" report-submit='true'>
<view class='apply-return'> <view class='apply-return'>
@ -12,7 +10,8 @@
:range="state.expresses" range-key="name"> :range="state.expresses" range-key="name">
<view class="picker acea-row row-between-wrapper"> <view class="picker acea-row row-between-wrapper">
<view class='reason'>{{ state.expresses[state.expressIndex].name }}</view> <view class='reason'>{{ state.expresses[state.expressIndex].name }}</view>
<text class='iconfont icon-jiantou'></text> <!-- TODO 芋艿这里样式有问题少了 > 按钮 -->
<text class='iconfont icon-jiantou' />
</view> </view>
</picker> </picker>
</view> </view>
@ -32,77 +31,57 @@
</template> </template>
<script setup> <script setup>
import { onLoad } from '@dcloudio/uni-app';
import { reactive } from 'vue';
import sheep from '@/sheep'; import sheep from '@/sheep';
import { import AfterSaleApi from '@/sheep/api/trade/afterSale';
onLoad, import DeliveryApi from '@/sheep/api/trade/delivery';
onReachBottom,
onPullDownRefresh
} from '@dcloudio/uni-app';
import {
computed,
watch,
ref,
reactive,
unref
} from 'vue';
const state = reactive({ const state = reactive({
expressIndex: 0, id: 0, //
expresses: [{ expressIndex: 0, // expresses
"id": 1, expresses: [], //
"name": "申通快递"
},
{
"id": 2,
"name": "顺丰速运"
},
{
"id": 3,
"name": "中通快递"
},
{
"id": 4,
"name": "韵达快递"
}
], //
}) })
function bindPickerChange(e) { function bindPickerChange(e) {
state.expressIndex = e.detail.value; state.expressIndex = e.detail.value;
} }
function subRefund(e) { async function subRefund(e) {
const formData = e.detail.value; let data = {
console.log(formData, '表单数据'); id: state.id,
console.log(state.expresses[state.expressIndex].id, '物流公司id'); logisticsId: state.expresses[state.expressIndex].id,
logisticsNo: e.detail.value.logisticsNo,
};
const { code } = await AfterSaleApi.deliveryAfterSale(data);
if (code !== 0) {
return; return;
// }
AfterSaleApi.deliveryAfterSale({ uni.showToast({
id: this.id,
logisticsId: this.expresses[this.expressIndex].id,
logisticsNo: formData.logisticsNo,
}).then(res => {
this.$util.Tips({
title: '填写退货成功', title: '填写退货成功',
icon: 'success'
}, {
tab: 5,
url: '/pages/users/user_return_detail/index?id=' + this.id
}); });
}).catch(err => { sheep.$router.go('/pages/order/aftersale/detail', { id: state.id });
return this.$util.Tips({
title: err
});
})
} }
function getList() { //
async function getExpressList() {
const { code, data } = await DeliveryApi.getDeliveryExpressList();
if (code !== 0) {
return;
} }
onLoad(() => { state.expresses = data;
// 退 }
onLoad(options => {
if (!options.id) {
sheep.$helper.toast(`缺少订单信息,请检查`);
return
}
state.id = options.id;
//
getExpressList();
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.apply-return { .apply-return {
padding: 20rpx 30rpx 70rpx 30rpx; padding: 20rpx 30rpx 70rpx 30rpx;

View File

@ -38,6 +38,14 @@ const AfterSaleApi = {
afterSaleId, afterSaleId,
}, },
}); });
},
// 退回货物
deliveryAfterSale: (data) => {
return request({
url: `/app-api/trade/after-sale/delivery`,
method: 'PUT',
data,
});
} }
}; };

View File

@ -0,0 +1,13 @@
import request from '@/sheep/request';
const DeliveryApi = {
// 获得快递公司列表
getDeliveryExpressList: () => {
return request({
url: `/app-api/trade/delivery/express/list`,
method: 'get',
});
}
};
export default DeliveryApi;