dever 3 éve
szülő
commit
8de69efed3

+ 8 - 2
app/factory/assets/pc/html/cashier.html

@@ -51,7 +51,8 @@
 							<tr>
 								<th lay-data="{field:'id'}">商品编码</th>
 								<th lay-data="{field:'name'}">商品名称</th>
-								<th lay-data="{field:'price', edit: 'text'}">售价(元)</th>
+								<th lay-data="{field:'price', edit: 'text'}">出厂价(元)</th>
+								<th lay-data="{field:'c_price', edit: 'text'}">成本价(元)</th>
 								<th lay-data="{field:'number', edit: 'text'}">数量</th>
 								<th lay-data="{field:'operation'}">操作</th>
 							</tr>
@@ -62,7 +63,7 @@
 					</table>
 				</div>
 				<div class="total ft16">
-					合计:【<span> 总金额:<i class="totalMoney">0.00</i> </span>】【<span> 总数量:<i class="totalQuantity">0</i> </span>】
+					合计:【<span> 总金额:<i class="totalMoney">0.00</i> </span>】【<span> 总成本:<i class="totalCMoney">0.00</i> </span>】【<span> 总数量:<i class="totalQuantity">0</i> </span>】
 				</div>
 				<table class="reading layui-table" lay-even="">
 					<tbody>
@@ -268,6 +269,7 @@
   			if (!goods[key]) {
   				goods[key] = node;
   				goods[key].price = parseFloat(goods[key].price);
+  				goods[key].c_price = parseFloat(goods[key].c_price);
   				goods[key].min = parseFloat(goods[key].min);
   				if (goods[key].min) {
   					goods[key].num = goods[key].min;
@@ -297,6 +299,7 @@
 			addtr += '<td class="goods_id">'+node.id+'</td>';
 			addtr += '<td class="goods_name">'+node.name+'</td>'	;					
 			addtr += '<td class="goods_price">'+node.price+'</td>';
+			addtr += '<td class="goods_c_price">'+node.c_price+'</td>';
 			addtr += '<td><div class="jiajian" value='+node.id+'><span class="jian" onclick="dec(\''+node.id+'\')">-</span><input type="text" value="'+node.num+'" class="goods_num"><span class="jia" onclick="add(\''+node.id+'\')">+</span></div></td>';					
 			addtr += '<td><button class="delete_btn" onclick="del(\''+node.id+'\')">删除</button></td>';						
 			addtr += '</tr>';
@@ -344,13 +347,16 @@
 	function setTotal()
 	{
 		var cash = 0;
+		var c_cash = 0;
 		var num = 0;
 		for (var i in goods) {
 			num += goods[i].num;
 			cash += goods[i].price * goods[i].num;
+			c_cash += goods[i].c_price * goods[i].num;
 		}
 		$(".totalQuantity").html(num);
 		$(".totalMoney").html(cash.toFixed(2)); 
+		$(".totalCMoney").html(c_cash.toFixed(2));
 	}
 
 	function setFactory()

+ 2 - 0
app/factory/lib/Goods.php

@@ -33,6 +33,7 @@ class Goods
                         $result[$v['id']]['name'] = $v['name'];
                         $result[$v['id']]['min'] = $data[$k]['min'];
                         $result[$v['id']]['price'] = $v['p_price'];
+                        $result[$v['id']]['c_price'] = $data[$k]['c_price'];
                         $result[$v['id']]['children'] = array();
                     }
                     if (isset($data[$k]['attr']) && $data[$k]['attr']) {
@@ -42,6 +43,7 @@ class Goods
                             'name' => $v['name'] . '-' . $data[$k]['sku_name'],
                             'min' => $data[$k]['min'],
                             'price' => $v['p_price'] ? $v['p_price'] : 0,
+                            'c_price' => $data[$k]['c_price'] ? $data[$k]['c_price'] : 0,
                             'end' => true,
                         );
                     }

+ 13 - 1
app/goods/database/info.php

@@ -292,6 +292,17 @@ $config = array
             'show'      => 'price_type=1',
         ),
 
+        'c_price'       => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '成本价',
+            'default'   => '',
+            'desc'      => '成本价',
+            'match'     => 'option',
+            'update'    => 'text',
+            'list'      => true,
+        ),
+
         'min'       => array
         (
             'type'      => 'int-11',
@@ -439,6 +450,7 @@ $config = array
             'search'    => 'select',
             'list'      => true,
             'edit'      => true,
+            'mul'       => true,
         ),
 
         'reorder'       => array
@@ -507,7 +519,7 @@ $config = array
         ),
         //'insert' => false,
         'delete' => false,
-        //'mul' => true,
+        'mul' => true,
         # 自定义快捷新增和编辑
         'button' => array
         (

+ 14 - 3
app/goods/database/info_sku.php

@@ -112,6 +112,17 @@ $config = array
             'list'      => true,
         ),
 
+        'c_price'       => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '成本价',
+            'default'   => '',
+            'desc'      => '成本价',
+            'match'     => 'option',
+            'update'    => 'text',
+            'list'      => true,
+        ),
+
         'min'       => array
         (
             'type'      => 'int-11',
@@ -238,7 +249,7 @@ $config = array
             ),
             'type' => 'all',
             'order' => array('id' => 'desc'),
-            'col' => 'id,info_id,`key`,price,s_price,f_price,type,min,code',
+            'col' => 'id,info_id,`key`,price,s_price,f_price,c_price,type,min,code',
         ),
 
         # 列表
@@ -252,7 +263,7 @@ $config = array
             ),
             'type' => 'all',
             'order' => array('id' => 'desc'),
-            'col' => 'id,info_id,`key`,price,s_price,f_price,min,code|key',
+            'col' => 'id,info_id,`key`,price,s_price,f_price,c_price,min,code|key',
         ),
 
         # 获取单条数据
@@ -265,7 +276,7 @@ $config = array
                 'state' => 1,
             ),
             'type' => 'one',
-            'col' => 'id,info_id,price,s_price,f_price,min,code',
+            'col' => 'id,info_id,price,s_price,f_price,c_price,min,code',
         ),
 
         'getMinOne' => array

+ 2 - 1
app/goods/lib/Sku.php

@@ -12,8 +12,9 @@ class Sku
         'code' => '商品条码号',
         's_price' => '市场价',
         'f_price' => '采购价',
+        'c_price' => '成本价',
         'price' => '销售价',
-        'min' => '起购数',
+        'min' => '采购起订数',
     );
 
     # 主要价格字段

+ 11 - 0
app/shop/database/goods.php

@@ -117,6 +117,17 @@ return array
             //'list'      => true,
         ),
 
+        'min'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '起购数',
+            'default'   => '1',
+            'desc'      => '起购数',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'list'      => true,
+        ),
+
         'status'        => array
         (
             'type'      => 'tinyint-1',

+ 11 - 0
app/shop/database/goods_sku.php

@@ -85,6 +85,17 @@ $config = array
             //'list'      => true,
         ),
 
+        'min'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '起购数',
+            'default'   => '1',
+            'desc'      => '起购数',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'list'      => true,
+        ),
+
         'reorder'       => array
         (
             'type'      => 'int-11',

+ 13 - 3
app/shop/database/info.php

@@ -20,7 +20,7 @@ $invoice = array
     2 => '不可以开发票',
 );
 
-$col = 'id,name,`desc`,ps_cash,truename,mobile,lng,lat,address,open,worktime,method,gotime,city,area,province,county,town,coupon_city,pdesc,license,food_license,jy_license,license_number,company_name,coord_address,invoice,type,mid';
+$col = 'id,name,`desc`,ps_cash,free_ps_cash,truename,mobile,lng,lat,address,open,worktime,method,gotime,city,area,province,county,town,coupon_city,pdesc,license,food_license,jy_license,license_number,company_name,coord_address,invoice,type,mid';
 
 $act = function()
 {
@@ -537,9 +537,19 @@ return array
         'ps_cash'      => array
         (
             'type'      => 'varchar-50',
-            'name'      => '配送费',
+            'name'      => '运费-单位为元',
             'default'   => '0',
-            'desc'      => '配送费',
+            'desc'      => '运费',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'free_ps_cash'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '免运费额度-满多少免运费,这里直接填写一个订单满多少金额就免费配送的金额,单位为元',
+            'default'   => '0',
+            'desc'      => '免运费额度',
             'match'     => 'option',
             'update'    => 'text',
         ),

+ 17 - 0
app/shop/lib/Sell.php

@@ -172,6 +172,10 @@ class Sell
             $info['ps_cash'] = 0;
         }
 
+        if (!$info['free_ps_cash']) {
+            $info['free_ps_cash'] = 0;
+        }
+
         if (!$info['wallet_cash']) {
             $info['wallet_cash'] = 0;
         } else {
@@ -673,6 +677,16 @@ class Sell
             $n = isset($num[$k]) ? $num[$k] : 1;
 
             $data['list'][$k] = Dever::load('goods/lib/info')->getPayInfo($v, $s);
+
+            $w = array();
+            $w['goods_id'] = $v;
+            $w['sku_id'] = $s;
+            $w['shop_id'] = $data['shop']['id'];
+            $goods_sku = Dever::db('shop/goods_sku')->find($w);
+            if ($goods_sku && isset($goods_sku['min'])) {
+                $data['list'][$k]['min'] = $goods_sku['min'];
+            }
+
             $data['list'][$k]['num'] = $n;
 
             # 2是库存不足
@@ -704,6 +718,9 @@ class Sell
 
         if ($data['method'] == 2) {
             $data['ps_cash'] = $data['shop']['ps_cash'];
+            if ($data['shop']['free_ps_cash'] && $data['shop']['free_ps_cash'] > 0 && $data['price'] >= $data['shop']['free_ps_cash']) {
+                $data['ps_cash'] = 0;
+            }
         }
 
         $data['oprice'] = $data['price'];

+ 1 - 0
app/shop/lib/Sku.php

@@ -15,6 +15,7 @@ class Sku
     		'add_num' => '新增库存数^-输入小于0的数字,则为减少库存',
 	        'total' => '当前库存|',
 	        'total_num' => '总库存|',
+            'min' => '起订数',
     	),
 
     	# 设置哪个商品类型无法设置上述字段