完善pdd售后
This commit is contained in:
parent
e9bd600e19
commit
8d5ca873ea
|
|
@ -0,0 +1,754 @@
|
|||
package com.qihang.pdd.controller;
|
||||
|
||||
|
||||
import cn.qihangerp.open.pdd.RefundApiHelper;
|
||||
import cn.qihangerp.open.pdd.common.ApiResultVo;
|
||||
import cn.qihangerp.open.pdd.model.AfterSale;
|
||||
import com.qihang.common.common.AjaxResult;
|
||||
import com.qihang.common.enums.HttpStatus;
|
||||
import com.qihang.pdd.domain.OmsPddOrder;
|
||||
import com.qihang.pdd.openapi.ApiCommon;
|
||||
import com.qihang.pdd.openapi.PullRequest;
|
||||
import com.qihang.pdd.service.OmsPddGoodsService;
|
||||
import com.qihang.pdd.service.OmsPddOrderService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/pdd-api/refund")
|
||||
@RestController
|
||||
public class PddRefundApiController {
|
||||
private static Logger logger = LoggerFactory.getLogger(PddRefundApiController.class);
|
||||
private final OmsPddGoodsService goodsService;
|
||||
private final OmsPddOrderService orderService;
|
||||
private final ApiCommon pddApiHelper;
|
||||
/**
|
||||
* 接口拉取订单
|
||||
*
|
||||
* @param
|
||||
* @param
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping ("/pull_refund")
|
||||
public AjaxResult getAfterSaleList(@RequestBody PullRequest req) throws Exception {
|
||||
// Integer updType = req.getUpdType();//更新类型0拉取新订单1更新订单
|
||||
// String startDate = req.getStartDate();//reqData.getString("startTime");
|
||||
// String endDate = req.getEndDate();//reqData.getString("endTime");
|
||||
|
||||
Long shopId = req.getShopId();// 拼多多shopId
|
||||
var checkResult = pddApiHelper.checkBefore(req.getShopId());
|
||||
if (checkResult.getCode() != HttpStatus.SUCCESS) {
|
||||
return AjaxResult.error(checkResult.getCode(), checkResult.getMsg(), checkResult.getData());
|
||||
}
|
||||
String accessToken = checkResult.getData().getAccessToken();
|
||||
String url = checkResult.getData().getServerUrl();
|
||||
String appKey = checkResult.getData().getAppKey();
|
||||
String appSecret = checkResult.getData().getAppSecret();
|
||||
|
||||
Long endTime = System.currentTimeMillis() / 1000;// 订单更新结束时间(默认值)
|
||||
Long startTime = endTime - 60 * 60 * 24 + 10;// 订单更新开始时间(默认值)
|
||||
|
||||
// 查询上次更新时间
|
||||
|
||||
|
||||
|
||||
// logger.info("开始循环更新拼多多订单。开始时间:" + DateUtil.unixTimeStampToDate(startTime) + "结束时间:" + DateUtil.unixTimeStampToDate(endTime));
|
||||
int hasExistOrder = 0;
|
||||
int insertSuccess = 0;
|
||||
int totalError = 0;
|
||||
|
||||
|
||||
ApiResultVo<AfterSale> apiResultVo = RefundApiHelper.pullRefundList(appKey, appSecret, accessToken, 1716160072, 1716242872, 1, 20);
|
||||
|
||||
if (apiResultVo.getCode() != 0) return AjaxResult.error(apiResultVo.getCode(), apiResultVo.getMsg());
|
||||
//成功
|
||||
if (apiResultVo.getList() != null) {
|
||||
//循环插入订单数据到数据库
|
||||
for (var trade : apiResultVo.getList()) {
|
||||
OmsPddOrder order = new OmsPddOrder();
|
||||
BeanUtils.copyProperties(trade,order);
|
||||
|
||||
|
||||
//插入订单数据
|
||||
// var result = orderService.saveOrder(req.getShopId(), order);
|
||||
// if (result.getCode() == ResultVoEnum.DataExist.getIndex()) {
|
||||
// //已经存在
|
||||
// logger.info("/**************主动更新pdd订单:开始更新数据库:" + order.getId() + "存在、更新****************/");
|
||||
//
|
||||
// hasExistOrder++;
|
||||
// } else if (result.getCode() == ResultVoEnum.SUCCESS.getIndex()) {
|
||||
// logger.info("/**************主动更新pdd订单:开始更新数据库:" + order.getId() + "不存在、新增****************/");
|
||||
//
|
||||
// insertSuccess++;
|
||||
// } else {
|
||||
// logger.info("/**************主动更新pdd订单:开始更新数据库:" + order.getId() + "报错****************/");
|
||||
// totalError++;
|
||||
// }
|
||||
}
|
||||
}
|
||||
String msg = "成功,总共找到:" + apiResultVo.getTotalRecords()+ "条商品数据,新增:" + insertSuccess + "条,添加错误:" + totalError + "条,更新:" + hasExistOrder + "条";
|
||||
logger.info(msg);
|
||||
|
||||
return AjaxResult.success(msg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * 更新订单状态(根据订单号)
|
||||
// *
|
||||
// * @param reqData
|
||||
// * @param req
|
||||
// * @return
|
||||
// * @throws Exception
|
||||
// */
|
||||
// @RequestMapping(value = "/pull_order_status", method = RequestMethod.POST)
|
||||
// public ApiResult<ErpSalesPullCountResp> updOrderStatus(@RequestBody DataRow reqData, HttpServletRequest req)
|
||||
// throws Exception {
|
||||
// // String startDate = reqData.getString("startTime");
|
||||
// // String endDate = reqData.getString("endTime");
|
||||
// log.info("开始接口更新订单状态");
|
||||
// Integer shopId = reqData.getInt("shopId");// 拼多多shopId
|
||||
// String orderS = reqData.getString("orderS");//
|
||||
//
|
||||
// ApiResult<ErpSalesPullCountResp> result = null;// 返回结果
|
||||
//
|
||||
// String clientId = DataConfigObject.getInstance().getPddClientId();
|
||||
// String clientSecret = DataConfigObject.getInstance().getPddClientSecret();
|
||||
// var shop = shopService.getShop(shopId);
|
||||
// // var settingEntity = thirdSettingService.getEntity(shop.getType());
|
||||
//
|
||||
// String accessToken = shop.getSessionKey();// settingEntity.getAccess_token();
|
||||
// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
//
|
||||
// PddOrderStatusGetRequest request = new PddOrderStatusGetRequest();
|
||||
// request.setOrderSns(orderS);
|
||||
// PddOrderStatusGetResponse response = client.syncInvoke(request, accessToken);
|
||||
// // System.out.println(JsonUtil.transferToJson(response));
|
||||
// // 更新订单状态
|
||||
// if (response.getErrorResponse() != null) {
|
||||
// if (response.getErrorResponse().getErrorCode().intValue() == 10019) {
|
||||
// return new ApiResult<>(EnumResultVo.TokenFail.getIndex(), "Token过期");
|
||||
// } else
|
||||
// return new ApiResult<>(EnumResultVo.SystemException.getIndex(),
|
||||
// "接口调用失败:" + response.getErrorResponse().getErrorMsg());
|
||||
// } else {
|
||||
// // 获取到了数据
|
||||
// if (response.getOrderStatusGetResponse().getOrderStatusList().size() > 0) {
|
||||
// for (var item : response.getOrderStatusGetResponse().getOrderStatusList()) {
|
||||
// orderPddService.updPddOrderStatus(item.getOrderSn(), item.getOrderStatus(), item.getRefundStatus());
|
||||
// log.info("更新订单状态:" + JsonUtil.transferToJson(item));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// log.info("更新订单状态 完成");
|
||||
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "SUCCESS");
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @RequestMapping(value = "/pull_order_status_all", method = RequestMethod.POST)
|
||||
// public ApiResult<ErpSalesPullCountResp> updOrderStatusAll(@RequestBody DataRow reqData, HttpServletRequest req)
|
||||
// throws Exception {
|
||||
// log.info("开始接口更新订单状态ALL");
|
||||
// Integer shopId = reqData.getInt("shopId");// 拼多多shopId
|
||||
// var shop = shopService.getShop(shopId);
|
||||
// String clientId = DataConfigObject.getInstance().getPddClientId();
|
||||
// String clientSecret = DataConfigObject.getInstance().getPddClientSecret();
|
||||
// // 获取店铺信息,判断店铺是否一致
|
||||
// var shopResult = PddApiUtils.getShopInfo(clientId, clientSecret, shop.getSessionKey());
|
||||
// if (shopResult.getCode() != EnumResultVo.SUCCESS.getIndex())
|
||||
// return new ApiResult<>(shopResult.getCode(), shopResult.getMsg());
|
||||
//
|
||||
// if (shopResult.getData().getMallId().longValue() != shop.getSellerUserId().longValue()) {
|
||||
// return new ApiResult<>(EnumResultVo.TokenFail.getIndex(), "该店铺不是授权店铺");
|
||||
// }
|
||||
//
|
||||
// String orderStatus = reqData.getString("orderStatus");
|
||||
// String refundStatusStr = reqData.getString("refundStatus");
|
||||
// Integer status = null;
|
||||
// Integer refundStatus = null;
|
||||
// if (!StringUtils.isEmpty(orderStatus)) {
|
||||
// try {
|
||||
// status = Integer.parseInt(orderStatus);
|
||||
// } catch (Exception e) {
|
||||
// }
|
||||
// }
|
||||
// if (!StringUtils.isEmpty(refundStatusStr)) {
|
||||
// try {
|
||||
// refundStatus = Integer.parseInt(refundStatusStr);
|
||||
// } catch (Exception e) {
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Integer pageIndex = 1;
|
||||
// Integer pageSize = 50;
|
||||
//
|
||||
// // 查询订单
|
||||
// var result = orderPddService.getOrderListByStatus(pageIndex, pageSize, shopId, status, refundStatus);
|
||||
// log.info("查询到" + result.getTotalPage() + "页需要更新,总共" + result.getTotalSize() + "条记录");
|
||||
//
|
||||
// String orderS = "";
|
||||
// for (var o : result.getList()) {
|
||||
// orderS += o.getOrderSn() + ",";
|
||||
// }
|
||||
// log.info("开始更新第1页");
|
||||
// upd(shopId, orderS);
|
||||
//
|
||||
// while (result.isHasNextPage()) {
|
||||
// pageIndex++;
|
||||
// log.info("开始更新第" + pageIndex + "页");
|
||||
// result = orderPddService.getOrderListByStatus(pageIndex, pageSize, shopId, status, refundStatus);
|
||||
//
|
||||
// String orderS1 = "";
|
||||
// for (var o : result.getList()) {
|
||||
// orderS1 += o.getOrderSn() + ",";
|
||||
// }
|
||||
// upd(shopId, orderS1);
|
||||
// }
|
||||
// log.info("已更新" + pageIndex + "页,总计:" + result.getTotalSize() + "条,更新完成");
|
||||
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "SUCCESS");
|
||||
// }
|
||||
|
||||
// private ApiResult<String> upd(Integer shopId, String orderS) throws Exception {
|
||||
// String clientId = DataConfigObject.getInstance().getPddClientId();
|
||||
// String clientSecret = DataConfigObject.getInstance().getPddClientSecret();
|
||||
// var shop = shopService.getShop(shopId);
|
||||
// // var settingEntity = thirdSettingService.getEntity(shop.getType());
|
||||
//
|
||||
// String accessToken = shop.getSessionKey();// settingEntity.getAccess_token();
|
||||
// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
//
|
||||
// PddOrderStatusGetRequest request = new PddOrderStatusGetRequest();
|
||||
// request.setOrderSns(orderS);
|
||||
// PddOrderStatusGetResponse response = client.syncInvoke(request, accessToken);
|
||||
// // System.out.println(JsonUtil.transferToJson(response));
|
||||
// // 更新订单状态
|
||||
// if (response.getErrorResponse() != null) {
|
||||
// if (response.getErrorResponse().getErrorCode().intValue() == 10019) {
|
||||
// return new ApiResult<>(EnumResultVo.TokenFail.getIndex(), "Token过期");
|
||||
// } else
|
||||
// return new ApiResult<>(EnumResultVo.SystemException.getIndex(),
|
||||
// "接口调用失败:" + response.getErrorResponse().getErrorMsg());
|
||||
// } else {
|
||||
// // 获取到了数据
|
||||
// if (response.getOrderStatusGetResponse().getOrderStatusList().size() > 0) {
|
||||
// for (var item : response.getOrderStatusGetResponse().getOrderStatusList()) {
|
||||
// orderPddService.updPddOrderStatus(item.getOrderSn(), item.getOrderStatus(), item.getRefundStatus());
|
||||
// log.info("更新订单状态:" + JsonUtil.transferToJson(item));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// log.info("更新订单状态 完成");
|
||||
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "SUCCESS");
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 重复打印
|
||||
// *
|
||||
// * @param reqData
|
||||
// * @return
|
||||
// * @throws Exception
|
||||
// */
|
||||
// @RequestMapping(value = "/pdd_order_repeat_print", method = RequestMethod.POST)
|
||||
// public ApiResult<String> pdd_order_repeat_print(@RequestBody DataRow reqData) throws Exception {
|
||||
// if (StringUtils.isEmpty(reqData.get("printName")))
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "请选择打印机");
|
||||
// var orders = orderPddService.getPrintOrderRepeat(reqData.getString("orderNo"));
|
||||
// if (orders.size() == 0)
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "订单物流打印信息不存在");
|
||||
// Integer total = 0;
|
||||
// StringBuilder sb = new StringBuilder("");
|
||||
// for (var order : orders) {
|
||||
// total += order.getQuantity();
|
||||
// sb.append(order.getGoodsSpecNum());
|
||||
// sb.append("(" + order.getGoodsSpec() + ")");
|
||||
// sb.append(order.getQuantity()).append("件");
|
||||
// sb.append("[" + order.getLocationNumber() + "]").append("\\n");
|
||||
// }
|
||||
// var shop = shopService.getShop(orders.get(0).getShopId());
|
||||
// StringBuilder remark = new StringBuilder("【" + shop.getNickName() + "】").append("订单:").append(orders.size())
|
||||
// .append("商品:").append(total).append("件").append("\\n");
|
||||
//
|
||||
// if (!StringUtils.isEmpty(orders.get(0).getEncryptedData())) {
|
||||
// // templateUrl=EnumPddPrintCompany.getValueByName(orders.get(0).getTrackingCompany());
|
||||
// remark.append(sb.toString()).append("备注:").append(orders.get(0).getRemark());
|
||||
// String taskId = orders.get(0).getTrackingNumber() + "_" + OrderNumberUtils.getOrderIdByTime();
|
||||
// StringBuilder printStr = new StringBuilder(
|
||||
// "{\"ERPId\":303379400,\"cmd\":\"print\",\"requestID\":\"90E06437\",\"task\":{\"documents\":[{\"contents\":[{\"addData\":{\"sender\":{\"address\":{\"city\":\"东莞市\",\"detail\":\"聚新二路42号华衣云商科技\",\"district\":\"大朗镇\",\"province\":\"广东省\"},\"mobile\":\"13018605585\",\"name\":\"杨辉\"}},");
|
||||
// printStr.append("\"encryptedData\": \"").append(orders.get(0).getEncryptedData()).append("\",");
|
||||
// printStr.append("\"signature\": \"").append(orders.get(0).getSignature()).append("\",");
|
||||
// printStr.append(
|
||||
// "\"templateUrl\":\"http://pinduoduoimg.yangkeduo.com/print_template/2019-08-01/4f0d85f35ca5729ad7df47314c990c31.xml\",\"userid\":\"593374804\",\"ver\":\"3\"},");
|
||||
// // printStr.append("\"templateUrl\":
|
||||
// // \"").append("https://commfile.pddpic.com/galerie-go/logistics/9238dbb5-1c4e-445e-bac6-45a6832b4e47.xml").append("\",\"userid\":\"593374804\",\"ver\":\"3\"},");
|
||||
// printStr.append("{\"data\":{\"height\":120,\"list\":[{\"fontSize\":29,\"height\":120,\"left\":2.08,");
|
||||
// printStr.append("\"text\": \"").append(remark.toString()).append("\",");
|
||||
// printStr.append(
|
||||
// "\"top\":10,\"width\":600}],\"waterdata\":{\"text\":\"\"},\"width\":560},\"templateURL\":\"http://pinduoduoimg.yangkeduo.com/logistics/2019-07-14/5d7e8b5969d954539fcfba3268bbeb3a.xml\"}],");
|
||||
// // printStr.append("\"top\":10,\"width\":413.52}],\"waterdata\":{\"text\":\"\"},\"width\":560},\"templateURL\":\"").append("https://commfile.pddpic.com/galerie-go/logistics/9238dbb5-1c4e-445e-bac6-45a6832b4e47.xml").append("\"}],");
|
||||
// printStr.append("\"documentID\": \"").append(taskId).append("\"}],");
|
||||
// printStr.append("\"notifyType\": [\"print\"],\"preview\": false,\"previewType\": \"image\",");
|
||||
// printStr.append("\"printer\": \"").append(reqData.getString("printName")).append("\",");
|
||||
// printStr.append("\"taskID\": \"").append(taskId).append("\"},");
|
||||
// printStr.append("\"version\": \"1.0\"}");
|
||||
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "成功", printStr.toString());
|
||||
// }
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "没有原始打单数据");
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @RequestMapping(value = "/pdd_order_print", method = RequestMethod.POST)
|
||||
// public ApiResult<String> pdd_order_print(@RequestBody DataRow reqData) throws Exception {
|
||||
// if (StringUtils.isEmpty(reqData.get("printName")))
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "请选择打印机");
|
||||
// var orders = orderPddService.getPrintOrderRepeatNumber(reqData.getString("trackingNumber"));
|
||||
// if (orders.size() == 0)
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "订单物流打印信息不存在");
|
||||
// Integer total = 0;
|
||||
// StringBuilder sb = new StringBuilder("");
|
||||
// for (var order : orders) {
|
||||
// total += order.getQuantity();
|
||||
// sb.append(order.getGoodsSpecNum());
|
||||
// sb.append("(" + order.getGoodsSpec() + ")");
|
||||
// sb.append(order.getQuantity()).append("件,");
|
||||
// sb.append("[" + order.getLocationNumber() + "]").append("\\n");
|
||||
// }
|
||||
// var shop = shopService.getShop(orders.get(0).getShopId());
|
||||
// StringBuilder remark = new StringBuilder("【" + shop.getNickName() + "】").append("订单:").append(orders.size())
|
||||
// .append("商品:").append(total).append("件").append("\\n");
|
||||
//
|
||||
// if (!StringUtils.isEmpty(orders.get(0).getEncryptedData())) {
|
||||
// // String
|
||||
// // templateUrl=EnumPddPrintCompany.getValueByName(orders.get(0).getTrackingCompany());
|
||||
// remark.append(sb.toString()).append("备注:").append(orders.get(0).getRemark());
|
||||
// String taskId = orders.get(0).getTrackingNumber() + "_" + OrderNumberUtils.getOrderIdByTime();
|
||||
// StringBuilder printStr = new StringBuilder(
|
||||
// "{\"ERPId\":303379400,\"cmd\":\"print\",\"requestID\":\"90E06437\",\"task\":{\"documents\":[{\"contents\":[{\"addData\":{\"sender\":{\"address\":{\"city\":\"东莞市\",\"detail\":\"聚新二路42号华衣云商科技\",\"district\":\"大朗镇\",\"province\":\"广东省\"},\"mobile\":\"13018605585\",\"name\":\"杨辉\"}},");
|
||||
// printStr.append("\"encryptedData\": \"").append(orders.get(0).getEncryptedData()).append("\",");
|
||||
// printStr.append("\"signature\": \"").append(orders.get(0).getSignature()).append("\",");
|
||||
// printStr.append(
|
||||
// "\"templateUrl\":\"http://pinduoduoimg.yangkeduo.com/print_template/2019-08-01/4f0d85f35ca5729ad7df47314c990c31.xml\",\"userid\":\"593374804\",\"ver\":\"3\"},");
|
||||
// // printStr.append("\"templateUrl\":
|
||||
// // \"").append("http://pinduoduoimg.yangkeduo.com/print_template/2019-08-01/4f0d85f35ca5729ad7df47314c990c31.xml").append("\",\"userid\":\"593374804\",\"ver\":\"3\"},");
|
||||
// printStr.append("{\"data\":{\"height\":120,\"list\":[{\"fontSize\":29,\"height\":120,\"left\":2.08,");
|
||||
// printStr.append("\"text\": \"").append(remark.toString()).append("\",");
|
||||
// printStr.append(
|
||||
// "\"top\":10,\"width\":600}],\"waterdata\":{\"text\":\"\"},\"width\":560},\"templateURL\":\"http://pinduoduoimg.yangkeduo.com/logistics/2019-07-14/5d7e8b5969d954539fcfba3268bbeb3a.xml\"}],");
|
||||
// // printStr.append("\"top\":10,\"width\":413.52}],\"waterdata\":{\"text\":\"\"},\"width\":560},\"templateURL\":\"").append("http://pinduoduoimg.yangkeduo.com/print_template/2019-08-01/4f0d85f35ca5729ad7df47314c990c31.xml").append("\"}],");
|
||||
// printStr.append("\"documentID\": \"").append(taskId).append("\"}],");
|
||||
// printStr.append("\"notifyType\": [\"print\"],\"preview\": false,\"previewType\": \"image\",");
|
||||
// printStr.append("\"printer\": \"").append(reqData.getString("printName")).append("\",");
|
||||
// printStr.append("\"taskID\": \"").append(taskId).append("\"},");
|
||||
// printStr.append("\"version\": \"1.0\"}");
|
||||
// for (var order : orders) {
|
||||
// orderPddService.updPddOrderResult(order.getOrderId(), "打印成功", 1, DateUtil.getCurrentDateTime());
|
||||
// }
|
||||
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "成功", printStr.toString());
|
||||
// }
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "没有原始打单数据");
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @RequestMapping(value = "/pdd_order_print_code", method = RequestMethod.POST)
|
||||
// public ApiResult<String> testPddPrint(@RequestBody DataRow reqData) throws Exception {
|
||||
// if (StringUtils.isEmpty(reqData.get("company")))
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "请选择快递公司");
|
||||
//
|
||||
// String clientId = DataConfigObject.getInstance().getPddClientId();
|
||||
// String clientSecret = DataConfigObject.getInstance().getPddClientSecret();
|
||||
//
|
||||
// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
// // 使用东方概念旗舰店授权打单,所有要用东方概念旗舰店accessToken获取电子面单
|
||||
// /*
|
||||
// * var dfgnShop = shopService.getShop(5); //检查获取单号的token是否过期 String accessToken5
|
||||
// * = dfgnShop.getSessionKey(); PddOrderStatusGetRequest request5 = new
|
||||
// * PddOrderStatusGetRequest(); request5.setOrderSns("");
|
||||
// * PddOrderStatusGetResponse response5 = client.syncInvoke(request5,
|
||||
// * accessToken5);
|
||||
// *
|
||||
// * if (response5.getErrorResponse() != null &&
|
||||
// * response5.getErrorResponse().getErrorCode() ==10019) { return new
|
||||
// * ApiResult<>(EnumResultVo.TokenFail.getIndex(),"东方符号店铺token过期","5"); }
|
||||
// *
|
||||
// * var checkTokenResult =
|
||||
// * PddApiUtils.getShopInfo(clientId,clientSecret,accessToken5);
|
||||
// * if(checkTokenResult.getData().getMallId().longValue() != 593374804L){ return
|
||||
// * new ApiResult<>(EnumResultVo.TokenFail.getIndex(),"东方符号店铺token过期","5"); }
|
||||
// */
|
||||
// Integer shopId = reqData.getInt("shopId");
|
||||
// var shop = shopService.getShop(shopId);
|
||||
// synchronized (this) {
|
||||
// var orders = (ArrayList) reqData.getObject("orders");
|
||||
// for (var orderSn : orders) {
|
||||
// // 查询需要打印的订单
|
||||
// var printOrderRes = orderPddService.getPrintOrderList(String.valueOf(orderSn),
|
||||
// reqData.getInt("isHebing"), reqData.getString("goodsNum"));
|
||||
// if (printOrderRes.getCode() > 0) {
|
||||
// log.info("订单不符号打印条件:" + printOrderRes.getMsg());
|
||||
// continue;
|
||||
// }
|
||||
// var orderList = printOrderRes.getData().getOrders();
|
||||
// System.out.println("订单数:" + orderList.size());
|
||||
// String accessToken = shop.getSessionKey();// settingEntity.getAccess_token();
|
||||
// PddOrderStatusGetRequest request = new PddOrderStatusGetRequest();
|
||||
//
|
||||
// StringBuilder orderSns = new StringBuilder();
|
||||
// for (var order : orderList) {
|
||||
// orderSns.append(order.getOrderSn()).append(",");
|
||||
// }
|
||||
// request.setOrderSns(orderSns.toString());
|
||||
//
|
||||
// PddOrderStatusGetResponse response = client.syncInvoke(request, accessToken);
|
||||
//
|
||||
// // 检查订单状态是否存在退款
|
||||
// if (response.getErrorResponse() != null) {
|
||||
// if (response.getErrorResponse().getErrorCode() == 10019) {
|
||||
// return new ApiResult<>(EnumResultVo.TokenFail.getIndex(), "token过期", shopId.toString());
|
||||
// } else {
|
||||
// log.error("拼多多订单打印接口请求错误:" + orderSns.toString() + response.getErrorResponse().getErrorMsg());
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for (var o : response.getOrderStatusGetResponse().getOrderStatusList()) {
|
||||
// if (o.getOrderStatus().intValue() != 1 || o.getRefundStatus().intValue() != 1) {
|
||||
// orderPddService.updPddOrderStatus(o.getOrderSn(), o.getOrderStatus(), o.getRefundStatus());
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// String encryptedData = "";
|
||||
// String signature = "";
|
||||
// String billCode = "";
|
||||
// var printRes = getPddPrint(orderList, reqData.getString("company"));
|
||||
// if (!StringUtils.isEmpty(printRes.getJSONObject("error"))) {
|
||||
// orderList.forEach(o -> orderPddService.updPddOrderResult(o.getOrderId(),
|
||||
// printRes.getJSONObject("error").getString("sub_msg"), 0, null));
|
||||
// continue;
|
||||
// }
|
||||
// if (!StringUtils.isEmpty(printRes.getString("waybill_code"))) {
|
||||
// encryptedData = printRes.getString("encryptedData");
|
||||
// signature = printRes.getString("signature");
|
||||
// billCode = printRes.getString("waybill_code");
|
||||
// // 3.更新库存确认到仓库
|
||||
// for (var o : orderList) {
|
||||
// String company = EnumPddPrintCompany.getName(reqData.getString("company"));
|
||||
// var result = orderPddService.updPddOrderPrint(o, company, billCode, encryptedData, signature);
|
||||
// log.info("拼多多订单:" + o.getOrderSn() + "物流:" + billCode + "结果:" + result.getMsg());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "订单取号完成");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public JSONObject getPddPrint(List<OrderViewModel> orders, String company) throws Exception {
|
||||
// String clientId = DataConfigObject.getInstance().getPddClientId();
|
||||
// String clientSecret = DataConfigObject.getInstance().getPddClientSecret();
|
||||
//
|
||||
// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
// var order = orders.get(0);
|
||||
// var dfgnShop = shopService.getShop(order.getShopId());// 固定使用东方概念旗舰店accessToken
|
||||
// String accessToken = dfgnShop.getSessionKey();// thirdSettingService.getEntity(5).getAccess_token();
|
||||
//
|
||||
// PddWaybillGetRequest request = new PddWaybillGetRequest();
|
||||
//
|
||||
// PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequest paramWaybillCloudPrintApplyNewRequest = new PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequest();
|
||||
// paramWaybillCloudPrintApplyNewRequest.setNeedEncrypt(false);
|
||||
//
|
||||
// PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestSender sender = new PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestSender();
|
||||
//
|
||||
// PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestSenderAddress address = new PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestSenderAddress();
|
||||
//
|
||||
// address.setProvince("广东省");
|
||||
// address.setCity("东莞市");
|
||||
// address.setDistrict("大朗镇");
|
||||
// // 百货店地址
|
||||
// if(order.getShopId()==18){
|
||||
// address.setDetail(company.equals("JTSD") ? "聚新2路42号" : "聚新二路42号华衣云商科技");
|
||||
// }
|
||||
// // 东方店地址
|
||||
// if(order.getShopId()==5){
|
||||
// address.setDetail("聚新二路42号华衣云商科技");
|
||||
// }
|
||||
//
|
||||
// sender.setAddress(address);
|
||||
// sender.setMobile("15920623872");
|
||||
// sender.setName("胡生");
|
||||
// sender.setPhone("15920623872");
|
||||
//
|
||||
// paramWaybillCloudPrintApplyNewRequest.setSender(sender);
|
||||
// List<PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItem> tradeOrderInfoDtos = new ArrayList<>();
|
||||
//
|
||||
// PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItem item = new PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItem();
|
||||
// // item.setLogisticsServices("{ "SVC-COD": { "value": "200" } }");
|
||||
// item.setObjectId("str");
|
||||
//
|
||||
// PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemOrderInfo orderInfo = new PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemOrderInfo();
|
||||
// orderInfo.setOrderChannelsType("PDD");
|
||||
// List<String> tradeOrderList = new ArrayList<String>();
|
||||
// orders.forEach(i -> tradeOrderList.add(i.getOrderSn()));
|
||||
// // tradeOrderList.add(order.getOrderSn());
|
||||
// orderInfo.setTradeOrderList(tradeOrderList);
|
||||
// item.setOrderInfo(orderInfo);
|
||||
//
|
||||
// PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemPackageInfo packageInfo = new PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemPackageInfo();
|
||||
// packageInfo.setGoodsDescription("str");
|
||||
// packageInfo.setId("str");
|
||||
// List<PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemPackageInfoItemsItem> items = new ArrayList<>();
|
||||
//
|
||||
// PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemPackageInfoItemsItem item1 = new PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemPackageInfoItemsItem();
|
||||
// item1.setCount(1);
|
||||
// item1.setName("衣服");
|
||||
// items.add(item1);
|
||||
// packageInfo.setItems(items);
|
||||
// packageInfo.setPackagingDescription("");
|
||||
// packageInfo.setTotalPackagesCount(0);
|
||||
// packageInfo.setVolume(0L);
|
||||
// packageInfo.setWeight(0L);
|
||||
// item.setPackageInfo(packageInfo);
|
||||
//
|
||||
// PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemRecipient recipient = new PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemRecipient();
|
||||
//
|
||||
// PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemRecipientAddress address1 = new PddWaybillGetRequest.ParamWaybillCloudPrintApplyNewRequestTradeOrderInfoDtosItemRecipientAddress();
|
||||
// address1.setCountry("中国");
|
||||
// address1.setProvince(order.getProvince());
|
||||
// address1.setCity(order.getCity());
|
||||
// address1.setDistrict(order.getTown());
|
||||
// address1.setDetail(order.getAddress());
|
||||
// // address.setTown();
|
||||
// recipient.setAddress(address1);
|
||||
// recipient.setMobile(order.getReceiverPhone());
|
||||
// recipient.setName(order.getReceiverName());
|
||||
// recipient.setPhone(order.getReceiverPhone());
|
||||
// item.setRecipient(recipient);
|
||||
// item.setTemplateUrl(EnumPddPrintCompany.getValue(company));
|
||||
// item.setUserId(0L);
|
||||
// tradeOrderInfoDtos.add(item);
|
||||
// paramWaybillCloudPrintApplyNewRequest.setTradeOrderInfoDtos(tradeOrderInfoDtos);
|
||||
// paramWaybillCloudPrintApplyNewRequest.setWpCode(company);
|
||||
// request.setParamWaybillCloudPrintApplyNewRequest(paramWaybillCloudPrintApplyNewRequest);
|
||||
// try {
|
||||
// JSONObject resObj = new JSONObject();
|
||||
//
|
||||
// // log.info(JsonUtil.transferToJson(request));
|
||||
//
|
||||
// PddWaybillGetResponse response = client.syncInvoke(request, accessToken);
|
||||
// String jsonStr = JsonUtil.transferToJson(response);
|
||||
// var res = JSONObject.parseObject(jsonStr);
|
||||
// if (!StringUtils.isEmpty(res.getJSONObject("error_response"))) {
|
||||
// resObj.put("error", res.getJSONObject("error_response"));
|
||||
// return resObj;
|
||||
// }
|
||||
// // log.info("获取面单密文结果:"+res);
|
||||
// var resObjs = res.getJSONObject("pdd_waybill_get_response").getJSONArray("modules");
|
||||
// for (int i = 0; i < resObjs.size(); i++) {
|
||||
// resObj = JSONObject.parseObject(resObjs.getJSONObject(i).getString("print_data"));
|
||||
// resObj.put("waybill_code", resObjs.getJSONObject(i).getString("waybill_code"));
|
||||
// }
|
||||
// // String
|
||||
// // resJsonStr="{\"pdd_waybill_get_response\":{\"modules\":[{\"object_id\":\"str\",\"print_data\":\"{\\\"encryptedData\\\":\\\"a67d4819d0cd21554e9437e0bc2caa629864b0effd1aec65833023f78e93733ca9eec3468dc487b24682b9d64f176ca6bb3f602c2b383571c725bae8ff84957579b574f231f3f4bff51447906ce0566b74210e61bb9379a1ad3647cd9c5648fc1e2a627dde855be135aeadb4dffd020554bf84a05f39d50f49bf8875895fc79ec23933bbf375987929f129b6bd30521b8259c104e564a45b5d2c4d3ccd45aa9dae43e27c34c91c6be269d3028ff1f579a866bed94696a9d697851edb30ee8411975486bc993fee8c4cad2525e0e33638978c8fcb8dea75a1d05d2b586ff0174bc18a3a0680e0ae48d73444fc440fb55f7b2a0485f4d2d7396601ba9ea295d895023b4d2299cb87cca5be2a147bc62f078e716dcce4f563215d8098b6eefe7df465c05a88f80098f6175441f711f5ca193c60b61435c58c5d32fa6a39b9b8a3699c4411dca8921be94ba5fd5de113a76c34eb0bad6fcbbfcfe4eacd400a1ff63e51d603c8aaada8969165607d149c0e6bcf724924fcacc9248818a219719e2c46199ced5ada6f6b42a2c3555fddcfe2fb5309cae5dca4a0c5d389ecee8bcf66062ff3aa7c09ee6aa9ebfa86139a7a4adce21cceb4729e0a448f762f6d5b379790093943651240f93932eb106d25341df44bb4dfb2e9b5ed3c827a6c063585cf2fbd9b5886886efea7ac89fb734130da262a22b282c8a8bbddc2d79fcd35814e3fa24c3538dac9bbdb096054263f7f2541191c0b1aa5207f8be1ae1292aea443d3fabf1fb837b58758738eebe494941af774ace3ac436420fc4c15b41b97c5553c1483ecfb87c3691e80f0d30e75d4339bc7e5d9de6ccf3e65d1008ba61d6803b0e8b874ab353ccb368536cc35b4ddde1f43d509ee8146ffd6b7a4841299dba4512af7b533a44fcabce1224c91ca9785659abf2f5f4f8dd2ccc6c264f7ed25587ab5b023ae2089e748bdf34eca6948198d366e879863b41cfe558bd0ce9f6c5361c1ea29d905e5e73b42f945e573cd9b519f17629fa8134a8dd4cdfd48aac911ea2140ece7269d71e8230ab6fff4ab9f08771f849cf3eb3a34f41743fd7b4f3e5532c6fc98a38cd63f7a48750d056fd25fad54f31ce2e8c3f4a679baf83f18202280c8069fe3c5c942cc5d95412b9ca707c62c0ba3c19f88bd4c518a6bdfda6670cf84a7ab6b23d4a8bb996fc9c6d8dc65318a82e5e637eb2aa2a91e3a146f01fecb2d02f6e768c90f72296d56563e9cf1e7d6d377ffcd7817c00d9db2e5abc93e515b23218e92df1f23e774580caee71824adfcc4a7d3c36f9113954f03eb84b7acecee2eb77d38935af1ec1ff0f7a5c965616166a5d9f427b5f5d497f83dfe67acb745f1e887e9c2af61f79fa802293e18a7d6a1f4666ff4913249f708623d5b619e7824c199474395b26cc26613b74d00a653ec4d3bcb580629a1716610a5341242ffbc10b176cddd186aa336f9cbe3fbaa2e9904c52c9e92da89f36539aba33e8883dd4b2b0792b8c93ec80508fb476d96fa689c3171135a3c03ee17c5e7f20387b2948bc4b9c371c1bbe57f4efa3b75054d77e191bcb8339c61c7d4efac045455da183eed3e331ec26fcc60e768f5\\\",\\\"signature\\\":\\\"g/C/uwNK5sTXC07e9z4KGoykKqoEuAL/txQtIGKCM6UMBkY1WmTpM43T8ylaoq0nsa3pEQBoWuu1QreS7kUAXU8egugpr8PMGnVg5plrDkAa/zaOAV+8q8xv3dR/7vU/VBmCWcR3z3dmlRBXNomyW6KNmXTeH1vh3tQPtPllho4=\\\",\\\"templateUrl\\\":\\\"https://file-link.pinduoduo.com/jtsd_one\\\",\\\"ver\\\":\\\"3\\\"}\",\"waybill_code\":\"JT5049988959708\"}]}}";
|
||||
// /*
|
||||
// * var resObjs=
|
||||
// * JSONObject.parseObject(resJsonStr).getJSONObject("pdd_waybill_get_response").
|
||||
// * getJSONArray("modules"); for(int i=0;i<resObjs.size();i++) { resObj =
|
||||
// * JSONObject.parseObject(resObjs.getJSONObject(i).getString("print_data"));
|
||||
// * resObj.put("waybill_code",resObjs.getJSONObject(i).getString("waybill_code"))
|
||||
// * ; }
|
||||
// */
|
||||
// return resObj;
|
||||
// } catch (Exception e) {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @RequestMapping(value = "/pdd_order_print_select_hebing", method = RequestMethod.POST)
|
||||
// public ApiResult<String> pdd_order_print_select_hebing(@RequestBody DataRow reqData) throws Exception {
|
||||
// if (StringUtils.isEmpty(reqData.get("company")))
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "请选择快递公司");
|
||||
// var orders = (ArrayList) reqData.getObject("orders");
|
||||
// if (orders.isEmpty())
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "请选择需要发货的订单");
|
||||
//
|
||||
// String clientId = DataConfigObject.getInstance().getPddClientId();
|
||||
// String clientSecret = DataConfigObject.getInstance().getPddClientSecret();
|
||||
//
|
||||
// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
// // 检查获取单号的token是否过期
|
||||
///* var dfgnShop = shopService.getShop(5);
|
||||
// String accessToken5 = dfgnShop.getSessionKey();
|
||||
// PddOrderStatusGetRequest request5 = new PddOrderStatusGetRequest();
|
||||
// request5.setOrderSns("");
|
||||
// PddOrderStatusGetResponse response5 = client.syncInvoke(request5, accessToken5);
|
||||
//
|
||||
// if (response5.getErrorResponse() != null && response5.getErrorResponse().getErrorCode() == 10019) {
|
||||
// return new ApiResult<>(EnumResultVo.TokenFail.getIndex(), "东方符号店铺token过期", "5");
|
||||
// }
|
||||
//
|
||||
// var checkTokenResult = PddApiUtils.getShopInfo(clientId, clientSecret, accessToken5);
|
||||
// if (checkTokenResult.getData().getMallId().longValue() != 593374804L) {
|
||||
// return new ApiResult<>(EnumResultVo.TokenFail.getIndex(), "东方符号店铺token过期", "5");
|
||||
// }*/
|
||||
//
|
||||
// Integer shopId = reqData.getInt("shopId");
|
||||
// var shop = shopService.getShop(shopId);
|
||||
//
|
||||
// var printOrders = orderPddService.getPrintOrderSelectList(orders);
|
||||
//
|
||||
// String accessToken = shop.getSessionKey();// settingEntity.getAccess_token();
|
||||
// PddOrderStatusGetRequest request = new PddOrderStatusGetRequest();
|
||||
//
|
||||
// StringBuilder orderSns = new StringBuilder();
|
||||
// for (var order : printOrders.getData()) {
|
||||
// orderSns.append(order.getOrderSn()).append(",");
|
||||
// }
|
||||
// request.setOrderSns(orderSns.toString());
|
||||
//
|
||||
// PddOrderStatusGetResponse response = client.syncInvoke(request, accessToken);
|
||||
//
|
||||
// // 检查订单状态是否存在退款
|
||||
// if (response.getErrorResponse() != null) {
|
||||
// if (response.getErrorResponse().getErrorCode() == 10019) {
|
||||
// return new ApiResult<>(EnumResultVo.TokenFail.getIndex(), "token过期", shopId.toString());
|
||||
// } else {
|
||||
// return new ApiResult<>(EnumResultVo.Fail.getIndex(),
|
||||
// "拼多多接口请求错误" + response.getErrorResponse().getErrorMsg());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for (var o : response.getOrderStatusGetResponse().getOrderStatusList()) {
|
||||
// if (o.getOrderStatus().intValue() != 1 || o.getRefundStatus().intValue() != 1) {
|
||||
// orderPddService.updPddOrderStatus(o.getOrderSn(), o.getOrderStatus(), o.getRefundStatus());
|
||||
// return new ApiResult<>(EnumResultVo.SystemException.getIndex(), orderSns.toString() + "订单状态已发货或已申请退款");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// var checkRes = orderPddService.checkPrint(printOrders.getData());
|
||||
//
|
||||
// if (checkRes.getCode() > 0)
|
||||
// return new ApiResult<>(checkRes.getCode(), checkRes.getMsg());
|
||||
// // 取电子面单号
|
||||
// var printRes = getPddPrint(printOrders.getData(), reqData.getString("company"));
|
||||
// if (!StringUtils.isEmpty(printRes.getJSONObject("error"))) {
|
||||
// printOrders.getData().forEach(o -> orderPddService.updPddOrderResult(o.getOrderId(),
|
||||
// printRes.getJSONObject("error").getString("sub_msg"), 0, null));
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(),
|
||||
// orderSns.toString() + printRes.getJSONObject("error").getString("sub_msg"));
|
||||
// }
|
||||
// String billCode = "";
|
||||
// String encryptedData = "";
|
||||
// String signature = "";
|
||||
// if (!StringUtils.isEmpty(printRes.getString("waybill_code"))) {
|
||||
// billCode = printRes.getString("waybill_code");
|
||||
// encryptedData = printRes.getString("encryptedData");
|
||||
// signature = printRes.getString("signature");
|
||||
// // 3.更新库存确认到仓库
|
||||
// for (var o : printOrders.getData()) {
|
||||
// var result = orderPddService.updPddOrderPrint(o,
|
||||
// EnumPddPrintCompany.getName(reqData.getString("company")), billCode, encryptedData, signature);
|
||||
// log.info("拼多多订单:" + o.getOrderSn() + "物流:" + billCode + "结果:" + result.getMsg());
|
||||
// }
|
||||
// }
|
||||
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "订单取号完成");
|
||||
// }
|
||||
//
|
||||
// @RequestMapping(value = "/pdd_order_send", method = RequestMethod.POST)
|
||||
// public ApiResult<String> pdd_order_send(@RequestBody DataRow reqData) throws Exception {
|
||||
// String clientId = DataConfigObject.getInstance().getPddClientId();
|
||||
// String clientSecret = DataConfigObject.getInstance().getPddClientSecret();
|
||||
// var shop = shopService.getShop(reqData.getInt("shopId"));
|
||||
//
|
||||
// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
//
|
||||
// String accessToken = shop.getSessionKey();
|
||||
// // 获取店铺信息,判断店铺是否一致
|
||||
// var shopResult = PddApiUtils.getShopInfo(clientId, clientSecret, accessToken);
|
||||
// if (shopResult.getCode() != EnumResultVo.SUCCESS.getIndex())
|
||||
// return new ApiResult<>(shopResult.getCode(), shopResult.getMsg());
|
||||
//
|
||||
// if (shopResult.getData().getMallId().longValue() != shop.getSellerUserId().longValue()) {
|
||||
// return new ApiResult<>(EnumResultVo.TokenFail.getIndex(), "该店铺不是授权店铺");
|
||||
// }
|
||||
//
|
||||
// var orders = (ArrayList) reqData.getObject("orders");
|
||||
// if (orders.isEmpty())
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "请选择需要发货的订单");
|
||||
// for (var orderNo : orders) {
|
||||
// var order = orderPddService.getOrder((String) orderNo);
|
||||
// PddLogisticsOnlineSendRequest request = new PddLogisticsOnlineSendRequest();
|
||||
// request.setLogisticsId(orderPddService.getPddLogisticsCompanyId(order.getTracking_company()).longValue());// 快递公司编号
|
||||
// request.setOrderSn(order.getOrderSn());// 订单编号
|
||||
// request.setTrackingNumber(order.getTracking_number());// 快递公司单号
|
||||
// PddLogisticsOnlineSendResponse response = client.syncInvoke(request, accessToken);
|
||||
// if (!StringUtils.isEmpty(response.getErrorResponse())) {
|
||||
// orderPddService.updPddOrderResult(order.getId(), response.getErrorResponse().getErrorMsg(), 1, null);
|
||||
// continue;
|
||||
// }
|
||||
// if (response.getLogisticsOnlineSendResponse().getIsSuccess()) {
|
||||
// var result = orderPddService.orderSend(order);
|
||||
// log.info("PDD订单发货:" + result.getMsg());
|
||||
// }
|
||||
// }
|
||||
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "成功");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 回收单号
|
||||
// *
|
||||
// * @param reqData
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping(value = "/pdd_cancel_print", method = RequestMethod.POST)
|
||||
// public ApiResult<String> pdd_cancel_print(@RequestBody DataRow reqData) {
|
||||
// String clientId = DataConfigObject.getInstance().getPddClientId();
|
||||
// String clientSecret = DataConfigObject.getInstance().getPddClientSecret();
|
||||
// PopClient client = new PopHttpClient(clientId, clientSecret);
|
||||
// // 固定使用东方概念旗舰店accessToken
|
||||
// var dfgnShop = shopService.getShop(18);
|
||||
// String accessToken = dfgnShop.getSessionKey();
|
||||
// var orders = orderPddService.getPrintOrderRepeat(reqData.getString("orderNo"));
|
||||
// try {
|
||||
// // 取消电子面单
|
||||
// PddWaybillCancelRequest request = new PddWaybillCancelRequest();
|
||||
// request.setWaybillCode(orders.get(0).getTrackingNumber());
|
||||
// request.setWpCode(EnumPddPrintCompany.getIndexByName(orders.get(0).getTrackingCompany()));
|
||||
// PddWaybillCancelResponse response = client.syncInvoke(request, accessToken);
|
||||
// String jsonStr = JsonUtil.transferToJson(response);
|
||||
// var res = JSONObject.parseObject(jsonStr);
|
||||
// if (!StringUtils.isEmpty(res.getJSONObject("error_response"))) {
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(),
|
||||
// res.getJSONObject("error_response").getString("sub_msg"));
|
||||
// }
|
||||
// if (!StringUtils.isEmpty(res.getJSONObject("pdd_waybill_cancel_response"))) {
|
||||
// if (res.getJSONObject("pdd_waybill_cancel_response").getBoolean("cancel_result")) {
|
||||
// for (var order : orders) {
|
||||
// orderPddService.cancelOrderPrint(order.getOrderId());
|
||||
// }
|
||||
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "成功");
|
||||
// } else
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "取消电子面单失败");
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "系统异常");
|
||||
// }
|
||||
// return new ApiResult<>(EnumResultVo.ParamsError.getIndex(), "取消电子面单失败");
|
||||
//
|
||||
// }
|
||||
//
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.qihang.pdd.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.qihang.common.common.AjaxResult;
|
||||
import com.qihang.common.common.PageQuery;
|
||||
import com.qihang.common.common.PageResult;
|
||||
import com.qihang.common.common.TableDataInfo;
|
||||
import com.qihang.common.enums.EnumShopType;
|
||||
import com.qihang.common.mq.MqMessage;
|
||||
import com.qihang.common.mq.MqType;
|
||||
import com.qihang.pdd.domain.OmsPddRefund;
|
||||
import com.qihang.pdd.domain.bo.PddAfterSaleBo;
|
||||
import com.qihang.pdd.domain.bo.PddOrderPushBo;
|
||||
import com.qihang.pdd.service.OmsPddRefundService;
|
||||
import com.qihang.security.common.BaseController;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 拼多多订单Controller
|
||||
*
|
||||
* @author qihang
|
||||
* @date 2024-01-02
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/refund")
|
||||
public class PddRefundController extends BaseController
|
||||
{
|
||||
private final KafkaTemplate<String,Object> kafkaTemplate;
|
||||
private final OmsPddRefundService refundService;
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public TableDataInfo orderList(PddAfterSaleBo bo, PageQuery pageQuery) {
|
||||
PageResult<OmsPddRefund> result = refundService.queryPageList(bo, pageQuery);
|
||||
|
||||
return getDataTable(result);
|
||||
}
|
||||
@PostMapping("/push_oms")
|
||||
@ResponseBody
|
||||
public AjaxResult pushOms(@RequestBody PddOrderPushBo bo) {
|
||||
// TODO:需要优化消息格式
|
||||
if(bo!=null && bo.getIds()!=null) {
|
||||
for(String id: bo.getIds()) {
|
||||
// mqUtils.sendApiMessage(MqMessage.build(EnumShopType.PDD, MqType.REFUND_MESSAGE, id));
|
||||
kafkaTemplate.send(MqType.REFUND_MQ, JSONObject.toJSONString(MqMessage.build(EnumShopType.PDD, MqType.REFUND_MESSAGE,id)));
|
||||
}
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
package com.qihang.pdd.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 拼多多订单退款表
|
||||
* @TableName oms_pdd_refund
|
||||
*/
|
||||
@Data
|
||||
public class OmsPddRefund implements Serializable {
|
||||
/**
|
||||
* 售后编号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 内部店铺ID
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderSn;
|
||||
|
||||
/**
|
||||
* 售后类型 1:全部 2:仅退款 3:退货退款 4:换货 5:缺货补寄 6:维修
|
||||
*/
|
||||
private Integer afterSalesType;
|
||||
|
||||
/**
|
||||
* 售后状态 0:无售后 2:买家申请退款,待商家处理 3:退货退款,待商家处理 4:商家同意退款,退款中 5:平台同意退款,退款中 6:驳回退款,待买家处理 7:已同意退货退款,待用户发货 8:平台处理中 9:平台拒绝退款,退款关闭 10:退款成功 11:买家撤销 12:买家逾期未处理,退款失败 13:买家逾期,超过有效期 14:换货补寄待商家处理 15:换货补寄待用户处理 16:换货补寄成功 17:换货补寄失败 18:换货补寄待用户确认完成 21:待商家同意维修 22:待用户确认发货 24:维修关闭 25:维修成功 27:待用户确认收货 31:已同意拒收退款,待用户拒收 32:补寄待商家发货 33:待商家召回
|
||||
*/
|
||||
private Integer afterSalesStatus;
|
||||
|
||||
/**
|
||||
* 售后原因
|
||||
*/
|
||||
private String afterSaleReason;
|
||||
|
||||
/**
|
||||
* 订单成团时间
|
||||
*/
|
||||
private String confirmTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createdTime;
|
||||
|
||||
/**
|
||||
* 订单折扣金额(元)
|
||||
*/
|
||||
private Double discountAmount;
|
||||
|
||||
/**
|
||||
* 1纠纷退款 0非纠纷退款
|
||||
*/
|
||||
private Double disputeRefundStatus;
|
||||
|
||||
/**
|
||||
* 商品图片
|
||||
*/
|
||||
private String goodsImage;
|
||||
|
||||
/**
|
||||
* 拼多多商品id
|
||||
*/
|
||||
private Long goodsId;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String goodsName;
|
||||
|
||||
/**
|
||||
* 商品价格,单位:元
|
||||
*/
|
||||
private Double goodsPrice;
|
||||
|
||||
/**
|
||||
* 订单金额(元)
|
||||
*/
|
||||
private Double orderAmount;
|
||||
|
||||
/**
|
||||
* 退款金额(元)
|
||||
*/
|
||||
private Double refundAmount;
|
||||
|
||||
/**
|
||||
* 同意退款操作人角色0:"默认",1:"用户",2:"商家",3:"平台",4:"系统",5:"团长",6:"司机",7:"代理人"
|
||||
*/
|
||||
private Integer refundOperatorRole;
|
||||
|
||||
/**
|
||||
* 拼多多商品skuid
|
||||
*/
|
||||
private Long skuId;
|
||||
|
||||
/**
|
||||
* 商家外部编码(商品)
|
||||
*/
|
||||
private String outerGoodsId;
|
||||
|
||||
/**
|
||||
* 商家外部编码(sku)
|
||||
*/
|
||||
private String outerId;
|
||||
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
private String goodsSpec;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer goodsNumber;
|
||||
|
||||
/**
|
||||
* 退货物流公司名称
|
||||
*/
|
||||
private String shippingName;
|
||||
|
||||
/**
|
||||
* 极速退款标志位 1:极速退款,0:非极速退款
|
||||
*/
|
||||
private Integer speedRefundFlag;
|
||||
|
||||
/**
|
||||
* 极速退款状态,"1":有极速退款资格,"2":极速退款失败, "3" 表示极速退款成功,其他表示非极速退款
|
||||
*/
|
||||
private Integer speedRefundStatus;
|
||||
|
||||
/**
|
||||
* 0-未勾选 1-消费者选择的收货状态为未收到货 2-消费者选择的收货状态为已收到货
|
||||
*/
|
||||
private Integer userShippingStatus;
|
||||
|
||||
/**
|
||||
* 快递单号
|
||||
*/
|
||||
private String trackingNumber;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private String updatedTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 系统更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.qihang.pdd.domain.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PddAfterSaleBo {
|
||||
private Integer shopId;
|
||||
private Integer customerExpect;
|
||||
private Long orderId;
|
||||
private String serviceId;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.qihang.pdd.mapper;
|
||||
|
||||
import com.qihang.pdd.domain.OmsPddRefund;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【oms_pdd_refund(拼多多订单退款表)】的数据库操作Mapper
|
||||
* @createDate 2024-06-20 16:33:28
|
||||
* @Entity com.qihang.pdd.domain.OmsPddRefund
|
||||
*/
|
||||
public interface OmsPddRefundMapper extends BaseMapper<OmsPddRefund> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.qihang.pdd.service;
|
||||
|
||||
import com.qihang.common.common.PageQuery;
|
||||
import com.qihang.common.common.PageResult;
|
||||
import com.qihang.common.common.ResultVo;
|
||||
import com.qihang.pdd.domain.OmsPddRefund;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qihang.pdd.domain.bo.PddAfterSaleBo;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【oms_pdd_refund(拼多多订单退款表)】的数据库操作Service
|
||||
* @createDate 2024-06-20 16:33:28
|
||||
*/
|
||||
public interface OmsPddRefundService extends IService<OmsPddRefund> {
|
||||
PageResult<OmsPddRefund> queryPageList(PddAfterSaleBo bo, PageQuery pageQuery);
|
||||
ResultVo<Integer> saveRefund(Long shopId, OmsPddRefund refund);
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package com.qihang.pdd.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.qihang.common.common.PageQuery;
|
||||
import com.qihang.common.common.PageResult;
|
||||
import com.qihang.common.common.ResultVo;
|
||||
import com.qihang.common.common.ResultVoEnum;
|
||||
import com.qihang.pdd.domain.OmsPddRefund;
|
||||
import com.qihang.pdd.domain.bo.PddAfterSaleBo;
|
||||
import com.qihang.pdd.mapper.OmsPddOrderItemMapper;
|
||||
import com.qihang.pdd.mapper.OmsPddOrderMapper;
|
||||
import com.qihang.pdd.service.OmsPddRefundService;
|
||||
import com.qihang.pdd.mapper.OmsPddRefundMapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【oms_pdd_refund(拼多多订单退款表)】的数据库操作Service实现
|
||||
* @createDate 2024-06-20 16:33:28
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
public class OmsPddRefundServiceImpl extends ServiceImpl<OmsPddRefundMapper, OmsPddRefund>
|
||||
implements OmsPddRefundService{
|
||||
private final OmsPddRefundMapper mapper;
|
||||
private final OmsPddOrderMapper orderMapper;
|
||||
private final OmsPddOrderItemMapper orderItemMapper;
|
||||
|
||||
@Override
|
||||
public PageResult<OmsPddRefund> queryPageList(PddAfterSaleBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<OmsPddRefund> queryWrapper = new LambdaQueryWrapper<OmsPddRefund>()
|
||||
.eq(bo.getShopId()!=null,OmsPddRefund::getShopId,bo.getShopId())
|
||||
// .eq(bo.getCustomerExpect()!=null,OmsJdAfterSale::getCustomerExpect,bo.getCustomerExpect())
|
||||
// .eq(bo.getOrderId()!=null,OmsJdAfterSale::getOrderId,bo.getOrderId())
|
||||
// .eq(StringUtils.hasText(bo.getServiceId()),OmsJdAfterSale::getServiceId,bo.getServiceId())
|
||||
;
|
||||
|
||||
Page<OmsPddRefund> page = mapper.selectPage(pageQuery.build(), queryWrapper);
|
||||
|
||||
return PageResult.build(page);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public ResultVo<Integer> saveRefund(Long shopId, OmsPddRefund refund){
|
||||
OmsPddRefund origin = mapper.selectById(refund.getId());
|
||||
if(origin!=null){
|
||||
// 存在,修改
|
||||
OmsPddRefund update = new OmsPddRefund();
|
||||
update.setId(origin.getId());
|
||||
update.setOrderSn(refund.getOrderSn());
|
||||
update.setAfterSalesStatus(refund.getAfterSalesStatus());
|
||||
update.setDisputeRefundStatus(refund.getDisputeRefundStatus());
|
||||
update.setRefundAmount(refund.getRefundAmount());
|
||||
update.setRefundOperatorRole(refund.getRefundOperatorRole());
|
||||
update.setShippingName(refund.getShippingName());
|
||||
update.setTrackingNumber(refund.getTrackingNumber());
|
||||
update.setSpeedRefundFlag(refund.getSpeedRefundFlag());
|
||||
update.setSpeedRefundStatus(refund.getSpeedRefundStatus());
|
||||
update.setUpdatedTime(refund.getUpdatedTime());
|
||||
update.setUpdateTime(new Date());
|
||||
mapper.updateById(update);
|
||||
return ResultVo.error(ResultVoEnum.DataExist, "退款已经存在,更新成功");
|
||||
|
||||
}else{
|
||||
refund.setShopId(shopId);
|
||||
refund.setCreateTime(new Date());
|
||||
mapper.insert(refund);
|
||||
return ResultVo.success();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.qihang.pdd.mapper.OmsPddRefundMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.qihang.pdd.domain.OmsPddRefund">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="orderSn" column="order_sn" jdbcType="VARCHAR"/>
|
||||
<result property="afterSalesType" column="after_sales_type" jdbcType="INTEGER"/>
|
||||
<result property="afterSalesStatus" column="after_sales_status" jdbcType="INTEGER"/>
|
||||
<result property="afterSaleReason" column="after_sale_reason" jdbcType="VARCHAR"/>
|
||||
<result property="confirmTime" column="confirm_time" jdbcType="VARCHAR"/>
|
||||
<result property="createdTime" column="created_time" jdbcType="VARCHAR"/>
|
||||
<result property="discountAmount" column="discount_amount" jdbcType="DOUBLE"/>
|
||||
<result property="disputeRefundStatus" column="dispute_refund_status" jdbcType="DOUBLE"/>
|
||||
<result property="goodsImage" column="goods_image" jdbcType="VARCHAR"/>
|
||||
<result property="goodsId" column="goods_id" jdbcType="BIGINT"/>
|
||||
<result property="goodsName" column="goods_name" jdbcType="VARCHAR"/>
|
||||
<result property="goodsPrice" column="goods_price" jdbcType="DOUBLE"/>
|
||||
<result property="orderAmount" column="order_amount" jdbcType="DOUBLE"/>
|
||||
<result property="refundAmount" column="refund_amount" jdbcType="DOUBLE"/>
|
||||
<result property="refundOperatorRole" column="refund_operator_role" jdbcType="INTEGER"/>
|
||||
<result property="skuId" column="sku_id" jdbcType="BIGINT"/>
|
||||
<result property="outerGoodsId" column="outer_goods_id" jdbcType="VARCHAR"/>
|
||||
<result property="outerId" column="outer_id" jdbcType="VARCHAR"/>
|
||||
<result property="goodsSpec" column="goods_spec" jdbcType="VARCHAR"/>
|
||||
<result property="goodsNumber" column="goods_number" jdbcType="INTEGER"/>
|
||||
<result property="shippingName" column="shipping_name" jdbcType="VARCHAR"/>
|
||||
<result property="speedRefundFlag" column="speed_refund_flag" jdbcType="INTEGER"/>
|
||||
<result property="speedRefundStatus" column="speed_refund_status" jdbcType="INTEGER"/>
|
||||
<result property="userShippingStatus" column="user_shipping_status" jdbcType="INTEGER"/>
|
||||
<result property="trackingNumber" column="tracking_number" jdbcType="VARCHAR"/>
|
||||
<result property="updatedTime" column="updated_time" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,shop_id,order_sn,
|
||||
after_sales_type,after_sales_status,after_sale_reason,
|
||||
confirm_time,created_time,discount_amount,
|
||||
dispute_refund_status,goods_image,goods_id,
|
||||
goods_name,goods_price,order_amount,
|
||||
refund_amount,refund_operator_role,sku_id,
|
||||
outer_goods_id,outer_id,goods_spec,
|
||||
goods_number,shipping_name,speed_refund_flag,
|
||||
speed_refund_status,user_shipping_status,tracking_number,
|
||||
updated_time,create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询拼多多订单退款列表
|
||||
export function listOrderRefund(query) {
|
||||
return request({
|
||||
url: '/pdd/orderRefund/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询拼多多订单退款详细
|
||||
export function getOrderRefund(id) {
|
||||
return request({
|
||||
url: '/pdd/orderRefund/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增拼多多订单退款
|
||||
export function addOrderRefund(data) {
|
||||
return request({
|
||||
url: '/pdd/orderRefund',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改拼多多订单退款
|
||||
export function updateOrderRefund(data) {
|
||||
return request({
|
||||
url: '/pdd/orderRefund',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除拼多多订单退款
|
||||
export function delOrderRefund(id) {
|
||||
return request({
|
||||
url: '/pdd/orderRefund/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询拼多多订单退款列表
|
||||
export function listPddRefund(query) {
|
||||
return request({
|
||||
url: '/pdd/pddRefund/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询拼多多订单退款详细
|
||||
export function getPddRefund(id) {
|
||||
return request({
|
||||
url: '/pdd/pddRefund/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增拼多多订单退款
|
||||
export function addPddRefund(data) {
|
||||
return request({
|
||||
url: '/pdd/pddRefund',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改拼多多订单退款
|
||||
export function updatePddRefund(data) {
|
||||
return request({
|
||||
url: '/pdd/pddRefund',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除拼多多订单退款
|
||||
export function delPddRefund(id) {
|
||||
return request({
|
||||
url: '/pdd/pddRefund/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询退款列表
|
||||
export function listRefund(query) {
|
||||
return request({
|
||||
url: '/api/pdd-api/refund/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function pullRefund(data) {
|
||||
return request({
|
||||
url: '/api/pdd-api/refund/pull_list',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function pushOms(data) {
|
||||
return request({
|
||||
url: '/api/pdd-api/refund/push_oms',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
|
@ -1,544 +0,0 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="订单编号" prop="orderSn">
|
||||
<el-input
|
||||
v-model="queryParams.orderSn"
|
||||
placeholder="请输入订单编号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="店铺" prop="shopId">
|
||||
<el-select v-model="queryParams.shopId" placeholder="请选择店铺" clearable @change="handleQuery">
|
||||
<el-option
|
||||
v-for="item in shopList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="售后原因" prop="afterSaleReason">
|
||||
<el-input
|
||||
v-model="queryParams.afterSaleReason"
|
||||
placeholder="请输入售后原因"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="拼多多商品id" prop="goodsId">
|
||||
<el-input
|
||||
v-model="queryParams.goodsId"
|
||||
placeholder="请输入拼多多商品id"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="商品编码" prop="goodsNumber">
|
||||
<el-input
|
||||
v-model="queryParams.goodsNumber"
|
||||
placeholder="请输入商品编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="快递单号" prop="trackingNumber">
|
||||
<el-input
|
||||
v-model="queryParams.trackingNumber"
|
||||
placeholder="请输入快递单号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['pdd:pddRefund:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['pdd:pddRefund:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['pdd:pddRefund:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['pdd:pddRefund:export']"
|
||||
>导出</el-button>
|
||||
</el-col> -->
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="pddRefundList" @selection-change="handleSelectionChange">
|
||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||
<el-table-column label="售后编号" align="center" prop="id" />
|
||||
<el-table-column label="订单编号" align="center" prop="orderSn" />
|
||||
<el-table-column label="店铺" align="center" prop="shopId" >
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.shopId==5">梦小妮潮流女装</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="售后类型" align="center" prop="afterSalesType" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small" v-if="scope.row.afterSalesType === 2"> 仅退款</el-tag>
|
||||
<el-tag size="small" v-if="scope.row.afterSalesType === 3"> 退货退款</el-tag>
|
||||
<el-tag size="small" v-if="scope.row.afterSalesType === 4"> 换货</el-tag>
|
||||
<el-tag size="small" v-if="scope.row.afterSalesType === 5"> 缺货补寄</el-tag>
|
||||
<el-tag size="small" v-if="scope.row.afterSalesType === 9"> 拦截退货</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="售后状态" align="center" prop="afterSalesStatus" /> -->
|
||||
<!-- 1:全部 2:买家申请退款,待商家处理 3:退货退款,待商家处理 4:商家同意退款,退款中 5:平台同意退款,退款中 6:驳回退款, 待买家处理 7:已同意退货退款,待用户发货 8:平台处理中 9:平台拒 绝退款,退款关闭 10:退款成功 11:买家撤销 12:买家逾期未处 理,退款失败 13:买家逾期,超过有效期 14 : 换货补寄待商家处理 15:换货补寄待用户处理 16:换货补寄成功 17:换货补寄失败 18:换货补寄待用户确认完成 31:商家同意拒收退款,待用户拒收;32: 待商家补寄发货 -->
|
||||
<el-table-column label="售后原因" align="center" prop="afterSaleReason" />
|
||||
<!-- <el-table-column label="订单成团时间" align="center" prop="confirmTime" /> -->
|
||||
<el-table-column label="创建时间" align="center" prop="createdTime" >
|
||||
<template slot-scope="scope">
|
||||
{{dateToString(scope.row.createdTime)}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="订单折扣金额" align="center" prop="discountAmount" /> -->
|
||||
<el-table-column label="订单金额" align="center" prop="orderAmount" />
|
||||
<el-table-column label="退款金额" align="center" prop="refundAmount" />
|
||||
<el-table-column label="商品图片" align="center" prop="goodsImage" width="100">
|
||||
<template slot-scope="scope">
|
||||
<image-preview :src="scope.row.goodsImage" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="拼多多商品id" align="center" prop="goodsId" /> -->
|
||||
<!-- <el-table-column label="拼多多商品skuid" align="center" prop="skuId" /> -->
|
||||
<el-table-column label="商品名称" align="center" prop="goodsName" />
|
||||
<!-- <el-table-column label="商品编码" align="center" prop="goodsNumber" /> -->
|
||||
<!-- <el-table-column label="商品编码" align="center" prop="skuNumber" /> -->
|
||||
<el-table-column label="商品规格" align="center" prop="skuInfo" />
|
||||
<el-table-column label="数量" align="center" prop="quantity" />
|
||||
<!-- <el-table-column label="商品价格,单位:元" align="center" prop="goodsPrice" /> -->
|
||||
<!-- <el-table-column label="更新时间" align="center" prop="updatedTime" /> -->
|
||||
<el-table-column label="快递单号" align="center" prop="trackingNumber" />
|
||||
<!-- <el-table-column label="快递公司" align="center" prop="trackingCompany" /> -->
|
||||
<el-table-column label="审核状态" align="center" prop="auditStatus" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small" v-if="scope.row.auditStatus === 0"> 未处理</el-tag>
|
||||
<el-tag size="small" v-if="scope.row.auditStatus === 2"> 已签收</el-tag>
|
||||
<el-tag size="small" v-if="scope.row.auditStatus === 9"> 供应商已退款</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="订单发货状态" align="center" prop="shippingStatus" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small" v-if="scope.row.shippingStatus === 0"> 未发货</el-tag>
|
||||
<el-tag size="small" v-if="scope.row.shippingStatus === 1"> 已发货</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="0-未勾选 1-消费者选择的收货状态为未收到货 2-消费者选择的收货状态为已收到货" align="center" prop="userShippingStatus" /> -->
|
||||
<!-- <el-table-column label="审核时间" align="center" prop="auditTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.auditTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="备注" align="center" prop="describe" />
|
||||
<el-table-column label="退货说明" align="center" prop="remark" />
|
||||
|
||||
<!-- <el-table-column label="erp退货单号" align="center" prop="erpOrderReturnNum" /> -->
|
||||
<!-- <el-table-column label="erp退货单id" align="center" prop="erpOrderReturnId" /> -->
|
||||
<el-table-column label="标记" align="center" prop="sign" />
|
||||
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['pdd:pddRefund:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['pdd:pddRefund:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改拼多多订单退款对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="订单编号" prop="orderSn">
|
||||
<el-input v-model="form.orderSn" placeholder="请输入订单编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="内部店铺ID" prop="shopId">
|
||||
<el-input v-model="form.shopId" placeholder="请输入内部店铺ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="售后原因" prop="afterSaleReason">
|
||||
<el-input v-model="form.afterSaleReason" placeholder="请输入售后原因" />
|
||||
</el-form-item>
|
||||
<el-form-item label="订单成团时间" prop="confirmTime">
|
||||
<el-input v-model="form.confirmTime" placeholder="请输入订单成团时间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="时间" prop="createdTime">
|
||||
<el-input v-model="form.createdTime" placeholder="请输入时间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="订单折扣金额" prop="discountAmount">
|
||||
<el-input v-model="form.discountAmount" placeholder="请输入订单折扣金额" />
|
||||
</el-form-item>
|
||||
<el-form-item label="订单金额" prop="orderAmount">
|
||||
<el-input v-model="form.orderAmount" placeholder="请输入订单金额" />
|
||||
</el-form-item>
|
||||
<el-form-item label="退款金额" prop="refundAmount">
|
||||
<el-input v-model="form.refundAmount" placeholder="请输入退款金额" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品图片" prop="goodsImage">
|
||||
<image-upload v-model="form.goodsImage"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="拼多多商品id" prop="goodsId">
|
||||
<el-input v-model="form.goodsId" placeholder="请输入拼多多商品id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="拼多多商品skuid" prop="skuId">
|
||||
<el-input v-model="form.skuId" placeholder="请输入拼多多商品skuid" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品名称" prop="goodsName">
|
||||
<el-input v-model="form.goodsName" placeholder="请输入商品名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品编码" prop="goodsNumber">
|
||||
<el-input v-model="form.goodsNumber" placeholder="请输入商品编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品编码" prop="skuNumber">
|
||||
<el-input v-model="form.skuNumber" placeholder="请输入商品编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品规格" prop="skuInfo">
|
||||
<el-input v-model="form.skuInfo" placeholder="请输入商品规格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="quantity">
|
||||
<el-input v-model="form.quantity" placeholder="请输入数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品价格,单位:元" prop="goodsPrice">
|
||||
<el-input v-model="form.goodsPrice" placeholder="请输入商品价格,单位:元" />
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updatedTime">
|
||||
<el-input v-model="form.updatedTime" placeholder="请输入更新时间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="快递单号" prop="trackingNumber">
|
||||
<el-input v-model="form.trackingNumber" placeholder="请输入快递单号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="快递公司" prop="trackingCompany">
|
||||
<el-input v-model="form.trackingCompany" placeholder="请输入快递公司" />
|
||||
</el-form-item>
|
||||
<el-form-item label="审核时间" prop="auditTime">
|
||||
<el-date-picker clearable
|
||||
v-model="form.auditTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择审核时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="describe">
|
||||
<el-input v-model="form.describe" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<el-form-item label="退货说明" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入退货说明" />
|
||||
</el-form-item>
|
||||
<el-form-item label="erp退货单号" prop="erpOrderReturnNum">
|
||||
<el-input v-model="form.erpOrderReturnNum" placeholder="请输入erp退货单号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="erp退货单id" prop="erpOrderReturnId">
|
||||
<el-input v-model="form.erpOrderReturnId" placeholder="请输入erp退货单id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="标记" prop="sign">
|
||||
<el-input v-model="form.sign" placeholder="请输入标记" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listPddRefund, getPddRefund, delPddRefund, addPddRefund, updatePddRefund } from "@/api/pdd/pddRefund";
|
||||
import { listShop } from "@/api/shop/shop";
|
||||
export default {
|
||||
name: "PddRefund",
|
||||
data() {
|
||||
return {
|
||||
shopList:[],
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 拼多多订单退款表格数据
|
||||
pddRefundList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
orderSn: null,
|
||||
shopId: null,
|
||||
afterSalesType: null,
|
||||
afterSalesStatus: null,
|
||||
afterSaleReason: null,
|
||||
confirmTime: null,
|
||||
createdTime: null,
|
||||
discountAmount: null,
|
||||
orderAmount: null,
|
||||
refundAmount: null,
|
||||
goodsImage: null,
|
||||
goodsId: null,
|
||||
skuId: null,
|
||||
goodsName: null,
|
||||
goodsNumber: null,
|
||||
skuNumber: null,
|
||||
skuInfo: null,
|
||||
quantity: null,
|
||||
goodsPrice: null,
|
||||
updatedTime: null,
|
||||
trackingNumber: null,
|
||||
trackingCompany: null,
|
||||
auditStatus: null,
|
||||
auditTime: null,
|
||||
describe: null,
|
||||
shippingStatus: null,
|
||||
userShippingStatus: null,
|
||||
erpOrderReturnNum: null,
|
||||
erpOrderReturnId: null,
|
||||
sign: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
orderSn: [
|
||||
{ required: true, message: "订单编号不能为空", trigger: "blur" }
|
||||
],
|
||||
shopId: [
|
||||
{ required: true, message: "内部店铺ID不能为空", trigger: "blur" }
|
||||
],
|
||||
afterSalesType: [
|
||||
{ required: true, message: "必填,售后类型2:仅退款 3:退货退款 4:换货 5:缺货补寄 9:拦截退货不能为空", trigger: "change" }
|
||||
],
|
||||
afterSalesStatus: [
|
||||
{ required: true, message: "必填,售后状态 1:全部 2:买家申请退款,待商家处理 3:退货退款,待商家处理 4:商家同意退款,退款中 5:平台同意退款,退款中 6:驳回退款, 待买家处理 7:已同意退货退款,待用户发货 8:平台处理中 9:平台拒 绝退款,退款关闭 10:退款成功 11:买家撤销 12:买家逾期未处 理,退款失败 13:买家逾期,超过有效期 14 : 换货补寄待商家处理 15:换货补寄待用户处理 16:换货补寄成功 17:换货补寄失败 18:换货补寄待用户确认完成 31:商家同意拒收退款,待用户拒收;32: 待商家补寄发货不能为空", trigger: "change" }
|
||||
],
|
||||
afterSaleReason: [
|
||||
{ required: true, message: "售后原因不能为空", trigger: "blur" }
|
||||
],
|
||||
confirmTime: [
|
||||
{ required: true, message: "订单成团时间不能为空", trigger: "blur" }
|
||||
],
|
||||
createdTime: [
|
||||
{ required: true, message: "时间不能为空", trigger: "blur" }
|
||||
],
|
||||
discountAmount: [
|
||||
{ required: true, message: "订单折扣金额不能为空", trigger: "blur" }
|
||||
],
|
||||
orderAmount: [
|
||||
{ required: true, message: "订单金额不能为空", trigger: "blur" }
|
||||
],
|
||||
refundAmount: [
|
||||
{ required: true, message: "退款金额不能为空", trigger: "blur" }
|
||||
],
|
||||
quantity: [
|
||||
{ required: true, message: "数量不能为空", trigger: "blur" }
|
||||
],
|
||||
goodsPrice: [
|
||||
{ required: true, message: "商品价格,单位:元不能为空", trigger: "blur" }
|
||||
],
|
||||
auditStatus: [
|
||||
{ required: true, message: "审核状态2已签收9供应商已退款不能为空", trigger: "change" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
listShop({platform:5}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
});
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
dateToString(timespan){
|
||||
var date = new Date(timespan * 1000);
|
||||
return date.toLocaleString();
|
||||
},
|
||||
/** 查询拼多多订单退款列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listPddRefund(this.queryParams).then(response => {
|
||||
this.pddRefundList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
orderSn: null,
|
||||
shopId: null,
|
||||
afterSalesType: null,
|
||||
afterSalesStatus: null,
|
||||
afterSaleReason: null,
|
||||
confirmTime: null,
|
||||
createdTime: null,
|
||||
discountAmount: null,
|
||||
orderAmount: null,
|
||||
refundAmount: null,
|
||||
goodsImage: null,
|
||||
goodsId: null,
|
||||
skuId: null,
|
||||
goodsName: null,
|
||||
goodsNumber: null,
|
||||
skuNumber: null,
|
||||
skuInfo: null,
|
||||
quantity: null,
|
||||
goodsPrice: null,
|
||||
updatedTime: null,
|
||||
trackingNumber: null,
|
||||
trackingCompany: null,
|
||||
auditStatus: null,
|
||||
auditTime: null,
|
||||
describe: null,
|
||||
remark: null,
|
||||
shippingStatus: null,
|
||||
userShippingStatus: null,
|
||||
erpOrderReturnNum: null,
|
||||
erpOrderReturnId: null,
|
||||
sign: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加拼多多订单退款";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getPddRefund(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改拼多多订单退款";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updatePddRefund(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addPddRefund(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除拼多多订单退款编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delPddRefund(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('pdd/pddRefund/export', {
|
||||
...this.queryParams
|
||||
}, `pddRefund_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
import TaoRefund from "@/views/shop/tao/refund/index";
|
||||
import JdRefund from "@/views/shop/jd/refund/index";
|
||||
import DouRefund from "@/views/dou/refund/index.vue";
|
||||
import PddRefund from "@/views/pdd/refund/index.vue";
|
||||
import PddRefund from "@/views/shop/pdd/refund/index.vue";
|
||||
|
||||
export default {
|
||||
name: "refund",
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
import TaoRefund from "@/views/shop/tao/refund/index";
|
||||
import JdRefund from "@/views/shop/jd/refund/index";
|
||||
import DouRefund from "@/views/dou/refund/index.vue";
|
||||
import PddRefund from "@/views/pdd/refund/index.vue";
|
||||
import PddRefund from "@/views/shop/pdd/refund/index.vue";
|
||||
|
||||
export default {
|
||||
name: "refund",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,289 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="店铺" prop="shopId">
|
||||
<el-select v-model="queryParams.shopId" placeholder="请选择店铺" clearable @change="handleQuery">
|
||||
<el-option
|
||||
v-for="item in shopList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="退款ID" prop="refundId">
|
||||
<el-input
|
||||
v-model="queryParams.refundId"
|
||||
placeholder="请输入退款ID"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单号" prop="orderSn">
|
||||
<el-input
|
||||
v-model="queryParams.orderSn"
|
||||
placeholder="请输入订单号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="afterSalesType">
|
||||
<el-select v-model="queryParams.afterSalesType" placeholder="请选择类型" clearable @change="handleQuery">
|
||||
|
||||
<el-option label="仅退款" value="2" ></el-option>
|
||||
<el-option label="退货退款" value="3"></el-option>
|
||||
<el-option label="换货" value="4"> </el-option>
|
||||
<el-option label="维修" value="6"> </el-option>
|
||||
<el-option label="缺货补寄" value="5"> </el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
:loading="pullLoading"
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handlePull"
|
||||
>API拉取新退款</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-refresh"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handlePushOms"
|
||||
>手动推送售后</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="taoRefundList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="${comment}" align="center" prop="id" /> -->
|
||||
<el-table-column label="退款ID" align="center" prop="id" />
|
||||
<el-table-column label="类型" align="center" prop="afterSalesType" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small" v-if="scope.row.afterSalesType === 2"> 仅退款</el-tag>
|
||||
<el-tag size="small" v-if="scope.row.afterSalesType === 3"> 退货退款</el-tag>
|
||||
<el-tag size="small" v-if="scope.row.afterSalesType === 4"> 换货</el-tag>
|
||||
<el-tag size="small" v-if="scope.row.afterSalesType === 6"> 维修</el-tag>
|
||||
<el-tag size="small" v-if="scope.row.afterSalesType === 5"> 缺货补寄</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="店铺" align="center" prop="shopId" >
|
||||
<template slot-scope="scope">
|
||||
<!-- <el-tag size="small"></el-tag>-->
|
||||
{{shopList.find(x=>x.id === scope.row.shopId).name}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="订单号" align="center" prop="orderSn" />
|
||||
<el-table-column label="商品" prop="wareName" ></el-table-column>
|
||||
<el-table-column label="退款金额" prop="refundAmount" ></el-table-column>
|
||||
<el-table-column label="订单金额" prop="orderAmount" ></el-table-column>
|
||||
|
||||
<el-table-column label="售后原因" prop="afterSaleReason" ></el-table-column>
|
||||
|
||||
|
||||
<el-table-column label="状态" align="center" prop="afterSalesStatus" >
|
||||
<template slot-scope="scope">
|
||||
<!-- 2:买家申请退款,待商家处理 3:退货退款,待商家处理 4:商家同意退款,退款中 5:平台同意退款,退款中 6:驳回退款,待买家处理 7:已同意退货退款,待用户发货 8:平台处理中 9:平台拒绝退款,退款关闭 10:退款成功 11:买家撤销 12:买家逾期未处理,退款失败 13:买家逾期,超过有效期 14:换货补寄待商家处理 15:换货补寄待用户处理 16:换货补寄成功 17:换货补寄失败 18:换货补寄待用户确认完成 21:待商家同意维修 22:待用户确认发货 24:维修关闭 25:维修成功 27:待用户确认收货 31:已同意拒收退款,待用户拒收 32:补寄待商家发货 33:待商家召回-->
|
||||
<el-tag size="small" > {{ scope.row.afterSalesStatus }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="申请时间" align="center" prop="createdTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createdTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <el-button-->
|
||||
<!-- v-if="scope.row.auditStatus === 0 && scope.row.afterSalesType === 1 "-->
|
||||
<!-- size="mini"-->
|
||||
<!-- type="text"-->
|
||||
<!-- icon="el-icon-edit"-->
|
||||
<!-- @click="handleConfirm(scope.row)"-->
|
||||
<!-- v-hasPermi="['tao:taoRefund:edit']"-->
|
||||
<!-- >退货确认</el-button>-->
|
||||
<!-- <!– <el-button-->
|
||||
<!-- size="mini"-->
|
||||
<!-- type="text"-->
|
||||
<!-- icon="el-icon-delete"-->
|
||||
<!-- @click="handleDelete(scope.row)"-->
|
||||
<!-- v-hasPermi="['tao:taoRefund:remove']"-->
|
||||
<!-- >删除</el-button> –>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listRefund,pullRefund,pushOms } from "@/api/pdd/refund";
|
||||
import { listShop } from "@/api/shop/shop";
|
||||
import {MessageBox} from "element-ui";
|
||||
import {isRelogin} from "@/utils/request";
|
||||
export default {
|
||||
name: "RefundPdd",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
pullLoading: false,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 淘宝退款订单表格数据
|
||||
taoRefundList: [],
|
||||
shopList:[],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
refundId: null,
|
||||
afterSalesType: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
num: [
|
||||
{ required: true, message: "退货数量不能为空", trigger: "blur" }
|
||||
],
|
||||
logisticsCompany: [
|
||||
{ required: true, message: "不能为空", trigger: "change" }
|
||||
],
|
||||
logisticsCode: [
|
||||
{ required: true, message: "不能为空", trigger: "blur" }
|
||||
],
|
||||
sendTime: [
|
||||
{ required: true, message: "不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
listShop({platform: 5}).then(response => {
|
||||
this.shopList = response.rows;
|
||||
if (this.shopList && this.shopList.length > 0) {
|
||||
this.queryParams.shopId = this.shopList[0].id
|
||||
}
|
||||
this.getList();
|
||||
});
|
||||
// this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询退款列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listRefund(this.queryParams).then(response => {
|
||||
this.taoRefundList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
refundId: null,
|
||||
afterSalesType: null,
|
||||
tid: null,
|
||||
oid: null,
|
||||
refundPhase: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
handlePushOms(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否手动推送到OMS?').then(function() {
|
||||
return pushOms({ids:ids});
|
||||
}).then(() => {
|
||||
// this.getList();
|
||||
this.$modal.msgSuccess("推送成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
handlePull() {
|
||||
if(this.queryParams.shopId){
|
||||
this.pullLoading = true
|
||||
pullRefund({shopId:this.queryParams.shopId,updType:0}).then(response => {
|
||||
console.log('拉取淘宝订单接口返回=====',response)
|
||||
if(response.code === 1401) {
|
||||
MessageBox.confirm('Token已过期,需要重新授权!请前往店铺列表重新获取授权!', '系统提示', { confirmButtonText: '前往授权', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
||||
this.$router.push({path:"/shop/shop_list",query:{type:4}})
|
||||
// isRelogin.show = false;
|
||||
// store.dispatch('LogOut').then(() => {
|
||||
// location.href = response.data.tokenRequestUrl+'?shopId='+this.queryParams.shopId
|
||||
// })
|
||||
}).catch(() => {
|
||||
isRelogin.show = false;
|
||||
});
|
||||
|
||||
// return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
||||
}else{
|
||||
this.$modal.msgSuccess(JSON.stringify(response));
|
||||
this.getList()
|
||||
}
|
||||
this.pullLoading = false
|
||||
})
|
||||
}else{
|
||||
this.$modal.msgSuccess("请先选择店铺");
|
||||
}
|
||||
|
||||
// this.$modal.msgSuccess("请先配置API");
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -28,7 +28,7 @@ import TaoRefund from "@/views/shop/tao/refund/index";
|
|||
import RefundJd from "@/views/shop/jd/refund/index";
|
||||
import RefundWei from "@/views/shop/wei/refund/index";
|
||||
import DouRefund from "@/views/dou/refund/index.vue";
|
||||
import PddRefund from "@/views/pdd/refund/index.vue";
|
||||
import PddRefund from "@/views/shop/pdd/refund/index.vue";
|
||||
|
||||
export default {
|
||||
name: "refund",
|
||||
|
|
|
|||
Loading…
Reference in New Issue