Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f1360c56
authored
Mar 07, 2022
by
朱继来
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'zjl_order_limit_20220218'
parents
30c3a842
22a1aed7
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
146 additions
and
62 deletions
app/Http/Controllers/AddOrderController.php
app/Http/Controllers/OrderController.php
app/Model/InvoiceCompanyModel.php
public/js/add_order.js
public/js/change_order.js
resources/views/changeOrder/content.blade.php
app/Http/Controllers/AddOrderController.php
View file @
f1360c56
...
...
@@ -259,11 +259,12 @@ Class AddOrderController extends Controller
// 选择发票信息
public
function
selectInv
(
Request
$request
)
{
if
(
$request
->
isMethod
(
'post'
))
{
$tax_id
=
$request
->
input
(
'tax_id'
);
$invoice
=
TaxInfoModel
::
where
(
'tax_id'
,
$tax_id
)
->
first
();
if
(
!
$invoice
)
return
[
'errcode'
=>
0
,
'errmsg'
=>
''
];
$invoice
->
province_val
=
$invoice
->
consignee_province
?
$this
->
getAddress
(
$invoice
->
consignee_province
)
:
''
;
$invoice
->
city_val
=
$invoice
->
consignee_city
?
$this
->
getAddress
(
$invoice
->
consignee_city
)
:
''
;
$invoice
->
district_val
=
$invoice
->
consignee_district
?
$this
->
getAddress
(
$invoice
->
consignee_district
)
:
''
;
...
...
@@ -273,17 +274,20 @@ Class AddOrderController extends Controller
$company_info
=
InvoiceCompanyModel
::
where
(
'com_name'
,
$invoice
->
tax_title
)
->
first
();
if
(
$company_info
)
{
if
(
$company_info
[
'company_category'
]
==
3
)
return
[
'errcode'
=>
1
,
'errmsg'
=>
'该客户为黑名单客户,禁止下单!'
];
$invoice
->
customer_en
=
$company_info
->
customer_en
;
$invoice
->
customer_type
=
$company_info
->
customer_type
;
$invoice
->
product_use_classone_sn
=
$company_info
->
product_use_classone_sn
;
$invoice
->
product_use_classtwo_sn
=
$company_info
->
product_use_classtwo_sn
;
$invoice
->
customer_website
=
$company_info
->
customer_website
;
if
(
$company_info
[
'company_category'
]
==
4
)
return
[
'errcode'
=>
2
,
'errmsg'
=>
'该客户为实体名单客户,是否继续下单!'
,
'data'
=>
$invoice
];
}
}
return
[
'errcode'
=>
0
,
'errmsg'
=>
''
,
'data'
=>
$invoice
];
}
}
// 根据发票类型选择发票信息
public
function
selectInvType
(
Request
$request
)
...
...
@@ -695,7 +699,6 @@ Class AddOrderController extends Controller
// 提交订单
public
function
create
(
Request
$request
)
{
if
(
$request
->
isMethod
(
'post'
))
{
$data
[
'type'
]
=
$request
->
input
(
'type'
);
$data
[
'inv_com_id'
]
=
$request
->
input
(
'inv_com_id'
,
0
);
$data
[
'uid'
]
=
$request
->
input
(
'uid'
);
...
...
@@ -763,7 +766,6 @@ Class AddOrderController extends Controller
return
[
'errcode'
=>
$response
[
'err_code'
],
'errmsg'
=>
$response
[
'err_msg'
],
'data'
=>
[
'order_id'
=>
$response
[
'data'
],
'type'
=>
$data
[
'type'
]]];
}
}
// 提交订单成功页面
public
function
success
(
Request
$request
)
...
...
app/Http/Controllers/OrderController.php
View file @
f1360c56
...
...
@@ -919,6 +919,7 @@ Class OrderController extends Controller
if
(
$count
>
$order_user_limit
)
return
[
'errcode'
=>
11001
,
'errmsg'
=>
'你已达到成交用户上限,请先释放你跟进的已下单用户或联系主管重新分配当前用户'
];
}
if
(
$request
->
user
->
email
!=
'admin@ichunt.com'
)
{
$perm
=
new
PermController
;
$OrderModel
=
new
OrderModel
;
$relation_id
=
[];
...
...
@@ -940,6 +941,7 @@ Class OrderController extends Controller
// 校验此是否为此订单销售或者对应主管,总监
if
(
!
in_array
(
$request
->
user
->
userId
,
$relation_id
))
return
[
'errcode'
=>-
1
,
'errmsg'
=>
'你没有权限操作此销售订单!'
];
}
if
(
!
$request
->
input
(
'pay_time_limit'
))
{
$payTime
=
$request
->
input
(
'payTime'
,
''
);
...
...
app/Model/InvoiceCompanyModel.php
View file @
f1360c56
...
...
@@ -8,8 +8,8 @@ use DB;
class
InvoiceCompanyModel
extends
Model
{
protected
$connection
=
'
web
'
;
protected
$table
=
'
lie_
invoice_company'
;
protected
$connection
=
'
crm
'
;
protected
$table
=
'invoice_company'
;
protected
$primaryKey
=
'id'
;
public
$timestamps
=
false
;
...
...
public/js/add_order.js
View file @
f1360c56
...
...
@@ -259,8 +259,31 @@
data
:
{
tax_id
:
tax_id
},
dataType
:
'json'
,
success
:
function
(
resp
)
{
if
(
resp
.
errcode
==
0
)
{
var
data
=
resp
.
data
;
if
(
resp
.
errcode
==
1
)
{
layer
.
alert
(
resp
.
errmsg
);
return
false
;
}
if
(
resp
.
errcode
==
2
)
{
layer
.
confirm
(
resp
.
errmsg
,
function
(
index
)
{
addInvoiceInfo
(
resp
.
data
)
layer
.
close
(
index
)
});
return
false
;
}
addInvoiceInfo
(
resp
.
data
)
}
})
}
else
{
$
(
'.invoice-content'
).
hide
();
$
(
'.tax_id'
).
val
(
''
);
}
})
// 添加发票信息
function
addInvoiceInfo
(
data
)
{
var
inv_type_val
=
''
;
$
(
'.invoice-content'
).
show
();
...
...
@@ -305,15 +328,7 @@
layer
.
msg
(
'购物车中存在digikey商品,请选择增值税普票或专票'
);
}
}
}
}
})
}
else
{
$
(
'.invoice-content'
).
hide
();
$
(
'.tax_id'
).
val
(
''
);
}
})
// 获取SKU信息
$
(
'.get-sku'
).
click
(
function
()
{
...
...
@@ -762,11 +777,42 @@
// 提交订单
// $('.submit-order').on('click', function() {
$
(
'.submit-order'
).
off
().
on
(
'click'
,
function
()
{
var
self
=
$
(
this
);
$
(
'.submit-order'
).
off
().
on
(
'click'
,
function
()
{
var
tax_id
=
$
(
'.tax_id'
).
val
();
if
(
tax_id
)
{
$
.
ajax
({
url
:
'/ajax/selectInv'
,
type
:
'post'
,
data
:
{
tax_id
:
tax_id
},
dataType
:
'json'
,
success
:
function
(
resp
)
{
if
(
resp
.
errcode
==
1
)
{
layer
.
alert
(
resp
.
errmsg
);
return
false
;
}
if
(
resp
.
errcode
==
2
)
{
layer
.
confirm
(
resp
.
errmsg
,
function
(
index
)
{
createOrder
();
layer
.
close
(
index
)
});
return
false
;
}
createOrder
();
}
})
}
else
{
createOrder
();
}
})
function
createOrder
()
{
var
shipping_type
=
$
(
'#shipping_type'
).
val
();
// 配送方式
var
address_id
=
$
(
'input[name=address_id]'
).
val
();
var
type
=
self
.
data
(
'type'
);
// 1-联营线上,2-自营线上,3-自营线下,4-自营其他业务
var
type
=
$
(
'.submit-order'
)
.
data
(
'type'
);
// 1-联营线上,2-自营线上,3-自营线下,4-自营其他业务
var
cart_ids
=
[];
var
user_id
=
0
;
var
remark
=
$
(
'#remark'
).
val
();
// 订单备注
...
...
@@ -780,7 +826,7 @@
var
is_dgk
=
false
;
$
(
'.shop-table tbody tr'
).
each
(
function
()
{
$
(
'.shop-table tbody tr'
).
each
(
function
()
{
var
cid
=
$
(
this
).
data
(
'cid'
);
cart_ids
.
push
(
cid
);
...
...
@@ -846,7 +892,7 @@
return
false
;
}
if
((
typeof
(
inv_type
)
==
'undefined'
||
inv_type
!=
''
)
&&
!
tax_id
)
{
if
((
typeof
(
inv_type
)
==
'undefined'
||
inv_type
!=
''
)
&&
!
tax_id
)
{
layer
.
msg
(
'请选择发票信息'
);
return
false
;
}
...
...
@@ -923,11 +969,11 @@
var
sale_type
=
$
(
'#sale_type'
).
val
();
var
cart_info
=
[];
$
(
'.shop-table tbody tr'
).
each
(
function
()
{
$
(
'.shop-table tbody tr'
).
each
(
function
()
{
var
gid
=
$
(
this
).
find
(
'.goods_id'
).
text
();
var
num
=
$
(
this
).
find
(
'.goods_num'
).
val
();
cart_info
.
push
({
'gid'
:
gid
,
'num'
:
num
});
cart_info
.
push
({
'gid'
:
gid
,
'num'
:
num
});
})
datax
.
role
=
role
;
// 自营线上下单添加角色
...
...
@@ -935,17 +981,17 @@
$
.
ajax
({
type
:
"POST"
,
url
:
'/ajax/checkStock'
,
data
:
{
cart_info
:
JSON
.
stringify
(
cart_info
),
sale_type
:
sale_type
},
data
:
{
cart_info
:
JSON
.
stringify
(
cart_info
),
sale_type
:
sale_type
},
dataType
:
"json"
,
async
:
false
,
success
:
function
(
resp
)
{
success
:
function
(
resp
)
{
if
(
resp
.
errcode
==
-
1
)
{
var
data
=
eval
(
resp
.
data
);
var
content
=
'<p>'
+
resp
.
errmsg
+
'</p>'
;
var
content
=
'<p>'
+
resp
.
errmsg
+
'</p>'
;
submit
=
false
;
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
content
+=
'<p><span>'
+
(
i
+
1
)
+
'、</span>'
+
data
[
i
][
'goods_name'
]
+
',可用库存:'
+
data
[
i
][
'stock'
]
+
'</p>'
;
content
+=
'<p><span>'
+
(
i
+
1
)
+
'、</span>'
+
data
[
i
][
'goods_name'
]
+
',可用库存:'
+
data
[
i
][
'stock'
]
+
'</p>'
;
}
// 弹出提示
...
...
@@ -970,17 +1016,17 @@
url
:
'/ajax/create'
,
data
:
datax
,
dataType
:
"json"
,
success
:
function
(
resp
)
{
success
:
function
(
resp
)
{
if
(
resp
.
errcode
==
0
)
{
layer
.
msg
(
resp
.
errmsg
);
location
.
href
=
'/addorder/success?order_id='
+
resp
.
data
.
order_id
+
'&type='
+
resp
.
data
.
type
;
location
.
href
=
'/addorder/success?order_id='
+
resp
.
data
.
order_id
+
'&type='
+
resp
.
data
.
type
;
return
false
;
}
else
if
(
resp
.
errcode
==
21024
)
{
layer
.
alert
(
'该用户已进入公司黑名单,具体请联系吴承义,同时订单无法提交'
);
return
false
;
}
else
if
(
resp
.
errcode
==
21030
)
{
layer
.
alert
(
resp
.
errmsg
,
function
()
{
layer
.
alert
(
resp
.
errmsg
,
function
()
{
var
delivery_place
=
$
(
'.delivery_place'
).
val
();
loading
.
lists
(
user_id
,
goods_type
,
is_online
,
delivery_place
);
// 加载购物车列表
...
...
@@ -994,12 +1040,13 @@
},
})
layer
.
msg
(
'订单生成中...'
,
{
icon
:
16
,
time
:
0
,
shade
:
0.3
});
layer
.
msg
(
'订单生成中...'
,
{
icon
:
16
,
time
:
0
,
shade
:
0.3
});
}
}
else
{
layer
.
msg
(
'请先添加商品'
);
}
})
}
// 发货方式
$
(
'.zy_delivery_type'
).
change
(
function
()
{
...
...
public/js/change_order.js
View file @
f1360c56
...
...
@@ -486,7 +486,39 @@
})
// 提交表单
$
(
'.checkOrder'
).
click
(
function
(){
$
(
'.checkOrder'
).
click
(
function
()
{
var
tax_id
=
$
(
'.tax_id'
).
val
();
if
(
tax_id
)
{
$
.
ajax
({
url
:
'/ajax/selectInv'
,
type
:
'post'
,
data
:
{
tax_id
:
tax_id
},
dataType
:
'json'
,
success
:
function
(
resp
)
{
if
(
resp
.
errcode
==
1
)
{
layer
.
alert
(
resp
.
errmsg
);
return
false
;
}
if
(
resp
.
errcode
==
2
)
{
layer
.
confirm
(
resp
.
errmsg
,
function
(
index
)
{
checkOrder
();
layer
.
close
(
index
)
});
return
false
;
}
checkOrder
();
}
})
}
else
{
checkOrder
();
}
})
function
checkOrder
()
{
var
is_newClient
=
$
(
'input[name=is_newClient]:checked'
).
val
();
var
client_source
=
$
(
'input[name=client_source]:checked'
).
val
();
var
order_status
=
$
(
'input[name=order_status]:checked'
).
val
();
...
...
@@ -565,7 +597,7 @@
var
is_all_self
=
true
;
// 全部为自营商品
var
is_all_self_xm
=
true
;
// 全部为自营现货
$
(
'.order-change-table'
).
find
(
'tbody tr'
).
each
(
function
()
{
$
(
'.order-change-table'
).
find
(
'tbody tr'
).
each
(
function
()
{
var
goods_number
=
$
(
this
).
find
(
'.change_goods_number'
).
val
();
var
price
=
$
(
this
).
find
(
'.price'
).
val
();
var
goods_name
=
$
(
this
).
find
(
'.change_goods_name'
).
val
();
...
...
@@ -579,22 +611,22 @@
if
(
goods_number
==
''
||
goods_number
==
0
)
{
change_goods_number
=
true
;
change_str
+=
goods_name
+
'数量不能为0或空 '
;
change_str
+=
goods_name
+
'数量不能为0或空 '
;
}
if
(
price
==
''
||
price
==
0
)
{
change_price
=
true
;
change_str
+=
goods_name
+
'单价不能为0或空 '
;
change_str
+=
goods_name
+
'单价不能为0或空 '
;
}
if
(
order_goods_type
==
1
&&
(
buyer_id
==
null
||
buyer_id
==
''
))
{
change_buyer_id
=
true
;
change_str
+=
goods_name
+
'采购员不能为空 '
;
change_str
+=
goods_name
+
'采购员不能为空 '
;
}
if
(
order_goods_type
==
1
&&
batch
==
''
)
{
change_batch
=
true
;
change_str
+=
goods_name
+
'批次不能为空 '
;
change_str
+=
goods_name
+
'批次不能为空 '
;
}
if
(
supplier_id
!=
10000
)
{
...
...
@@ -621,13 +653,13 @@
}
$
.
ajax
({
url
:
'/api/getOrderFreight'
,
url
:
'/api/getOrderFreight'
,
type
:
'post'
,
data
:
{
order_id
:
order_id
},
data
:
{
order_id
:
order_id
},
dataType
:
'json'
,
async
:
false
,
success
:
function
(
resp
)
{
if
(
resp
.
errcode
==
0
)
{
if
(
resp
.
errcode
==
0
)
{
msg_txt
+=
resp
.
data
;
$
(
'.freight_fee'
).
val
(
resp
.
data
).
trigger
(
'keyup'
);
}
...
...
@@ -651,7 +683,7 @@
if
(
deposit_amount
==
''
)
{
layer
.
msg
(
'请填写定金金额'
);
return
false
;
}
else
if
(
deposit_amount
==
0
)
{
}
else
if
(
deposit_amount
==
0
)
{
layer
.
msg
(
'定金金额不能为0'
);
return
false
;
}
...
...
@@ -697,7 +729,7 @@
var
check_failed_info
=
''
;
// 检查商品单价
$
(
'.order-change-table'
).
find
(
'tbody tr'
).
each
(
function
()
{
$
(
'.order-change-table'
).
find
(
'tbody tr'
).
each
(
function
()
{
var
origin_price
=
parseFloat
(
$
(
this
).
find
(
'.price'
).
data
(
'origin'
));
var
price
=
parseFloat
(
$
(
this
).
find
(
'.price'
).
val
())
||
0
;
var
goods_name
=
$
(
this
).
find
(
'.change_goods_name'
).
val
();
...
...
@@ -706,7 +738,7 @@
// 若商品单价降价幅度小于或等于20%则赋值
if
(
price
<=
limit_price
)
{
check_failed_info
+=
'型号:'
+
goods_name
+
',单价:'
+
origin_price
+
' -> '
+
price
+
' | '
;
check_failed_info
+=
'型号:'
+
goods_name
+
',单价:'
+
origin_price
+
' -> '
+
price
+
' | '
;
$
(
'input[name=check_failed]'
).
val
(
1
);
$
(
'input[name=check_failed_info]'
).
val
(
check_failed_info
);
}
...
...
@@ -727,21 +759,21 @@
var
order_type_extend
=
$
(
'#order_type_extend'
).
val
();
var
content
=
'<div class="submit-check">'
;
content
+=
'<p class="error">请仔细核对订单金额,谨慎操作!'
+
msg_txt
+
'</p>'
;
content
+=
'<p><label>商品总金额:</label>'
+
currencySign
+
goods_amount
+
'</p>'
;
content
+=
'<p><label>优惠金额:</label>'
+
discount_amount
+
'</p>'
+
'<p><label>附加费金额:</label>'
+
extra_fee
+
'</p>'
+
'<p><label>运费金额:</label>'
+
freight_fee
+
'</p>'
+
'<p><label>订单总金额:</label><span class="error">'
+
currencySign
+
order_amount
+
'</span></p>'
;
content
+=
'<p class="error">请仔细核对订单金额,谨慎操作!'
+
msg_txt
+
'</p>'
;
content
+=
'<p><label>商品总金额:</label>'
+
currencySign
+
goods_amount
+
'</p>'
;
content
+=
'<p><label>优惠金额:</label>'
+
discount_amount
+
'</p>'
+
'<p><label>附加费金额:</label>'
+
extra_fee
+
'</p>'
+
'<p><label>运费金额:</label>'
+
freight_fee
+
'</p>'
+
'<p><label>订单总金额:</label><span class="error">'
+
currencySign
+
order_amount
+
'</span></p>'
;
if
(
order_goods_type
==
1
)
{
content
+=
'</div>'
;
var
url
=
'/details/'
+
order_id
;
var
url
=
'/details/'
+
order_id
;
}
else
{
content
+=
'<p><label>支付优惠:</label>'
+
pay_preferential
+
'</p>'
+
'<p><label>实际支付金额:</label><span class="error">'
+
currencySign
+
last_paid
+
'</span></p>'
+
content
+=
'<p><label>支付优惠:</label>'
+
pay_preferential
+
'</p>'
+
'<p><label>实际支付金额:</label><span class="error">'
+
currencySign
+
last_paid
+
'</span></p>'
+
'</div>'
;
var
url
=
'/details/'
+
order_id
+
'?tags=self'
;
var
url
=
'/details/'
+
order_id
+
'?tags=self'
;
}
// 弹出提示
...
...
@@ -749,17 +781,17 @@
area
:
[
'360px'
],
title
:
'提示信息'
,
content
:
content
,
btn
:[
'确定'
,
'取消'
],
yes
:
function
(
index
,
layero
)
{
btn
:
[
'确定'
,
'取消'
],
yes
:
function
(
index
,
layero
)
{
$
.
ajax
({
url
:
'/ajaxSaveChange'
,
url
:
'/ajaxSaveChange'
,
type
:
'post'
,
data
:
$
(
'#checkOrderForm'
).
serialize
(),
dataType
:
'json'
,
success
:
function
(
resp
)
{
if
(
resp
.
errcode
==
0
)
{
if
(
resp
.
errcode
==
0
)
{
layer
.
msg
(
resp
.
errmsg
||
'操作成功'
);
setTimeout
(
function
()
{
setTimeout
(
function
()
{
// location.reload();
location
.
href
=
url
;
},
1000
);
...
...
@@ -779,13 +811,13 @@
}
})
layer
.
msg
(
'审核提交中...'
,
{
icon
:
16
,
time
:
0
,
shade
:
0.3
});
// 阻止重复提交
layer
.
msg
(
'审核提交中...'
,
{
icon
:
16
,
time
:
0
,
shade
:
0.3
});
// 阻止重复提交
},
btn2
:
function
(
index
,
layero
)
{
btn2
:
function
(
index
,
layero
)
{
layer
.
close
(
index
);
}
});
}
)
}
// 临时保存
$
(
'.tempSave'
).
click
(
function
()
{
...
...
resources/views/changeOrder/content.blade.php
View file @
f1360c56
...
...
@@ -32,6 +32,7 @@
<input
type=
"hidden"
name=
"check_failed_info"
value=
""
>
<input
type=
"hidden"
name=
"change_pay_type"
value=
""
>
<input
type=
"hidden"
name=
"business_type"
value=
"{{$order_temp_info['business_type']}}"
>
<input
type=
"hidden"
class=
"tax_id"
name=
"tax_id"
value=
"{{ isset($order_invoice_info['tax_id']) ? $order_invoice_info['tax_id'] : '' }}"
>
<?php
$isNewClient
=
App\Http\Controllers\isNewClient
(
$order_info
[
'order_goods_type'
],
$order_info
[
'user_id'
],
$order_info
[
'create_time'
]);
?>
@if ($isNewClient)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment