Commit ad979a8a authored by hezhen's avatar hezhen

修改问题

parent 64cd7dbd
......@@ -18,7 +18,12 @@ if ($id) {
$company['culture'] = explode(',', $company['culture']);
}
if($_GPC['action']=='region'){
$parent_id= isset($_GPC["parent_id"])?$_GPC["parent_id"]:1;
$sql = "select * from ".tablename('sys_region')." where parent_id =".$parent_id;
$list=pdo_fetchall($sql);
exit(json_encode(array('errno'=>0,'message'=>'','data'=>$list)));
}
load()->func('tpl');
include $this->template('manage/companyEdit');
......
<?php
//dezend by http://www.yunlu99.com/
function changeWater($id)
{
$time = time();
$list = pdo_getall('longbing_company_selling_water', array('order_id' => $id, 'waiting' => 1));
pdo_update('longbing_company_selling_water', array('waiting' => 2, 'update_time' => $time), array('order_id' => $id, 'waiting' => 1));
foreach ($list as $index => $item) {
$money = $item['price'] * $item['extract'] / 100;
$money = sprintf('%.2f', $money);
$profit = pdo_get('longbing_company_selling_profit', array('user_id' => $item['user_id']));
if ($profit) {
if ($money <= $profit['waiting']) {
$waiting = $profit['waiting'] - $money;
$total_profit = $profit['total_profit'] + $money;
$profit_money = $profit['profit'] + $money;
$waiting = sprintf('%.2f', $waiting);
$total_profit = sprintf('%.2f', $total_profit);
$profit_money = sprintf('%.2f', $profit_money);
}
else {
$waiting = 0;
$money = $profit['waiting'];
$total_profit = $profit['total_profit'] + $profit['waiting'];
$profit_money = $profit['profit'] + $profit['waiting'];
$total_profit = sprintf('%.2f', $total_profit);
$profit_money = sprintf('%.2f', $profit_money);
}
pdo_update('longbing_company_selling_profit', array('waiting' => $waiting, 'total_profit' => $total_profit, 'profit' => $profit_money), array('id' => $profit['id']));
$user = pdo_get('longbing_company_user', array('id' => $item['source_id']));
if ($user) {
$create_money = $user['create_money'] + $money;
$create_money = sprintf('%.2f', $create_money);
pdo_update('longbing_company_user', array('create_money' => $create_money, 'update_time' => $time), array('id' => $user['id']));
}
}
}
}
function checkFreeCard($order_id){
$order_goods_list = pdo_getall('longbing_company_shop_order_item',array('order_id'=>$order_id));
$return = false;
foreach ($order_goods_list as $order_goods){
$goods = pdo_get('longbing_company_goods',array('id'=>$order_goods['goods_id']));
if($goods && $goods['is_free_card']){
$return = true;
break;
}
}
return $return;
}
define('ROOT_PATH', IA_ROOT . '/addons/longbing_company/');
is_file(ROOT_PATH . '/inc/we7.php') || exit('Access Denied Longbing');
require_once ROOT_PATH . '/inc/we7.php';
global $_GPC;
global $_W;
$uid = $_GPC['user_id'];
$id = $_GPC['id'];
if (!$uid || !$id) {
return $this->result(-1, '', array());
}
$where = array('user_id' => $uid, 'id' => $id);
$info = pdo_get('longbing_company_shop_order', $where);
if (!$info) {
return $this->result(-1, '', array());
}
if ($info['order_status'] != 2) {
return $this->result(-1, '', array());
}
$uniacid = $info['uniacid'];
$result = pdo_update('longbing_company_shop_order', array('order_status' => 3), $where);
if ($info['type'] == 1) {
$infos = pdo_getall('longbing_company_shop_order', array('collage_id' => $info['collage_id'], 'order_status >' => 2));
$collage = pdo_get('longbing_company_shop_collage_list', array('id' => $info['collage_id']));
if ($collage['number'] && $collage['number'] == count($infos)) {
pdo_update('longbing_company_shop_collage_list', array('collage_status' => 3), array('id' => $info['collage_id']));
}
}
if ($result) {
changeWater($id);
/*if(checkFreeCard($id)){
pdo_update('longbing_company_user', array('is_pay' => 1,'is_staff'=>1), array('id' => $uid));
}*/
return $this->result(0, '', array());
}
return $this->result(-1, '', array());
?>
......@@ -15,15 +15,17 @@ $record_id = $_GPC['record_id'];
$direct = $_GPC['direct'];
$number = $_GPC['number'];
$trolley_arr = explode(',', $trolley_ids);
if (!$address_id || empty($trolley_arr)) {
/*if (!$address_id || empty($trolley_arr)) {
return $this->result(-1, '', array());
}*/
if(!$number || !$goods_id) {
return $this->result(-1, '', array());
}
$address = pdo_get('longbing_company_shop_address', array('id' => $address_id, 'user_id' => $uid));
/*$address = pdo_get('longbing_company_shop_address', array('id' => $address_id, 'user_id' => $uid));
if (empty($address)) {
return $this->result(-1, '', array());
}
}*/
$trolley_in = '(' . $trolley_ids . ')';
......@@ -70,7 +72,11 @@ foreach ($list as $k => $v) {
$total_freight += $v['freight'];
$price += $spe_price['price'] * $v['number'];
}
$user=pdo_get('longbing_company_user', array('id' => $to_uid,'is_staff'=>1));
$user1=pdo_get('longbing_company_user', array('id' => $uid,'is_staff'=>1));
if(!$user||$user1){
$to_uid=0;
}
$time = time();
$total_freight = sprintf('%.2f', $total_freight);
$price = sprintf('%.2f', $price);
......
......@@ -13,7 +13,10 @@ $record_id = $_GPC['record_id'];
$number = $_GPC['number'];
$goods_id = $_GPC['goods_id'];
$spe_id = $_GPC['spe_price_id'];
if (!$address_id || !$number || !$goods_id) {
/*if (!$address_id || !$number || !$goods_id) {
return $this->result(-1, '', array());
}*/
if(!$number || !$goods_id) {
return $this->result(-1, '', array());
}
......@@ -42,16 +45,21 @@ foreach ($speList as $k2 => $v2) {
}
$titles = trim($titles, '-');
$address = pdo_get('longbing_company_shop_address', array('id' => $address_id, 'user_id' => $uid));
/*$address = pdo_get('longbing_company_shop_address', array('id' => $address_id, 'user_id' => $uid));
if (empty($address)) {
return $this->result(-1, '', array());
}
}*/
$user=pdo_get('longbing_company_user', array('id' => $to_uid,'is_staff'=>1));
$user1=pdo_get('longbing_company_user', array('id' => $uid,'is_staff'=>1));
if(!$user||$user1){
$to_uid=0;
}
$time = time();
$total_freight = sprintf('%.2f', $goods_info['freight']);
$price = sprintf('%.2f', $spe_info['price'] * $number);
$insertOrder = array('user_id' => $uid, 'address_id' => $address_id, 'freight' => $total_freight, 'price' => $price, 'total_price' => $total_freight + $price, 'uniacid' => $uniacid, 'name' => $address['name'], 'sex' => $address['sex'], 'phone' => $address['phone'], 'address' => $address['address'], 'address_detail' => $address['address_detail'], 'province' => $address['province'], 'city' => $address['city'], 'area' => $address['area'], 'to_uid' => $to_uid, 'create_time' => $time, 'update_time' => $time);
$insertOrder = array('user_id' => $uid, 'address_id' => 0, 'freight' => $total_freight, 'price' => $price, 'total_price' => $total_freight + $price, 'uniacid' => $uniacid, 'name' => $address['name'], 'sex' => $address['sex'], 'phone' => $address['phone'], 'address' => $address['address'], 'address_detail' => $address['address_detail'], 'province' => $address['province'], 'city' => $address['city'], 'area' => $address['area'], 'to_uid' => $to_uid, 'create_time' => $time, 'update_time' => $time);
if ($record_id) {
$sign = true;
......
......@@ -71,7 +71,7 @@
{elseif $item['pay_status'] == 1}
{if $item['order_status'] == 0}
<span class="layui-badge layui-bg-orange">发货</span>
<span class="layui-badge layui-bg-orange">审核</span>
{elseif $item['order_status'] == 2}
<span class="layui-badge layui-bg-green">已发货</span>
{elseif $item['order_status'] == 3}
......@@ -90,7 +90,7 @@
{if $item['collage_check'] == 1}
<button type="button" class="layui-btn layui-btn-xs btn-send-item"
itemId="{$item['id']}">
发货
审核
</button>
{/if}
{/if}
......
......@@ -9812,6 +9812,9 @@ class longbing_companyModuleWxapp extends WeModuleWxapp
}
if ($staff) {
if($staff['is_stock']==1&&$config['stock_extract']&&$config['stock_extract']>0&&$config['stock_extract']<100){
$config['staff_extract']=$config['stock_extract'];
}
$extract_money = $price * $config['staff_extract'] / 100;
$extract_money = sprintf('%.2f', $extract_money);
@pdo_update('longbing_company_selling_profit', array('waiting +=' => $extract_money), array('user_id' => $staff_id));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment