*/ class inventorydepth_finder_task_skus { var $addon_cols = 'shop_id'; function __construct($app) { $this->app = $app; $this->_render = app::get('inventorydepth')->render(); } public $column_request = '回写库存'; public $column_request_order = 2; public function column_request($row) { $request = $row['request']; //error_log(var_export($row,1),3,__FILE__.'.log'); if ($request == 'true') { $word = $this->app->_('开启'); $color = 'green'; $title = '点击关闭该货品自动回写库存功能'; $href = 'index.php?app=inventorydepth&ctl=shop_skus&act=set_request&p[0]=false&p[1]='.$sku['id'].'&finder_id='.$_GET['_finder']['finder_id']; }else{ $word = $this->app->_('关闭'); $color = '#a7a7a7'; $title = '点击开启该货品自动回写库存功能'; $href = 'index.php?app=inventorydepth&ctl=shop_skus&act=set_request&p[0]=true&p[1]='.$sku['id'].'&finder_id='.$_GET['_finder']['finder_id']; } return << {$word}  EOF; } private $js_shop_stock = false; public $column_shop_stock = '店铺库存'; public $column_shop_stock_order = 89; public function column_shop_stock($row) { $id = $row['id']; $iid = $row['shop_iid']; $shop_id = $row['shop_id']; $shop_bn = $row['shop_bn']; $shop_bn = addslashes(str_replace('+','%2B',$shop_bn)); $sku_id = $row['shop_sku_id']; $shop_type = $row['shop_type']; if ($this->js_shop_stock === false) { $this->js_shop_stock = true; $return = << void function(){ function shop_stock_request(data){ new Request.JSON({ url:"index.php?app=inventorydepth&ctl=shop_adjustment&act=getShopStock", method:"post", data:{"iid":data,"shop_id":"{$shop_id}","shop_bn":"{$shop_bn}","shop_type":"{$shop_type}"}, onComplete:function(rsp){ if(rsp.status=='fail'){console.log(rsp.msg);return;} if(rsp.status=='succ'){ rsp.data.each(function(item,index){ var id = item.id; if (\$defined(\$("sku-shop-stock-"+id))){ \$("sku-shop-stock-"+id).setHTML(item.num); } }); } } }).send(); } \$('main').addEvent('domready',function(){ var data = []; \$ES('.sku-shop-stock').each(function(i){ if(data.length>=20){ shop_stock_request(data); data = []; } data.push(i.get("iid")); }); if (data.length>0) { shop_stock_request(data); } }); }(); EOF; } $return .= << EOF; return $return; } public $column_actual_stock = '店铺可售库存'; public $column_actual_stock_order = 90; public function column_actual_stock($row) { $id = $row['id']; $pkg_list=''; if($row['bind'] == '1'){ #查询本地捆绑明细 return << 0  EOF; } return << 0  EOF; } public $column_release_stock = '发布库存'; public $column_release_stock_order = 91; private $js_release_stock = false; public function column_release_stock($row) { $id = $row['id']; $iid = $row['shop_iid']; $shop_id = $row['shop_id']; $shop_bn = $row['shop_bn']; $shop_bn = addslashes(str_replace('+','%2B',$shop_bn)); $sku_id = $row['shop_sku_id']; $bn = $row['shop_product_bn']; if ($this->js_release_stock === false) { $this->js_release_stock = true; $return = << void function(){ function release_stock_request(data){ new Request.JSON({ url:"index.php?app=inventorydepth&ctl=shop_adjustment&act=getReleaseStock", method:"post", data:{"ids":data,"shop_id":"{$shop_id}","shop_bn":"{$shop_bn}"}, onComplete:function(rsp){ if(rsp.status=='fail'){console.log(rsp.msg);return;} if(rsp.status=='succ'){ rsp.data.each(function(item,index){ var id = 'release-stock-'+item.id; if (\$defined(\$(id))){ \$(id).set('value',item.quantity); } id = 'actual-stock-'+item.id; if (\$defined(\$(id))){ \$(id).setHTML(item.actual_stock); if(item.actual_product_stock){ var actual_product_stock = item.actual_product_stock; var pkg_pro_html=''; if(actual_product_stock.length > 0){ pkg_pro_html += ''; for(j=0;j'+actual_product_stock[j].bn+''; } pkg_pro_html += '
货号名称可售库存
'+actual_product_stock[j].product_name+''+actual_product_stock[j].stock+'
'; } \$(id).set('rel',pkg_pro_html); } } id = 'regulation-'+item.id; if (\$defined(\$(id))){ \$(id).setHTML(item.reguhtml); } }); } } }).send(); } \$('main').addEvent('domready',function(){ var data = []; \$ES('.release-stock').each(function(i){ data.push(i.get("skuid")); }); if (data.length>0) { release_stock_request(data); } }); }(); EOF; } $return .= << EOF; return $return; } public $column_regulation = '库存更新规则'; public $column_regulation_order = 71; public function column_regulation($row) { $id = $row['id']; return << EOF; } }