...
|
...
|
@@ -2,6 +2,8 @@ package controllers |
|
|
|
|
|
import (
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
"strconv"
|
|
|
|
|
|
"github.com/astaxie/beego/logs"
|
|
|
orderQuery "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/orderinfo/query"
|
...
|
...
|
@@ -83,3 +85,106 @@ func (c *OrderDividendController) PageListOrderDividend() { |
|
|
c.ResponsePageList(rsp, cnt, param.PageNumber)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
//OrderDividendDetail 订单的分红详情
|
|
|
func (c *OrderDividendController) OrderDividendDetail() {
|
|
|
type Parameter struct {
|
|
|
Id string `json:"id"`
|
|
|
}
|
|
|
var (
|
|
|
param Parameter
|
|
|
err error
|
|
|
)
|
|
|
if err = c.BindJsonData(¶m); err != nil {
|
|
|
logs.Error(err)
|
|
|
c.ResponseError(errors.New("json数据解析失败"))
|
|
|
return
|
|
|
}
|
|
|
orderid, _ := strconv.ParseInt(param.Id, 10, 64)
|
|
|
if orderid == 0 {
|
|
|
c.ResponseError(errors.New("参数错误"))
|
|
|
return
|
|
|
}
|
|
|
orderSrv := orderService.NewOrderInfoService(nil)
|
|
|
orderinfo, err := orderSrv.GetOrderDetail(orderQuery.GetOrderQuery{
|
|
|
OrderId: orderid,
|
|
|
})
|
|
|
if err != nil {
|
|
|
c.ResponseError(err)
|
|
|
return
|
|
|
}
|
|
|
if orderinfo.OrderType != domain.OrderReal {
|
|
|
c.ResponseError(errors.New("参数错误"))
|
|
|
return
|
|
|
}
|
|
|
allGoods := []map[string]interface{}{}
|
|
|
for _, v := range orderinfo.Goods {
|
|
|
detail := map[string]interface{}{
|
|
|
"productName": v.GoodName,
|
|
|
"orderNum": v.PlanGoodNumber,
|
|
|
"univalence": v.Price,
|
|
|
"partnerRatio": v.PartnerBonusPercent,
|
|
|
"orderPrice": v.GoodCompute.PlanAmount,
|
|
|
"partnerDividendsReceivable": v.GoodCompute.PlanPartnerBonus,
|
|
|
}
|
|
|
m := map[string]interface{}{
|
|
|
"detail": detail,
|
|
|
"quantityControl": "",
|
|
|
"id": v.Id,
|
|
|
"stateOfPayment": v.BonusStatus,
|
|
|
"remark": v.Remark,
|
|
|
"orderPriceControl": "",
|
|
|
}
|
|
|
if v.GoodCompute.UseAmount >= 0 {
|
|
|
m["orderPriceControl"] = fmt.Sprint(v.GoodCompute.UseAmount)
|
|
|
}
|
|
|
if v.UseGoodNumber >= 0 {
|
|
|
m["quantityControl"] = fmt.Sprint(v.UseGoodNumber)
|
|
|
}
|
|
|
allGoods = append(allGoods, m)
|
|
|
}
|
|
|
orderData := map[string]interface{}{
|
|
|
"buyer": orderinfo.Buyer.BuyerName,
|
|
|
"shipmentsId": orderinfo.DeliveryCode,
|
|
|
"orderDist": orderinfo.RegionInfo.RegionName,
|
|
|
"partner": orderinfo.PartnerInfo.PartnerName,
|
|
|
"id": orderinfo.Id,
|
|
|
"orderNumber": orderinfo.OrderCode,
|
|
|
}
|
|
|
dividendCount := map[string]interface{}{
|
|
|
"orderNum": orderinfo.OrderCompute.PlanOrderCount,
|
|
|
"orderAmountAdjustment": orderinfo.OrderCompute.PlanOrderAmount,
|
|
|
"orderNumControl": "",
|
|
|
"orderAmountAdjustmentControl": "",
|
|
|
"partnerDividends": orderinfo.OrderCompute.PlanPartnerBonus,
|
|
|
"partnerDividendsControl": "",
|
|
|
"receivedDividends": orderinfo.OrderCompute.PartnerBonusHas,
|
|
|
"notReceivedDividend": orderinfo.OrderCompute.PartnerBonusNot,
|
|
|
"dividendSpending": orderinfo.OrderCompute.PartnerBonusExpense,
|
|
|
"commissionProportion": orderinfo.SalesmanBonusPercent,
|
|
|
"expectedCommission": orderinfo.OrderCompute.SalesmanBonus,
|
|
|
}
|
|
|
if orderinfo.OrderCompute.UseOrderAmount >= 0 {
|
|
|
dividendCount["orderAmountAdjustmentControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderAmount)
|
|
|
}
|
|
|
if orderinfo.OrderCompute.UsePartnerBonus >= 0 {
|
|
|
dividendCount["partnerDividendsControl"] = fmt.Sprint(orderinfo.OrderCompute.UsePartnerBonus)
|
|
|
}
|
|
|
if orderinfo.OrderCompute.UseOrderCount >= 0 {
|
|
|
dividendCount["orderNumControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderCount)
|
|
|
}
|
|
|
rsp := map[string]interface{}{
|
|
|
"order": orderData,
|
|
|
"product": allGoods,
|
|
|
"dividendCount": dividendCount,
|
|
|
"operationTime": orderinfo.UpdateTime.Local().Format("2006-01-02 15:04:06"),
|
|
|
}
|
|
|
if orderinfo.OrderCompute.UseOrderAmount >= 0 {
|
|
|
rsp["orderNumCountControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderAmount)
|
|
|
}
|
|
|
if orderinfo.OrderCompute.UseOrderCount >= 0 {
|
|
|
rsp["orderAmountAdjustmentCountControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderCount)
|
|
|
}
|
|
|
c.ResponseData(rsp)
|
|
|
return
|
|
|
} |
...
|
...
|
|