...
|
...
|
@@ -6,6 +6,7 @@ import ( |
|
|
"strconv"
|
|
|
|
|
|
"github.com/astaxie/beego/logs"
|
|
|
orderCmd "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/orderinfo/command"
|
|
|
orderQuery "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/orderinfo/query"
|
|
|
orderService "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/orderinfo/service"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain"
|
...
|
...
|
@@ -76,6 +77,7 @@ func (c *OrderDividendController) PageListOrderDividend() { |
|
|
"dividendSpending": orderinfo.OrderCompute.PartnerBonusExpense,
|
|
|
"receiveDividends": orderinfo.OrderCompute.PartnerBonusHas,
|
|
|
"uncollectedDividends": orderinfo.OrderCompute.PartnerBonusNot,
|
|
|
"stateOfPayment": orderinfo.BonusStatus,
|
|
|
}
|
|
|
if orderinfo.OrderCompute.UsePartnerBonus >= 0 {
|
|
|
m["dividendsReceivable"] = orderinfo.OrderCompute.UsePartnerBonus
|
...
|
...
|
@@ -129,12 +131,13 @@ func (c *OrderDividendController) OrderDividendDetail() { |
|
|
"partnerDividendsReceivable": v.GoodCompute.PlanPartnerBonus,
|
|
|
}
|
|
|
m := map[string]interface{}{
|
|
|
"detail": detail,
|
|
|
"quantityControl": "",
|
|
|
"id": v.Id,
|
|
|
"stateOfPayment": v.BonusStatus,
|
|
|
"remark": v.Remark,
|
|
|
"amountControl": "",
|
|
|
"detail": detail,
|
|
|
"quantityControl": "",
|
|
|
"id": v.Id,
|
|
|
"stateOfPayment": v.BonusStatus,
|
|
|
"remark": v.Remark,
|
|
|
"amountControl": "",
|
|
|
"partnerDividendControl": "",
|
|
|
}
|
|
|
if v.GoodCompute.UseAmount >= 0 {
|
|
|
m["amountControl"] = fmt.Sprint(v.GoodCompute.UseAmount)
|
...
|
...
|
@@ -142,6 +145,9 @@ func (c *OrderDividendController) OrderDividendDetail() { |
|
|
if v.UseGoodNumber >= 0 {
|
|
|
m["quantityControl"] = fmt.Sprint(v.UseGoodNumber)
|
|
|
}
|
|
|
if v.GoodCompute.UsePartnerBonus >= 0 {
|
|
|
m["partnerDividendControl"] = fmt.Sprint(v.GoodCompute.UsePartnerBonus)
|
|
|
}
|
|
|
allGoods = append(allGoods, m)
|
|
|
}
|
|
|
orderData := map[string]interface{}{
|
...
|
...
|
@@ -194,8 +200,12 @@ type postOrderDividend struct { |
|
|
Id string `json:"id"`
|
|
|
DividendPayments []postDividendPayment `json:"dividendPayment"`
|
|
|
}
|
|
|
|
|
|
type postDividendPayment struct {
|
|
|
QuantityControl string `json:"quantityControl"`
|
|
|
StateOfPayment string `json:"stateOfPayment"`
|
|
|
ProductId string `json:"productId"`
|
|
|
Remark string `json:"remark"`
|
|
|
}
|
|
|
|
|
|
func (c *OrderDividendController) EditOrderDividend() {
|
...
|
...
|
@@ -208,5 +218,50 @@ func (c *OrderDividendController) EditOrderDividend() { |
|
|
c.ResponseError(errors.New("json数据解析失败"))
|
|
|
return
|
|
|
}
|
|
|
orderId, _ := strconv.ParseInt(param.Id, 10, 64)
|
|
|
if orderId == 0 {
|
|
|
c.ResponseError(errors.New("参数错误"))
|
|
|
return
|
|
|
}
|
|
|
goodbouns := []orderCmd.GoodBouns{}
|
|
|
for _, v := range param.DividendPayments {
|
|
|
goodId, _ := strconv.ParseInt(v.ProductId, 10, 64)
|
|
|
if goodId == 0 {
|
|
|
c.ResponseError(errors.New("参数错误"))
|
|
|
return
|
|
|
}
|
|
|
bounsStatus, _ := strconv.Atoi(v.StateOfPayment)
|
|
|
if !(bounsStatus == domain.OrderGoodWaitPay || bounsStatus == domain.OrderGoodHasPay) {
|
|
|
c.ResponseError(errors.New("参数错误"))
|
|
|
return
|
|
|
}
|
|
|
g := orderCmd.GoodBouns{
|
|
|
GoodId: goodId,
|
|
|
Remark: v.Remark,
|
|
|
BounsStatus: bounsStatus,
|
|
|
}
|
|
|
if len(v.QuantityControl) == 0 {
|
|
|
g.UseGoodNumber = -1
|
|
|
} else {
|
|
|
num, err := strconv.Atoi(v.QuantityControl)
|
|
|
if err != nil {
|
|
|
c.ResponseError(errors.New("参数错误"))
|
|
|
return
|
|
|
}
|
|
|
g.UseGoodNumber = num
|
|
|
}
|
|
|
goodbouns = append(goodbouns, g)
|
|
|
}
|
|
|
cmd := orderCmd.UpdateGoodBouns{
|
|
|
Id: orderId,
|
|
|
GoodBouns: goodbouns,
|
|
|
}
|
|
|
orderSrv := orderService.NewOrderInfoService(nil)
|
|
|
err = orderSrv.UpdateGoodBouns(cmd)
|
|
|
if err != nil {
|
|
|
c.ResponseError(err)
|
|
|
return
|
|
|
}
|
|
|
c.ResponseData(nil)
|
|
|
return
|
|
|
} |
...
|
...
|
|