dever 3 years ago
parent
commit
a862925f0b
3 changed files with 37 additions and 17 deletions
  1. 1 1
      app/factory/assets/pc/html/setGoods.html
  2. 23 2
      app/mshop/lib/Feieyun.php
  3. 13 14
      app/mshop/src/Data.php

+ 1 - 1
app/factory/assets/pc/html/setGoods.html

@@ -130,7 +130,7 @@
         */
 
         $("#goods").on("keyup", ".goods_set_price", function() {
-            var num = parseInt($(this).val());
+            var num = parseFloat($(this).val());
             var id = $(this).parent().attr('value');
             goods[id].p_price = num;
             setTotal();

+ 23 - 2
app/mshop/lib/Feieyun.php

@@ -147,9 +147,9 @@ class Feieyun
 		
 		foreach ($goods as $k5 => $v5) {
 			$name = $v5['title'];
-			$price = '¥' . $v5['price'];
+			$price = $v5['price'];
 			$num = $v5['num'];
-			$prices = '¥' . $v5['total'];
+			$prices = $v5['total'];
 			$kw3 = '';
 			$kw1 = '';
 			$kw2 = '';
@@ -230,4 +230,25 @@ class Feieyun
 
 		return $orderInfo;
     }
+
+    /**
+     * 参考例子 3
+     * [统计字符串字节数补空格,实现左右排版对齐]
+     * @param  [string] $str_left    [左边字符串]
+     * @param  [string] $str_right   [右边字符串]
+     * @param  [int]    $length      [输入当前纸张规格一行所支持的最大字母数量]
+     *                               58mm的机器,一行打印16个汉字,32个字母;76mm的机器,一行打印22个汉字,33个字母,80mm的机器,一行打印24个汉字,48个字母
+     *                               标签机宽度50mm,一行32个字母,宽度40mm,一行26个字母
+     * @return [string]              [返回处理结果字符串]
+     */
+    public function lr($str_left,$str_right,$length = 32){
+        $kw = '';
+        $str_left_lenght = strlen(Dever::convert($str_left));
+        $str_right_lenght = strlen(Dever::convert($str_right));
+        $k = $length - ($str_left_lenght+$str_right_lenght);
+        for($q=0;$q<$k;$q++){
+            $kw .= ' ';
+        }
+        return $str_left.$kw.$str_right;
+    }
 }

+ 13 - 14
app/mshop/src/Data.php

@@ -501,20 +501,20 @@ class Data extends Core
             $d  = array
             (
                 'title' => $v['info']['name'] . $sku,
-                'price' => '¥' . $v['price'],
-                'num' => 'x' . $v['num'],
-                'total' => '¥' . $v['price']*$v['num'],
+                'price' => '' . $v['price'],
+                'num' => $v['num'],
+                'total' => '' . $v['price']*$v['num'],
             );
             $goods[] = $d;
             if ($v['status'] == 3) {
                 $tgoods[] = $d;
             }
         }
-        $content = '--------------'.$main_config['name'].'------------<BR><BR>';
+        $content = '------------'.$main_config['name'].'------------<BR><BR>';
         $content .= '<C>'.$config['method'][$order['method']].'</C><BR>';
         $content .= '<CB>单号:'.$order['order_num'].'</CB><BR><BR>';
         $content .= '门店名称:'.$shop['name'].'<BR>';
-        $content .= '制单人:'.$user['name'].'<BR>';
+        $content .= '制  人:'.$user['name'].'<BR>';
         $content .= '下单时间:'.$order['cdate'].'<BR>';
         if ($order['fdate']) {
             $content .= '完成时间:'.$order['fdate'].'<BR>';
@@ -524,25 +524,24 @@ class Data extends Core
             $content .= Dever::load('mshop/lib/feieyun')->goods('订单商品', $goods);
         }
         
-
         if ($order['card_code_id']) {
             $card = Dever::db('goods/card_code')->find($order['card_code_id']);
             if ($card) {
                 $content .= '礼品卡:'.$card['card'].'<BR>';
             }
         }
-        $content .= '优惠:¥ '.$order['coupon_cash'].'<BR>';
+        $content .= Dever::load('mshop/lib/feieyun')->lr('优    惠:', $order['coupon_cash']).'<BR>';
         if (isset($order['ps_cash']) && $order['ps_cash']) {
-            $content .= '配送费:¥ '.$order['ps_cash'].'<BR>';
+            $content .= Dever::load('mshop/lib/feieyun')->lr('配送费:', $order['ps_cash']).' <BR>';
         }
-        $content .= '应付:¥ '.$order['price'].'<BR>';
+        $content .= Dever::load('mshop/lib/feieyun')->lr('应    付:', $order['price']).'<BR>';
         $content .= '--------------------------------<BR>';
-        $content .= '微信支付:¥ '.$order['price'].'<BR>';
-        $content .= '找零:'.$order['kou_cash'].'<BR>';
+        $content .= Dever::load('mshop/lib/feieyun')->lr($order['pay_type_name'] . '支付:', $order['price']).'<BR>';
+        $content .= Dever::load('mshop/lib/feieyun')->lr('找    零:', $order['kou_cash']).'<BR>';
         
         if ($tgoods) {
             $content .= Dever::load('mshop/lib/feieyun')->goods('退款商品', $tgoods);
-            $content .= '退款金额:¥ '.$order['coupon_cash'].'<BR>';
+            $content .= Dever::load('mshop/lib/feieyun')->lr('退款金额:', $order['coupon_cash']).'<BR>';
         }
 
         $content .= '--------------------------------<BR>';
@@ -557,14 +556,14 @@ class Data extends Core
         }
 
         if ($order['info']) {
-            $content .= '备注:'.$order['info'].'<BR>';
+            $content .= Dever::load('mshop/lib/feieyun')->lr('备注:', $order['info']).'<BR>';
 
             $content .= '--------------------------------<BR>';
         }
         
 
         $content .= '<C>如遇任何问题请致电客服</C><BR>';
-        $content .= '<C>电话:'.$factory_config['phone'].'</C><BR>';
+        $content .= '<C>电话:'.$manage_config['phone'].'</C><BR>';
         $content .= '<C>'.$main_config['worktime'].'</C><BR>';
         //$content .= '<QR>http://www.feieyun.com</QR>';//把二维码字符串用标签套上即可自动生成二维码