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

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({ return http.request({
url: `/afterSale/getStoreAfterSaleAddress/${sn}`, url: `/afterSale/getStoreAfterSaleAddress/${sn}`,
method: Method.GET, method: Method.GET,
needToken: true, 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) { useItNow(item) {
if (item.storeId) { if (item.storeId && item.storeId!='platform') {
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/shopPage?id=${item.storeId}`, url: `/pages/product/shopPage?id=${item.storeId}`,
}); });
} else { } else {
uni.switchTab({ 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'"> <view class="cannot_apply" v-if="order.serviceType == 'CANCEL'">
取消订单-{{ order.serviceStatus | serviceStatusList }}</view> 取消订单-{{ order.serviceStatus | serviceStatusList }}</view>
</div> </div>
<!-- 申请记录 --> <!-- 申请记录 -->
</view> </view>
<!-- 售后申请 -->
<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="after-line">
<!-- 售后申请 -->
<view v-if="
current === 0 && order.groupAfterSaleStatus.includes('NOT_APPLIED')
" @click="applyService(sku.sn, order, sku)" class="rebuy-btn">
申请售后
</view>
<!-- 申请中 --> <!-- 申请中 -->
<view class="rebuy-btn" v-if=" <view class="default-btn border" v-if="
current === 2 && current === 2 &&
order.serviceStatus && order.serviceStatus &&
order.serviceStatus == 'PASS' && order.serviceStatus == 'PASS' &&
@ -86,7 +88,10 @@
" @click="onExpress(order, sku)"> " @click="onExpress(order, sku)">
提交物流 提交物流
</view> </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>
</view> </view>
@ -105,13 +110,14 @@
</view> </view>
<u-loadmore bg-color="#f8f8f8" :status="status" /> <u-loadmore bg-color="#f8f8f8" :status="status" />
</scroll-view> </scroll-view>
<u-modal show-cancel-button @confirm="closeService" v-model="cancelShow" content="确认取消售后"></u-modal>
<u-modal v-model="tipsShow" content="当订单未确认收货|已过售后服务有效期|已申请售后服务时,不能申请售后"></u-modal> <u-modal v-model="tipsShow" content="当订单未确认收货|已过售后服务有效期|已申请售后服务时,不能申请售后"></u-modal>
</view> </view>
</template> </template>
<script> <script>
import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue"; 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"; import { getOrderList } from "@/api/order.js";
export default { export default {
@ -134,6 +140,8 @@ export default {
], ],
current: 0, // current: 0, //
tipsShow: false, // tipsShow: false, //
cancelShow: false, //
selectedOrder: "", //order
orderList: [], // orderList: [], //
params: { params: {
pageNumber: 1, pageNumber: 1,
@ -202,12 +210,12 @@ export default {
}); });
getOrderList(this.params).then((res) => { getOrderList(this.params).then((res) => {
uni.hideLoading(); uni.hideLoading();
const orderlist = res.data.result.records; const orderList = res.data.result.records;
if (orderlist.length > 0) { if (orderList.length > 0) {
this.orderList = this.orderList.concat(orderlist); this.orderList = this.orderList.concat(orderList);
this.params.pageNumber += 1; this.params.pageNumber += 1;
} }
if (orderlist.length < 10) { if (orderList.length < 10) {
this.status = "nomore"; this.status = "nomore";
} else { } else {
this.status = "loading"; 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; background: $page-color-base;
height: 100%; height: 100%;
} }
.body-view { .body-view {
overflow-y: auto; overflow-y: auto;
height: calc(100vh - 44px - 80rpx - 104rpx); height: calc(100vh - 44px - 80rpx - 104rpx);
@ -420,28 +454,27 @@ page,
.icon { .icon {
margin-right: 10rpx; margin-right: 10rpx;
} }
.cancel-btn {
color: #999999; .sale {
border-color: #999999; width: 100%;
margin-left: 15rpx; display: flex;
height: 60rpx; justify-content: flex-end;
} }
.pay-btn { .default-btn {
background-color: #1abc9c;
color: #ffffff;
margin-left: 15rpx;
height: 60rpx;
}
.rebuy-btn {
background-color: #ffffff; background-color: #ffffff;
margin-left: 15rpx; margin-left: 15rpx;
height: 60rpx; height: 60rpx;
line-height: 60rpx; line-height: 60rpx;
text-align: center; text-align: center;
font-size: 24rpx; font-size: 24rpx;
border: 2rpx solid $light-color;
color: $light-color;
padding: 0 24rpx; padding: 0 24rpx;
border-radius: 200px; border-radius: 200px;
} }
.close {
color: $light-color;
}
.border {
border: 2rpx solid $light-color;
color: $light-color;
}
</style> </style>

View File

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

View File

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