|
@@ -2,6 +2,8 @@ package controllers |
|
@@ -2,6 +2,8 @@ package controllers |
|
2
|
|
2
|
|
|
3
|
import (
|
3
|
import (
|
|
4
|
"errors"
|
4
|
"errors"
|
|
|
|
5
|
+ "fmt"
|
|
|
|
6
|
+ "strconv"
|
|
5
|
|
7
|
|
|
6
|
"github.com/astaxie/beego/logs"
|
8
|
"github.com/astaxie/beego/logs"
|
|
7
|
orderQuery "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/orderinfo/query"
|
9
|
orderQuery "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/orderinfo/query"
|
|
@@ -83,3 +85,106 @@ func (c *OrderDividendController) PageListOrderDividend() { |
|
@@ -83,3 +85,106 @@ func (c *OrderDividendController) PageListOrderDividend() { |
|
83
|
c.ResponsePageList(rsp, cnt, param.PageNumber)
|
85
|
c.ResponsePageList(rsp, cnt, param.PageNumber)
|
|
84
|
return
|
86
|
return
|
|
85
|
}
|
87
|
}
|
|
|
|
88
|
+
|
|
|
|
89
|
+//OrderDividendDetail 订单的分红详情
|
|
|
|
90
|
+func (c *OrderDividendController) OrderDividendDetail() {
|
|
|
|
91
|
+ type Parameter struct {
|
|
|
|
92
|
+ Id string `json:"id"`
|
|
|
|
93
|
+ }
|
|
|
|
94
|
+ var (
|
|
|
|
95
|
+ param Parameter
|
|
|
|
96
|
+ err error
|
|
|
|
97
|
+ )
|
|
|
|
98
|
+ if err = c.BindJsonData(¶m); err != nil {
|
|
|
|
99
|
+ logs.Error(err)
|
|
|
|
100
|
+ c.ResponseError(errors.New("json数据解析失败"))
|
|
|
|
101
|
+ return
|
|
|
|
102
|
+ }
|
|
|
|
103
|
+ orderid, _ := strconv.ParseInt(param.Id, 10, 64)
|
|
|
|
104
|
+ if orderid == 0 {
|
|
|
|
105
|
+ c.ResponseError(errors.New("参数错误"))
|
|
|
|
106
|
+ return
|
|
|
|
107
|
+ }
|
|
|
|
108
|
+ orderSrv := orderService.NewOrderInfoService(nil)
|
|
|
|
109
|
+ orderinfo, err := orderSrv.GetOrderDetail(orderQuery.GetOrderQuery{
|
|
|
|
110
|
+ OrderId: orderid,
|
|
|
|
111
|
+ })
|
|
|
|
112
|
+ if err != nil {
|
|
|
|
113
|
+ c.ResponseError(err)
|
|
|
|
114
|
+ return
|
|
|
|
115
|
+ }
|
|
|
|
116
|
+ if orderinfo.OrderType != domain.OrderReal {
|
|
|
|
117
|
+ c.ResponseError(errors.New("参数错误"))
|
|
|
|
118
|
+ return
|
|
|
|
119
|
+ }
|
|
|
|
120
|
+ allGoods := []map[string]interface{}{}
|
|
|
|
121
|
+ for _, v := range orderinfo.Goods {
|
|
|
|
122
|
+ detail := map[string]interface{}{
|
|
|
|
123
|
+ "productName": v.GoodName,
|
|
|
|
124
|
+ "orderNum": v.PlanGoodNumber,
|
|
|
|
125
|
+ "univalence": v.Price,
|
|
|
|
126
|
+ "partnerRatio": v.PartnerBonusPercent,
|
|
|
|
127
|
+ "orderPrice": v.GoodCompute.PlanAmount,
|
|
|
|
128
|
+ "partnerDividendsReceivable": v.GoodCompute.PlanPartnerBonus,
|
|
|
|
129
|
+ }
|
|
|
|
130
|
+ m := map[string]interface{}{
|
|
|
|
131
|
+ "detail": detail,
|
|
|
|
132
|
+ "quantityControl": "",
|
|
|
|
133
|
+ "id": v.Id,
|
|
|
|
134
|
+ "stateOfPayment": v.BonusStatus,
|
|
|
|
135
|
+ "remark": v.Remark,
|
|
|
|
136
|
+ "orderPriceControl": "",
|
|
|
|
137
|
+ }
|
|
|
|
138
|
+ if v.GoodCompute.UseAmount >= 0 {
|
|
|
|
139
|
+ m["orderPriceControl"] = fmt.Sprint(v.GoodCompute.UseAmount)
|
|
|
|
140
|
+ }
|
|
|
|
141
|
+ if v.UseGoodNumber >= 0 {
|
|
|
|
142
|
+ m["quantityControl"] = fmt.Sprint(v.UseGoodNumber)
|
|
|
|
143
|
+ }
|
|
|
|
144
|
+ allGoods = append(allGoods, m)
|
|
|
|
145
|
+ }
|
|
|
|
146
|
+ orderData := map[string]interface{}{
|
|
|
|
147
|
+ "buyer": orderinfo.Buyer.BuyerName,
|
|
|
|
148
|
+ "shipmentsId": orderinfo.DeliveryCode,
|
|
|
|
149
|
+ "orderDist": orderinfo.RegionInfo.RegionName,
|
|
|
|
150
|
+ "partner": orderinfo.PartnerInfo.PartnerName,
|
|
|
|
151
|
+ "id": orderinfo.Id,
|
|
|
|
152
|
+ "orderNumber": orderinfo.OrderCode,
|
|
|
|
153
|
+ }
|
|
|
|
154
|
+ dividendCount := map[string]interface{}{
|
|
|
|
155
|
+ "orderNum": orderinfo.OrderCompute.PlanOrderCount,
|
|
|
|
156
|
+ "orderAmountAdjustment": orderinfo.OrderCompute.PlanOrderAmount,
|
|
|
|
157
|
+ "orderNumControl": "",
|
|
|
|
158
|
+ "orderAmountAdjustmentControl": "",
|
|
|
|
159
|
+ "partnerDividends": orderinfo.OrderCompute.PlanPartnerBonus,
|
|
|
|
160
|
+ "partnerDividendsControl": "",
|
|
|
|
161
|
+ "receivedDividends": orderinfo.OrderCompute.PartnerBonusHas,
|
|
|
|
162
|
+ "notReceivedDividend": orderinfo.OrderCompute.PartnerBonusNot,
|
|
|
|
163
|
+ "dividendSpending": orderinfo.OrderCompute.PartnerBonusExpense,
|
|
|
|
164
|
+ "commissionProportion": orderinfo.SalesmanBonusPercent,
|
|
|
|
165
|
+ "expectedCommission": orderinfo.OrderCompute.SalesmanBonus,
|
|
|
|
166
|
+ }
|
|
|
|
167
|
+ if orderinfo.OrderCompute.UseOrderAmount >= 0 {
|
|
|
|
168
|
+ dividendCount["orderAmountAdjustmentControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderAmount)
|
|
|
|
169
|
+ }
|
|
|
|
170
|
+ if orderinfo.OrderCompute.UsePartnerBonus >= 0 {
|
|
|
|
171
|
+ dividendCount["partnerDividendsControl"] = fmt.Sprint(orderinfo.OrderCompute.UsePartnerBonus)
|
|
|
|
172
|
+ }
|
|
|
|
173
|
+ if orderinfo.OrderCompute.UseOrderCount >= 0 {
|
|
|
|
174
|
+ dividendCount["orderNumControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderCount)
|
|
|
|
175
|
+ }
|
|
|
|
176
|
+ rsp := map[string]interface{}{
|
|
|
|
177
|
+ "order": orderData,
|
|
|
|
178
|
+ "product": allGoods,
|
|
|
|
179
|
+ "dividendCount": dividendCount,
|
|
|
|
180
|
+ "operationTime": orderinfo.UpdateTime.Local().Format("2006-01-02 15:04:06"),
|
|
|
|
181
|
+ }
|
|
|
|
182
|
+ if orderinfo.OrderCompute.UseOrderAmount >= 0 {
|
|
|
|
183
|
+ rsp["orderNumCountControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderAmount)
|
|
|
|
184
|
+ }
|
|
|
|
185
|
+ if orderinfo.OrderCompute.UseOrderCount >= 0 {
|
|
|
|
186
|
+ rsp["orderAmountAdjustmentCountControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderCount)
|
|
|
|
187
|
+ }
|
|
|
|
188
|
+ c.ResponseData(rsp)
|
|
|
|
189
|
+ return
|
|
|
|
190
|
+} |