edit-biz_brand-settle

This commit is contained in:
dengbw
2022-09-03 18:31:51 +08:00
committed by lccsw
parent 142b660728
commit 09713afb0e
11 changed files with 123 additions and 92 deletions
+7 -4
View File
@@ -83,16 +83,19 @@ class Seprice extends HD_Controller
}
$biz_id = $biz_row['id'];
$biz_info_row = $this->biz_info_model->get(['biz_id'=>$biz_id]);
$jsondata = json_decode($biz_info_row['jsondata'],true);
$info['money_json'] = [
'rent' => $biz_info_row['rent'] ? $biz_info_row['rent'] : '',
'base_manager' => $biz_info_row['manager_wage'] ? $biz_info_row['manager_wage'] : '',
'base_employees' => 0,
'employee_wage' => $biz_info_row['employee_wage'] ? $biz_info_row['employee_wage'] : '',
'wat_ele' => $biz_info_row['wat_ele'] ? $biz_info_row['wat_ele'] : '',
'media' => $biz_info_row['margin'] ? $biz_info_row['margin'] : '',
'marketing' => '',
'drive' => '',
'commission' => $biz_info_row['commission'] ? $biz_info_row['commission'] : '',
'trucking' => ''
'num' => $biz_info_row['num'],
'trucking' => '',
'drive' => $jsondata['car_rent'] ? $jsondata['car_rent'] : '',
'marketing' => $jsondata['marketing'] ? $jsondata['marketing'] : '',
'door_step' => $jsondata['door_step'] ? $jsondata['door_step'] : '',
];
$info['year'] = date('Y');
$info['month'] = intval(date('m'));
+1
View File
@@ -389,6 +389,7 @@ class Settle extends HD_Controller
$temp['price_ml'] = $v['price_total'] - $temp['total_need'];
$temp['profix_partner'] = $v['profix_partner'] + $v['profix_partner_oflow'];
$temp['money_json'] = json_decode($v['money_json'],true);
$temp['price_all_after'] = sprintf("%.2f",$v['price_all']/1.13);
$lists[] = $temp;
}
}
+6 -1
View File
@@ -71,6 +71,8 @@ class Srv extends HD_Controller{
public function get(){
$biz_id = $_SESSION['srv_biz_id'];
$id = $this->input->get('id');
$type = $this->input->get('type');
!$type && $type = 1;
if(!$biz_id){
return $this->show_json(SYS_CODE_FAIL,'参数错误');
}
@@ -78,7 +80,7 @@ class Srv extends HD_Controller{
$finances = $this->sys_finance_model->select(['status' => 1], '', 0, 0, 'id,title');
$info = [
'biz_id' => $biz_id,
'type' => 1,
'type' => $type,
'is_def' => 0,
's_effect_time' => date('Y-m-d'),
'action' => 'biz/srv/add',
@@ -127,6 +129,9 @@ class Srv extends HD_Controller{
$jsondata['rebate'] = $info['jsondata']['rebate'];
$jsondata['finance_id'] = $info['jsondata']['finance_id'];
$jsondata['finance_num'] = $info['jsondata']['finance_num'];
$finance = $this->sys_finance_model->get(['id'=>intval($jsondata['finance_id'])],'title');
$jsondata['finance_title'] = $finance['title'];
$data['title'] = $jsondata['finance_title'];
}
//只能有一条默认
if($info['is_def']){
+11 -2
View File
@@ -1035,6 +1035,7 @@ class Store extends HD_Controller
$this->biz_info_model->add(['biz_id' => $biz_id, 'c_time' => time()]);
$base_info = $this->biz_info_model->get(['biz_id' => $biz_id]);
}
$jsondata = json_decode($base_info['jsondata'],true);
$info = [
'id' => $base_info['id'],
'biz_id' => $base_info['biz_id'],
@@ -1053,6 +1054,9 @@ class Store extends HD_Controller
'type' => $base_info['type'],
'rate' => strlen($base_info['rate']) ? $base_info['rate'] : 0,
'biz_type' => $biz['type'],
'car_rent' => $jsondata['car_rent'] ? $jsondata['car_rent'] : '',
'marketing' => $jsondata['marketing'] ? $jsondata['marketing'] : '',
'door_step' => $jsondata['door_step'] ? $jsondata['door_step'] : '',
];
$brands = [];
$b_rows = $this->biz_trucking_model->select(['biz_id' => $base_info['biz_id'], 'status' => 1], '', '', '', 'auto_b_id,money');
@@ -1080,13 +1084,14 @@ class Store extends HD_Controller
{
$info = $this->input->post('info');
$brands = $this->input->post('brands');
if (!$this->biz_info_model->get(['id' => $info['id']])) {
$row = $this->biz_info_model->get(['id' => $info['id']]);
if (!$row) {
return $this->show_json(SYS_CODE_FAIL, '错数错误!');
}
if ($info['rate'] < 0 || $info['rate'] > 100) {
return $this->show_json(SYS_CODE_FAIL, '分佣比例请填写0~100');
}
$jsondata = json_decode($row['jsondata'],true);
$up_data = [
'name' => $info['name'],
'mobile' => $info['mobile'],
@@ -1103,6 +1108,10 @@ class Store extends HD_Controller
'rate' => $info['rate'],
'num' => $info['num']
];
$jsondata['car_rent'] = $info['car_rent'] ? $info['car_rent'] : '';
$jsondata['marketing'] = $info['marketing'] ? $info['marketing'] : '';
$jsondata['door_step'] = $info['door_step'] ? $info['door_step'] : '';
$up_data['jsondata'] = json_encode($jsondata,JSON_UNESCAPED_UNICODE);
$this->biz_info_model->update($up_data, ['id' => $info['id']]);
$b_ids = array_column($brands, 'id');
if ($b_ids) {
+19 -22
View File
@@ -18,12 +18,6 @@
<input type="number" placeholder="垂直媒体" v-model="info.money_json.media"/>
</div>
</div>
<div class="am-form-group wp50 fl">
<label class="am-para-label">市场营销费:</label>
<div class="am-para-input">
<input type="number" placeholder="市场营销费" v-model="info.money_json.marketing"/>
</div>
</div>
<div class="am-form-group wp50 fl">
<label class="am-para-label">试驾车租金:</label>
<div class="am-para-input">
@@ -31,15 +25,15 @@
</div>
</div>
<div class="am-form-group wp50 fl">
<label class="am-para-label">销售提成</label>
<label class="am-para-label">市场营销费</label>
<div class="am-para-input">
<input type="number" placeholder="销售提成" v-model="info.money_json.commission"/>
<input type="number" placeholder="市场营销费" v-model="info.money_json.marketing"/>
</div>
</div>
<div class="am-form-group wp50 fl">
<label class="am-para-label">拖车费</label>
<label class="am-para-label">门头营销</label>
<div class="am-para-input">
<input type="number" placeholder="拖车费" v-model="info.money_json.trucking"/>
<input type="number" placeholder="门头营销" v-model="info.money_json.door_step"/>
</div>
</div>
<div class="am-form-group wp50">
@@ -52,19 +46,22 @@
</select>
</div>
</div>
<div class="am-form-group wp50">
<label class="am-para-label">销售薪资</label>
<div class="am-form-group wp50 fl">
<label class="am-para-label">销售人数</label>
<div class="am-para-input">
<div>
<span class="btn btn-success" @click="add_employee_price()">新增</span>
销售薪资总和:{{info.money_json.base_employees}}
</div>
<div class="mt10" v-for="(val,key) in employee_price_list">
<select style="display: inline;width: 100px;" v-model="employee_price_list[key]" @change="up_employee_price()">
<option v-for="item in employee_price_arr" :value="item">{{item}}</option>
</select>
<a class="btn btn-default" @click="del_employee_price(key)">删除</a>
</div>
<input type="number" placeholder="销售人数" v-model="info.money_json.num"/>
</div>
</div>
<div class="am-form-group wp50 fl">
<label class="am-para-label">销售底薪:</label>
<div class="am-para-input">
<input type="number" placeholder="销售底薪" v-model="info.money_json.employee_wage"/>
</div>
</div>
<div class="am-form-group wp50">
<label class="am-para-label">销售提成:</label>
<div class="am-para-input">
<input type="number" placeholder="销售提成" v-model="info.money_json.commission"/>
</div>
</div>
<div class="am-form-group wp50">
+11 -9
View File
@@ -36,14 +36,15 @@
<th width="5%">
<span>ID</span>
</th>
<th width="10%"><span>门店</span></th>
<th width="10%"><span>单车总毛利</span></th>
<th width="10%"><span>税后单车总毛利</span></th>
<th width="10%"><span>水平业务总毛利</span></th>
<th width="10%"><span>门店费用</span></th>
<th width="10%"><span>其它费用</span></th>
<th width="10%"><span>总利润</span></th>
<th width="10%"><span></span></th>
<th width="8%"><span>门店</span></th>
<th width="6%"><span>单车总毛利</span></th>
<th width="6%"><span>税后单车总毛利</span></th>
<th width="6%"><span>水平业务总毛利</span></th>
<th width="6%"><span>税后水平业务总毛利</span></th>
<th width="6%"><span>门店费用</span></th>
<th width="6%"><span>其它费用</span></th>
<th width="6%"><span>总利</span></th>
<th width="6%"><span>分润</span></th>
<th width="6%"><span>时间</span></th>
</tr>
</thead>
@@ -57,6 +58,7 @@
<td>{{v.profix_car}}</td>
<td>{{v.profix_car_after}}</td>
<td>{{v.price_all}}</td>
<td>{{v.price_all_after}}</td>
<td>
<template v-if="v.money_json && v.money_json.biz_price">
<template v-for="(v2,i2) in v.money_json.biz_price_list">
@@ -78,7 +80,7 @@
<td>{{v.month_str}}</td>
</tr>
<tr>
<td colspan="10" class="align-r">
<td colspan="11" class="align-r">
<a class="am-btn am-btn-primary am-btn-xs" :data-open="'/biz/settle?_biz_type=1&biz_id='+v.biz_id+'&month='+v.month" href="javascript:;">查看明细</a>
<a class="am-btn am-btn-primary am-btn-xs" :data-modal="'/biz/settle/add_price?id='+v.id" data-title="新增费用" href="javascript:;">新增费用</a>
<a class="am-btn am-btn-primary am-btn-xs" data-ajax="post" data-action="biz/settle/edit_static" :data-params-id="v.id" data-params-type="1" href="javascript:;">重新结算</a>
+1 -1
View File
@@ -38,7 +38,7 @@
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
<div class="am-form-group fl ml20">
<button data-title="新增" type="button" data-modal="/biz/srv/get" class="am-btn am-btn-success am-btn-sm w100">
<button data-title="新增" type="button" :data-modal="'/biz/srv/get?type='+params.type" class="am-btn am-btn-success am-btn-sm w100">
新增
</button>
</div>
+58 -47
View File
@@ -1,5 +1,14 @@
<form id="vue-edit" class="am-form am-form-horizontal" :action="action" data-auto="true" method="post"
style="width: 90%;padding-top: 10px">
<div class="am-form-group">
<label class="am-para-label">分佣比例:</label>
<div class="am-para-input">
<template v-if="info.biz_type==2">合伙人</template>
<template v-else>品牌店</template>
<input type="text" style="width:90px;display:inline" placeholder="0~100" name="" v-model="info.rate"/>%&nbsp;&nbsp;&nbsp;&nbsp;
狸车:<span>{{100-info.rate}}%</span> (说明:有效值0~100,输入数值的百分比)
</div>
</div>
<template v-if="info.biz_type==2">
<div class="am-form-group">
<label class="am-para-label">联系人:</label>
@@ -13,7 +22,7 @@
<input type="text" placeholder="输入联系电话" name="" v-model="info.mobile"/>
</div>
</div>
<div class="am-form-group" v-if="info.biz_type==2">
<div class="am-form-group">
<label class="am-para-label">类型:</label>
<div class="am-para-input w150">
<select v-model="info.type">
@@ -21,27 +30,48 @@
</select>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">保证金:</label>
<div class="am-para-input w150">
<input type="text" placeholder="输入保证金" name="" type="number" v-model="info.margin"/>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">面积:</label>
<div class="am-para-input w150">
<input type="text" placeholder="输入面积" name="" type="number" v-model="info.area"/>
</div>
</div>
</template>
<div class="am-form-group">
<label class="am-para-label">分佣比例</label>
<div class="am-para-input">
<template v-if="info.biz_type==2">合伙人</template>
<template v-else>品牌店</template>
<input type="text" style="width:90px;display:inline" placeholder="0~100" name="" v-model="info.rate"/>%&nbsp;&nbsp;&nbsp;&nbsp;
狸车:<span>{{100-info.rate}}%</span> (说明:有效值0~100,输入数值的百分比)
<label class="am-para-label">租金()</label>
<div class="am-para-input w150">
<input type="text" placeholder="输入租金" name="" type="number" v-model="info.rent"/>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">水电()</label>
<div class="am-para-input w150">
<input type="text" placeholder="输入水电" name="" type="number" v-model="info.wat_ele"/>
</div>
</div>
<template v-if="info.biz_type==1">
<div class="am-form-group">
<label class="am-para-label">房租</label>
<label class="am-para-label">试驾车租金</label>
<div class="am-para-input w150">
<input type="text" placeholder="输入房租" name="" type="number" v-model="info.rent"/>
<input type="text" placeholder="输入试驾车租金" name="" type="number" v-model="info.car_rent"/>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">水电</label>
<label class="am-para-label">市场活动营</label>
<div class="am-para-input w150">
<input type="text" placeholder="输入水电" name="" type="number" v-model="info.wat_ele"/>
<input type="text" placeholder="输入市场活动营" name="" type="number" v-model="info.marketing"/>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">门头营销:</label>
<div class="am-para-input w150">
<input type="text" placeholder="输入门头营销" name="" type="number" v-model="info.door_step"/>
</div>
</div>
<div class="am-form-group">
@@ -66,39 +96,20 @@
</select>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">销售人数:</label>
<div class="am-para-input w150">
<input type="text" placeholder="输入销售提成" name="" type="number" v-model="info.num"/>
</div>
</div>
</template>
<template v-if="info.biz_type==2">
<div class="am-form-group">
<label class="am-para-label">保证金:</label>
<div class="am-para-input w150">
<input type="text" placeholder="输入保证金" name="" type="number" v-model="info.margin"/>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">面积:</label>
<div class="am-para-input w150">
<input type="text" placeholder="输入面积" name="" type="number" v-model="info.area"/>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">租金()</label>
<div class="am-para-input w150">
<input type="text" placeholder="输入租金" name="" type="number" v-model="info.rent"/>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">水电()</label>
<div class="am-para-input w150">
<input type="text" placeholder="输入水电" name="" type="number" v-model="info.wat_ele"/>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">销售底薪:</label>
<div class="am-para-input w150">
<input type="text" placeholder="输入人工工资" name="" type="number" v-model="info.employee_wage"/>
</div>
</div>
<template v-if="info.biz_type==2">
<div class="am-form-group">
<label class="am-para-label">人员核定:</label>
<div class="am-para-input">
@@ -118,6 +129,16 @@
<input type="text" placeholder="输入裸车抽成" name="" type="number" v-model="info.commission"/>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">合作时间:</label>
<div class="am-para-input">
<input type="text" id="s_time" style="width:200px;display:inline" placeholder="开始时间" name=""
autocomplete="off" v-model="info.s_time"/>
<input type="text" id="e_time" style="width:200px;display:inline" placeholder="结束时间" name=""
autocomplete="off" v-model="info.e_time"/>
</div>
</div>
</template>
<div class="am-form-group">
<label class="am-para-label">拖车费:</label>
<div class="am-para-input w150">
@@ -134,16 +155,6 @@
</template>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">合作时间:</label>
<div class="am-para-input">
<input type="text" id="s_time" style="width:200px;display:inline" placeholder="开始时间" name=""
autocomplete="off" v-model="info.s_time"/>
<input type="text" id="e_time" style="width:200px;display:inline" placeholder="结束时间" name=""
autocomplete="off" v-model="info.e_time"/>
</div>
</div>
</template>
<div class="am-form-group" style="margin-bottom: 2rem">
<div class="am-para-input">
<button class="am-btn am-btn-secondary" type="button" @click="saveEdit">保存</button>
+1 -1
View File
@@ -658,7 +658,7 @@ class CusorderV2 extends Wxapp
!$page && $page = 1;
!$size && $size = 10;
$where = [];
$where = ['status!='=>2];
if ($group_id == 1) {
$where['admin_id'] = $uid;//销售
} else if ($group_id == 2 || $group_id == 3) {//店长/老板
+5 -5
View File
@@ -226,7 +226,7 @@ class User extends Wxapp
$this->load->model('receiver/order/receiver_orders_v2_model');
$this->load->model('receiver/order/receiver_order_signs_model', 'order_signs_model');
$this->load->model('receiver/receiver_customers_visit_data_model', 'mdCustomerVisitData');
$where = ['status>' => -1, 'is_top' => 1, 'biz_id' => $biz_id, 'cs_biz_id<>' => -1];
$where = ['status>' => -1, 'is_top' => 1, 'biz_id' => $biz_id, 'cs_biz_id<>' => -1,'status!='=>2];
$group_id == 1 && $where['admin_id'] = $uid;
$group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤
$gz_count = $this->customers_model->count($where);
@@ -256,20 +256,20 @@ class User extends Wxapp
];
}
$where = ['status>=' => 0, 'payway' => 0, 'id>=' => Orders_v2_entity::V2_START_ID,
'brand_id>' => 0, 'biz_id' => $biz_id,
'brand_id>' => 0, 'biz_id' => $biz_id,'status!='=>2,
'id not in (select o_id from lc_receiver_order_status where pid_status=1 and status=2)' => null];
$group_id == 1 && $where['sale_id'] = $uid;
$group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤
$fq_total = $this->receiver_orders_v2_model->count($where);
$where = ['status>=' => 0, 'id>=' => Orders_v2_entity::V2_START_ID,
'brand_id>' => 0, 'biz_id' => $biz_id,
'brand_id>' => 0, 'biz_id' => $biz_id,'status!='=>2,
'id not in (select o_id from lc_receiver_order_status where pid_status=2 and status=1)' => null];
$group_id == 1 && $where['sale_id'] = $uid;
$group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤
$pc_total = $this->receiver_orders_v2_model->count($where);
$where = [
'status>=' => 0, 'id>=' => Orders_v2_entity::V2_START_ID,
'brand_id>' => 0, 'biz_id' => $biz_id,
'brand_id>' => 0, 'biz_id' => $biz_id,'status!='=>2,
'id not in (select o_id from lc_receiver_order_status where pid_status=3 and status=1)' => null,
'id in (select o_id from lc_receiver_order_status where pid_status=0 and status=2)' => null];
$group_id == 1 && $where['sale_id'] = $uid;
@@ -277,7 +277,7 @@ class User extends Wxapp
$kp_total = $this->receiver_orders_v2_model->count($where);
$where = [
'status>=' => 0, 'id>=' => Orders_v2_entity::V2_START_ID,
'brand_id>' => 0, 'biz_id' => $biz_id,
'brand_id>' => 0, 'biz_id' => $biz_id,'status!='=>2,
'id in (select o_id from lc_receiver_order_status where pid_status=3 and status=1)' => null,
'id not in (select o_id from lc_receiver_order_status where pid_status=4 and status=2)' => null
];
@@ -26,6 +26,9 @@ class Biz_settle_price_model extends HD_Model
'drive' => '试驾车租金',
'commission' => '销售提成',
'trucking' => '拖车费',
'num' => '销售人数',
'door_step' => '门头营销',
'employee_wage' => '销售底薪',
];
$res = [];
if($jsondata){