新增取消售后 优化售后部分逻辑

master
lemon橪 2021-11-30 14:59:49 +08:00
parent deed875c1b
commit c412c92b3e
5 changed files with 79 additions and 32 deletions

View File

@ -34,16 +34,29 @@ export function applyCancelOrder(params) {
});
}
/**
/**
* 获取商家售后收件地址
*/
export function getstoreAfterSaleAddress(sn) {
export function getStoreAfterSaleAddress(sn) {
return http.request({
url: `/afterSale/getStoreAfterSaleAddress/${sn}`,
method: Method.GET,
needToken: true,
});
}
/**
* 取消售后
*/
export function cancelAfterSale(afterSaleSn) {
return http.request({
url: `/afterSale/cancel/${afterSaleSn}`,
method: Method.POST,
needToken: true,
});
}
/**
* 获取售后服务记录相关数据

View File

@ -187,13 +187,13 @@ export default {
* 立即使用优惠券
*/
useItNow(item) {
if (item.storeId) {
if (item.storeId && item.storeId!='platform') {
uni.navigateTo({
url: `/pages/product/shopPage?id=${item.storeId}`,
});
} else {
uni.switchTab({
url: "/pages/tabbar/home/index",
url: "/pages/navigation/search/searchPage",
});
}
},

View File

@ -68,17 +68,19 @@
<view class="cannot_apply" v-if="order.serviceType == 'CANCEL'">
取消订单-{{ order.serviceStatus | serviceStatusList }}</view>
</div>
<!-- 申请记录 -->
</view>
<view class="after-line">
<!-- 售后申请 -->
<view v-if="
current === 0 && order.groupAfterSaleStatus.includes('NOT_APPLIED')
" @click="applyService(sku.sn, order, sku)" class="rebuy-btn">
<div v-if="current === 0 && sku.afterSaleStatus && (sku.afterSaleStatus.includes('NOT_APPLIED') || sku.afterSaleStatus.includes('PART_AFTER_SALE')) " @click="applyService(sku.sn, order, sku)" class="sale">
<view class=" default-btn border" >
申请售后
</view>
</div>
<view class="after-line">
<!-- 申请中 -->
<view class="rebuy-btn" v-if="
<view class="default-btn border" v-if="
current === 2 &&
order.serviceStatus &&
order.serviceStatus == 'PASS' &&
@ -86,7 +88,10 @@
" @click="onExpress(order, sku)">
提交物流
</view>
<view @click="afterDetails(order, sku)" v-if="current === 1 || current === 2" class="rebuy-btn">
<view @click="close(order,sku)" v-if="current === 1" class="default-btn close">
取消售后
</view>
<view @click="afterDetails(order, sku)" v-if="current === 1 || current === 2" class="default-btn border">
售后详情
</view>
</view>
@ -105,13 +110,14 @@
</view>
<u-loadmore bg-color="#f8f8f8" :status="status" />
</scroll-view>
<u-modal show-cancel-button @confirm="closeService" v-model="cancelShow" content="确认取消售后"></u-modal>
<u-modal v-model="tipsShow" content="当订单未确认收货|已过售后服务有效期|已申请售后服务时,不能申请售后"></u-modal>
</view>
</template>
<script>
import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
import { getAfterSaleList } from "@/api/after-sale.js";
import { getAfterSaleList, cancelAfterSale } from "@/api/after-sale.js";
import { getOrderList } from "@/api/order.js";
export default {
@ -134,6 +140,8 @@ export default {
],
current: 0, //
tipsShow: false, //
cancelShow: false, //
selectedOrder: "", //order
orderList: [], //
params: {
pageNumber: 1,
@ -202,12 +210,12 @@ export default {
});
getOrderList(this.params).then((res) => {
uni.hideLoading();
const orderlist = res.data.result.records;
if (orderlist.length > 0) {
this.orderList = this.orderList.concat(orderlist);
const orderList = res.data.result.records;
if (orderList.length > 0) {
this.orderList = this.orderList.concat(orderList);
this.params.pageNumber += 1;
}
if (orderlist.length < 10) {
if (orderList.length < 10) {
this.status = "nomore";
} else {
this.status = "loading";
@ -215,6 +223,31 @@ export default {
});
},
close(order, sku) {
console.log(order, sku);
this.selectedOrder = order;
this.cancelShow = true;
},
async closeService() {
uni.showLoading({
title: "加载中",
});
console.log(this.selectedOrder);
let res = await cancelAfterSale(this.selectedOrder.sn);
if (res.data.success) {
uni.showToast({
title: "取消成功!",
duration: 2000,
icon: "none",
});
}
this.orderList = [];
this.getOrderList(this.current);
uni.hideLoading();
},
/**
* 售后详情
*/
@ -324,6 +357,7 @@ page,
background: $page-color-base;
height: 100%;
}
.body-view {
overflow-y: auto;
height: calc(100vh - 44px - 80rpx - 104rpx);
@ -420,28 +454,27 @@ page,
.icon {
margin-right: 10rpx;
}
.cancel-btn {
color: #999999;
border-color: #999999;
margin-left: 15rpx;
height: 60rpx;
.sale {
width: 100%;
display: flex;
justify-content: flex-end;
}
.pay-btn {
background-color: #1abc9c;
color: #ffffff;
margin-left: 15rpx;
height: 60rpx;
}
.rebuy-btn {
.default-btn {
background-color: #ffffff;
margin-left: 15rpx;
height: 60rpx;
line-height: 60rpx;
text-align: center;
font-size: 24rpx;
border: 2rpx solid $light-color;
color: $light-color;
padding: 0 24rpx;
border-radius: 200px;
}
.close {
color: $light-color;
}
.border {
border: 2rpx solid $light-color;
color: $light-color;
}
</style>

View File

@ -312,6 +312,7 @@ export default {
return false;
}
console.log(this.form.accountType)
if (this.form.accountType == "BANK_TRANSFER") {
//
if (this.$u.test.isEmpty(this.form.bankDepositName)) {

View File

@ -197,7 +197,7 @@
<script>
import {
getServiceDetail,
getstoreAfterSaleAddress,
getStoreAfterSaleAddress,
getAfterSaleLog,
getAfterSaleReason,
} from "@/api/after-sale.js";
@ -315,7 +315,7 @@ export default {
* 获取地址信息
*/
getAddress() {
getstoreAfterSaleAddress(this.sn).then((res) => {
getStoreAfterSaleAddress(this.sn).then((res) => {
if (res.data.success) {
this.storeAfterSaleAddress = res.data.result;
}