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
8cc80fd3
authored
Dec 16, 2019
by
allen
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
订单周迭代
parent
5cff11f3
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
446 additions
and
71 deletions
app/Http/Controllers/ApiController.php
app/Http/Controllers/OrderController.php
app/Http/Function.php
app/Http/routes.php
app/Model/CmsModel.php
public/js/order.js
resources/views/detail/content.blade.php
app/Http/Controllers/ApiController.php
View file @
8cc80fd3
...
...
@@ -193,6 +193,13 @@ class ApiController extends Controller
$data
[
'id'
]
=
$request
->
input
(
'id'
);
$data
[
'remarks'
]
=
$request
->
input
(
'remarks'
);
$data
[
'buyerId'
]
=
$request
->
input
(
'userId'
);
//采购id
$data
[
'batch'
]
=
$request
->
input
(
'batch'
);
//采购id
if
(
$data
[
'buyerId'
]
==
-
1
){
unset
(
$data
[
'buyerId'
]);
}
$result
=
$OrderItemsModel
->
updateData
(
$data
);
...
...
@@ -204,4 +211,22 @@ class ApiController extends Controller
}
/*
检查内部系统用户是否存在
*/
public
function
check_user_exists
(
$request
){
$CmsModel
=
new
CmsModel
();
$userName
=
$request
->
input
(
'user'
);
$user_info
=
$CmsModel
->
getUserInfo
(
array
(
'name'
=>
$userName
));
if
(
$user_info
){
$this
->
Export
(
1
,
'success'
,
$user_info
[
'userId'
]);
}
else
{
$this
->
Export
(
-
1
,
'error'
);
}
}
}
app/Http/Controllers/OrderController.php
View file @
8cc80fd3
...
...
@@ -17,6 +17,7 @@ use App\Model\UserMainModel;
use
App\Model\OrderActionLogModel
;
use
App\Model\OrderReturnModel
;
use
App\Model\OrderItemsTrackModel
;
use
App\Model\CmsModel
;
use
Session
;
use
Hprose\Http\Client
;
...
...
@@ -754,6 +755,12 @@ Class OrderController extends Controller
public
function
templateData
(
Request
$request
,
$id
,
$view_id
)
{
$info
=
$this
->
orderDetail
(
$request
,
$id
);
//获取数组中的采购人id的名字
$this
->
getBuyerName
(
$info
);
// dump($info['order_temp_info']);exit;
$this
->
pageHeader
(
$request
,
$info
,
'订单详情'
);
if
(
$info
[
'order_info'
][
'order_goods_type'
]
==
2
&&
in_array
(
$info
[
'order_info'
][
'order_type'
],
[
1
,
3
]))
{
// 平台自营订单
...
...
@@ -767,6 +774,38 @@ Class OrderController extends Controller
return
view
(
$view_id
,
$info
);
}
/*
获取采购人名称
*/
public
function
getBuyerName
(
&
$info
){
if
(
count
(
$info
[
'order_items_info'
])
<=
0
){
return
;
}
foreach
(
$info
[
'order_items_info'
]
as
$key
=>
$value
)
{
$data
[]
=
$value
[
'buyerid'
];
}
$CmsModel
=
new
CmsModel
();
$name_data
=
$CmsModel
->
getBatchUserName
(
$data
);
foreach
(
$info
[
'order_items_info'
]
as
$key
=>
$value
)
{
foreach
(
$name_data
as
$k
=>
$v
)
{
if
(
$v
[
'userId'
]
==
$value
[
'buyerid'
]){
$info
[
'order_items_info'
][
$key
][
'buyerName'
]
=
$v
[
'name'
];
$info
[
'order_items_info'
][
$key
][
'send_email'
]
=
$v
[
'email'
];
break
;
//找到了就不必再循环这个数组了
}
}
}
}
// 详情页自营其他数据
public
function
selfOtherData
(
&
$info
,
$order_id
)
{
...
...
@@ -2025,4 +2064,100 @@ Class OrderController extends Controller
});
}
/*
发送邮件
*/
public
function
send_mail
(
Request
$request
){
$id
=
$_REQUEST
[
'id'
];
$info
=
$this
->
orderDetail
(
$request
,
$id
);
// $info['order_items_info'];
// $info['order_temp_info']['erp_sn'] =
// dump($info);exit;
//获取数组中的采购人id的名字
$this
->
getBuyerName
(
$info
);
//循环订单详情
foreach
(
$info
[
'order_items_info'
]
as
$key
=>
$value
)
{
$tmp
[
'orderNum'
]
=
$info
[
'order_temp_info'
][
'erp_sn'
];
$tmp
[
'goods'
]
=
$value
[
'goods_name'
];
$tmp
[
'purchasingPrice'
]
=
$value
[
'goods_price'
];
//采购价
$tmp
[
'unitPrice'
]
=
$value
[
'goods_price'
];
//单价
$tmp
[
'brand'
]
=
$value
[
'brand_name'
];
$tmp
[
'nums'
]
=
$value
[
'goods_number'
];
$tmp
[
'currency'
]
=
$info
[
'order_info'
][
'currency'
]
==
1
?
'人民币'
:
'美元'
;
$tmp
[
'totalPrice'
]
=
$value
[
'goods_amount'
];
$tmp
[
'remarks'
]
=
$value
[
'remarks'
];
$tmp
[
'material'
]
=
$value
[
'erp_rec_id'
];
$tmp
[
'purchasing'
]
=
!
empty
(
$value
[
'buyerName'
])
?
$value
[
'buyerName'
]
:
''
;
$tmp
[
'projectId'
]
=
$key
+
1
;
if
(
empty
(
$value
[
'batch'
])){
$msg
=
'商品:'
.
$tmp
[
'goods'
]
.
'缺少批次<br/>'
.
'请填写批次后再发送'
;
echo
json_encode
([
'errcode'
=>-
1
,
'errmsg'
=>
$msg
]);
exit
;
}
//批次
$tmp
[
'deliveryTime'
]
=
$value
[
'batch'
];
$tmp
[
'send_email'
]
=
!
empty
(
$value
[
'send_email'
])
?
$value
[
'send_email'
]
:
''
;
$data
[
'data'
][]
=
$tmp
;
}
//循环出邮件接收人
foreach
(
$data
[
'data'
]
as
$key
=>
$value
)
{
$send_mail_array
[]
=
$value
[
'send_email'
];
}
$send_mail_array
=
array_unique
(
$send_mail_array
);
$data
[
'combined'
]
=
$info
[
'order_info'
][
'order_amount'
];
$data
[
'order_amount'
]
=
$info
[
'order_info'
][
'order_amount'
];
$data
[
'date'
]
=
date
(
'Y-m-d'
,
time
());
if
(
empty
(
$send_mail_array
[
0
])){
echo
json_encode
([
'errcode'
=>-
1
,
'errmsg'
=>
'没有填写采购人员,请至少填写一个采购人员'
]);
exit
;
}
$data
[
'toUser'
]
=
$send_mail_array
[
0
];
unset
(
$send_mail_array
[
0
]);
$data
[
'ccUser'
]
=
$send_mail_array
;
$CmsModel
=
new
CmsModel
();
//获取业务员
$data
[
'id'
]
=
$CmsModel
->
getUserName
(
$info
[
'order_info'
][
'sale_id'
]);
$crm_url
=
Config
(
'website.crm_domain'
)
.
'/api/sendCaiGouEmailByOrderAdmin'
;
$data
=
json_encode
(
$data
);
$crm_header
=
array
(
'api-key: crm a1b2c3d4e5f6g7h8i9jk'
);
$res
=
json_decode
(
post_curl
(
$crm_url
,
$data
,
$crm_header
));
if
(
$res
->
err_code
==
0
){
echo
json_encode
([
'errcode'
=>
1
,
'errmsg'
=>
'发送成功'
]);
exit
;
}
else
{
echo
json_encode
([
'errcode'
=>-
1
,
'errmsg'
=>
$res
->
msg
]);
exit
;
}
}
}
\ No newline at end of file
app/Http/Function.php
View file @
8cc80fd3
...
...
@@ -482,4 +482,29 @@ function S_hash($key, $field='', $value='')
}
return
$redis
->
hset
(
$key
,
$field
,
$value
);
}
// curl post
function
post_curl
(
$url
,
$data
,
$headers
=
array
(),
$cookie
=
""
)
{
$ch
=
curl_init
();
curl_setopt
(
$ch
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$ch
,
CURLOPT_HEADER
,
0
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$ch
,
CURLOPT_POST
,
1
);
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
$data
);
curl_setopt
(
$ch
,
CURLOPT_TIMEOUT
,
3
);
if
(
count
(
$headers
)){
curl_setopt
(
$ch
,
CURLOPT_HTTPHEADER
,
$headers
);
}
if
(
$cookie
){
curl_setopt
(
$ch
,
CURLOPT_COOKIE
,
$cookie
);
}
if
(
strpos
(
$url
,
'https://'
)
!==
false
)
{
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYHOST
,
1
);
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYPEER
,
false
);
}
$output
=
curl_exec
(
$ch
);
curl_close
(
$ch
);
return
$output
;
}
\ No newline at end of file
app/Http/routes.php
View file @
8cc80fd3
...
...
@@ -62,6 +62,7 @@ Route::group(['middleware' => 'web'], function () {
Route
::
resource
(
'/prompt'
,
'PromptController@index'
);
Route
::
get
(
'/count'
,
'OrderCountController@count'
);
Route
::
post
(
'/send_mail'
,
'OrderController@send_mail'
);
Route
::
get
(
'/self_count'
,
'OrderCountController@selfCount'
);
Route
::
get
(
'/amount'
,
'OrderCountController@amount'
);
Route
::
get
(
'/self_amount'
,
'OrderCountController@selfAmount'
);
...
...
app/Model/CmsModel.php
View file @
8cc80fd3
...
...
@@ -20,4 +20,20 @@ class CmsModel extends Model
return
$user
?
$user
->
name
:
''
;
}
/*
查询cms系统用户信息
*/
public
function
getUserInfo
(
$where
){
return
$this
->
where
(
$where
)
->
select
(
'userId'
)
->
first
();
}
/*
批量查询用户姓名
*/
public
function
getBatchUserName
(
$user_ids
){
return
$this
->
whereIn
(
'userId'
,
$user_ids
)
->
select
(
'userId'
,
'name'
,
'email'
)
->
get
()
->
toArray
();
}
}
\ No newline at end of file
public/js/order.js
View file @
8cc80fd3
...
...
@@ -614,76 +614,61 @@
default
:
title
=
'填写订单取消原因'
;
break
;
}
var
content
=
'<div class="form-group">'
+
'<label>
附加费选项:
</label>'
+
var
content
=
'<div class="form-group">'
+
'<label>
网站数据不准:
</label>'
+
'<div class="input-radio">'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="产地税">产地税</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="关税">关税</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="3C商检">3C商检</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="运费">运费</label>'
+
'</div>'
+
'</div>'
+
'<div class="form-group">'
+
'<label>信息错误需重新下单选项:</label>'
+
'<div class="input-radio">'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="更改客户基本信息">更改客户基本信息</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="更改料号/数量/单价">更改料号/数量/单价</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="更改支付方式">更改支付方式</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="更改交易方式">更改交易方式</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="更改使用优惠券">更改使用优惠券</label>'
+
'</div>'
+
'</div>'
+
'<div class="form-group">'
+
'<label>不满足选项:</label>'
+
'<div class="input-radio">'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="交期问题">交期问题</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="批次问题">批次问题</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="包装问题">包装问题</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="代购渠道不出货">代购渠道不出货</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="价格无法满足">价格无法满足</label>'
+
'<label class="radio-inline"><input type="checkbox" name="cancel_reason" value="价格不准">价格不准</label>'
+
'<label class="radio-inline"><input type="checkbox" name="cancel_reason" value="库存数量不准">库存数量不准</label>'
+
'<label class="radio-inline"><input type="checkbox" name="cancel_reason" value="批次不准(或者没有)">批次不准(或者没有)</label>'
+
'<label class="radio-inline"><input type="checkbox" name="cancel_reason" value="货期不准">货期不准</label>'
+
'</div>'
+
'</div>'
+
'<div class="form-group">'
+
'<label>
报关问题选项:
</label>'
+
'<label>
更改订单信息:
</label>'
+
'<div class="input-radio">'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="无法归类">无法归类</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="禁运物料">禁运物料</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="无法操作报关物料">无法操作报关物料</label>'
+
'<label class="radio-inline"><input type="checkbox" name="cancel_reason" value="更改发票信息">更改发票信息</label>'
+
'<label class="radio-inline"><input type="checkbox" name="cancel_reason" value="更改收票地址">更改收票地址</label>'
+
'<label class="radio-inline"><input type="checkbox" name="cancel_reason" value="增删改型号/数量">增删改型号/数量</label>'
+
'<label class="radio-inline"><input type="checkbox" name="cancel_reason" value="需使用或更改优惠券">需使用或更改优惠券</label>'
+
'<label class="radio-inline"><input type="checkbox" name="cancel_reason" value="更改付款方式">更改付款方式</label>'
+
'</div>'
+
'</div>'
+
'<div class="form-group">'
+
'<label>
代购渠道问题选项:
</label>'
+
'<label>
额外附加费:
</label>'
+
'<div class="input-radio">'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="货已出">货已出</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="库存不够">库存不够</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="采购漏下单">采购漏下单</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="供应商漏发货">供应商漏发货</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="渠道涨价">渠道涨价</label>'
+
'<label class="radio-inline"><input type="checkbox" name="cancel_reason" value="产地税">产地税</label>'
+
'<label class="radio-inline"><input type="checkbox" name="cancel_reason" value="关税">关税</label>'
+
'<label class="radio-inline"><input type="checkbox" name="cancel_reason" value="3C商检">3C商检</label>'
+
'<label class="radio-inline"><input type="checkbox" name="cancel_reason" value="运费">运费</label>'
+
'</div>'
+
'</div>'
+
'<div class="form-group">'
+
'<label>客户
问题选项:
</label>'
+
'<label>客户
需求变动:
</label>'
+
'<div class="input-radio">'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="客户找到更优货源">客户找到更优货源</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="客户需求变动">客户需求变动</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="客户测试">客户测试</label>'
+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="更改相关信息(支付方式,优惠券)">更改相关信息(支付方式,优惠券)</label>'
+
'<label class="radio-inline"><input type="checkbox" name="cancel_reason" value="客户找到更优渠道">客户找到更优渠道</label>'
+
'<label class="radio-inline"><input type="checkbox" name="cancel_reason" value="客户上游取消需求">客户上游取消需求</label>'
+
'</div>'
+
'</div>'
+
'<div class="form-group">'
+
'<label>
非代购渠道选项:
</label>'
+
'<label>
其他问题:
</label>'
+
'<div class="input-radio">'
+
'<label class="radio-inline"><input type="
radio" name="cancel_reason" value="价格上涨">价格上涨
</label>'
+
'<label class="radio-inline"><input type="
radio" name="cancel_reason" value="库存变动">库存变动
</label>'
+
'<label class="radio-inline"><input type="
radio" name="cancel_reason" value="订单审核过久">订单审核过久
</label>'
+
'<label class="radio-inline"><input type="
radio" name="cancel_reason" value="测试订单">测试订单
</label>'
+
'<label class="radio-inline"
><input type="radio" name="cancel_reason" value="1">其他
</label>'
+
'<label class="radio-inline"><input type="
checkbox" name="cancel_reason" value="采购漏下单">采购漏下单
</label>'
+
'<label class="radio-inline"><input type="
checkbox" name="cancel_reason" value="订单处理时间较长,供应商库存不足">订单处理时间较长,供应商库存不足
</label>'
+
'<label class="radio-inline"><input type="
checkbox" name="cancel_reason" value="管制、禁运物料">管制、禁运物料
</label>'
+
'<label class="radio-inline"><input type="
checkbox" name="cancel_reason" value="商品报关无法归类">商品报关无法归类
</label>'
+
'<label class="radio-inline"
style="margin-left:0px"><input type="checkbox" name="cancel_reason" value="客户测试下单">客户测试下单
</label>'
+
'</div>'
+
'</div>'
;
'<div class="input-other-reason" style="display:none;">'
+
'<textarea class="form-control" name="input-other-reason" placeholder="请填写其他原因"></textarea>'
+
'</div>'
+
'</div>'
;
layer
.
open
({
area
:
[
'800px'
],
...
...
@@ -691,9 +676,22 @@
content
:
content
,
btn
:[
'确认'
,
'取消'
],
btn1
:
function
(
index
){
var
cancel_reason
=
$
(
'input[name=cancel_reason]:checked'
).
val
();
// var cancel_reason = $('input[name=cancel_reason]:checked').val();
$select
=
new
Array
();
$
(
'input[name=cancel_reason]:checked'
).
each
(
function
(
data
,
select_check
){
$select
[
data
]
=
(
$
(
select_check
).
val
());
})
cancel_reason
=
$select
.
join
(
', '
);
var
other_reason
=
$
(
'textarea[name=input-other-reason]'
).
val
();
if
(
cancel_reason
==
null
)
{
layer
.
tips
(
'请选择取消原因'
,
$
(
'.input-radio'
));
return
false
;
...
...
resources/views/detail/content.blade.php
View file @
8cc80fd3
...
...
@@ -472,11 +472,13 @@
<th>
货期
</th>
@if ($order_info['order_goods_type'] == 1)
<th>
供应商
</th>
<th>
采购员
</th>
@endif
<th>
自采标记
</th>
<th
hidden
>
批号
</th>
@if ($order_info['order_goods_type'] == 1)
<th>
生产跟踪
</th>
@endif
...
...
@@ -486,6 +488,10 @@
<th>
备注
</th>
@endif
<th>
</th>
<?php
if
(
$action_name
==
'changeOrder'
&&
count
(
$order_items_info
)
>
1
&&
in_array
(
$order_info
[
'status'
],
[
1
,
2
]))
{
echo
'<th>操作</th>'
;
...
...
@@ -523,7 +529,13 @@
<td>
{{$v['delivery_time']}}
</td>
@if ($order_info['order_goods_type'] == 1)
<td>
{{$v['supplier_name']}}
</td>
<td>
<div
class=
"buyerName"
>
<?php
echo
!
empty
(
$v
[
'buyerName'
])
?
$v
[
'buyerName'
]
:
''
;
?>
</div>
</td>
@endif
<td>
...
...
@@ -537,6 +549,10 @@
</td>
<td
hidden
class=
"batch"
>
<?php
echo
!
empty
(
$v
[
'batch'
])
?
$v
[
'batch'
]
:
''
;
?>
</td>
@if ($order_info['order_goods_type'] == 1)
...
...
@@ -544,17 +560,18 @@
@endif
@if (empty($_REQUEST['tags']))
<td>
<td
class=
"remarks"
>
@if(!empty($v['remarks']))
{{$v['remarks']}}
@else
<button
type=
"button"
class=
"btn btn-success btn-xs remarks"
>
填写备注
</button>
@endif
</td>
@endif
<td>
<button
type=
"button"
class=
"btn btn-success btn-xs remarks"
>
填写备注
</button>
</td>
@if ($action_name == 'changeOrder'
&&
count($order_items_info) > 1
&&
in_array($order_info['status'], [1, 2]))
<td><a
class=
"btn btn-danger deletegoods"
href=
"javascript:;"
data-id=
"{{$v['rec_id']}}"
>
删除
</a></td>
...
...
@@ -793,6 +810,14 @@
<a
class=
"btn btn-info"
href=
"{{URL('change', ['order_id'=>$order_info['order_id']])}}"
>
人工审单
</a>
@endif
<!-- 判断邮件发送时机 -->
@if (!empty($order_temp_info['erp_sn']) )
@if ( (!empty($order_pay_log[0]['is_paid'])
&&
$order_pay_log[0]['is_paid'] == 1) ||
(!empty($order_pay_log[0]['pay_type'])
&&
$order_pay_log[0]['pay_type'] == 4) )
<a
class=
"btn btn-success send_mail"
>
发送邮件
</a>
@endif
@endif
<!-- 预付款 管理员完成首款对账后改变'对账'按钮 -->
@if (in_array($order_info['status'], [2, 3])
&&
in_array('check_account', $userPerms))
@if ($order_info['status'] == 3
&&
(!empty($order_pay_log)
&&
$order_pay_log[0]['pay_type'] != ''))
...
...
@@ -1023,26 +1048,172 @@
$
.
lie
.
order
.
details
();
$
.
lie
.
goods
.
add
();
$
(
function
(){
$
(
'.remarks'
).
click
(
function
(){
//备注填写确定按钮被点击
$
(
document
).
on
(
'click'
,
'.remarks_enter'
,
function
(){
user_id
=
-
1
;
//获取备注
$remarks
=
$
(
'#remarks_input'
).
val
();
// console.log('备注:'+$remarks);
//采购员
$remarks_user
=
$
(
'#remarks_user'
).
val
();
// console.log('采购员:'+$remarks_user);
//批次
$batch
=
$
(
'#batch'
).
val
();
// console.log($batch);
//检查采购员是否存在
if
(
$remarks_user
.
length
>
0
){
$id
=
$
(
this
).
parent
().
parent
().
find
(
'.order-track'
).
attr
(
'data-rid'
);
$
.
ajaxSettings
.
async
=
false
;
$
.
post
(
"/api/check_user_exists"
,{
user
:
$remarks_user
},
function
(
result
)
{
//请求处理
console
.
log
(
result
);
layer
.
prompt
({
title
:
'请输入备注信息'
,
formType
:
3
},
function
(
$remarks
,
index
){
if
(
result
.
errmsg
==
'error'
){
alert
(
'采购员不存在或未录入系统,请确认后再填写'
)
return
false
;
}
else
{
user_id
=
result
.
data
}
$
.
post
(
'/api/update_order_items'
,{
id
:
$id
,
remarks
:
$remarks
},
function
(
data
){
if
(
data
.
errcode
==
1
){
history
.
go
(
0
)
}
},
"json"
);
},
'json'
)
$
.
ajaxSettings
.
async
=
true
;
}
if
(
$remarks_user
.
length
>
0
&&
user_id
==
-
1
){
return
false
;
}
layer
.
close
(
index
);
if
(
$remarks
.
length
>
0
||
user_id
>
0
||
$batch
.
length
>
0
){
$
.
post
(
'/api/update_order_items'
,{
id
:
$id
,
remarks
:
$remarks
,
userId
:
user_id
,
batch
:
$batch
},
function
(
data
){
if
(
data
.
errcode
==
1
){
history
.
go
(
0
)
}
},
'json'
)
}
else
{
alert
(
'您未填写任何信息,请至少填写一处'
);
return
false
;
}
})
//备注填写确定按钮被点击
$
(
document
).
on
(
'click'
,
'.remarks_cancel'
,
function
(){
console
.
log
(
'cancel'
);
layer
.
close
(
index_windows
);
})
$
(
document
).
on
(
'click'
,
'.send_mail'
,
function
(
data
){
var
$id
=
"{{$order_info['order_id']}}"
;
$
.
post
(
'/send_mail'
,{
id
:
$id
},
function
(
data
){
if
(
data
.
errcode
==
1
){
layer
.
msg
(
'邮件发送成功'
);
history
.
go
(
0
)
}
else
{
layer
.
msg
(
data
.
errmsg
);
}
},
'json'
)
})
$
(
function
(){
$
(
'.remarks'
).
click
(
function
(){
$id
=
$
(
this
).
parent
().
parent
().
find
(
'.order-track'
).
attr
(
'data-rid'
);
//展示采购员
$buyerName
=
trim
(
$
(
this
).
parent
().
parent
().
find
(
'.buyerName'
).
html
());
// console.log($buyerName);
//展示备注
$remarks
=
trim
(
$
(
this
).
parent
().
parent
().
find
(
'.remarks'
).
html
());
// console.log($remarks);
//展示批次
$batch
=
trim
(
$
(
this
).
parent
().
parent
().
find
(
'.batch'
).
html
());
// console.log($batch);
index_windows
=
layer
.
open
({
type
:
1
,
skin
:
'layui-layer-demo'
,
//样式类名
closeBtn
:
0
,
//不显示关闭按钮
anim
:
2
,
shadeClose
:
true
,
//开启遮罩关闭
content
:
'
<
div
>
<
h2
>&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
编辑信息
<
/h2>
\
<
br
/><
div
>&
nbsp
;
&
nbsp
;
批次
:
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
<
input
id
=
"batch"
value
=
"'+$batch+'"
><
br
/>
\
<
br
/>
<
div
>&
nbsp
;
&
nbsp
;
采购员
:
<
input
id
=
"remarks_user"
value
=
"'+$buyerName+'"
>
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
<
/div> <br/
>
\
<
div
>&
nbsp
;
&
nbsp
;
备注
:
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
<
input
id
=
"remarks_input"
value
=
"'+$remarks+'"
><
/div>
\
<
br
/>\
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
\
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
\
<
button
type
=
"button"
class
=
"layui-btn remarks_enter layui-btn-primary"
>
确定
<
/button>
\
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
\
<
button
type
=
"button"
class
=
"layui-btn remarks_cancel layui-btn-primary"
>
取消
<
/button>
\
<
br
/><
br
/>\
<
/div>
'
});
})
$
(
'.send_mail'
).
click
(
function
(){
console
.
log
(
'send_mail'
)
})
})
//供使用者调用
function
trim
(
s
){
return
trimRight
(
trimLeft
(
s
));
}
//去掉左边的空白
function
trimLeft
(
s
){
if
(
s
==
null
)
{
return
""
;
}
var
whitespace
=
new
String
(
" \t\n\r"
);
var
str
=
new
String
(
s
);
if
(
whitespace
.
indexOf
(
str
.
charAt
(
0
))
!=
-
1
)
{
var
j
=
0
,
i
=
str
.
length
;
while
(
j
<
i
&&
whitespace
.
indexOf
(
str
.
charAt
(
j
))
!=
-
1
){
j
++
;
}
str
=
str
.
substring
(
j
,
i
);
}
return
str
;
}
//去掉右边的空白 www.2cto.com
function
trimRight
(
s
){
if
(
s
==
null
)
return
""
;
var
whitespace
=
new
String
(
" \t\n\r"
);
var
str
=
new
String
(
s
);
if
(
whitespace
.
indexOf
(
str
.
charAt
(
str
.
length
-
1
))
!=
-
1
){
var
i
=
str
.
length
-
1
;
while
(
i
>=
0
&&
whitespace
.
indexOf
(
str
.
charAt
(
i
))
!=
-
1
){
i
--
;
}
str
=
str
.
substring
(
0
,
i
+
1
);
}
return
str
;
}
</script>
\ No newline at end of file
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