package com.fjhx.sale.controller.after;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.sale.entity.after.dto.AfterSalesDetailDto;
import com.fjhx.sale.entity.after.dto.AfterSalesDetailSelectDto;
import com.fjhx.sale.entity.after.vo.AfterSalesDetailVo;
import com.fjhx.sale.service.after.AfterSalesDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * <p>
 * 售后明细 前端控制器
 * </p>
 *
 * @author
 * @since 2023-07-20
 */
@RestController
@RequestMapping("/afterSalesDetail")
public class AfterSalesDetailController {

    @Autowired
    private AfterSalesDetailService afterSalesDetailService;

    /**
     * 售后明细分页
     */
    @PostMapping("/page")
    public Page<AfterSalesDetailVo> page(@RequestBody AfterSalesDetailSelectDto dto) {
        return afterSalesDetailService.getPage(dto);
    }

    /**
     * 售后管理编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody AfterSalesDetailDto afterSalesDetailDto) {
        afterSalesDetailService.edit(afterSalesDetailDto);
    }

    /**
     * 售后退货
     */
    @PostMapping("/salesReturn")
    public void salesReturn(@RequestBody AfterSalesDetailDto afterSalesDetailDto) {
        afterSalesDetailService.salesReturn(afterSalesDetailDto);
    }

    /**
     * 售后换货
     */
    @PostMapping("/salesReplace")
    public void salesReplace(@RequestBody AfterSalesDetailDto afterSalesDetailDto) {
        afterSalesDetailService.salesReplace(afterSalesDetailDto);
    }

    /**
     * 发起采购
     */
    @PostMapping("/initPurchase")
    public void initPurchase(@RequestBody AfterSalesDetailDto afterSalesDetailDto) {
        afterSalesDetailService.initPurchase(afterSalesDetailDto);
    }

}
