1.1版本
增加分销商
This commit is contained in:
parent
0163f85aa1
commit
db219ebbaa
@ -0,0 +1,114 @@
|
|||||||
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
|
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.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.domain.BsSettlement;
|
||||||
|
import com.ruoyi.system.service.IBsSettlementService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算记录Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-11-20
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/settlement")
|
||||||
|
public class BsSettlementController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IBsSettlementService bsSettlementService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询结算记录列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:settlement:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(BsSettlement bsSettlement)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<BsSettlement> list = bsSettlementService.selectBsSettlementList(bsSettlement);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出结算记录列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:settlement:export')")
|
||||||
|
@Log(title = "结算记录", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, BsSettlement bsSettlement)
|
||||||
|
{
|
||||||
|
List<BsSettlement> list = bsSettlementService.selectBsSettlementList(bsSettlement);
|
||||||
|
ExcelUtil<BsSettlement> util = new ExcelUtil<BsSettlement>(BsSettlement.class);
|
||||||
|
util.exportExcel(response, list, "结算记录数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取结算记录详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:settlement:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||||
|
{
|
||||||
|
return success(bsSettlementService.selectBsSettlementById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增结算记录
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:settlement:add')")
|
||||||
|
@Log(title = "结算记录", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody BsSettlement bsSettlement)
|
||||||
|
{
|
||||||
|
return toAjax(bsSettlementService.insertBsSettlement(bsSettlement));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改结算记录
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:settlement:edit')")
|
||||||
|
@Log(title = "结算记录", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody BsSettlement bsSettlement)
|
||||||
|
{
|
||||||
|
return toAjax(bsSettlementService.updateBsSettlement(bsSettlement));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除结算记录
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:settlement:remove')")
|
||||||
|
@Log(title = "结算记录", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable String[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(bsSettlementService.deleteBsSettlementByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据结算id查询订单id并且查询出订单信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/getOrderForIds/{id}")
|
||||||
|
public AjaxResult getOrderForIds(@PathVariable String id) {
|
||||||
|
String ids = bsSettlementService.selectSettlementByNo(id);
|
||||||
|
String[] idStrings = ids.split(",");
|
||||||
|
Long[] orderIds = new Long[idStrings.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < idStrings.length; i++) {
|
||||||
|
orderIds[i] = Long.parseLong(idStrings[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return success(bsSettlementService.getOrderForIds(orderIds));
|
||||||
|
}
|
||||||
|
}
|
@ -97,6 +97,18 @@ public class BsOrder extends BaseEntity {
|
|||||||
@Excel(name = "分销商id")
|
@Excel(name = "分销商id")
|
||||||
private int distributor;
|
private int distributor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算状态
|
||||||
|
*/
|
||||||
|
@Excel(name = "结算状态")
|
||||||
|
private int settlementStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算单号
|
||||||
|
*/
|
||||||
|
@Excel(name = "结算单号")
|
||||||
|
private String settlementNo;
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
@ -203,6 +215,22 @@ public class BsOrder extends BaseEntity {
|
|||||||
this.distributor = distributor;
|
this.distributor = distributor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSettlementStatus() {
|
||||||
|
return settlementStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSettlementStatus(int settlementStatus) {
|
||||||
|
this.settlementStatus = settlementStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSettlementNo() {
|
||||||
|
return settlementNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSettlementNo(String settlementNo) {
|
||||||
|
this.settlementNo = settlementNo;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
@ -219,6 +247,8 @@ public class BsOrder extends BaseEntity {
|
|||||||
.append("openid", getOpenid())
|
.append("openid", getOpenid())
|
||||||
.append("transactionId", getTransactionId())
|
.append("transactionId", getTransactionId())
|
||||||
.append("distributor", getDistributor())
|
.append("distributor", getDistributor())
|
||||||
|
.append("distributor", getSettlementStatus())
|
||||||
|
.append("distributor", getSettlementNo())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,99 @@
|
|||||||
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算记录对象 bs_settlement
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-11-20
|
||||||
|
*/
|
||||||
|
public class BsSettlement extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键(结算单号) */
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/** 凭证 */
|
||||||
|
@Excel(name = "凭证")
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
/** 结算金额 */
|
||||||
|
@Excel(name = "结算金额")
|
||||||
|
private BigDecimal sum;
|
||||||
|
|
||||||
|
/** 订单id */
|
||||||
|
@Excel(name = "订单id")
|
||||||
|
private String orderIds;
|
||||||
|
|
||||||
|
/** 结算时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@Excel(name = "结算时间", width = 50, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date time;
|
||||||
|
|
||||||
|
public void setId(String id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setImage(String image)
|
||||||
|
{
|
||||||
|
this.image = image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImage()
|
||||||
|
{
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
public void setSum(BigDecimal sum)
|
||||||
|
{
|
||||||
|
this.sum = sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getSum()
|
||||||
|
{
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime(Date time) {
|
||||||
|
this.time = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderIds(String orderIds)
|
||||||
|
{
|
||||||
|
this.orderIds = orderIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrderIds()
|
||||||
|
{
|
||||||
|
return orderIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("remark", getRemark())
|
||||||
|
.append("image", getImage())
|
||||||
|
.append("sum", getSum())
|
||||||
|
.append("time", getTime())
|
||||||
|
.append("orderIds", getOrderIds())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -24,4 +24,14 @@ public class BsOrderDTO extends BsOrder {
|
|||||||
* 分销商distributionId
|
* 分销商distributionId
|
||||||
*/
|
*/
|
||||||
private Long distributionId;
|
private Long distributionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分销商提成
|
||||||
|
*/
|
||||||
|
private int distributionCommission;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分销商来源
|
||||||
|
*/
|
||||||
|
private String distributionSource;
|
||||||
}
|
}
|
||||||
|
@ -24,4 +24,14 @@ public class BsOrdersVO extends BsOrder {
|
|||||||
* 分销商distributionId
|
* 分销商distributionId
|
||||||
*/
|
*/
|
||||||
private Long distributionId;
|
private Long distributionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分销商提成
|
||||||
|
*/
|
||||||
|
private int distributionCommission;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分销商来源
|
||||||
|
*/
|
||||||
|
private String distributionSource;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
import com.ruoyi.system.domain.BsOrder;
|
import com.ruoyi.system.domain.BsOrder;
|
||||||
import com.ruoyi.system.domain.dto.BsOrderDTO;
|
import com.ruoyi.system.domain.dto.BsOrderDTO;
|
||||||
import com.ruoyi.system.domain.vo.BsOrdersVO;
|
import com.ruoyi.system.domain.vo.BsOrdersVO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单Mapper接口
|
* 订单Mapper接口
|
||||||
@ -94,4 +95,14 @@ public interface BsOrderMapper
|
|||||||
* 分销商查询订单
|
* 分销商查询订单
|
||||||
*/
|
*/
|
||||||
public List<BsOrdersVO> distributionGetOrder(int distributorId);
|
public List<BsOrdersVO> distributionGetOrder(int distributorId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改订单信息
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int upOrderSettlementStatus(@Param("array") Long[] ids, @Param("settlementNo") String settlementNo);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,74 @@
|
|||||||
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.system.domain.BsSettlement;
|
||||||
|
import com.ruoyi.system.domain.vo.BsOrdersVO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-11-20
|
||||||
|
*/
|
||||||
|
public interface BsSettlementMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询结算记录
|
||||||
|
*
|
||||||
|
* @param id 结算记录主键
|
||||||
|
* @return 结算记录
|
||||||
|
*/
|
||||||
|
public BsSettlement selectBsSettlementById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询结算记录列表
|
||||||
|
*
|
||||||
|
* @param bsSettlement 结算记录
|
||||||
|
* @return 结算记录集合
|
||||||
|
*/
|
||||||
|
public List<BsSettlement> selectBsSettlementList(BsSettlement bsSettlement);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增结算记录
|
||||||
|
*
|
||||||
|
* @param bsSettlement 结算记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertBsSettlement(BsSettlement bsSettlement);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改结算记录
|
||||||
|
*
|
||||||
|
* @param bsSettlement 结算记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateBsSettlement(BsSettlement bsSettlement);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除结算记录
|
||||||
|
*
|
||||||
|
* @param id 结算记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBsSettlementById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除结算记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBsSettlementByIds(String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据结算id查询订单id
|
||||||
|
*/
|
||||||
|
public String selectSettlementByNo(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据订单id查询订单信息
|
||||||
|
*/
|
||||||
|
public List<BsOrdersVO> getOrderForIds(@Param("ids") Long[] ids);
|
||||||
|
}
|
@ -94,4 +94,12 @@ public interface IBsOrderService
|
|||||||
* 分销商查询订单
|
* 分销商查询订单
|
||||||
*/
|
*/
|
||||||
public List<BsOrdersVO> distributionGetOrder(int distributorId);
|
public List<BsOrdersVO> distributionGetOrder(int distributorId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改订单信息
|
||||||
|
*
|
||||||
|
* @param ids 需要修改的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int upOrderSettlementStatus(Long[] ids,String settlementNo);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,74 @@
|
|||||||
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import com.ruoyi.system.domain.BsSettlement;
|
||||||
|
import com.ruoyi.system.domain.vo.BsOrdersVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算记录Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-11-20
|
||||||
|
*/
|
||||||
|
public interface IBsSettlementService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询结算记录
|
||||||
|
*
|
||||||
|
* @param id 结算记录主键
|
||||||
|
* @return 结算记录
|
||||||
|
*/
|
||||||
|
public BsSettlement selectBsSettlementById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询结算记录列表
|
||||||
|
*
|
||||||
|
* @param bsSettlement 结算记录
|
||||||
|
* @return 结算记录集合
|
||||||
|
*/
|
||||||
|
public List<BsSettlement> selectBsSettlementList(BsSettlement bsSettlement);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增结算记录
|
||||||
|
*
|
||||||
|
* @param bsSettlement 结算记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertBsSettlement(BsSettlement bsSettlement);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改结算记录
|
||||||
|
*
|
||||||
|
* @param bsSettlement 结算记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateBsSettlement(BsSettlement bsSettlement);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除结算记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的结算记录主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBsSettlementByIds(String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除结算记录信息
|
||||||
|
*
|
||||||
|
* @param id 结算记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBsSettlementById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据结算id查询订单id
|
||||||
|
*/
|
||||||
|
public String selectSettlementByNo(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据订单id查询订单信息
|
||||||
|
*/
|
||||||
|
public List<BsOrdersVO> getOrderForIds(Long[] ids);
|
||||||
|
|
||||||
|
}
|
@ -146,4 +146,12 @@ public class BsOrderServiceImpl implements IBsOrderService
|
|||||||
public List<BsOrdersVO> distributionGetOrder(int distributorId) {
|
public List<BsOrdersVO> distributionGetOrder(int distributorId) {
|
||||||
return bsOrderMapper.distributionGetOrder(distributorId);
|
return bsOrderMapper.distributionGetOrder(distributorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改订单结算状态
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int upOrderSettlementStatus(Long[] ids, String settlementNo) {
|
||||||
|
return bsOrderMapper.upOrderSettlementStatus(ids, settlementNo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,131 @@
|
|||||||
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.uuid.IdUtils;
|
||||||
|
import com.ruoyi.system.domain.BsSettlement;
|
||||||
|
import com.ruoyi.system.domain.vo.BsOrdersVO;
|
||||||
|
import com.ruoyi.system.mapper.BsOrderMapper;
|
||||||
|
import com.ruoyi.system.mapper.BsSettlementMapper;
|
||||||
|
import com.ruoyi.system.service.IBsSettlementService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算记录Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-11-20
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BsSettlementServiceImpl implements IBsSettlementService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private BsSettlementMapper bsSettlementMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BsOrderMapper bsOrderMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询结算记录
|
||||||
|
*
|
||||||
|
* @param id 结算记录主键
|
||||||
|
* @return 结算记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BsSettlement selectBsSettlementById(String id)
|
||||||
|
{
|
||||||
|
return bsSettlementMapper.selectBsSettlementById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询结算记录列表
|
||||||
|
*
|
||||||
|
* @param bsSettlement 结算记录
|
||||||
|
* @return 结算记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<BsSettlement> selectBsSettlementList(BsSettlement bsSettlement)
|
||||||
|
{
|
||||||
|
return bsSettlementMapper.selectBsSettlementList(bsSettlement);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增结算记录
|
||||||
|
*
|
||||||
|
* @param bsSettlement 结算记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertBsSettlement(BsSettlement bsSettlement)
|
||||||
|
{
|
||||||
|
String no = IdUtils.fastSimpleUUID();
|
||||||
|
bsSettlement.setId(no);
|
||||||
|
int num = bsSettlementMapper.insertBsSettlement(bsSettlement);
|
||||||
|
if(num != 0){
|
||||||
|
String orderId = bsSettlement.getOrderIds();
|
||||||
|
String[] idStrings = orderId.split(",");
|
||||||
|
Long[] ids = new Long[idStrings.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < idStrings.length; i++) {
|
||||||
|
ids[i] = Long.parseLong(idStrings[i]);
|
||||||
|
}
|
||||||
|
bsOrderMapper.upOrderSettlementStatus(ids,no);
|
||||||
|
}
|
||||||
|
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改结算记录
|
||||||
|
*
|
||||||
|
* @param bsSettlement 结算记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateBsSettlement(BsSettlement bsSettlement)
|
||||||
|
{
|
||||||
|
return bsSettlementMapper.updateBsSettlement(bsSettlement);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除结算记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的结算记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteBsSettlementByIds(String[] ids)
|
||||||
|
{
|
||||||
|
return bsSettlementMapper.deleteBsSettlementByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除结算记录信息
|
||||||
|
*
|
||||||
|
* @param id 结算记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteBsSettlementById(String id)
|
||||||
|
{
|
||||||
|
return bsSettlementMapper.deleteBsSettlementById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据结算id查询订单id
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String selectSettlementByNo(String id) {
|
||||||
|
|
||||||
|
return bsSettlementMapper.selectSettlementByNo(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据订单id查询订单信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<BsOrdersVO> getOrderForIds(Long[] ids) {
|
||||||
|
return bsSettlementMapper.getOrderForIds(ids);
|
||||||
|
}
|
||||||
|
}
|
@ -18,6 +18,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="payStatus" column="payStatus"/>
|
<result property="payStatus" column="payStatus"/>
|
||||||
<result property="openid" column="openid"/>
|
<result property="openid" column="openid"/>
|
||||||
<result property="distributor" column="distributor"/>
|
<result property="distributor" column="distributor"/>
|
||||||
|
<result property="settlementStatus" column="settlement_status"/>
|
||||||
|
<result property="settlementNo" column="settlement_no"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap type="BsOrdersVO" id="BsOrdersVOResult">
|
<resultMap type="BsOrdersVO" id="BsOrdersVOResult">
|
||||||
@ -37,6 +39,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="distributionName" column="distributionName"/>
|
<result property="distributionName" column="distributionName"/>
|
||||||
<result property="distributionPhone" column="distributionPhone"/>
|
<result property="distributionPhone" column="distributionPhone"/>
|
||||||
<result property="distributionId" column="distributionId"/>
|
<result property="distributionId" column="distributionId"/>
|
||||||
|
<result property="settlementStatus" column="settlement_status"/>
|
||||||
|
<result property="settlementNo" column="settlement_no"/>
|
||||||
|
<result property="distributionSource" column="distributionSource"/>
|
||||||
|
<result property="distributionCommission" column="distributionCommission"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectBsOrderVo">
|
<sql id="selectBsOrderVo">
|
||||||
@ -53,7 +59,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
create_time,
|
create_time,
|
||||||
payStatus,
|
payStatus,
|
||||||
openid,
|
openid,
|
||||||
distributor
|
distributor,
|
||||||
|
settlement_status,
|
||||||
|
settlement_no
|
||||||
from bs_order </sql>
|
from bs_order </sql>
|
||||||
|
|
||||||
<select id="selectBsOrderList" parameterType="BsOrder" resultMap="BsOrderResult">
|
<select id="selectBsOrderList" parameterType="BsOrder" resultMap="BsOrderResult">
|
||||||
@ -69,6 +77,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="createId != null and createId != ''"> and create_id = #{createId}</if>
|
<if test="createId != null and createId != ''"> and create_id = #{createId}</if>
|
||||||
<if test="createTime != null "> and create_time = #{createTime}</if>
|
<if test="createTime != null "> and create_time = #{createTime}</if>
|
||||||
<if test="openid != null and openid != ''"> and openid = #{openid}</if>
|
<if test="openid != null and openid != ''"> and openid = #{openid}</if>
|
||||||
|
<if test="settlementStatus != null "> and settlement_status = #{settlementStatus}</if>
|
||||||
|
<if test="settlementNo != null and settlementNo != ''"> and settlement_no = #{settlementNo}</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY pay_time DESC
|
ORDER BY pay_time DESC
|
||||||
</select>
|
</select>
|
||||||
@ -98,6 +108,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="payStatus != null">payStatus,</if>
|
<if test="payStatus != null">payStatus,</if>
|
||||||
<if test="openid != null">openid,</if>
|
<if test="openid != null">openid,</if>
|
||||||
<if test="distributor != null">distributor,</if>
|
<if test="distributor != null">distributor,</if>
|
||||||
|
<if test="settlementStatus != null">settlement_status,</if>
|
||||||
|
<if test="settlementNo != null">settlement_no,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="orderNo != null">#{orderNo},</if>
|
<if test="orderNo != null">#{orderNo},</if>
|
||||||
@ -112,6 +124,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="payStatus != null">#{payStatus},</if>
|
<if test="payStatus != null">#{payStatus},</if>
|
||||||
<if test="openid != null">#{openid},</if>
|
<if test="openid != null">#{openid},</if>
|
||||||
<if test="distributor != null">#{distributor},</if>
|
<if test="distributor != null">#{distributor},</if>
|
||||||
|
<if test="settlementStatus != null">#{settlementStatus},</if>
|
||||||
|
<if test="settlementNo != null">#{settlementNo},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@ -159,43 +173,58 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<select id="getAllOrder" parameterType="com.ruoyi.system.domain.dto.BsOrderDTO" resultMap="BsOrdersVOResult">
|
<select id="getAllOrder" parameterType="com.ruoyi.system.domain.dto.BsOrderDTO" resultMap="BsOrdersVOResult">
|
||||||
select
|
select
|
||||||
bo.id,
|
bo.id,
|
||||||
bo.order_no,
|
bo.order_no,
|
||||||
bo.channel,
|
bo.channel,
|
||||||
bo.transaction_id,
|
bo.transaction_id,
|
||||||
bo.pay_time,
|
bo.pay_time,
|
||||||
bo.goods_name,
|
bo.goods_name,
|
||||||
bo.goodsmin,
|
bo.goodsmin,
|
||||||
bo.price,
|
bo.price,
|
||||||
bo.create_time,
|
bo.create_time,
|
||||||
bo.openid,
|
bo.openid,
|
||||||
bo.payStatus,
|
bo.payStatus,
|
||||||
bo.distributor,
|
bo.distributor,
|
||||||
bd.name as distributionName,
|
bo.settlement_status,
|
||||||
bd.phone as distributionPhone,
|
bo.settlement_no,
|
||||||
bd.id as distributionId
|
bd.name as distributionName,
|
||||||
|
bd.phone as distributionPhone,
|
||||||
|
bd.id as distributionId,
|
||||||
|
bd.source as distributionSource,
|
||||||
|
bd.commission as distributionCommission
|
||||||
from bs_order as bo
|
from bs_order as bo
|
||||||
left join bs_distribution as bd on bd.id = bo.distributor
|
left join bs_distribution as bd on bd.id = bo.distributor
|
||||||
<where>
|
<where>
|
||||||
<if test="orderNo != null and orderNo != ''"> AND bo.order_no = #{orderNo} </if>
|
<if test="id != null">AND bo.id = #{id}</if>
|
||||||
<if test="channel != null"> AND bo.channel = #{channel} </if>
|
<if test="orderNo != null and orderNo != ''">AND bo.order_no = #{orderNo}</if>
|
||||||
<if test="transactionId != null"> AND bo.transaction_id LIKE CONCAT('%', #{transactionId}, '%') </if>
|
<if test="channel != null">AND bo.channel = #{channel}</if>
|
||||||
<if test="payTime != null"> AND DATE(bo.pay_time) = #{payTime} </if>
|
<if test="transactionId != null">AND bo.transaction_id LIKE CONCAT('%', #{transactionId}, '%')</if>
|
||||||
<if test="goodsName != null and goodsName != ''"> AND bo.goods_name LIKE CONCAT('%', #{goodsName}, '%') </if>
|
<if test="payTime != null">AND DATE(bo.pay_time) = #{payTime}</if>
|
||||||
<if test="goodsmin != null"> AND bo.goodsmin = #{goodsmin} </if>
|
<if test="goodsName != null and goodsName != ''">AND bo.goods_name LIKE CONCAT('%', #{goodsName}, '%')</if>
|
||||||
<if test="price != null and price != ''"> AND bo.price = #{price} </if>
|
<if test="goodsmin != null">AND bo.goodsmin = #{goodsmin}</if>
|
||||||
<if test="createId != null and createId != ''"> AND bo.create_id = #{createId} </if>
|
<if test="price != null and price != ''">AND bo.price = #{price}</if>
|
||||||
<if test="createTime != null"> AND bo.create_time = #{createTime} </if>
|
<if test="createId != null and createId != ''">AND bo.create_id = #{createId}</if>
|
||||||
<if test="openid != null and openid != ''"> AND bo.openid = #{openid} </if>
|
<if test="createTime != null">AND bo.create_time = #{createTime}</if>
|
||||||
<if test="distributionName != null and distributionName != ''"> AND bd.name = #{distributionName} </if>
|
<if test="openid != null and openid != ''">AND bo.openid = #{openid}</if>
|
||||||
<if test="distributionPhone != null and distributionPhone != ''"> AND bd.phone = #{distributionPhone} </if>
|
<if test="distributionName != null and distributionName != ''">AND bd.name = #{distributionName}</if>
|
||||||
<if test="distributionId != null"> AND bd.id = #{distributionId} </if>
|
<if test="distributionPhone != null and distributionPhone != ''">AND bd.phone = #{distributionPhone}</if>
|
||||||
|
<if test="distributionId != null">AND bd.id = #{distributionId}</if>
|
||||||
|
<if test="settlementStatus != null and settlementStatus != ''"> AND bo.settlement_status = #{settlementStatus} </if>
|
||||||
|
<if test="settlementNo != null and settlementNo != ''"> AND bo.settlement_no = #{settlementNo} </if>
|
||||||
|
<if test="distributionSource != null and distributionSource != '' "> AND bd.source = #{distributionSource} </if>
|
||||||
AND bo.payStatus = 1
|
AND bo.payStatus = 1
|
||||||
</where>
|
</where>
|
||||||
ORDER BY bo.pay_time DESC
|
ORDER BY bo.pay_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="distributionGetOrder" parameterType="Integer" resultMap="BsOrdersVOResult">
|
<select id="distributionGetOrder" parameterType="Integer" resultMap="BsOrdersVOResult">
|
||||||
select order_no,channel,transaction_id,pay_time,goods_name,goodsmin,payStatus,price,create_time,openid from bs_order where distributor = #{distributor} and payStatus = 1
|
select order_no,channel,transaction_id,pay_time,goods_name,goodsmin,payStatus,price,create_time,openid from bs_order where distributor = #{distributor} and payStatus = 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<update id="upOrderSettlementStatus" parameterType="String">
|
||||||
|
update bs_order set settlement_status = 1,settlement_no = #{settlementNo} where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -0,0 +1,146 @@
|
|||||||
|
<?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.system.mapper.BsSettlementMapper">
|
||||||
|
|
||||||
|
<resultMap type="BsSettlement" id="BsSettlementResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="remark" column="remark"/>
|
||||||
|
<result property="image" column="image"/>
|
||||||
|
<result property="sum" column="sum"/>
|
||||||
|
<result property="time" column="time"/>
|
||||||
|
<result property="orderIds" column="order_ids"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectBsSettlementVo">
|
||||||
|
select id, remark, image, sum, time, order_ids
|
||||||
|
from bs_settlement
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectBsSettlementList" parameterType="BsSettlement" resultMap="BsSettlementResult">
|
||||||
|
<include refid="selectBsSettlementVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="image != null and image != ''">and image = #{image}</if>
|
||||||
|
<if test="sum != null ">and sum = #{sum}</if>
|
||||||
|
<if test="time != null and time != ''">and time = #{time}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectBsSettlementById" parameterType="String" resultMap="BsSettlementResult">
|
||||||
|
<include refid="selectBsSettlementVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertBsSettlement" parameterType="BsSettlement">
|
||||||
|
insert into bs_settlement
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">id,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="image != null">image,</if>
|
||||||
|
<if test="sum != null">sum,</if>
|
||||||
|
<if test="time != null">time,</if>
|
||||||
|
<if test="orderIds != null">order_ids,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">#{id},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="image != null">#{image},</if>
|
||||||
|
<if test="sum != null">#{sum},</if>
|
||||||
|
<if test="time != null">#{time},</if>
|
||||||
|
<if test="orderIds != null">#{orderIds},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateBsSettlement" parameterType="BsSettlement">
|
||||||
|
update bs_settlement
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="image != null">image = #{image},</if>
|
||||||
|
<if test="sum != null">sum = #{sum},</if>
|
||||||
|
<if test="time != null">sum = #{time},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteBsSettlementById" parameterType="String">
|
||||||
|
delete
|
||||||
|
from bs_settlement
|
||||||
|
where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteBsSettlementByIds" parameterType="String">
|
||||||
|
delete from bs_settlement where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="selectSettlementByNo" parameterType="String" resultType="String">
|
||||||
|
select order_ids from bs_settlement where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<resultMap type="BsOrdersVO" id="BsOrdersVOResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="orderNo" column="order_no"/>
|
||||||
|
<result property="channel" column="channel"/>
|
||||||
|
<result property="transactionId" column="transaction_id"/>
|
||||||
|
<result property="payTime" column="pay_time"/>
|
||||||
|
<result property="goodsName" column="goods_name"/>
|
||||||
|
<result property="goodsmin" column="goodsmin"/>
|
||||||
|
<result property="price" column="price"/>
|
||||||
|
<result property="createId" column="create_id"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="payStatus" column="payStatus"/>
|
||||||
|
<result property="openid" column="openid"/>
|
||||||
|
<result property="distributor" column="distributor"/>
|
||||||
|
<result property="distributionName" column="distributionName"/>
|
||||||
|
<result property="distributionPhone" column="distributionPhone"/>
|
||||||
|
<result property="distributionId" column="distributionId"/>
|
||||||
|
<result property="settlementStatus" column="settlement_status"/>
|
||||||
|
<result property="settlementNo" column="settlement_no"/>
|
||||||
|
<result property="distributionSource" column="distributionSource"/>
|
||||||
|
<result property="distributionCommission" column="distributionCommission"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="getOrderForIds" parameterType="Long" resultMap="BsOrdersVOResult">
|
||||||
|
select
|
||||||
|
bo.id,
|
||||||
|
bo.order_no,
|
||||||
|
bo.channel,
|
||||||
|
bo.transaction_id,
|
||||||
|
bo.pay_time,
|
||||||
|
bo.goods_name,
|
||||||
|
bo.goodsmin,
|
||||||
|
bo.price,
|
||||||
|
bo.create_time,
|
||||||
|
bo.openid,
|
||||||
|
bo.payStatus,
|
||||||
|
bo.settlement_status,
|
||||||
|
bo.settlement_no,
|
||||||
|
bd.name as distributionName,
|
||||||
|
bd.phone as distributionPhone,
|
||||||
|
bd.id as distributionId,
|
||||||
|
bd.source as distributionSource,
|
||||||
|
bd.commission as distributionCommission
|
||||||
|
from bs_order as bo
|
||||||
|
|
||||||
|
left join bs_distribution as bd on bd.id = bo.distributor
|
||||||
|
|
||||||
|
<where>
|
||||||
|
<if test="ids != null and ids.length > 0">
|
||||||
|
AND bo.id IN
|
||||||
|
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
AND bo.payStatus = 1
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
52
ruoyi-ui/src/api/system/settlement.js
Normal file
52
ruoyi-ui/src/api/system/settlement.js
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询结算记录列表
|
||||||
|
export function listSettlement(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/settlement/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询结算记录详细
|
||||||
|
export function getSettlement(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/settlement/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询结算记录详细2
|
||||||
|
export function getOrderForIds(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/settlement/getOrderForIds/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增结算记录
|
||||||
|
export function addSettlement(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/settlement',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改结算记录
|
||||||
|
export function updateSettlement(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/settlement',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除结算记录
|
||||||
|
export function delSettlement(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/settlement/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
||||||
<el-form-item label="订单号" prop="orderNo">
|
<el-form-item label="订单号" prop="orderNo">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.orderNo"
|
v-model="queryParams.orderNo"
|
||||||
@ -19,12 +19,42 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="分销商来源" prop="distributionSource">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.distributionSource"
|
||||||
|
placeholder="请输入分销商来源"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="结算单号" prop="settlementNo">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.settlementNo"
|
||||||
|
placeholder="请输入结算单号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="结算状态" prop="settlementStatus">
|
||||||
|
<el-select v-model="queryParams.settlementStatus" placeholder="请选择结算状态" clearable
|
||||||
|
@keyup.enter.native="handleQuery">
|
||||||
|
<el-option
|
||||||
|
v-for="status in settlementStatusOptions"
|
||||||
|
:key="status.value"
|
||||||
|
:label="status.label"
|
||||||
|
:value="status.value">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="支付时间" prop="payTime">
|
<el-form-item label="支付时间" prop="payTime">
|
||||||
<el-date-picker clearable
|
<el-date-picker clearable
|
||||||
v-model="queryParams.payTime"
|
v-model="queryParams.payTime"
|
||||||
type="date"
|
type="date"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
placeholder="请选择支付时间">
|
placeholder="请选择支付时间">
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="商品名称" prop="goodsName">
|
<el-form-item label="商品名称" prop="goodsName">
|
||||||
@ -51,93 +81,71 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<!-- <el-row :gutter="10" class="mb8">-->
|
<el-row :gutter="10" class="mb8">
|
||||||
<!-- <el-col :span="1.5">-->
|
<el-col :span="1.5">
|
||||||
<!-- <el-button-->
|
<el-button
|
||||||
<!-- type="primary"-->
|
type="danger"
|
||||||
<!-- plain-->
|
plain
|
||||||
<!-- icon="el-icon-plus"-->
|
icon="el-icon-coin"
|
||||||
<!-- size="mini"-->
|
size="mini"
|
||||||
<!-- @click="handleAdd"-->
|
:disabled="multiple"
|
||||||
<!-- v-hasPermi="['system:order:add']"-->
|
@click="handleUpdate"
|
||||||
<!-- >新增</el-button>-->
|
>结算
|
||||||
<!-- </el-col>-->
|
</el-button>
|
||||||
<!-- <el-col :span="1.5">-->
|
</el-col>
|
||||||
<!-- <el-button-->
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
<!-- type="success"-->
|
</el-row>
|
||||||
<!-- plain-->
|
|
||||||
<!-- icon="el-icon-edit"-->
|
|
||||||
<!-- size="mini"-->
|
|
||||||
<!-- :disabled="single"-->
|
|
||||||
<!-- @click="handleUpdate"-->
|
|
||||||
<!-- v-hasPermi="['system:order:edit']"-->
|
|
||||||
<!-- >修改</el-button>-->
|
|
||||||
<!-- </el-col>-->
|
|
||||||
<!-- <el-col :span="1.5">-->
|
|
||||||
<!-- <el-button-->
|
|
||||||
<!-- type="danger"-->
|
|
||||||
<!-- plain-->
|
|
||||||
<!-- icon="el-icon-delete"-->
|
|
||||||
<!-- size="mini"-->
|
|
||||||
<!-- :disabled="multiple"-->
|
|
||||||
<!-- @click="handleDelete"-->
|
|
||||||
<!-- v-hasPermi="['system:order:remove']"-->
|
|
||||||
<!-- >删除</el-button>-->
|
|
||||||
<!-- </el-col>-->
|
|
||||||
<!-- <el-col :span="1.5">-->
|
|
||||||
<!-- <el-button-->
|
|
||||||
<!-- type="warning"-->
|
|
||||||
<!-- plain-->
|
|
||||||
<!-- icon="el-icon-download"-->
|
|
||||||
<!-- size="mini"-->
|
|
||||||
<!-- @click="handleExport"-->
|
|
||||||
<!-- v-hasPermi="['system:order:export']"-->
|
|
||||||
<!-- >导出</el-button>-->
|
|
||||||
<!-- </el-col>-->
|
|
||||||
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
|
|
||||||
<!-- </el-row>-->
|
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="orderList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="orderList" @selection-change="handleSelectionChange">
|
||||||
<!-- <el-table-column type="selection" width="55" align="center" />-->
|
<el-table-column type="selection" width="55" align="center" :selectable="isRowSelectable"/>
|
||||||
<el-table-column label="商户单号" align="center" prop="orderNo" />
|
<el-table-column label="商户单号" align="center" prop="orderNo"/>
|
||||||
<el-table-column label="交易流水号" align="center" prop="transactionId" />
|
<el-table-column label="交易流水号" align="center" prop="transactionId"/>
|
||||||
<el-table-column label="支付方式" align="center" prop="channel" >
|
<el-table-column label="支付方式" align="center" prop="channel">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ getPaymentMethod(scope.row.channel) }}
|
{{ getPaymentMethod(scope.row.channel) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="商品名称" align="center" prop="goodsName" />
|
<el-table-column label="商品名称" align="center" prop="goodsName"/>
|
||||||
<el-table-column label="商品id" align="center" prop="goodsmin" />
|
<el-table-column label="商品id" align="center" prop="goodsmin"/>
|
||||||
<el-table-column label="订单价格" align="center" prop="price" />
|
<el-table-column label="订单价格" align="center" prop="price"/>
|
||||||
<el-table-column label="订单状态" align="center" prop="payStatus">
|
<el-table-column label="订单状态" align="center" prop="payStatus">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ getPayStatus(scope.row.payStatus) }}
|
{{ getPayStatus(scope.row.payStatus) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="openid" align="center" prop="openid" />
|
<el-table-column label="openid" align="center" prop="openid"/>
|
||||||
<el-table-column label="支付时间" align="center" prop="payTime" width="180">
|
<el-table-column label="支付时间" align="center" prop="payTime" width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.payTime, '{y}-{m}-{d}:{h}:{m}:{s}') }}</span>
|
<span>{{ parseTime(scope.row.payTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}:{h}:{m}:{s}') }}</span>
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="分销商姓名" align="center" prop="distributionName" />
|
<el-table-column label="分销商姓名" align="center" prop="distributionName"/>
|
||||||
<el-table-column label="分销商联系方式" align="center" prop="distributionPhone" />
|
<el-table-column label="分销商联系方式" align="center" prop="distributionPhone"/>
|
||||||
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="分销商来源" align="center" prop="distributionSource"/>
|
||||||
|
<el-table-column label="提成" align="center" prop="distributionCommission"/>
|
||||||
|
<el-table-column label="是否结算" align="center" prop="settlementStatus">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ getSettlementStatus(scope.row.settlementStatus) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="结算单号" align="center" prop="settlementNo"/>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
|
v-if="scope.row.settlementStatus === 2"
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-coin"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['system:order:remove']"
|
>结算
|
||||||
>删除</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>-->
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination
|
||||||
@ -152,27 +160,27 @@
|
|||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="订单号" prop="orderNo">
|
<el-form-item label="订单号" prop="orderNo">
|
||||||
<el-input v-model="form.orderNo" placeholder="请输入订单号" />
|
<el-input v-model="form.orderNo" placeholder="请输入订单号"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="1:微信,2:支付宝" prop="channel">
|
<el-form-item label="1:微信,2:支付宝" prop="channel">
|
||||||
<el-input v-model="form.channel" placeholder="请输入1:微信,2:支付宝" />
|
<el-input v-model="form.channel" placeholder="请输入1:微信,2:支付宝"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="支付时间" prop="payTime">
|
<el-form-item label="支付时间" prop="payTime">
|
||||||
<el-date-picker clearable
|
<el-date-picker clearable
|
||||||
v-model="form.payTime"
|
v-model="form.payTime"
|
||||||
type="date"
|
type="date"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
placeholder="请选择支付时间">
|
placeholder="请选择支付时间">
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="商品名称" prop="goodsName">
|
<el-form-item label="商品名称" prop="goodsName">
|
||||||
<el-input v-model="form.goodsName" placeholder="请输入商品名称" />
|
<el-input v-model="form.goodsName" placeholder="请输入商品名称"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="订单价格" prop="price">
|
<el-form-item label="订单价格" prop="price">
|
||||||
<el-input v-model="form.price" placeholder="请输入订单价格" />
|
<el-input v-model="form.price" placeholder="请输入订单价格"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="购买人id" prop="createId">
|
<el-form-item label="购买人id" prop="createId">
|
||||||
<el-input v-model="form.createId" placeholder="请输入购买人id" />
|
<el-input v-model="form.createId" placeholder="请输入购买人id"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
@ -180,12 +188,35 @@
|
|||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 添加结算记录对话框 -->
|
||||||
|
<el-dialog :title="settlementTitle" :visible.sync="settlementOpen" width="500px" append-to-body>
|
||||||
|
<el-form ref="settlementForm" :model="settlementForm" :rules="settlementRules" label-width="100px">
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="settlementForm.remark" placeholder="请输入备注"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="凭证" prop="image">
|
||||||
|
<image-upload v-model="settlementForm.image"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="应结算金额" >
|
||||||
|
<span class="price">{{this.endPrice}}元</span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="结算金额" prop="sum">
|
||||||
|
<el-input v-model="settlementForm.sum" placeholder="请输入结算金额"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="settlementSubmitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {listOrder, getOrder, delOrder, addOrder, updateOrder, listAllOrder} from "@/api/system/order";
|
import {listOrder, getOrder, delOrder, addOrder, updateOrder, listAllOrder} from "@/api/system/order";
|
||||||
import {parseTime} from "../../../utils/ruoyi";
|
import {parseTime} from "../../../utils/ruoyi";
|
||||||
|
import {addSettlement, updateSettlement} from "@/api/system/settlement";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Order",
|
name: "Order",
|
||||||
@ -225,15 +256,33 @@ export default {
|
|||||||
createTime: null,
|
createTime: null,
|
||||||
payStatus: null,
|
payStatus: null,
|
||||||
openid: null,
|
openid: null,
|
||||||
distributionName:null,
|
distributionName: null,
|
||||||
distributionPhone:null,
|
distributionPhone: null,
|
||||||
distributionId:null
|
distributionId: null,
|
||||||
|
settlementNo: null,
|
||||||
|
settlementStatus:null,
|
||||||
|
distributionSource:null,
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {},
|
||||||
}
|
//结算相关
|
||||||
|
// 弹出层标题
|
||||||
|
settlementTitle: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
settlementOpen: false,
|
||||||
|
// 表单参数
|
||||||
|
settlementForm: {},
|
||||||
|
// 表单校验
|
||||||
|
settlementRules: {},
|
||||||
|
|
||||||
|
settlementStatusOptions: [
|
||||||
|
{value: 1, label: '已结算'},
|
||||||
|
{value: 2, label: '未结算'}
|
||||||
|
],
|
||||||
|
selectedRows: [],
|
||||||
|
endPrice: 0,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -269,7 +318,9 @@ export default {
|
|||||||
createId: null,
|
createId: null,
|
||||||
createTime: null,
|
createTime: null,
|
||||||
payStatus: null,
|
payStatus: null,
|
||||||
openid: null
|
openid: null,
|
||||||
|
settlementNo: null,
|
||||||
|
settlementStatus: null,
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
@ -286,8 +337,10 @@ export default {
|
|||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.id)
|
this.ids = selection.map(item => item.id)
|
||||||
this.single = selection.length!==1
|
this.single = selection.length !== 1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
|
this.selectedRows = selection;
|
||||||
|
this.calculateTotalPrice();
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
@ -295,16 +348,6 @@ export default {
|
|||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "添加订单";
|
this.title = "添加订单";
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
|
||||||
handleUpdate(row) {
|
|
||||||
this.reset();
|
|
||||||
const id = row.id || this.ids
|
|
||||||
getOrder(id).then(response => {
|
|
||||||
this.form = response.data;
|
|
||||||
this.open = true;
|
|
||||||
this.title = "修改订单";
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
@ -328,12 +371,13 @@ export default {
|
|||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const ids = row.id || this.ids;
|
const ids = row.id || this.ids;
|
||||||
this.$modal.confirm('是否确认删除订单编号为"' + ids + '"的数据项?').then(function() {
|
this.$modal.confirm('是否确认删除订单编号为"' + ids + '"的数据项?').then(function () {
|
||||||
return delOrder(ids);
|
return delOrder(ids);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess("删除成功");
|
||||||
}).catch(() => {});
|
}).catch(() => {
|
||||||
|
});
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
@ -358,7 +402,78 @@ export default {
|
|||||||
case 2:
|
case 2:
|
||||||
return '未支付';
|
return '未支付';
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
settlementReset() {
|
||||||
|
this.settlementForm = {
|
||||||
|
image: null,
|
||||||
|
settlementNo: null,
|
||||||
|
settlementStatus: null,
|
||||||
|
};
|
||||||
|
this.resetForm("settlementForm");
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 计算选中行的总价格 */
|
||||||
|
calculateTotalPrice() {
|
||||||
|
this.endPrice = this.selectedRows.reduce((acc, row) => {
|
||||||
|
return acc + parseFloat(row.distributionCommission || 0);
|
||||||
|
}, 0);
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 结算按钮 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.settlementReset();
|
||||||
|
const id = row.id || this.ids.join(',');
|
||||||
|
if (row.id) {
|
||||||
|
this.endPrice = parseFloat(row.distributionCommission);
|
||||||
|
} else {
|
||||||
|
// 这里已经在handleSelectionChange中处理了多选的情况
|
||||||
|
}
|
||||||
|
this.settlementForm.orderIds = id;
|
||||||
|
this.settlementOpen = true;
|
||||||
|
this.settlementTitle = "结算";
|
||||||
|
},
|
||||||
|
/** 结算提交按钮 */
|
||||||
|
settlementSubmitForm() {
|
||||||
|
this.$refs["settlementForm"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.settlementForm.id != null) {
|
||||||
|
updateSettlement(this.settlementForm).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.settlementOpen = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addSettlement(this.settlementForm).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.settlementOpen = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
isRowSelectable(row) {
|
||||||
|
return row.settlementStatus !== 1;
|
||||||
|
},
|
||||||
|
getSettlementStatus(settlementStatus) {
|
||||||
|
switch (settlementStatus) {
|
||||||
|
case 1:
|
||||||
|
return '已结算';
|
||||||
|
case 2:
|
||||||
|
return '未结算';
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
.price {
|
||||||
|
font-size: 18px;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
363
ruoyi-ui/src/views/system/settlement/index.vue
Normal file
363
ruoyi-ui/src/views/system/settlement/index.vue
Normal file
@ -0,0 +1,363 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="结算金额" prop="sum">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.sum"
|
||||||
|
placeholder="请输入结算金额"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['system:settlement:add']"
|
||||||
|
>新增
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['system:settlement:edit']"
|
||||||
|
>修改
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['system:settlement:remove']"
|
||||||
|
>删除
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['system:settlement:export']"
|
||||||
|
>导出
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="settlementList" @expand-change="loadOrderList">
|
||||||
|
<el-table-column type="selection" width="55" align="center"/>
|
||||||
|
<el-table-column type="expand">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-table
|
||||||
|
:data="scope.row.orderList"
|
||||||
|
border
|
||||||
|
size="mini"
|
||||||
|
>
|
||||||
|
<el-table-column label="商户单号" align="center" prop="orderNo"/>
|
||||||
|
<el-table-column label="交易流水号" align="center" prop="transactionId"/>
|
||||||
|
<el-table-column label="支付方式" align="center" prop="channel">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ getPaymentMethod(scope.row.channel) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="商品名称" align="center" prop="goodsName"/>
|
||||||
|
<el-table-column label="订单价格" align="center" prop="price"/>
|
||||||
|
<el-table-column label="订单状态" align="center" prop="payStatus">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ getPayStatus(scope.row.payStatus) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="openid" align="center" prop="openid"/>
|
||||||
|
<el-table-column label="支付时间" align="center" prop="payTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.payTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="分销商姓名" align="center" prop="distributionName"/>
|
||||||
|
<el-table-column label="分销商联系方式" align="center" prop="distributionPhone"/>
|
||||||
|
<el-table-column label="提成" align="center" prop="distributionCommission"/>
|
||||||
|
</el-table>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="主键(结算单号)" align="center" prop="id"/>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark"/>
|
||||||
|
<el-table-column label="凭证" align="center" prop="image" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<image-preview :src="scope.row.image" :width="50" :height="50"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="结算金额" align="center" prop="sum"/>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:settlement:edit']"
|
||||||
|
>修改
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:settlement:remove']"
|
||||||
|
>删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改结算记录对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="凭证" prop="image">
|
||||||
|
<image-upload v-model="form.image"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="结算金额" prop="sum">
|
||||||
|
<el-input v-model="form.sum" placeholder="请输入结算金额"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
listSettlement,
|
||||||
|
getSettlement,
|
||||||
|
delSettlement,
|
||||||
|
addSettlement,
|
||||||
|
updateSettlement,
|
||||||
|
getOrderForIds
|
||||||
|
} from "@/api/system/settlement";
|
||||||
|
import {parseTime} from "../../../utils/ruoyi";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Settlement",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 结算记录表格数据
|
||||||
|
settlementList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
image: null,
|
||||||
|
sum: null
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {},
|
||||||
|
orderForIdsList: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
parseTime,
|
||||||
|
/** 查询结算记录列表 */
|
||||||
|
/*getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listSettlement(this.queryParams).then(response => {
|
||||||
|
this.settlementList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},*/
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listSettlement(this.queryParams).then(response => {
|
||||||
|
this.settlementList = response.rows.map(item => ({
|
||||||
|
...item,
|
||||||
|
// 保存子表数据
|
||||||
|
orderList: []
|
||||||
|
}));
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
loadOrderList(row) {
|
||||||
|
this.loading = true;
|
||||||
|
getOrderForIds(row.id).then(response => {
|
||||||
|
// 填充子表格数据
|
||||||
|
// row.orderList = response.data;
|
||||||
|
const filteredOrders = response.data.filter(order => order.settlementNo === row.id);
|
||||||
|
row.orderList = filteredOrders; // 填充符合条件的子表格数据
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
remark: null,
|
||||||
|
image: null,
|
||||||
|
sum: null
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id)
|
||||||
|
this.single = selection.length !== 1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加结算记录";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getSettlement(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改结算记录";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateSettlement(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addSettlement(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除结算记录编号为"' + ids + '"的数据项?').then(function () {
|
||||||
|
return delSettlement(ids);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('system/settlement/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `settlement_${new Date().getTime()}.xlsx`)
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/** */
|
||||||
|
getOrderForIdsList(row) {
|
||||||
|
getOrderForIds(row.id).then(response => {
|
||||||
|
this.orderForIdsList = response.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getPaymentMethod(channel) {
|
||||||
|
switch (channel) {
|
||||||
|
case 1:
|
||||||
|
return '微信支付';
|
||||||
|
case 2:
|
||||||
|
return '支付宝支付';
|
||||||
|
default:
|
||||||
|
return '未知支付方式';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getPayStatus(payStatus) {
|
||||||
|
switch (payStatus) {
|
||||||
|
case 1:
|
||||||
|
return '已支付';
|
||||||
|
case 2:
|
||||||
|
return '未支付';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -95,6 +95,7 @@ export default {
|
|||||||
},
|
},
|
||||||
getOrderNo(){
|
getOrderNo(){
|
||||||
this.form.payStatus = 2
|
this.form.payStatus = 2
|
||||||
|
this.form.settlementStatus = 2
|
||||||
this.form.price = this.goods.price
|
this.form.price = this.goods.price
|
||||||
this.form.goodsName = this.goods.name
|
this.form.goodsName = this.goods.name
|
||||||
this.form.goodsmin = this.goods.id
|
this.form.goodsmin = this.goods.id
|
||||||
|
Loading…
Reference in New Issue
Block a user