Compare commits
2 Commits
test
...
lmh-20261120
| Author | SHA1 | Date | |
|---|---|---|---|
| 817545059e | |||
| 5c2d4a23c2 |
+4
-2
@@ -46,9 +46,11 @@ public class PayPostcodeController extends BaseController
|
|||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('data:payPostcode:query')")
|
@PreAuthorize("@ss.hasPermi('data:payPostcode:query')")
|
||||||
@GetMapping("/zones")
|
@GetMapping("/zones")
|
||||||
public AjaxResult zones(PayPostcodeGroup query)
|
public TableDataInfo zones(PayPostcodeGroup query)
|
||||||
{
|
{
|
||||||
return success(payPostcodeService.selectZoneList(query));
|
startPage();
|
||||||
|
List<PayPostcodeGroup> list = payPostcodeService.selectZoneList(query);
|
||||||
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('data:payPostcode:edit')")
|
@PreAuthorize("@ss.hasPermi('data:payPostcode:edit')")
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import com.bms.common.core.controller.BaseController;
|
import com.bms.common.core.controller.BaseController;
|
||||||
import com.bms.common.core.domain.AjaxResult;
|
import com.bms.common.core.domain.AjaxResult;
|
||||||
import com.bms.common.core.page.TableDataInfo;
|
import com.bms.common.core.page.TableDataInfo;
|
||||||
|
import com.bms.price.domain.PayOrderFeeBatch;
|
||||||
import com.bms.price.domain.PayOrderFeeLine;
|
import com.bms.price.domain.PayOrderFeeLine;
|
||||||
import com.bms.price.domain.PayOrderQuery;
|
import com.bms.price.domain.PayOrderQuery;
|
||||||
import com.bms.price.domain.PayOrderRecalcCommand;
|
import com.bms.price.domain.PayOrderRecalcCommand;
|
||||||
@@ -112,6 +113,19 @@ public class PayOrderController extends BaseController
|
|||||||
return success(payOrderListService.fees(billId));
|
return success(payOrderListService.fees(billId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给勾选订单批量增加手工费用。创建人取当前登录用户,来源为手工,并记新增日志。
|
||||||
|
*
|
||||||
|
* @param batch 订单和费用行
|
||||||
|
* @return 写入的费用条数
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('price:payOrder:feeBatch')")
|
||||||
|
@PostMapping("/fees/batch")
|
||||||
|
public AjaxResult addFees(@RequestBody PayOrderFeeBatch batch)
|
||||||
|
{
|
||||||
|
return success(payOrderListService.addManualFees(batch));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 在某一段手工增加一行应付费用。创建人取当前登录用户。
|
* 在某一段手工增加一行应付费用。创建人取当前登录用户。
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.bms.price.domain;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** 应付列表勾选订单后,批量写入同一组手工费用。 */
|
||||||
|
@Data
|
||||||
|
public class PayOrderFeeBatch
|
||||||
|
{
|
||||||
|
/** 勾选的计费订单 ID */
|
||||||
|
private List<String> billIds;
|
||||||
|
|
||||||
|
/** 要加到每一票订单上的费用 */
|
||||||
|
private List<PayOrderFeeLine> fees;
|
||||||
|
}
|
||||||
@@ -17,6 +17,9 @@ public class PayOrderRow
|
|||||||
|
|
||||||
private String trackingNo;
|
private String trackingNo;
|
||||||
|
|
||||||
|
/** 客户编码,列表展示用 */
|
||||||
|
private String customerCode;
|
||||||
|
|
||||||
private String customerName;
|
private String customerName;
|
||||||
|
|
||||||
private String productName;
|
private String productName;
|
||||||
|
|||||||
@@ -24,9 +24,21 @@ public class PrcPayBill implements Serializable
|
|||||||
private BigDecimal redlineAmount;
|
private BigDecimal redlineAmount;
|
||||||
/** 成本价合计(当前计费结果) */
|
/** 成本价合计(当前计费结果) */
|
||||||
private BigDecimal costAmount;
|
private BigDecimal costAmount;
|
||||||
/** 应付合计(当前等于成本价,落库后按全部未删除明细重算) */
|
/** 应付合计(当前等于成本价,落库后按全部未删除明细折人民币重算) */
|
||||||
private BigDecimal payTotal;
|
private BigDecimal payTotal;
|
||||||
|
|
||||||
|
/** A段合计,人民币 */
|
||||||
|
private BigDecimal amountA;
|
||||||
|
|
||||||
|
/** B段合计,人民币 */
|
||||||
|
private BigDecimal amountB;
|
||||||
|
|
||||||
|
/** C段合计,人民币 */
|
||||||
|
private BigDecimal amountC;
|
||||||
|
|
||||||
|
/** D段合计,人民币 */
|
||||||
|
private BigDecimal amountD;
|
||||||
|
|
||||||
/** 应付计费状态,字典 bms_pay_calc_status:1计费成功,2计费失败 */
|
/** 应付计费状态,字典 bms_pay_calc_status:1计费成功,2计费失败 */
|
||||||
private Integer payCalcStatus;
|
private Integer payCalcStatus;
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,18 @@ public class TmsPriceQuoteResult implements Serializable
|
|||||||
private BigDecimal incomeTotal;
|
private BigDecimal incomeTotal;
|
||||||
/** 应付合计(订单账单);也是报价应付 */
|
/** 应付合计(订单账单);也是报价应付 */
|
||||||
private BigDecimal payTotal;
|
private BigDecimal payTotal;
|
||||||
|
|
||||||
|
/** 应付 A 段合计,来自 prc_pay_bill.amount_a */
|
||||||
|
private BigDecimal amountA;
|
||||||
|
|
||||||
|
/** 应付 B 段合计,来自 prc_pay_bill.amount_b */
|
||||||
|
private BigDecimal amountB;
|
||||||
|
|
||||||
|
/** 应付 C 段合计,来自 prc_pay_bill.amount_c */
|
||||||
|
private BigDecimal amountC;
|
||||||
|
|
||||||
|
/** 应付 D 段合计,来自 prc_pay_bill.amount_d */
|
||||||
|
private BigDecimal amountD;
|
||||||
/** 报价 / 历史字段;账单同步时与 incomeTotal 相同 */
|
/** 报价 / 历史字段;账单同步时与 incomeTotal 相同 */
|
||||||
private BigDecimal payableTotal;
|
private BigDecimal payableTotal;
|
||||||
private String currency = "CNY";
|
private String currency = "CNY";
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ public interface PayPostcodeMapper
|
|||||||
|
|
||||||
List<PayPostcodeGroup> selectCountryList(PayPostcodeGroup query);
|
List<PayPostcodeGroup> selectCountryList(PayPostcodeGroup query);
|
||||||
|
|
||||||
|
/** 当前页国家的分区数和邮编数。 */
|
||||||
|
List<PayPostcodeGroup> selectCountryZoneStats(PayPostcodeGroup query);
|
||||||
|
|
||||||
List<PayPostcodeGroup> selectZoneList(PayPostcodeGroup query);
|
List<PayPostcodeGroup> selectZoneList(PayPostcodeGroup query);
|
||||||
|
|
||||||
PayPostcodeGroup selectSampleGroup(PayPostcodeGroup query);
|
PayPostcodeGroup selectSampleGroup(PayPostcodeGroup query);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.bms.price.mapper;
|
package com.bms.price.mapper;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import com.bms.price.domain.PrcPayBill;
|
import com.bms.price.domain.PrcPayBill;
|
||||||
@@ -64,8 +63,8 @@ public interface PrcPayBillMapper
|
|||||||
*/
|
*/
|
||||||
int refreshPayTotal(@Param("billIds") List<Long> billIds);
|
int refreshPayTotal(@Param("billIds") List<Long> billIds);
|
||||||
|
|
||||||
/** 把折成人民币后的应付汇总写到主表,明细金额和币种不动。 */
|
/** 把折成人民币后的应付总额和 ABCD 段合计写到主表,明细金额和币种不动。 */
|
||||||
int updateCnyPayTotal(@Param("billId") Long billId, @Param("payTotal") BigDecimal payTotal);
|
int updateCnyPayTotal(PrcPayBill row);
|
||||||
|
|
||||||
/** 订单还没有应付主表时补一行,总额随后按明细重算。单次不超过 1000 个订单。 */
|
/** 订单还没有应付主表时补一行,总额随后按明细重算。单次不超过 1000 个订单。 */
|
||||||
int insertMissingPayBills(@Param("billIds") List<Long> billIds, @Param("operator") String operator);
|
int insertMissingPayBills(@Param("billIds") List<Long> billIds, @Param("operator") String operator);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.bms.price.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.bms.price.domain.PayOrderCostResult;
|
import com.bms.price.domain.PayOrderCostResult;
|
||||||
|
import com.bms.price.domain.PayOrderFeeBatch;
|
||||||
import com.bms.price.domain.PayOrderFeeBoard;
|
import com.bms.price.domain.PayOrderFeeBoard;
|
||||||
import com.bms.price.domain.PayOrderFeeLine;
|
import com.bms.price.domain.PayOrderFeeLine;
|
||||||
import com.bms.price.domain.PayOrderQuery;
|
import com.bms.price.domain.PayOrderQuery;
|
||||||
@@ -26,6 +27,14 @@ public interface IPayOrderListService
|
|||||||
*/
|
*/
|
||||||
PayOrderFeeLine addManualFee(String billId, PayOrderFeeLine line);
|
PayOrderFeeLine addManualFee(String billId, PayOrderFeeLine line);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给勾选的订单批量增加同一组手工费用。来源记 MANUAL,创建人是当前登录用户,并记新增日志。
|
||||||
|
*
|
||||||
|
* @param batch 订单和费用行
|
||||||
|
* @return 写入的费用条数
|
||||||
|
*/
|
||||||
|
int addManualFees(PayOrderFeeBatch batch);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 逻辑删除一条应付费用。已经进入应付账单的费用不能删。
|
* 逻辑删除一条应付费用。已经进入应付账单的费用不能删。
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public interface IPrcPayBillFeeService
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 分批写入应付明细,并回写这些订单的应付总额。
|
* 分批写入应付明细,并回写这些订单的应付总额。
|
||||||
* 明细每批最多 1000 条,金额和币种按原样写入 prc_pay_bill_fee。汇总时外币按汇率折成人民币,只回写 prc_pay_bill.pay_total。
|
* 明细每批最多 1000 条,金额和币种按原样写入 prc_pay_bill_fee。汇总时外币按汇率折成人民币,ABCD 段分别四舍五入到两位后写入 prc_pay_bill,应付总额取这四段之和。
|
||||||
*
|
*
|
||||||
* @param fees 本次新增的应付明细
|
* @param fees 本次新增的应付明细
|
||||||
*/
|
*/
|
||||||
|
|||||||
+1
@@ -698,6 +698,7 @@ public class PayOrderCostServiceImpl implements IPayOrderCostService
|
|||||||
scId = fallback++;
|
scId = fallback++;
|
||||||
}
|
}
|
||||||
row.setScId(scId);
|
row.setScId(scId);
|
||||||
|
row.setFeeLevel("4");
|
||||||
String userId = PayFeeMoney.userId();
|
String userId = PayFeeMoney.userId();
|
||||||
row.setAmount(fee.getAmount());
|
row.setAmount(fee.getAmount());
|
||||||
row.setCurrency(fee.getCurrency());
|
row.setCurrency(fee.getCurrency());
|
||||||
|
|||||||
+172
-59
@@ -10,6 +10,7 @@ import java.util.List;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
@@ -23,6 +24,7 @@ import com.bms.common.utils.uuid.IdUtils;
|
|||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.bms.price.domain.PayOrderCostResult;
|
import com.bms.price.domain.PayOrderCostResult;
|
||||||
|
import com.bms.price.domain.PayOrderFeeBatch;
|
||||||
import com.bms.price.domain.PayOrderFeeBoard;
|
import com.bms.price.domain.PayOrderFeeBoard;
|
||||||
import com.bms.price.domain.PrcPayBill;
|
import com.bms.price.domain.PrcPayBill;
|
||||||
import com.bms.price.domain.PayOrderFeeLine;
|
import com.bms.price.domain.PayOrderFeeLine;
|
||||||
@@ -51,6 +53,10 @@ public class PayOrderListServiceImpl implements IPayOrderListService
|
|||||||
|
|
||||||
private static final int MAX_LADING_NOS = 10;
|
private static final int MAX_LADING_NOS = 10;
|
||||||
|
|
||||||
|
private static final int MAX_BATCH_LINES = 20;
|
||||||
|
|
||||||
|
private static final AtomicLong MANUAL_SC_SEQ = new AtomicLong();
|
||||||
|
|
||||||
private static final Map<String, String> TITLES = new LinkedHashMap<>();
|
private static final Map<String, String> TITLES = new LinkedHashMap<>();
|
||||||
|
|
||||||
static
|
static
|
||||||
@@ -434,67 +440,12 @@ public class PayOrderListServiceImpl implements IPayOrderListService
|
|||||||
public PayOrderFeeLine addManualFee(String billId, PayOrderFeeLine line)
|
public PayOrderFeeLine addManualFee(String billId, PayOrderFeeLine line)
|
||||||
{
|
{
|
||||||
PayOrderRow order = requireOrder(billId);
|
PayOrderRow order = requireOrder(billId);
|
||||||
if (line == null)
|
PayOrderFeeLine ready = checkedLine(line);
|
||||||
{
|
|
||||||
throw new ServiceException("请填写费用");
|
|
||||||
}
|
|
||||||
String level = line.getLevel() == null ? "" : line.getLevel().trim();
|
|
||||||
if (!TITLES.containsKey(level))
|
|
||||||
{
|
|
||||||
throw new ServiceException("请选择费用阶段");
|
|
||||||
}
|
|
||||||
String feeName = firstText(line.getFeeName(), line.getFeeType());
|
|
||||||
if (feeName.isEmpty())
|
|
||||||
{
|
|
||||||
throw new ServiceException("请填写费用项");
|
|
||||||
}
|
|
||||||
if (feeName.length() > 100)
|
|
||||||
{
|
|
||||||
feeName = feeName.substring(0, 100);
|
|
||||||
}
|
|
||||||
String feeType = firstText(line.getFeeType(), "MANUAL");
|
|
||||||
if (feeType.length() > 30)
|
|
||||||
{
|
|
||||||
feeType = "MANUAL";
|
|
||||||
}
|
|
||||||
if (line.getAmount() == null)
|
|
||||||
{
|
|
||||||
throw new ServiceException("请填写金额");
|
|
||||||
}
|
|
||||||
String currency = firstText(line.getCurrency(), "CNY").toUpperCase();
|
|
||||||
if (currency.length() > 10)
|
|
||||||
{
|
|
||||||
throw new ServiceException("币种过长");
|
|
||||||
}
|
|
||||||
BigDecimal amount = line.getAmount().setScale(2, RoundingMode.HALF_UP);
|
|
||||||
if (amount.abs().compareTo(new BigDecimal("9999999999.99")) > 0)
|
|
||||||
{
|
|
||||||
throw new ServiceException("金额超出范围");
|
|
||||||
}
|
|
||||||
String remark = line.getRemark() == null ? null : line.getRemark().trim();
|
|
||||||
if (remark != null && remark.length() > 200)
|
|
||||||
{
|
|
||||||
throw new ServiceException("说明不能超过200字");
|
|
||||||
}
|
|
||||||
Long orderBillId = Long.valueOf(order.getBillId().trim());
|
Long orderBillId = Long.valueOf(order.getBillId().trim());
|
||||||
String operator = operator();
|
|
||||||
String userId = PayFeeMoney.userId();
|
String userId = PayFeeMoney.userId();
|
||||||
payBillMapper.insertMissingPayBills(List.of(orderBillId), operator);
|
payBillMapper.insertMissingPayBills(List.of(orderBillId), operator());
|
||||||
PrcPayBill payBill = payBillMapper.selectByBillId(orderBillId);
|
PrcPayBill payBill = payBillMapper.selectByBillId(orderBillId);
|
||||||
PrcPayBillFee fee = new PrcPayBillFee();
|
PrcPayBillFee fee = newManualFee(orderBillId, payBill == null ? null : payBill.getPayBillId(), ready, userId);
|
||||||
fee.setFeeId(UUID.randomUUID().toString());
|
|
||||||
fee.setBillId(orderBillId);
|
|
||||||
fee.setPayBillId(payBill == null ? null : payBill.getPayBillId());
|
|
||||||
fee.setFeeType(feeType);
|
|
||||||
fee.setFeeName(feeName);
|
|
||||||
fee.setScId(manualScId());
|
|
||||||
fee.setFeeLevel(level);
|
|
||||||
fee.setAmount(amount);
|
|
||||||
fee.setCurrency(currency);
|
|
||||||
fee.setRemark(remark == null || remark.isEmpty() ? null : remark);
|
|
||||||
fee.setFeeSource("MANUAL");
|
|
||||||
fee.setCreateBy(userId);
|
|
||||||
fee.setUpdateBy(userId);
|
|
||||||
payBillFeeMapper.insertManual(fee);
|
payBillFeeMapper.insertManual(fee);
|
||||||
payBillFeeService.refreshTotals(List.of(orderBillId));
|
payBillFeeService.refreshTotals(List.of(orderBillId));
|
||||||
payBillFeeLogService.record(fee, PayBillFeeLogService.ADD);
|
payBillFeeLogService.record(fee, PayBillFeeLogService.ADD);
|
||||||
@@ -502,6 +453,34 @@ public class PayOrderListServiceImpl implements IPayOrderListService
|
|||||||
return toLine(saved == null ? fee : saved);
|
return toLine(saved == null ? fee : saved);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同一组费用写到每一票勾选订单上。应付总额和 ABCD 段在写入后一起重算。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public int addManualFees(PayOrderFeeBatch batch)
|
||||||
|
{
|
||||||
|
List<Long> billIds = batchBillIds(batch);
|
||||||
|
List<PayOrderFeeLine> lines = batchLines(batch);
|
||||||
|
List<PayOrderRow> orders = payOrderListMapper.selectByBillIds(billIds);
|
||||||
|
if (orders == null || orders.size() != billIds.size())
|
||||||
|
{
|
||||||
|
throw new ServiceException("有订单不在应付列表中,请重新勾选");
|
||||||
|
}
|
||||||
|
String userId = PayFeeMoney.userId();
|
||||||
|
List<PrcPayBillFee> fees = new ArrayList<>(billIds.size() * lines.size());
|
||||||
|
for (Long billId : billIds)
|
||||||
|
{
|
||||||
|
for (PayOrderFeeLine line : lines)
|
||||||
|
{
|
||||||
|
fees.add(newManualFee(billId, null, line, userId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
payBillFeeService.insertBatchAndRefreshTotals(fees);
|
||||||
|
payBillFeeLogService.record(fees, PayBillFeeLogService.ADD);
|
||||||
|
return fees.size();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 逻辑删除一条费用,并按剩余未删除明细重算应付总额。
|
* 逻辑删除一条费用,并按剩余未删除明细重算应付总额。
|
||||||
*
|
*
|
||||||
@@ -579,10 +558,144 @@ public class PayOrderListServiceImpl implements IPayOrderListService
|
|||||||
return fallback == null ? "" : fallback.trim();
|
return fallback == null ? "" : fallback.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 校验并收成可落库的一行。金额保留三位,和费用明细的小数位一致。 */
|
||||||
|
private PayOrderFeeLine checkedLine(PayOrderFeeLine line)
|
||||||
|
{
|
||||||
|
if (line == null)
|
||||||
|
{
|
||||||
|
throw new ServiceException("请填写费用");
|
||||||
|
}
|
||||||
|
String level = line.getLevel() == null ? "" : line.getLevel().trim();
|
||||||
|
if (!TITLES.containsKey(level))
|
||||||
|
{
|
||||||
|
throw new ServiceException("请选择费用阶段");
|
||||||
|
}
|
||||||
|
String feeName = firstText(line.getFeeName(), line.getFeeType());
|
||||||
|
if (feeName.isEmpty())
|
||||||
|
{
|
||||||
|
throw new ServiceException("请填写费用项");
|
||||||
|
}
|
||||||
|
if (feeName.length() > 100)
|
||||||
|
{
|
||||||
|
feeName = feeName.substring(0, 100);
|
||||||
|
}
|
||||||
|
String feeType = firstText(line.getFeeType(), "MANUAL");
|
||||||
|
if (feeType.length() > 30)
|
||||||
|
{
|
||||||
|
feeType = "MANUAL";
|
||||||
|
}
|
||||||
|
if (line.getAmount() == null)
|
||||||
|
{
|
||||||
|
throw new ServiceException("请填写金额");
|
||||||
|
}
|
||||||
|
String currency = firstText(line.getCurrency(), "CNY").toUpperCase(Locale.ROOT);
|
||||||
|
if (currency.length() > 10)
|
||||||
|
{
|
||||||
|
throw new ServiceException("币种过长");
|
||||||
|
}
|
||||||
|
BigDecimal amount = line.getAmount().setScale(3, RoundingMode.HALF_UP);
|
||||||
|
if (amount.abs().compareTo(new BigDecimal("9999999999.999")) > 0)
|
||||||
|
{
|
||||||
|
throw new ServiceException("金额超出范围");
|
||||||
|
}
|
||||||
|
String remark = line.getRemark() == null ? null : line.getRemark().trim();
|
||||||
|
if (remark != null && remark.length() > 200)
|
||||||
|
{
|
||||||
|
throw new ServiceException("说明不能超过200字");
|
||||||
|
}
|
||||||
|
PayOrderFeeLine ready = new PayOrderFeeLine();
|
||||||
|
ready.setLevel(level);
|
||||||
|
ready.setFeeName(feeName);
|
||||||
|
ready.setFeeType(feeType);
|
||||||
|
ready.setAmount(amount);
|
||||||
|
ready.setCurrency(currency);
|
||||||
|
ready.setRemark(remark == null || remark.isEmpty() ? null : remark);
|
||||||
|
return ready;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Long> batchBillIds(PayOrderFeeBatch batch)
|
||||||
|
{
|
||||||
|
if (batch == null || batch.getBillIds() == null || batch.getBillIds().isEmpty())
|
||||||
|
{
|
||||||
|
throw new ServiceException("请勾选订单");
|
||||||
|
}
|
||||||
|
LinkedHashSet<Long> ids = new LinkedHashSet<>();
|
||||||
|
for (String raw : batch.getBillIds())
|
||||||
|
{
|
||||||
|
if (raw == null || raw.isBlank())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ids.add(Long.valueOf(raw.trim()));
|
||||||
|
}
|
||||||
|
catch (NumberFormatException ex)
|
||||||
|
{
|
||||||
|
throw new ServiceException("订单编号不正确");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ids.isEmpty())
|
||||||
|
{
|
||||||
|
throw new ServiceException("请勾选订单");
|
||||||
|
}
|
||||||
|
if (ids.size() > MAX_ORDER_NOS)
|
||||||
|
{
|
||||||
|
throw new ServiceException("一次最多选择" + MAX_ORDER_NOS + "个订单");
|
||||||
|
}
|
||||||
|
return new ArrayList<>(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<PayOrderFeeLine> batchLines(PayOrderFeeBatch batch)
|
||||||
|
{
|
||||||
|
if (batch.getFees() == null || batch.getFees().isEmpty())
|
||||||
|
{
|
||||||
|
throw new ServiceException("请填写费用");
|
||||||
|
}
|
||||||
|
if (batch.getFees().size() > MAX_BATCH_LINES)
|
||||||
|
{
|
||||||
|
throw new ServiceException("一次最多增加" + MAX_BATCH_LINES + "条费用");
|
||||||
|
}
|
||||||
|
List<PayOrderFeeLine> lines = new ArrayList<>(batch.getFees().size());
|
||||||
|
for (PayOrderFeeLine line : batch.getFees())
|
||||||
|
{
|
||||||
|
if (line != null && (line.getLevel() == null || line.getLevel().isBlank()))
|
||||||
|
{
|
||||||
|
line.setLevel("4");
|
||||||
|
}
|
||||||
|
lines.add(checkedLine(line));
|
||||||
|
}
|
||||||
|
return lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 手工费用。创建人和更新人记当前登录用户主键,来源固定为手工。 */
|
||||||
|
private static PrcPayBillFee newManualFee(Long billId, String payBillId, PayOrderFeeLine line, String userId)
|
||||||
|
{
|
||||||
|
PrcPayBillFee fee = new PrcPayBillFee();
|
||||||
|
fee.setFeeId(UUID.randomUUID().toString());
|
||||||
|
fee.setBillId(billId);
|
||||||
|
fee.setPayBillId(payBillId);
|
||||||
|
fee.setFeeType(line.getFeeType());
|
||||||
|
fee.setFeeName(line.getFeeName());
|
||||||
|
fee.setScId(manualScId());
|
||||||
|
fee.setFeeLevel(line.getLevel());
|
||||||
|
fee.setAmount(line.getAmount());
|
||||||
|
fee.setCurrency(line.getCurrency());
|
||||||
|
fee.setRemark(line.getRemark());
|
||||||
|
fee.setFeeSource("MANUAL");
|
||||||
|
fee.setIsDeleted("0");
|
||||||
|
fee.setCreateBy(userId);
|
||||||
|
fee.setUpdateBy(userId);
|
||||||
|
return fee;
|
||||||
|
}
|
||||||
|
|
||||||
/** 手工费用用负数序号,避免和同一费用项的计算费用撞上唯一键。 */
|
/** 手工费用用负数序号,避免和同一费用项的计算费用撞上唯一键。 */
|
||||||
private static long manualScId()
|
private static long manualScId()
|
||||||
{
|
{
|
||||||
long tick = System.nanoTime();
|
long tick = MANUAL_SC_SEQ.updateAndGet(current -> {
|
||||||
|
long next = System.nanoTime();
|
||||||
|
return next > current ? next : current + 1L;
|
||||||
|
});
|
||||||
if (tick == Long.MIN_VALUE)
|
if (tick == Long.MIN_VALUE)
|
||||||
{
|
{
|
||||||
return -1L;
|
return -1L;
|
||||||
|
|||||||
+53
-1
@@ -1,8 +1,10 @@
|
|||||||
package com.bms.price.service.impl;
|
package com.bms.price.service.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import com.bms.common.exception.ServiceException;
|
import com.bms.common.exception.ServiceException;
|
||||||
@@ -39,7 +41,57 @@ public class PayPostcodeServiceImpl implements IPayPostcodeService
|
|||||||
@Override
|
@Override
|
||||||
public List<PayPostcodeGroup> selectCountryList(PayPostcodeGroup query)
|
public List<PayPostcodeGroup> selectCountryList(PayPostcodeGroup query)
|
||||||
{
|
{
|
||||||
return payPostcodeMapper.selectCountryList(query);
|
List<PayPostcodeGroup> countries = payPostcodeMapper.selectCountryList(query);
|
||||||
|
if (countries == null || countries.isEmpty())
|
||||||
|
{
|
||||||
|
return countries;
|
||||||
|
}
|
||||||
|
List<Long> groupIds = new ArrayList<Long>();
|
||||||
|
for (PayPostcodeGroup row : countries)
|
||||||
|
{
|
||||||
|
row.setZoneCount(0);
|
||||||
|
row.setLineCount(0);
|
||||||
|
if (row.getGroupId() != null)
|
||||||
|
{
|
||||||
|
groupIds.add(row.getGroupId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (groupIds.isEmpty())
|
||||||
|
{
|
||||||
|
return countries;
|
||||||
|
}
|
||||||
|
query.getParams().put("groupIds", groupIds);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<PayPostcodeGroup> stats = payPostcodeMapper.selectCountryZoneStats(query);
|
||||||
|
if (stats == null || stats.isEmpty())
|
||||||
|
{
|
||||||
|
return countries;
|
||||||
|
}
|
||||||
|
Map<Long, PayPostcodeGroup> byId = new HashMap<Long, PayPostcodeGroup>();
|
||||||
|
for (PayPostcodeGroup stat : stats)
|
||||||
|
{
|
||||||
|
if (stat.getGroupId() != null)
|
||||||
|
{
|
||||||
|
byId.put(stat.getGroupId(), stat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (PayPostcodeGroup row : countries)
|
||||||
|
{
|
||||||
|
PayPostcodeGroup stat = byId.get(row.getGroupId());
|
||||||
|
if (stat == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
row.setZoneCount(stat.getZoneCount() == null ? 0 : stat.getZoneCount());
|
||||||
|
row.setLineCount(stat.getLineCount() == null ? 0 : stat.getLineCount());
|
||||||
|
}
|
||||||
|
return countries;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
query.getParams().remove("groupIds");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+9
-2
@@ -493,9 +493,16 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
|||||||
TmsPriceQuoteResult result = toResult(bill, incomeBillFeeMapper.selectByBillId(bill.getBillId()),
|
TmsPriceQuoteResult result = toResult(bill, incomeBillFeeMapper.selectByBillId(bill.getBillId()),
|
||||||
payBillFeeMapper.selectByBillId(bill.getBillId()));
|
payBillFeeMapper.selectByBillId(bill.getBillId()));
|
||||||
PrcPayBill payBill = payBillMapper.selectByBillId(bill.getBillId());
|
PrcPayBill payBill = payBillMapper.selectByBillId(bill.getBillId());
|
||||||
if (payBill != null && payBill.getPayTotal() != null)
|
if (payBill != null)
|
||||||
{
|
{
|
||||||
result.setPayTotal(payBill.getPayTotal());
|
if (payBill.getPayTotal() != null)
|
||||||
|
{
|
||||||
|
result.setPayTotal(payBill.getPayTotal());
|
||||||
|
}
|
||||||
|
result.setAmountA(payBill.getAmountA());
|
||||||
|
result.setAmountB(payBill.getAmountB());
|
||||||
|
result.setAmountC(payBill.getAmountC());
|
||||||
|
result.setAmountD(payBill.getAmountD());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
+39
-6
@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.bms.common.utils.SecurityUtils;
|
import com.bms.common.utils.SecurityUtils;
|
||||||
|
import com.bms.price.domain.PrcPayBill;
|
||||||
import com.bms.price.domain.PrcPayBillFee;
|
import com.bms.price.domain.PrcPayBillFee;
|
||||||
import com.bms.price.mapper.PrcPayBillFeeMapper;
|
import com.bms.price.mapper.PrcPayBillFeeMapper;
|
||||||
import com.bms.price.mapper.PrcPayBillMapper;
|
import com.bms.price.mapper.PrcPayBillMapper;
|
||||||
@@ -83,13 +84,13 @@ public class PrcPayBillFeeServiceImpl implements IPrcPayBillFeeService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 不改 prc_pay_bill_fee。按计费日汇率把明细折成人民币后相加,四舍五入到两位,只写入 prc_pay_bill.pay_total。 */
|
/** 不改 prc_pay_bill_fee。按计费日汇率把明细折成人民币后,ABCD 段分别四舍五入到两位,应付总额取这四段之和,写入 prc_pay_bill。 */
|
||||||
private void writeCnyTotals(List<Long> billIds)
|
private void writeCnyTotals(List<Long> billIds)
|
||||||
{
|
{
|
||||||
Map<Long, BigDecimal> sums = new LinkedHashMap<>();
|
Map<Long, BigDecimal[]> sums = new LinkedHashMap<>();
|
||||||
for (Long billId : billIds)
|
for (Long billId : billIds)
|
||||||
{
|
{
|
||||||
sums.put(billId, BigDecimal.ZERO);
|
sums.put(billId, new BigDecimal[] { BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO });
|
||||||
}
|
}
|
||||||
List<PrcPayBillFee> fees = payBillFeeMapper.selectOpenFees(billIds);
|
List<PrcPayBillFee> fees = payBillFeeMapper.selectOpenFees(billIds);
|
||||||
if (fees != null)
|
if (fees != null)
|
||||||
@@ -100,20 +101,52 @@ public class PrcPayBillFeeServiceImpl implements IPrcPayBillFeeService
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
BigDecimal[] bucket = sums.get(fee.getBillId());
|
||||||
|
if (bucket == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
BigDecimal cny = payFeeMoney.toCny(fee.getAmount(), fee.getCurrency(), fee.getBizDate());
|
BigDecimal cny = payFeeMoney.toCny(fee.getAmount(), fee.getCurrency(), fee.getBizDate());
|
||||||
if (cny == null)
|
if (cny == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
sums.merge(fee.getBillId(), cny, BigDecimal::add);
|
int segment = segmentIndex(fee.getFeeLevel());
|
||||||
|
bucket[segment] = bucket[segment].add(cny);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Map.Entry<Long, BigDecimal> entry : sums.entrySet())
|
for (Map.Entry<Long, BigDecimal[]> entry : sums.entrySet())
|
||||||
{
|
{
|
||||||
payBillMapper.updateCnyPayTotal(entry.getKey(), PayFeeMoney.total(entry.getValue()));
|
BigDecimal[] bucket = entry.getValue();
|
||||||
|
PrcPayBill row = new PrcPayBill();
|
||||||
|
row.setBillId(entry.getKey());
|
||||||
|
row.setAmountA(PayFeeMoney.total(bucket[0]));
|
||||||
|
row.setAmountB(PayFeeMoney.total(bucket[1]));
|
||||||
|
row.setAmountC(PayFeeMoney.total(bucket[2]));
|
||||||
|
row.setAmountD(PayFeeMoney.total(bucket[3]));
|
||||||
|
row.setPayTotal(row.getAmountA().add(row.getAmountB()).add(row.getAmountC()).add(row.getAmountD()));
|
||||||
|
payBillMapper.updateCnyPayTotal(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 0A 1B 2C,其余含未标阶段的尾程计算费用归到 D。 */
|
||||||
|
private static int segmentIndex(String feeLevel)
|
||||||
|
{
|
||||||
|
if ("1".equals(feeLevel))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if ("2".equals(feeLevel))
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if ("3".equals(feeLevel))
|
||||||
|
{
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
private static String currentOperator()
|
private static String currentOperator()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
left join srv_bill_air_fee air on f.fee_source = 'LADING' and air.id = f.sc_id
|
left join srv_bill_air_fee air on f.fee_source = 'LADING' and air.id = f.sc_id
|
||||||
left join prc_surcharge air_sc on air_sc.sc_id = air.sc_id
|
left join prc_surcharge air_sc on air_sc.sc_id = air.sc_id
|
||||||
left join prc_surcharge item_sc on ifnull(f.fee_source, '') <> 'LADING' and item_sc.sc_id = f.sc_id
|
left join prc_surcharge item_sc on ifnull(f.fee_source, '') <> 'LADING' and item_sc.sc_id = f.sc_id
|
||||||
left join sys_dict_data dict on dict.dict_type = 'bms_fee_type' and dict.dict_value = f.fee_type
|
left join sys_dict_data dict on dict.dict_type = 'bms_fee_type' and dict.dict_value COLLATE utf8mb4_general_ci = f.fee_type COLLATE utf8mb4_general_ci
|
||||||
where f.bill_id = o.bill_id and f.is_deleted = '0') as feeText,
|
where f.bill_id = o.bill_id and f.is_deleted = '0') as feeText,
|
||||||
(select count(*) from prc_pay_bill_fee f
|
(select count(*) from prc_pay_bill_fee f
|
||||||
where f.bill_id = o.bill_id and ifnull(f.is_deleted, '0') = '0') as feeCount,
|
where f.bill_id = o.bill_id and ifnull(f.is_deleted, '0') = '0') as feeCount,
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
left join srv_bill_air_fee air on f.fee_source = 'LADING' and air.id = f.sc_id
|
left join srv_bill_air_fee air on f.fee_source = 'LADING' and air.id = f.sc_id
|
||||||
left join prc_surcharge air_sc on air_sc.sc_id = air.sc_id
|
left join prc_surcharge air_sc on air_sc.sc_id = air.sc_id
|
||||||
left join prc_surcharge item_sc on ifnull(f.fee_source, '') <> 'LADING' and item_sc.sc_id = f.sc_id
|
left join prc_surcharge item_sc on ifnull(f.fee_source, '') <> 'LADING' and item_sc.sc_id = f.sc_id
|
||||||
left join sys_dict_data dict on dict.dict_type = 'bms_fee_type' and dict.dict_value = f.fee_type
|
left join sys_dict_data dict on dict.dict_type = 'bms_fee_type' and dict.dict_value COLLATE utf8mb4_general_ci = f.fee_type COLLATE utf8mb4_general_ci
|
||||||
where f.is_deleted = '0'
|
where f.is_deleted = '0'
|
||||||
and f.bill_id in
|
and f.bill_id in
|
||||||
<foreach collection="billIds" item="id" open="(" separator="," close=")">#{id}</foreach>
|
<foreach collection="billIds" item="id" open="(" separator="," close=")">#{id}</foreach>
|
||||||
@@ -262,7 +262,7 @@
|
|||||||
left join srv_bill_air_fee air on f.fee_source = 'LADING' and air.id = f.sc_id
|
left join srv_bill_air_fee air on f.fee_source = 'LADING' and air.id = f.sc_id
|
||||||
left join prc_surcharge air_sc on air_sc.sc_id = air.sc_id
|
left join prc_surcharge air_sc on air_sc.sc_id = air.sc_id
|
||||||
left join prc_surcharge item_sc on ifnull(f.fee_source, '') <> 'LADING' and item_sc.sc_id = f.sc_id
|
left join prc_surcharge item_sc on ifnull(f.fee_source, '') <> 'LADING' and item_sc.sc_id = f.sc_id
|
||||||
left join sys_dict_data dict on dict.dict_type = 'bms_fee_type' and dict.dict_value = f.fee_type
|
left join sys_dict_data dict on dict.dict_type = 'bms_fee_type' and dict.dict_value COLLATE utf8mb4_general_ci = f.fee_type COLLATE utf8mb4_general_ci
|
||||||
where ifnull(f.is_deleted, '0') = '0'
|
where ifnull(f.is_deleted, '0') = '0'
|
||||||
and f.statement_line_id is null
|
and f.statement_line_id is null
|
||||||
and f.bill_id in
|
and f.bill_id in
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
p.order_no as orderNo,
|
p.order_no as orderNo,
|
||||||
nullif(trim(e.air_no_old), '') as ladingNo,
|
nullif(trim(e.air_no_old), '') as ladingNo,
|
||||||
p.tracking_no as trackingNo,
|
p.tracking_no as trackingNo,
|
||||||
|
p.customer_code as customerCode,
|
||||||
p.customer_name as customerName,
|
p.customer_name as customerName,
|
||||||
p.product_name as productName,
|
p.product_name as productName,
|
||||||
p.country_name as countryName,
|
p.country_name as countryName,
|
||||||
|
|||||||
@@ -96,6 +96,31 @@
|
|||||||
end
|
end
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
<sql id="countryBucket">
|
||||||
|
case
|
||||||
|
when nullif(trim(g.country_code), '') is not null then upper(trim(g.country_code))
|
||||||
|
when nullif(trim(g.country_name), '') is not null then trim(g.country_name)
|
||||||
|
else '未填写国家'
|
||||||
|
end
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<sql id="countryListFilter">
|
||||||
|
<if test="countryName != null and countryName != ''">
|
||||||
|
and (g.country_name like concat('%', #{countryName}, '%') or g.country_code like concat('%', #{countryName}, '%') or g.catalog_country like concat('%', #{countryName}, '%'))
|
||||||
|
</if>
|
||||||
|
<if test="serviceType != null and serviceType != ''">and g.service_type like concat('%', #{serviceType}, '%')</if>
|
||||||
|
<if test="productName != null and productName != ''">and g.product_name like concat('%', #{productName}, '%')</if>
|
||||||
|
<if test="channelName != null and channelName != ''">and g.channel_name like concat('%', #{channelName}, '%')</if>
|
||||||
|
<if test="coverage != null and coverage != ''">and g.coverage = #{coverage}</if>
|
||||||
|
<if test="postcode != null and postcode != ''">
|
||||||
|
and exists (
|
||||||
|
select 1 from pay_postcode_line lp
|
||||||
|
where lp.group_id = g.group_id and lp.postcode like concat('%', #{postcode}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 国家列表只汇总配置表。分区数和邮编数另查当前页,避免整表邮编先放大再聚合。 -->
|
||||||
<select id="selectCountryList" parameterType="com.bms.price.domain.PayPostcodeGroup" resultType="com.bms.price.domain.PayPostcodeGroup">
|
<select id="selectCountryList" parameterType="com.bms.price.domain.PayPostcodeGroup" resultType="com.bms.price.domain.PayPostcodeGroup">
|
||||||
select min(g.group_id) as groupId,
|
select min(g.group_id) as groupId,
|
||||||
max(g.country_name) as countryName,
|
max(g.country_name) as countryName,
|
||||||
@@ -104,50 +129,65 @@
|
|||||||
group_concat(distinct nullif(trim(g.service_type), '') order by g.service_type separator '、') as serviceType,
|
group_concat(distinct nullif(trim(g.service_type), '') order by g.service_type separator '、') as serviceType,
|
||||||
group_concat(distinct nullif(trim(g.product_name), '') order by g.product_name separator '、') as productName,
|
group_concat(distinct nullif(trim(g.product_name), '') order by g.product_name separator '、') as productName,
|
||||||
group_concat(distinct nullif(trim(g.channel_name), '') order by g.channel_name separator '、') as channelName,
|
group_concat(distinct nullif(trim(g.channel_name), '') order by g.channel_name separator '、') as channelName,
|
||||||
count(distinct case
|
|
||||||
when l.line_id is null and nullif(trim(g.block_title), '') is null then null
|
|
||||||
else concat(
|
|
||||||
case
|
|
||||||
when l.line_id is not null then
|
|
||||||
case
|
|
||||||
when nullif(trim(l.zone_name), '') is not null then trim(l.zone_name)
|
|
||||||
when nullif(trim(l.region_name), '') is not null then trim(l.region_name)
|
|
||||||
when nullif(trim(g.block_title), '') is not null then trim(g.block_title)
|
|
||||||
else '未分区'
|
|
||||||
end
|
|
||||||
else trim(g.block_title)
|
|
||||||
end,
|
|
||||||
'||',
|
|
||||||
lower(ifnull(trim(g.channel_name), ''))
|
|
||||||
)
|
|
||||||
end) as zoneCount,
|
|
||||||
count(l.line_id) as lineCount,
|
|
||||||
max(g.create_time) as createTime
|
max(g.create_time) as createTime
|
||||||
from pay_postcode_group g
|
from pay_postcode_group g
|
||||||
left join pay_postcode_line l on l.group_id = g.group_id
|
|
||||||
<where>
|
<where>
|
||||||
<if test="countryName != null and countryName != ''">
|
<include refid="countryListFilter"/>
|
||||||
and (g.country_name like concat('%', #{countryName}, '%') or g.country_code like concat('%', #{countryName}, '%') or g.catalog_country like concat('%', #{countryName}, '%'))
|
|
||||||
</if>
|
|
||||||
<if test="serviceType != null and serviceType != ''">and g.service_type like concat('%', #{serviceType}, '%')</if>
|
|
||||||
<if test="productName != null and productName != ''">and g.product_name like concat('%', #{productName}, '%')</if>
|
|
||||||
<if test="channelName != null and channelName != ''">and g.channel_name like concat('%', #{channelName}, '%')</if>
|
|
||||||
<if test="coverage != null and coverage != ''">and g.coverage = #{coverage}</if>
|
|
||||||
<if test="postcode != null and postcode != ''">
|
|
||||||
and exists (
|
|
||||||
select 1 from pay_postcode_line lp
|
|
||||||
where lp.group_id = g.group_id and lp.postcode like concat('%', #{postcode}, '%')
|
|
||||||
)
|
|
||||||
</if>
|
|
||||||
</where>
|
</where>
|
||||||
group by case
|
group by <include refid="countryBucket"/>
|
||||||
when nullif(trim(g.country_code), '') is not null then upper(trim(g.country_code))
|
|
||||||
when nullif(trim(g.country_name), '') is not null then trim(g.country_name)
|
|
||||||
else '未填写国家'
|
|
||||||
end
|
|
||||||
order by max(g.create_time) desc
|
order by max(g.create_time) desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 当前页国家的分区数、邮编数。有邮编的按分区名加渠道去重;没有邮编但有区块标题的算一个分区。 -->
|
||||||
|
<select id="selectCountryZoneStats" parameterType="com.bms.price.domain.PayPostcodeGroup" resultType="com.bms.price.domain.PayPostcodeGroup">
|
||||||
|
select min(t.group_id) as groupId,
|
||||||
|
count(distinct t.zone_key) as zoneCount,
|
||||||
|
count(case when t.line_flag = 1 then 1 end) as lineCount
|
||||||
|
from (
|
||||||
|
select g.group_id,
|
||||||
|
<include refid="countryBucket"/> as country_key,
|
||||||
|
concat(<include refid="zoneExpr"/>, '||', lower(ifnull(trim(g.channel_name), ''))) as zone_key,
|
||||||
|
1 as line_flag
|
||||||
|
from (
|
||||||
|
select g.group_id, g.block_title, g.channel_name, g.country_code, g.country_name
|
||||||
|
from pay_postcode_group g
|
||||||
|
<where>
|
||||||
|
<include refid="countryListFilter"/>
|
||||||
|
<include refid="pageCountryScope"/>
|
||||||
|
</where>
|
||||||
|
) g
|
||||||
|
inner join pay_postcode_line l on l.group_id = g.group_id
|
||||||
|
union all
|
||||||
|
select g.group_id,
|
||||||
|
<include refid="countryBucket"/> as country_key,
|
||||||
|
concat(trim(g.block_title), '||', lower(ifnull(trim(g.channel_name), ''))) as zone_key,
|
||||||
|
0 as line_flag
|
||||||
|
from pay_postcode_group g
|
||||||
|
<where>
|
||||||
|
<include refid="countryListFilter"/>
|
||||||
|
<include refid="pageCountryScope"/>
|
||||||
|
and nullif(trim(g.block_title), '') is not null
|
||||||
|
and not exists (select 1 from pay_postcode_line l where l.group_id = g.group_id)
|
||||||
|
</where>
|
||||||
|
) t
|
||||||
|
group by t.country_key
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<sql id="pageCountryScope">
|
||||||
|
<if test="params != null and params.groupIds != null and params.groupIds.size() > 0">
|
||||||
|
and <include refid="countryBucket"/> in (
|
||||||
|
select case
|
||||||
|
when nullif(trim(src.country_code), '') is not null then upper(trim(src.country_code))
|
||||||
|
when nullif(trim(src.country_name), '') is not null then trim(src.country_name)
|
||||||
|
else '未填写国家'
|
||||||
|
end
|
||||||
|
from pay_postcode_group src
|
||||||
|
where src.group_id in
|
||||||
|
<foreach collection="params.groupIds" item="id" open="(" separator="," close=")">#{id}</foreach>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</sql>
|
||||||
|
|
||||||
<select id="selectZoneList" parameterType="com.bms.price.domain.PayPostcodeGroup" resultType="com.bms.price.domain.PayPostcodeGroup">
|
<select id="selectZoneList" parameterType="com.bms.price.domain.PayPostcodeGroup" resultType="com.bms.price.domain.PayPostcodeGroup">
|
||||||
select t.zone_name as zoneName,
|
select t.zone_name as zoneName,
|
||||||
min(t.group_id) as groupId,
|
min(t.group_id) as groupId,
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
)
|
)
|
||||||
left join pay_product cur on cur.product_id = t.product_id
|
left join pay_product cur on cur.product_id = t.product_id
|
||||||
<include refid="payProductWhere"/>
|
<include refid="payProductWhere"/>
|
||||||
order by ifnull(t.effective_start, pay_product.effective_date) desc, pay_product.product_id desc
|
order by pay_product.create_time desc, pay_product.product_id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectPayProductById" parameterType="long" resultMap="PayProductResult">
|
<select id="selectPayProductById" parameterType="long" resultMap="PayProductResult">
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
left join prc_surcharge air_sc on air_sc.sc_id = air.sc_id
|
left join prc_surcharge air_sc on air_sc.sc_id = air.sc_id
|
||||||
left join pay_surcharge pay_sc on f.fee_type = 'SURCHARGE' and ifnull(f.fee_source, '') <> 'LADING' and pay_sc.surcharge_id = f.sc_id
|
left join pay_surcharge pay_sc on f.fee_type = 'SURCHARGE' and ifnull(f.fee_source, '') <> 'LADING' and pay_sc.surcharge_id = f.sc_id
|
||||||
left join prc_surcharge item_sc on f.fee_type = 'SURCHARGE' and ifnull(f.fee_source, '') <> 'LADING' and item_sc.sc_id = f.sc_id
|
left join prc_surcharge item_sc on f.fee_type = 'SURCHARGE' and ifnull(f.fee_source, '') <> 'LADING' and item_sc.sc_id = f.sc_id
|
||||||
left join sys_dict_data dict on dict.dict_type = 'bms_fee_type' and dict.dict_value = f.fee_type
|
left join sys_dict_data dict on dict.dict_type = 'bms_fee_type' and dict.dict_value COLLATE utf8mb4_general_ci = f.fee_type COLLATE utf8mb4_general_ci
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="feeActorName">
|
<sql id="feeActorName">
|
||||||
@@ -59,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
where u.del_flag = '0'
|
where u.del_flag = '0'
|
||||||
and (
|
and (
|
||||||
(${column} regexp '^[0-9]+$' and u.user_id = cast(${column} as unsigned))
|
(${column} regexp '^[0-9]+$' and u.user_id = cast(${column} as unsigned))
|
||||||
or (ifnull(${column}, '') not regexp '^[0-9]+$' and u.user_name = ${column} COLLATE utf8mb4_general_ci)
|
or (ifnull(${column}, '') not regexp '^[0-9]+$' and u.user_name COLLATE utf8mb4_general_ci = ${column} COLLATE utf8mb4_general_ci)
|
||||||
)
|
)
|
||||||
limit 1
|
limit 1
|
||||||
), ${column})
|
), ${column})
|
||||||
@@ -197,7 +197,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectOpenFees" resultMap="PrcPayBillFeeResult">
|
<select id="selectOpenFees" resultMap="PrcPayBillFeeResult">
|
||||||
select f.fee_id, f.bill_id, f.amount, f.currency, b.biz_date
|
select f.fee_id, f.bill_id, f.fee_level, f.amount, f.currency, b.biz_date
|
||||||
from prc_pay_bill_fee f
|
from prc_pay_bill_fee f
|
||||||
left join prc_order_bill b on b.bill_id = f.bill_id
|
left join prc_order_bill b on b.bill_id = f.bill_id
|
||||||
where ifnull(f.is_deleted, '0') = '0'
|
where ifnull(f.is_deleted, '0') = '0'
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="redlineAmount" column="redline_amount" />
|
<result property="redlineAmount" column="redline_amount" />
|
||||||
<result property="costAmount" column="cost_amount" />
|
<result property="costAmount" column="cost_amount" />
|
||||||
<result property="payTotal" column="pay_total" />
|
<result property="payTotal" column="pay_total" />
|
||||||
|
<result property="amountA" column="amount_a" />
|
||||||
|
<result property="amountB" column="amount_b" />
|
||||||
|
<result property="amountC" column="amount_c" />
|
||||||
|
<result property="amountD" column="amount_d" />
|
||||||
<result property="belongSaler" column="belong_saler" />
|
<result property="belongSaler" column="belong_saler" />
|
||||||
<result property="belongSalerCode" column="belong_saler_code" />
|
<result property="belongSalerCode" column="belong_saler_code" />
|
||||||
<result property="settlementMan" column="settlement_man" />
|
<result property="settlementMan" column="settlement_man" />
|
||||||
@@ -24,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<sql id="selectPrcPayBillVo">
|
<sql id="selectPrcPayBillVo">
|
||||||
select pay_bill_id, bill_id, currency, product_amount, redline_amount,
|
select pay_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||||
cost_amount, pay_total,
|
cost_amount, pay_total, amount_a, amount_b, amount_c, amount_d,
|
||||||
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
||||||
create_by, create_time, update_by, update_time
|
create_by, create_time, update_by, update_time
|
||||||
from prc_pay_bill
|
from prc_pay_bill
|
||||||
@@ -138,9 +142,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<foreach collection="billIds" item="billId" open="(" separator="," close=")">#{billId}</foreach>
|
<foreach collection="billIds" item="billId" open="(" separator="," close=")">#{billId}</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateCnyPayTotal">
|
<update id="updateCnyPayTotal" parameterType="PrcPayBill">
|
||||||
update prc_pay_bill
|
update prc_pay_bill
|
||||||
set pay_total = #{payTotal},
|
set pay_total = #{payTotal},
|
||||||
|
amount_a = #{amountA},
|
||||||
|
amount_b = #{amountB},
|
||||||
|
amount_c = #{amountC},
|
||||||
|
amount_d = #{amountD},
|
||||||
currency = 'CNY',
|
currency = 'CNY',
|
||||||
update_time = sysdate()
|
update_time = sysdate()
|
||||||
where bill_id = #{billId}
|
where bill_id = #{billId}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ CREATE TABLE IF NOT EXISTS `pay_postcode_line` (
|
|||||||
`sort_no` int(11) NOT NULL DEFAULT 0 COMMENT 'Excel中的先后顺序',
|
`sort_no` int(11) NOT NULL DEFAULT 0 COMMENT 'Excel中的先后顺序',
|
||||||
PRIMARY KEY (`line_id`),
|
PRIMARY KEY (`line_id`),
|
||||||
KEY `idx_pay_postcode_line_group` (`group_id`),
|
KEY `idx_pay_postcode_line_group` (`group_id`),
|
||||||
|
KEY `idx_pay_postcode_line_zone` (`group_id`, `zone_name`, `region_name`),
|
||||||
KEY `idx_pay_postcode_line_code` (`postcode`)
|
KEY `idx_pay_postcode_line_code` (`postcode`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='应付邮编明细,一行对应Excel一条邮编';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='应付邮编明细,一行对应Excel一条邮编';
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
-- `pay_postcode_line` 增加分区统计覆盖索引,国家列表按配置汇总分区数时不必回表读整行邮编
|
||||||
|
ALTER TABLE `bms`.`pay_postcode_line` ADD INDEX `idx_pay_postcode_line_zone` (`group_id`, `zone_name`, `region_name`);
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
-- 应付列表增加批量新增费用按钮
|
||||||
|
INSERT INTO `bms`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`)
|
||||||
|
SELECT (SELECT IFNULL(MAX(`t`.`menu_id`), 0) + 1 FROM (SELECT `menu_id` FROM `bms`.`sys_menu`) `t`), '批量新增费用', `p`.`menu_id`, (SELECT IFNULL(MAX(`c`.`order_num`), 0) + 1 FROM (SELECT `parent_id`, `order_num` FROM `bms`.`sys_menu`) `c` WHERE `c`.`parent_id` = `p`.`menu_id`), '', '', 1, 0, 'F', '0', '0', 'price:payOrder:feeBatch', '#', 'admin', sysdate()
|
||||||
|
FROM `bms`.`sys_menu` `p`
|
||||||
|
WHERE `p`.`perms` = 'price:payOrder:list' AND `p`.`menu_type` = 'C'
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM `bms`.`sys_menu` `e` WHERE `e`.`perms` = 'price:payOrder:feeBatch')
|
||||||
|
ORDER BY `p`.`menu_id`
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
|
-- 管理员拥有批量新增费用按钮
|
||||||
|
INSERT INTO `bms`.`sys_role_menu` (`role_id`, `menu_id`)
|
||||||
|
SELECT 1, `m`.`menu_id`
|
||||||
|
FROM `bms`.`sys_menu` `m`
|
||||||
|
WHERE `m`.`perms` = 'price:payOrder:feeBatch'
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM `bms`.`sys_role_menu` `rm` WHERE `rm`.`role_id` = 1 AND `rm`.`menu_id` = `m`.`menu_id`);
|
||||||
|
|
||||||
|
-- 能看应付列表的角色同时拥有批量新增费用按钮
|
||||||
|
INSERT INTO `bms`.`sys_role_menu` (`role_id`, `menu_id`)
|
||||||
|
SELECT DISTINCT `rm`.`role_id`, `btn`.`menu_id`
|
||||||
|
FROM `bms`.`sys_role_menu` `rm`
|
||||||
|
INNER JOIN `bms`.`sys_menu` `parent` ON `parent`.`menu_id` = `rm`.`menu_id` AND `parent`.`perms` = 'price:payOrder:list' AND `parent`.`menu_type` = 'C'
|
||||||
|
INNER JOIN `bms`.`sys_menu` `btn` ON `btn`.`perms` = 'price:payOrder:feeBatch'
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM `bms`.`sys_role_menu` `x` WHERE `x`.`role_id` = `rm`.`role_id` AND `x`.`menu_id` = `btn`.`menu_id`);
|
||||||
@@ -38,6 +38,14 @@ export function addPayOrderFee(billId, data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function addPayOrderFees(data) {
|
||||||
|
return request({
|
||||||
|
url: '/price/payOrder/fees/batch',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function removePayOrderFee(feeId) {
|
export function removePayOrderFee(feeId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/price/payOrder/fees/' + feeId,
|
url: '/price/payOrder/fees/' + feeId,
|
||||||
|
|||||||
@@ -6,16 +6,16 @@
|
|||||||
<span v-if="country" class="drawer-sub">
|
<span v-if="country" class="drawer-sub">
|
||||||
{{ country.countryName || '未填写国家' }}
|
{{ country.countryName || '未填写国家' }}
|
||||||
<template v-if="country.countryCode">({{ country.countryCode }})</template>
|
<template v-if="country.countryCode">({{ country.countryCode }})</template>
|
||||||
,共 {{ zoneList.length }} 个分区
|
,共 {{ total }} 个分区
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div v-loading="loading">
|
<div>
|
||||||
<div class="zone-toolbar">
|
<div class="zone-toolbar">
|
||||||
<el-button type="primary" plain icon="Plus" size="small" :disabled="!country" @click="handleAdd" v-hasPermi="['data:payPostcode:edit']">新增分区</el-button>
|
<el-button type="primary" plain icon="Plus" size="small" :disabled="!country" @click="handleAdd" v-hasPermi="['data:payPostcode:edit']">新增分区</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-table :data="zoneList" border :row-key="rowKey" :empty-text="country ? '这个国家还没有分区' : '请选择国家'">
|
<el-table v-loading="loading" :data="zoneList" border :row-key="rowKey" :empty-text="country ? '这个国家还没有分区' : '请选择国家'">
|
||||||
<el-table-column label="分区" min-width="180" align="center">
|
<el-table-column label="分区" min-width="180" align="center">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div class="zone-country-cell">
|
<div class="zone-country-cell">
|
||||||
@@ -42,6 +42,17 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
<div class="drawer-pager">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="query.pageNum"
|
||||||
|
v-model:page-size="query.pageSize"
|
||||||
|
:total="total"
|
||||||
|
:page-sizes="[20, 50, 100, 200]"
|
||||||
|
layout="total, sizes, prev, pager, next"
|
||||||
|
@size-change="loadList"
|
||||||
|
@current-change="loadList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<pay-zone-form-dialog ref="formRef" :country="country" @success="onChanged" />
|
<pay-zone-form-dialog ref="formRef" :country="country" @success="onChanged" />
|
||||||
@@ -61,6 +72,8 @@ const visible = ref(false)
|
|||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const country = ref(null)
|
const country = ref(null)
|
||||||
const zoneList = ref([])
|
const zoneList = ref([])
|
||||||
|
const total = ref(0)
|
||||||
|
const query = ref({ pageNum: 1, pageSize: 20 })
|
||||||
const formRef = ref()
|
const formRef = ref()
|
||||||
const lineRef = ref()
|
const lineRef = ref()
|
||||||
|
|
||||||
@@ -92,6 +105,7 @@ function rowKey(row) {
|
|||||||
|
|
||||||
function open(row) {
|
function open(row) {
|
||||||
country.value = row
|
country.value = row
|
||||||
|
query.value = { pageNum: 1, pageSize: 20 }
|
||||||
visible.value = true
|
visible.value = true
|
||||||
loadList()
|
loadList()
|
||||||
}
|
}
|
||||||
@@ -99,17 +113,22 @@ function open(row) {
|
|||||||
function loadList() {
|
function loadList() {
|
||||||
if (!country.value) {
|
if (!country.value) {
|
||||||
zoneList.value = []
|
zoneList.value = []
|
||||||
|
total.value = 0
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
loading.value = true
|
loading.value = true
|
||||||
listPayPostcodeZone({
|
listPayPostcodeZone({
|
||||||
countryCode: country.value.countryCode,
|
countryCode: country.value.countryCode,
|
||||||
countryName: country.value.countryName,
|
countryName: country.value.countryName,
|
||||||
allChannels: true
|
allChannels: true,
|
||||||
|
pageNum: query.value.pageNum,
|
||||||
|
pageSize: query.value.pageSize
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
zoneList.value = res.data || []
|
zoneList.value = res.rows || []
|
||||||
|
total.value = res.total || 0
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
zoneList.value = []
|
zoneList.value = []
|
||||||
|
total.value = 0
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
})
|
})
|
||||||
@@ -158,4 +177,5 @@ defineExpose({ open })
|
|||||||
.zone-country-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; }
|
.zone-country-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; }
|
||||||
.zone-title { font-weight: 500; }
|
.zone-title { font-weight: 500; }
|
||||||
.zone-click { padding: 0; height: auto; font-size: 12px; }
|
.zone-click { padding: 0; height: auto; font-size: 12px; }
|
||||||
|
.drawer-pager { margin-top: 16px; display: flex; justify-content: flex-end; }
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="产品名称" required>
|
<el-form-item label="价卡名称" required>
|
||||||
<el-input v-model="form.productName" maxlength="80" placeholder="渠道或产品名称" />
|
<el-input v-model="form.productName" maxlength="80" placeholder="价卡名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
|
|||||||
@@ -40,10 +40,6 @@
|
|||||||
<span v-else>{{ row.sourceFile || '-' }}</span>
|
<span v-else>{{ row.sourceFile || '-' }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #col-parseStatus="{ row }">
|
|
||||||
<el-tag :type="statusType(row.parseStatus)" size="small">{{ statusText(row.parseStatus) }}</el-tag>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #col-termRange="{ row }">
|
<template #col-termRange="{ row }">
|
||||||
<span>{{ termText(row) }}</span>
|
<span>{{ termText(row) }}</span>
|
||||||
</template>
|
</template>
|
||||||
@@ -262,19 +258,14 @@ const statusOptions = [
|
|||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{ label: '应付价卡名称', prop: 'productName', align: 'center', minWidth: 180, showOverflowTooltip: true, fixed: 'left' },
|
{ label: '应付价卡名称', prop: 'productName', align: 'center', minWidth: 180, showOverflowTooltip: true, fixed: 'left' },
|
||||||
{ label: '价卡归属', prop: 'supplierName', align: 'center', width: 100 },
|
|
||||||
{ label: '国家/口岸', prop: 'countryScope', align: 'center', minWidth: 120, showOverflowTooltip: true },
|
{ label: '国家/口岸', prop: 'countryScope', align: 'center', minWidth: 120, showOverflowTooltip: true },
|
||||||
{ label: '费用类型', prop: 'chargeType', align: 'center', width: 110 },
|
{ label: '费用类型', prop: 'chargeType', align: 'center', width: 110 },
|
||||||
{ label: '每公斤加价', prop: 'extraPerKg', align: 'center', width: 120 },
|
{ label: '每公斤加价', prop: 'extraPerKg', align: 'center', width: 120 },
|
||||||
{ label: '报价工作表', prop: 'sheetName', align: 'center', minWidth: 140, showOverflowTooltip: true },
|
|
||||||
{ label: '关联分区表', prop: 'relatedSheet', align: 'center', minWidth: 140, showOverflowTooltip: true },
|
|
||||||
{ label: '版本', prop: 'versionNo', align: 'center', width: 70 },
|
{ label: '版本', prop: 'versionNo', align: 'center', width: 70 },
|
||||||
{ label: '有效期', prop: 'termRange', align: 'center', minWidth: 180, showOverflowTooltip: true },
|
{ label: '有效期', prop: 'termRange', align: 'center', minWidth: 180, showOverflowTooltip: true },
|
||||||
{ label: '状态', prop: 'termStatus', align: 'center', width: 100 },
|
{ label: '状态', prop: 'termStatus', align: 'center', width: 100 },
|
||||||
{ label: '币种', prop: 'currency', align: 'center', width: 80 },
|
{ label: '币种', prop: 'currency', align: 'center', width: 80 },
|
||||||
{ label: '重量段', prop: 'weightCount', align: 'center', width: 80 },
|
{ label: '重量段', prop: 'weightCount', align: 'center', width: 80 },
|
||||||
{ label: '附加费', prop: 'surchargeCount', align: 'center', width: 80 },
|
|
||||||
{ label: '识别结果', prop: 'parseStatus', align: 'center', width: 120 },
|
|
||||||
{ label: '来源文件', prop: 'sourceFile', align: 'center', minWidth: 180, showOverflowTooltip: true },
|
{ label: '来源文件', prop: 'sourceFile', align: 'center', minWidth: 180, showOverflowTooltip: true },
|
||||||
{ label: '创建时间', prop: 'createTime', align: 'center', width: 160, parseTime: true },
|
{ label: '创建时间', prop: 'createTime', align: 'center', width: 160, parseTime: true },
|
||||||
{ label: '操作', prop: 'action', align: 'center', width: 340, fixed: 'right', showInToolbar: false }
|
{ label: '操作', prop: 'action', align: 'center', width: 340, fixed: 'right', showInToolbar: false }
|
||||||
@@ -588,16 +579,6 @@ function changeStatus(row, field, status) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function statusText(status) {
|
|
||||||
return statusOptions.find(item => item.value === status)?.label || status || '-'
|
|
||||||
}
|
|
||||||
|
|
||||||
function statusType(status) {
|
|
||||||
if (status === 'OK') return 'success'
|
|
||||||
if (status === 'EMPTY') return 'warning'
|
|
||||||
if (status === 'MISSING') return 'danger'
|
|
||||||
return 'info'
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -0,0 +1,375 @@
|
|||||||
|
<template>
|
||||||
|
<el-drawer
|
||||||
|
:model-value="modelValue"
|
||||||
|
:title="title"
|
||||||
|
size="840px"
|
||||||
|
append-to-body
|
||||||
|
destroy-on-close
|
||||||
|
class="bill-detail-drawer"
|
||||||
|
@update:model-value="$emit('update:modelValue', $event)"
|
||||||
|
>
|
||||||
|
<div v-loading="loading" class="bill-detail-wrap">
|
||||||
|
<el-empty v-if="!detail" description="暂无详情" />
|
||||||
|
<div v-else class="bill-detail">
|
||||||
|
<section class="detail-block">
|
||||||
|
<div class="sec-title">订单信息</div>
|
||||||
|
<el-descriptions class="detail-desc" :column="2" border size="small">
|
||||||
|
<el-descriptions-item label="订单号">{{ detail.orderNo || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="运单号">{{ detail.trackingNo || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="转单号">{{ detail.transferNo || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="销售员">{{ detail.belongSaler || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="结算员">{{ detail.settlementMan || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="客服员">{{ detail.serviceMan || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="客户">{{ displayCustomer(detail) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="客户状态">{{ customerActiveLabel(detail.customerActiveStatus) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="额度欠费">{{ creditArrearsLabel(detail.creditArrearsStatus) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="退费状态">{{ refundLabel(detail.refundStatus) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="仓库">{{ detail.warehouseCode || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="发件人">{{ detail.shipperName || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="收件人">{{ detail.consigneeName || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="目的国/地区">{{ countryLabel(detail) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="目的邮编">{{ detail.destPostcode || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="件数">{{ detail.pieces != null ? detail.pieces : '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="尺寸(cm)">{{ dimLabel(detail) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="实重(kg)">{{ formatWeight(detail.actualWeight) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="收货重(kg)">{{ formatWeight(detail.receiveWeight) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="材积重(kg)">{{ formatWeight(detail.volumeWeight) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="体积(m³)">{{ formatMoney(detail.volume) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="下单时间">{{ formatDateTime(detail.orderTime) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="订单备注" :span="2">{{ detail.orderRemark || '-' }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="detail-block">
|
||||||
|
<div class="sec-title">计费信息</div>
|
||||||
|
<div class="amount-summary">
|
||||||
|
<div class="amount-card">
|
||||||
|
<div class="amount-label">A段</div>
|
||||||
|
<div class="amount-value">{{ formatMoney(detail.amountA) }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="amount-card">
|
||||||
|
<div class="amount-label">B段</div>
|
||||||
|
<div class="amount-value">{{ formatMoney(detail.amountB) }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="amount-card">
|
||||||
|
<div class="amount-label">C段</div>
|
||||||
|
<div class="amount-value">{{ formatMoney(detail.amountC) }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="amount-card">
|
||||||
|
<div class="amount-label">D段</div>
|
||||||
|
<div class="amount-value">{{ formatMoney(detail.amountD) }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="amount-card is-total">
|
||||||
|
<div class="amount-label">应付总额</div>
|
||||||
|
<div class="amount-value">{{ formatMoney(detail.payTotal) }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-descriptions class="detail-desc" :column="2" border size="small">
|
||||||
|
<el-descriptions-item label="产品">{{ productLabel(detail) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="客户确认重(kg)">{{ formatWeight(detail.chargeWeight) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="计费重量(kg)">{{ formatWeight(detail.chargeWeight ?? detail.weight) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="重量段">{{ detail.weightLabel || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="计费时间">{{ detail.bizDate || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="渠道编码">{{ detail.productFloorCode || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="渠道名称">{{ detail.productFloor || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="计费状态">
|
||||||
|
<el-tag size="small" :type="billingFailTagType(detail.billingFailStatus)">{{ billingFailLabel(detail.billingFailStatus) }}</el-tag>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="套餐">{{ priceSetLabel(detail) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="币种">
|
||||||
|
<dict-tag :options="bms_currency" :value="displayCurrency(detail.currency)" />
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="取值方式">{{ roundModeLabel(detail.roundMode) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="运费单价">{{ formatRate(detail.freightRate) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="挂号费">{{ formatMoney(detail.registrationFee) }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="detail-block">
|
||||||
|
<div class="sec-title">费用明细</div>
|
||||||
|
<div v-if="!readonly" class="pay-generate">
|
||||||
|
<el-button type="primary" plain size="small" v-hasPermi="['price:billing:bill']" @click="handlePayBill">生成应付</el-button>
|
||||||
|
</div>
|
||||||
|
<el-table v-if="payFees.length" :data="payFees" border size="small" class="fee-table">
|
||||||
|
<el-table-column label="费用名称" min-width="140" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">{{ displayFeeName(row) }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="费用类型" min-width="140" align="center" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag size="small" :type="feeTypeTag(row.feeType)" effect="plain">
|
||||||
|
{{ payFeeTypeLabel(row) }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="金额" min-width="120" align="right">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span class="fee-amount">{{ formatFeeAmount(row.amount) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="币种" width="90" align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<dict-tag :options="bms_currency" :value="displayCurrency(row.currency)" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="说明" min-width="160" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">{{ row.remark || '-' }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<el-empty v-else description="暂无应付明细" :image-size="64" />
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { generatePayBill } from '@/api/price/pay'
|
||||||
|
import { getPayOrder } from '@/api/price/payOrder'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
modelValue: { type: Boolean, default: false },
|
||||||
|
title: { type: String, default: '订单详情' },
|
||||||
|
loading: { type: Boolean, default: false },
|
||||||
|
detail: { type: Object, default: null },
|
||||||
|
readonly: { type: Boolean, default: false }
|
||||||
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:modelValue', 'updated'])
|
||||||
|
|
||||||
|
const { bms_fee_type, bms_currency } = useDict('bms_fee_type', 'bms_currency')
|
||||||
|
|
||||||
|
const payFees = computed(() => {
|
||||||
|
const d = props.detail
|
||||||
|
if (!d) return []
|
||||||
|
return d.payFeeDetails || []
|
||||||
|
})
|
||||||
|
|
||||||
|
function handlePayBill() {
|
||||||
|
const billId = props.detail?.billId
|
||||||
|
if (!billId) return
|
||||||
|
ElMessageBox.confirm('确认生成应付?', '生成应付', { type: 'warning' })
|
||||||
|
.then(() => generatePayBill(billId))
|
||||||
|
.then(() => {
|
||||||
|
ElMessage.success('操作成功')
|
||||||
|
return getPayOrder(billId)
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
if (res && res.data) emit('updated', res.data)
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
if (err === 'cancel' || err === 'close') return
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function customerActiveLabel(status) {
|
||||||
|
const map = { ACTIVE: '正常', MISSING: '不存在', DISABLED: '停用' }
|
||||||
|
return map[status] || status || '-'
|
||||||
|
}
|
||||||
|
|
||||||
|
function creditArrearsLabel(status) {
|
||||||
|
const map = { NORMAL: '正常', ARREARS: '欠费' }
|
||||||
|
return map[status] || status || '-'
|
||||||
|
}
|
||||||
|
|
||||||
|
function displayCustomer(row) {
|
||||||
|
if (row.customerName && row.customerCode) return row.customerName + ' (' + row.customerCode + ')'
|
||||||
|
return row.customerName || row.customerCode || row.customerId || '-'
|
||||||
|
}
|
||||||
|
|
||||||
|
function countryLabel(row) {
|
||||||
|
return (row.countryName || '-') + ' (' + (row.countryCode || '-') + ')'
|
||||||
|
}
|
||||||
|
|
||||||
|
function productLabel(row) {
|
||||||
|
return (row.productName || '-') + ' (' + (row.productCode || '-') + ')'
|
||||||
|
}
|
||||||
|
|
||||||
|
function priceSetLabel(row) {
|
||||||
|
const name = row.priceSetName || '-'
|
||||||
|
return row.priceSetCode ? name + ' (' + row.priceSetCode + ')' : name
|
||||||
|
}
|
||||||
|
|
||||||
|
function dimLabel(row) {
|
||||||
|
if (row.pkgLength == null && row.pkgWidth == null && row.pkgHeight == null) return '-'
|
||||||
|
return [row.pkgLength, row.pkgWidth, row.pkgHeight].map(v => v == null ? '-' : v).join(' × ')
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatMoney(val) {
|
||||||
|
if (val === null || val === undefined || val === '') return '-'
|
||||||
|
const num = Number(val)
|
||||||
|
if (Number.isNaN(num)) return val
|
||||||
|
return num.toFixed(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatFeeAmount(val) {
|
||||||
|
if (val === null || val === undefined || val === '') return '-'
|
||||||
|
const num = Number(val)
|
||||||
|
if (Number.isNaN(num)) return val
|
||||||
|
return num.toFixed(3)
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatWeight(val) {
|
||||||
|
if (val === null || val === undefined || val === '') return '-'
|
||||||
|
const num = Number(val)
|
||||||
|
if (Number.isNaN(num)) return val
|
||||||
|
return num.toFixed(3)
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatRate(val) {
|
||||||
|
if (val === null || val === undefined || val === '') return '-'
|
||||||
|
const num = Number(val)
|
||||||
|
if (Number.isNaN(num)) return val
|
||||||
|
return num.toFixed(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDateTime(val) {
|
||||||
|
if (!val) return '-'
|
||||||
|
const d = new Date(val)
|
||||||
|
if (Number.isNaN(d.getTime())) return val
|
||||||
|
const pad = n => String(n).padStart(2, '0')
|
||||||
|
return d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate()) + ' ' + pad(d.getHours()) + ':' + pad(d.getMinutes()) + ':' + pad(d.getSeconds())
|
||||||
|
}
|
||||||
|
|
||||||
|
const billingFailStatusOptions = [
|
||||||
|
{ label: '计费成功', value: 0 },
|
||||||
|
{ label: '销售价未匹配产品', value: 1 },
|
||||||
|
{ label: '销售价未匹配国家', value: 2 },
|
||||||
|
{ label: '销售价未匹配重量段', value: 3 },
|
||||||
|
{ label: '产品价未匹配产品', value: 23 },
|
||||||
|
{ label: '产品价未匹配国家', value: 24 },
|
||||||
|
{ label: '产品价未匹配重量段', value: 25 },
|
||||||
|
{ label: '未绑定套餐', value: 4 },
|
||||||
|
{ label: '套餐未启用/无生效版本', value: 5 },
|
||||||
|
{ label: '已生成应收账单', value: 6 },
|
||||||
|
{ label: '产品档案缺失', value: 7 },
|
||||||
|
{ label: '未命中价格', value: 8 },
|
||||||
|
{ label: '分区无价格', value: 9 },
|
||||||
|
{ label: '邮编必填', value: 10 },
|
||||||
|
{ label: '邮编未匹配分区', value: 11 },
|
||||||
|
{ label: '上游订单不存在', value: 12 },
|
||||||
|
{ label: '上游订单号为空', value: 13 },
|
||||||
|
{ label: '上游客户为空', value: 14 },
|
||||||
|
{ label: '上游产品为空', value: 15 },
|
||||||
|
{ label: '上游重量无效', value: 16 },
|
||||||
|
{ label: '计费时间为空', value: 17 },
|
||||||
|
{ label: '退费订单无法解析', value: 18 },
|
||||||
|
{ label: '客户代码为空', value: 19 },
|
||||||
|
{ label: '客户已停用', value: 20 },
|
||||||
|
{ label: '运费为空', value: 21 },
|
||||||
|
{ label: '未知失败', value: 22 },
|
||||||
|
{ label: '未计费', value: 26 }
|
||||||
|
]
|
||||||
|
|
||||||
|
function billingFailLabel(status) {
|
||||||
|
const code = status == null ? 0 : Number(status)
|
||||||
|
const hit = billingFailStatusOptions.find(item => item.value === code)
|
||||||
|
return hit ? hit.label : '未知失败'
|
||||||
|
}
|
||||||
|
|
||||||
|
function billingFailTagType(status) {
|
||||||
|
const code = status == null ? 0 : Number(status)
|
||||||
|
if (code === 26) return 'info'
|
||||||
|
if (code > 0) return 'danger'
|
||||||
|
return 'success'
|
||||||
|
}
|
||||||
|
|
||||||
|
function roundModeLabel(mode) {
|
||||||
|
const map = { UP: '向上取值', DOWN: '向下取整', HALF_UP: '四舍五入' }
|
||||||
|
return map[mode] || mode || '四舍五入'
|
||||||
|
}
|
||||||
|
|
||||||
|
function payFeeTypeLabel(row) {
|
||||||
|
const name = String(row?.feeName || row?.fee_name || '').trim()
|
||||||
|
if (row?.feeType === 'LADING' || row?.feeSource === 'LADING') return name || '提单费用'
|
||||||
|
return feeTypeLabel(row?.feeType) || row?.feeType || '-'
|
||||||
|
}
|
||||||
|
|
||||||
|
function feeTypeLabel(type) {
|
||||||
|
const found = (bms_fee_type.value || []).find(d => d.value === type)
|
||||||
|
return found ? found.label : ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function feeTypeTag(type) {
|
||||||
|
if (type === 'FREIGHT') return ''
|
||||||
|
if (type === 'REGISTRATION') return 'warning'
|
||||||
|
if (type === 'SURCHARGE') return 'danger'
|
||||||
|
return 'info'
|
||||||
|
}
|
||||||
|
|
||||||
|
function displayCurrency(v) {
|
||||||
|
if (!v || v === 'RMB' || v === 'rmb') return 'CNY'
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
function displayFeeName(row) {
|
||||||
|
const typeLabel = feeTypeLabel(row.feeType)
|
||||||
|
const name = String(row.feeName || row.fee_name || '').trim()
|
||||||
|
const isSurcharge = row.feeType === 'SURCHARGE' || row.feeType === '附加费'
|
||||||
|
if (isSurcharge && name && name !== typeLabel && name !== 'SURCHARGE' && name !== '附加费') {
|
||||||
|
return name
|
||||||
|
}
|
||||||
|
return name || typeLabel || row.feeType || '-'
|
||||||
|
}
|
||||||
|
|
||||||
|
function refundLabel(status) {
|
||||||
|
const map = { NONE: '未退费', REFUNDED: '已退费' }
|
||||||
|
return map[status] || status || '未退费'
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.bill-detail-wrap { min-height: 240px; }
|
||||||
|
.pay-generate { margin-bottom: 8px; }
|
||||||
|
.bill-detail { padding-bottom: 8px; }
|
||||||
|
.detail-block { margin-bottom: 20px; }
|
||||||
|
.detail-block:last-child { margin-bottom: 0; }
|
||||||
|
.sec-title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
margin: 0 0 12px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
.sec-title::before {
|
||||||
|
content: '';
|
||||||
|
width: 3px;
|
||||||
|
height: 14px;
|
||||||
|
border-radius: 2px;
|
||||||
|
background: var(--el-color-primary);
|
||||||
|
}
|
||||||
|
.amount-summary {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(5, 1fr);
|
||||||
|
gap: 10px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
.amount-card {
|
||||||
|
padding: 12px 14px;
|
||||||
|
background: #f7f8fa;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
.amount-card.is-total { background: #fff1f0; }
|
||||||
|
.amount-label { font-size: 12px; color: #909399; line-height: 1.2; }
|
||||||
|
.amount-value {
|
||||||
|
margin-top: 6px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
.amount-card.is-total .amount-value { color: #f56c6c; }
|
||||||
|
.detail-desc :deep(.el-descriptions__label) {
|
||||||
|
width: 108px;
|
||||||
|
color: #909399;
|
||||||
|
font-weight: 400;
|
||||||
|
background: #fafbfc;
|
||||||
|
}
|
||||||
|
.detail-desc :deep(.el-descriptions__content) { color: #303133; }
|
||||||
|
.detail-desc :deep(.el-descriptions__cell) { padding: 9px 12px; }
|
||||||
|
.fee-amount { font-variant-numeric: tabular-nums; font-weight: 500; }
|
||||||
|
</style>
|
||||||
@@ -29,18 +29,22 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-row class="mb8">
|
<el-row class="mb8" align="middle">
|
||||||
<el-button type="primary" plain icon="RefreshRight" :loading="recalcRunning" v-hasPermi="['price:payOrder:recalc']" @click="openRecalc">费用重算</el-button>
|
<el-button type="primary" plain icon="RefreshRight" :loading="recalcRunning" v-hasPermi="['price:payOrder:recalc']" @click="openRecalc">费用重算</el-button>
|
||||||
|
<el-button type="primary" plain icon="Plus" v-hasPermi="['price:payOrder:feeBatch']" @click="openBatch">新增费用</el-button>
|
||||||
|
<span v-if="selectedOrders.length" class="picked-count">已选 {{ selectedOrders.length }} 个订单</span>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="rows" border>
|
<el-table ref="orderTableRef" v-loading="loading" :data="rows" row-key="billId" border @selection-change="onSelectionChange">
|
||||||
|
<el-table-column type="selection" width="48" reserve-selection fixed="left" />
|
||||||
<el-table-column prop="orderNo" label="订单号" min-width="160" fixed="left" show-overflow-tooltip />
|
<el-table-column prop="orderNo" label="订单号" min-width="160" fixed="left" show-overflow-tooltip />
|
||||||
<el-table-column prop="ladingNo" label="提单号" min-width="150" fixed="left" show-overflow-tooltip>
|
<el-table-column prop="ladingNo" label="提单号" min-width="150" fixed="left" show-overflow-tooltip>
|
||||||
<template #default="{ row }">{{ row.ladingNo || '-' }}</template>
|
<template #default="{ row }">{{ row.ladingNo || '-' }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="trackingNo" label="运单号" min-width="150" show-overflow-tooltip />
|
<el-table-column prop="trackingNo" label="运单号" min-width="150" show-overflow-tooltip />
|
||||||
<el-table-column prop="customerName" label="客户" min-width="140" show-overflow-tooltip />
|
<el-table-column prop="customerCode" label="客户编码" min-width="140" show-overflow-tooltip>
|
||||||
<el-table-column prop="productName" label="产品" min-width="160" show-overflow-tooltip />
|
<template #default="{ row }">{{ row.customerCode || '-' }}</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="countryName" label="目的国" width="110" show-overflow-tooltip />
|
<el-table-column prop="countryName" label="目的国" width="110" show-overflow-tooltip />
|
||||||
<el-table-column prop="destPostcode" label="邮编" width="120" show-overflow-tooltip>
|
<el-table-column prop="destPostcode" label="邮编" width="120" show-overflow-tooltip>
|
||||||
<template #default="{ row }">{{ row.destPostcode || '-' }}</template>
|
<template #default="{ row }">{{ row.destPostcode || '-' }}</template>
|
||||||
@@ -77,7 +81,7 @@
|
|||||||
</el-table>
|
</el-table>
|
||||||
<pagination v-show="total > 0" :total="total" v-model:page="query.pageNum" v-model:limit="query.pageSize" @pagination="loadList" />
|
<pagination v-show="total > 0" :total="total" v-model:page="query.pageNum" v-model:limit="query.pageSize" @pagination="loadList" />
|
||||||
|
|
||||||
<bill-detail v-model="detailOpen" title="订单详情" :loading="detailLoading" :detail="detail" :show-income="false" />
|
<pay-order-detail v-model="detailOpen" title="订单详情" :loading="detailLoading" :detail="detail" @updated="onDetailUpdated" />
|
||||||
|
|
||||||
<el-dialog v-model="feeOpen" :title="feeTitle" width="1280px" append-to-body destroy-on-close>
|
<el-dialog v-model="feeOpen" :title="feeTitle" width="1280px" append-to-body destroy-on-close>
|
||||||
<div v-loading="feeLoading" class="fee-board">
|
<div v-loading="feeLoading" class="fee-board">
|
||||||
@@ -172,6 +176,63 @@
|
|||||||
<pagination v-show="logTotal > 0" :total="logTotal" v-model:page="logQuery.pageNum" v-model:limit="logQuery.pageSize" @pagination="loadLogs" />
|
<pagination v-show="logTotal > 0" :total="logTotal" v-model:page="logQuery.pageNum" v-model:limit="logQuery.pageSize" @pagination="loadLogs" />
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog v-model="batchOpen" title="批量新增费用" width="1080px" append-to-body destroy-on-close :close-on-click-modal="false">
|
||||||
|
<div class="batch-block batch-orders">
|
||||||
|
<div class="fee-head">已选订单({{ batchOrders.length }})</div>
|
||||||
|
<div class="batch-order-list">
|
||||||
|
<el-tag
|
||||||
|
v-for="row in batchOrders"
|
||||||
|
:key="row.billId"
|
||||||
|
closable
|
||||||
|
effect="plain"
|
||||||
|
@close="removeBatchOrder(row)"
|
||||||
|
>{{ row.orderNo || '-' }}</el-tag>
|
||||||
|
<span v-if="!batchOrders.length" class="batch-order-empty">没有订单</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="batch-block">
|
||||||
|
<div class="fee-head">新增费用</div>
|
||||||
|
<div class="fee-tools">
|
||||||
|
<el-button type="primary" plain size="small" @click="addBatchFee">增加一行</el-button>
|
||||||
|
</div>
|
||||||
|
<el-table class="fee-table" :data="batchFees" border empty-text="请增加费用">
|
||||||
|
<el-table-column label="费用项" min-width="160" header-align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-select v-model="row.feeType" filterable placeholder="选择费用项">
|
||||||
|
<el-option v-for="item in (bms_fee_type || [])" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="金额" min-width="120" header-align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-input-number v-model="row.amount" :precision="3" :controls="false" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="币种" min-width="120" header-align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-select v-model="row.currency" filterable placeholder="选择币种">
|
||||||
|
<el-option v-for="item in (bms_currency || [])" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="说明" min-width="180" header-align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-input v-model="row.remark" maxlength="200" placeholder="选填" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="80" align="center" class-name="fee-op">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button link type="danger" @click="removeBatchFee(row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="batchOpen = false">取消</el-button>
|
||||||
|
<el-button type="primary" :loading="batchSaving" @click="submitBatch">确认</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
<el-dialog v-model="recalcOpen" title="费用重算" width="720px" append-to-body :close-on-click-modal="false">
|
<el-dialog v-model="recalcOpen" title="费用重算" width="720px" append-to-body :close-on-click-modal="false">
|
||||||
<el-form label-width="90px">
|
<el-form label-width="90px">
|
||||||
<el-form-item label="重算方式">
|
<el-form-item label="重算方式">
|
||||||
@@ -252,9 +313,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="PayOrderList">
|
<script setup name="PayOrderList">
|
||||||
import { addPayOrderFee, cancelPayOrderRecalc, getPayOrder, getPayOrderRecalcTask, listPayOrder, listPayOrderFeeLogs, listPayOrderFees, pollPayOrderRecalc, removePayOrderFee, submitPayOrderRecalc } from '@/api/price/payOrder'
|
import { addPayOrderFee, addPayOrderFees, cancelPayOrderRecalc, getPayOrder, getPayOrderRecalcTask, listPayOrder, listPayOrderFeeLogs, listPayOrderFees, pollPayOrderRecalc, removePayOrderFee, submitPayOrderRecalc } from '@/api/price/payOrder'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import BillDetail from '../components/BillDetail.vue'
|
import PayOrderDetail from './PayOrderDetail.vue'
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
const { bms_pay_calc_status, bms_fee_type, bms_currency, bms_pay_fee_log_type } = useDict('bms_pay_calc_status', 'bms_fee_type', 'bms_currency', 'bms_pay_fee_log_type')
|
const { bms_pay_calc_status, bms_fee_type, bms_currency, bms_pay_fee_log_type } = useDict('bms_pay_calc_status', 'bms_fee_type', 'bms_currency', 'bms_pay_fee_log_type')
|
||||||
@@ -263,6 +324,14 @@ const loading = ref(false)
|
|||||||
const rows = ref([])
|
const rows = ref([])
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
const query = reactive({ orderNo: '', ladingNo: '', customerName: '', pageNum: 1, pageSize: 20 })
|
const query = reactive({ orderNo: '', ladingNo: '', customerName: '', pageNum: 1, pageSize: 20 })
|
||||||
|
const orderTableRef = ref()
|
||||||
|
const selectedMap = ref(new Map())
|
||||||
|
const selectedOrders = computed(() => Array.from(selectedMap.value.values()))
|
||||||
|
const batchOpen = ref(false)
|
||||||
|
const batchSaving = ref(false)
|
||||||
|
const batchOrders = ref([])
|
||||||
|
const batchFees = ref([])
|
||||||
|
let batchFeeSeed = 1
|
||||||
|
|
||||||
const detailOpen = ref(false)
|
const detailOpen = ref(false)
|
||||||
const detailLoading = ref(false)
|
const detailLoading = ref(false)
|
||||||
@@ -397,6 +466,30 @@ function reset() {
|
|||||||
search()
|
search()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function snapshotOrder(row) {
|
||||||
|
return {
|
||||||
|
billId: row.billId,
|
||||||
|
orderNo: row.orderNo,
|
||||||
|
ladingNo: row.ladingNo,
|
||||||
|
customerName: row.customerName,
|
||||||
|
productName: row.productName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSelectionChange(selection) {
|
||||||
|
if (loading.value) return
|
||||||
|
const pageIds = new Set((rows.value || []).map(row => String(row.billId)))
|
||||||
|
const next = new Map(selectedMap.value)
|
||||||
|
for (const id of pageIds) next.delete(id)
|
||||||
|
for (const row of selection || []) next.set(String(row.billId), snapshotOrder(row))
|
||||||
|
selectedMap.value = next
|
||||||
|
}
|
||||||
|
|
||||||
|
function syncSelection() {
|
||||||
|
const selection = orderTableRef.value?.getSelectionRows?.() || []
|
||||||
|
onSelectionChange(selection)
|
||||||
|
}
|
||||||
|
|
||||||
function loadList() {
|
function loadList() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
listPayOrder(query).then(res => {
|
listPayOrder(query).then(res => {
|
||||||
@@ -404,6 +497,98 @@ function loadList() {
|
|||||||
total.value = res.total || 0
|
total.value = res.total || 0
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
|
nextTick(syncSelection)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function emptyBatchFee() {
|
||||||
|
batchFeeSeed += 1
|
||||||
|
return { key: batchFeeSeed, level: '4', feeType: '', amount: null, currency: 'CNY', remark: '' }
|
||||||
|
}
|
||||||
|
|
||||||
|
function openBatch() {
|
||||||
|
if (!selectedOrders.value.length) {
|
||||||
|
proxy.$modal.msgWarning('请先勾选订单')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
batchOrders.value = selectedOrders.value.map(row => ({ ...row }))
|
||||||
|
batchFees.value = [emptyBatchFee()]
|
||||||
|
batchOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeBatchOrder(row) {
|
||||||
|
const id = String(row.billId)
|
||||||
|
batchOrders.value = batchOrders.value.filter(item => String(item.billId) !== id)
|
||||||
|
const stored = selectedMap.value.get(id)
|
||||||
|
const current = (rows.value || []).find(item => String(item.billId) === id)
|
||||||
|
orderTableRef.value?.toggleRowSelection(current || stored || row, false)
|
||||||
|
const next = new Map(selectedMap.value)
|
||||||
|
next.delete(id)
|
||||||
|
selectedMap.value = next
|
||||||
|
}
|
||||||
|
|
||||||
|
function addBatchFee() {
|
||||||
|
if (batchFees.value.length >= 20) {
|
||||||
|
proxy.$modal.msgWarning('一次最多增加20条费用')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
batchFees.value.push(emptyBatchFee())
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeBatchFee(row) {
|
||||||
|
batchFees.value = batchFees.value.filter(item => item !== row)
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitBatch() {
|
||||||
|
if (!batchOrders.value.length) {
|
||||||
|
proxy.$modal.msgWarning('请勾选订单')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!batchFees.value.length) {
|
||||||
|
proxy.$modal.msgWarning('请增加费用')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const fees = []
|
||||||
|
for (const row of batchFees.value) {
|
||||||
|
if (!row.feeType) {
|
||||||
|
proxy.$modal.msgWarning('请选择费用项')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (row.amount === null || row.amount === undefined || row.amount === '') {
|
||||||
|
proxy.$modal.msgWarning('请填写金额')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!row.currency) {
|
||||||
|
proxy.$modal.msgWarning('请选择币种')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const dict = (bms_fee_type.value || []).find(item => item.value === row.feeType)
|
||||||
|
fees.push({
|
||||||
|
feeType: row.feeType,
|
||||||
|
feeName: dict ? dict.label : row.feeType,
|
||||||
|
level: '4',
|
||||||
|
amount: row.amount,
|
||||||
|
currency: row.currency,
|
||||||
|
remark: row.remark
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const orderCount = batchOrders.value.length
|
||||||
|
proxy.$modal.confirm('确认为 ' + orderCount + ' 个订单各增加 ' + fees.length + ' 条手工费用?').then(() => {
|
||||||
|
batchSaving.value = true
|
||||||
|
return addPayOrderFees({
|
||||||
|
billIds: batchOrders.value.map(row => String(row.billId)),
|
||||||
|
fees
|
||||||
|
})
|
||||||
|
}).then(() => {
|
||||||
|
proxy.$modal.msgSuccess('已为 ' + orderCount + ' 个订单增加费用')
|
||||||
|
batchOpen.value = false
|
||||||
|
selectedMap.value = new Map()
|
||||||
|
orderTableRef.value?.clearSelection()
|
||||||
|
loadList()
|
||||||
|
}).catch(() => {
|
||||||
|
/* 取消或接口失败时保留弹框 */
|
||||||
|
}).finally(() => {
|
||||||
|
batchSaving.value = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,6 +603,12 @@ function openDetail(row) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onDetailUpdated(data) {
|
||||||
|
if (data) {
|
||||||
|
detail.value = data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function openFees(row) {
|
function openFees(row) {
|
||||||
feeTitle.value = (row.orderNo || '订单') + '的应付费用'
|
feeTitle.value = (row.orderNo || '订单') + '的应付费用'
|
||||||
feeBillId.value = row.billId
|
feeBillId.value = row.billId
|
||||||
@@ -831,6 +1022,20 @@ loadList()
|
|||||||
border: 1px solid var(--el-border-color);
|
border: 1px solid var(--el-border-color);
|
||||||
}
|
}
|
||||||
.fee-tools { margin-bottom: 8px; text-align: right; }
|
.fee-tools { margin-bottom: 8px; text-align: right; }
|
||||||
|
.picked-count { margin-left: 12px; color: var(--el-text-color-secondary); font-size: 13px; }
|
||||||
|
.batch-block { margin-bottom: 16px; }
|
||||||
|
.batch-order-list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
max-height: 132px;
|
||||||
|
overflow: auto;
|
||||||
|
padding: 10px 12px;
|
||||||
|
border: 1px solid var(--el-border-color);
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
.batch-orders .fee-head { margin-bottom: 0; }
|
||||||
|
.batch-order-empty { color: var(--el-text-color-secondary); font-size: 13px; line-height: 24px; }
|
||||||
.log-change { line-height: 1.6; }
|
.log-change { line-height: 1.6; }
|
||||||
.log-empty { color: var(--el-text-color-secondary); }
|
.log-empty { color: var(--el-text-color-secondary); }
|
||||||
.rebill-progress__msg { margin-top: 12px; color: var(--el-text-color-regular); }
|
.rebill-progress__msg { margin-top: 12px; color: var(--el-text-color-regular); }
|
||||||
|
|||||||
Reference in New Issue
Block a user