跨域回滚,药品订单回滚增加药品名称

This commit is contained in:
2024-03-04 11:09:29 +08:00
parent f8ccf96e58
commit db2c47bfed
2 changed files with 17 additions and 1 deletions
+16
View File
@@ -263,6 +263,7 @@ type OrderProductData struct {
LogisticsFee float64 // 运费金额
LogisticsNo string // 物流编号
LogisticsCompanyCode string // 快递公司编码
ProductNames string // 药品列表
DeliveryTime time.Time // 发货时间
PayTime time.Time // 支付时间
Remarks string // 订单备注
@@ -1479,6 +1480,7 @@ func (r *ExportService) OrderProduct(d []*model.OrderProduct) (string, error) {
{Value: "运费金额", CellType: "float64", NumberFmt: "0.0000", ColWidth: 18},
{Value: "物流编号", CellType: "string", NumberFmt: "", ColWidth: 18},
{Value: "快递公司编码", CellType: "string", NumberFmt: "", ColWidth: 18},
{Value: "药品", CellType: "string", NumberFmt: "", ColWidth: 35},
{Value: "发货时间", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30},
{Value: "支付时间", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30},
{Value: "订单备注", CellType: "string", NumberFmt: "", ColWidth: 18},
@@ -1575,6 +1577,20 @@ func (r *ExportService) OrderProduct(d []*model.OrderProduct) (string, error) {
data.CreatedAt = t
}
// 处理药品列表
orderProductItemDao := dao.OrderProductItemDao{}
orderProductItems, err := orderProductItemDao.GetOrderProductItemByOrderProductId(v.OrderProductId)
if err == nil || len(orderProductItems) > 0 {
var products []string
for _, v := range orderProductItems {
amount := fmt.Sprintf("%d", v.Amount)
product := v.ProductName + "(" + amount + ")"
products = append(products, product)
}
data.ProductNames = strings.Join(products, ";")
}
dataSlice = append(dataSlice, data)
}