发起退货: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'>
@ -9,17 +7,18 @@
<view class='item acea-row row-between-wrapper' style="display: flex;align-items: center;"> <view class='item acea-row row-between-wrapper' style="display: flex;align-items: center;">
<view>物流公司</view> <view>物流公司</view>
<picker mode='selector' class='num' @change="bindPickerChange" :value="state.expressIndex" <picker mode='selector' class='num' @change="bindPickerChange" :value="state.expressIndex"
: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>
<view class='item textarea acea-row row-between' style="display: flex;align-items: center;"> <view class='item textarea acea-row row-between' style="display: flex;align-items: center;">
<view>物流单号</view> <view>物流单号</view>
<input placeholder='请填写物流单号' class='num' name="logisticsNo" <input placeholder='请填写物流单号' class='num' name="logisticsNo"
placeholder-class='placeholder' /> placeholder-class='placeholder' />
</view> </view>
<button class='returnBnt bg-color ss-reset-button ui-BG-Main-Gradient sub-btn' <button class='returnBnt bg-color ss-reset-button ui-BG-Main-Gradient sub-btn'
form-type="submit" form-type="submit"
@ -32,77 +31,57 @@
</template> </template>
<script setup> <script setup>
import sheep from '@/sheep'; import { onLoad } from '@dcloudio/uni-app';
import { import { reactive } from 'vue';
onLoad, import sheep from '@/sheep';
onReachBottom, import AfterSaleApi from '@/sheep/api/trade/afterSale';
onPullDownRefresh import DeliveryApi from '@/sheep/api/trade/delivery';
} from '@dcloudio/uni-app';
import { const state = reactive({
computed, id: 0, //
watch, expressIndex: 0, // expresses
ref, expresses: [], //
reactive,
unref
} from 'vue';
const state = reactive({
expressIndex: 0,
expresses: [{
"id": 1,
"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,
return; logisticsNo: e.detail.value.logisticsNo,
// };
AfterSaleApi.deliveryAfterSale({ const { code } = await AfterSaleApi.deliveryAfterSale(data);
id: this.id, if (code !== 0) {
logisticsId: this.expresses[this.expressIndex].id, return;
logisticsNo: formData.logisticsNo, }
}).then(res => { uni.showToast({
this.$util.Tips({ title: '填写退货成功',
title: '填写退货成功', });
icon: 'success' sheep.$router.go('/pages/order/aftersale/detail', { id: state.id });
}, {
tab: 5,
url: '/pages/users/user_return_detail/index?id=' + this.id
});
}).catch(err => {
return this.$util.Tips({
title: err
});
})
} }
function getList() { //
async function getExpressList() {
const { code, data } = await DeliveryApi.getDeliveryExpressList();
if (code !== 0) {
return;
}
state.expresses = data;
} }
onLoad(() => {
// 退 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;