Commit 93f7880f by allen

crm转移到订单系统

parent 7aec11d6
......@@ -90,16 +90,24 @@ Class AddOrderController extends Controller
{
if ($request->isMethod('post')) {
$mobile = $request->input('mobile');
$user_id = $request->input('user_id');
$goods_type = $request->input('goods_type'); // 类型,1-联营,2-自营
$operator_id = $request->user->userId;
$UserMainModel = new UserMainModel;
if (preg_match('/@/', $mobile)) {
$user = $UserMainModel->where('email', $mobile)->select('user_id', 'email', 'is_test')->orderBy('create_time', 'desc')->first();
} else {
$user = $UserMainModel->where('mobile', $mobile)->select('user_id', 'mobile', 'is_test')->orderBy('create_time', 'desc')->first();
}
if(!empty($user_id)){
$user = $UserMainModel->where('user_id', $user_id)->select('user_id', 'email', 'is_test')->orderBy('create_time', 'desc')->first();
}else{
if (preg_match('/@/', $mobile)) {
$user = $UserMainModel->where('email', $mobile)->select('user_id', 'email', 'is_test')->orderBy('create_time', 'desc')->first();
} else {
$user = $UserMainModel->where('mobile', $mobile)->select('user_id', 'mobile', 'is_test')->orderBy('create_time', 'desc')->first();
}
}
if (!empty($user)) {
$perm = new PermController;
......
......@@ -31,9 +31,10 @@
var loading = this;
// 获取用户信息
$('.get-user').click(function(){
var mobile = $(this).siblings('.search-user').val();
function get_user(){
// var mobile = $(this).siblings('.search-user').val();
var mobile = getUrlParam('user_id');
if (!mobile) return false;
// 自营其他订单类型---仓库损耗
......@@ -46,7 +47,7 @@
$.ajax({
url: '/ajax/getUserInfo',
type: 'post',
data: {mobile : mobile.trim(), goods_type: goods_type},
data: {user_id : mobile.trim(), goods_type: goods_type},
dataType: 'json',
success: function (resp) {
if (resp.errcode == 0) {
......@@ -99,7 +100,9 @@
layer.msg(resp.errmsg)
},
})
})
}
get_user();
// 选择收货地址
$('.user-info').delegate('#address', 'change', function() {
......@@ -969,4 +972,11 @@
},
}
});
})(jQuery)
\ No newline at end of file
})(jQuery)
//获取url中的参数
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
var r = window.location.search.substr(1).match(reg); //匹配目标参数
if (r != null) return unescape(r[2]); return null; //返回参数值
}
\ No newline at end of file
......@@ -5,7 +5,7 @@
<div class="ibox-content create-order">
<div class="row" style="margin-bottom: 30px;">
<div class="col-sm-12">
<div class="col-sm-12" hidden>
<input type="text" class="search-user" name="user-mobile" value="" placeholder="请输入会员账号">
<a class="btn btn-info get-user">获取用户信息</a>
......
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 sign in to comment