dever 3 年之前
父节点
当前提交
9f003c90bb
共有 2 个文件被更改,包括 41 次插入19 次删除
  1. 40 18
      app/mshop/src/Goods.php
  2. 1 1
      app/shop/src/My.php

+ 40 - 18
app/mshop/src/Goods.php

@@ -28,38 +28,60 @@ class Goods extends Core
     # 下单pdf
     public function pdf()
     {
-        Dever::apply('fpdf184/chinese', 'pdf');
+        Dever::apply('fpdf/chinese', 'pdf');
 
         $pdf=new \PDF_Chinese();
+        $pdf->AddGBFont();
+        $pdf->Open();
+        $pdf->AddPage();
+        $pdf->SetFont('GB', 'B', 10);
+        $pdf->Cell(0, 8,  $this->convert("------------------------------------------------------------------厨人易料------------------------------------------------------------------"), 0, 0, 'C');
+        $pdf->Ln();
+        $pdf->Ln();
 
-        $pdf->AddGBFont('simsun','宋体');
+        $pdf->SetFont('GB', 'B', 20);
+        $pdf->Cell(180, 8,  $this->convert("库存清单"), 0, 0, 'C');
+        $pdf->Ln();
+        $pdf->Ln();
+        $pdf->Ln();
+        $pdf->SetFont('GB', 'B', 10);
+        $pdf->Cell(180, 8,  $this->convert("门店名称:的发电机房就得开"), 0, 0);
 
-        $pdf->AddGBFont('simhei','黑体');
+        $pdf->Ln();
+        $pdf->Cell(180, 8,  $this->convert("制单人:23213213"), 0, 0);
 
-        $pdf->AddGBFont('simkai','楷体_GB2312');
+        $pdf->Ln();
+        $pdf->Cell(180, 8,  $this->convert("制单时间:23213213"), 0, 0);
 
-        $pdf->AddGBFont('sinfang','仿宋_GB2312');
+        $pdf->Ln();
+        $pdf->Cell(0, 8,  $this->convert("----------------------------------------------------------------------------------------------------------------------------------------------"), 0, 0);
 
-        $pdf->Open();
-
-        $pdf->AddPage();
+        $pdf->Ln();
+        $pdf->Cell(150, 8,  $this->convert("商品名称"), 0, 0);
+        $pdf->Cell(40, 8,  $this->convert("数量"), 0, 0, 'R');
 
-        $pdf->SetFont('simsun','',20);
+        $pdf->Ln();
+        $pdf->Cell(150, 8,  $this->convert("22221111111"), 0, 0);
+        $pdf->Cell(40, 8,  $this->convert("X 2"), 0, 0, 'R');
 
-        $pdf->Write(10,'简体中文汉字');
+        $pdf->Ln();
+        $pdf->Cell(0, 8,  $this->convert("----------------------------------------------------------------------------------------------------------------------------------------------"), 0, 0);
 
-        $pdf->SetFont('simhei','',20);
+        $pdf->Ln();
+        $pdf->Ln();
+        $pdf->Cell(180, 8,  $this->convert("如遇任何问题请至电客服"), 0, 0, 'C');
 
-        $pdf->Write(10,'简体中文汉字');
+        $pdf->Ln();
+        $pdf->Cell(180, 8,  $this->convert("电话:400-123-1234"), 0, 0, 'C');
 
-        $pdf->SetFont('simkai','',20);
-
-        $pdf->Write(10,'简体中文汉字');
-
-        $pdf->Write(10,'简体中文汉字');
+        $pdf->Ln();
+        $pdf->Cell(180, 8,  $this->convert("周一~周五 9:00~18:00"), 0, 0, 'C');
 
         $pdf->Output();
     }
 
-    
+    private function convert($string, $to = 'GBK', $source = 'UTF-8')
+    {
+        return mb_convert_encoding($string, $to, $source);
+    }
 }

+ 1 - 1
app/shop/src/My.php

@@ -56,7 +56,7 @@ class My extends Core
 	# 我的礼品卡列表
 	public function card()
 	{
-		$this->data = Dever::db('goods/card_code')->page(array('uid' => $this->uid));
+		$this->data = Dever::db('goods/card_code')->select_page(array('uid' => $this->uid));
 
 		if ($this->data) {
 			$status = Dever::db('goods/card_code')->config['status'];