提交价格套餐功能

This commit is contained in:
wuweihua
2026-09-04 14:56:05 +08:00
parent f8b9681583
commit 5e15ab9c44
47 changed files with 6243 additions and 9 deletions
@@ -0,0 +1,196 @@
package com.ruoyi.web.controller.price;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.price.domain.PrcCustomerPriceSet;
import com.ruoyi.price.domain.PrcPriceSet;
import com.ruoyi.price.domain.PrcPriceSetDetail;
import com.ruoyi.price.service.IPrcPriceSetService;
/**
* 价格套餐管理
*
* @author ruoyi
*/
@RestController
@RequestMapping("/price/set")
public class PriceSetController extends BaseController
{
@Autowired
private IPrcPriceSetService priceSetService;
@PreAuthorize("@ss.hasPermi('price:set:list')")
@GetMapping("/list")
public TableDataInfo list(PrcPriceSet set)
{
startPage();
List<PrcPriceSet> list = priceSetService.selectPrcPriceSetList(set);
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('price:set:query')")
@GetMapping("/{priceSetId:[0-9]+}")
public AjaxResult getInfo(@PathVariable Long priceSetId)
{
return success(priceSetService.selectPrcPriceSetById(priceSetId));
}
@PreAuthorize("@ss.hasPermi('price:set:add')")
@Log(title = "价格套餐", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody PrcPriceSet set)
{
set.setCreateBy(getUsername());
set.setUpdateBy(getUsername());
Long id = priceSetService.savePrcPriceSet(set);
return success(id);
}
@PreAuthorize("@ss.hasPermi('price:set:edit')")
@Log(title = "价格套餐", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody PrcPriceSet set)
{
set.setUpdateBy(getUsername());
return toAjax(priceSetService.updatePrcPriceSet(set));
}
@PreAuthorize("@ss.hasPermi('price:set:remove')")
@Log(title = "价格套餐", businessType = BusinessType.DELETE)
@DeleteMapping("/{priceSetIds}")
public AjaxResult remove(@PathVariable Long[] priceSetIds)
{
return toAjax(priceSetService.deletePrcPriceSetByIds(priceSetIds));
}
@PreAuthorize("@ss.hasPermi('price:set:audit')")
@Log(title = "价格套餐提交审核", businessType = BusinessType.UPDATE)
@PutMapping("/submit/{priceSetId}")
public AjaxResult submit(@PathVariable Long priceSetId)
{
return toAjax(priceSetService.submit(priceSetId, getUsername()));
}
@PreAuthorize("@ss.hasPermi('price:set:audit')")
@Log(title = "价格套餐生效", businessType = BusinessType.UPDATE)
@PutMapping("/approve/{priceSetId}")
public AjaxResult approve(@PathVariable Long priceSetId)
{
return toAjax(priceSetService.approve(priceSetId, getUsername()));
}
@PreAuthorize("@ss.hasPermi('price:set:audit')")
@Log(title = "价格套餐驳回", businessType = BusinessType.UPDATE)
@PutMapping("/reject/{priceSetId}")
public AjaxResult reject(@PathVariable Long priceSetId)
{
return toAjax(priceSetService.reject(priceSetId, getUsername()));
}
@PreAuthorize("@ss.hasPermi('price:set:audit')")
@Log(title = "价格套餐停用", businessType = BusinessType.UPDATE)
@PutMapping("/disable/{priceSetId}")
public AjaxResult disable(@PathVariable Long priceSetId)
{
return toAjax(priceSetService.disable(priceSetId, getUsername()));
}
@PreAuthorize("@ss.hasPermi('price:set:add')")
@Log(title = "价格套餐复用", businessType = BusinessType.INSERT)
@PostMapping("/copy/{priceSetId}")
public AjaxResult copy(@PathVariable Long priceSetId)
{
Long id = priceSetService.copy(priceSetId, getUsername());
return success(id);
}
@PreAuthorize("@ss.hasPermi('price:set:query')")
@PostMapping("/validate")
public AjaxResult validate(@RequestBody PrcPriceSet set)
{
return success(priceSetService.validate(set));
}
@PreAuthorize("@ss.hasPermi('price:set:list')")
@GetMapping("/detail/list")
public TableDataInfo detailList(PrcPriceSetDetail detail)
{
startPage();
List<PrcPriceSetDetail> list = priceSetService.selectDetailList(detail);
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('price:set:edit')")
@Log(title = "套餐明细", businessType = BusinessType.INSERT)
@PostMapping("/detail")
public AjaxResult addDetail(@RequestBody PrcPriceSetDetail detail)
{
return toAjax(priceSetService.insertDetail(detail));
}
@PreAuthorize("@ss.hasPermi('price:set:edit')")
@Log(title = "套餐明细", businessType = BusinessType.UPDATE)
@PutMapping("/detail")
public AjaxResult editDetail(@RequestBody PrcPriceSetDetail detail)
{
return toAjax(priceSetService.updateDetail(detail));
}
@PreAuthorize("@ss.hasPermi('price:set:edit')")
@Log(title = "套餐明细", businessType = BusinessType.DELETE)
@DeleteMapping("/detail/{psdIds}")
public AjaxResult removeDetail(@PathVariable Long[] psdIds)
{
return toAjax(priceSetService.deleteDetailByIds(psdIds));
}
@PreAuthorize("@ss.hasPermi('price:set:list')")
@GetMapping("/customer/list")
public TableDataInfo customerList(PrcCustomerPriceSet customer)
{
startPage();
List<PrcCustomerPriceSet> list = priceSetService.selectCustomerList(customer);
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('price:set:edit')")
@Log(title = "套餐客户绑定", businessType = BusinessType.INSERT)
@PostMapping("/customer")
public AjaxResult addCustomer(@RequestBody PrcCustomerPriceSet customer)
{
customer.setCreateBy(getUsername());
return toAjax(priceSetService.insertCustomer(customer));
}
@PreAuthorize("@ss.hasPermi('price:set:edit')")
@Log(title = "套餐客户绑定", businessType = BusinessType.UPDATE)
@PutMapping("/customer")
public AjaxResult editCustomer(@RequestBody PrcCustomerPriceSet customer)
{
customer.setUpdateBy(getUsername());
return toAjax(priceSetService.updateCustomer(customer));
}
@PreAuthorize("@ss.hasPermi('price:set:edit')")
@Log(title = "套餐客户绑定", businessType = BusinessType.DELETE)
@DeleteMapping("/customer/{customerPricesetIds}")
public AjaxResult removeCustomer(@PathVariable Long[] customerPricesetIds)
{
return toAjax(priceSetService.deleteCustomerByIds(customerPricesetIds));
}
}
@@ -0,0 +1,110 @@
package com.ruoyi.web.controller.price;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.price.domain.PrcWeightSectionDetail;
import com.ruoyi.price.domain.PrcWeightSectionTemplate;
import com.ruoyi.price.service.IPrcWeightService;
/**
* 重量段管理
*
* @author ruoyi
*/
@RestController
@RequestMapping("/price/weight")
public class WeightController extends BaseController
{
@Autowired
private IPrcWeightService weightService;
@PreAuthorize("@ss.hasPermi('price:weight:list')")
@GetMapping("/template/list")
public TableDataInfo templateList(PrcWeightSectionTemplate template)
{
startPage();
List<PrcWeightSectionTemplate> list = weightService.selectPrcWeightSectionTemplateList(template);
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('price:weight:query')")
@GetMapping("/template/{wstId}")
public AjaxResult getTemplate(@PathVariable Long wstId)
{
return success(weightService.selectPrcWeightSectionTemplateById(wstId));
}
@PreAuthorize("@ss.hasPermi('price:weight:add')")
@Log(title = "重量段模板", businessType = BusinessType.INSERT)
@PostMapping("/template")
public AjaxResult addTemplate(@Validated @RequestBody PrcWeightSectionTemplate template)
{
template.setCreateBy(getUsername());
return toAjax(weightService.insertPrcWeightSectionTemplate(template));
}
@PreAuthorize("@ss.hasPermi('price:weight:edit')")
@Log(title = "重量段模板", businessType = BusinessType.UPDATE)
@PutMapping("/template")
public AjaxResult editTemplate(@Validated @RequestBody PrcWeightSectionTemplate template)
{
template.setUpdateBy(getUsername());
return toAjax(weightService.updatePrcWeightSectionTemplate(template));
}
@PreAuthorize("@ss.hasPermi('price:weight:remove')")
@Log(title = "重量段模板", businessType = BusinessType.DELETE)
@DeleteMapping("/template/{wstIds}")
public AjaxResult removeTemplate(@PathVariable Long[] wstIds)
{
return toAjax(weightService.deletePrcWeightSectionTemplateByIds(wstIds));
}
@PreAuthorize("@ss.hasPermi('price:weight:list')")
@GetMapping("/detail/list")
public TableDataInfo detailList(PrcWeightSectionDetail detail)
{
startPage();
List<PrcWeightSectionDetail> list = weightService.selectPrcWeightSectionDetailList(detail);
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('price:weight:add')")
@Log(title = "重量段明细", businessType = BusinessType.INSERT)
@PostMapping("/detail")
public AjaxResult addDetail(@Validated @RequestBody PrcWeightSectionDetail detail)
{
return toAjax(weightService.insertPrcWeightSectionDetail(detail));
}
@PreAuthorize("@ss.hasPermi('price:weight:edit')")
@Log(title = "重量段明细", businessType = BusinessType.UPDATE)
@PutMapping("/detail")
public AjaxResult editDetail(@Validated @RequestBody PrcWeightSectionDetail detail)
{
return toAjax(weightService.updatePrcWeightSectionDetail(detail));
}
@PreAuthorize("@ss.hasPermi('price:weight:remove')")
@Log(title = "重量段明细", businessType = BusinessType.DELETE)
@DeleteMapping("/detail/{wsdIds}")
public AjaxResult removeDetail(@PathVariable Long[] wsdIds)
{
return toAjax(weightService.deletePrcWeightSectionDetailByIds(wsdIds));
}
}
@@ -0,0 +1,144 @@
package com.ruoyi.web.controller.price;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.price.domain.XtdZoneCountry;
import com.ruoyi.price.domain.XtdZoneDivision;
import com.ruoyi.price.domain.XtdZoneScheme;
import com.ruoyi.price.service.IXtdZoneService;
/**
* 分区管理
*
* @author ruoyi
*/
@RestController
@RequestMapping("/price/zone")
public class ZoneController extends BaseController
{
@Autowired
private IXtdZoneService zoneService;
@PreAuthorize("@ss.hasPermi('price:zone:list')")
@GetMapping("/scheme/list")
public TableDataInfo schemeList(XtdZoneScheme scheme)
{
startPage();
List<XtdZoneScheme> list = zoneService.selectXtdZoneSchemeList(scheme);
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('price:zone:query')")
@GetMapping("/scheme/{zsId}")
public AjaxResult getScheme(@PathVariable Long zsId)
{
return success(zoneService.selectXtdZoneSchemeById(zsId));
}
@PreAuthorize("@ss.hasPermi('price:zone:add')")
@Log(title = "分区方案", businessType = BusinessType.INSERT)
@PostMapping("/scheme")
public AjaxResult addScheme(@Validated @RequestBody XtdZoneScheme scheme)
{
scheme.setCreateBy(getUsername());
return toAjax(zoneService.insertXtdZoneScheme(scheme));
}
@PreAuthorize("@ss.hasPermi('price:zone:edit')")
@Log(title = "分区方案", businessType = BusinessType.UPDATE)
@PutMapping("/scheme")
public AjaxResult editScheme(@Validated @RequestBody XtdZoneScheme scheme)
{
scheme.setUpdateBy(getUsername());
return toAjax(zoneService.updateXtdZoneScheme(scheme));
}
@PreAuthorize("@ss.hasPermi('price:zone:remove')")
@Log(title = "分区方案", businessType = BusinessType.DELETE)
@DeleteMapping("/scheme/{zsIds}")
public AjaxResult removeScheme(@PathVariable Long[] zsIds)
{
return toAjax(zoneService.deleteXtdZoneSchemeByIds(zsIds));
}
@PreAuthorize("@ss.hasPermi('price:zone:list')")
@GetMapping("/division/list")
public TableDataInfo divisionList(XtdZoneDivision division)
{
startPage();
List<XtdZoneDivision> list = zoneService.selectXtdZoneDivisionList(division);
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('price:zone:add')")
@Log(title = "分区区划", businessType = BusinessType.INSERT)
@PostMapping("/division")
public AjaxResult addDivision(@Validated @RequestBody XtdZoneDivision division)
{
return toAjax(zoneService.insertXtdZoneDivision(division));
}
@PreAuthorize("@ss.hasPermi('price:zone:edit')")
@Log(title = "分区区划", businessType = BusinessType.UPDATE)
@PutMapping("/division")
public AjaxResult editDivision(@Validated @RequestBody XtdZoneDivision division)
{
return toAjax(zoneService.updateXtdZoneDivision(division));
}
@PreAuthorize("@ss.hasPermi('price:zone:remove')")
@Log(title = "分区区划", businessType = BusinessType.DELETE)
@DeleteMapping("/division/{zdIds}")
public AjaxResult removeDivision(@PathVariable Long[] zdIds)
{
return toAjax(zoneService.deleteXtdZoneDivisionByIds(zdIds));
}
@PreAuthorize("@ss.hasPermi('price:zone:list')")
@GetMapping("/country/list")
public TableDataInfo countryList(XtdZoneCountry country)
{
startPage();
List<XtdZoneCountry> list = zoneService.selectXtdZoneCountryList(country);
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('price:zone:add')")
@Log(title = "分区国家", businessType = BusinessType.INSERT)
@PostMapping("/country")
public AjaxResult addCountry(@Validated @RequestBody XtdZoneCountry country)
{
return toAjax(zoneService.insertXtdZoneCountry(country));
}
@PreAuthorize("@ss.hasPermi('price:zone:edit')")
@Log(title = "分区国家", businessType = BusinessType.UPDATE)
@PutMapping("/country")
public AjaxResult editCountry(@Validated @RequestBody XtdZoneCountry country)
{
return toAjax(zoneService.updateXtdZoneCountry(country));
}
@PreAuthorize("@ss.hasPermi('price:zone:remove')")
@Log(title = "分区国家", businessType = BusinessType.DELETE)
@DeleteMapping("/country/{zcIds}")
public AjaxResult removeCountry(@PathVariable Long[] zcIds)
{
return toAjax(zoneService.deleteXtdZoneCountryByIds(zcIds));
}
}
@@ -0,0 +1,57 @@
package com.ruoyi.price.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 客户套餐 prc_customer_price_set
*
* @author ruoyi
*/
public class PrcCustomerPriceSet extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long customerPricesetId;
private Long priceSetId;
private Long customerId;
private String customerName;
/** 优先级,数字越小越优先 */
private Integer bindPriority;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date prBegindate;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date prEnddate;
private String priceSetNote;
public Long getCustomerPricesetId() { return customerPricesetId; }
public void setCustomerPricesetId(Long customerPricesetId) { this.customerPricesetId = customerPricesetId; }
public Long getPriceSetId() { return priceSetId; }
public void setPriceSetId(Long priceSetId) { this.priceSetId = priceSetId; }
public Long getCustomerId() { return customerId; }
public void setCustomerId(Long customerId) { this.customerId = customerId; }
public String getCustomerName() { return customerName; }
public void setCustomerName(String customerName) { this.customerName = customerName; }
public Integer getBindPriority() { return bindPriority; }
public void setBindPriority(Integer bindPriority) { this.bindPriority = bindPriority; }
public Date getPrBegindate() { return prBegindate; }
public void setPrBegindate(Date prBegindate) { this.prBegindate = prBegindate; }
public Date getPrEnddate() { return prEnddate; }
public void setPrEnddate(Date prEnddate) { this.prEnddate = prEnddate; }
public String getPriceSetNote() { return priceSetNote; }
public void setPriceSetNote(String priceSetNote) { this.priceSetNote = priceSetNote; }
@Override
public String toString()
{
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("customerPricesetId", getCustomerPricesetId())
.append("priceSetId", getPriceSetId())
.append("customerId", getCustomerId())
.append("bindPriority", getBindPriority())
.toString();
}
}
@@ -0,0 +1,115 @@
package com.ruoyi.price.domain;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 价格套餐 prc_price_set
*
* @author ruoyi
*/
public class PrcPriceSet extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 价格套餐id */
private Long priceSetId;
/** 套餐编码 */
private String priceSetCode;
/** 套餐名称 */
private String priceSetName;
/** 备注 */
private String priceSetNote;
/** 计价类型 FIXED / DISCOUNT */
private String setType;
/** 默认折扣百分数 */
private BigDecimal defaultDiscount;
/** 默认套餐 Y */
private String defaultType;
/** 试算标记 Y */
private String calculateSign;
/** 生效日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date effectiveDate;
/** 失效日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date expireDate;
/** 状态 D/A/E/R/S */
private String status;
/** 租户ID */
private Long tmsId;
/** 产品数(列表) */
private Integer productCount;
/** 客户数(列表) */
private Integer customerCount;
/** 是否已过期(计算字段) */
private Boolean expired;
/** 列表搜索关键字 */
private String keyword;
/** 保存后是否提交审核 Y */
private String submitFlag;
/** 套餐明细(向导保存) */
private List<PrcPriceSetDetail> details;
/** 绑定客户(向导保存) */
private List<PrcCustomerPriceSet> customers;
public Long getPriceSetId() { return priceSetId; }
public void setPriceSetId(Long priceSetId) { this.priceSetId = priceSetId; }
public String getPriceSetCode() { return priceSetCode; }
public void setPriceSetCode(String priceSetCode) { this.priceSetCode = priceSetCode; }
public String getPriceSetName() { return priceSetName; }
public void setPriceSetName(String priceSetName) { this.priceSetName = priceSetName; }
public String getPriceSetNote() { return priceSetNote; }
public void setPriceSetNote(String priceSetNote) { this.priceSetNote = priceSetNote; }
public String getSetType() { return setType; }
public void setSetType(String setType) { this.setType = setType; }
public BigDecimal getDefaultDiscount() { return defaultDiscount; }
public void setDefaultDiscount(BigDecimal defaultDiscount) { this.defaultDiscount = defaultDiscount; }
public String getDefaultType() { return defaultType; }
public void setDefaultType(String defaultType) { this.defaultType = defaultType; }
public String getCalculateSign() { return calculateSign; }
public void setCalculateSign(String calculateSign) { this.calculateSign = calculateSign; }
public Date getEffectiveDate() { return effectiveDate; }
public void setEffectiveDate(Date effectiveDate) { this.effectiveDate = effectiveDate; }
public Date getExpireDate() { return expireDate; }
public void setExpireDate(Date expireDate) { this.expireDate = expireDate; }
public String getStatus() { return status; }
public void setStatus(String status) { this.status = status; }
public Long getTmsId() { return tmsId; }
public void setTmsId(Long tmsId) { this.tmsId = tmsId; }
public Integer getProductCount() { return productCount; }
public void setProductCount(Integer productCount) { this.productCount = productCount; }
public Integer getCustomerCount() { return customerCount; }
public void setCustomerCount(Integer customerCount) { this.customerCount = customerCount; }
public Boolean getExpired() { return expired; }
public void setExpired(Boolean expired) { this.expired = expired; }
public String getKeyword() { return keyword; }
public void setKeyword(String keyword) { this.keyword = keyword; }
public String getSubmitFlag() { return submitFlag; }
public void setSubmitFlag(String submitFlag) { this.submitFlag = submitFlag; }
public List<PrcPriceSetDetail> getDetails() { return details; }
public void setDetails(List<PrcPriceSetDetail> details) { this.details = details; }
public List<PrcCustomerPriceSet> getCustomers() { return customers; }
public void setCustomers(List<PrcCustomerPriceSet> customers) { this.customers = customers; }
@Override
public String toString()
{
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("priceSetId", getPriceSetId())
.append("priceSetCode", getPriceSetCode())
.append("priceSetName", getPriceSetName())
.append("setType", getSetType())
.append("status", getStatus())
.append("effectiveDate", getEffectiveDate())
.append("expireDate", getExpireDate())
.toString();
}
}
@@ -0,0 +1,34 @@
package com.ruoyi.price.domain;
/**
* 套餐校验项
*
* @author ruoyi
*/
public class PrcPriceSetCheckItem
{
/** 校验项名称 */
private String item;
/** PASS / WARN / FAIL / INFO */
private String result;
/** 说明 */
private String message;
public PrcPriceSetCheckItem()
{
}
public PrcPriceSetCheckItem(String item, String result, String message)
{
this.item = item;
this.result = result;
this.message = message;
}
public String getItem() { return item; }
public void setItem(String item) { this.item = item; }
public String getResult() { return result; }
public void setResult(String result) { this.result = result; }
public String getMessage() { return message; }
public void setMessage(String message) { this.message = message; }
}
@@ -0,0 +1,79 @@
package com.ruoyi.price.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 价格套餐明细 prc_price_set_detail
*
* @author ruoyi
*/
public class PrcPriceSetDetail implements Serializable
{
private static final long serialVersionUID = 1L;
private Long psdId;
private Long priceSetId;
private String productCode;
private String productName;
private String countryCode;
private String countryName;
private Long zdId;
private Long wsdId;
private String weightLabel;
private BigDecimal fvValue;
private BigDecimal fvRegistrationFee;
private BigDecimal discountValue;
private Integer prId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createdAt;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updatedAt;
public Long getPsdId() { return psdId; }
public void setPsdId(Long psdId) { this.psdId = psdId; }
public Long getPriceSetId() { return priceSetId; }
public void setPriceSetId(Long priceSetId) { this.priceSetId = priceSetId; }
public String getProductCode() { return productCode; }
public void setProductCode(String productCode) { this.productCode = productCode; }
public String getProductName() { return productName; }
public void setProductName(String productName) { this.productName = productName; }
public String getCountryCode() { return countryCode; }
public void setCountryCode(String countryCode) { this.countryCode = countryCode; }
public String getCountryName() { return countryName; }
public void setCountryName(String countryName) { this.countryName = countryName; }
public Long getZdId() { return zdId; }
public void setZdId(Long zdId) { this.zdId = zdId; }
public Long getWsdId() { return wsdId; }
public void setWsdId(Long wsdId) { this.wsdId = wsdId; }
public String getWeightLabel() { return weightLabel; }
public void setWeightLabel(String weightLabel) { this.weightLabel = weightLabel; }
public BigDecimal getFvValue() { return fvValue; }
public void setFvValue(BigDecimal fvValue) { this.fvValue = fvValue; }
public BigDecimal getFvRegistrationFee() { return fvRegistrationFee; }
public void setFvRegistrationFee(BigDecimal fvRegistrationFee) { this.fvRegistrationFee = fvRegistrationFee; }
public BigDecimal getDiscountValue() { return discountValue; }
public void setDiscountValue(BigDecimal discountValue) { this.discountValue = discountValue; }
public Integer getPrId() { return prId; }
public void setPrId(Integer prId) { this.prId = prId; }
public Date getCreatedAt() { return createdAt; }
public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; }
public Date getUpdatedAt() { return updatedAt; }
public void setUpdatedAt(Date updatedAt) { this.updatedAt = updatedAt; }
@Override
public String toString()
{
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("psdId", getPsdId())
.append("priceSetId", getPriceSetId())
.append("productCode", getProductCode())
.append("countryCode", getCountryCode())
.append("wsdId", getWsdId())
.toString();
}
}
@@ -0,0 +1,86 @@
package com.ruoyi.price.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 重量段明细 prc_weight_section_detail
*
* @author ruoyi
*/
public class PrcWeightSectionDetail implements Serializable
{
private static final long serialVersionUID = 1L;
/** 重量段明细ID */
private Long wsdId;
/** 重量段模板ID */
private Long wstId;
/** 段标题 */
private String wlTitle;
/** 起始重量 */
private BigDecimal wlStartweight;
/** 结束重量 */
private BigDecimal wlEndweight;
/** 计费方式代码 */
private String weightBillingCode;
/** 单位重量 */
private BigDecimal fvUnitweight;
/** 生效日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date effectiveDate;
/** 失效日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date expireDate;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createdAt;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updatedAt;
public Long getWsdId() { return wsdId; }
public void setWsdId(Long wsdId) { this.wsdId = wsdId; }
public Long getWstId() { return wstId; }
public void setWstId(Long wstId) { this.wstId = wstId; }
public String getWlTitle() { return wlTitle; }
public void setWlTitle(String wlTitle) { this.wlTitle = wlTitle; }
public BigDecimal getWlStartweight() { return wlStartweight; }
public void setWlStartweight(BigDecimal wlStartweight) { this.wlStartweight = wlStartweight; }
public BigDecimal getWlEndweight() { return wlEndweight; }
public void setWlEndweight(BigDecimal wlEndweight) { this.wlEndweight = wlEndweight; }
public String getWeightBillingCode() { return weightBillingCode; }
public void setWeightBillingCode(String weightBillingCode) { this.weightBillingCode = weightBillingCode; }
public BigDecimal getFvUnitweight() { return fvUnitweight; }
public void setFvUnitweight(BigDecimal fvUnitweight) { this.fvUnitweight = fvUnitweight; }
public Date getEffectiveDate() { return effectiveDate; }
public void setEffectiveDate(Date effectiveDate) { this.effectiveDate = effectiveDate; }
public Date getExpireDate() { return expireDate; }
public void setExpireDate(Date expireDate) { this.expireDate = expireDate; }
public Date getCreatedAt() { return createdAt; }
public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; }
public Date getUpdatedAt() { return updatedAt; }
public void setUpdatedAt(Date updatedAt) { this.updatedAt = updatedAt; }
@Override
public String toString()
{
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("wsdId", getWsdId())
.append("wstId", getWstId())
.append("wlTitle", getWlTitle())
.append("wlStartweight", getWlStartweight())
.append("wlEndweight", getWlEndweight())
.append("weightBillingCode", getWeightBillingCode())
.append("fvUnitweight", getFvUnitweight())
.append("effectiveDate", getEffectiveDate())
.append("expireDate", getExpireDate())
.append("createdAt", getCreatedAt())
.append("updatedAt", getUpdatedAt())
.toString();
}
}
@@ -0,0 +1,78 @@
package com.ruoyi.price.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 重量段模板 prc_weight_section_template
*
* @author ruoyi
*/
public class PrcWeightSectionTemplate extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 重量段模板ID */
private Long wstId;
/** 模板名称 */
private String wstName;
/** 状态码(on/off) */
private String ssCode;
/** 产品组代码 */
private String pgCode;
/** 服务渠道ID */
private Long snId;
/** 货物类型代码 */
private String ctCode;
/** 付款方式代码 */
private String pmCode;
/** 备注 */
private String wstNote;
/** 租户ID */
private Long tmsId;
/** 明细数量(列表展示,非表字段) */
private Integer detailCount;
public Long getWstId() { return wstId; }
public void setWstId(Long wstId) { this.wstId = wstId; }
public String getWstName() { return wstName; }
public void setWstName(String wstName) { this.wstName = wstName; }
public String getSsCode() { return ssCode; }
public void setSsCode(String ssCode) { this.ssCode = ssCode; }
public String getPgCode() { return pgCode; }
public void setPgCode(String pgCode) { this.pgCode = pgCode; }
public Long getSnId() { return snId; }
public void setSnId(Long snId) { this.snId = snId; }
public String getCtCode() { return ctCode; }
public void setCtCode(String ctCode) { this.ctCode = ctCode; }
public String getPmCode() { return pmCode; }
public void setPmCode(String pmCode) { this.pmCode = pmCode; }
public String getWstNote() { return wstNote; }
public void setWstNote(String wstNote) { this.wstNote = wstNote; }
public Long getTmsId() { return tmsId; }
public void setTmsId(Long tmsId) { this.tmsId = tmsId; }
public Integer getDetailCount() { return detailCount; }
public void setDetailCount(Integer detailCount) { this.detailCount = detailCount; }
@Override
public String toString()
{
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("wstId", getWstId())
.append("wstName", getWstName())
.append("ssCode", getSsCode())
.append("pgCode", getPgCode())
.append("snId", getSnId())
.append("ctCode", getCtCode())
.append("pmCode", getPmCode())
.append("wstNote", getWstNote())
.append("tmsId", getTmsId())
.append("detailCount", getDetailCount())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}
@@ -0,0 +1,58 @@
package com.ruoyi.price.domain;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 分区国家 xtd_zonecountry
*
* @author ruoyi
*/
public class XtdZoneCountry implements Serializable
{
private static final long serialVersionUID = 1L;
/** 分区国家ID */
private Long zcId;
/** 区划ID */
private Long zdId;
/** 国家代码(ISO2) */
private String countryCode;
/** 划分类型(默认C) */
private String zcDividekind;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createdAt;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updatedAt;
public Long getZcId() { return zcId; }
public void setZcId(Long zcId) { this.zcId = zcId; }
public Long getZdId() { return zdId; }
public void setZdId(Long zdId) { this.zdId = zdId; }
public String getCountryCode() { return countryCode; }
public void setCountryCode(String countryCode) { this.countryCode = countryCode; }
public String getZcDividekind() { return zcDividekind; }
public void setZcDividekind(String zcDividekind) { this.zcDividekind = zcDividekind; }
public Date getCreatedAt() { return createdAt; }
public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; }
public Date getUpdatedAt() { return updatedAt; }
public void setUpdatedAt(Date updatedAt) { this.updatedAt = updatedAt; }
@Override
public String toString()
{
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("zcId", getZcId())
.append("zdId", getZdId())
.append("countryCode", getCountryCode())
.append("zcDividekind", getZcDividekind())
.append("createdAt", getCreatedAt())
.append("updatedAt", getUpdatedAt())
.toString();
}
}
@@ -0,0 +1,78 @@
package com.ruoyi.price.domain;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 分区区划 xtd_zone_division
*
* @author ruoyi
*/
public class XtdZoneDivision implements Serializable
{
private static final long serialVersionUID = 1L;
/** 区划ID */
private Long zdId;
/** 分区方案ID */
private Long zsId;
/** 排序 */
private Integer zdSort;
/** 区划代码 */
private String zdCode;
/** 区划名称 */
private String znName;
/** 区划英文名 */
private String znEname;
/** 备注 */
private String znNote;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createdAt;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updatedAt;
/** 国家数量(列表展示,非表字段) */
private Integer countryCount;
public Long getZdId() { return zdId; }
public void setZdId(Long zdId) { this.zdId = zdId; }
public Long getZsId() { return zsId; }
public void setZsId(Long zsId) { this.zsId = zsId; }
public Integer getZdSort() { return zdSort; }
public void setZdSort(Integer zdSort) { this.zdSort = zdSort; }
public String getZdCode() { return zdCode; }
public void setZdCode(String zdCode) { this.zdCode = zdCode; }
public String getZnName() { return znName; }
public void setZnName(String znName) { this.znName = znName; }
public String getZnEname() { return znEname; }
public void setZnEname(String znEname) { this.znEname = znEname; }
public String getZnNote() { return znNote; }
public void setZnNote(String znNote) { this.znNote = znNote; }
public Date getCreatedAt() { return createdAt; }
public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; }
public Date getUpdatedAt() { return updatedAt; }
public void setUpdatedAt(Date updatedAt) { this.updatedAt = updatedAt; }
public Integer getCountryCount() { return countryCount; }
public void setCountryCount(Integer countryCount) { this.countryCount = countryCount; }
@Override
public String toString()
{
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("zdId", getZdId())
.append("zsId", getZsId())
.append("zdSort", getZdSort())
.append("zdCode", getZdCode())
.append("znName", getZnName())
.append("znEname", getZnEname())
.append("znNote", getZnNote())
.append("createdAt", getCreatedAt())
.append("updatedAt", getUpdatedAt())
.append("countryCount", getCountryCount())
.toString();
}
}
@@ -0,0 +1,75 @@
package com.ruoyi.price.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 分区方案 xtd_zone_scheme
*
* @author ruoyi
*/
public class XtdZoneScheme extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 分区方案ID */
private Long zsId;
/** 方案名称 */
private String zsName;
/** 状态码(on/off) */
private String ssCode;
/** 产品组代码 */
private String pgCode;
/** 服务渠道ID */
private Long snId;
/** 备注 */
private String zsNote;
/** 租户ID */
private Long tmsId;
/** 区划数量(列表展示,非表字段) */
private Integer divisionCount;
public Long getZsId() { return zsId; }
public void setZsId(Long zsId) { this.zsId = zsId; }
public String getZsName() { return zsName; }
public void setZsName(String zsName) { this.zsName = zsName; }
public String getSsCode() { return ssCode; }
public void setSsCode(String ssCode) { this.ssCode = ssCode; }
public String getPgCode() { return pgCode; }
public void setPgCode(String pgCode) { this.pgCode = pgCode; }
public Long getSnId() { return snId; }
public void setSnId(Long snId) { this.snId = snId; }
public String getZsNote() { return zsNote; }
public void setZsNote(String zsNote) { this.zsNote = zsNote; }
public Long getTmsId() { return tmsId; }
public void setTmsId(Long tmsId) { this.tmsId = tmsId; }
public Integer getDivisionCount() { return divisionCount; }
public void setDivisionCount(Integer divisionCount) { this.divisionCount = divisionCount; }
@Override
public String toString()
{
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("zsId", getZsId())
.append("zsName", getZsName())
.append("ssCode", getSsCode())
.append("pgCode", getPgCode())
.append("snId", getSnId())
.append("zsNote", getZsNote())
.append("tmsId", getTmsId())
.append("divisionCount", getDivisionCount())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}
@@ -0,0 +1,32 @@
package com.ruoyi.price.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.price.domain.PrcCustomerPriceSet;
/**
* 客户套餐 数据层
*
* @author ruoyi
*/
public interface PrcCustomerPriceSetMapper
{
public PrcCustomerPriceSet selectPrcCustomerPriceSetById(Long customerPricesetId);
public List<PrcCustomerPriceSet> selectPrcCustomerPriceSetList(PrcCustomerPriceSet customer);
public int insertPrcCustomerPriceSet(PrcCustomerPriceSet customer);
public int updatePrcCustomerPriceSet(PrcCustomerPriceSet customer);
public int deletePrcCustomerPriceSetByIds(Long[] customerPricesetIds);
public int deletePrcCustomerPriceSetByPriceSetId(Long priceSetId);
public int countByPriceSetId(Long priceSetId);
public int countOverlap(@Param("customerId") Long customerId,
@Param("priceSetId") Long priceSetId,
@Param("beginDate") java.util.Date beginDate,
@Param("endDate") java.util.Date endDate);
}
@@ -0,0 +1,28 @@
package com.ruoyi.price.mapper;
import java.util.List;
import com.ruoyi.price.domain.PrcPriceSetDetail;
/**
* 价格套餐明细 数据层
*
* @author ruoyi
*/
public interface PrcPriceSetDetailMapper
{
public PrcPriceSetDetail selectPrcPriceSetDetailById(Long psdId);
public List<PrcPriceSetDetail> selectPrcPriceSetDetailList(PrcPriceSetDetail detail);
public int insertPrcPriceSetDetail(PrcPriceSetDetail detail);
public int updatePrcPriceSetDetail(PrcPriceSetDetail detail);
public int deletePrcPriceSetDetailByIds(Long[] psdIds);
public int deletePrcPriceSetDetailByPriceSetId(Long priceSetId);
public int countProductByPriceSetId(Long priceSetId);
public int countByPriceSetId(Long priceSetId);
}
@@ -0,0 +1,26 @@
package com.ruoyi.price.mapper;
import java.util.List;
import com.ruoyi.price.domain.PrcPriceSet;
/**
* 价格套餐 数据层
*
* @author ruoyi
*/
public interface PrcPriceSetMapper
{
public PrcPriceSet selectPrcPriceSetById(Long priceSetId);
public List<PrcPriceSet> selectPrcPriceSetList(PrcPriceSet set);
public int insertPrcPriceSet(PrcPriceSet set);
public int updatePrcPriceSet(PrcPriceSet set);
public int updatePrcPriceSetStatus(PrcPriceSet set);
public int deletePrcPriceSetByIds(Long[] priceSetIds);
public int countByName(PrcPriceSet set);
}
@@ -0,0 +1,26 @@
package com.ruoyi.price.mapper;
import java.util.List;
import com.ruoyi.price.domain.PrcWeightSectionDetail;
/**
* 重量段明细 数据层
*
* @author ruoyi
*/
public interface PrcWeightSectionDetailMapper
{
public PrcWeightSectionDetail selectPrcWeightSectionDetailById(Long wsdId);
public List<PrcWeightSectionDetail> selectPrcWeightSectionDetailListByWstId(Long wstId);
public List<PrcWeightSectionDetail> selectPrcWeightSectionDetailList(PrcWeightSectionDetail detail);
public int insertPrcWeightSectionDetail(PrcWeightSectionDetail detail);
public int updatePrcWeightSectionDetail(PrcWeightSectionDetail detail);
public int deletePrcWeightSectionDetailByIds(Long[] wsdIds);
public int countByWstId(Long wstId);
}
@@ -0,0 +1,22 @@
package com.ruoyi.price.mapper;
import java.util.List;
import com.ruoyi.price.domain.PrcWeightSectionTemplate;
/**
* 重量段模板 数据层
*
* @author ruoyi
*/
public interface PrcWeightSectionTemplateMapper
{
public PrcWeightSectionTemplate selectPrcWeightSectionTemplateById(Long wstId);
public List<PrcWeightSectionTemplate> selectPrcWeightSectionTemplateList(PrcWeightSectionTemplate template);
public int insertPrcWeightSectionTemplate(PrcWeightSectionTemplate template);
public int updatePrcWeightSectionTemplate(PrcWeightSectionTemplate template);
public int deletePrcWeightSectionTemplateByIds(Long[] wstIds);
}
@@ -0,0 +1,26 @@
package com.ruoyi.price.mapper;
import java.util.List;
import com.ruoyi.price.domain.XtdZoneCountry;
/**
* 分区国家 数据层
*
* @author ruoyi
*/
public interface XtdZoneCountryMapper
{
public XtdZoneCountry selectXtdZoneCountryById(Long zcId);
public List<XtdZoneCountry> selectXtdZoneCountryListByZdId(Long zdId);
public List<XtdZoneCountry> selectXtdZoneCountryList(XtdZoneCountry country);
public int insertXtdZoneCountry(XtdZoneCountry country);
public int updateXtdZoneCountry(XtdZoneCountry country);
public int deleteXtdZoneCountryByIds(Long[] zcIds);
public int countByZdId(Long zdId);
}
@@ -0,0 +1,26 @@
package com.ruoyi.price.mapper;
import java.util.List;
import com.ruoyi.price.domain.XtdZoneDivision;
/**
* 分区区划 数据层
*
* @author ruoyi
*/
public interface XtdZoneDivisionMapper
{
public XtdZoneDivision selectXtdZoneDivisionById(Long zdId);
public List<XtdZoneDivision> selectXtdZoneDivisionListByZsId(Long zsId);
public List<XtdZoneDivision> selectXtdZoneDivisionList(XtdZoneDivision division);
public int insertXtdZoneDivision(XtdZoneDivision division);
public int updateXtdZoneDivision(XtdZoneDivision division);
public int deleteXtdZoneDivisionByIds(Long[] zdIds);
public int countByZsId(Long zsId);
}
@@ -0,0 +1,22 @@
package com.ruoyi.price.mapper;
import java.util.List;
import com.ruoyi.price.domain.XtdZoneScheme;
/**
* 分区方案 数据层
*
* @author ruoyi
*/
public interface XtdZoneSchemeMapper
{
public XtdZoneScheme selectXtdZoneSchemeById(Long zsId);
public List<XtdZoneScheme> selectXtdZoneSchemeList(XtdZoneScheme scheme);
public int insertXtdZoneScheme(XtdZoneScheme scheme);
public int updateXtdZoneScheme(XtdZoneScheme scheme);
public int deleteXtdZoneSchemeByIds(Long[] zsIds);
}
@@ -0,0 +1,53 @@
package com.ruoyi.price.service;
import java.util.List;
import com.ruoyi.price.domain.PrcCustomerPriceSet;
import com.ruoyi.price.domain.PrcPriceSet;
import com.ruoyi.price.domain.PrcPriceSetCheckItem;
import com.ruoyi.price.domain.PrcPriceSetDetail;
/**
* 价格套餐 服务层
*
* @author ruoyi
*/
public interface IPrcPriceSetService
{
public PrcPriceSet selectPrcPriceSetById(Long priceSetId);
public List<PrcPriceSet> selectPrcPriceSetList(PrcPriceSet set);
public Long savePrcPriceSet(PrcPriceSet set);
public int updatePrcPriceSet(PrcPriceSet set);
public int deletePrcPriceSetByIds(Long[] priceSetIds);
public int submit(Long priceSetId, String updateBy);
public int approve(Long priceSetId, String updateBy);
public int reject(Long priceSetId, String updateBy);
public int disable(Long priceSetId, String updateBy);
public Long copy(Long priceSetId, String createBy);
public List<PrcPriceSetCheckItem> validate(PrcPriceSet set);
public List<PrcPriceSetDetail> selectDetailList(PrcPriceSetDetail detail);
public int insertDetail(PrcPriceSetDetail detail);
public int updateDetail(PrcPriceSetDetail detail);
public int deleteDetailByIds(Long[] psdIds);
public List<PrcCustomerPriceSet> selectCustomerList(PrcCustomerPriceSet customer);
public int insertCustomer(PrcCustomerPriceSet customer);
public int updateCustomer(PrcCustomerPriceSet customer);
public int deleteCustomerByIds(Long[] customerPricesetIds);
}
@@ -0,0 +1,33 @@
package com.ruoyi.price.service;
import java.util.List;
import com.ruoyi.price.domain.PrcWeightSectionDetail;
import com.ruoyi.price.domain.PrcWeightSectionTemplate;
/**
* 重量段管理 服务层
*
* @author ruoyi
*/
public interface IPrcWeightService
{
public PrcWeightSectionTemplate selectPrcWeightSectionTemplateById(Long wstId);
public List<PrcWeightSectionTemplate> selectPrcWeightSectionTemplateList(PrcWeightSectionTemplate template);
public int insertPrcWeightSectionTemplate(PrcWeightSectionTemplate template);
public int updatePrcWeightSectionTemplate(PrcWeightSectionTemplate template);
public int deletePrcWeightSectionTemplateByIds(Long[] wstIds);
public PrcWeightSectionDetail selectPrcWeightSectionDetailById(Long wsdId);
public List<PrcWeightSectionDetail> selectPrcWeightSectionDetailList(PrcWeightSectionDetail detail);
public int insertPrcWeightSectionDetail(PrcWeightSectionDetail detail);
public int updatePrcWeightSectionDetail(PrcWeightSectionDetail detail);
public int deletePrcWeightSectionDetailByIds(Long[] wsdIds);
}
@@ -0,0 +1,44 @@
package com.ruoyi.price.service;
import java.util.List;
import com.ruoyi.price.domain.XtdZoneCountry;
import com.ruoyi.price.domain.XtdZoneDivision;
import com.ruoyi.price.domain.XtdZoneScheme;
/**
* 分区管理 服务层
*
* @author ruoyi
*/
public interface IXtdZoneService
{
public XtdZoneScheme selectXtdZoneSchemeById(Long zsId);
public List<XtdZoneScheme> selectXtdZoneSchemeList(XtdZoneScheme scheme);
public int insertXtdZoneScheme(XtdZoneScheme scheme);
public int updateXtdZoneScheme(XtdZoneScheme scheme);
public int deleteXtdZoneSchemeByIds(Long[] zsIds);
public XtdZoneDivision selectXtdZoneDivisionById(Long zdId);
public List<XtdZoneDivision> selectXtdZoneDivisionList(XtdZoneDivision division);
public int insertXtdZoneDivision(XtdZoneDivision division);
public int updateXtdZoneDivision(XtdZoneDivision division);
public int deleteXtdZoneDivisionByIds(Long[] zdIds);
public XtdZoneCountry selectXtdZoneCountryById(Long zcId);
public List<XtdZoneCountry> selectXtdZoneCountryList(XtdZoneCountry country);
public int insertXtdZoneCountry(XtdZoneCountry country);
public int updateXtdZoneCountry(XtdZoneCountry country);
public int deleteXtdZoneCountryByIds(Long[] zcIds);
}
@@ -0,0 +1,751 @@
package com.ruoyi.price.service.impl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.price.domain.PrcCustomerPriceSet;
import com.ruoyi.price.domain.PrcPriceSet;
import com.ruoyi.price.domain.PrcPriceSetCheckItem;
import com.ruoyi.price.domain.PrcPriceSetDetail;
import com.ruoyi.price.mapper.PrcCustomerPriceSetMapper;
import com.ruoyi.price.mapper.PrcPriceSetDetailMapper;
import com.ruoyi.price.mapper.PrcPriceSetMapper;
import com.ruoyi.price.service.IPrcPriceSetService;
/**
* 价格套餐 服务层实现
*
* @author ruoyi
*/
@Service
public class PrcPriceSetServiceImpl implements IPrcPriceSetService
{
private static final String STATUS_DRAFT = "D";
private static final String STATUS_AUDIT = "A";
private static final String STATUS_EFFECT = "E";
private static final String STATUS_REJECT = "R";
private static final String STATUS_STOP = "S";
private static final String TYPE_FIXED = "FIXED";
private static final String TYPE_DISCOUNT = "DISCOUNT";
@Autowired
private PrcPriceSetMapper setMapper;
@Autowired
private PrcPriceSetDetailMapper detailMapper;
@Autowired
private PrcCustomerPriceSetMapper customerMapper;
@Override
public PrcPriceSet selectPrcPriceSetById(Long priceSetId)
{
PrcPriceSet set = setMapper.selectPrcPriceSetById(priceSetId);
if (set != null)
{
fillExpired(set);
PrcPriceSetDetail query = new PrcPriceSetDetail();
query.setPriceSetId(priceSetId);
set.setDetails(detailMapper.selectPrcPriceSetDetailList(query));
PrcCustomerPriceSet cquery = new PrcCustomerPriceSet();
cquery.setPriceSetId(priceSetId);
set.setCustomers(customerMapper.selectPrcCustomerPriceSetList(cquery));
}
return set;
}
@Override
public List<PrcPriceSet> selectPrcPriceSetList(PrcPriceSet set)
{
List<PrcPriceSet> list = setMapper.selectPrcPriceSetList(set);
for (PrcPriceSet item : list)
{
fillExpired(item);
}
return list;
}
@Override
@Transactional
public Long savePrcPriceSet(PrcPriceSet set)
{
validateBasic(set, false);
if (set.getPriceSetId() == null)
{
if (StringUtils.isEmpty(set.getStatus()))
{
set.setStatus(STATUS_DRAFT);
}
if (!STATUS_DRAFT.equals(set.getStatus()) && !STATUS_AUDIT.equals(set.getStatus()))
{
set.setStatus(STATUS_DRAFT);
}
if (StringUtils.isEmpty(set.getSetType()))
{
set.setSetType(TYPE_FIXED);
}
setMapper.insertPrcPriceSet(set);
if (StringUtils.isEmpty(set.getPriceSetCode()))
{
set.setPriceSetCode(String.format("SET%04d", set.getPriceSetId()));
setMapper.updatePrcPriceSet(set);
}
}
else
{
PrcPriceSet db = requireSet(set.getPriceSetId());
assertBasicEditable(db);
set.setStatus(db.getStatus());
setMapper.updatePrcPriceSet(set);
}
replaceChildren(set);
if ("Y".equalsIgnoreCase(set.getSubmitFlag()))
{
submit(set.getPriceSetId(), set.getUpdateBy() != null ? set.getUpdateBy() : set.getCreateBy());
}
return set.getPriceSetId();
}
@Override
public int updatePrcPriceSet(PrcPriceSet set)
{
PrcPriceSet db = requireSet(set.getPriceSetId());
assertBasicEditable(db);
validateBasic(set, false);
set.setStatus(db.getStatus());
return setMapper.updatePrcPriceSet(set);
}
@Override
@Transactional
public int deletePrcPriceSetByIds(Long[] priceSetIds)
{
for (Long id : priceSetIds)
{
PrcPriceSet db = requireSet(id);
if (!STATUS_DRAFT.equals(db.getStatus()) && !STATUS_REJECT.equals(db.getStatus()))
{
throw new ServiceException("仅草稿或驳回状态的套餐允许删除:" + displayName(db));
}
int bound = customerMapper.countByPriceSetId(id);
if (bound > 0)
{
throw new ServiceException("套餐【" + displayName(db) + "】已绑定客户,请先解绑后再删除");
}
detailMapper.deletePrcPriceSetDetailByPriceSetId(id);
}
return setMapper.deletePrcPriceSetByIds(priceSetIds);
}
@Override
public int submit(Long priceSetId, String updateBy)
{
PrcPriceSet db = requireSet(priceSetId);
if (!STATUS_DRAFT.equals(db.getStatus()) && !STATUS_REJECT.equals(db.getStatus()))
{
throw new ServiceException("当前状态不允许提交审核");
}
PrcPriceSet payload = selectPrcPriceSetById(priceSetId);
List<PrcPriceSetCheckItem> items = validate(payload);
assertNoFail(items);
PrcPriceSet upd = new PrcPriceSet();
upd.setPriceSetId(priceSetId);
upd.setStatus(STATUS_AUDIT);
upd.setUpdateBy(updateBy);
return setMapper.updatePrcPriceSetStatus(upd);
}
@Override
public int approve(Long priceSetId, String updateBy)
{
PrcPriceSet db = requireSet(priceSetId);
if (!STATUS_AUDIT.equals(db.getStatus()))
{
throw new ServiceException("仅审核中的套餐可以生效");
}
PrcPriceSet upd = new PrcPriceSet();
upd.setPriceSetId(priceSetId);
upd.setStatus(STATUS_EFFECT);
upd.setUpdateBy(updateBy);
return setMapper.updatePrcPriceSetStatus(upd);
}
@Override
public int reject(Long priceSetId, String updateBy)
{
PrcPriceSet db = requireSet(priceSetId);
if (!STATUS_AUDIT.equals(db.getStatus()))
{
throw new ServiceException("仅审核中的套餐可以驳回");
}
PrcPriceSet upd = new PrcPriceSet();
upd.setPriceSetId(priceSetId);
upd.setStatus(STATUS_REJECT);
upd.setUpdateBy(updateBy);
return setMapper.updatePrcPriceSetStatus(upd);
}
@Override
public int disable(Long priceSetId, String updateBy)
{
PrcPriceSet db = requireSet(priceSetId);
if (!STATUS_EFFECT.equals(db.getStatus()))
{
throw new ServiceException("仅生效中的套餐可以停用");
}
PrcPriceSet upd = new PrcPriceSet();
upd.setPriceSetId(priceSetId);
upd.setStatus(STATUS_STOP);
upd.setUpdateBy(updateBy);
return setMapper.updatePrcPriceSetStatus(upd);
}
@Override
@Transactional
public Long copy(Long priceSetId, String createBy)
{
PrcPriceSet src = selectPrcPriceSetById(priceSetId);
if (src == null)
{
throw new ServiceException("套餐不存在");
}
PrcPriceSet copy = new PrcPriceSet();
copy.setPriceSetName(src.getPriceSetName() + "-副本");
copy.setPriceSetNote(src.getPriceSetNote());
copy.setSetType(src.getSetType());
copy.setDefaultDiscount(src.getDefaultDiscount());
copy.setDefaultType(src.getDefaultType());
copy.setCalculateSign(src.getCalculateSign());
copy.setEffectiveDate(src.getEffectiveDate());
copy.setExpireDate(src.getExpireDate());
copy.setStatus(STATUS_DRAFT);
copy.setTmsId(src.getTmsId());
copy.setCreateBy(createBy);
List<PrcPriceSetDetail> details = new ArrayList<PrcPriceSetDetail>();
if (src.getDetails() != null)
{
for (PrcPriceSetDetail d : src.getDetails())
{
PrcPriceSetDetail nd = new PrcPriceSetDetail();
nd.setProductCode(d.getProductCode());
nd.setProductName(d.getProductName());
nd.setCountryCode(d.getCountryCode());
nd.setCountryName(d.getCountryName());
nd.setZdId(d.getZdId());
nd.setWsdId(d.getWsdId());
nd.setWeightLabel(d.getWeightLabel());
nd.setFvValue(d.getFvValue());
nd.setFvRegistrationFee(d.getFvRegistrationFee());
nd.setDiscountValue(d.getDiscountValue());
nd.setPrId(d.getPrId());
details.add(nd);
}
}
copy.setDetails(details);
copy.setCustomers(new ArrayList<PrcCustomerPriceSet>());
return savePrcPriceSet(copy);
}
@Override
public List<PrcPriceSetCheckItem> validate(PrcPriceSet set)
{
List<PrcPriceSetCheckItem> items = new ArrayList<PrcPriceSetCheckItem>();
if (set.getPriceSetId() != null && (set.getDetails() == null || set.getCustomers() == null))
{
PrcPriceSet db = selectPrcPriceSetById(set.getPriceSetId());
if (db != null)
{
if (StringUtils.isEmpty(set.getPriceSetName()))
{
set.setPriceSetName(db.getPriceSetName());
}
if (set.getSetType() == null)
{
set.setSetType(db.getSetType());
}
if (set.getEffectiveDate() == null)
{
set.setEffectiveDate(db.getEffectiveDate());
}
if (set.getExpireDate() == null)
{
set.setExpireDate(db.getExpireDate());
}
if (set.getDefaultDiscount() == null)
{
set.setDefaultDiscount(db.getDefaultDiscount());
}
if (set.getDetails() == null)
{
set.setDetails(db.getDetails());
}
if (set.getCustomers() == null)
{
set.setCustomers(db.getCustomers());
}
}
}
int nameCount = setMapper.countByName(set);
if (StringUtils.isEmpty(set.getPriceSetName()))
{
items.add(new PrcPriceSetCheckItem("套餐名称是否重复", "FAIL", "套餐名称不能为空"));
}
else if (nameCount > 0)
{
items.add(new PrcPriceSetCheckItem("套餐名称是否重复", "FAIL", "当前名称已被占用"));
}
else
{
items.add(new PrcPriceSetCheckItem("套餐名称是否重复", "PASS", "当前名称未占用"));
}
if (set.getEffectiveDate() == null)
{
items.add(new PrcPriceSetCheckItem("生效日期 ≤ 失效日期", "FAIL", "生效日期不能为空"));
}
else if (set.getExpireDate() != null && set.getEffectiveDate().after(set.getExpireDate()))
{
items.add(new PrcPriceSetCheckItem("生效日期 ≤ 失效日期", "FAIL", "生效日期不能晚于失效日期"));
}
else
{
String msg = DateUtils.parseDateToStr("yyyy-MM-dd", set.getEffectiveDate())
+ " ≤ "
+ (set.getExpireDate() == null ? "长期" : DateUtils.parseDateToStr("yyyy-MM-dd", set.getExpireDate()));
items.add(new PrcPriceSetCheckItem("生效日期 ≤ 失效日期", "PASS", msg));
}
String setType = StringUtils.isEmpty(set.getSetType()) ? TYPE_FIXED : set.getSetType();
List<PrcPriceSetDetail> details = filterDetails(set.getDetails());
if (TYPE_FIXED.equals(setType))
{
int incomplete = 0;
for (PrcPriceSetDetail d : details)
{
if (StringUtils.isEmpty(d.getProductCode()) || StringUtils.isEmpty(d.getCountryCode())
|| (d.getWsdId() == null && StringUtils.isEmpty(d.getWeightLabel()))
|| d.getFvValue() == null || d.getFvRegistrationFee() == null)
{
incomplete++;
}
}
if (details.isEmpty())
{
items.add(new PrcPriceSetCheckItem("FIXED 明细完整性", "FAIL", "固定价模式至少需要 1 条明细"));
}
else if (incomplete > 0)
{
items.add(new PrcPriceSetCheckItem("FIXED 明细完整性", "FAIL", incomplete + " 条明细缺少产品/国家/重量段/运费/挂号费"));
}
else
{
items.add(new PrcPriceSetCheckItem("FIXED 明细完整性", "PASS", details.size() + " 条明细,运费与挂号费均填写"));
}
}
else
{
if (set.getDefaultDiscount() == null
|| set.getDefaultDiscount().compareTo(BigDecimal.ONE) < 0
|| set.getDefaultDiscount().compareTo(new BigDecimal("99")) > 0)
{
items.add(new PrcPriceSetCheckItem("DISCOUNT 默认折扣", "FAIL", "折扣模式默认折扣需在 1~99"));
}
else
{
items.add(new PrcPriceSetCheckItem("DISCOUNT 默认折扣", "PASS", "默认折扣 " + set.getDefaultDiscount().stripTrailingZeros().toPlainString() + "%"));
}
}
Set<String> uniq = new HashSet<String>();
boolean dup = false;
for (PrcPriceSetDetail d : details)
{
String key;
if (TYPE_FIXED.equals(setType))
{
key = nvl(d.getProductCode()) + "|" + nvl(d.getCountryCode()) + "|"
+ (d.getWsdId() != null ? d.getWsdId() : nvl(d.getWeightLabel()));
}
else
{
key = nvl(d.getProductCode());
}
if (!uniq.add(key) && StringUtils.isNotEmpty(d.getProductCode()))
{
dup = true;
break;
}
}
if (dup)
{
items.add(new PrcPriceSetCheckItem("同产品同国家同重量段是否重复", "FAIL", "存在重复明细"));
}
else
{
items.add(new PrcPriceSetCheckItem("同产品同国家同重量段是否重复", "PASS", "无重复明细"));
}
List<PrcCustomerPriceSet> customers = filterCustomers(set.getCustomers());
int overlap = 0;
for (PrcCustomerPriceSet c : customers)
{
overlap += customerMapper.countOverlap(c.getCustomerId(), set.getPriceSetId(),
c.getPrBegindate() != null ? c.getPrBegindate() : set.getEffectiveDate(),
c.getPrEnddate() != null ? c.getPrEnddate() : set.getExpireDate());
}
if (overlap > 0)
{
items.add(new PrcPriceSetCheckItem("与同客户现有套餐是否冲突", "WARN", "存在 " + overlap + " 条与已生效套餐日期重叠的客户绑定,可共存但需确认优先级"));
}
else if (customers.isEmpty())
{
items.add(new PrcPriceSetCheckItem("与同客户现有套餐是否冲突", "INFO", "暂未绑定客户,可后续补充"));
}
else
{
items.add(new PrcPriceSetCheckItem("与同客户现有套餐是否冲突", "PASS", "未发现与已生效套餐的日期重叠"));
}
if (TYPE_FIXED.equals(setType) && !details.isEmpty())
{
items.add(new PrcPriceSetCheckItem("运费单价 vs 默认等级价偏差", "INFO", "默认等级价对照将在计费试算上线后自动计算"));
}
else if (TYPE_DISCOUNT.equals(setType))
{
items.add(new PrcPriceSetCheckItem("运费单价 vs 默认等级价偏差", "INFO", "折扣模式按下单时默认等级价 × 折扣计费"));
}
return items;
}
@Override
public List<PrcPriceSetDetail> selectDetailList(PrcPriceSetDetail detail)
{
return detailMapper.selectPrcPriceSetDetailList(detail);
}
@Override
public int insertDetail(PrcPriceSetDetail detail)
{
PrcPriceSet db = requireSet(detail.getPriceSetId());
assertChildEditable(db);
validateDetail(db, detail);
return detailMapper.insertPrcPriceSetDetail(detail);
}
@Override
public int updateDetail(PrcPriceSetDetail detail)
{
PrcPriceSetDetail old = detailMapper.selectPrcPriceSetDetailById(detail.getPsdId());
if (old == null)
{
throw new ServiceException("套餐明细不存在");
}
PrcPriceSet db = requireSet(old.getPriceSetId());
assertChildEditable(db);
detail.setPriceSetId(old.getPriceSetId());
validateDetail(db, detail);
return detailMapper.updatePrcPriceSetDetail(detail);
}
@Override
public int deleteDetailByIds(Long[] psdIds)
{
for (Long id : psdIds)
{
PrcPriceSetDetail old = detailMapper.selectPrcPriceSetDetailById(id);
if (old == null)
{
continue;
}
PrcPriceSet db = requireSet(old.getPriceSetId());
assertChildEditable(db);
}
return detailMapper.deletePrcPriceSetDetailByIds(psdIds);
}
@Override
public List<PrcCustomerPriceSet> selectCustomerList(PrcCustomerPriceSet customer)
{
return customerMapper.selectPrcCustomerPriceSetList(customer);
}
@Override
public int insertCustomer(PrcCustomerPriceSet customer)
{
PrcPriceSet db = requireSet(customer.getPriceSetId());
assertChildEditable(db);
validateCustomer(customer, db);
if (customer.getBindPriority() == null)
{
customer.setBindPriority(1);
}
return customerMapper.insertPrcCustomerPriceSet(customer);
}
@Override
public int updateCustomer(PrcCustomerPriceSet customer)
{
PrcCustomerPriceSet old = customerMapper.selectPrcCustomerPriceSetById(customer.getCustomerPricesetId());
if (old == null)
{
throw new ServiceException("客户绑定不存在");
}
PrcPriceSet db = requireSet(old.getPriceSetId());
assertChildEditable(db);
customer.setPriceSetId(old.getPriceSetId());
validateCustomer(customer, db);
return customerMapper.updatePrcCustomerPriceSet(customer);
}
@Override
public int deleteCustomerByIds(Long[] customerPricesetIds)
{
for (Long id : customerPricesetIds)
{
PrcCustomerPriceSet old = customerMapper.selectPrcCustomerPriceSetById(id);
if (old == null)
{
continue;
}
PrcPriceSet db = requireSet(old.getPriceSetId());
if (STATUS_AUDIT.equals(db.getStatus()))
{
throw new ServiceException("审核中的套餐不允许解绑客户");
}
}
return customerMapper.deletePrcCustomerPriceSetByIds(customerPricesetIds);
}
private void replaceChildren(PrcPriceSet set)
{
if (set.getDetails() != null)
{
detailMapper.deletePrcPriceSetDetailByPriceSetId(set.getPriceSetId());
for (PrcPriceSetDetail d : filterDetails(set.getDetails()))
{
validateDetail(set, d);
d.setPsdId(null);
d.setPriceSetId(set.getPriceSetId());
detailMapper.insertPrcPriceSetDetail(d);
}
}
if (set.getCustomers() != null)
{
customerMapper.deletePrcCustomerPriceSetByPriceSetId(set.getPriceSetId());
for (PrcCustomerPriceSet c : filterCustomers(set.getCustomers()))
{
validateCustomer(c, set);
c.setCustomerPricesetId(null);
c.setPriceSetId(set.getPriceSetId());
c.setCreateBy(set.getCreateBy());
if (c.getBindPriority() == null)
{
c.setBindPriority(1);
}
customerMapper.insertPrcCustomerPriceSet(c);
}
}
}
private void validateBasic(PrcPriceSet set, boolean strictSubmit)
{
if (StringUtils.isEmpty(set.getPriceSetName()))
{
throw new ServiceException("套餐名称不能为空");
}
if (set.getEffectiveDate() == null)
{
throw new ServiceException("生效日期不能为空");
}
if (set.getExpireDate() != null && set.getEffectiveDate().after(set.getExpireDate()))
{
throw new ServiceException("生效日期不能晚于失效日期");
}
if (TYPE_DISCOUNT.equals(set.getSetType()))
{
if (set.getDefaultDiscount() == null
|| set.getDefaultDiscount().compareTo(BigDecimal.ONE) < 0
|| set.getDefaultDiscount().compareTo(new BigDecimal("99")) > 0)
{
throw new ServiceException("折扣模式默认折扣需在 1~99");
}
}
if (setMapper.countByName(set) > 0)
{
throw new ServiceException("套餐名称已存在");
}
if (strictSubmit)
{
assertNoFail(validate(set));
}
}
private void validateDetail(PrcPriceSet set, PrcPriceSetDetail detail)
{
if (StringUtils.isEmpty(detail.getProductCode()))
{
throw new ServiceException("明细产品代码不能为空");
}
if (TYPE_FIXED.equals(set.getSetType()))
{
if (StringUtils.isEmpty(detail.getCountryCode()))
{
throw new ServiceException("固定价明细必须填写国家");
}
if (detail.getWsdId() == null && StringUtils.isEmpty(detail.getWeightLabel()))
{
throw new ServiceException("固定价明细必须填写重量段");
}
if (detail.getFvValue() == null)
{
throw new ServiceException("固定价明细必须填写运费单价");
}
if (detail.getFvRegistrationFee() == null)
{
throw new ServiceException("固定价明细必须填写挂号费");
}
}
if (StringUtils.isNotEmpty(detail.getCountryCode()))
{
detail.setCountryCode(detail.getCountryCode().toUpperCase());
}
}
private void validateCustomer(PrcCustomerPriceSet customer, PrcPriceSet set)
{
if (customer.getCustomerId() == null || customer.getCustomerId().longValue() <= 0)
{
throw new ServiceException("客户ID不能为空");
}
if (customer.getPrBegindate() == null)
{
customer.setPrBegindate(set.getEffectiveDate());
}
if (customer.getPrBegindate() == null)
{
throw new ServiceException("客户绑定生效日期不能为空");
}
if (customer.getPrEnddate() != null && customer.getPrBegindate().after(customer.getPrEnddate()))
{
throw new ServiceException("客户绑定生效日期不能晚于失效日期");
}
if (customer.getBindPriority() != null && customer.getBindPriority().intValue() < 1)
{
throw new ServiceException("优先级必须大于等于 1");
}
}
private void assertBasicEditable(PrcPriceSet db)
{
if (STATUS_AUDIT.equals(db.getStatus()))
{
throw new ServiceException("审核中的套餐不允许修改");
}
if (STATUS_STOP.equals(db.getStatus()))
{
throw new ServiceException("已停用的套餐不允许修改,请使用复用新建");
}
}
private void assertChildEditable(PrcPriceSet db)
{
if (STATUS_AUDIT.equals(db.getStatus()))
{
throw new ServiceException("审核中的套餐不允许改明细或客户");
}
if (STATUS_STOP.equals(db.getStatus()))
{
throw new ServiceException("已停用的套餐不允许改明细或客户");
}
}
private void assertNoFail(List<PrcPriceSetCheckItem> items)
{
for (PrcPriceSetCheckItem item : items)
{
if ("FAIL".equals(item.getResult()))
{
throw new ServiceException(item.getItem() + ":" + item.getMessage());
}
}
}
private PrcPriceSet requireSet(Long priceSetId)
{
PrcPriceSet db = setMapper.selectPrcPriceSetById(priceSetId);
if (db == null)
{
throw new ServiceException("套餐不存在");
}
return db;
}
private void fillExpired(PrcPriceSet set)
{
Date today = DateUtils.parseDate(DateUtils.getDate());
boolean expired = STATUS_EFFECT.equals(set.getStatus())
&& set.getExpireDate() != null
&& today != null
&& set.getExpireDate().before(today);
set.setExpired(Boolean.valueOf(expired));
}
private List<PrcPriceSetDetail> filterDetails(List<PrcPriceSetDetail> details)
{
List<PrcPriceSetDetail> list = new ArrayList<PrcPriceSetDetail>();
if (details == null)
{
return list;
}
for (PrcPriceSetDetail d : details)
{
if (d != null && StringUtils.isNotEmpty(d.getProductCode()))
{
list.add(d);
}
}
return list;
}
private List<PrcCustomerPriceSet> filterCustomers(List<PrcCustomerPriceSet> customers)
{
List<PrcCustomerPriceSet> list = new ArrayList<PrcCustomerPriceSet>();
if (customers == null)
{
return list;
}
for (PrcCustomerPriceSet c : customers)
{
if (c != null && c.getCustomerId() != null && c.getCustomerId().longValue() > 0)
{
list.add(c);
}
}
return list;
}
private String displayName(PrcPriceSet set)
{
if (StringUtils.isNotEmpty(set.getPriceSetCode()))
{
return set.getPriceSetCode() + " " + set.getPriceSetName();
}
return set.getPriceSetName();
}
private String nvl(String val)
{
return val == null ? "" : val;
}
}
@@ -0,0 +1,116 @@
package com.ruoyi.price.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.price.domain.PrcWeightSectionDetail;
import com.ruoyi.price.domain.PrcWeightSectionTemplate;
import com.ruoyi.price.mapper.PrcWeightSectionDetailMapper;
import com.ruoyi.price.mapper.PrcWeightSectionTemplateMapper;
import com.ruoyi.price.service.IPrcWeightService;
/**
* 重量段管理 服务层实现
*
* @author ruoyi
*/
@Service
public class PrcWeightServiceImpl implements IPrcWeightService
{
@Autowired
private PrcWeightSectionTemplateMapper templateMapper;
@Autowired
private PrcWeightSectionDetailMapper detailMapper;
@Override
public PrcWeightSectionTemplate selectPrcWeightSectionTemplateById(Long wstId)
{
PrcWeightSectionTemplate template = templateMapper.selectPrcWeightSectionTemplateById(wstId);
if (template != null)
{
template.setDetailCount(detailMapper.countByWstId(wstId));
}
return template;
}
@Override
public List<PrcWeightSectionTemplate> selectPrcWeightSectionTemplateList(PrcWeightSectionTemplate template)
{
List<PrcWeightSectionTemplate> list = templateMapper.selectPrcWeightSectionTemplateList(template);
for (PrcWeightSectionTemplate item : list)
{
item.setDetailCount(detailMapper.countByWstId(item.getWstId()));
}
return list;
}
@Override
public int insertPrcWeightSectionTemplate(PrcWeightSectionTemplate template)
{
if (StringUtils.isEmpty(template.getSsCode()))
{
template.setSsCode("on");
}
return templateMapper.insertPrcWeightSectionTemplate(template);
}
@Override
public int updatePrcWeightSectionTemplate(PrcWeightSectionTemplate template)
{
// ss_code=on 时仍允许编辑(当前阶段)
return templateMapper.updatePrcWeightSectionTemplate(template);
}
@Override
public int deletePrcWeightSectionTemplateByIds(Long[] wstIds)
{
return templateMapper.deletePrcWeightSectionTemplateByIds(wstIds);
}
@Override
public PrcWeightSectionDetail selectPrcWeightSectionDetailById(Long wsdId)
{
return detailMapper.selectPrcWeightSectionDetailById(wsdId);
}
@Override
public List<PrcWeightSectionDetail> selectPrcWeightSectionDetailList(PrcWeightSectionDetail detail)
{
return detailMapper.selectPrcWeightSectionDetailList(detail);
}
@Override
public int insertPrcWeightSectionDetail(PrcWeightSectionDetail detail)
{
validateWeightRange(detail);
return detailMapper.insertPrcWeightSectionDetail(detail);
}
@Override
public int updatePrcWeightSectionDetail(PrcWeightSectionDetail detail)
{
validateWeightRange(detail);
return detailMapper.updatePrcWeightSectionDetail(detail);
}
@Override
public int deletePrcWeightSectionDetailByIds(Long[] wsdIds)
{
return detailMapper.deletePrcWeightSectionDetailByIds(wsdIds);
}
private void validateWeightRange(PrcWeightSectionDetail detail)
{
if (detail.getWlStartweight() == null || detail.getWlEndweight() == null)
{
throw new ServiceException("起始重量和结束重量不能为空");
}
if (detail.getWlStartweight().compareTo(detail.getWlEndweight()) >= 0)
{
throw new ServiceException("起始重量必须小于结束重量");
}
}
}
@@ -0,0 +1,160 @@
package com.ruoyi.price.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.price.domain.XtdZoneCountry;
import com.ruoyi.price.domain.XtdZoneDivision;
import com.ruoyi.price.domain.XtdZoneScheme;
import com.ruoyi.price.mapper.XtdZoneCountryMapper;
import com.ruoyi.price.mapper.XtdZoneDivisionMapper;
import com.ruoyi.price.mapper.XtdZoneSchemeMapper;
import com.ruoyi.price.service.IXtdZoneService;
/**
* 分区管理 服务层实现
*
* @author ruoyi
*/
@Service
public class XtdZoneServiceImpl implements IXtdZoneService
{
@Autowired
private XtdZoneSchemeMapper schemeMapper;
@Autowired
private XtdZoneDivisionMapper divisionMapper;
@Autowired
private XtdZoneCountryMapper countryMapper;
@Override
public XtdZoneScheme selectXtdZoneSchemeById(Long zsId)
{
XtdZoneScheme scheme = schemeMapper.selectXtdZoneSchemeById(zsId);
if (scheme != null)
{
scheme.setDivisionCount(divisionMapper.countByZsId(zsId));
}
return scheme;
}
@Override
public List<XtdZoneScheme> selectXtdZoneSchemeList(XtdZoneScheme scheme)
{
List<XtdZoneScheme> list = schemeMapper.selectXtdZoneSchemeList(scheme);
for (XtdZoneScheme item : list)
{
item.setDivisionCount(divisionMapper.countByZsId(item.getZsId()));
}
return list;
}
@Override
public int insertXtdZoneScheme(XtdZoneScheme scheme)
{
if (StringUtils.isEmpty(scheme.getSsCode()))
{
scheme.setSsCode("on");
}
return schemeMapper.insertXtdZoneScheme(scheme);
}
@Override
public int updateXtdZoneScheme(XtdZoneScheme scheme)
{
return schemeMapper.updateXtdZoneScheme(scheme);
}
@Override
public int deleteXtdZoneSchemeByIds(Long[] zsIds)
{
for (Long zsId : zsIds)
{
int count = divisionMapper.countByZsId(zsId);
if (count > 0)
{
XtdZoneScheme scheme = schemeMapper.selectXtdZoneSchemeById(zsId);
String name = scheme != null ? scheme.getZsName() : String.valueOf(zsId);
throw new ServiceException("分区方案【" + name + "】存在区划明细,不允许删除");
}
}
return schemeMapper.deleteXtdZoneSchemeByIds(zsIds);
}
@Override
public XtdZoneDivision selectXtdZoneDivisionById(Long zdId)
{
XtdZoneDivision division = divisionMapper.selectXtdZoneDivisionById(zdId);
if (division != null)
{
division.setCountryCount(countryMapper.countByZdId(zdId));
}
return division;
}
@Override
public List<XtdZoneDivision> selectXtdZoneDivisionList(XtdZoneDivision division)
{
List<XtdZoneDivision> list = divisionMapper.selectXtdZoneDivisionList(division);
for (XtdZoneDivision item : list)
{
item.setCountryCount(countryMapper.countByZdId(item.getZdId()));
}
return list;
}
@Override
public int insertXtdZoneDivision(XtdZoneDivision division)
{
return divisionMapper.insertXtdZoneDivision(division);
}
@Override
public int updateXtdZoneDivision(XtdZoneDivision division)
{
return divisionMapper.updateXtdZoneDivision(division);
}
@Override
public int deleteXtdZoneDivisionByIds(Long[] zdIds)
{
return divisionMapper.deleteXtdZoneDivisionByIds(zdIds);
}
@Override
public XtdZoneCountry selectXtdZoneCountryById(Long zcId)
{
return countryMapper.selectXtdZoneCountryById(zcId);
}
@Override
public List<XtdZoneCountry> selectXtdZoneCountryList(XtdZoneCountry country)
{
return countryMapper.selectXtdZoneCountryList(country);
}
@Override
public int insertXtdZoneCountry(XtdZoneCountry country)
{
if (StringUtils.isEmpty(country.getZcDividekind()))
{
country.setZcDividekind("C");
}
return countryMapper.insertXtdZoneCountry(country);
}
@Override
public int updateXtdZoneCountry(XtdZoneCountry country)
{
return countryMapper.updateXtdZoneCountry(country);
}
@Override
public int deleteXtdZoneCountryByIds(Long[] zcIds)
{
return countryMapper.deleteXtdZoneCountryByIds(zcIds);
}
}
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.price.mapper.PrcCustomerPriceSetMapper">
<resultMap type="PrcCustomerPriceSet" id="PrcCustomerPriceSetResult">
<id property="customerPricesetId" column="customer_priceset_id" />
<result property="priceSetId" column="price_set_id" />
<result property="customerId" column="customer_id" />
<result property="customerName" column="customer_name" />
<result property="bindPriority" column="bind_priority" />
<result property="prBegindate" column="pr_begindate" />
<result property="prEnddate" column="pr_enddate" />
<result property="priceSetNote" column="price_set_note" />
<result property="createBy" column="created_by" />
<result property="createTime" column="created_at" />
<result property="updateBy" column="updated_by" />
<result property="updateTime" column="updated_at" />
</resultMap>
<sql id="selectPrcCustomerPriceSetVo">
select customer_priceset_id, price_set_id, customer_id, customer_name, bind_priority,
pr_begindate, pr_enddate, price_set_note,
created_by, created_at, updated_by, updated_at
from prc_customer_price_set
</sql>
<select id="selectPrcCustomerPriceSetById" parameterType="Long" resultMap="PrcCustomerPriceSetResult">
<include refid="selectPrcCustomerPriceSetVo"/>
where customer_priceset_id = #{customerPricesetId}
</select>
<select id="selectPrcCustomerPriceSetList" parameterType="PrcCustomerPriceSet" resultMap="PrcCustomerPriceSetResult">
<include refid="selectPrcCustomerPriceSetVo"/>
<where>
<if test="priceSetId != null">
AND price_set_id = #{priceSetId}
</if>
<if test="customerId != null">
AND customer_id = #{customerId}
</if>
<if test="customerName != null and customerName != ''">
AND customer_name like concat('%', #{customerName}, '%')
</if>
</where>
order by bind_priority asc, customer_priceset_id asc
</select>
<select id="countByPriceSetId" parameterType="Long" resultType="int">
select count(1) from prc_customer_price_set where price_set_id = #{priceSetId}
</select>
<select id="countOverlap" resultType="int">
select count(1)
from prc_customer_price_set c
inner join prc_price_set s on s.price_set_id = c.price_set_id
where c.customer_id = #{customerId}
and s.status = 'E'
<if test="priceSetId != null">
AND c.price_set_id &lt;&gt; #{priceSetId}
</if>
and c.pr_begindate &lt;= ifnull(#{endDate}, '9999-12-31')
and ifnull(c.pr_enddate, '9999-12-31') &gt;= #{beginDate}
</select>
<insert id="insertPrcCustomerPriceSet" parameterType="PrcCustomerPriceSet" useGeneratedKeys="true" keyProperty="customerPricesetId">
insert into prc_customer_price_set (
<if test="priceSetId != null">price_set_id,</if>
<if test="customerId != null">customer_id,</if>
<if test="customerName != null">customer_name,</if>
<if test="bindPriority != null">bind_priority,</if>
<if test="prBegindate != null">pr_begindate,</if>
<if test="prEnddate != null">pr_enddate,</if>
<if test="priceSetNote != null">price_set_note,</if>
<if test="createBy != null and createBy != ''">created_by,</if>
created_at
) values (
<if test="priceSetId != null">#{priceSetId},</if>
<if test="customerId != null">#{customerId},</if>
<if test="customerName != null">#{customerName},</if>
<if test="bindPriority != null">#{bindPriority},</if>
<if test="prBegindate != null">#{prBegindate},</if>
<if test="prEnddate != null">#{prEnddate},</if>
<if test="priceSetNote != null">#{priceSetNote},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updatePrcCustomerPriceSet" parameterType="PrcCustomerPriceSet">
update prc_customer_price_set
<set>
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="customerName != null">customer_name = #{customerName},</if>
<if test="bindPriority != null">bind_priority = #{bindPriority},</if>
<if test="prBegindate != null">pr_begindate = #{prBegindate},</if>
pr_enddate = #{prEnddate},
<if test="priceSetNote != null">price_set_note = #{priceSetNote},</if>
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
updated_at = sysdate()
</set>
where customer_priceset_id = #{customerPricesetId}
</update>
<delete id="deletePrcCustomerPriceSetByIds" parameterType="Long">
delete from prc_customer_price_set where customer_priceset_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deletePrcCustomerPriceSetByPriceSetId" parameterType="Long">
delete from prc_customer_price_set where price_set_id = #{priceSetId}
</delete>
</mapper>
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.price.mapper.PrcPriceSetDetailMapper">
<resultMap type="PrcPriceSetDetail" id="PrcPriceSetDetailResult">
<id property="psdId" column="psd_id" />
<result property="priceSetId" column="price_set_id" />
<result property="productCode" column="product_code" />
<result property="productName" column="product_name" />
<result property="countryCode" column="country_code" />
<result property="countryName" column="country_name" />
<result property="zdId" column="zd_id" />
<result property="wsdId" column="wsd_id" />
<result property="weightLabel" column="weight_label" />
<result property="fvValue" column="fv_value" />
<result property="fvRegistrationFee" column="fv_registration_fee" />
<result property="discountValue" column="discount_value" />
<result property="prId" column="pr_id" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
</resultMap>
<sql id="selectPrcPriceSetDetailVo">
select psd_id, price_set_id, product_code, product_name, country_code, country_name,
zd_id, wsd_id, weight_label, fv_value, fv_registration_fee, discount_value,
pr_id, created_at, updated_at
from prc_price_set_detail
</sql>
<select id="selectPrcPriceSetDetailById" parameterType="Long" resultMap="PrcPriceSetDetailResult">
<include refid="selectPrcPriceSetDetailVo"/>
where psd_id = #{psdId}
</select>
<select id="selectPrcPriceSetDetailList" parameterType="PrcPriceSetDetail" resultMap="PrcPriceSetDetailResult">
<include refid="selectPrcPriceSetDetailVo"/>
<where>
<if test="priceSetId != null">
AND price_set_id = #{priceSetId}
</if>
<if test="productCode != null and productCode != ''">
AND product_code = #{productCode}
</if>
<if test="countryCode != null and countryCode != ''">
AND country_code = #{countryCode}
</if>
</where>
order by psd_id asc
</select>
<select id="countProductByPriceSetId" parameterType="Long" resultType="int">
select count(distinct product_code) from prc_price_set_detail where price_set_id = #{priceSetId}
</select>
<select id="countByPriceSetId" parameterType="Long" resultType="int">
select count(1) from prc_price_set_detail where price_set_id = #{priceSetId}
</select>
<insert id="insertPrcPriceSetDetail" parameterType="PrcPriceSetDetail" useGeneratedKeys="true" keyProperty="psdId">
insert into prc_price_set_detail (
<if test="priceSetId != null">price_set_id,</if>
<if test="productCode != null and productCode != ''">product_code,</if>
<if test="productName != null">product_name,</if>
<if test="countryCode != null">country_code,</if>
<if test="countryName != null">country_name,</if>
<if test="zdId != null">zd_id,</if>
<if test="wsdId != null">wsd_id,</if>
<if test="weightLabel != null">weight_label,</if>
<if test="fvValue != null">fv_value,</if>
<if test="fvRegistrationFee != null">fv_registration_fee,</if>
<if test="discountValue != null">discount_value,</if>
<if test="prId != null">pr_id,</if>
created_at
) values (
<if test="priceSetId != null">#{priceSetId},</if>
<if test="productCode != null and productCode != ''">#{productCode},</if>
<if test="productName != null">#{productName},</if>
<if test="countryCode != null">#{countryCode},</if>
<if test="countryName != null">#{countryName},</if>
<if test="zdId != null">#{zdId},</if>
<if test="wsdId != null">#{wsdId},</if>
<if test="weightLabel != null">#{weightLabel},</if>
<if test="fvValue != null">#{fvValue},</if>
<if test="fvRegistrationFee != null">#{fvRegistrationFee},</if>
<if test="discountValue != null">#{discountValue},</if>
<if test="prId != null">#{prId},</if>
sysdate()
)
</insert>
<update id="updatePrcPriceSetDetail" parameterType="PrcPriceSetDetail">
update prc_price_set_detail
<set>
<if test="productCode != null and productCode != ''">product_code = #{productCode},</if>
<if test="productName != null">product_name = #{productName},</if>
country_code = #{countryCode},
country_name = #{countryName},
zd_id = #{zdId},
wsd_id = #{wsdId},
weight_label = #{weightLabel},
fv_value = #{fvValue},
fv_registration_fee = #{fvRegistrationFee},
discount_value = #{discountValue},
pr_id = #{prId},
updated_at = sysdate()
</set>
where psd_id = #{psdId}
</update>
<delete id="deletePrcPriceSetDetailByIds" parameterType="Long">
delete from prc_price_set_detail where psd_id in
<foreach item="psdId" collection="array" open="(" separator="," close=")">
#{psdId}
</foreach>
</delete>
<delete id="deletePrcPriceSetDetailByPriceSetId" parameterType="Long">
delete from prc_price_set_detail where price_set_id = #{priceSetId}
</delete>
</mapper>
@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.price.mapper.PrcPriceSetMapper">
<resultMap type="PrcPriceSet" id="PrcPriceSetResult">
<id property="priceSetId" column="price_set_id" />
<result property="priceSetCode" column="price_set_code" />
<result property="priceSetName" column="price_set_name" />
<result property="priceSetNote" column="price_set_note" />
<result property="setType" column="set_type" />
<result property="defaultDiscount" column="default_discount" />
<result property="defaultType" column="default_type" />
<result property="calculateSign" column="calculate_sign" />
<result property="effectiveDate" column="effective_date" />
<result property="expireDate" column="expire_date" />
<result property="status" column="status" />
<result property="tmsId" column="tms_id" />
<result property="createBy" column="created_by" />
<result property="createTime" column="created_at" />
<result property="updateBy" column="updated_by" />
<result property="updateTime" column="updated_at" />
<result property="productCount" column="product_count" />
<result property="customerCount" column="customer_count" />
</resultMap>
<sql id="selectPrcPriceSetVo">
select s.price_set_id, s.price_set_code, s.price_set_name, s.price_set_note,
s.set_type, s.default_discount, s.default_type, s.calculate_sign,
s.effective_date, s.expire_date, s.status, s.tms_id,
s.created_by, s.created_at, s.updated_by, s.updated_at,
(select count(distinct d.product_code) from prc_price_set_detail d where d.price_set_id = s.price_set_id) as product_count,
(select count(1) from prc_customer_price_set c where c.price_set_id = s.price_set_id) as customer_count
from prc_price_set s
</sql>
<select id="selectPrcPriceSetById" parameterType="Long" resultMap="PrcPriceSetResult">
<include refid="selectPrcPriceSetVo"/>
where s.price_set_id = #{priceSetId}
</select>
<select id="selectPrcPriceSetList" parameterType="PrcPriceSet" resultMap="PrcPriceSetResult">
<include refid="selectPrcPriceSetVo"/>
<where>
<if test="setType != null and setType != ''">
AND s.set_type = #{setType}
</if>
<if test="status != null and status != ''">
AND s.status = #{status}
</if>
<if test="tmsId != null">
AND s.tms_id = #{tmsId}
</if>
<if test="priceSetName != null and priceSetName != ''">
AND s.price_set_name like concat('%', #{priceSetName}, '%')
</if>
<if test="keyword != null and keyword != ''">
AND (
s.price_set_code like concat('%', #{keyword}, '%')
OR s.price_set_name like concat('%', #{keyword}, '%')
OR exists (
select 1 from prc_customer_price_set c
where c.price_set_id = s.price_set_id
and (
c.customer_name like concat('%', #{keyword}, '%')
or concat(c.customer_id, '') like concat('%', #{keyword}, '%')
)
)
)
</if>
</where>
order by s.price_set_id desc
</select>
<select id="countByName" parameterType="PrcPriceSet" resultType="int">
select count(1) from prc_price_set
where price_set_name = #{priceSetName}
<if test="priceSetId != null">
AND price_set_id &lt;&gt; #{priceSetId}
</if>
<if test="tmsId != null">
AND tms_id = #{tmsId}
</if>
</select>
<insert id="insertPrcPriceSet" parameterType="PrcPriceSet" useGeneratedKeys="true" keyProperty="priceSetId">
insert into prc_price_set (
<if test="priceSetCode != null and priceSetCode != ''">price_set_code,</if>
<if test="priceSetName != null and priceSetName != ''">price_set_name,</if>
<if test="priceSetNote != null">price_set_note,</if>
<if test="setType != null and setType != ''">set_type,</if>
<if test="defaultDiscount != null">default_discount,</if>
<if test="defaultType != null">default_type,</if>
<if test="calculateSign != null">calculate_sign,</if>
<if test="effectiveDate != null">effective_date,</if>
<if test="expireDate != null">expire_date,</if>
<if test="status != null and status != ''">status,</if>
<if test="tmsId != null">tms_id,</if>
<if test="createBy != null and createBy != ''">created_by,</if>
created_at
) values (
<if test="priceSetCode != null and priceSetCode != ''">#{priceSetCode},</if>
<if test="priceSetName != null and priceSetName != ''">#{priceSetName},</if>
<if test="priceSetNote != null">#{priceSetNote},</if>
<if test="setType != null and setType != ''">#{setType},</if>
<if test="defaultDiscount != null">#{defaultDiscount},</if>
<if test="defaultType != null">#{defaultType},</if>
<if test="calculateSign != null">#{calculateSign},</if>
<if test="effectiveDate != null">#{effectiveDate},</if>
<if test="expireDate != null">#{expireDate},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="tmsId != null">#{tmsId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updatePrcPriceSet" parameterType="PrcPriceSet">
update prc_price_set
<set>
<if test="priceSetCode != null and priceSetCode != ''">price_set_code = #{priceSetCode},</if>
<if test="priceSetName != null and priceSetName != ''">price_set_name = #{priceSetName},</if>
<if test="priceSetNote != null">price_set_note = #{priceSetNote},</if>
<if test="setType != null and setType != ''">set_type = #{setType},</if>
default_discount = #{defaultDiscount},
<if test="defaultType != null">default_type = #{defaultType},</if>
<if test="calculateSign != null">calculate_sign = #{calculateSign},</if>
<if test="effectiveDate != null">effective_date = #{effectiveDate},</if>
expire_date = #{expireDate},
<if test="status != null and status != ''">status = #{status},</if>
<if test="tmsId != null">tms_id = #{tmsId},</if>
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
updated_at = sysdate()
</set>
where price_set_id = #{priceSetId}
</update>
<update id="updatePrcPriceSetStatus" parameterType="PrcPriceSet">
update prc_price_set
<set>
status = #{status},
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
updated_at = sysdate()
</set>
where price_set_id = #{priceSetId}
</update>
<delete id="deletePrcPriceSetByIds" parameterType="Long">
delete from prc_price_set where price_set_id in
<foreach item="priceSetId" collection="array" open="(" separator="," close=")">
#{priceSetId}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.price.mapper.PrcWeightSectionDetailMapper">
<resultMap type="PrcWeightSectionDetail" id="PrcWeightSectionDetailResult">
<id property="wsdId" column="wsd_id" />
<result property="wstId" column="wst_id" />
<result property="wlTitle" column="wl_title" />
<result property="wlStartweight" column="wl_startweight" />
<result property="wlEndweight" column="wl_endweight" />
<result property="weightBillingCode" column="weight_billing_code" />
<result property="fvUnitweight" column="fv_unitweight" />
<result property="effectiveDate" column="effective_date" />
<result property="expireDate" column="expire_date" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
</resultMap>
<sql id="selectPrcWeightSectionDetailVo">
select wsd_id, wst_id, wl_title, wl_startweight, wl_endweight, weight_billing_code,
fv_unitweight, effective_date, expire_date, created_at, updated_at
from prc_weight_section_detail
</sql>
<select id="selectPrcWeightSectionDetailById" parameterType="Long" resultMap="PrcWeightSectionDetailResult">
<include refid="selectPrcWeightSectionDetailVo"/>
where wsd_id = #{wsdId}
</select>
<select id="selectPrcWeightSectionDetailListByWstId" parameterType="Long" resultMap="PrcWeightSectionDetailResult">
<include refid="selectPrcWeightSectionDetailVo"/>
where wst_id = #{wstId}
order by wl_startweight asc, wsd_id asc
</select>
<select id="selectPrcWeightSectionDetailList" parameterType="PrcWeightSectionDetail" resultMap="PrcWeightSectionDetailResult">
<include refid="selectPrcWeightSectionDetailVo"/>
<where>
<if test="wstId != null">
AND wst_id = #{wstId}
</if>
<if test="wlTitle != null and wlTitle != ''">
AND wl_title like concat('%', #{wlTitle}, '%')
</if>
<if test="weightBillingCode != null and weightBillingCode != ''">
AND weight_billing_code = #{weightBillingCode}
</if>
</where>
order by wl_startweight asc, wsd_id asc
</select>
<select id="countByWstId" parameterType="Long" resultType="int">
select count(1) from prc_weight_section_detail where wst_id = #{wstId}
</select>
<insert id="insertPrcWeightSectionDetail" parameterType="PrcWeightSectionDetail" useGeneratedKeys="true" keyProperty="wsdId">
insert into prc_weight_section_detail (
<if test="wstId != null">wst_id,</if>
<if test="wlTitle != null">wl_title,</if>
<if test="wlStartweight != null">wl_startweight,</if>
<if test="wlEndweight != null">wl_endweight,</if>
<if test="weightBillingCode != null">weight_billing_code,</if>
<if test="fvUnitweight != null">fv_unitweight,</if>
<if test="effectiveDate != null">effective_date,</if>
<if test="expireDate != null">expire_date,</if>
created_at
) values (
<if test="wstId != null">#{wstId},</if>
<if test="wlTitle != null">#{wlTitle},</if>
<if test="wlStartweight != null">#{wlStartweight},</if>
<if test="wlEndweight != null">#{wlEndweight},</if>
<if test="weightBillingCode != null">#{weightBillingCode},</if>
<if test="fvUnitweight != null">#{fvUnitweight},</if>
<if test="effectiveDate != null">#{effectiveDate},</if>
<if test="expireDate != null">#{expireDate},</if>
sysdate()
)
</insert>
<update id="updatePrcWeightSectionDetail" parameterType="PrcWeightSectionDetail">
update prc_weight_section_detail
<set>
<if test="wstId != null">wst_id = #{wstId},</if>
<if test="wlTitle != null">wl_title = #{wlTitle},</if>
<if test="wlStartweight != null">wl_startweight = #{wlStartweight},</if>
<if test="wlEndweight != null">wl_endweight = #{wlEndweight},</if>
<if test="weightBillingCode != null">weight_billing_code = #{weightBillingCode},</if>
<if test="fvUnitweight != null">fv_unitweight = #{fvUnitweight},</if>
<if test="effectiveDate != null">effective_date = #{effectiveDate},</if>
<if test="expireDate != null">expire_date = #{expireDate},</if>
updated_at = sysdate()
</set>
where wsd_id = #{wsdId}
</update>
<delete id="deletePrcWeightSectionDetailByIds" parameterType="Long">
delete from prc_weight_section_detail where wsd_id in
<foreach item="wsdId" collection="array" open="(" separator="," close=")">
#{wsdId}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.price.mapper.PrcWeightSectionTemplateMapper">
<resultMap type="PrcWeightSectionTemplate" id="PrcWeightSectionTemplateResult">
<id property="wstId" column="wst_id" />
<result property="wstName" column="wst_name" />
<result property="ssCode" column="ss_code" />
<result property="pgCode" column="pg_code" />
<result property="snId" column="sn_id" />
<result property="ctCode" column="ct_code" />
<result property="pmCode" column="pm_code" />
<result property="wstNote" column="wst_note" />
<result property="tmsId" column="tms_id" />
<result property="createBy" column="created_by" />
<result property="createTime" column="created_at" />
<result property="updateBy" column="updated_by" />
<result property="updateTime" column="updated_at" />
<result property="detailCount" column="detail_count" />
</resultMap>
<sql id="selectPrcWeightSectionTemplateVo">
select wst_id, wst_name, ss_code, pg_code, sn_id, ct_code, pm_code, wst_note, tms_id,
created_by, created_at, updated_by, updated_at
from prc_weight_section_template
</sql>
<select id="selectPrcWeightSectionTemplateById" parameterType="Long" resultMap="PrcWeightSectionTemplateResult">
<include refid="selectPrcWeightSectionTemplateVo"/>
where wst_id = #{wstId}
</select>
<select id="selectPrcWeightSectionTemplateList" parameterType="PrcWeightSectionTemplate" resultMap="PrcWeightSectionTemplateResult">
<include refid="selectPrcWeightSectionTemplateVo"/>
<where>
<if test="wstName != null and wstName != ''">
AND wst_name like concat('%', #{wstName}, '%')
</if>
<if test="ssCode != null and ssCode != ''">
AND ss_code = #{ssCode}
</if>
<if test="pgCode != null and pgCode != ''">
AND pg_code = #{pgCode}
</if>
<if test="snId != null">
AND sn_id = #{snId}
</if>
<if test="ctCode != null and ctCode != ''">
AND ct_code = #{ctCode}
</if>
<if test="pmCode != null and pmCode != ''">
AND pm_code = #{pmCode}
</if>
<if test="tmsId != null">
AND tms_id = #{tmsId}
</if>
</where>
order by wst_id desc
</select>
<insert id="insertPrcWeightSectionTemplate" parameterType="PrcWeightSectionTemplate" useGeneratedKeys="true" keyProperty="wstId">
insert into prc_weight_section_template (
<if test="wstName != null and wstName != ''">wst_name,</if>
<if test="ssCode != null and ssCode != ''">ss_code,</if>
<if test="pgCode != null">pg_code,</if>
<if test="snId != null">sn_id,</if>
<if test="ctCode != null">ct_code,</if>
<if test="pmCode != null">pm_code,</if>
<if test="wstNote != null">wst_note,</if>
<if test="tmsId != null">tms_id,</if>
<if test="createBy != null and createBy != ''">created_by,</if>
created_at
) values (
<if test="wstName != null and wstName != ''">#{wstName},</if>
<if test="ssCode != null and ssCode != ''">#{ssCode},</if>
<if test="pgCode != null">#{pgCode},</if>
<if test="snId != null">#{snId},</if>
<if test="ctCode != null">#{ctCode},</if>
<if test="pmCode != null">#{pmCode},</if>
<if test="wstNote != null">#{wstNote},</if>
<if test="tmsId != null">#{tmsId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updatePrcWeightSectionTemplate" parameterType="PrcWeightSectionTemplate">
update prc_weight_section_template
<set>
<if test="wstName != null and wstName != ''">wst_name = #{wstName},</if>
<if test="ssCode != null and ssCode != ''">ss_code = #{ssCode},</if>
<if test="pgCode != null">pg_code = #{pgCode},</if>
<if test="snId != null">sn_id = #{snId},</if>
<if test="ctCode != null">ct_code = #{ctCode},</if>
<if test="pmCode != null">pm_code = #{pmCode},</if>
<if test="wstNote != null">wst_note = #{wstNote},</if>
<if test="tmsId != null">tms_id = #{tmsId},</if>
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
updated_at = sysdate()
</set>
where wst_id = #{wstId}
</update>
<delete id="deletePrcWeightSectionTemplateByIds" parameterType="Long">
delete from prc_weight_section_template where wst_id in
<foreach item="wstId" collection="array" open="(" separator="," close=")">
#{wstId}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.price.mapper.XtdZoneCountryMapper">
<resultMap type="XtdZoneCountry" id="XtdZoneCountryResult">
<id property="zcId" column="zc_id" />
<result property="zdId" column="zd_id" />
<result property="countryCode" column="country_code" />
<result property="zcDividekind" column="zc_dividekind" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
</resultMap>
<sql id="selectXtdZoneCountryVo">
select zc_id, zd_id, country_code, zc_dividekind, created_at, updated_at
from xtd_zonecountry
</sql>
<select id="selectXtdZoneCountryById" parameterType="Long" resultMap="XtdZoneCountryResult">
<include refid="selectXtdZoneCountryVo"/>
where zc_id = #{zcId}
</select>
<select id="selectXtdZoneCountryListByZdId" parameterType="Long" resultMap="XtdZoneCountryResult">
<include refid="selectXtdZoneCountryVo"/>
where zd_id = #{zdId}
order by zc_id asc
</select>
<select id="selectXtdZoneCountryList" parameterType="XtdZoneCountry" resultMap="XtdZoneCountryResult">
<include refid="selectXtdZoneCountryVo"/>
<where>
<if test="zdId != null">
AND zd_id = #{zdId}
</if>
<if test="countryCode != null and countryCode != ''">
AND country_code = #{countryCode}
</if>
<if test="zcDividekind != null and zcDividekind != ''">
AND zc_dividekind = #{zcDividekind}
</if>
</where>
order by zc_id asc
</select>
<select id="countByZdId" parameterType="Long" resultType="int">
select count(1) from xtd_zonecountry where zd_id = #{zdId}
</select>
<insert id="insertXtdZoneCountry" parameterType="XtdZoneCountry" useGeneratedKeys="true" keyProperty="zcId">
insert into xtd_zonecountry (
<if test="zdId != null">zd_id,</if>
<if test="countryCode != null and countryCode != ''">country_code,</if>
<if test="zcDividekind != null and zcDividekind != ''">zc_dividekind,</if>
created_at
) values (
<if test="zdId != null">#{zdId},</if>
<if test="countryCode != null and countryCode != ''">#{countryCode},</if>
<if test="zcDividekind != null and zcDividekind != ''">#{zcDividekind},</if>
sysdate()
)
</insert>
<update id="updateXtdZoneCountry" parameterType="XtdZoneCountry">
update xtd_zonecountry
<set>
<if test="zdId != null">zd_id = #{zdId},</if>
<if test="countryCode != null and countryCode != ''">country_code = #{countryCode},</if>
<if test="zcDividekind != null and zcDividekind != ''">zc_dividekind = #{zcDividekind},</if>
updated_at = sysdate()
</set>
where zc_id = #{zcId}
</update>
<delete id="deleteXtdZoneCountryByIds" parameterType="Long">
delete from xtd_zonecountry where zc_id in
<foreach item="zcId" collection="array" open="(" separator="," close=")">
#{zcId}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.price.mapper.XtdZoneDivisionMapper">
<resultMap type="XtdZoneDivision" id="XtdZoneDivisionResult">
<id property="zdId" column="zd_id" />
<result property="zsId" column="zs_id" />
<result property="zdSort" column="zd_sort" />
<result property="zdCode" column="zd_code" />
<result property="znName" column="zn_name" />
<result property="znEname" column="zn_ename" />
<result property="znNote" column="zn_note" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
<result property="countryCount" column="country_count" />
</resultMap>
<sql id="selectXtdZoneDivisionVo">
select zd_id, zs_id, zd_sort, zd_code, zn_name, zn_ename, zn_note, created_at, updated_at
from xtd_zone_division
</sql>
<select id="selectXtdZoneDivisionById" parameterType="Long" resultMap="XtdZoneDivisionResult">
<include refid="selectXtdZoneDivisionVo"/>
where zd_id = #{zdId}
</select>
<select id="selectXtdZoneDivisionListByZsId" parameterType="Long" resultMap="XtdZoneDivisionResult">
<include refid="selectXtdZoneDivisionVo"/>
where zs_id = #{zsId}
order by zd_sort asc, zd_id asc
</select>
<select id="selectXtdZoneDivisionList" parameterType="XtdZoneDivision" resultMap="XtdZoneDivisionResult">
<include refid="selectXtdZoneDivisionVo"/>
<where>
<if test="zsId != null">
AND zs_id = #{zsId}
</if>
<if test="zdCode != null and zdCode != ''">
AND zd_code like concat('%', #{zdCode}, '%')
</if>
<if test="znName != null and znName != ''">
AND zn_name like concat('%', #{znName}, '%')
</if>
</where>
order by zd_sort asc, zd_id asc
</select>
<select id="countByZsId" parameterType="Long" resultType="int">
select count(1) from xtd_zone_division where zs_id = #{zsId}
</select>
<insert id="insertXtdZoneDivision" parameterType="XtdZoneDivision" useGeneratedKeys="true" keyProperty="zdId">
insert into xtd_zone_division (
<if test="zsId != null">zs_id,</if>
<if test="zdSort != null">zd_sort,</if>
<if test="zdCode != null">zd_code,</if>
<if test="znName != null">zn_name,</if>
<if test="znEname != null">zn_ename,</if>
<if test="znNote != null">zn_note,</if>
created_at
) values (
<if test="zsId != null">#{zsId},</if>
<if test="zdSort != null">#{zdSort},</if>
<if test="zdCode != null">#{zdCode},</if>
<if test="znName != null">#{znName},</if>
<if test="znEname != null">#{znEname},</if>
<if test="znNote != null">#{znNote},</if>
sysdate()
)
</insert>
<update id="updateXtdZoneDivision" parameterType="XtdZoneDivision">
update xtd_zone_division
<set>
<if test="zsId != null">zs_id = #{zsId},</if>
<if test="zdSort != null">zd_sort = #{zdSort},</if>
<if test="zdCode != null">zd_code = #{zdCode},</if>
<if test="znName != null">zn_name = #{znName},</if>
<if test="znEname != null">zn_ename = #{znEname},</if>
<if test="znNote != null">zn_note = #{znNote},</if>
updated_at = sysdate()
</set>
where zd_id = #{zdId}
</update>
<delete id="deleteXtdZoneDivisionByIds" parameterType="Long">
delete from xtd_zone_division where zd_id in
<foreach item="zdId" collection="array" open="(" separator="," close=")">
#{zdId}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.price.mapper.XtdZoneSchemeMapper">
<resultMap type="XtdZoneScheme" id="XtdZoneSchemeResult">
<id property="zsId" column="zs_id" />
<result property="zsName" column="zs_name" />
<result property="ssCode" column="ss_code" />
<result property="pgCode" column="pg_code" />
<result property="snId" column="sn_id" />
<result property="zsNote" column="zs_note" />
<result property="tmsId" column="tms_id" />
<result property="createBy" column="created_by" />
<result property="createTime" column="created_at" />
<result property="updateBy" column="updated_by" />
<result property="updateTime" column="updated_at" />
<result property="divisionCount" column="division_count" />
</resultMap>
<sql id="selectXtdZoneSchemeVo">
select zs_id, zs_name, ss_code, pg_code, sn_id, zs_note, tms_id,
created_by, created_at, updated_by, updated_at
from xtd_zone_scheme
</sql>
<select id="selectXtdZoneSchemeById" parameterType="Long" resultMap="XtdZoneSchemeResult">
<include refid="selectXtdZoneSchemeVo"/>
where zs_id = #{zsId}
</select>
<select id="selectXtdZoneSchemeList" parameterType="XtdZoneScheme" resultMap="XtdZoneSchemeResult">
<include refid="selectXtdZoneSchemeVo"/>
<where>
<if test="zsName != null and zsName != ''">
AND zs_name like concat('%', #{zsName}, '%')
</if>
<if test="ssCode != null and ssCode != ''">
AND ss_code = #{ssCode}
</if>
<if test="pgCode != null and pgCode != ''">
AND pg_code = #{pgCode}
</if>
<if test="snId != null">
AND sn_id = #{snId}
</if>
<if test="tmsId != null">
AND tms_id = #{tmsId}
</if>
</where>
order by zs_id desc
</select>
<insert id="insertXtdZoneScheme" parameterType="XtdZoneScheme" useGeneratedKeys="true" keyProperty="zsId">
insert into xtd_zone_scheme (
<if test="zsName != null and zsName != ''">zs_name,</if>
<if test="ssCode != null and ssCode != ''">ss_code,</if>
<if test="pgCode != null">pg_code,</if>
<if test="snId != null">sn_id,</if>
<if test="zsNote != null">zs_note,</if>
<if test="tmsId != null">tms_id,</if>
<if test="createBy != null and createBy != ''">created_by,</if>
created_at
) values (
<if test="zsName != null and zsName != ''">#{zsName},</if>
<if test="ssCode != null and ssCode != ''">#{ssCode},</if>
<if test="pgCode != null">#{pgCode},</if>
<if test="snId != null">#{snId},</if>
<if test="zsNote != null">#{zsNote},</if>
<if test="tmsId != null">#{tmsId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateXtdZoneScheme" parameterType="XtdZoneScheme">
update xtd_zone_scheme
<set>
<if test="zsName != null and zsName != ''">zs_name = #{zsName},</if>
<if test="ssCode != null and ssCode != ''">ss_code = #{ssCode},</if>
<if test="pgCode != null">pg_code = #{pgCode},</if>
<if test="snId != null">sn_id = #{snId},</if>
<if test="zsNote != null">zs_note = #{zsNote},</if>
<if test="tmsId != null">tms_id = #{tmsId},</if>
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
updated_at = sysdate()
</set>
where zs_id = #{zsId}
</update>
<delete id="deleteXtdZoneSchemeByIds" parameterType="Long">
delete from xtd_zone_scheme where zs_id in
<foreach item="zsId" collection="array" open="(" separator="," close=")">
#{zsId}
</foreach>
</delete>
</mapper>
+123
View File
@@ -0,0 +1,123 @@
-- ----------------------------
-- BMS price set: 客户中心 · 价格套餐管理
-- charset: utf8mb4
-- menu_id: 2200-2210
-- 相对 PRD《价格表优化建表.sql》差异:
-- 1. prc_price_set 增加 price_set_code / set_type / default_discount,status 对齐原型 D/A/E/R/S
-- 2. 新增 prc_price_set_detail(原型 FIXED/DISCOUNT 明细,运费+挂号费同行)
-- 3. prc_customer_price_set 增加 customer_name / bind_priority
-- ----------------------------
CREATE TABLE IF NOT EXISTS prc_price_set (
price_set_id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '价格套餐id',
price_set_code VARCHAR(20) DEFAULT NULL COMMENT '套餐编码 SET0001',
price_set_name VARCHAR(50) NOT NULL COMMENT '报价名称',
price_set_note VARCHAR(200) DEFAULT NULL COMMENT '备注',
set_type VARCHAR(10) NOT NULL DEFAULT 'FIXED' COMMENT '计价类型 FIXED=固定价 DISCOUNT=折扣',
default_discount DECIMAL(5,2) DEFAULT NULL COMMENT '默认折扣百分数 1-99,仅 DISCOUNT',
default_type CHAR(1) DEFAULT NULL COMMENT '默认套餐 Y=默认',
calculate_sign CHAR(1) DEFAULT NULL COMMENT '试算标记 Y=外部试算套餐',
effective_date DATE NOT NULL COMMENT '生效日期',
expire_date DATE DEFAULT NULL COMMENT '失效日期(空=长期)',
status CHAR(1) NOT NULL DEFAULT 'D' COMMENT 'D草稿 A审核中 E生效 R驳回 S停用',
tms_id BIGINT(20) DEFAULT NULL COMMENT '多租户系统ID',
created_by VARCHAR(64) DEFAULT '' COMMENT '创建人',
created_at DATETIME DEFAULT NULL COMMENT '创建时间',
updated_by VARCHAR(64) DEFAULT '' COMMENT '更新人',
updated_at DATETIME DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (price_set_id),
UNIQUE KEY uk_price_set_code (price_set_code),
INDEX idx_ps_status (status),
INDEX idx_ps_type (set_type),
INDEX idx_ps_tms (tms_id),
INDEX idx_ps_effective (effective_date, expire_date)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='价格方案表-报价基本资料';
CREATE TABLE IF NOT EXISTS prc_price_set_detail (
psd_id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '套餐明细id',
price_set_id BIGINT(20) NOT NULL COMMENT '价格套餐id',
product_code VARCHAR(10) NOT NULL COMMENT '产品代码',
product_name VARCHAR(50) DEFAULT NULL COMMENT '产品名称',
country_code CHAR(2) DEFAULT NULL COMMENT '国家二字码',
country_name VARCHAR(50) DEFAULT NULL COMMENT '国家名称',
zd_id BIGINT(20) DEFAULT NULL COMMENT '收费区划id',
wsd_id BIGINT(20) DEFAULT NULL COMMENT '重量段明细id',
weight_label VARCHAR(50) DEFAULT NULL COMMENT '重量段展示',
fv_value DECIMAL(10,4) DEFAULT NULL COMMENT '运费单价 RMB/KG',
fv_registration_fee DECIMAL(10,2) DEFAULT NULL COMMENT '挂号费 RMB/票',
discount_value DECIMAL(5,2) DEFAULT NULL COMMENT '明细折扣百分数,DISCOUNT 可覆盖默认',
pr_id INT(11) DEFAULT NULL COMMENT '关联价格规则id',
created_at DATETIME DEFAULT NULL COMMENT '创建时间',
updated_at DATETIME DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (psd_id),
INDEX idx_psd_set (price_set_id),
INDEX idx_psd_product (price_set_id, product_code, country_code),
CONSTRAINT fk_psd_set FOREIGN KEY (price_set_id) REFERENCES prc_price_set (price_set_id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='价格套餐明细-固定价/折扣范围';
CREATE TABLE IF NOT EXISTS prc_customer_price_set (
customer_priceset_id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '客户价格套餐id',
price_set_id BIGINT(20) NOT NULL COMMENT '价格套餐id',
customer_id BIGINT(20) NOT NULL COMMENT '客户id',
customer_name VARCHAR(100) DEFAULT NULL COMMENT '客户名称(展示)',
bind_priority INT(11) NOT NULL DEFAULT 1 COMMENT '优先级,数字越小越优先',
pr_begindate DATETIME NOT NULL COMMENT '价格开始生效日期',
pr_enddate DATETIME DEFAULT NULL COMMENT '价格失效日期(空=长期)',
price_set_note VARCHAR(100) DEFAULT NULL COMMENT '备注',
created_by VARCHAR(64) DEFAULT '' COMMENT '创建人',
created_at DATETIME DEFAULT NULL COMMENT '创建时间',
updated_by VARCHAR(64) DEFAULT '' COMMENT '更新人',
updated_at DATETIME DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (customer_priceset_id),
INDEX idx_customer_set (customer_id, pr_begindate, pr_enddate),
INDEX idx_cps_set (price_set_id),
CONSTRAINT fk_customer_price_set FOREIGN KEY (price_set_id) REFERENCES prc_price_set (price_set_id) ON DELETE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='客户套餐表-客户某时间段内使用的套餐';
-- 客户中心目录
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2200, N'客户中心', 0, 8, 'customer', NULL, '', '', 1, 0, 'M', '0', '0', '', 'peoples', 'admin', sysdate(), N'客户中心目录'
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2200);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2201, N'价格套餐管理', 2200, 1, 'set', 'price/set/priceSet', '', 'PriceSet', 1, 0, 'C', '0', '0', 'price:set:list', 'shopping', 'admin', sysdate(), N'价格套餐管理菜单'
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2201);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2202, N'套餐查询', 2201, 1, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:set:query', '#', 'admin', sysdate(), ''
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2202);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2203, N'套餐新增', 2201, 2, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:set:add', '#', 'admin', sysdate(), ''
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2203);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2204, N'套餐修改', 2201, 3, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:set:edit', '#', 'admin', sysdate(), ''
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2204);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2205, N'套餐删除', 2201, 4, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:set:remove', '#', 'admin', sysdate(), ''
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2205);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2206, N'套餐审核', 2201, 5, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:set:audit', '#', 'admin', sysdate(), ''
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2206);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2208, N'新建套餐', 2200, 2, 'setCreate', 'price/set/create', '', 'PriceSetCreate', 1, 0, 'C', '1', '0', 'price:set:add', '#', 'admin', sysdate(), N'新建套餐隐藏页'
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2208);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2209, N'套餐详情', 2200, 3, 'setDetail', 'price/set/detail', '', 'PriceSetDetail', 1, 0, 'C', '1', '0', 'price:set:query', '#', 'admin', sysdate(), N'套餐详情隐藏页'
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2209);
-- role_id=1 grants
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2200 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2200);
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2201 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2201);
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2202 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2202);
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2203 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2203);
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2204 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2204);
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2205 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2205);
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2206 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2206);
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2208 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2208);
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2209 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2209);
+144
View File
@@ -0,0 +1,144 @@
-- ----------------------------
-- BMS price basic: zone / weight section
-- charset: utf8mb4
-- menu_id: 2100-2123 (2115-2123 reserved)
-- ----------------------------
CREATE TABLE IF NOT EXISTS xtd_zone_scheme (
zs_id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'zone scheme id',
zs_name VARCHAR(100) NOT NULL COMMENT 'scheme name',
ss_code VARCHAR(20) NOT NULL DEFAULT 'on' COMMENT 'status on/off',
pg_code VARCHAR(50) DEFAULT NULL COMMENT 'product group code',
sn_id BIGINT(20) DEFAULT NULL COMMENT 'service channel id',
zs_note VARCHAR(500) DEFAULT NULL COMMENT 'note',
tms_id BIGINT(20) DEFAULT NULL COMMENT 'tenant id',
created_by VARCHAR(64) DEFAULT '' COMMENT 'created by',
created_at DATETIME DEFAULT NULL COMMENT 'created at',
updated_by VARCHAR(64) DEFAULT '' COMMENT 'updated by',
updated_at DATETIME DEFAULT NULL COMMENT 'updated at',
PRIMARY KEY (zs_id),
INDEX idx_zs_ss_code (ss_code),
INDEX idx_zs_tms_id (tms_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='zone scheme';
CREATE TABLE IF NOT EXISTS xtd_zone_division (
zd_id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'division id globally unique',
zs_id BIGINT(20) NOT NULL COMMENT 'scheme id',
zd_sort INT(11) DEFAULT 0 COMMENT 'sort',
zd_code VARCHAR(50) DEFAULT NULL COMMENT 'division code',
zn_name VARCHAR(100) DEFAULT NULL COMMENT 'name',
zn_ename VARCHAR(100) DEFAULT NULL COMMENT 'english name',
zn_note VARCHAR(500) DEFAULT NULL COMMENT 'note',
created_at DATETIME DEFAULT NULL COMMENT 'created at',
updated_at DATETIME DEFAULT NULL COMMENT 'updated at',
PRIMARY KEY (zd_id),
INDEX idx_zd_zs_id (zs_id),
CONSTRAINT fk_zd_zs FOREIGN KEY (zs_id) REFERENCES xtd_zone_scheme (zs_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='zone division';
CREATE TABLE IF NOT EXISTS xtd_zonecountry (
zc_id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'zone country id',
zd_id BIGINT(20) NOT NULL COMMENT 'division id',
country_code CHAR(2) NOT NULL COMMENT 'ISO2 country code',
zc_dividekind VARCHAR(10) NOT NULL DEFAULT 'C' COMMENT 'divide kind default C',
created_at DATETIME DEFAULT NULL COMMENT 'created at',
updated_at DATETIME DEFAULT NULL COMMENT 'updated at',
PRIMARY KEY (zc_id),
INDEX idx_zc_zd_id (zd_id),
INDEX idx_zc_country (country_code),
CONSTRAINT fk_zc_zd FOREIGN KEY (zd_id) REFERENCES xtd_zone_division (zd_id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='zone country';
CREATE TABLE IF NOT EXISTS prc_weight_section_template (
wst_id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'weight template id',
wst_name VARCHAR(100) NOT NULL COMMENT 'template name',
ss_code VARCHAR(20) NOT NULL DEFAULT 'on' COMMENT 'status on/off',
pg_code VARCHAR(50) DEFAULT NULL COMMENT 'product group code',
sn_id BIGINT(20) DEFAULT NULL COMMENT 'service channel id',
ct_code VARCHAR(50) DEFAULT NULL COMMENT 'cargo type code',
pm_code VARCHAR(50) DEFAULT NULL COMMENT 'payment method code',
wst_note VARCHAR(500) DEFAULT NULL COMMENT 'note',
tms_id BIGINT(20) DEFAULT NULL COMMENT 'tenant id',
created_by VARCHAR(64) DEFAULT '' COMMENT 'created by',
created_at DATETIME DEFAULT NULL COMMENT 'created at',
updated_by VARCHAR(64) DEFAULT '' COMMENT 'updated by',
updated_at DATETIME DEFAULT NULL COMMENT 'updated at',
PRIMARY KEY (wst_id),
INDEX idx_wst_ss_code (ss_code),
INDEX idx_wst_tms_id (tms_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='weight section template';
CREATE TABLE IF NOT EXISTS prc_weight_section_detail (
wsd_id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'weight detail id globally unique',
wst_id BIGINT(20) NOT NULL COMMENT 'template id',
wl_title VARCHAR(100) DEFAULT NULL COMMENT 'title',
wl_startweight DECIMAL(18,6) NOT NULL COMMENT 'start weight',
wl_endweight DECIMAL(18,6) NOT NULL COMMENT 'end weight',
weight_billing_code VARCHAR(20) DEFAULT NULL COMMENT 'billing code',
fv_unitweight DECIMAL(18,6) DEFAULT NULL COMMENT 'unit weight',
effective_date DATE DEFAULT NULL COMMENT 'effective date',
expire_date DATE DEFAULT NULL COMMENT 'expire date',
created_at DATETIME DEFAULT NULL COMMENT 'created at',
updated_at DATETIME DEFAULT NULL COMMENT 'updated at',
PRIMARY KEY (wsd_id),
INDEX idx_wsd_wst_id (wst_id),
CONSTRAINT fk_wsd_wst FOREIGN KEY (wst_id) REFERENCES prc_weight_section_template (wst_id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='weight section detail';
-- menus 2100-2114 (active); 2115-2123 reserved
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2100, N'价格基础', 0, 7, 'price', NULL, '', '', 1, 0, 'M', '0', '0', '', 'money', 'admin', sysdate(), N'价格基础数据目录'
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2100);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2101, N'分区管理', 2100, 1, 'zone', 'price/basic/zone/index', '', 'PriceZone', 1, 0, 'C', '0', '0', 'price:zone:list', 'international', 'admin', sysdate(), N'分区管理菜单'
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2101);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2102, N'分区查询', 2101, 1, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:zone:query', '#', 'admin', sysdate(), ''
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2102);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2103, N'分区新增', 2101, 2, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:zone:add', '#', 'admin', sysdate(), ''
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2103);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2104, N'分区修改', 2101, 3, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:zone:edit', '#', 'admin', sysdate(), ''
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2104);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2105, N'分区删除', 2101, 4, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:zone:remove', '#', 'admin', sysdate(), ''
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2105);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2110, N'重量段管理', 2100, 2, 'weight', 'price/basic/weight/index', '', 'PriceWeight', 1, 0, 'C', '0', '0', 'price:weight:list', 'chart', 'admin', sysdate(), N'重量段管理菜单'
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2110);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2111, N'重量段查询', 2110, 1, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:weight:query', '#', 'admin', sysdate(), ''
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2111);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2112, N'重量段新增', 2110, 2, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:weight:add', '#', 'admin', sysdate(), ''
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2112);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2113, N'重量段修改', 2110, 3, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:weight:edit', '#', 'admin', sysdate(), ''
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2113);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2114, N'重量段删除', 2110, 4, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:weight:remove', '#', 'admin', sysdate(), ''
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2114);
-- role_id=1 grants
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2100 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2100);
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2101 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2101);
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2102 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2102);
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2103 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2103);
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2104 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2104);
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2105 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2105);
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2110 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2110);
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2111 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2111);
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2112 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2112);
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2113 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2113);
INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2114 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2114);
+144
View File
@@ -0,0 +1,144 @@
import request from '@/utils/request'
export function listPriceSet(query) {
return request({
url: '/price/set/list',
method: 'get',
params: query
})
}
export function getPriceSet(priceSetId) {
return request({
url: '/price/set/' + priceSetId,
method: 'get'
})
}
export function savePriceSet(data) {
return request({
url: '/price/set',
method: 'post',
data: data
})
}
export function updatePriceSet(data) {
return request({
url: '/price/set',
method: 'put',
data: data
})
}
export function delPriceSet(priceSetIds) {
return request({
url: '/price/set/' + priceSetIds,
method: 'delete'
})
}
export function submitPriceSet(priceSetId) {
return request({
url: '/price/set/submit/' + priceSetId,
method: 'put'
})
}
export function approvePriceSet(priceSetId) {
return request({
url: '/price/set/approve/' + priceSetId,
method: 'put'
})
}
export function rejectPriceSet(priceSetId) {
return request({
url: '/price/set/reject/' + priceSetId,
method: 'put'
})
}
export function disablePriceSet(priceSetId) {
return request({
url: '/price/set/disable/' + priceSetId,
method: 'put'
})
}
export function copyPriceSet(priceSetId) {
return request({
url: '/price/set/copy/' + priceSetId,
method: 'post'
})
}
export function validatePriceSet(data) {
return request({
url: '/price/set/validate',
method: 'post',
data: data
})
}
export function listSetDetail(query) {
return request({
url: '/price/set/detail/list',
method: 'get',
params: query
})
}
export function addSetDetail(data) {
return request({
url: '/price/set/detail',
method: 'post',
data: data
})
}
export function updateSetDetail(data) {
return request({
url: '/price/set/detail',
method: 'put',
data: data
})
}
export function delSetDetail(psdIds) {
return request({
url: '/price/set/detail/' + psdIds,
method: 'delete'
})
}
export function listSetCustomer(query) {
return request({
url: '/price/set/customer/list',
method: 'get',
params: query
})
}
export function addSetCustomer(data) {
return request({
url: '/price/set/customer',
method: 'post',
data: data
})
}
export function updateSetCustomer(data) {
return request({
url: '/price/set/customer',
method: 'put',
data: data
})
}
export function delSetCustomer(ids) {
return request({
url: '/price/set/customer/' + ids,
method: 'delete'
})
}
+83
View File
@@ -0,0 +1,83 @@
import request from '@/utils/request'
// ========== 重量段模板 ==========
/** 查询重量段模板列表 */
export function listTemplate(query) {
return request({
url: '/price/weight/template/list',
method: 'get',
params: query
})
}
/** 查询重量段模板详细 */
export function getTemplate(wstId) {
return request({
url: '/price/weight/template/' + wstId,
method: 'get'
})
}
/** 新增重量段模板 */
export function addTemplate(data) {
return request({
url: '/price/weight/template',
method: 'post',
data: data
})
}
/** 修改重量段模板 */
export function updateTemplate(data) {
return request({
url: '/price/weight/template',
method: 'put',
data: data
})
}
/** 删除重量段模板 */
export function delTemplate(wstIds) {
return request({
url: '/price/weight/template/' + wstIds,
method: 'delete'
})
}
// ========== 重量段明细 ==========
/** 查询重量段明细列表(按 wstId) */
export function listDetail(query) {
return request({
url: '/price/weight/detail/list',
method: 'get',
params: query
})
}
/** 新增重量段明细 */
export function addDetail(data) {
return request({
url: '/price/weight/detail',
method: 'post',
data: data
})
}
/** 修改重量段明细 */
export function updateDetail(data) {
return request({
url: '/price/weight/detail',
method: 'put',
data: data
})
}
/** 删除重量段明细 */
export function delDetail(wsdIds) {
return request({
url: '/price/weight/detail/' + wsdIds,
method: 'delete'
})
}
+120
View File
@@ -0,0 +1,120 @@
import request from '@/utils/request'
// ========== 分区方案 ==========
/** 查询分区方案列表 */
export function listScheme(query) {
return request({
url: '/price/zone/scheme/list',
method: 'get',
params: query
})
}
/** 查询分区方案详细 */
export function getScheme(zsId) {
return request({
url: '/price/zone/scheme/' + zsId,
method: 'get'
})
}
/** 新增分区方案 */
export function addScheme(data) {
return request({
url: '/price/zone/scheme',
method: 'post',
data: data
})
}
/** 修改分区方案 */
export function updateScheme(data) {
return request({
url: '/price/zone/scheme',
method: 'put',
data: data
})
}
/** 删除分区方案 */
export function delScheme(zsIds) {
return request({
url: '/price/zone/scheme/' + zsIds,
method: 'delete'
})
}
// ========== 区划 ==========
/** 查询区划列表(按 zsId) */
export function listDivision(query) {
return request({
url: '/price/zone/division/list',
method: 'get',
params: query
})
}
/** 新增区划 */
export function addDivision(data) {
return request({
url: '/price/zone/division',
method: 'post',
data: data
})
}
/** 修改区划 */
export function updateDivision(data) {
return request({
url: '/price/zone/division',
method: 'put',
data: data
})
}
/** 删除区划 */
export function delDivision(zdIds) {
return request({
url: '/price/zone/division/' + zdIds,
method: 'delete'
})
}
// ========== 国家 ==========
/** 查询国家列表(按 zdId) */
export function listCountry(query) {
return request({
url: '/price/zone/country/list',
method: 'get',
params: query
})
}
/** 新增国家 */
export function addCountry(data) {
return request({
url: '/price/zone/country',
method: 'post',
data: data
})
}
/** 修改国家 */
export function updateCountry(data) {
return request({
url: '/price/zone/country',
method: 'put',
data: data
})
}
/** 删除国家 */
export function delCountry(zcIds) {
return request({
url: '/price/zone/country/' + zcIds,
method: 'delete'
})
}
+3 -1
View File
@@ -1,4 +1,4 @@
import router from './router' import router, { notFoundRoute } from './router'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import NProgress from 'nprogress' import NProgress from 'nprogress'
import 'nprogress/nprogress.css' import 'nprogress/nprogress.css'
@@ -51,6 +51,8 @@ router.beforeEach(async (to, from) => {
router.addRoute(route) router.addRoute(route)
} }
}) })
// 404 必须在全部动态路由之后注册,否则字典数据等隐藏页会被通配抢走
router.addRoute(notFoundRoute)
// 重新导航到目标路由,确保动态路由已注册 // 重新导航到目标路由,确保动态路由已注册
return { ...to, replace: true } return { ...to, replace: true }
} catch (err) { } catch (err) {
+9 -7
View File
@@ -24,7 +24,7 @@ import Layout from '@/layout'
} }
*/ */
// 公共路由 // 公共路由(404 不放这里,等动态路由注册后再挂,避免抢先匹配)
export const constantRoutes = [ export const constantRoutes = [
{ {
path: '/redirect', path: '/redirect',
@@ -47,11 +47,6 @@ export const constantRoutes = [
component: () => import('@/views/register'), component: () => import('@/views/register'),
hidden: true hidden: true
}, },
{
path: "/:pathMatch(.*)*",
component: () => import('@/views/error/404'),
hidden: true
},
{ {
path: '/401', path: '/401',
component: () => import('@/views/error/401'), component: () => import('@/views/error/401'),
@@ -131,7 +126,7 @@ export const dynamicRoutes = [
{ {
path: 'index/:dictId(\\d+)', path: 'index/:dictId(\\d+)',
component: () => import('@/views/system/dict/data'), component: () => import('@/views/system/dict/data'),
name: 'Data', name: 'DictData',
meta: { title: '字典数据', activeMenu: '/system/dict' } meta: { title: '字典数据', activeMenu: '/system/dict' }
} }
] ]
@@ -166,6 +161,13 @@ export const dynamicRoutes = [
} }
] ]
// 404 必须在动态路由之后注册,否则会抢先匹配 /system/dict-data 等隐藏页
export const notFoundRoute = {
path: '/:pathMatch(.*)*',
component: () => import('@/views/error/404'),
hidden: true
}
const router = createRouter({ const router = createRouter({
history: createWebHistory(), history: createWebHistory(),
routes: constantRoutes, routes: constantRoutes,
@@ -0,0 +1,542 @@
<template>
<div class="app-container">
<!-- 重量段模板 -->
<basic-table
ref="templateTableRef"
:columns="templateColumns"
:search-columns="templateSearchColumns"
:query="queryTemplateList"
row-key="wstId"
@row-click="handleTemplateRowClick"
>
<template #toolbar="{ selection, ids }">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Plus"
@click="handleTemplateAdd"
v-hasPermi="['price:weight:add']"
>新建模板</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="selection.length !== 1"
@click="handleTemplateUpdate(selection[0])"
v-hasPermi="['price:weight:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Delete"
:disabled="!selection.length"
@click="handleTemplateDelete(ids)"
v-hasPermi="['price:weight:remove']"
>删除</el-button>
</el-col>
</template>
<template #col-ssCode="{ row }">
<el-tag :type="row.ssCode === 'on' || row.ssCode === 'ON' ? 'success' : 'warning'" size="small">
{{ (row.ssCode || '').toLowerCase() === 'on' ? 'on' : 'of' }}
</el-tag>
</template>
<template #col-action="{ row }">
<el-button link type="primary" icon="List" @click.stop="handleShowDetail(row)" v-hasPermi="['price:weight:query']">明细</el-button>
<el-button link type="primary" icon="Edit" @click.stop="handleTemplateUpdate(row)" v-hasPermi="['price:weight:edit']">编辑</el-button>
<el-button link type="primary" icon="Delete" @click.stop="handleTemplateDelete(row.wstId)" v-hasPermi="['price:weight:remove']">删除</el-button>
</template>
</basic-table>
<!-- 明细 + 可视化标尺 -->
<el-card shadow="never" class="detail-card" v-loading="detailLoading">
<template #header>
<div class="card-header">
<span>
重量段明细
<span v-if="selectedTemplate" class="sub-hint">
当前模板:{{ selectedTemplate.wstName }}(wstId={{ selectedTemplate.wstId }},共 {{ detailList.length }} 段)
</span>
<span v-else class="sub-hint">请点击上方模板行或「明细」查看重量段</span>
</span>
<el-button
type="primary"
plain
icon="Plus"
size="small"
:disabled="!selectedTemplate"
@click="handleDetailAdd"
v-hasPermi="['price:weight:add']"
>新增明细</el-button>
</div>
</template>
<div v-if="selectedTemplate && detailList.length" class="ruler-block">
<div class="section-title">重量段可视化标尺</div>
<div class="weight-ruler">
<el-tag
v-for="item in detailList"
:key="item.wsdId"
class="weight-chip"
effect="plain"
type="primary"
round
>
{{ formatEndWeight(item) }}
<span class="chip-range">{{ item.wlStartweight }}~{{ item.wlEndweight }}</span>
</el-tag>
</div>
</div>
<el-table
:data="detailList"
border
row-key="wsdId"
empty-text="暂无明细数据"
>
<el-table-column label="wsdId" prop="wsdId" align="center" width="80" />
<el-table-column label="标题" prop="wlTitle" align="center" min-width="110" show-overflow-tooltip />
<el-table-column label="起始重量" prop="wlStartweight" align="center" width="110" />
<el-table-column label="截止重量" prop="wlEndweight" align="center" width="110" />
<el-table-column label="计费类别" prop="weightBillingCode" align="center" width="110" />
<el-table-column label="计费单位" prop="fvUnitweight" align="center" width="110" />
<el-table-column label="生效日期" prop="effectiveDate" align="center" width="120">
<template #default="{ row }">{{ parseDate(row.effectiveDate) }}</template>
</el-table-column>
<el-table-column label="失效日期" prop="expireDate" align="center" width="120">
<template #default="{ row }">{{ parseDate(row.expireDate) || '-' }}</template>
</el-table-column>
<el-table-column label="操作" align="center" width="160" fixed="right">
<template #default="{ row }">
<el-button link type="primary" icon="Edit" @click="handleDetailUpdate(row)" v-hasPermi="['price:weight:edit']">编辑</el-button>
<el-button link type="primary" icon="Delete" @click="handleDetailDelete(row.wsdId)" v-hasPermi="['price:weight:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<!-- 模板表单 -->
<el-dialog :title="templateTitle" v-model="templateOpen" width="600px" append-to-body>
<el-form ref="templateFormRef" :model="templateForm" :rules="templateRules" label-width="100px">
<el-form-item label="模板名称" prop="wstName">
<el-input v-model="templateForm.wstName" placeholder="请输入模板名称" maxlength="60" />
</el-form-item>
<el-form-item label="状态" prop="ssCode">
<el-radio-group v-model="templateForm.ssCode">
<el-radio value="on">有效(on)</el-radio>
<el-radio value="of">停用(of)</el-radio>
</el-radio-group>
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label="产品组" prop="pgCode">
<el-input v-model="templateForm.pgCode" placeholder="如 EXP" maxlength="10" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="渠道ID" prop="snId">
<el-input v-model="templateForm.snId" placeholder="snId" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="货物类型" prop="ctCode">
<el-input v-model="templateForm.ctCode" placeholder="ctCode" maxlength="5" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="付款方式" prop="pmCode">
<el-input v-model="templateForm.pmCode" placeholder="pmCode" maxlength="5" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注" prop="wstNote">
<el-input v-model="templateForm.wstNote" type="textarea" placeholder="请输入备注" :rows="3" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitTemplateForm">确 定</el-button>
<el-button @click="templateOpen = false">取 消</el-button>
</div>
</template>
</el-dialog>
<!-- 明细表单 -->
<el-dialog :title="detailTitle" v-model="detailOpen" width="600px" append-to-body>
<el-form ref="detailFormRef" :model="detailForm" :rules="detailRules" label-width="110px">
<el-form-item label="标题" prop="wlTitle">
<el-input v-model="detailForm.wlTitle" placeholder="如 0.5kg段" maxlength="50" />
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label="起始重量" prop="wlStartweight">
<el-input-number v-model="detailForm.wlStartweight" :min="0" :precision="3" :step="0.1" controls-position="right" style="width: 100%" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="截止重量" prop="wlEndweight">
<el-input-number v-model="detailForm.wlEndweight" :min="0" :precision="3" :step="0.1" controls-position="right" style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="计费类别" prop="weightBillingCode">
<el-input v-model="detailForm.weightBillingCode" placeholder="如 W/P/C" maxlength="5" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="计费单位" prop="fvUnitweight">
<el-input-number v-model="detailForm.fvUnitweight" :min="0" :precision="3" :step="0.1" controls-position="right" style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="生效日期" prop="effectiveDate">
<el-date-picker
v-model="detailForm.effectiveDate"
type="date"
value-format="YYYY-MM-DD"
placeholder="选择生效日期"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="失效日期" prop="expireDate">
<el-date-picker
v-model="detailForm.expireDate"
type="date"
value-format="YYYY-MM-DD"
placeholder="可选"
style="width: 100%"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitDetailForm">确 定</el-button>
<el-button @click="detailOpen = false">取 消</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="PriceWeight">
import {
listTemplate, getTemplate, addTemplate, updateTemplate, delTemplate,
listDetail, addDetail, updateDetail, delDetail
} from '@/api/price/weight'
import { parseTime } from '@/utils/ruoyi'
const { proxy } = getCurrentInstance()
const templateTableRef = ref()
const selectedTemplate = ref(null)
const detailList = ref([])
const detailLoading = ref(false)
const templateOpen = ref(false)
const templateTitle = ref('')
const templateFormRef = ref()
const templateForm = ref({})
const templateRules = {
wstName: [{ required: true, message: '模板名称不能为空', trigger: 'blur' }],
ssCode: [{ required: true, message: '状态不能为空', trigger: 'change' }]
}
const detailOpen = ref(false)
const detailTitle = ref('')
const detailFormRef = ref()
const detailForm = ref({})
const validateWeightRange = (rule, value, callback) => {
const start = detailForm.value.wlStartweight
const end = detailForm.value.wlEndweight
if (start == null || end == null) {
callback()
return
}
if (Number(start) >= Number(end)) {
callback(new Error('起始重量必须小于截止重量'))
} else {
callback()
}
}
const detailRules = {
wlStartweight: [
{ required: true, message: '起始重量不能为空', trigger: 'blur' },
{ validator: validateWeightRange, trigger: 'blur' }
],
wlEndweight: [
{ required: true, message: '截止重量不能为空', trigger: 'blur' },
{ validator: validateWeightRange, trigger: 'blur' }
],
weightBillingCode: [{ required: true, message: '计费类别不能为空', trigger: 'blur' }],
effectiveDate: [{ required: true, message: '生效日期不能为空', trigger: 'change' }]
}
const templateSearchColumns = [
{ label: '模板名称', prop: 'wstName', component: 'input', placeholder: '请输入模板名称', width: '220px' },
{
label: '状态',
prop: 'ssCode',
component: 'select',
options: [
{ label: '有效(on)', value: 'on' },
{ label: '停用(of)', value: 'of' }
],
placeholder: '状态',
width: '160px'
},
{ label: '产品组', prop: 'pgCode', component: 'input', placeholder: '产品组', width: '140px' }
]
const templateColumns = [
{ label: 'wstId', prop: 'wstId', align: 'center', width: 80 },
{ label: '模板名称', prop: 'wstName', align: 'center', minWidth: 140 },
{ label: '状态', prop: 'ssCode', align: 'center', width: 90 },
{ label: '产品组', prop: 'pgCode', align: 'center', width: 90 },
{ label: '渠道', prop: 'snId', align: 'center', width: 90 },
{ label: '货物类型', prop: 'ctCode', align: 'center', width: 90 },
{ label: '付款方式', prop: 'pmCode', align: 'center', width: 90 },
{ label: '明细数', prop: 'detailCount', align: 'center', width: 90 },
{ label: '操作', prop: 'action', align: 'center', width: 220, showInToolbar: false }
]
function queryTemplateList(params) {
return listTemplate(params)
}
function parseDate(val) {
if (!val) return ''
return parseTime(val, '{y}-{m}-{d}')
}
function formatEndWeight(item) {
const end = item.wlEndweight
if (end == null) return item.wlTitle || ''
return Number(end) + 'kg'
}
function handleTemplateRowClick(row) {
handleShowDetail(row)
}
function handleShowDetail(row) {
if (!row?.wstId) return
selectedTemplate.value = row
loadDetailList(row.wstId)
}
function loadDetailList(wstId) {
if (!wstId) {
detailList.value = []
return
}
detailLoading.value = true
listDetail({ wstId, pageNum: 1, pageSize: 500 }).then(res => {
const rows = res.rows || []
detailList.value = rows.slice().sort((a, b) => Number(a.wlStartweight) - Number(b.wlStartweight))
}).catch(() => {
detailList.value = []
}).finally(() => {
detailLoading.value = false
})
}
function normalizeOptionalNumber(val) {
if (val === '' || val === null || val === undefined) return undefined
return Number(val)
}
function resetTemplateForm() {
templateForm.value = {
wstId: undefined,
wstName: undefined,
ssCode: 'on',
pgCode: undefined,
snId: undefined,
ctCode: undefined,
pmCode: undefined,
wstNote: undefined
}
proxy.resetForm('templateFormRef')
}
function handleTemplateAdd() {
resetTemplateForm()
templateOpen.value = true
templateTitle.value = '新建重量段模板'
}
function handleTemplateUpdate(row) {
resetTemplateForm()
getTemplate(row.wstId).then(res => {
const data = res.data || {}
if (data.ssCode) data.ssCode = String(data.ssCode).toLowerCase()
templateForm.value = data
templateOpen.value = true
templateTitle.value = '编辑重量段模板'
})
}
function submitTemplateForm() {
proxy.$refs['templateFormRef'].validate(valid => {
if (!valid) return
const payload = {
...templateForm.value,
snId: normalizeOptionalNumber(templateForm.value.snId)
}
const req = payload.wstId != null ? updateTemplate(payload) : addTemplate(payload)
req.then(() => {
proxy.$modal.msgSuccess(payload.wstId != null ? '修改成功' : '新增成功')
templateOpen.value = false
templateTableRef.value.refresh()
if (selectedTemplate.value?.wstId === payload.wstId) {
loadDetailList(payload.wstId)
}
})
})
}
function handleTemplateDelete(wstIds) {
proxy.$modal.confirm('是否确认删除重量段模板编号为"' + wstIds + '"的数据项?').then(() => {
return delTemplate(wstIds)
}).then(() => {
templateTableRef.value.refresh()
if (selectedTemplate.value && String(wstIds).split(',').map(String).includes(String(selectedTemplate.value.wstId))) {
selectedTemplate.value = null
detailList.value = []
}
proxy.$modal.msgSuccess('删除成功')
}).catch(() => {})
}
function resetDetailForm() {
detailForm.value = {
wsdId: undefined,
wstId: selectedTemplate.value?.wstId,
wlTitle: undefined,
wlStartweight: undefined,
wlEndweight: undefined,
weightBillingCode: 'W',
fvUnitweight: undefined,
effectiveDate: undefined,
expireDate: undefined
}
proxy.resetForm('detailFormRef')
}
function handleDetailAdd() {
if (!selectedTemplate.value) {
proxy.$modal.msgWarning('请先选择重量段模板')
return
}
resetDetailForm()
detailOpen.value = true
detailTitle.value = '新增重量段明细'
}
function handleDetailUpdate(row) {
resetDetailForm()
detailForm.value = {
...row,
effectiveDate: parseDate(row.effectiveDate) || row.effectiveDate,
expireDate: parseDate(row.expireDate) || row.expireDate
}
detailOpen.value = true
detailTitle.value = '编辑重量段明细'
}
function submitDetailForm() {
proxy.$refs['detailFormRef'].validate(valid => {
if (!valid) return
const start = Number(detailForm.value.wlStartweight)
const end = Number(detailForm.value.wlEndweight)
if (!(start < end)) {
proxy.$modal.msgError('起始重量必须小于截止重量')
return
}
const payload = {
...detailForm.value,
wstId: selectedTemplate.value.wstId,
wlStartweight: start,
wlEndweight: end,
fvUnitweight: normalizeOptionalNumber(detailForm.value.fvUnitweight)
}
const req = payload.wsdId != null ? updateDetail(payload) : addDetail(payload)
req.then(() => {
proxy.$modal.msgSuccess(payload.wsdId != null ? '修改成功' : '新增成功')
detailOpen.value = false
loadDetailList(selectedTemplate.value.wstId)
templateTableRef.value.refresh()
})
})
}
function handleDetailDelete(wsdIds) {
proxy.$modal.confirm('是否确认删除重量段明细编号为"' + wsdIds + '"的数据项?').then(() => {
return delDetail(wsdIds)
}).then(() => {
loadDetailList(selectedTemplate.value.wstId)
templateTableRef.value.refresh()
proxy.$modal.msgSuccess('删除成功')
}).catch(() => {})
}
</script>
<style scoped>
.detail-card {
margin-top: 16px;
}
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
}
.sub-hint {
margin-left: 10px;
color: #909399;
font-size: 13px;
font-weight: normal;
}
.ruler-block {
margin-bottom: 16px;
}
.section-title {
font-size: 14px;
font-weight: 600;
margin-bottom: 10px;
padding-left: 8px;
border-left: 3px solid var(--el-color-primary);
}
.weight-ruler {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.weight-chip {
height: auto;
padding: 6px 12px;
line-height: 1.3;
}
.chip-range {
margin-left: 6px;
color: #909399;
font-size: 12px;
}
</style>
@@ -0,0 +1,548 @@
<template>
<div class="app-container">
<!-- 分区方案 -->
<basic-table
ref="schemeTableRef"
:columns="schemeColumns"
:search-columns="schemeSearchColumns"
:query="querySchemeList"
row-key="zsId"
@row-click="handleSchemeRowClick"
>
<template #toolbar="{ selection, ids }">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Plus"
@click="handleSchemeAdd"
v-hasPermi="['price:zone:add']"
>新建分区方案</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="selection.length !== 1"
@click="handleSchemeUpdate(selection[0])"
v-hasPermi="['price:zone:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Delete"
:disabled="!selection.length"
@click="handleSchemeDelete(ids)"
v-hasPermi="['price:zone:remove']"
>删除</el-button>
</el-col>
</template>
<template #col-ssCode="{ row }">
<el-tag :type="row.ssCode === 'on' ? 'success' : 'info'" size="small">
{{ row.ssCode === 'on' ? 'on' : 'of' }}
</el-tag>
</template>
<template #col-action="{ row }">
<el-button link type="primary" icon="Edit" @click.stop="handleSchemeUpdate(row)" v-hasPermi="['price:zone:edit']">编辑</el-button>
<el-button link type="primary" icon="Delete" @click.stop="handleSchemeDelete(row.zsId)" v-hasPermi="['price:zone:remove']">删除</el-button>
</template>
</basic-table>
<!-- 区划明细 -->
<el-card shadow="never" class="detail-card" v-loading="divisionLoading">
<template #header>
<div class="card-header">
<span>
区划明细
<span v-if="selectedScheme" class="sub-hint">当前方案:{{ selectedScheme.zsName }}(zsId={{ selectedScheme.zsId }})</span>
<span v-else class="sub-hint">请点击上方方案行查看区划</span>
</span>
<el-button
type="primary"
plain
icon="Plus"
size="small"
:disabled="!selectedScheme"
@click="handleDivisionAdd"
v-hasPermi="['price:zone:add']"
>新增区划</el-button>
</div>
</template>
<el-table
:data="divisionList"
border
highlight-current-row
row-key="zdId"
empty-text="暂无区划数据"
>
<el-table-column label="zdId" prop="zdId" align="center" width="80" />
<el-table-column label="区划代码" prop="zdCode" align="center" min-width="120" show-overflow-tooltip />
<el-table-column label="中文名" prop="znName" align="center" min-width="120" show-overflow-tooltip />
<el-table-column label="英文名" prop="znEname" align="center" min-width="140" show-overflow-tooltip />
<el-table-column label="国家数" prop="countryCount" align="center" width="90" />
<el-table-column label="操作" align="center" width="240" fixed="right">
<template #default="{ row }">
<el-button link type="primary" icon="View" @click="openCountryDrawer(row)" v-hasPermi="['price:zone:query']">查看国家</el-button>
<el-button link type="primary" icon="Edit" @click="handleDivisionUpdate(row)" v-hasPermi="['price:zone:edit']">编辑</el-button>
<el-button link type="primary" icon="Delete" @click="handleDivisionDelete(row.zdId)" v-hasPermi="['price:zone:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<!-- 方案表单 -->
<el-dialog :title="schemeTitle" v-model="schemeOpen" width="560px" append-to-body>
<el-form ref="schemeFormRef" :model="schemeForm" :rules="schemeRules" label-width="100px">
<el-form-item label="方案名称" prop="zsName">
<el-input v-model="schemeForm.zsName" placeholder="请输入分区方案名称" maxlength="50" />
</el-form-item>
<el-form-item label="状态" prop="ssCode">
<el-radio-group v-model="schemeForm.ssCode">
<el-radio value="on">有效(on)</el-radio>
<el-radio value="of">停用(of)</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="产品组" prop="pgCode">
<el-input v-model="schemeForm.pgCode" placeholder="如 EXP / EMS / LINE" maxlength="10" />
</el-form-item>
<el-form-item label="渠道ID" prop="snId">
<el-input v-model="schemeForm.snId" placeholder="请输入渠道 snId" />
</el-form-item>
<el-form-item label="备注" prop="zsNote">
<el-input v-model="schemeForm.zsNote" type="textarea" placeholder="请输入备注" :rows="3" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitSchemeForm">确 定</el-button>
<el-button @click="schemeOpen = false">取 消</el-button>
</div>
</template>
</el-dialog>
<!-- 区划表单 -->
<el-dialog :title="divisionTitle" v-model="divisionOpen" width="560px" append-to-body>
<el-form ref="divisionFormRef" :model="divisionForm" :rules="divisionRules" label-width="100px">
<el-form-item label="区划代码" prop="zdCode">
<el-input v-model="divisionForm.zdCode" placeholder="如 DHL-ASIA" maxlength="50" />
</el-form-item>
<el-form-item label="中文名" prop="znName">
<el-input v-model="divisionForm.znName" placeholder="请输入中文名" maxlength="50" />
</el-form-item>
<el-form-item label="英文名" prop="znEname">
<el-input v-model="divisionForm.znEname" placeholder="请输入英文名" maxlength="50" />
</el-form-item>
<el-form-item label="排序号" prop="zdSort">
<el-input v-model="divisionForm.zdSort" placeholder="显示排序号" maxlength="3" />
</el-form-item>
<el-form-item label="备注" prop="znNote">
<el-input v-model="divisionForm.znNote" type="textarea" placeholder="请输入备注" :rows="3" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitDivisionForm">确 定</el-button>
<el-button @click="divisionOpen = false">取 消</el-button>
</div>
</template>
</el-dialog>
<!-- 国家抽屉 -->
<el-drawer v-model="countryDrawerVisible" size="640px" append-to-body>
<template #header>
<div class="drawer-head">
<span class="drawer-title">区划国家</span>
<span v-if="selectedDivision" class="drawer-sub">
{{ selectedDivision.zdCode }} {{ selectedDivision.znName }}
</span>
</div>
</template>
<div class="drawer-toolbar">
<el-button
type="primary"
plain
icon="Plus"
size="small"
@click="handleCountryAdd"
v-hasPermi="['price:zone:add']"
>新增国家</el-button>
</div>
<el-table v-loading="countryLoading" :data="countryList" border row-key="zcId" empty-text="暂无国家">
<el-table-column label="zcId" prop="zcId" align="center" width="80" />
<el-table-column label="国家代码" prop="countryCode" align="center" width="100" />
<el-table-column label="划分类型" prop="zcDividekind" align="center" width="120">
<template #default="{ row }">
<el-tag size="small" :type="divideKindTag(row.zcDividekind)">
{{ divideKindLabel(row.zcDividekind) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="160">
<template #default="{ row }">
<el-button link type="primary" icon="Edit" @click="handleCountryUpdate(row)" v-hasPermi="['price:zone:edit']">编辑</el-button>
<el-button link type="primary" icon="Delete" @click="handleCountryDelete(row.zcId)" v-hasPermi="['price:zone:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-drawer>
<!-- 国家表单 -->
<el-dialog :title="countryTitle" v-model="countryOpen" width="480px" append-to-body>
<el-form ref="countryFormRef" :model="countryForm" :rules="countryRules" label-width="100px">
<el-form-item label="国家代码" prop="countryCode">
<el-input v-model="countryForm.countryCode" placeholder="ISO两位码,如 DE" maxlength="2" style="text-transform: uppercase" />
</el-form-item>
<el-form-item label="划分类型" prop="zcDividekind">
<el-radio-group v-model="countryForm.zcDividekind">
<el-radio value="C">国家(C)</el-radio>
<el-radio value="T">城市(T)</el-radio>
<el-radio value="P">邮编(P)</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitCountryForm">确 定</el-button>
<el-button @click="countryOpen = false">取 消</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="PriceZone">
import {
listScheme, getScheme, addScheme, updateScheme, delScheme,
listDivision, addDivision, updateDivision, delDivision,
listCountry, addCountry, updateCountry, delCountry
} from '@/api/price/zone'
const { proxy } = getCurrentInstance()
const schemeTableRef = ref()
const selectedScheme = ref(null)
const divisionList = ref([])
const divisionLoading = ref(false)
const schemeOpen = ref(false)
const schemeTitle = ref('')
const schemeFormRef = ref()
const schemeForm = ref({})
const schemeRules = {
zsName: [{ required: true, message: '方案名称不能为空', trigger: 'blur' }],
ssCode: [{ required: true, message: '状态不能为空', trigger: 'change' }]
}
const divisionOpen = ref(false)
const divisionTitle = ref('')
const divisionFormRef = ref()
const divisionForm = ref({})
const divisionRules = {
zdCode: [{ required: true, message: '区划代码不能为空', trigger: 'blur' }],
znName: [{ required: true, message: '中文名不能为空', trigger: 'blur' }]
}
const countryDrawerVisible = ref(false)
const selectedDivision = ref(null)
const countryList = ref([])
const countryLoading = ref(false)
const countryOpen = ref(false)
const countryTitle = ref('')
const countryFormRef = ref()
const countryForm = ref({})
const countryRules = {
countryCode: [
{ required: true, message: '国家代码不能为空', trigger: 'blur' },
{ min: 2, max: 2, message: '国家代码须为2位', trigger: 'blur' }
],
zcDividekind: [{ required: true, message: '划分类型不能为空', trigger: 'change' }]
}
const schemeSearchColumns = [
{ label: '方案名称', prop: 'zsName', component: 'input', placeholder: '请输入方案名称', width: '220px' },
{
label: '状态',
prop: 'ssCode',
component: 'select',
options: [
{ label: '有效(on)', value: 'on' },
{ label: '停用(of)', value: 'of' }
],
placeholder: '状态',
width: '160px'
}
]
const schemeColumns = [
{ label: 'zsId', prop: 'zsId', align: 'center', width: 80 },
{ label: '方案名称', prop: 'zsName', align: 'center', minWidth: 140 },
{ label: '状态', prop: 'ssCode', align: 'center', width: 90 },
{ label: '产品组', prop: 'pgCode', align: 'center', width: 100 },
{ label: '渠道', prop: 'snId', align: 'center', width: 100 },
{ label: '区划数', prop: 'divisionCount', align: 'center', width: 90 },
{ label: '操作', prop: 'action', align: 'center', width: 160, showInToolbar: false }
]
function querySchemeList(params) {
return listScheme(params)
}
function handleSchemeRowClick(row) {
if (!row?.zsId) return
selectedScheme.value = row
loadDivisionList(row.zsId)
}
function loadDivisionList(zsId) {
if (!zsId) {
divisionList.value = []
return
}
divisionLoading.value = true
listDivision({ zsId, pageNum: 1, pageSize: 200 }).then(res => {
divisionList.value = res.rows || []
}).catch(() => {
divisionList.value = []
}).finally(() => {
divisionLoading.value = false
})
}
function resetSchemeForm() {
schemeForm.value = {
zsId: undefined,
zsName: undefined,
ssCode: 'on',
pgCode: undefined,
snId: undefined,
zsNote: undefined
}
proxy.resetForm('schemeFormRef')
}
function handleSchemeAdd() {
resetSchemeForm()
schemeOpen.value = true
schemeTitle.value = '新建分区方案'
}
function handleSchemeUpdate(row) {
resetSchemeForm()
getScheme(row.zsId).then(res => {
schemeForm.value = res.data || {}
schemeOpen.value = true
schemeTitle.value = '编辑分区方案'
})
}
function submitSchemeForm() {
proxy.$refs['schemeFormRef'].validate(valid => {
if (!valid) return
const payload = { ...schemeForm.value }
if (payload.snId === '' || payload.snId === null) {
payload.snId = undefined
} else if (payload.snId !== undefined) {
payload.snId = Number(payload.snId)
}
const req = payload.zsId != null ? updateScheme(payload) : addScheme(payload)
req.then(() => {
proxy.$modal.msgSuccess(payload.zsId != null ? '修改成功' : '新增成功')
schemeOpen.value = false
schemeTableRef.value.refresh()
if (selectedScheme.value?.zsId === payload.zsId) {
loadDivisionList(payload.zsId)
}
})
})
}
function handleSchemeDelete(zsIds) {
proxy.$modal.confirm('是否确认删除分区方案编号为"' + zsIds + '"的数据项?').then(() => {
return delScheme(zsIds)
}).then(() => {
schemeTableRef.value.refresh()
if (selectedScheme.value && String(zsIds).split(',').map(String).includes(String(selectedScheme.value.zsId))) {
selectedScheme.value = null
divisionList.value = []
}
proxy.$modal.msgSuccess('删除成功')
}).catch(() => {})
}
function resetDivisionForm() {
divisionForm.value = {
zdId: undefined,
zsId: selectedScheme.value?.zsId,
zdCode: undefined,
znName: undefined,
znEname: undefined,
zdSort: undefined,
znNote: undefined
}
proxy.resetForm('divisionFormRef')
}
function handleDivisionAdd() {
if (!selectedScheme.value) {
proxy.$modal.msgWarning('请先选择分区方案')
return
}
resetDivisionForm()
divisionOpen.value = true
divisionTitle.value = '新增区划'
}
function handleDivisionUpdate(row) {
resetDivisionForm()
divisionForm.value = { ...row }
divisionOpen.value = true
divisionTitle.value = '编辑区划'
}
function submitDivisionForm() {
proxy.$refs['divisionFormRef'].validate(valid => {
if (!valid) return
const payload = { ...divisionForm.value, zsId: selectedScheme.value.zsId }
const req = payload.zdId != null ? updateDivision(payload) : addDivision(payload)
req.then(() => {
proxy.$modal.msgSuccess(payload.zdId != null ? '修改成功' : '新增成功')
divisionOpen.value = false
loadDivisionList(selectedScheme.value.zsId)
schemeTableRef.value.refresh()
})
})
}
function handleDivisionDelete(zdIds) {
proxy.$modal.confirm('是否确认删除区划编号为"' + zdIds + '"的数据项?').then(() => {
return delDivision(zdIds)
}).then(() => {
loadDivisionList(selectedScheme.value.zsId)
schemeTableRef.value.refresh()
proxy.$modal.msgSuccess('删除成功')
}).catch(() => {})
}
function divideKindLabel(kind) {
const map = { C: '国家(C)', T: '城市(T)', P: '邮编(P)' }
return map[kind] || kind
}
function divideKindTag(kind) {
const map = { C: 'primary', T: 'warning', P: 'success' }
return map[kind] || 'info'
}
function openCountryDrawer(row) {
selectedDivision.value = row
countryDrawerVisible.value = true
loadCountryList(row.zdId)
}
function loadCountryList(zdId) {
if (!zdId) {
countryList.value = []
return
}
countryLoading.value = true
listCountry({ zdId, pageNum: 1, pageSize: 500 }).then(res => {
countryList.value = res.rows || []
}).catch(() => {
countryList.value = []
}).finally(() => {
countryLoading.value = false
})
}
function resetCountryForm() {
countryForm.value = {
zcId: undefined,
zdId: selectedDivision.value?.zdId,
countryCode: undefined,
zcDividekind: 'C'
}
proxy.resetForm('countryFormRef')
}
function handleCountryAdd() {
resetCountryForm()
countryOpen.value = true
countryTitle.value = '新增国家'
}
function handleCountryUpdate(row) {
resetCountryForm()
countryForm.value = { ...row }
countryOpen.value = true
countryTitle.value = '编辑国家'
}
function submitCountryForm() {
proxy.$refs['countryFormRef'].validate(valid => {
if (!valid) return
const payload = {
...countryForm.value,
zdId: selectedDivision.value.zdId,
countryCode: (countryForm.value.countryCode || '').toUpperCase()
}
const req = payload.zcId != null ? updateCountry(payload) : addCountry(payload)
req.then(() => {
proxy.$modal.msgSuccess(payload.zcId != null ? '修改成功' : '新增成功')
countryOpen.value = false
loadCountryList(selectedDivision.value.zdId)
loadDivisionList(selectedScheme.value.zsId)
})
})
}
function handleCountryDelete(zcIds) {
proxy.$modal.confirm('是否确认删除国家编号为"' + zcIds + '"的数据项?').then(() => {
return delCountry(zcIds)
}).then(() => {
loadCountryList(selectedDivision.value.zdId)
loadDivisionList(selectedScheme.value.zsId)
proxy.$modal.msgSuccess('删除成功')
}).catch(() => {})
}
</script>
<style scoped>
.detail-card {
margin-top: 16px;
}
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
}
.sub-hint {
margin-left: 10px;
color: #909399;
font-size: 13px;
font-weight: normal;
}
.drawer-head {
display: flex;
align-items: center;
gap: 10px;
}
.drawer-title {
font-size: 16px;
font-weight: 600;
}
.drawer-sub {
color: #909399;
font-size: 13px;
}
.drawer-toolbar {
margin-bottom: 12px;
}
</style>
+490
View File
@@ -0,0 +1,490 @@
<template>
<div class="app-container">
<el-steps :active="active" finish-status="success" align-center class="wizard-steps">
<el-step title="基本信息" />
<el-step title="套餐明细" />
<el-step title="绑定客户" />
<el-step title="校验确认" />
</el-steps>
<!-- 第 1 步 -->
<el-card v-show="active === 0" shadow="never" class="step-card">
<template #header><span>第 1 步 · 基本信息</span></template>
<el-form ref="formRef" :model="form" :rules="rules" label-width="120px" class="max-form">
<el-form-item label="套餐名称" prop="priceSetName">
<el-input v-model="form.priceSetName" maxlength="50" placeholder="如:金牌电商专属套餐" />
<div class="form-hint">显示给客户的套餐对外名称</div>
</el-form-item>
<el-form-item label="计价类型" prop="setType">
<div class="type-row">
<div
class="type-card"
:class="{ selected: form.setType === 'FIXED' }"
@click="form.setType = 'FIXED'"
>
<div class="t-title">FIXED 固定价</div>
<div class="t-desc">每个产品×国家×重量段独立配置运费单价 + 挂号费,覆盖默认价</div>
</div>
<div
class="type-card"
:class="{ selected: form.setType === 'DISCOUNT' }"
@click="form.setType = 'DISCOUNT'"
>
<div class="t-title">DISCOUNT 折扣</div>
<div class="t-desc">按默认等级价统一乘折扣,可选产品范围</div>
</div>
</div>
</el-form-item>
<el-form-item label="默认折扣" prop="defaultDiscount">
<el-input-number
v-model="form.defaultDiscount"
:min="1"
:max="99"
:disabled="form.setType !== 'DISCOUNT'"
controls-position="right"
/>
<span class="unit">%</span>
<el-tag v-if="form.setType !== 'DISCOUNT'" type="warning" size="small" style="margin-left: 8px">仅 DISCOUNT 模式生效</el-tag>
<div class="form-hint">范围 1~99,88 表示默认价 × 0.88;FIXED 模式此值忽略</div>
</el-form-item>
<el-form-item label="生效日期" prop="effectiveDate">
<el-date-picker v-model="form.effectiveDate" type="date" value-format="YYYY-MM-DD" placeholder="生效日期" />
</el-form-item>
<el-form-item label="失效日期" prop="expireDate">
<el-date-picker v-model="form.expireDate" type="date" value-format="YYYY-MM-DD" placeholder="空表示长期有效" />
<div class="form-hint">空表示长期有效</div>
</el-form-item>
<el-form-item label="说明备注" prop="priceSetNote">
<el-input v-model="form.priceSetNote" type="textarea" :rows="3" maxlength="200" placeholder="套餐业务说明,显示给客户与运营" />
</el-form-item>
</el-form>
</el-card>
<!-- 第 2 步 -->
<el-card v-show="active === 1" shadow="never" class="step-card">
<template #header>
<div class="card-head">
<span>
第 2 步 · 套餐明细
<span class="sub">当前:{{ form.setType === 'FIXED' ? 'FIXED 固定价' : 'DISCOUNT 折扣' }}模式</span>
</span>
<el-button type="primary" size="small" icon="Plus" @click="addDetailRow">添加明细行</el-button>
</div>
</template>
<el-alert
v-if="form.setType === 'FIXED'"
type="info"
:closable="false"
show-icon
class="mb12"
title="FIXED 模式:每个产品 × 国家 × 重量段独立配置运费单价(RMB/KG)+ 挂号费(RMB/票)。命中时直接取该固定价。"
/>
<el-alert
v-else
type="warning"
:closable="false"
show-icon
class="mb12"
title="DISCOUNT 模式:可不填明细(全部产品适用默认折扣),或按产品限定折扣范围。"
/>
<el-table :data="form.details" border empty-text="暂无明细,点击添加明细行">
<el-table-column label="产品" min-width="150">
<template #default="{ row }">
<el-select v-model="row.productCode" filterable allow-create placeholder="产品" @change="onProductChange(row)">
<el-option v-for="p in productOptions" :key="p.value" :label="p.label" :value="p.value" />
</el-select>
</template>
</el-table-column>
<el-table-column v-if="form.setType === 'FIXED'" label="国家" min-width="130">
<template #default="{ row }">
<el-select v-model="row.countryCode" filterable allow-create placeholder="国家" @change="onCountryChange(row)">
<el-option v-for="c in countryOptions" :key="c.value" :label="c.label" :value="c.value" />
</el-select>
</template>
</el-table-column>
<el-table-column v-if="form.setType === 'FIXED'" label="重量段" min-width="150">
<template #default="{ row }">
<el-select v-model="row.weightLabel" filterable allow-create placeholder="重量段">
<el-option v-for="w in weightOptions" :key="w.value" :label="w.label" :value="w.value" />
</el-select>
</template>
</el-table-column>
<el-table-column v-if="form.setType === 'FIXED'" label="运费单价(RMB/KG)" min-width="150">
<template #default="{ row }">
<el-input-number v-model="row.fvValue" :min="0" :precision="4" :step="1" controls-position="right" style="width: 100%" />
</template>
</el-table-column>
<el-table-column v-if="form.setType === 'FIXED'" label="挂号费(RMB/票)" min-width="140">
<template #default="{ row }">
<el-input-number v-model="row.fvRegistrationFee" :min="0" :precision="2" :step="1" controls-position="right" style="width: 100%" />
</template>
</el-table-column>
<el-table-column v-if="form.setType === 'DISCOUNT'" label="产品折扣%" min-width="140">
<template #default="{ row }">
<el-input-number v-model="row.discountValue" :min="1" :max="99" :precision="2" controls-position="right" style="width: 100%" placeholder="空=默认折扣" />
</template>
</el-table-column>
<el-table-column label="操作" width="80" align="center">
<template #default="{ $index }">
<el-button link type="danger" @click="form.details.splice($index, 1)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<!-- 第 3 步 -->
<el-card v-show="active === 2" shadow="never" class="step-card">
<template #header>
<div class="card-head">
<span>第 3 步 · 绑定客户<span class="sub">可选,可后续补充</span></span>
<el-button type="primary" size="small" icon="Plus" @click="addCustomerRow">添加客户</el-button>
</div>
</template>
<el-alert
type="warning"
:closable="false"
show-icon
class="mb12"
title="套餐创建后处于草稿状态,可暂不绑定客户。优先级数字越小越优先(1 = 最高)。同一客户可绑定多个套餐。"
/>
<el-table :data="form.customers" border empty-text="暂未绑定客户">
<el-table-column label="客户ID" min-width="120">
<template #default="{ row }">
<el-input v-model="row.customerId" placeholder="客户ID" />
</template>
</el-table-column>
<el-table-column label="客户名称" min-width="140">
<template #default="{ row }">
<el-input v-model="row.customerName" placeholder="客户名称" />
</template>
</el-table-column>
<el-table-column label="优先级" width="110">
<template #default="{ row }">
<el-input-number v-model="row.bindPriority" :min="1" controls-position="right" style="width: 100%" />
</template>
</el-table-column>
<el-table-column label="生效日期" min-width="150">
<template #default="{ row }">
<el-date-picker v-model="row.prBegindate" type="date" value-format="YYYY-MM-DD" style="width: 100%" />
</template>
</el-table-column>
<el-table-column label="失效日期" min-width="150">
<template #default="{ row }">
<el-date-picker v-model="row.prEnddate" type="date" value-format="YYYY-MM-DD" style="width: 100%" />
</template>
</el-table-column>
<el-table-column label="操作" width="80" align="center">
<template #default="{ $index }">
<el-button link type="danger" @click="form.customers.splice($index, 1)">移除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<!-- 第 4 步 -->
<el-card v-show="active === 3" shadow="never" class="step-card">
<template #header>
<div class="card-head">
<span>第 4 步 · 校验确认</span>
<el-button type="primary" size="small" @click="runValidate">重新校验</el-button>
</div>
</template>
<el-table :data="checkItems" border empty-text="点击「下一步」或「重新校验」执行校验">
<el-table-column label="校验项" prop="item" min-width="200" />
<el-table-column label="结果" width="120">
<template #default="{ row }">
<el-tag :type="checkTag(row.result)" size="small">{{ checkLabel(row.result) }}</el-tag>
</template>
</el-table-column>
<el-table-column label="说明" prop="message" min-width="280" />
</el-table>
</el-card>
<div class="wizard-actions">
<el-button @click="goBack">取消</el-button>
<el-button v-if="active > 0" @click="active--">上一步</el-button>
<el-button v-if="active < 3" type="primary" @click="nextStep">下一步</el-button>
<el-button type="info" :loading="saving" @click="saveDraft">保存草稿</el-button>
<el-button type="primary" :loading="saving" @click="saveAndSubmit">保存并提交审核</el-button>
</div>
</div>
</template>
<script setup name="PriceSetCreate">
import { getPriceSet, savePriceSet, validatePriceSet } from '@/api/price/set'
const { proxy } = getCurrentInstance()
const route = useRoute()
const active = ref(0)
const saving = ref(false)
const formRef = ref()
const checkItems = ref([])
const productOptions = [
{ value: 'WSP037', label: 'WSP037 球衣' },
{ value: 'WSP038', label: 'WSP038 普货' },
{ value: 'WSP034', label: 'WSP034 带电' },
{ value: 'WSP035', label: 'WSP035 敏感' },
{ value: 'WSP066', label: 'WSP066 鞋盒' }
]
const countryOptions = [
{ value: 'DE', label: '德国 DE' },
{ value: 'FR', label: '法国 FR' },
{ value: 'IT', label: '意大利 IT' },
{ value: 'ES', label: '西班牙 ES' }
]
const weightOptions = [
{ value: '0.01≤W≤0.3', label: '0.01≤W≤0.3' },
{ value: '0.3<W≤1', label: '0.3<W≤1' },
{ value: '1<W≤2', label: '1<W≤2' }
]
const form = reactive({
priceSetId: undefined,
priceSetName: '',
setType: 'FIXED',
defaultDiscount: 88,
effectiveDate: undefined,
expireDate: undefined,
priceSetNote: '',
details: [],
customers: []
})
const rules = {
priceSetName: [{ required: true, message: '套餐名称不能为空', trigger: 'blur' }],
setType: [{ required: true, message: '请选择计价类型', trigger: 'change' }],
effectiveDate: [{ required: true, message: '生效日期不能为空', trigger: 'change' }]
}
function emptyDetail() {
return {
productCode: undefined,
productName: undefined,
countryCode: form.setType === 'FIXED' ? 'DE' : undefined,
countryName: form.setType === 'FIXED' ? '德国' : undefined,
weightLabel: form.setType === 'FIXED' ? '0.3<W≤1' : undefined,
fvValue: undefined,
fvRegistrationFee: undefined,
discountValue: undefined
}
}
function emptyCustomer() {
return {
customerId: undefined,
customerName: '',
bindPriority: form.customers.length + 1,
prBegindate: form.effectiveDate,
prEnddate: form.expireDate
}
}
function addDetailRow() {
form.details.push(emptyDetail())
}
function addCustomerRow() {
form.customers.push(emptyCustomer())
}
function onProductChange(row) {
const found = productOptions.find(p => p.value === row.productCode)
row.productName = found ? found.label.replace(row.productCode + ' ', '') : row.productCode
}
function onCountryChange(row) {
const found = countryOptions.find(c => c.value === row.countryCode)
row.countryName = found ? found.label.replace(' ' + row.countryCode, '') : row.countryCode
}
function buildPayload(submitFlag) {
const details = (form.details || []).filter(d => d.productCode).map(d => ({
...d,
countryCode: d.countryCode || undefined,
fvValue: d.fvValue,
fvRegistrationFee: d.fvRegistrationFee
}))
const customers = (form.customers || [])
.filter(c => c.customerId)
.map(c => ({
...c,
customerId: Number(c.customerId)
}))
return {
priceSetId: form.priceSetId,
priceSetName: form.priceSetName,
setType: form.setType,
defaultDiscount: form.setType === 'DISCOUNT' ? form.defaultDiscount : undefined,
effectiveDate: form.effectiveDate,
expireDate: form.expireDate || undefined,
priceSetNote: form.priceSetNote,
details,
customers,
submitFlag: submitFlag ? 'Y' : undefined
}
}
function nextStep() {
if (active.value === 0) {
formRef.value.validate(valid => {
if (valid) active.value++
})
return
}
if (active.value === 2) {
active.value++
runValidate()
return
}
active.value++
}
function runValidate() {
validatePriceSet(buildPayload(false)).then(res => {
checkItems.value = res.data || []
})
}
function saveDraft() {
formRef.value.validate(valid => {
if (!valid) {
active.value = 0
return
}
doSave(false)
})
}
function saveAndSubmit() {
formRef.value.validate(valid => {
if (!valid) {
active.value = 0
return
}
doSave(true)
})
}
function doSave(submit) {
saving.value = true
savePriceSet(buildPayload(submit)).then(res => {
form.priceSetId = res.data
proxy.$modal.msgSuccess(submit ? '已保存并提交审核' : '草稿已保存,套餐ID=' + res.data)
goBack()
}).finally(() => {
saving.value = false
})
}
function goBack() {
const obj = { path: '/customer/set' }
if (proxy.$tab) {
proxy.$tab.closeOpenPage(obj)
} else {
proxy.$router.push(obj)
}
}
function checkTag(result) {
const map = { PASS: 'success', WARN: 'warning', FAIL: 'danger', INFO: 'primary' }
return map[result] || 'info'
}
function checkLabel(result) {
const map = { PASS: '? 通过', WARN: '? 待确认', FAIL: '? 失败', INFO: '? 提示' }
return map[result] || result
}
function loadExisting(id) {
getPriceSet(id).then(res => {
const data = res.data || {}
form.priceSetId = data.priceSetId
form.priceSetName = data.priceSetName
form.setType = data.setType || 'FIXED'
form.defaultDiscount = data.defaultDiscount != null ? Number(data.defaultDiscount) : 88
form.effectiveDate = data.effectiveDate
form.expireDate = data.expireDate
form.priceSetNote = data.priceSetNote
form.details = (data.details || []).map(d => ({ ...d }))
form.customers = (data.customers || []).map(c => ({ ...c }))
})
}
onMounted(() => {
const id = route.query.priceSetId
if (id) {
loadExisting(id)
} else {
addDetailRow()
}
})
</script>
<style scoped>
.wizard-steps {
margin-bottom: 20px;
background: #fff;
padding: 20px 12px 12px;
border-radius: 6px;
}
.step-card {
margin-bottom: 16px;
}
.card-head {
display: flex;
align-items: center;
justify-content: space-between;
}
.sub {
margin-left: 8px;
color: #909399;
font-weight: normal;
font-size: 13px;
}
.max-form {
max-width: 760px;
}
.form-hint {
font-size: 12px;
color: #909399;
line-height: 1.4;
margin-top: 4px;
}
.unit {
margin-left: 8px;
color: #909399;
}
.type-row {
display: flex;
gap: 12px;
width: 100%;
}
.type-card {
flex: 1;
border: 1px solid #d9d9d9;
border-radius: 6px;
padding: 14px 16px;
cursor: pointer;
}
.type-card.selected {
border-color: #1890ff;
background: #e6f7ff;
}
.t-title {
font-weight: 600;
margin-bottom: 4px;
}
.t-desc {
font-size: 12px;
color: #909399;
line-height: 1.5;
}
.mb12 {
margin-bottom: 12px;
}
.wizard-actions {
text-align: center;
padding: 8px 0 24px;
}
</style>
+416
View File
@@ -0,0 +1,416 @@
<template>
<div class="app-container" v-loading="loading">
<div class="detail-header">
<h2>{{ set.priceSetCode || '-' }} · {{ set.priceSetName || '套餐详情' }}</h2>
<div class="header-actions">
<el-tag :type="statusTag" size="large">{{ statusLabel }}</el-tag>
<el-tag :type="set.setType === 'FIXED' ? 'warning' : 'primary'" size="large" effect="plain">
{{ set.setType === 'FIXED' ? 'FIXED 固定价' : 'DISCOUNT 折扣' }}
</el-tag>
<el-button @click="goList">返回列表</el-button>
<el-button v-if="set.status === 'D' || set.status === 'R'" type="primary" @click="goEdit" v-hasPermi="['price:set:edit']">继续配置</el-button>
<el-button v-if="set.status === 'D' || set.status === 'R'" type="primary" @click="onSubmit" v-hasPermi="['price:set:audit']">提交审核</el-button>
<el-button v-if="set.status === 'A'" type="success" @click="onApprove" v-hasPermi="['price:set:audit']">审批生效</el-button>
<el-button v-if="set.status === 'A'" type="warning" @click="onReject" v-hasPermi="['price:set:audit']">驳回</el-button>
<el-button v-if="set.status === 'E' && !set.expired" type="danger" @click="onDisable" v-hasPermi="['price:set:audit']">停用</el-button>
<el-button v-if="set.status === 'S'" @click="onCopy" v-hasPermi="['price:set:add']">复用新建</el-button>
</div>
</div>
<el-row :gutter="16">
<el-col :span="24">
<el-card shadow="never">
<template #header>基本信息</template>
<el-descriptions :column="2" border>
<el-descriptions-item label="套餐ID">{{ set.priceSetCode }}</el-descriptions-item>
<el-descriptions-item label="套餐名称">{{ set.priceSetName }}</el-descriptions-item>
<el-descriptions-item label="计价类型">
{{ set.setType === 'FIXED' ? 'FIXED 固定价' : 'DISCOUNT 折扣' }}
</el-descriptions-item>
<el-descriptions-item label="默认折扣">
<span v-if="set.setType === 'DISCOUNT'">{{ set.defaultDiscount }}%</span>
<el-tag v-else type="info" size="small">不适用(FIXED)</el-tag>
</el-descriptions-item>
<el-descriptions-item label="状态">{{ statusLabel }}</el-descriptions-item>
<el-descriptions-item label="生效日期">
{{ formatDate(set.effectiveDate) }} ~ {{ set.expireDate ? formatDate(set.expireDate) : '长期' }}
</el-descriptions-item>
<el-descriptions-item label="创建人">{{ set.createBy || '-' }}</el-descriptions-item>
<el-descriptions-item label="创建时间">{{ set.createTime || '-' }}</el-descriptions-item>
<el-descriptions-item label="最后更新" :span="2">{{ set.updateTime || '-' }} {{ set.updateBy ? '(' + set.updateBy + ')' : '' }}</el-descriptions-item>
<el-descriptions-item label="说明" :span="2">{{ set.priceSetNote || '-' }}</el-descriptions-item>
</el-descriptions>
</el-card>
</el-col>
</el-row>
<el-card shadow="never" class="mt16">
<template #header>
<div class="card-head">
<span>套餐明细</span>
<el-button
v-if="childEditable"
type="primary"
size="small"
icon="Plus"
@click="openDetailDialog()"
v-hasPermi="['price:set:edit']"
>添加明细</el-button>
</div>
</template>
<el-table :data="set.details || []" border empty-text="暂无明细">
<el-table-column label="明细ID" prop="psdId" width="90" />
<el-table-column label="产品" min-width="130">
<template #default="{ row }">{{ row.productCode }} {{ row.productName || '' }}</template>
</el-table-column>
<el-table-column v-if="set.setType === 'FIXED'" label="国家" min-width="110">
<template #default="{ row }">{{ row.countryName || row.countryCode || '-' }}</template>
</el-table-column>
<el-table-column v-if="set.setType === 'FIXED'" label="重量段" prop="weightLabel" min-width="120" />
<el-table-column v-if="set.setType === 'FIXED'" label="运费单价" min-width="120">
<template #default="{ row }"><span class="hl">{{ row.fvValue }} RMB/KG</span></template>
</el-table-column>
<el-table-column v-if="set.setType === 'FIXED'" label="挂号费" min-width="120">
<template #default="{ row }"><span class="reg">{{ row.fvRegistrationFee }} RMB/票</span></template>
</el-table-column>
<el-table-column v-if="set.setType === 'DISCOUNT'" label="产品折扣" min-width="110">
<template #default="{ row }">{{ row.discountValue != null ? row.discountValue + '%' : '默认折扣' }}</template>
</el-table-column>
<el-table-column label="关联 pr_id" prop="prId" width="110">
<template #default="{ row }">{{ row.prId || '-' }}</template>
</el-table-column>
<el-table-column v-if="childEditable" label="操作" width="140" align="center">
<template #default="{ row }">
<el-button link type="primary" @click="openDetailDialog(row)" v-hasPermi="['price:set:edit']">编辑</el-button>
<el-button link type="danger" @click="removeDetail(row)" v-hasPermi="['price:set:edit']">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card shadow="never" class="mt16">
<template #header>
<div class="card-head">
<span>绑定客户</span>
<el-button
v-if="childEditable"
type="primary"
size="small"
icon="Plus"
@click="openCustomerDialog()"
v-hasPermi="['price:set:edit']"
>添加客户</el-button>
</div>
</template>
<el-table :data="set.customers || []" border empty-text="暂未绑定客户">
<el-table-column label="绑定ID" prop="customerPricesetId" width="100" />
<el-table-column label="客户ID" prop="customerId" width="110" />
<el-table-column label="客户名称" prop="customerName" min-width="140" />
<el-table-column label="优先级" width="110">
<template #default="{ row }">{{ row.bindPriority }}{{ row.bindPriority === 1 ? '(最高)' : '' }}</template>
</el-table-column>
<el-table-column label="生效日期" min-width="200">
<template #default="{ row }">
{{ formatDate(row.prBegindate) }} ~ {{ row.prEnddate ? formatDate(row.prEnddate) : '长期' }}
</template>
</el-table-column>
<el-table-column v-if="childEditable" label="操作" width="140" align="center">
<template #default="{ row }">
<el-button link type="primary" @click="openCustomerDialog(row)" v-hasPermi="['price:set:edit']">编辑</el-button>
<el-button link type="danger" @click="removeCustomer(row)" v-hasPermi="['price:set:edit']">解绑</el-button>
</template>
</el-table-column>
</el-table>
<div class="rel-hint">优先级数字越小越优先;同一客户绑定多个套餐时,按优先级 → 生效日期依次命中。</div>
</el-card>
<el-dialog :title="detailTitle" v-model="detailOpen" width="560px" append-to-body>
<el-form ref="detailFormRef" :model="detailForm" :rules="detailRules" label-width="120px">
<el-form-item label="产品代码" prop="productCode">
<el-input v-model="detailForm.productCode" maxlength="10" />
</el-form-item>
<el-form-item label="产品名称" prop="productName">
<el-input v-model="detailForm.productName" maxlength="50" />
</el-form-item>
<template v-if="set.setType === 'FIXED'">
<el-form-item label="国家代码" prop="countryCode">
<el-input v-model="detailForm.countryCode" maxlength="2" />
</el-form-item>
<el-form-item label="国家名称" prop="countryName">
<el-input v-model="detailForm.countryName" maxlength="50" />
</el-form-item>
<el-form-item label="重量段" prop="weightLabel">
<el-input v-model="detailForm.weightLabel" maxlength="50" />
</el-form-item>
<el-form-item label="运费单价" prop="fvValue">
<el-input-number v-model="detailForm.fvValue" :min="0" :precision="4" controls-position="right" style="width: 100%" />
</el-form-item>
<el-form-item label="挂号费" prop="fvRegistrationFee">
<el-input-number v-model="detailForm.fvRegistrationFee" :min="0" :precision="2" controls-position="right" style="width: 100%" />
</el-form-item>
</template>
<el-form-item v-else label="产品折扣%" prop="discountValue">
<el-input-number v-model="detailForm.discountValue" :min="1" :max="99" controls-position="right" style="width: 100%" />
</el-form-item>
<el-form-item label="关联 pr_id" prop="prId">
<el-input v-model="detailForm.prId" placeholder="可选" />
</el-form-item>
</el-form>
<template #footer>
<el-button type="primary" @click="submitDetail">确 定</el-button>
<el-button @click="detailOpen = false">取 消</el-button>
</template>
</el-dialog>
<el-dialog :title="customerTitle" v-model="customerOpen" width="520px" append-to-body>
<el-form ref="customerFormRef" :model="customerForm" :rules="customerRules" label-width="110px">
<el-form-item label="客户ID" prop="customerId">
<el-input v-model="customerForm.customerId" />
</el-form-item>
<el-form-item label="客户名称" prop="customerName">
<el-input v-model="customerForm.customerName" maxlength="100" />
</el-form-item>
<el-form-item label="优先级" prop="bindPriority">
<el-input-number v-model="customerForm.bindPriority" :min="1" controls-position="right" />
</el-form-item>
<el-form-item label="生效日期" prop="prBegindate">
<el-date-picker v-model="customerForm.prBegindate" type="date" value-format="YYYY-MM-DD" style="width: 100%" />
</el-form-item>
<el-form-item label="失效日期" prop="prEnddate">
<el-date-picker v-model="customerForm.prEnddate" type="date" value-format="YYYY-MM-DD" style="width: 100%" />
</el-form-item>
</el-form>
<template #footer>
<el-button type="primary" @click="submitCustomer">确 定</el-button>
<el-button @click="customerOpen = false">取 消</el-button>
</template>
</el-dialog>
</div>
</template>
<script setup name="PriceSetDetail">
import {
getPriceSet, submitPriceSet, approvePriceSet, rejectPriceSet, disablePriceSet, copyPriceSet,
addSetDetail, updateSetDetail, delSetDetail,
addSetCustomer, updateSetCustomer, delSetCustomer
} from '@/api/price/set'
import { parseTime } from '@/utils/ruoyi'
const { proxy } = getCurrentInstance()
const route = useRoute()
const loading = ref(false)
const set = ref({})
const detailOpen = ref(false)
const detailTitle = ref('')
const detailFormRef = ref()
const detailForm = ref({})
const detailRules = {
productCode: [{ required: true, message: '产品代码不能为空', trigger: 'blur' }]
}
const customerOpen = ref(false)
const customerTitle = ref('')
const customerFormRef = ref()
const customerForm = ref({})
const customerRules = {
customerId: [{ required: true, message: '客户ID不能为空', trigger: 'blur' }],
prBegindate: [{ required: true, message: '生效日期不能为空', trigger: 'change' }]
}
const childEditable = computed(() => ['D', 'R', 'E'].includes(set.value.status))
const statusLabel = computed(() => {
if (set.value.expired) return '已过期'
const map = { D: '草稿', A: '审核中', E: '生效中', R: '驳回', S: '已停用' }
return map[set.value.status] || set.value.status || '-'
})
const statusTag = computed(() => {
if (set.value.expired) return 'danger'
const map = { D: 'warning', A: 'primary', E: 'success', R: 'danger', S: 'info' }
return map[set.value.status] || 'info'
})
function formatDate(val) {
return val ? parseTime(val, '{y}-{m}-{d}') : ''
}
function load() {
const id = route.query.priceSetId
if (!id) return
loading.value = true
getPriceSet(id).then(res => {
set.value = res.data || {}
}).finally(() => {
loading.value = false
})
}
function goList() {
const obj = { path: '/customer/set' }
if (proxy.$tab) {
proxy.$tab.closeOpenPage(obj)
} else {
proxy.$router.push(obj)
}
}
function goEdit() {
proxy.$router.push({ path: '/customer/setCreate', query: { priceSetId: set.value.priceSetId } })
}
function onSubmit() {
proxy.$modal.confirm('确认提交审核?').then(() => submitPriceSet(set.value.priceSetId)).then(() => {
proxy.$modal.msgSuccess('已提交审核')
load()
}).catch(() => {})
}
function onApprove() {
proxy.$modal.confirm('确认审批生效?').then(() => approvePriceSet(set.value.priceSetId)).then(() => {
proxy.$modal.msgSuccess('套餐已生效')
load()
}).catch(() => {})
}
function onReject() {
proxy.$modal.confirm('确认驳回该套餐?').then(() => rejectPriceSet(set.value.priceSetId)).then(() => {
proxy.$modal.msgSuccess('已驳回')
load()
}).catch(() => {})
}
function onDisable() {
proxy.$modal.confirm('停用后不再参与计费命中,确认停用?').then(() => disablePriceSet(set.value.priceSetId)).then(() => {
proxy.$modal.msgSuccess('已停用')
load()
}).catch(() => {})
}
function onCopy() {
copyPriceSet(set.value.priceSetId).then(res => {
proxy.$modal.msgSuccess('已复制为草稿')
proxy.$router.push({ path: '/customer/setCreate', query: { priceSetId: res.data } })
})
}
function openDetailDialog(row) {
detailForm.value = row ? { ...row } : {
priceSetId: set.value.priceSetId,
productCode: undefined,
productName: undefined,
countryCode: undefined,
countryName: undefined,
weightLabel: undefined,
fvValue: undefined,
fvRegistrationFee: undefined,
discountValue: undefined
}
detailTitle.value = row ? '编辑明细' : '添加明细'
detailOpen.value = true
}
function submitDetail() {
proxy.$refs['detailFormRef'].validate(valid => {
if (!valid) return
const payload = { ...detailForm.value, priceSetId: set.value.priceSetId }
const req = payload.psdId ? updateSetDetail(payload) : addSetDetail(payload)
req.then(() => {
proxy.$modal.msgSuccess('保存成功')
detailOpen.value = false
load()
})
})
}
function removeDetail(row) {
proxy.$modal.confirm('确认删除该明细?').then(() => delSetDetail(row.psdId)).then(() => {
proxy.$modal.msgSuccess('已删除')
load()
}).catch(() => {})
}
function openCustomerDialog(row) {
customerForm.value = row ? { ...row } : {
priceSetId: set.value.priceSetId,
customerId: undefined,
customerName: '',
bindPriority: 1,
prBegindate: set.value.effectiveDate,
prEnddate: set.value.expireDate
}
customerTitle.value = row ? '编辑客户绑定' : '添加客户'
customerOpen.value = true
}
function submitCustomer() {
proxy.$refs['customerFormRef'].validate(valid => {
if (!valid) return
const payload = {
...customerForm.value,
priceSetId: set.value.priceSetId,
customerId: Number(customerForm.value.customerId)
}
const req = payload.customerPricesetId ? updateSetCustomer(payload) : addSetCustomer(payload)
req.then(() => {
proxy.$modal.msgSuccess('保存成功')
customerOpen.value = false
load()
})
})
}
function removeCustomer(row) {
proxy.$modal.confirm('确认解绑该客户?').then(() => delSetCustomer(row.customerPricesetId)).then(() => {
proxy.$modal.msgSuccess('已解绑')
load()
}).catch(() => {})
}
onMounted(() => {
load()
})
</script>
<style scoped>
.detail-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
gap: 12px;
flex-wrap: wrap;
}
.detail-header h2 {
margin: 0;
font-size: 18px;
}
.header-actions {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.mt16 {
margin-top: 16px;
}
.card-head {
display: flex;
align-items: center;
justify-content: space-between;
}
.rel-hint {
margin-top: 10px;
font-size: 12px;
color: #909399;
}
.hl {
color: #1890ff;
font-weight: 600;
}
.reg {
color: #d48806;
font-weight: 600;
}
</style>
+251
View File
@@ -0,0 +1,251 @@
<template>
<div class="app-container">
<basic-table
ref="tableRef"
:columns="columns"
:search-columns="searchColumns"
:query="queryList"
row-key="priceSetId"
>
<template #toolbar="{ selection, ids }">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Plus"
@click="handleCreate"
v-hasPermi="['price:set:add']"
>新建套餐</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Delete"
:disabled="!selection.length"
@click="handleDelete(ids)"
v-hasPermi="['price:set:remove']"
>删除</el-button>
</el-col>
</template>
<template #col-setType="{ row }">
<el-tag :type="row.setType === 'FIXED' ? 'warning' : 'primary'" size="small" effect="plain">
{{ row.setType === 'FIXED' ? 'FIXED 固定价' : 'DISCOUNT 折扣' }}
</el-tag>
</template>
<template #col-dateRange="{ row }">
{{ formatDate(row.effectiveDate) }} ~ {{ row.expireDate ? formatDate(row.expireDate) : '长期' }}
</template>
<template #col-status="{ row }">
<el-tag :type="statusTag(row)" size="small">{{ statusLabel(row) }}</el-tag>
</template>
<template #col-action="{ row }">
<el-button link type="primary" @click="handleDetail(row)" v-hasPermi="['price:set:query']">详情</el-button>
<el-button
v-if="row.status === 'D' || row.status === 'R'"
link
type="primary"
@click="handleEdit(row)"
v-hasPermi="['price:set:edit']"
>{{ row.status === 'D' ? '继续配置' : '编辑' }}</el-button>
<el-button
v-if="row.status === 'D' || row.status === 'R'"
link
type="primary"
@click="handleSubmit(row)"
v-hasPermi="['price:set:audit']"
>提交审核</el-button>
<el-button
v-if="row.status === 'A'"
link
type="success"
@click="handleApprove(row)"
v-hasPermi="['price:set:audit']"
>审批</el-button>
<el-button
v-if="row.status === 'E' && !row.expired"
link
type="warning"
@click="handleDisable(row)"
v-hasPermi="['price:set:audit']"
>停用</el-button>
<el-button
v-if="row.status === 'S'"
link
type="primary"
@click="handleCopy(row)"
v-hasPermi="['price:set:add']"
>复用</el-button>
<el-button
v-if="row.status === 'D' || row.status === 'R'"
link
type="danger"
@click="handleDelete(row.priceSetId)"
v-hasPermi="['price:set:remove']"
>删除</el-button>
</template>
</basic-table>
</div>
</template>
<script setup name="PriceSet">
import {
listPriceSet, delPriceSet, submitPriceSet, approvePriceSet, disablePriceSet, copyPriceSet
} from '@/api/price/set'
import { parseTime } from '@/utils/ruoyi'
const { proxy } = getCurrentInstance()
const tableRef = ref()
const isFirstActivate = ref(true)
const searchColumns = [
{
label: '类型',
prop: 'setType',
component: 'select',
options: [
{ label: 'FIXED 固定价', value: 'FIXED' },
{ label: 'DISCOUNT 折扣', value: 'DISCOUNT' }
],
placeholder: '全部类型',
width: '160px'
},
{
label: '状态',
prop: 'status',
component: 'select',
options: [
{ label: '草稿', value: 'D' },
{ label: '审核中', value: 'A' },
{ label: '生效', value: 'E' },
{ label: '驳回', value: 'R' },
{ label: '已停用', value: 'S' }
],
placeholder: '全部状态',
width: '140px'
},
{ label: '关键字', prop: 'keyword', component: 'input', placeholder: '套餐ID / 名称 / 客户', width: '240px' }
]
const columns = [
{ label: '套餐编码', prop: 'priceSetCode', width: 110 },
{ label: '套餐名称', prop: 'priceSetName', minWidth: 160 },
{ label: '类型', prop: 'setType', width: 140 },
{ label: '说明', prop: 'priceSetNote', minWidth: 160 },
{ label: '产品数', prop: 'productCount', width: 80 },
{ label: '客户数', prop: 'customerCount', width: 80 },
{ label: '生效日期', prop: 'dateRange', minWidth: 200 },
{ label: '状态', prop: 'status', width: 90 },
{ label: '操作', prop: 'action', width: 280, showInToolbar: false }
]
function queryList(params) {
return listPriceSet(params)
}
function formatDate(val) {
return val ? parseTime(val, '{y}-{m}-{d}') : ''
}
function statusLabel(row) {
if (row.expired) return '已过期'
const map = { D: '草稿', A: '审核中', E: '生效', R: '驳回', S: '已停用' }
return map[row.status] || row.status
}
function statusTag(row) {
if (row.expired) return 'danger'
const map = { D: 'warning', A: 'primary', E: 'success', R: 'danger', S: 'info' }
return map[row.status] || 'info'
}
function handleCreate() {
proxy.$router.push({ path: '/customer/setCreate' })
}
function handleDetail(row) {
proxy.$router.push({ path: '/customer/setDetail', query: { priceSetId: row.priceSetId } })
}
function handleEdit(row) {
proxy.$router.push({ path: '/customer/setCreate', query: { priceSetId: row.priceSetId } })
}
function refresh() {
tableRef.value?.refresh()
}
onActivated(() => {
if (isFirstActivate.value) {
isFirstActivate.value = false
return
}
tableRef.value?.reload()
})
function handleDelete(ids) {
proxy.$modal.confirm('是否确认删除套餐编号为 "' + ids + '" 的数据项?').then(() => {
return delPriceSet(ids)
}).then(() => {
proxy.$modal.msgSuccess('删除成功')
refresh()
}).catch(() => {})
}
function handleSubmit(row) {
proxy.$modal.confirm('确认提交套餐【' + row.priceSetName + '】审核?').then(() => {
return submitPriceSet(row.priceSetId)
}).then(() => {
proxy.$modal.msgSuccess('已提交审核')
refresh()
}).catch(() => {})
}
function handleApprove(row) {
proxy.$modal.confirm('确认将套餐【' + row.priceSetName + '】审批生效?').then(() => {
return approvePriceSet(row.priceSetId)
}).then(() => {
proxy.$modal.msgSuccess('套餐已生效')
refresh()
}).catch(() => {})
}
function handleDisable(row) {
proxy.$modal.confirm('停用后该套餐不再参与计费命中,确认停用【' + row.priceSetName + '】?').then(() => {
return disablePriceSet(row.priceSetId)
}).then(() => {
proxy.$modal.msgSuccess('已停用')
refresh()
}).catch(() => {})
}
function handleCopy(row) {
copyPriceSet(row.priceSetId).then(res => {
proxy.$modal.msgSuccess('已复制为草稿')
proxy.$router.push({ path: '/customer/setCreate', query: { priceSetId: res.data } })
})
}
</script>
<style scoped>
.hint-card {
margin-top: 16px;
}
.hint-body {
font-size: 13px;
color: #595959;
line-height: 1.7;
padding: 8px 12px;
background: #f6ffed;
border: 1px solid #b7eb8f;
border-radius: 6px;
}
.hint-body b {
color: #ff4d4f;
}
</style>
+1 -1
View File
@@ -120,7 +120,7 @@
</div> </div>
</template> </template>
<script setup name="Data"> <script setup name="DictData">
import useDictStore from '@/store/modules/dict' import useDictStore from '@/store/modules/dict'
import { getType } from "@/api/system/dict/type" import { getType } from "@/api/system/dict/type"
import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data" import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data"