增加打印大字体的功能
This commit is contained in:
@@ -96,6 +96,74 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
|
||||
return fmt.Sprintf(strings.Replace(orderFmt, "\n", "", -1), orderParams...)
|
||||
}
|
||||
|
||||
func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel string) (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("<S2>饿百取货码:%s</S2><RN>\n", jxutils.GetEbaiOrderGetCode(order))
|
||||
}
|
||||
orderFmt := `
|
||||
<S2><C>%s</C></S2><RN><RN>
|
||||
<C>手机买菜上京西</C>
|
||||
<C>极速到家送惊喜</C><RN>
|
||||
********************************
|
||||
<S2>下单时间: %s<RN><RN></S2>
|
||||
<S2>预计送达: %s<RN><RN></S2>
|
||||
<S2>订单编号: %s<RN></S2>
|
||||
<RN>
|
||||
<S2>%s#%d</S2><RN><RN>
|
||||
<QR>%s</QR>
|
||||
` + getCode + `<RN>
|
||||
<S2>客户: %s<RN></S2>
|
||||
<S2>电话: %s<RN></S2>
|
||||
<S2>地址: %s<RN></S2>
|
||||
<RN>
|
||||
<S2>客户备注: <RN></S2>
|
||||
<S2>%s</S2><RN>
|
||||
<RN>
|
||||
<S2><B1>实际支付:</B1>%s<RN></S2>
|
||||
<RN>
|
||||
<S2>商品明细: <RN></S2>
|
||||
<S2>品名数量单价小计<RN></S2>
|
||||
********************************<RN>`
|
||||
orderParams := []interface{}{
|
||||
globals.StoreName,
|
||||
utils.Time2Str(order.OrderCreatedAt),
|
||||
utils.Time2Str(expectedDeliveryTime),
|
||||
order.VendorOrderID,
|
||||
jxutils.GetVendorName(order.VendorID),
|
||||
order.OrderSeq,
|
||||
order.VendorOrderID,
|
||||
order.ConsigneeName,
|
||||
order.ConsigneeMobile,
|
||||
order.ConsigneeAddress,
|
||||
order.BuyerComment,
|
||||
jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice),
|
||||
}
|
||||
|
||||
for _, sku := range order.Skus {
|
||||
orderFmt += `<S2>%s<RN></S2>`
|
||||
orderFmt += `<S2>%s %s %s<RN><RN></S2>`
|
||||
orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count), jxutils.IntPrice2StandardCurrencyString(sku.VendorPrice), jxutils.IntPrice2StandardCurrencyString(sku.VendorPrice*int64(sku.Count)))
|
||||
}
|
||||
orderFmt += `<RN>
|
||||
<S2><B1>共%d种%d件商品</B1></S2>
|
||||
<RN>
|
||||
********************************<RN>
|
||||
<C><H2>商品质量问题请联系:</H2></C>
|
||||
<C><H2>%s:%s</H2></C><RN>
|
||||
<S2>更多信息请关注官方微信: %s<RN></S2>
|
||||
********************************<RN>
|
||||
********************************<RN>
|
||||
`
|
||||
// <QR>http://weixin.qq.com/r/tkkDGzTERmk5rXB49xyk</QR>
|
||||
orderParams = append(orderParams, order.SkuCount, order.GoodsCount, order.StoreName, storeTel, globals.StoreName)
|
||||
return fmt.Sprintf(strings.Replace(orderFmt, "\n", "", -1), orderParams...)
|
||||
}
|
||||
|
||||
func (c *PrinterHandler) GetVendorID() int {
|
||||
return model.VendorIDZhongWu
|
||||
}
|
||||
@@ -128,7 +196,12 @@ func (c *PrinterHandler) GetPrinterStatus(ctx *jxcontext.Context, deviceID, devi
|
||||
|
||||
func (c *PrinterHandler) PrintOrder(ctx *jxcontext.Context, store *model.Store, order *model.GoodsOrder) (printerStatus *partner.PrinterStatus, err error) {
|
||||
globals.SugarLogger.Debugf("zhongwu PrintOrderByOrder orderID:%s", order.VendorOrderID)
|
||||
content := c.getOrderContent(order, store.Tel1)
|
||||
content := ""
|
||||
if store.PrinterFontSize == partner.PrinterFontSizeBig {
|
||||
content = c.getOrderContentBig(order, store.Tel1)
|
||||
} else {
|
||||
content = c.getOrderContent(order, store.Tel1)
|
||||
}
|
||||
return c.PrintMsg(ctx, store.PrinterSN, store.PrinterKey, order.VendorOrderID, content)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user