|
@@ -404,6 +404,31 @@ class AfterSaleService extends CrudService {
|
|
|
res = await this.afterFetch(filter, res);
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询售后快递
|
|
|
+ * @param {Object} query 查询参数
|
|
|
+ * @param {String} query.id 售后id
|
|
|
+ */
|
|
|
+ async getTransportInfo({ id }) {
|
|
|
+ const data = await this.model.findById(id);
|
|
|
+ if (!data) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到售后数据');
|
|
|
+ const { transport } = data;
|
|
|
+ if (!transport) return;
|
|
|
+ const { customer_transport_no, customer_transport_type, shop_transport_no, shop_transport_type } = transport;
|
|
|
+ const result = {};
|
|
|
+ if (customer_transport_no && customer_transport_type) {
|
|
|
+ const q = { no: customer_transport_no, type: customer_transport_type };
|
|
|
+ const customer = await this.ctx.service.util.kd100.search(q);
|
|
|
+ result.customer = customer;
|
|
|
+ }
|
|
|
+ if (shop_transport_no && shop_transport_type) {
|
|
|
+ const q = { no: shop_transport_no, type: shop_transport_type };
|
|
|
+ const shop = await this.ctx.service.util.kd100.search(q);
|
|
|
+ result.shop = shop;
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
module.exports = AfterSaleService;
|