feat 对接售后列表
This commit is contained in:
parent
34a8f40953
commit
799d1d5d03
@ -1,5 +1,9 @@
|
||||
import { getRightsList } from './api';
|
||||
import { AfterServiceStatus, ServiceType, ServiceTypeDesc } from '../config';
|
||||
import {
|
||||
getOrderRefundList
|
||||
} from '~/services/order/getOrderRefundList';
|
||||
|
||||
|
||||
Page({
|
||||
page: {
|
||||
@ -8,6 +12,7 @@ Page({
|
||||
},
|
||||
|
||||
data: {
|
||||
enable: false,
|
||||
tabs: [
|
||||
{
|
||||
key: -1,
|
||||
@ -66,7 +71,7 @@ Page({
|
||||
},
|
||||
|
||||
onPullDownRefresh_(e) {
|
||||
const { callback } = e.detail;
|
||||
// const { callback } = e.detail;
|
||||
this.setData({
|
||||
pullDownRefreshing: true,
|
||||
}); // 下拉刷新时不显示load-more
|
||||
@ -75,7 +80,7 @@ Page({
|
||||
this.setData({
|
||||
pullDownRefreshing: false,
|
||||
});
|
||||
callback && callback();
|
||||
// callback && callback();
|
||||
})
|
||||
.catch((err) => {
|
||||
this.setData({
|
||||
@ -90,75 +95,78 @@ Page({
|
||||
this.refreshList(status);
|
||||
},
|
||||
|
||||
// 获取售后订单列表
|
||||
getAfterServiceList(statusCode = -1, reset = false) {
|
||||
const params = {
|
||||
parameter: {
|
||||
pageSize: this.page.size,
|
||||
pageNum: this.page.num,
|
||||
pageIndex: this.page.num,
|
||||
},
|
||||
};
|
||||
if (statusCode !== -1) params.parameter.afterServiceStatus = statusCode;
|
||||
this.setData({
|
||||
listLoading: 1,
|
||||
});
|
||||
return getRightsList(params)
|
||||
return getOrderRefundList(params)
|
||||
.then((res) => {
|
||||
console.log(res,'售后订单列表');
|
||||
this.page.num++;
|
||||
let dataList = [];
|
||||
let { tabs } = this.data;
|
||||
if (res && res.data && res.data.states) {
|
||||
tabs = this.data.tabs.map((item) => {
|
||||
switch (item.key) {
|
||||
case AfterServiceStatus.TO_AUDIT:
|
||||
item.info = res.data.states.audit;
|
||||
break;
|
||||
case AfterServiceStatus.THE_APPROVED:
|
||||
item.info = res.data.states.approved;
|
||||
break;
|
||||
case AfterServiceStatus.COMPLETE:
|
||||
item.info = res.data.states.complete;
|
||||
break;
|
||||
case AfterServiceStatus.CLOSED:
|
||||
item.info = res.data.states.closed;
|
||||
break;
|
||||
}
|
||||
return item;
|
||||
});
|
||||
}
|
||||
if (res && res.data && res.data.dataList) {
|
||||
dataList = (res.data.dataList || []).map((_data) => {
|
||||
// if (res && res.data && res.data.states) {
|
||||
// tabs = this.data.tabs.map((item) => {
|
||||
// switch (item.key) {
|
||||
// case AfterServiceStatus.TO_AUDIT:
|
||||
// item.info = res.data.states.audit;
|
||||
// break;
|
||||
// case AfterServiceStatus.THE_APPROVED:
|
||||
// item.info = res.data.states.approved;
|
||||
// break;
|
||||
// case AfterServiceStatus.COMPLETE:
|
||||
// item.info = res.data.states.complete;
|
||||
// break;
|
||||
// case AfterServiceStatus.CLOSED:
|
||||
// item.info = res.data.states.closed;
|
||||
// break;
|
||||
// }
|
||||
// return item;
|
||||
// });
|
||||
// }
|
||||
if (res && res.data && res.data.result) {
|
||||
dataList = (res.data.result || []).map((_data) => {
|
||||
return {
|
||||
id: _data.rights.rightsNo,
|
||||
serviceNo: _data.rights.rightsNo,
|
||||
storeName: _data.rights.storeName,
|
||||
type: _data.rights.rightsType,
|
||||
typeDesc: ServiceTypeDesc[_data.rights.rightsType],
|
||||
id: _data.orderRefundGuid,
|
||||
serviceNo: _data.orderRefundGuid,
|
||||
storeName: _data.storeName,
|
||||
type: _data.refundType,
|
||||
typeDesc: ServiceTypeDesc[_data.refundType],
|
||||
typeDescIcon:
|
||||
_data.rightsType === ServiceType.ONLY_REFUND
|
||||
? 'money-circle'
|
||||
: 'return-goods-1',
|
||||
status: _data.rights.rightsStatus,
|
||||
statusName: _data.rights.userRightsStatusName,
|
||||
statusDesc: _data.rights.userRightsStatusDesc,
|
||||
amount: _data.rights.refundAmount,
|
||||
goodsList: _data.rightsItem.map((item, i) => ({
|
||||
status: _data.rightsStatus,
|
||||
statusName: _data.eserRightsStatusDesc,
|
||||
statusDesc: _data.eserRightsStatusDesc,
|
||||
amount: _data.refundMoney,
|
||||
goodsList: _data.orderRefundGoodList.map((item, i) => ({
|
||||
id: i,
|
||||
thumb: item.goodsPictureUrl,
|
||||
title: item.goodsName,
|
||||
specs: (item.specInfo || []).map((s) => s.specValues || ''),
|
||||
itemRefundAmount: item.itemRefundAmount,
|
||||
rightsQuantity: item.itemRefundAmount,
|
||||
thumb: item.thumb,
|
||||
title: item.title,
|
||||
specs: (item.specifications || []).map((s) => s.specValue || ''),
|
||||
itemRefundAmount: item.price,
|
||||
rightsQuantity: item.buyQuantity,
|
||||
})),
|
||||
storeId: _data.storeId,
|
||||
storeId: _data.shopGuid,
|
||||
buttons: _data.buttonVOs || [],
|
||||
logisticsNo: _data.logisticsVO.logisticsNo, // 退货物流单号
|
||||
logisticsCompanyName: _data.logisticsVO.logisticsCompanyName, // 退货物流公司
|
||||
logisticsCompanyCode: _data.logisticsVO.logisticsCompanyCode, // 退货物流公司
|
||||
remark: _data.logisticsVO.remark, // 退货备注
|
||||
logisticsVO: _data.logisticsVO,
|
||||
// logisticsNo: _data.logisticsVO.logisticsNo, // 退货物流单号
|
||||
// logisticsCompanyName: _data.logisticsVO.logisticsCompanyName, // 退货物流公司
|
||||
// logisticsCompanyCode: _data.logisticsVO.logisticsCompanyCode, // 退货物流公司
|
||||
// remark: _data.logisticsVO.remark, // 退货备注
|
||||
// logisticsVO: _data.logisticsVO,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
if (reset) {
|
||||
this.setData(
|
||||
|
@ -27,6 +27,7 @@
|
||||
>
|
||||
<view slot="footer" class="order-goods-card-footer">
|
||||
<wr-price
|
||||
priceUnit="yuan"
|
||||
price="{{goods.itemRefundAmount}}"
|
||||
fill
|
||||
wr-class="order-goods-card-footer-price-class"
|
||||
|
@ -1,6 +1,8 @@
|
||||
import Dialog from 'tdesign-miniprogram/dialog/index';
|
||||
import Toast from 'tdesign-miniprogram/toast/index';
|
||||
|
||||
import {
|
||||
repeal
|
||||
} from '~/services/order/repeal';
|
||||
import { cancelRights } from '../../after-service-detail/api';
|
||||
import { ServiceButtonTypes } from '../../config';
|
||||
|
||||
@ -9,6 +11,7 @@ Component({
|
||||
service: {
|
||||
type: Object,
|
||||
observer(service) {
|
||||
console.log(service,'看看service');
|
||||
const buttonsRight = service.buttons || service.buttonVOs || [];
|
||||
this.setData({
|
||||
buttons: {
|
||||
@ -74,6 +77,7 @@ Component({
|
||||
});
|
||||
},
|
||||
|
||||
// 撤销申请
|
||||
onConfirm() {
|
||||
Dialog.confirm({
|
||||
title: '是否撤销退货申请?',
|
||||
@ -81,13 +85,16 @@ Component({
|
||||
confirmBtn: '撤销申请',
|
||||
cancelBtn: '不撤销',
|
||||
}).then(() => {
|
||||
const params = { rightsNo: this.data.service.id };
|
||||
return cancelRights(params).then(() => {
|
||||
Toast({
|
||||
context: this,
|
||||
selector: '#t-toast',
|
||||
message: '你确认撤销申请',
|
||||
});
|
||||
const params = { orderRefundGuid: this.data.service.id };
|
||||
return repeal(params).then((res) => {
|
||||
if(res.code === 200){
|
||||
bindrefresh()
|
||||
Toast({
|
||||
context: this,
|
||||
selector: '#t-toast',
|
||||
message: '撤销申请成功!',
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
@ -8,13 +8,14 @@
|
||||
<view class="wr-goods-card__main">
|
||||
<view class="wr-goods-card__thumb thumb-class" bind:tap="clickThumbHandle">
|
||||
<!-- data-src 是方便加购动画读取图片用的 -->
|
||||
<t-image
|
||||
<!-- <t-image
|
||||
t-class="wr-goods-card__thumb-com"
|
||||
wx:if="{{ !!goods.thumb && !goods.hideKey.thumb }}"
|
||||
src="{{ goods.thumb }}"
|
||||
mode="{{ thumbMode }}"
|
||||
lazy-load="{{ lazyLoad }}"
|
||||
/>
|
||||
/> -->
|
||||
<image src="{{ goods.thumb }}" mode="{{ thumbMode }}" class="wr-goods-card__thumb-com"></image>
|
||||
<slot name="thumb-cover" />
|
||||
</view>
|
||||
|
||||
@ -39,6 +40,7 @@
|
||||
<slot name="price-prefix" />
|
||||
<view wx:if="{{ goods.price && !goods.hideKey.price }}" class="wr-goods-card__price">
|
||||
<price
|
||||
priceUnit="yuan"
|
||||
wr-class="price-class"
|
||||
symbol="{{currency}}"
|
||||
price="{{goods.price}}"
|
||||
@ -48,6 +50,7 @@
|
||||
</view>
|
||||
<view wx:if="{{ goods.originPrice && !goods.hideKey.originPrice && isValidityLinePrice }}" class="wr-goods-card__origin-price">
|
||||
<price
|
||||
priceUnit="yuan"
|
||||
wr-class="origin-price-class"
|
||||
symbol="{{currency}}"
|
||||
price="{{goods.originPrice}}"
|
||||
|
@ -21,14 +21,14 @@ export const AfterServiceStatus = {
|
||||
|
||||
// 售后类型
|
||||
export const ServiceType = {
|
||||
RETURN_GOODS: 10, // 退货退款
|
||||
ONLY_REFUND: 20, // 仅退款
|
||||
RETURN_GOODS: 1, // 退货退款
|
||||
ONLY_REFUND: 2, // 退款(无需退货)
|
||||
ORDER_CANCEL: 30, // 支付后取消
|
||||
};
|
||||
|
||||
export const ServiceTypeDesc = {
|
||||
[ServiceType.ONLY_REFUND]: '退款(无需退货)',
|
||||
[ServiceType.RETURN_GOODS]: '退货',
|
||||
[ServiceType.ONLY_REFUND]: '退款',
|
||||
[ServiceType.ORDER_CANCEL]: '支付后取消',
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,17 @@
|
||||
import Dialog from 'tdesign-miniprogram/dialog/index';
|
||||
import Toast from 'tdesign-miniprogram/toast/index';
|
||||
import reasonSheet from '../components/reason-sheet/reasonSheet';
|
||||
import { getDeliverCompanyList, create, update } from './api';
|
||||
import {
|
||||
getDeliverCompanyList,
|
||||
create,
|
||||
update
|
||||
} from './api';
|
||||
import {
|
||||
getLogisticsCompanyList
|
||||
} from '~/services/order/getLogisticsCompanyList';
|
||||
import {
|
||||
buyerDelivery
|
||||
} from '~/services/order/buyerDelivery';
|
||||
|
||||
Page({
|
||||
deliveryCompanyList: [],
|
||||
@ -16,10 +26,10 @@ Page({
|
||||
onLoad(query) {
|
||||
const {
|
||||
rightsNo = '',
|
||||
logisticsNo = '',
|
||||
logisticsCompanyName = '',
|
||||
logisticsCompanyCode = '',
|
||||
remark = '',
|
||||
logisticsNo = '',
|
||||
logisticsCompanyName = '',
|
||||
logisticsCompanyCode = '',
|
||||
remark = '',
|
||||
} = query;
|
||||
|
||||
if (!rightsNo) {
|
||||
@ -28,7 +38,9 @@ Page({
|
||||
content: '',
|
||||
confirmBtn: '确认',
|
||||
}).then(() => {
|
||||
wx.navigateBack({ backRefresh: true });
|
||||
wx.navigateBack({
|
||||
backRefresh: true
|
||||
});
|
||||
});
|
||||
}
|
||||
this.rightsNo = rightsNo;
|
||||
@ -77,20 +89,27 @@ Page({
|
||||
});
|
||||
},
|
||||
|
||||
// 获取物流公司列表
|
||||
getDeliveryCompanyList() {
|
||||
if (this.deliveryCompanyList.length > 0) {
|
||||
return Promise.resolve(this.deliveryCompanyList);
|
||||
}
|
||||
return getDeliverCompanyList().then((res) => {
|
||||
return getLogisticsCompanyList().then((res) => {
|
||||
this.deliveryCompanyList = res.data || [];
|
||||
return this.deliveryCompanyList;
|
||||
});
|
||||
},
|
||||
|
||||
onInput(e) {
|
||||
const { key } = e.currentTarget.dataset;
|
||||
const { value } = e.detail;
|
||||
this.setData({ [key]: value });
|
||||
const {
|
||||
key
|
||||
} = e.currentTarget.dataset;
|
||||
const {
|
||||
value
|
||||
} = e.detail;
|
||||
this.setData({
|
||||
[key]: value
|
||||
});
|
||||
},
|
||||
|
||||
onCompanyTap() {
|
||||
@ -99,15 +118,16 @@ Page({
|
||||
show: true,
|
||||
title: '选择物流公司',
|
||||
options: deliveryCompanyList.map((company) => ({
|
||||
title: company.name,
|
||||
checked: this.data.deliveryCompany
|
||||
? company.code === this.data.deliveryCompany.code
|
||||
: false,
|
||||
title: company.logisticsCompanyName,
|
||||
checked: this.data.deliveryCompany ?
|
||||
company.code === this.data.deliveryCompany.code :
|
||||
false,
|
||||
})),
|
||||
showConfirmButton: true,
|
||||
showCancelButton: true,
|
||||
emptyTip: '请选择物流公司',
|
||||
}).then((indexes) => {
|
||||
console.log(indexes);
|
||||
this.setData({
|
||||
deliveryCompany: deliveryCompanyList[indexes[0]],
|
||||
});
|
||||
@ -116,7 +136,10 @@ Page({
|
||||
},
|
||||
|
||||
checkParams() {
|
||||
const res = { errMsg: '', require: false };
|
||||
const res = {
|
||||
errMsg: '',
|
||||
require: false
|
||||
};
|
||||
|
||||
if (!this.data.trackingNo) {
|
||||
res.errMsg = '请填写运单号';
|
||||
@ -125,10 +148,13 @@ Page({
|
||||
res.errMsg = '请选择物流公司';
|
||||
res.require = true;
|
||||
}
|
||||
this.setData({ submitActived: !res.require });
|
||||
this.setData({
|
||||
submitActived: !res.require
|
||||
});
|
||||
return res;
|
||||
},
|
||||
|
||||
// 提交
|
||||
onSubmit() {
|
||||
const checkRes = this.checkParams();
|
||||
if (checkRes.errMsg) {
|
||||
@ -144,31 +170,45 @@ Page({
|
||||
const {
|
||||
trackingNo,
|
||||
remark,
|
||||
deliveryCompany: { code, name },
|
||||
deliveryCompany: {
|
||||
logisticsCompanyCode,
|
||||
logisticsCompanyName,
|
||||
logisticsCompanyGuid
|
||||
},
|
||||
} = this.data;
|
||||
|
||||
const params = {
|
||||
rightsNo: this.rightsNo,
|
||||
logisticsCompanyCode: code,
|
||||
logisticsCompanyName: name,
|
||||
logisticsNo: trackingNo,
|
||||
remark,
|
||||
orderRefundGuid: this.rightsNo,
|
||||
logisticsCompanyGuid: logisticsCompanyGuid,
|
||||
expressNo: trackingNo,
|
||||
customerWaybillRemark: remark,
|
||||
};
|
||||
console.log(params,'填写运单号参数');
|
||||
const api = this.isChange ? create : update;
|
||||
this.setData({ submitting: true });
|
||||
api(params)
|
||||
.then(() => {
|
||||
this.setData({ submitting: false });
|
||||
Toast({
|
||||
context: this,
|
||||
selector: '#t-toast',
|
||||
message: '保存成功',
|
||||
icon: '',
|
||||
});
|
||||
setTimeout(() => wx.navigateBack({ backRefresh: true }), 1000);
|
||||
this.setData({
|
||||
submitting: true
|
||||
});
|
||||
buyerDelivery(params)
|
||||
.then((res) => {
|
||||
if(res.code === 200){
|
||||
this.setData({
|
||||
submitting: false
|
||||
});
|
||||
Toast({
|
||||
context: this,
|
||||
selector: '#t-toast',
|
||||
message: '保存成功',
|
||||
icon: '',
|
||||
});
|
||||
setTimeout(() => wx.navigateBack({
|
||||
backRefresh: true
|
||||
}), 1000);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.setData({ submitting: false });
|
||||
this.setData({
|
||||
submitting: false
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@ -182,9 +222,11 @@ Page({
|
||||
message: '扫码成功',
|
||||
icon: '',
|
||||
});
|
||||
this.setData({ trackingNo: res.result });
|
||||
this.setData({
|
||||
trackingNo: res.result
|
||||
});
|
||||
},
|
||||
fail: () => {},
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
@ -19,9 +19,9 @@
|
||||
</t-cell>
|
||||
<t-cell
|
||||
t-class-title="t-cell-title-width"
|
||||
t-class-note="{{deliveryCompany && deliveryCompany.name ? 't-cell__value' : 't-cell__placeholder'}}"
|
||||
t-class-note="{{deliveryCompany && deliveryCompany.logisticsCompanyName ? 't-cell__value' : 't-cell__placeholder'}}"
|
||||
title="物流公司"
|
||||
note="{{deliveryCompany && deliveryCompany.name || '请选择物流公司'}}"
|
||||
note="{{deliveryCompany && deliveryCompany.logisticsCompanyName || '请选择物流公司'}}"
|
||||
arrow
|
||||
bindtap="onCompanyTap"
|
||||
/>
|
||||
|
@ -2,7 +2,7 @@ import {
|
||||
request
|
||||
} from '../_utils/request';
|
||||
|
||||
/** 编辑个人资料 */
|
||||
/** 添加地址 */
|
||||
export function addOrUpdateAddress(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
|
21
services/order/buyerDelivery.js
Normal file
21
services/order/buyerDelivery.js
Normal file
@ -0,0 +1,21 @@
|
||||
import {
|
||||
request
|
||||
} from '../_utils/request';
|
||||
|
||||
/** 买家发货(填写运单号) */
|
||||
export function buyerDelivery(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: `OrderRefundApi/buyerDelivery`,
|
||||
method: 'POST',
|
||||
data: data,
|
||||
success: function (res) {
|
||||
|
||||
resolve(res);
|
||||
},
|
||||
fail: function (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
@ -3,7 +3,7 @@ import {
|
||||
} from '../_utils/request';
|
||||
|
||||
|
||||
/* 提交订单 */
|
||||
/* 获取订单运费 */
|
||||
export async function getGoodsFreight(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
|
22
services/order/getLogisticsCompanyList.js
Normal file
22
services/order/getLogisticsCompanyList.js
Normal file
@ -0,0 +1,22 @@
|
||||
import {
|
||||
request
|
||||
} from '../_utils/request';
|
||||
|
||||
|
||||
/* 获取物流公司列表 */
|
||||
export async function getLogisticsCompanyList(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: `OrderRefundApi/getLogisticsCompanyList`,
|
||||
method: 'Get',
|
||||
data: data,
|
||||
success: function (res) {
|
||||
|
||||
resolve(res);
|
||||
},
|
||||
fail: function (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
22
services/order/getOrderRefundList.js
Normal file
22
services/order/getOrderRefundList.js
Normal file
@ -0,0 +1,22 @@
|
||||
import {
|
||||
request
|
||||
} from '../_utils/request';
|
||||
|
||||
|
||||
/* 获取售后列表 */
|
||||
export async function getOrderRefundList(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: `OrderRefundApi/getOrderRefundList`,
|
||||
method: 'Get',
|
||||
data: data,
|
||||
success: function (res) {
|
||||
|
||||
resolve(res);
|
||||
},
|
||||
fail: function (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
21
services/order/repeal.js
Normal file
21
services/order/repeal.js
Normal file
@ -0,0 +1,21 @@
|
||||
import {
|
||||
request
|
||||
} from '../_utils/request';
|
||||
|
||||
/** 撤销售后单记录 */
|
||||
export function repeal(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: `OrderRefundApi/repeal`,
|
||||
method: 'POST',
|
||||
data: data,
|
||||
success: function (res) {
|
||||
|
||||
resolve(res);
|
||||
},
|
||||
fail: function (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user