huangjiajun 6ヶ月前
コミット
611584844e
1個のファイルの変更21行の追加26行の削除
  1. +21
    -26
      app/admin/svc/order/svc_order_list.go

+ 21
- 26
app/admin/svc/order/svc_order_list.go ファイルの表示

@@ -476,7 +476,7 @@ func OrderOutput(c *gin.Context) {
list := db.GetOrderListOutput(eg, args)
xlsx, _ := excelize.OpenFile("./static/template/商品销售明细表.xlsx")

var data = map[string]map[int64][]map[string]string{}
var data = map[string]map[int64]map[string]string{}
if list != nil {
enterpriseIds := make([]int, 0)
for _, v := range *list {
@@ -491,10 +491,10 @@ func OrderOutput(c *gin.Context) {
enterpriseName = enterpriseMap[v.EnterpriseId].Name
}
if data[enterpriseName] == nil {
data[enterpriseName] = make(map[int64][]map[string]string)
data[enterpriseName] = make(map[int64]map[string]string)
}
if data[enterpriseName][v.Oid] == nil {
data[enterpriseName][v.Oid] = make([]map[string]string, 0)
data[enterpriseName][v.Oid] = make(map[string]string)
}
//TODO:: 查找 `order_goods`
var orderGoods []model.OrderGoods
@@ -504,11 +504,10 @@ func OrderOutput(c *gin.Context) {
return
}
for _, vv := range orderGoods {
tmp := make(map[string]string)
tmp["date"] = v.CreateAt.Format("2006-01-02")
tmp["send_date"] = gjson.Get(v.BuyInfo, "date").String()
tmp["goods_name"] = vv.GoodsTitle
tmp["ord_no"] = vv.OrdNo
data[enterpriseName][v.Oid]["date"] = v.CreateAt.Format("2006-01-02")
data[enterpriseName][v.Oid]["send_date"] = gjson.Get(v.BuyInfo, "date").String()
data[enterpriseName][v.Oid]["goods_name"] = vv.GoodsTitle
data[enterpriseName][v.Oid]["ord_no"] = vv.OrdNo
skuData := make([]md.Sku, 0)
json.Unmarshal([]byte(vv.Sku), &skuData)
skuStr := ""
@@ -518,9 +517,8 @@ func OrderOutput(c *gin.Context) {
}
skuStr += v1.Value
}
tmp["sku_str"] = skuStr
tmp["num"] = utils.IntToStr(vv.Num)
data[enterpriseName][v.Oid] = append(data[enterpriseName][v.Oid], tmp)
data[enterpriseName][v.Oid]["sku_str"] = skuStr
data[enterpriseName][v.Oid]["num"] = utils.IntToStr(vv.Num)
}
}
}
@@ -536,22 +534,19 @@ func OrderOutput(c *gin.Context) {
for k, v := range data {
var total = 0
for kk, vv := range v {
for _, vv1 := range vv {
if vv1["ord_no"] == "" {
vv1["ord_no"] = utils.Int64ToStr(kk)
}
xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{
vv1["date"],
vv1["ord_no"],
k,
vv1["goods_name"],
vv1["sku_str"],
vv1["num"],
})
xlsx.SetRowHeight("Sheet1", j, 18)
total += utils.StrToInt(vv1["num"])
if vv["ord_no"] == "" {
vv["ord_no"] = utils.Int64ToStr(kk)
}

xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{
vv["date"],
vv["ord_no"],
k,
vv["goods_name"],
vv["sku_str"],
vv["num"],
})
xlsx.SetRowHeight("Sheet1", j, 18)
total += utils.StrToInt(vv["num"])
j++
}



読み込み中…
キャンセル
保存