|
|
|
@ -1,16 +1,16 @@
|
|
|
|
|
$(document).on('turbolinks:load', function() {
|
|
|
|
|
if ($('body.admins-salesmans-index-page').length > 0) {
|
|
|
|
|
if ($('body.admins-salesman-customers-index-page').length > 0) {
|
|
|
|
|
|
|
|
|
|
// ============= 添加销售人员 ==============
|
|
|
|
|
var $addMemberModal = $('.admin-add-salesman-customer-user-modal');
|
|
|
|
|
var $addMemberForm = $addMemberModal.find('.admin-add-salesman-customer-user-form');
|
|
|
|
|
var $memberSelect = $addMemberModal.find('.salesman-user-select');
|
|
|
|
|
// var $salesmanIdInput = $addMemberForm.find('input[name="salesman_id"]')
|
|
|
|
|
var $memberSelect = $addMemberModal.find('.salesman-customer-user-select');
|
|
|
|
|
var $salesmanIdInput = $('.salesman-customer-list-form').find(".btn-primary");
|
|
|
|
|
|
|
|
|
|
$addMemberModal.on('show.bs.modal', function(event){
|
|
|
|
|
var $link = $(event.relatedTarget);
|
|
|
|
|
var salesmanId = $link.data('salesman-id');
|
|
|
|
|
$salesmanIdInput.val(salesmanId);
|
|
|
|
|
// var salesmanId = $link.data('salesman_id');
|
|
|
|
|
// $salesmanIdInput.val(salesmanId);
|
|
|
|
|
|
|
|
|
|
$memberSelect.select2('val', ' ');
|
|
|
|
|
});
|
|
|
|
@ -52,7 +52,7 @@ $(document).on('turbolinks:load', function() {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
url: '/admins/salesman_customers/batch_add',
|
|
|
|
|
data: { user_ids: memberIds },
|
|
|
|
|
data: { salesman_id: $salesmanIdInput.data("salesman-id"), user_ids: memberIds },
|
|
|
|
|
success: function(){
|
|
|
|
|
$.notify({ message: '创建成功' });
|
|
|
|
|
$addMemberModal.modal('hide');
|
|
|
|
|