Compare commits

2 Commits

Author SHA1 Message Date
wuweihua cf336f7a67 新增按国家去重区块标题接口,优化计费列表请求方式 2026-11-12 13:45:09 +08:00
wuweihua d2c75e0c51 修改计费逻辑 2026-11-12 11:07:13 +08:00
27 changed files with 493 additions and 113 deletions
@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.bms.common.annotation.Log; import com.bms.common.annotation.Log;
@@ -43,6 +44,15 @@ public class PayPostcodeController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/** 按国家去重区块,供附加费编辑分区下拉 */
@PreAuthorize("@ss.hasPermi('data:payPostcode:list')")
@GetMapping("/blockOptions")
public AjaxResult blockOptions(@RequestParam(required = false) String countryCode,
@RequestParam(required = false) String countryName)
{
return success(payPostcodeService.selectBlockTitlesByCountry(countryCode, countryName));
}
@PreAuthorize("@ss.hasPermi('data:payPostcode:query')") @PreAuthorize("@ss.hasPermi('data:payPostcode:query')")
@GetMapping("/{groupId}") @GetMapping("/{groupId}")
public AjaxResult getInfo(@PathVariable Long groupId) public AjaxResult getInfo(@PathVariable Long groupId)
@@ -147,6 +147,22 @@ public class BillingController extends BaseController
@PreAuthorize("@ss.hasPermi('price:billing:bill')") @PreAuthorize("@ss.hasPermi('price:billing:bill')")
@GetMapping("/bill/list") @GetMapping("/bill/list")
public TableDataInfo billList(PrcOrderBill query) public TableDataInfo billList(PrcOrderBill query)
{
return doBillList(query);
}
/**
* POST 计费列表:大批单号等筛选放请求体,避免 GET URL 过长触发 HTTP 431。
* pageNum/pageSize 仍走 URL 查询参数,供 PageHelper 读取。
*/
@PreAuthorize("@ss.hasPermi('price:billing:bill')")
@PostMapping("/bill/list")
public TableDataInfo billListPost(@RequestBody(required = false) PrcOrderBill query)
{
return doBillList(query);
}
private TableDataInfo doBillList(PrcOrderBill query)
{ {
if (query == null) if (query == null)
{ {
@@ -220,6 +236,19 @@ public class BillingController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/**
* POST 列表:筛选(尤其是大批量单号)放请求体,避免 GET URL 过长触发 HTTP 431。
* pageNum/pageSize 仍走 URL 查询参数,供 TableSupport/PageHelper 读取。
*/
@PreAuthorize("@ss.hasPermi('price:orderBill:list')")
@PostMapping("/orderBill/list")
public TableDataInfo orderBillListPost(@RequestBody(required = false) PrcOrderBill query)
{
startPage();
List<PrcOrderBill> list = prcOrderBillService.selectBillList(query == null ? new PrcOrderBill() : query);
return getDataTable(list);
}
/** 订单列表弹窗:按 billId 查询计费失败原因(受数据权限控制)。 */ /** 订单列表弹窗:按 billId 查询计费失败原因(受数据权限控制)。 */
@PreAuthorize("@ss.hasPermi('price:orderBill:list')") @PreAuthorize("@ss.hasPermi('price:orderBill:list')")
@@ -20,6 +20,7 @@ import com.bms.common.core.page.TableDataInfo;
import com.bms.common.enums.BusinessType; import com.bms.common.enums.BusinessType;
import com.bms.price.domain.PrcSurcharge; import com.bms.price.domain.PrcSurcharge;
import com.bms.price.domain.PrcSurchargeRel; import com.bms.price.domain.PrcSurchargeRel;
import com.bms.price.service.IPayPostcodeService;
import com.bms.price.service.IPrcSurchargeRelService; import com.bms.price.service.IPrcSurchargeRelService;
import com.bms.price.service.IPrcSurchargeService; import com.bms.price.service.IPrcSurchargeService;
@@ -38,6 +39,9 @@ public class SurchargeController extends BaseController
@Autowired @Autowired
private IPrcSurchargeRelService surchargeRelService; private IPrcSurchargeRelService surchargeRelService;
@Autowired
private IPayPostcodeService payPostcodeService;
@PreAuthorize("@ss.hasPermi('price:surcharge:list')") @PreAuthorize("@ss.hasPermi('price:surcharge:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(PrcSurcharge surcharge) public TableDataInfo list(PrcSurcharge surcharge)
@@ -47,6 +51,15 @@ public class SurchargeController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/** 按国家从应付邮编配置拉取区块/分区选项 */
@PreAuthorize("@ss.hasPermi('price:surcharge:list') or @ss.hasPermi('price:surcharge:query') or @ss.hasPermi('price:surcharge:add') or @ss.hasPermi('price:surcharge:edit')")
@GetMapping("/blockOptions")
public AjaxResult blockOptions(@RequestParam(required = false) String countryCode,
@RequestParam(required = false) String countryName)
{
return success(payPostcodeService.selectBlockTitlesByCountry(countryCode, countryName));
}
@PreAuthorize("@ss.hasPermi('price:surcharge:query')") @PreAuthorize("@ss.hasPermi('price:surcharge:query')")
@GetMapping("/{scId}") @GetMapping("/{scId}")
public AjaxResult getInfo(@PathVariable Long scId) public AjaxResult getInfo(@PathVariable Long scId)
@@ -16,8 +16,10 @@ public class PrcSurcharge extends BaseEntity
private String scName; private String scName;
/** 字典 bms_fee_type */ /** 字典 bms_fee_type */
private String feeType; private String feeType;
/** FIXED / WEIGHT / RATE */ /** 计费方式:ALWAYS/每票都收、POSTCODE/命中邮编、ZONE/命中分区、EXTRA_KG/超重续收、WEIGHT/超重、SIZE/超尺寸、RETURN/退件、MANUAL/暂不计费 */
private String chargeType; private String chargeType;
/** 渠道产品(字典 payment_product_type.dict_value) */
private String dictValue;
private BigDecimal chargeValue; private BigDecimal chargeValue;
private String currency; private String currency;
/** 字典 bms_round_mode:UP / DOWN / HALF_UP */ /** 字典 bms_round_mode:UP / DOWN / HALF_UP */
@@ -29,6 +31,8 @@ public class PrcSurcharge extends BaseEntity
public static final String IS_DEL_YES = "1"; public static final String IS_DEL_YES = "1";
private String isDel; private String isDel;
private String countryCode; private String countryCode;
/** 分区/区块(对应 pay_postcode_group.block_title) */
private String blockTitle;
private String scNote; private String scNote;
private Long tmsId; private Long tmsId;
} }
@@ -60,6 +60,9 @@ public class TmsPriceBillRequest extends TmsPriceQuoteRequest
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date pickupDate; private Date pickupDate;
private String orderRemark; private String orderRemark;
/** 上游 PRODUCT_FLOOR_CODE;打单计费在账单落库前也可直接用 */
private String productFloorCode;
/** 上游 TAB_ORDER 整行,用于写入 prc_order_bill_ext 扩展字段 */ /** 上游 TAB_ORDER 整行,用于写入 prc_order_bill_ext 扩展字段 */
private Map<String, Object> upstreamRow; private Map<String, Object> upstreamRow;
@@ -22,7 +22,7 @@ public class TmsPriceQuoteRequest implements Serializable
private String productCode; private String productCode;
/** /**
* 打单套餐(LABEL)试算/计费用渠道ID;计费也可从订单扩展 productChannelId 解析。 * 打单套餐(LABEL)试算用渠道ID;计费优先取订单 product_floor_code。
*/ */
private String channelId; private String channelId;
@@ -10,6 +10,10 @@ public interface PayPostcodeMapper
{ {
List<PayPostcodeGroup> selectGroupList(PayPostcodeGroup query); List<PayPostcodeGroup> selectGroupList(PayPostcodeGroup query);
/** 按国家去重区块标题 */
List<String> selectBlockTitlesByCountry(@Param("countryCode") String countryCode,
@Param("countryName") String countryName);
PayPostcodeGroup selectGroupById(Long groupId); PayPostcodeGroup selectGroupById(Long groupId);
int updateGroup(PayPostcodeGroup group); int updateGroup(PayPostcodeGroup group);
@@ -44,6 +44,7 @@ public class OracleOrderBillMapper
} }
req.setProductCode(product); req.setProductCode(product);
req.setProductName(firstStr(row, "LINE_NAME", "PRODUCT_NAME")); req.setProductName(firstStr(row, "LINE_NAME", "PRODUCT_NAME"));
req.setProductFloorCode(firstStr(row, "PRODUCT_FLOOR_CODE"));
req.setCountryCode(firstStr(row, "COUNTRY")); req.setCountryCode(firstStr(row, "COUNTRY"));
String countryName = firstStr(row, "COUNTRY_NAME", "COUNTRY_EINGTH_NAME", "COUNTRY"); String countryName = firstStr(row, "COUNTRY_NAME", "COUNTRY_EINGTH_NAME", "COUNTRY");
req.setCountryName(countryName); req.setCountryName(countryName);
@@ -10,6 +10,9 @@ public interface IPayPostcodeService
{ {
List<PayPostcodeGroup> selectGroupList(PayPostcodeGroup query); List<PayPostcodeGroup> selectGroupList(PayPostcodeGroup query);
/** 附加费分区下拉:按国家去重区块标题 */
List<String> selectBlockTitlesByCountry(String countryCode, String countryName);
PayPostcodeGroup selectGroupById(Long groupId); PayPostcodeGroup selectGroupById(Long groupId);
int updateGroup(PayPostcodeGroup group); int updateGroup(PayPostcodeGroup group);
@@ -34,6 +34,12 @@ public class PayPostcodeServiceImpl implements IPayPostcodeService
return payPostcodeMapper.selectGroupList(query); return payPostcodeMapper.selectGroupList(query);
} }
@Override
public List<String> selectBlockTitlesByCountry(String countryCode, String countryName)
{
return payPostcodeMapper.selectBlockTitlesByCountry(countryCode, countryName);
}
@Override @Override
public PayPostcodeGroup selectGroupById(Long groupId) public PayPostcodeGroup selectGroupById(Long groupId)
{ {
@@ -1716,21 +1716,13 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
return BigDecimal.ZERO; return BigDecimal.ZERO;
} }
RoundingMode rm = resolveFeeRoundingMode(surcharge.getRoundMode()); RoundingMode rm = resolveFeeRoundingMode(surcharge.getRoundMode());
String chargeType = surcharge.getChargeType() == null ? "FIXED" : surcharge.getChargeType().toUpperCase(); String chargeType = surcharge.getChargeType() == null ? "MANUAL" : surcharge.getChargeType().toUpperCase();
BigDecimal amount; // MANUAL=暂不计费;其他计费方式暂按固定金额 charge_value
if ("WEIGHT".equals(chargeType)) if ("MANUAL".equals(chargeType))
{ {
amount = surcharge.getChargeValue().multiply(nz(weight)); return BigDecimal.ZERO.setScale(4, rm);
} }
else if ("RATE".equals(chargeType)) return surcharge.getChargeValue().setScale(4, rm);
{
amount = nz(freightAmount).multiply(surcharge.getChargeValue());
}
else
{
amount = surcharge.getChargeValue();
}
return amount.setScale(4, rm);
} }
private RoundingMode resolveFeeRoundingMode(String roundMode) private RoundingMode resolveFeeRoundingMode(String roundMode)
@@ -3180,6 +3172,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
req.setCustomerName(bill.getCustomerName()); req.setCustomerName(bill.getCustomerName());
req.setProductCode(bill.getProductCode()); req.setProductCode(bill.getProductCode());
req.setProductName(resolveBillProductName(bill)); req.setProductName(resolveBillProductName(bill));
req.setProductFloorCode(bill.getProductFloorCode());
req.setCountryCode(bill.getCountryCode()); req.setCountryCode(bill.getCountryCode());
req.setCountryName(bill.getCountryName()); req.setCountryName(bill.getCountryName());
req.setDestPostcode(bill.getDestPostcode()); req.setDestPostcode(bill.getDestPostcode());
@@ -79,11 +79,13 @@ public class PrcSurchargeServiceImpl implements IPrcSurchargeService
fresh.setScName(surcharge.getScName()); fresh.setScName(surcharge.getScName());
fresh.setFeeType(StringUtils.isNotEmpty(surcharge.getFeeType()) ? surcharge.getFeeType() : old.getFeeType()); fresh.setFeeType(StringUtils.isNotEmpty(surcharge.getFeeType()) ? surcharge.getFeeType() : old.getFeeType());
fresh.setChargeType(surcharge.getChargeType()); fresh.setChargeType(surcharge.getChargeType());
fresh.setDictValue(surcharge.getDictValue());
fresh.setChargeValue(surcharge.getChargeValue()); fresh.setChargeValue(surcharge.getChargeValue());
fresh.setCurrency(surcharge.getCurrency()); fresh.setCurrency(surcharge.getCurrency());
fresh.setRoundMode(surcharge.getRoundMode()); fresh.setRoundMode(surcharge.getRoundMode());
fresh.setSsCode(old.getSsCode()); fresh.setSsCode(old.getSsCode());
fresh.setCountryCode(surcharge.getCountryCode()); fresh.setCountryCode(surcharge.getCountryCode());
fresh.setBlockTitle(surcharge.getBlockTitle());
fresh.setScNote(surcharge.getScNote()); fresh.setScNote(surcharge.getScNote());
applyInsertDefaults(fresh); applyInsertDefaults(fresh);
fresh.setCreateBy(operator); fresh.setCreateBy(operator);
@@ -99,10 +101,12 @@ public class PrcSurchargeServiceImpl implements IPrcSurchargeService
return eq(old.getScName(), updated.getScName()) return eq(old.getScName(), updated.getScName())
&& eq(old.getFeeType(), updated.getFeeType()) && eq(old.getFeeType(), updated.getFeeType())
&& eq(old.getChargeType(), updated.getChargeType()) && eq(old.getChargeType(), updated.getChargeType())
&& eq(old.getDictValue(), updated.getDictValue())
&& eqDecimal(old.getChargeValue(), updated.getChargeValue()) && eqDecimal(old.getChargeValue(), updated.getChargeValue())
&& eq(old.getCurrency(), updated.getCurrency()) && eq(old.getCurrency(), updated.getCurrency())
&& eq(old.getRoundMode(), updated.getRoundMode()) && eq(old.getRoundMode(), updated.getRoundMode())
&& eq(old.getCountryCode(), updated.getCountryCode()) && eq(old.getCountryCode(), updated.getCountryCode())
&& eq(old.getBlockTitle(), updated.getBlockTitle())
&& eq(old.getScNote(), updated.getScNote()); && eq(old.getScNote(), updated.getScNote());
} }
@@ -161,6 +165,10 @@ public class PrcSurchargeServiceImpl implements IPrcSurchargeService
{ {
surcharge.setRoundMode("HALF_UP"); surcharge.setRoundMode("HALF_UP");
} }
if (StringUtils.isEmpty(surcharge.getChargeType()))
{
surcharge.setChargeType("MANUAL");
}
} }
private void validate(PrcSurcharge surcharge) private void validate(PrcSurcharge surcharge)
@@ -32,6 +32,7 @@ import com.bms.price.domain.PayCostLine;
import com.bms.price.domain.PayOrderCostResult; import com.bms.price.domain.PayOrderCostResult;
import com.bms.price.domain.PayProduct; import com.bms.price.domain.PayProduct;
import com.bms.price.domain.PrcCustomerPriceSet; import com.bms.price.domain.PrcCustomerPriceSet;
import com.bms.price.domain.PrcOrderBill;
import com.bms.price.domain.PrcOrderBillExt; import com.bms.price.domain.PrcOrderBillExt;
import com.bms.price.domain.PrcPriceSet; import com.bms.price.domain.PrcPriceSet;
import com.bms.price.domain.PrcPriceSetDetail; import com.bms.price.domain.PrcPriceSetDetail;
@@ -52,8 +53,11 @@ import com.bms.price.enums.BillCustomerActiveStatus;
import com.bms.price.mapper.BmsProductCountryMapper; import com.bms.price.mapper.BmsProductCountryMapper;
import com.bms.price.mapper.BmsProductMapper; import com.bms.price.mapper.BmsProductMapper;
import com.bms.price.mapper.BmsRedlineProductCountryMapper; import com.bms.price.mapper.BmsRedlineProductCountryMapper;
import com.bms.masterdata.domain.ServiceChannel;
import com.bms.masterdata.mapper.ServiceChannelMapper;
import com.bms.price.mapper.PrcCustomerPriceSetMapper; import com.bms.price.mapper.PrcCustomerPriceSetMapper;
import com.bms.price.mapper.PrcOrderBillExtMapper; import com.bms.price.mapper.PrcOrderBillExtMapper;
import com.bms.price.mapper.PrcOrderBillMapper;
import com.bms.price.mapper.PrcPriceSetDetailMapper; import com.bms.price.mapper.PrcPriceSetDetailMapper;
import com.bms.price.mapper.PrcPriceSetMapper; import com.bms.price.mapper.PrcPriceSetMapper;
import com.bms.price.mapper.PrcPriceSetProductMapper; import com.bms.price.mapper.PrcPriceSetProductMapper;
@@ -143,6 +147,12 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
@Autowired @Autowired
private PrcOrderBillExtMapper orderBillExtMapper; private PrcOrderBillExtMapper orderBillExtMapper;
@Autowired
private PrcOrderBillMapper orderBillMapper;
@Autowired
private ServiceChannelMapper serviceChannelMapper;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public TmsPriceQuoteResult quote(TmsPriceQuoteRequest request) public TmsPriceQuoteResult quote(TmsPriceQuoteRequest request)
@@ -715,7 +725,10 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
return r; return r;
} }
/** 试算用 request.channelId;计费优先订单扩展 productChannelId。 */ /**
* 试算用 request.channelId;计费优先 prc_order_bill.product_floor_code,
* 没有再取 prc_order_bill_ext.product_floor_code,再解析为渠道ID。
*/
private String resolveLabelChannelId(TmsPriceQuoteRequest request) private String resolveLabelChannelId(TmsPriceQuoteRequest request)
{ {
if (request != null && StringUtils.isNotEmpty(request.getChannelId())) if (request != null && StringUtils.isNotEmpty(request.getChannelId()))
@@ -727,22 +740,48 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
return null; return null;
} }
TmsPriceBillRequest billReq = (TmsPriceBillRequest) request; TmsPriceBillRequest billReq = (TmsPriceBillRequest) request;
PrcOrderBillExt ext = null; String floorCode = emptyToNull(billReq.getProductFloorCode());
if (StringUtils.isNotEmpty(billReq.getOrderNo())) String orderNo = emptyToNull(billReq.getOrderNo());
if (StringUtils.isEmpty(floorCode) && StringUtils.isNotEmpty(orderNo))
{ {
ext = orderBillExtMapper.selectByOrderNo(billReq.getOrderNo().trim()); PrcOrderBill bill = orderBillMapper.selectPrcOrderBillByOrderNo(orderNo);
if (bill != null)
{
floorCode = emptyToNull(bill.getProductFloorCode());
}
} }
if (ext == null) if (StringUtils.isEmpty(floorCode) && StringUtils.isNotEmpty(orderNo))
{
PrcOrderBillExt ext = orderBillExtMapper.selectByOrderNo(orderNo);
if (ext != null)
{
floorCode = emptyToNull(ext.getProductFloorCode());
}
}
if (StringUtils.isEmpty(floorCode))
{ {
return null; return null;
} }
if (StringUtils.isNotEmpty(ext.getProductChannelId())) return resolveChannelIdByFloorCode(floorCode);
}
/** 将 product_floor_code 解析为 srv_service_channel.id(先按编码,再按ID) */
private String resolveChannelIdByFloorCode(String floorCode)
{
if (StringUtils.isEmpty(floorCode) || serviceChannelMapper == null)
{ {
return ext.getProductChannelId().trim(); return null;
} }
if (StringUtils.isNotEmpty(ext.getProductFloorCode())) String code = floorCode.trim();
ServiceChannel byCode = serviceChannelMapper.selectServiceChannelByCode(code);
if (byCode != null && StringUtils.isNotEmpty(byCode.getId()))
{ {
return ext.getProductFloorCode().trim(); return byCode.getId().trim();
}
ServiceChannel byId = serviceChannelMapper.selectServiceChannelById(code);
if (byId != null && StringUtils.isNotEmpty(byId.getId()))
{
return byId.getId().trim();
} }
return null; return null;
} }
@@ -1802,21 +1841,13 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
return BigDecimal.ZERO; return BigDecimal.ZERO;
} }
RoundingMode rm = resolveRoundingMode(rel.getRoundMode()); RoundingMode rm = resolveRoundingMode(rel.getRoundMode());
String chargeType = rel.getChargeType() == null ? "FIXED" : rel.getChargeType().toUpperCase(); String chargeType = rel.getChargeType() == null ? "MANUAL" : rel.getChargeType().toUpperCase();
BigDecimal amount; // MANUAL=暂不计费;其他计费方式暂按固定金额 charge_value
if ("WEIGHT".equals(chargeType)) if ("MANUAL".equals(chargeType))
{ {
amount = rel.getChargeValue().multiply(nvl(weight)); return BigDecimal.ZERO.setScale(2, rm);
} }
else if ("RATE".equals(chargeType)) return rel.getChargeValue().setScale(2, rm);
{
amount = nvl(freightAmount).multiply(rel.getChargeValue());
}
else
{
amount = rel.getChargeValue();
}
return amount.setScale(2, rm);
} }
private void persistQuote(String quoteKey, TmsPriceQuoteRequest request, BigDecimal weight, private void persistQuote(String quoteKey, TmsPriceQuoteRequest request, BigDecimal weight,
@@ -30,6 +30,26 @@
order by group_id desc order by group_id desc
</select> </select>
<select id="selectBlockTitlesByCountry" resultType="string">
select distinct block_title
from pay_postcode_group
where block_title is not null
and block_title &lt;&gt; ''
<if test="countryCode != null and countryCode != ''">
and (
upper(ifnull(country_code, '')) = upper(#{countryCode})
or upper(ifnull(catalog_country, '')) = upper(#{countryCode})
)
</if>
<if test="countryName != null and countryName != ''">
and (
country_name like concat('%', #{countryName}, '%')
or catalog_country like concat('%', #{countryName}, '%')
)
</if>
order by block_title asc
</select>
<select id="selectLineList" parameterType="com.bms.price.domain.PayPostcodeLine" resultType="com.bms.price.domain.PayPostcodeLine"> <select id="selectLineList" parameterType="com.bms.price.domain.PayPostcodeLine" resultType="com.bms.price.domain.PayPostcodeLine">
select line_id as lineId, group_id as groupId, country_name as countryName, country_code as countryCode, select line_id as lineId, group_id as groupId, country_name as countryName, country_code as countryCode,
region_name as regionName, region_name_cn as regionNameCn, city_name as cityName, region_code as regionCode, region_name as regionName, region_name_cn as regionNameCn, city_name as cityName, region_code as regionCode,
@@ -9,12 +9,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="scName" column="sc_name" /> <result property="scName" column="sc_name" />
<result property="feeType" column="fee_type" /> <result property="feeType" column="fee_type" />
<result property="chargeType" column="charge_type" /> <result property="chargeType" column="charge_type" />
<result property="dictValue" column="dict_value" />
<result property="chargeValue" column="charge_value" /> <result property="chargeValue" column="charge_value" />
<result property="currency" column="currency" /> <result property="currency" column="currency" />
<result property="roundMode" column="round_mode" /> <result property="roundMode" column="round_mode" />
<result property="ssCode" column="ss_code" /> <result property="ssCode" column="ss_code" />
<result property="isDel" column="is_del" /> <result property="isDel" column="is_del" />
<result property="countryCode" column="country_code" /> <result property="countryCode" column="country_code" />
<result property="blockTitle" column="block_title" />
<result property="scNote" column="sc_note" /> <result property="scNote" column="sc_note" />
<result property="tmsId" column="tms_id" /> <result property="tmsId" column="tms_id" />
<result property="createBy" column="created_by" /> <result property="createBy" column="created_by" />
@@ -24,8 +26,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectPrcSurchargeVo"> <sql id="selectPrcSurchargeVo">
select sc_id, sc_name, fee_type, charge_type, charge_value, currency, round_mode, ss_code, is_del, select sc_id, sc_name, fee_type, charge_type, dict_value, charge_value, currency, round_mode,
country_code, sc_note, tms_id, created_by, create_time, updated_by, update_time ss_code, is_del, country_code, block_title, sc_note, tms_id, created_by, create_time, updated_by, update_time
from prc_surcharge from prc_surcharge
</sql> </sql>
@@ -55,6 +57,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="chargeType != null and chargeType != ''"> <if test="chargeType != null and chargeType != ''">
AND charge_type = #{chargeType} AND charge_type = #{chargeType}
</if> </if>
<if test="dictValue != null and dictValue != ''">
AND dict_value = #{dictValue}
</if>
<if test="blockTitle != null and blockTitle != ''">
AND block_title like concat('%', #{blockTitle}, '%')
</if>
<if test="roundMode != null and roundMode != ''"> <if test="roundMode != null and roundMode != ''">
AND round_mode = #{roundMode} AND round_mode = #{roundMode}
</if> </if>
@@ -82,12 +90,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="scName != null and scName != ''">sc_name,</if> <if test="scName != null and scName != ''">sc_name,</if>
<if test="feeType != null and feeType != ''">fee_type,</if> <if test="feeType != null and feeType != ''">fee_type,</if>
<if test="chargeType != null and chargeType != ''">charge_type,</if> <if test="chargeType != null and chargeType != ''">charge_type,</if>
<if test="dictValue != null">dict_value,</if>
<if test="chargeValue != null">charge_value,</if> <if test="chargeValue != null">charge_value,</if>
<if test="currency != null and currency != ''">currency,</if> <if test="currency != null and currency != ''">currency,</if>
<if test="roundMode != null and roundMode != ''">round_mode,</if> <if test="roundMode != null and roundMode != ''">round_mode,</if>
<if test="ssCode != null and ssCode != ''">ss_code,</if> <if test="ssCode != null and ssCode != ''">ss_code,</if>
is_del, is_del,
<if test="countryCode != null">country_code,</if> <if test="countryCode != null">country_code,</if>
<if test="blockTitle != null">block_title,</if>
<if test="scNote != null">sc_note,</if> <if test="scNote != null">sc_note,</if>
<if test="tmsId != null">tms_id,</if> <if test="tmsId != null">tms_id,</if>
<if test="createBy != null and createBy != ''">created_by,</if> <if test="createBy != null and createBy != ''">created_by,</if>
@@ -96,12 +106,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="scName != null and scName != ''">#{scName},</if> <if test="scName != null and scName != ''">#{scName},</if>
<if test="feeType != null and feeType != ''">#{feeType},</if> <if test="feeType != null and feeType != ''">#{feeType},</if>
<if test="chargeType != null and chargeType != ''">#{chargeType},</if> <if test="chargeType != null and chargeType != ''">#{chargeType},</if>
<if test="dictValue != null">#{dictValue},</if>
<if test="chargeValue != null">#{chargeValue},</if> <if test="chargeValue != null">#{chargeValue},</if>
<if test="currency != null and currency != ''">#{currency},</if> <if test="currency != null and currency != ''">#{currency},</if>
<if test="roundMode != null and roundMode != ''">#{roundMode},</if> <if test="roundMode != null and roundMode != ''">#{roundMode},</if>
<if test="ssCode != null and ssCode != ''">#{ssCode},</if> <if test="ssCode != null and ssCode != ''">#{ssCode},</if>
ifnull(#{isDel}, '0'), ifnull(#{isDel}, '0'),
<if test="countryCode != null">#{countryCode},</if> <if test="countryCode != null">#{countryCode},</if>
<if test="blockTitle != null">#{blockTitle},</if>
<if test="scNote != null">#{scNote},</if> <if test="scNote != null">#{scNote},</if>
<if test="tmsId != null">#{tmsId},</if> <if test="tmsId != null">#{tmsId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
@@ -0,0 +1,55 @@
-- prc_surcharge: drop calc_rule; keep dict_value / block_title; charge_type stores billing mode
SET NAMES utf8mb4;
-- If calc_rule exists, copy into charge_type then drop
SET @col := (
SELECT COLUMN_NAME FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'prc_surcharge'
AND COLUMN_NAME = 'calc_rule'
LIMIT 1
);
SET @sql := IF(@col IS NULL,
'SELECT 1',
'UPDATE prc_surcharge SET charge_type = calc_rule WHERE calc_rule IS NOT NULL AND calc_rule <> ''''');
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
SET @col := (
SELECT COLUMN_NAME FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'prc_surcharge'
AND COLUMN_NAME = 'calc_rule'
LIMIT 1
);
SET @sql := IF(@col IS NULL,
'SELECT 1',
'ALTER TABLE prc_surcharge DROP COLUMN calc_rule');
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
SET @col := (
SELECT COLUMN_NAME FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'prc_surcharge'
AND COLUMN_NAME = 'dict_value'
LIMIT 1
);
SET @sql := IF(@col IS NULL,
'ALTER TABLE prc_surcharge ADD COLUMN dict_value varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT ''渠道产品 payment_product_type.dict_value'' AFTER charge_type',
'SELECT 1');
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
SET @col := (
SELECT COLUMN_NAME FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'prc_surcharge'
AND COLUMN_NAME = 'block_title'
LIMIT 1
);
SET @sql := IF(@col IS NULL,
'ALTER TABLE prc_surcharge ADD COLUMN block_title varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT ''分区/区块(pay_postcode_group.block_title)'' AFTER country_code',
'SELECT 1');
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
-- legacy amount modes: FIXED -> ALWAYS; RATE no longer used as amount mode -> MANUAL
UPDATE prc_surcharge SET charge_type = 'ALWAYS' WHERE charge_type IS NULL OR charge_type = '' OR upper(charge_type) = 'FIXED';
UPDATE prc_surcharge SET charge_type = 'MANUAL' WHERE upper(charge_type) = 'RATE';
+12 -4
View File
@@ -50,18 +50,26 @@ export function billOrder(data) {
/** Receivable bill list */ /** Receivable bill list */
export function listBill(query) { export function listBill(query) {
const { pageNum, pageSize, ...filters } = query || {}
return request({ return request({
url: '/price/billing/bill/list', url: '/price/billing/bill/list',
method: 'get', method: 'post',
params: query // 分页参数走 URL(PageHelper);筛选(大批单号)走 body,避免 HTTP 431
params: { pageNum, pageSize },
data: filters,
timeout: 120000
}) })
} }
export function listOrderBill(query) { export function listOrderBill(query) {
const { pageNum, pageSize, ...filters } = query || {}
return request({ return request({
url: '/price/billing/orderBill/list', url: '/price/billing/orderBill/list',
method: 'get', method: 'post',
params: query // 分页参数走 URL(PageHelper);筛选(大批单号)走 body,避免 HTTP 431
params: { pageNum, pageSize },
data: filters,
timeout: 120000
}) })
} }
+9
View File
@@ -37,6 +37,15 @@ export function listSurchargeOptions(query) {
}) })
} }
/** 按国家拉取应付邮编区块(分区下拉) */
export function listSurchargeBlockOptions(query) {
return request({
url: '/price/surcharge/blockOptions',
method: 'get',
params: query
})
}
/** 绑定附加费到产品/明细(scId + productCode + detailId) */ /** 绑定附加费到产品/明细(scId + productCode + detailId) */
export function addSurchargeRel(data) { export function addSurchargeRel(data) {
return request({ return request({
@@ -55,7 +55,7 @@ import SurchargeRelDialog from './SurchargeRelDialog.vue'
const emit = defineEmits(['success']) const emit = defineEmits(['success'])
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const { bms_round_mode, bms_charge_type } = useDict('bms_round_mode', 'bms_charge_type') const { bms_round_mode } = useDict('bms_round_mode')
const relRef = ref() const relRef = ref()
const visible = ref(false) const visible = ref(false)
@@ -107,9 +107,22 @@ function priceTypeLabel(val) {
return '产品价' return '产品价'
} }
const chargeTypeLabelMap = {
MANUAL: '暂不计费',
ALWAYS: '每票都收',
POSTCODE: '命中邮编',
ZONE: '命中分区',
EXTRA_KG: '超重续收',
WEIGHT: '超重',
SIZE: '超尺寸',
RETURN: '退件',
FIXED: '每票都收',
RATE: '暂不计费'
}
function chargeTypeLabel(val) { function chargeTypeLabel(val) {
const found = bms_charge_type.value.find(c => c.value === val) if (!val) return chargeTypeLabelMap.MANUAL
return found ? found.label : (val || '-') return chargeTypeLabelMap[val] || chargeTypeLabelMap[String(val).toUpperCase()] || val
} }
function roundModeLabel(val) { function roundModeLabel(val) {
@@ -120,7 +133,6 @@ function roundModeLabel(val) {
function formatChargeValue(row) { function formatChargeValue(row) {
if (row.chargeValue == null) return '-' if (row.chargeValue == null) return '-'
const v = Number(row.chargeValue) const v = Number(row.chargeValue)
if (row.chargeType === 'RATE') return (v * 100).toFixed(2) + '%'
return v + ' ' + (row.currency || 'CNY') return v + ' ' + (row.currency || 'CNY')
} }
@@ -55,7 +55,7 @@ import RedlineSurchargeRelDialog from './RedlineSurchargeRelDialog.vue'
const emit = defineEmits(['success']) const emit = defineEmits(['success'])
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const { bms_round_mode, bms_charge_type } = useDict('bms_round_mode', 'bms_charge_type') const { bms_round_mode } = useDict('bms_round_mode')
const relRef = ref() const relRef = ref()
const visible = ref(false) const visible = ref(false)
@@ -110,9 +110,22 @@ function priceTypeLabel(val) {
return '产品价' return '产品价'
} }
const chargeTypeLabelMap = {
MANUAL: '暂不计费',
ALWAYS: '每票都收',
POSTCODE: '命中邮编',
ZONE: '命中分区',
EXTRA_KG: '超重续收',
WEIGHT: '超重',
SIZE: '超尺寸',
RETURN: '退件',
FIXED: '每票都收',
RATE: '暂不计费'
}
function chargeTypeLabel(val) { function chargeTypeLabel(val) {
const found = bms_charge_type.value.find(c => c.value === val) if (!val) return chargeTypeLabelMap.MANUAL
return found ? found.label : (val || '-') return chargeTypeLabelMap[val] || chargeTypeLabelMap[String(val).toUpperCase()] || val
} }
function roundModeLabel(val) { function roundModeLabel(val) {
@@ -123,7 +136,6 @@ function roundModeLabel(val) {
function formatChargeValue(row) { function formatChargeValue(row) {
if (row.chargeValue == null) return '-' if (row.chargeValue == null) return '-'
const v = Number(row.chargeValue) const v = Number(row.chargeValue)
if (row.chargeType === 'RATE') return (v * 100).toFixed(2) + '%'
return v + ' ' + (row.currency || 'CNY') return v + ' ' + (row.currency || 'CNY')
} }
@@ -1,5 +1,5 @@
<template> <template>
<el-dialog :title="title" v-model="visible" width="640px" append-to-body> <el-dialog :title="title" v-model="visible" width="720px" append-to-body>
<basic-form ref="formRef" v-model="form" :schemas="schemas" label-width="100px" /> <basic-form ref="formRef" v-model="form" :schemas="schemas" label-width="100px" />
<template #footer> <template #footer>
<el-button type="primary" @click="submitForm">确 定</el-button> <el-button type="primary" @click="submitForm">确 定</el-button>
@@ -10,101 +10,148 @@
<script setup> <script setup>
import BasicForm from '@/components/BasicForm' import BasicForm from '@/components/BasicForm'
import { getSurcharge, addSurcharge, updateSurcharge } from '@/api/price/surcharge' import { getSurcharge, addSurcharge, updateSurcharge, listSurchargeBlockOptions } from '@/api/price/surcharge'
import { listRegionOptions } from '@/api/data/region' import { listRegionOptions } from '@/api/data/region'
const emit = defineEmits(['success']) const emit = defineEmits(['success'])
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const { payment_product_type } = useDict('payment_product_type')
const formRef = ref() const formRef = ref()
const visible = ref(false) const visible = ref(false)
const title = ref('') const title = ref('')
const form = ref(emptyForm()) const form = ref(emptyForm())
const regionOptions = ref([]) const regionOptions = ref([])
const blockOptions = ref([])
const loadingBlocks = ref(false)
const suppressCountryWatch = ref(false)
const calcModeOptions = [
{ value: 'MANUAL', label: '暂不计费' },
{ value: 'ALWAYS', label: '每票都收' },
{ value: 'POSTCODE', label: '命中邮编' },
{ value: 'ZONE', label: '命中分区' },
{ value: 'EXTRA_KG', label: '超重续收' },
{ value: 'WEIGHT', label: '超重' },
{ value: 'SIZE', label: '超尺寸' },
{ value: 'RETURN', label: '退件' }
]
const countrySelectOptions = computed(() => { const countrySelectOptions = computed(() => {
const all = [{ label: "全部国家", value: '' }] const all = [{ label: '全部国家', value: '' }]
return all.concat((regionOptions.value || []).map(r => ({ return all.concat((regionOptions.value || []).map(r => ({
label: regionLabel(r), label: regionLabel(r),
value: r.countryCode2 value: r.countryCode2
}))) })))
}) })
const channelProductOptions = computed(() =>
(payment_product_type.value || []).map(item => ({
label: item.label,
value: item.value
}))
)
const blockSelectOptions = computed(() =>
(blockOptions.value || []).map(title => ({ label: title, value: title }))
)
const schemas = computed(() => [ const schemas = computed(() => [
{ {
label: "附加费名称", label: '附加费名称',
prop: 'scName', prop: 'scName',
component: 'input', component: 'input',
placeholder: "如 燃油附加费", placeholder: '如 燃油附加费',
span: 12, span: 12,
width: '100%', width: '100%',
props: { maxlength: 100 }, props: { maxlength: 100 },
rules: [{ required: true, message: "附加费名称不能为空", trigger: 'blur' }] rules: [{ required: true, message: '附加费名称不能为空', trigger: 'blur' }]
}, },
{ {
label: "费用类型", label: '费用类型',
prop: 'feeType', prop: 'feeType',
component: 'select', component: 'select',
placeholder: "请选择", placeholder: '请选择',
dict: 'bms_fee_type', dict: 'bms_fee_type',
span: 12, span: 12,
width: '100%', width: '100%',
disabled: true, disabled: true,
rules: [{ required: true, message: "请选择费用类型", trigger: 'change' }] rules: [{ required: true, message: '请选择费用类型', trigger: 'change' }]
}, },
{ {
label: "计费方式", label: '计费方式',
prop: 'chargeType', prop: 'chargeType',
component: 'select', component: 'select',
placeholder: "请选择", placeholder: '请选择',
dict: 'bms_charge_type', options: calcModeOptions,
span: 12, span: 12,
width: '100%', width: '100%',
rules: [{ required: true, message: "请选择计费方式", trigger: 'change' }] rules: [{ required: true, message: '请选择计费方式', trigger: 'change' }]
}, },
{ {
label: "计费数值", label: '渠道产品',
prop: 'dictValue',
component: 'select',
placeholder: '请选择渠道产品',
options: channelProductOptions.value,
span: 12,
width: '100%',
props: { filterable: true, clearable: true }
},
{
label: '计费数值',
prop: 'chargeValue', prop: 'chargeValue',
component: 'inputNumber', component: 'inputNumber',
span: 12, span: 12,
width: '100%', width: '100%',
props: { min: 0, precision: 6, step: 1, controlsPosition: 'right' }, props: { min: 0, precision: 6, step: 1, controlsPosition: 'right' },
rules: [{ required: true, message: "计费数值不能为空", trigger: 'blur' }] rules: [{ required: true, message: '计费数值不能为空', trigger: 'blur' }]
}, },
{ {
label: "币种", label: '币种',
prop: 'currency', prop: 'currency',
component: 'select', component: 'select',
placeholder: "请选择", placeholder: '请选择',
dict: 'bms_currency', dict: 'bms_currency',
span: 12, span: 12,
width: '100%' width: '100%'
}, },
{ {
label: "取值方式", label: '取值方式',
prop: 'roundMode', prop: 'roundMode',
component: 'select', component: 'select',
placeholder: "请选择", placeholder: '请选择',
dict: 'bms_round_mode', dict: 'bms_round_mode',
span: 12, span: 12,
width: '100%', width: '100%',
rules: [{ required: true, message: "请选择取值方式", trigger: 'change' }] rules: [{ required: true, message: '请选择取值方式', trigger: 'change' }]
}, },
{ {
label: "适用国家", label: '适用国家',
prop: 'countryCode', prop: 'countryCode',
component: 'select', component: 'select',
placeholder: "全部国家", placeholder: '全部国家',
options: countrySelectOptions.value, options: countrySelectOptions.value,
span: 12, span: 12,
width: '100%', width: '100%',
props: { filterable: true, clearable: true } props: { filterable: true, clearable: true }
}, },
{ {
label: "备注", label: '分区',
prop: 'blockTitle',
component: 'select',
placeholder: form.value.countryCode ? (loadingBlocks.value ? '加载中...' : '请选择分区/区块') : '请先选择国家',
options: blockSelectOptions.value,
span: 12,
width: '100%',
disabled: !form.value.countryCode || loadingBlocks.value,
props: { filterable: true, clearable: true }
},
{
label: '备注',
prop: 'scNote', prop: 'scNote',
component: 'textarea', component: 'textarea',
placeholder: "请输入备注", placeholder: '请输入备注',
span: 24, span: 24,
width: '100%', width: '100%',
props: { rows: 2, maxlength: 500 } props: { rows: 2, maxlength: 500 }
@@ -116,11 +163,13 @@ function emptyForm() {
scId: undefined, scId: undefined,
scName: undefined, scName: undefined,
feeType: 'SURCHARGE', feeType: 'SURCHARGE',
chargeType: 'FIXED', dictValue: undefined,
chargeType: 'MANUAL',
chargeValue: 0, chargeValue: 0,
currency: 'CNY', currency: 'CNY',
roundMode: 'HALF_UP', roundMode: 'HALF_UP',
countryCode: undefined, countryCode: undefined,
blockTitle: undefined,
scNote: undefined scNote: undefined
} }
} }
@@ -137,25 +186,64 @@ function ensureRegions() {
}) })
} }
function resolveCountryName(code) {
if (!code) return ''
const region = (regionOptions.value || []).find(item => item.countryCode2 === code)
return region?.countryNameCn || region?.countryNameEn || ''
}
function loadBlockOptions(code, keepCurrent) {
if (!code) {
blockOptions.value = []
if (!keepCurrent) form.value.blockTitle = undefined
return Promise.resolve()
}
loadingBlocks.value = true
const countryName = resolveCountryName(code)
return listSurchargeBlockOptions({ countryCode: code, countryName: countryName || undefined })
.then(res => {
const list = (res.data || []).filter(Boolean)
blockOptions.value = list
if (!keepCurrent) {
form.value.blockTitle = undefined
} else if (form.value.blockTitle && !list.includes(form.value.blockTitle)) {
// keep current title even if not in options (legacy)
blockOptions.value = [form.value.blockTitle].concat(list)
}
})
.catch(() => {
blockOptions.value = []
})
.finally(() => {
loadingBlocks.value = false
})
}
function reset() { function reset() {
form.value = emptyForm() form.value = emptyForm()
blockOptions.value = []
nextTick(() => formRef.value?.clearValidate()) nextTick(() => formRef.value?.clearValidate())
} }
function open(row) { function open(row) {
reset() reset()
ensureRegions() ensureRegions().then(() => {
if (!row) { if (!row) {
title.value = "新建附加费" title.value = '新建附加费'
visible.value = true visible.value = true
return return
} }
getSurcharge(row.scId).then(res => { getSurcharge(row.scId).then(res => {
const data = res.data || {} const data = res.data || {}
form.value = { ...emptyForm(), ...data } suppressCountryWatch.value = true
title.value = "修改附加费" form.value = { ...emptyForm(), ...data }
visible.value = true title.value = '修改附加费'
nextTick(() => formRef.value?.clearValidate()) visible.value = true
loadBlockOptions(form.value.countryCode, true).finally(() => {
suppressCountryWatch.value = false
nextTick(() => formRef.value?.clearValidate())
})
})
}) })
} }
@@ -164,17 +252,26 @@ function submitForm() {
if (!valid) return if (!valid) return
const payload = { ...form.value } const payload = { ...form.value }
if (!payload.countryCode) payload.countryCode = undefined if (!payload.countryCode) payload.countryCode = undefined
if (!payload.dictValue) payload.dictValue = undefined
if (!payload.blockTitle) payload.blockTitle = undefined
if (!payload.chargeType) payload.chargeType = 'MANUAL'
if (payload.chargeValue != null) payload.chargeValue = Number(payload.chargeValue) if (payload.chargeValue != null) payload.chargeValue = Number(payload.chargeValue)
const req = payload.scId != null ? updateSurcharge(payload) : addSurcharge(payload) const req = payload.scId != null ? updateSurcharge(payload) : addSurcharge(payload)
req.then(() => { req.then(() => {
proxy.$modal.msgSuccess(payload.scId != null ? "修改成功" : "新增成功") proxy.$modal.msgSuccess(payload.scId != null ? '修改成功' : '新增成功')
visible.value = false visible.value = false
emit('success') emit('success')
}).catch(() => { }).catch(() => {
// 后端返回 warn(601「未做任何修改」) 时由全局拦截器弹提示,此处吞掉 reject // backend warn(601) handled globally
}) })
}) })
} }
watch(() => form.value.countryCode, (code, prev) => {
if (suppressCountryWatch.value) return
if (code === prev) return
loadBlockOptions(code, false)
})
defineExpose({ open }) defineExpose({ open })
</script> </script>
@@ -66,7 +66,7 @@ import { listRegionOptions } from '@/api/data/region'
// 只读抽屉:查看已被版本化编辑淘汰的作废记录(ss_code = vd) // 只读抽屉:查看已被版本化编辑淘汰的作废记录(ss_code = vd)
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const { bms_charge_type, bms_round_mode, bms_fee_type } = useDict('bms_charge_type', 'bms_round_mode', 'bms_fee_type') const { bms_round_mode, bms_fee_type } = useDict('bms_round_mode', 'bms_fee_type')
const visible = ref(false) const visible = ref(false)
const loading = ref(false) const loading = ref(false)
@@ -105,9 +105,22 @@ function feeTypeLabel(val) {
return found ? found.label : (val || '-') return found ? found.label : (val || '-')
} }
const chargeTypeLabelMap = {
MANUAL: '暂不计费',
ALWAYS: '每票都收',
POSTCODE: '命中邮编',
ZONE: '命中分区',
EXTRA_KG: '超重续收',
WEIGHT: '超重',
SIZE: '超尺寸',
RETURN: '退件',
FIXED: '每票都收',
RATE: '暂不计费'
}
function chargeTypeLabel(val) { function chargeTypeLabel(val) {
const found = bms_charge_type.value.find(d => d.value === val) if (!val) return chargeTypeLabelMap.MANUAL
return found ? found.label : (val || '-') return chargeTypeLabelMap[val] || chargeTypeLabelMap[String(val).toUpperCase()] || val
} }
function roundModeLabel(val) { function roundModeLabel(val) {
@@ -118,7 +131,6 @@ function roundModeLabel(val) {
function formatChargeValue(row) { function formatChargeValue(row) {
if (row.chargeValue == null) return '-' if (row.chargeValue == null) return '-'
const v = Number(row.chargeValue) const v = Number(row.chargeValue)
if (row.chargeType === 'RATE') return (v * 100).toFixed(2) + '%'
return v + ' ' + (row.currency || 'CNY') return v + ' ' + (row.currency || 'CNY')
} }
@@ -77,20 +77,32 @@ import { listRegionOptions } from '@/api/data/region'
import { onMounted } from 'vue' import { onMounted } from 'vue'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const { bms_charge_type } = useDict('bms_charge_type')
const tableRef = ref() const tableRef = ref()
const formDialogRef = ref() const formDialogRef = ref()
const voidDrawerRef = ref() const voidDrawerRef = ref()
const regionOptions = ref([]) const regionOptions = ref([])
const calcModeLabelMap = {
MANUAL: '暂不计费',
ALWAYS: '每票都收',
POSTCODE: '命中邮编',
ZONE: '命中分区',
EXTRA_KG: '超重续收',
WEIGHT: '超重',
SIZE: '超尺寸',
RETURN: '退件'
}
const columns = [ const columns = [
{ label: '附加费名称', prop: 'scName', align: 'center', minWidth: 140, showOverflowTooltip: true }, { label: '附加费名称', prop: 'scName', align: 'center', minWidth: 140, showOverflowTooltip: true },
{ label: '费用类型', prop: 'feeType', align: 'center', width: 110, dict: 'bms_fee_type' }, { label: '费用类型', prop: 'feeType', align: 'center', width: 110, dict: 'bms_fee_type' },
{ label: '计费方式', prop: 'chargeType', align: 'center', width: 130 }, { label: '计费方式', prop: 'chargeType', align: 'center', width: 110 },
{ label: '渠道产品', prop: 'dictValue', align: 'center', minWidth: 130, showOverflowTooltip: true },
{ label: '计费数值', prop: 'chargeValue', align: 'center', width: 140 }, { label: '计费数值', prop: 'chargeValue', align: 'center', width: 140 },
{ label: '取值方式', prop: 'roundMode', align: 'center', width: 110, dict: 'bms_round_mode' }, { label: '取值方式', prop: 'roundMode', align: 'center', width: 110, dict: 'bms_round_mode' },
{ label: '适用国家', prop: 'countryCode', align: 'center', minWidth: 120, showOverflowTooltip: true }, { label: '适用国家', prop: 'countryCode', align: 'center', minWidth: 120, showOverflowTooltip: true },
{ label: '分区', prop: 'blockTitle', align: 'center', minWidth: 140, showOverflowTooltip: true },
{ label: '状态', prop: 'ssCode', align: 'center', width: 80 }, { label: '状态', prop: 'ssCode', align: 'center', width: 80 },
{ label: '备注', prop: 'scNote', align: 'center', minWidth: 140, showOverflowTooltip: true }, { label: '备注', prop: 'scNote', align: 'center', minWidth: 140, showOverflowTooltip: true },
{ label: '创建时间', prop: 'createTime', align: 'center', width: 160, parseTime: true }, { label: '创建时间', prop: 'createTime', align: 'center', width: 160, parseTime: true },
@@ -103,10 +115,18 @@ const searchColumns = [
label: '计费方式', label: '计费方式',
prop: 'chargeType', prop: 'chargeType',
component: 'select', component: 'select',
dict: 'bms_charge_type', options: Object.keys(calcModeLabelMap).map(value => ({ value, label: calcModeLabelMap[value] })),
placeholder: '计费方式', placeholder: '计费方式',
width: '150px' width: '150px'
}, },
{
label: '渠道产品',
prop: 'dictValue',
component: 'select',
dict: 'payment_product_type',
placeholder: '渠道产品',
width: '160px'
},
{ label: '取值方式', prop: 'roundMode', component: 'select', dict: 'bms_round_mode', placeholder: '取值方式', width: '150px' }, { label: '取值方式', prop: 'roundMode', component: 'select', dict: 'bms_round_mode', placeholder: '取值方式', width: '150px' },
{ {
label: '状态', label: '状态',
@@ -127,8 +147,8 @@ function queryList(params) {
} }
function chargeTypeLabel(val) { function chargeTypeLabel(val) {
const found = bms_charge_type.value.find(c => c.value === val) if (!val) return calcModeLabelMap.MANUAL
return found ? found.label : (val || '-') return calcModeLabelMap[val] || val
} }
function countryLabel(code) { function countryLabel(code) {
@@ -150,9 +170,6 @@ onMounted(() => {
function formatChargeValue(row) { function formatChargeValue(row) {
if (row.chargeValue == null) return '-' if (row.chargeValue == null) return '-'
const v = Number(row.chargeValue) const v = Number(row.chargeValue)
if (row.chargeType === 'RATE') {
return (v * 100).toFixed(2) + '%'
}
return v + ' ' + (row.currency || 'CNY') return v + ' ' + (row.currency || 'CNY')
} }
@@ -128,10 +128,9 @@ function statusTag(status) {
return map[String(status)] || 'info' return map[String(status)] || 'info'
} }
/** 待生效、已生效:可编辑价卡 */ /** 不限状态:待生效/已生效/已失效均可编辑价卡 */
function canEdit(row) { function canEdit(row) {
const s = row ? String(row.status) : '' return !!row
return s === '0' || s === '1'
} }
/** 仅待生效可改生效时间 */ /** 仅待生效可改生效时间 */
+1 -1
View File
@@ -192,7 +192,7 @@ function openCreateVersion() {
}) })
} }
/** 编辑待生效/已生效版本价卡 */ /** 编辑版本价卡(不限状态) */
function openEditVersion(row) { function openEditVersion(row) {
if (!priceSetId.value || !row?.versionNo) return if (!priceSetId.value || !row?.versionNo) return
proxy.$router.push({ proxy.$router.push({
@@ -68,11 +68,22 @@ defineProps({
} }
}) })
const { bms_charge_type } = useDict('bms_charge_type') const chargeTypeLabelMap = {
MANUAL: '暂不计费',
ALWAYS: '每票都收',
POSTCODE: '命中邮编',
ZONE: '命中分区',
EXTRA_KG: '超重续收',
WEIGHT: '超重',
SIZE: '超尺寸',
RETURN: '退件',
FIXED: '每票都收',
RATE: '暂不计费'
}
function chargeTypeLabel(val) { function chargeTypeLabel(val) {
const found = (bms_charge_type.value || []).find(c => c.value === val) if (!val) return chargeTypeLabelMap.MANUAL
return found ? found.label : (val || '-') return chargeTypeLabelMap[val] || chargeTypeLabelMap[String(val).toUpperCase()] || val
} }
</script> </script>
@@ -62,8 +62,6 @@ const props = defineProps({
}) })
const emit = defineEmits(['update:modelValue', 'confirm']) const emit = defineEmits(['update:modelValue', 'confirm'])
const { bms_charge_type } = useDict('bms_charge_type')
const tableRef = ref() const tableRef = ref()
const picked = ref([]) const picked = ref([])
@@ -91,9 +89,22 @@ const rows = computed(() => {
})) }))
}) })
const chargeTypeLabelMap = {
MANUAL: '暂不计费',
ALWAYS: '每票都收',
POSTCODE: '命中邮编',
ZONE: '命中分区',
EXTRA_KG: '超重续收',
WEIGHT: '超重',
SIZE: '超尺寸',
RETURN: '退件',
FIXED: '每票都收',
RATE: '暂不计费'
}
function chargeTypeLabel(val) { function chargeTypeLabel(val) {
const found = (bms_charge_type.value || []).find(c => c.value === val) if (!val) return chargeTypeLabelMap.MANUAL
return found ? found.label : (val || '-') return chargeTypeLabelMap[val] || chargeTypeLabelMap[String(val).toUpperCase()] || val
} }
function onSelectionChange(selection) { function onSelectionChange(selection) {