im
This commit is contained in:
@@ -102,9 +102,9 @@ func (p PrinterHandler) PrintOrder(ctx *jxcontext.Context, store *model.Store, s
|
||||
}
|
||||
content := ""
|
||||
if store.PrinterFontSize == partner.PrinterFontSizeBig || store.PrinterFontSize == partner.PrinterFontSizeBig2 {
|
||||
content = p.getOrderContentBig(order, store.Tel1, storeDetail)
|
||||
content = p.getOrderContentBigV2(order, store.Tel1, storeDetail)
|
||||
} else {
|
||||
content = p.getOrderContent(order, store.Tel1, storeDetail)
|
||||
content = p.getOrderContentV2(order, store.Tel1, storeDetail)
|
||||
}
|
||||
count := 0
|
||||
for {
|
||||
@@ -163,6 +163,135 @@ func (p PrinterHandler) SetSound(ctx *jxcontext.Context, sn, id2, sound string)
|
||||
return err
|
||||
}
|
||||
|
||||
//不包括价格版本
|
||||
func (c *PrinterHandler) getOrderContentV2(order *model.GoodsOrder, storeTel string, storeDetail *dao.StoreDetail) (content string) {
|
||||
expectedDeliveryTime := order.ExpectedDeliveredTime
|
||||
if utils.IsTimeZero(expectedDeliveryTime) {
|
||||
expectedDeliveryTime = order.OrderCreatedAt.Add(1 * time.Hour)
|
||||
}
|
||||
getCode := ""
|
||||
if order.VendorID == model.VendorIDEBAI {
|
||||
getCode = fmt.Sprintf("<C>饿百取货码:%s</C>", jxutils.GetEbaiOrderGetCode(order))
|
||||
}
|
||||
if order.BuyerComment == "" {
|
||||
order.BuyerComment = "客户电话: " + order.ConsigneeMobile + ",配送遇到问题,可联系18048531223取消配送单,禁止未配送直接完成订单!"
|
||||
}
|
||||
orderParams := []interface{}{}
|
||||
orderFmt := ``
|
||||
if storeDetail != nil {
|
||||
if storeDetail.BrandIsPrint == model.NO {
|
||||
orderFmt += `<C><font# bolder=1 height=2 width=2>%s</font#></C>`
|
||||
if order.VendorOrgCode == "34665" {
|
||||
orderParams = append(orderParams, globals.StoreNameEbai2)
|
||||
} else {
|
||||
orderParams = append(orderParams, storeDetail.BrandName)
|
||||
}
|
||||
}
|
||||
}
|
||||
orderFmt += `
|
||||
<font# bolder=0 height=1 width=1>--------------------------------</font#>
|
||||
<LEFT>下单时间: %s</LEFT>
|
||||
<LEFT>期望送达: %s</LEFT>
|
||||
<LEFT>客户姓名: %s</LEFT>
|
||||
<LEFT>客户电话: %s</LEFT>
|
||||
<LEFT><font# bolder=0 height=2 width=1>订单编号: %s</font#></LEFT><BR>
|
||||
<C><font# bolder=0 height=2 width=2>%s#%d</font#>
|
||||
<QR>%s</QR></C>
|
||||
` + getCode + `<font# bolder=0 height=1 width=1>--------------------------------</font#>
|
||||
<LEFT><font# bolder=0 height=2 width=1>客户地址: %s</font#></LEFT>
|
||||
<font# bolder=0 height=1 width=1>--------------------------------</font#>
|
||||
<LEFT><font# bolder=0 height=1 width=1>客户备注:%s</font#></LEFT>
|
||||
<font# bolder=0 height=1 width=1>--------------------------------</font#>
|
||||
<LEFT><font# bolder=0 height=1 width=1>商品列表</font#></LEFT>
|
||||
商品名` + trenditapi.StrRepeat(" ", 20) + `数量
|
||||
` + trenditapi.StrRepeat("-", 32) + `
|
||||
`
|
||||
orderParams = append(orderParams,
|
||||
utils.Time2Str(order.OrderCreatedAt),
|
||||
utils.Time2Str(expectedDeliveryTime),
|
||||
order.ConsigneeName,
|
||||
order.ConsigneeMobile,
|
||||
order.VendorOrderID,
|
||||
jxutils.GetVendorName(order.VendorID),
|
||||
order.OrderSeq,
|
||||
order.VendorOrderID,
|
||||
order.ConsigneeAddress,
|
||||
order.BuyerComment,
|
||||
)
|
||||
|
||||
for k, sku := range order.Skus {
|
||||
orderFmt += trenditapi.FormatPrintOrderItemV2(sku.SkuName, sku.Count, k+1)
|
||||
}
|
||||
orderFmt += `<BR><LEFT><font# bolder=0 height=2 width=1>共%d种%d件商品</font#></LEFT>
|
||||
<font# bolder=0 height=2 width=1>--------------#%d完-------------</font#>`
|
||||
orderParams = append(orderParams, order.SkuCount, order.GoodsCount, order.OrderSeq)
|
||||
return fmt.Sprintf(orderFmt, orderParams...)
|
||||
}
|
||||
func (c *PrinterHandler) getOrderContentBigV2(order *model.GoodsOrder, storeTel string, storeDetail *dao.StoreDetail) (content string) {
|
||||
expectedDeliveryTime := order.ExpectedDeliveredTime
|
||||
if utils.IsTimeZero(expectedDeliveryTime) {
|
||||
expectedDeliveryTime = order.OrderCreatedAt.Add(1 * time.Hour)
|
||||
}
|
||||
getCode := ""
|
||||
if order.VendorID == model.VendorIDEBAI {
|
||||
getCode = fmt.Sprintf("<C>饿百取货码:%s</C>", jxutils.GetEbaiOrderGetCode(order))
|
||||
}
|
||||
if order.BuyerComment == "" {
|
||||
order.BuyerComment = "客户电话: " + order.ConsigneeMobile + ",配送遇到问题,可联系18048531223取消配送单,禁止未配送直接完成订单!"
|
||||
}
|
||||
orderParams := []interface{}{}
|
||||
orderFmt := ``
|
||||
if storeDetail != nil {
|
||||
if storeDetail.BrandIsPrint == model.NO {
|
||||
orderFmt += `<C><font# bolder=1 height=2 width=2>%s</font#></C>`
|
||||
if order.VendorOrgCode == "34665" {
|
||||
orderParams = append(orderParams, globals.StoreNameEbai2)
|
||||
} else {
|
||||
orderParams = append(orderParams, storeDetail.BrandName)
|
||||
}
|
||||
}
|
||||
}
|
||||
orderFmt += `
|
||||
<font# bolder=0 height=2 width=1>--------------------------------</font#>
|
||||
<LEFT>下单时间: %s</LEFT>
|
||||
<LEFT>期望送达: %s</LEFT>
|
||||
<LEFT>客户姓名: %s</LEFT>
|
||||
<LEFT>客户电话: %s</LEFT>
|
||||
<LEFT><font# bolder=1 height=2 width=1>订单编号: %s</font#></LEFT><BR>
|
||||
<C><font# bolder=0 height=2 width=2>%s#%d</font#>
|
||||
<QR>%s</QR></C>
|
||||
` + getCode + `<font# bolder=0 height=1 width=1>--------------------------------</font#>
|
||||
<LEFT><font# bolder=0 height=2 width=1>客户地址: %s</font#></LEFT>
|
||||
<font# bolder=0 height=1 width=1>--------------------------------</font#>
|
||||
<LEFT><font# bolder=0 height=2 width=1>客户备注:%s</font#></LEFT>
|
||||
<font# bolder=0 height=1 width=1>--------------------------------</font#>
|
||||
<LEFT><font# bolder=0 height=1 width=1>商品列表</font#></LEFT>
|
||||
商品名` + trenditapi.StrRepeat(" ", 20) + `数量
|
||||
` + trenditapi.StrRepeat("-", 32) + `
|
||||
`
|
||||
orderParams = append(orderParams,
|
||||
utils.Time2Str(order.OrderCreatedAt),
|
||||
utils.Time2Str(expectedDeliveryTime),
|
||||
order.ConsigneeName,
|
||||
order.ConsigneeMobile,
|
||||
order.VendorOrderID,
|
||||
jxutils.GetVendorName(order.VendorID),
|
||||
order.OrderSeq,
|
||||
order.VendorOrderID,
|
||||
order.ConsigneeAddress,
|
||||
order.BuyerComment,
|
||||
)
|
||||
|
||||
for k, sku := range order.Skus {
|
||||
orderFmt += trenditapi.FormatPrintOrderItemBigV2(sku.SkuName, sku.Count, k+1)
|
||||
}
|
||||
orderFmt += `<BR><LEFT><font# bolder=0 height=2 width=1>共%d种%d件商品</font#></LEFT>
|
||||
<font# bolder=0 height=2 width=1>--------------#%d完-------------</font#>`
|
||||
orderParams = append(orderParams, order.SkuCount, order.GoodsCount, order.OrderSeq)
|
||||
return fmt.Sprintf(orderFmt, orderParams...)
|
||||
}
|
||||
|
||||
//打印单价版本
|
||||
//正常尺寸打印模板
|
||||
func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel string, storeDetail *dao.StoreDetail) (content string) {
|
||||
expectedDeliveryTime := order.ExpectedDeliveredTime
|
||||
|
||||
Reference in New Issue
Block a user