作者 anyv
1 个管道 的构建 通过 耗费 4 秒

业务员统一配送支付

... ... @@ -70,8 +70,29 @@ class OrderpageController extends WeChatBaseController{
$courier = Db::name('money_ratio') -> where('id',1) -> find();
$this -> assign('courier',$courier['courier']);
$this -> assign('indent_id',$indet_id['indet_id']);
//这个用户是属于哪个业务员的
//判断这个用户所属哪个业务员
$uid = cmf_get_current_user_id();
$user = Db::name('my_user') -> where('uid',$uid) -> find();
//当当前用户为老师时
if($user['status'] == 3){
$salesman = Db::name('my_user') -> where('id',$user['pid']) -> find();
}
//当前用户为学生时
if($user['status'] == 4){
$teacher = Db::name('my_user') -> where('id',$user['pid']) -> find();
$salesman = Db::name('my_user') -> where('id',$teacher['pid']) -> find();
}
//查询这个用户下添加的学校
$school = Db::name('school') -> where("uid",$uid) -> select();
$grade_class = Db::name('grade_class') -> where("school_id",$school[0]['id']) -> select();
foreach ($grade_class as $key => $val){
$class = explode('-',$val['class']);
for($i=$class[0];$i<=$class[1];$i++){
$grade_class_show[] = $val['grade'].' - '.$i."班";
}
}
$this -> assign('school',$school);
$this -> assign('grade_class_show',$grade_class_show);
return $this -> fetch();
}
... ... @@ -181,6 +202,56 @@ class OrderpageController extends WeChatBaseController{
}
/**
* 点击学校时获取年级班级
*/
public function get_grade_class(){
$school_id = $_POST['id'];
$grade_class = Db::name('grade_class') -> where("school_id",$school_id) -> select() -> toArray();
if(!empty($grade_class)){
foreach ($grade_class as $key => $val){
$class = explode('-',$val['class']);
for($i=$class[0];$i<=$class[1];$i++){
$grade_class_show[] = $val['grade'].' - '.$i."班";
}
}
return json_encode($grade_class_show);
}else{
return false;
}
}
/**
* 业务员统一配送页去支付
*/
public function salesman_ty_go_pay(){
$_POST['is_courier'] = 1;
$school_class = explode(' ',$_POST['school_class']);
$_POST['school'] = $school_class[0];
$_POST['grade'] = $school_class[1];
$_POST['class'] = $school_class[3];
$indent_data['id'] = $_POST['id'];
$indent_data['region'] = $_POST['region'];
$indent_data['name'] = $_POST['name'];
$indent_data['phone'] = $_POST['phone'];
$indent_data['is_courier'] = $_POST['is_courier'];
$indent_data['school'] = $_POST['school'];
$indent_data['grade'] = $_POST['grade'];
$indent_data['class'] = $_POST['class'];
$indent_data['leave_word'] = $_POST['leave_word'];
$data = Db::name('indent') -> update($indent_data);
if($data){
return true;
}else{
return false;
}
}
... ...
... ... @@ -10,7 +10,7 @@
// [ 入口文件 ]
// 调试模式开关
define("APP_DEBUG", false);
define("APP_DEBUG",true);
// 定义CMF根目录,可更改此目录
define('CMF_ROOT', __DIR__ . '/../');
... ...
... ... @@ -46,22 +46,14 @@
</div>
<div>
<div class="three_model_school_data there_university" style="display: block;">
<div class="three_model_school_name">天津科技大学</div>
<div class="three_model_school_name">天津科技大学</div>
<div class="three_model_school_name there_unActive">天津科技大学</div>
<div class="three_model_school_name">天津科技大学2</div>
<div class="three_model_school_name">天津科技大学3</div>
<div class="three_model_school_name">天津科技大学4</div>
<div class="three_model_school_name">天津科技大学5</div>
<div class="three_model_school_name">天津科技大学6</div>
<volist name="school" id="vo">
<div class="three_model_school_name <eq name='key' value='0'>there_unActive</eq>" onclick="click_school({$vo.id})">{$vo.school}</div>
</volist>
</div>
<div class="three_model_school_data there_class">
<div class="three_model_school_name">G1-11</div>
<div class="three_model_school_name">G1-12</div>
<div class="three_model_school_name">G1-13</div>
<div class="three_model_school_name">G1-14</div>
<div class="three_model_school_name">G1-15</div>
<div class="three_model_school_name">G1-16</div>
<div class="three_model_school_data there_class banjiadd">
<volist name="grade_class_show" id="vo">
<div class="three_model_school_name banji">{$vo}</div>
</volist>
</div>
</div>
</div>
... ... @@ -98,7 +90,7 @@
地区
</div>
<div class="log_four_input_one_center">
<div id="city_text">请选择省市区</div>
<div id="city_text" >请选择省市区</div>
</div>
<div class="log_four_input_one_right">
<img src="__TMPL__/public/assets/images/29.png" alt="" />
... ... @@ -109,7 +101,7 @@
学校
</div>
<div class="log_four_input_one_center">
<div class="city_text">请选择学校和班级</div>
<div class="city_text school_grade_class" id="school_class">请选择学校和班级</div>
</div>
<div class="log_four_input_one_right">
<img src="__TMPL__/public/assets/images/29.png" alt="" />
... ... @@ -122,7 +114,7 @@
姓名
</div>
<div class="log_four_input_one_center">
<input type="text" placeholder="请输入姓名" />
<input type="text" placeholder="请输入姓名" id="name"/>
</div>
<div class="log_four_input_one_right">
<img src="__TMPL__/public/assets/images/29.png" alt="" />
... ... @@ -133,7 +125,7 @@
手机号
</div>
<div class="log_four_input_one_center">
<input type="text" placeholder="输入手机号" maxlength="11"/>
<input type="text" placeholder="输入手机号" maxlength="11" id="phone"/>
</div>
<div class="log_four_input_one_right" style="opacity: 0;">
<img src="__TMPL__/public/assets/images/29.png" alt="" />
... ... @@ -184,7 +176,7 @@
买家留言
</div>
<div class="log_four_pash_bottom_two">
<textarea name="" id="" cols="20" rows="3" placeholder="在此填写您的留言"></textarea>
<textarea cols="20" rows="3" placeholder="在此填写您的留言" id="liuyan"></textarea>
</div>
</div>
</div>
... ... @@ -194,7 +186,7 @@
<div class="log_four_zong_qian">合计金额:</div>
<div class="log_four_zong_shu"><span></span>{$money.0}.<span>{$money.1}</span></div>
</div>
<div class="log_three_fixed_right">
<div class="log_three_fixed_right" onclick="go_pay()">
立即支付
</div>
</div>
... ... @@ -210,6 +202,63 @@
function go_courier(){
window.location.href = "{:url('Orderpage/order_salesman_kd')}?indet_id="+{$indent_id};
}
/**
*当点击学校时
*/
function click_school(id){
$.post("{:url('Orderpage/get_grade_class')}",{id:id},function(data){
if(data){
grade = JSON.parse(data);
$('.banji').remove();
for(i=0;i<grade.length;i++){
$('.banjiadd').append("<div class='three_model_school_name banji'>"+grade[i]+"</div>");
}
}else{
$('.banji').remove();
}
});
}
/**
*点击班级时
*/
$(document).on('click','.banji',function(){
grade = $(this).text();
$('.school_grade_class').text($xuexiao+" "+grade);
})
/**
*点击去支付
*/
function go_pay(){
region = $('#city_text').text();
school_class = $('#school_class').text();
name = $('#name').val();
phone = $('#phone').val();
if(region == '请选择省市区'){
alert('地区不能为空');
}else if(school_class == '请选择学校和班级'){
alert('学校班级不能为空');
}else if(name == ''){
alert('姓名不能为空');
}else if(phone == ''){
alert('手机号不能为空');
}else{
liuyan = $('#liuyan').val();
indet_id = {$indent_id};
money = {$money.0};
$.post("{:url('Orderpage/salesman_ty_go_pay')}",{leave_word:liuyan,id:indet_id,money:money,region:region,school_class:school_class,name:name,phone:phone},function(data){
if(data){
window.location.href = "{:url('Pay/index',array('id'=>$indent_id))}";
}else{
alert('更新订单失败');
}
});
}
}
</script>
<script>
$(".log_four_top_right>div").click(function() {
... ...