define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: async function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'mobile/index' + location.search,
add_url: 'mobile/add',
edit_url: 'mobile/edit',
del_url: 'mobile/del',
multi_url: 'mobile/multi',
multi_edit_url: 'mobile/multi_edit',
multi_edit_proxy_url: 'mobile/multi_edit_proxy',
multi_edit_status_url: 'mobile/multi_edit_status',
import_url: 'mobile/import',
export_url: 'mobile/export',
batch: 'mobile/batch',
table: 'mobile',
cancel_discount: 'mobile/cancelsetdiscount',
set_discount: 'mobile/setdiscount',
batch_set_amount: 'mobile/batch_set_amount',
batch_set_kill: 'mobile/set_kill',
batch_activity_cancel: 'mobile/batch_activity_cancel',
}
});
var table = $("#table");
//let status = await $.getJSON('mobile/status')
let mobileStatus={}
mobile_status.forEach((item,idx)=>{
mobileStatus[idx]=item
})
$('.btn-multi-edit').click(function (){
let ids=[]
$('#table').bootstrapTable('getSelections').forEach(item=>{
ids.push(item.id)
})
if(!ids.length){
layer.alert('请选择')
return
}
Fast.api.open(`${$.fn.bootstrapTable.defaults.extend.multi_edit_url}/ids/${ids.join(',')}`,'批量编辑')
})
$('.btn-export').click(function (){
let ids=[]
$('#table').bootstrapTable('getSelections').forEach(item=>{
ids.push(item.id)
})
if(!ids.length){
parent.layer.alert('请选择')
return
}
open(`${$.fn.bootstrapTable.defaults.extend.export_url}/ids/${ids.join(',')}`)
})
$('.btn-multi-edit-proxy').click(function (){
let ids=[]
$('#table').bootstrapTable('getSelections').forEach(item=>{
ids.push(item.id)
})
if(!ids.length){
layer.alert('请选择')
return
}
Fast.api.open(`${$.fn.bootstrapTable.defaults.extend.multi_edit_proxy_url}/ids/${ids.join(',')}`,'编辑供应商')
})
$('.btn-multi-edit-status').click(function (){
let ids=[]
$('#table').bootstrapTable('getSelections').forEach(item=>{
ids.push(item.id)
})
if(!ids.length){
layer.alert('请选择')
return
}
Fast.api.open(`${$.fn.bootstrapTable.defaults.extend.multi_edit_status_url}/ids/${ids.join(',')}`,'编辑上下架')
})
$('.btn-batch_set_amount').click(function (){
let ids=[]
$('#table').bootstrapTable('getSelections').forEach(item=>{
ids.push(item.id)
})
if(!ids.length){
layer.alert('请选择')
return
}
Fast.api.open(`${$.fn.bootstrapTable.defaults.extend.batch_set_amount}/ids/${ids.join(',')}`,'批量改价')
})
$('.btn-batch_set_kill').click(function (){
let ids=[]
$('#table').bootstrapTable('getSelections').forEach(item=>{
ids.push(item.id)
})
if(!ids.length){
layer.alert('请选择')
return
}
Fast.api.open(`${$.fn.bootstrapTable.defaults.extend.batch_set_kill}/ids/${ids.join(',')}`,'秒杀')
})
$('.btn-set_online_clear').click(function (){
Fast.api.open(`${$(this).data('url')}`,$(this).text())
})
let _delete_condition=false,deleteIdx,secpwd
let make_export
let sub=admin_Info.is_sub
let columns= [
{checkbox: true},
{field: 'id', title: __('Id'),operate: false,},
{field: 'no', title: __('手机号'), operate: "LIKE"},
{field: 'filter_first_last', title: __('筛选位置'),visible: false,operate: '=',searchList: {1:'尾部',2:'中间'},defaultValue:1},
{field: 'province', title: __('Province'),operate: 'LIKE'},
{field: 'city', title: __('归属地'),operate: 'LIKE'},
{field: 'exclude_nums', title: __('排除数字'),visible:false,data:'data-field="title" data-multiple="true" data-source="mobile/exclude_nums" readonly',addclass: 'selectpage'},
{field: 'network', title: __('运营商'), formatter(network){
return `${network}`
},searchList: mobile_network},
{field: 'proxy_id', title: __('供应商')/*, searchList: proxy*/,formatter(_,mobile) {
return mobile.proxy_name;
}},
{field: 'brand', title: __('卡品牌'), formatter: Table.api.formatter.label, operate: "LIKE"},
{
field: 'rules', title: __('规律'), searchList: Object.keys(filters), formatter(a) {
return a.join('
')
}
},
{
field: 'info.describe',
title: __('套餐信息'),
operate: "like",
formatter: Table.api.formatter.content,
width: 200
},
{field: 'amount_original', title: __('Amount_original'), operate: false},
{field: 'amount_di', title: __('底价'), operate: 'BETWEEN'},
{field: 'amount_proxy', title: __('代理价'), operate: 'BETWEEN'},
{field: 'amount_base', title: __('Amount'), operate: 'BETWEEN'},
{field: 'amount_kill', title: __('秒杀价'), operate: 'BETWEEN'},
{field: 'amount_charge', title: __('预存话费'), operate: 'BETWEEN'},
{field: 'api_goods_id', title: __('Api商品id')},
{field: 'remark', title: __('备注'), operate: 'like'},
{
//field: sub?'mobile_sub.sub_top_time':'top_time',
field: 'top_time',
title: __('Top_time'),
//operate: 'RANGE',
//addclass: 'datetimerange',
autocomplete: false,
/* formatter(a, b, c) {
return `
`
}*/
formatter: Table.api.formatter.label,
/*formatter(a){
if(a>0){
return '是'
}
return '否'
},*/
searchList: {1:'置顶1',2:'置顶2',3:'置顶3',4:'置顶4',5:'置顶5',0:'否'},
},
{
//field: sub?'mobile_sub.sub_rec_time':'rec_time',
field: 'rec_time',
title: __('Rec_time'),
//operate: 'RANGE',
//addclass: 'datetimerange',
autocomplete: false,
/*formatter(a, b, c) {
return `
`
}*/
formatter: Table.api.formatter.label,
/*formatter(a){
if(a>0){
return '是'
}
return '否'
},*/
searchList: {1:'推荐1',2:'推荐2',3:'推荐3',4:'推荐4',5:'推荐5',0:'否'},
},
{
field: 'is_offer',
title: '特价号',
autocomplete: false,
formatter(a){
if(a>0){
return '是'
}
return '否'
},
searchList: {1:'是',0:'否'},
},
{
field: 'buttons',
width: "120px",
title: __('操作'),
table: table,
events: Table.api.events.operate,
operate: false,
formatter: Table.api.formatter.buttons,
buttons: [
{
name: 'detail',
text: __('预占'),
title: __('预占'),
classname: 'btn btn-xs btn-info btn-dialog',
url: 'mobile/takeit',
callback: function (data) {
},
visible: function (row) {
return table.data('operate-mobile_takeit') && row.is_activity===0;
}
},
{
name: 'detail',
text: __('取消预占'),
title: __('取消预占'),
classname: 'btn btn-xs btn-warning btn-ajax',
confirm: '确认取消吗?',
url: 'mobile/activity_cancel?aaa=1',
success: function (data) {
$('.btn-refresh').trigger('click')
},
visible: function (row) {
return table.data('operate-activity_cancel') && row.is_activity===1;
},
disable(row){
return admin_Info.is_sub && row.hold_chan!==admin_Info.id
}
},
{
name: 'detail',
text: __('记录'),
title: __('记录'),
classname: 'btn btn-xs btn-info btn-dialog',
url: 'mobile_price_log/index?a=1',
callback: function (data) {
},
visible: function (row) {
return true;
}
},
]
},
{field: 'status', title: __('号码状态'), formatter (a,b){
if(b.is_activity){
return `●
预占`
}else{
return mobileStatus[a]
}
}, searchList: mobileStatus},
{
field: 'update_time',
title: __('Update_time'),
operate: 'RANGE',
addclass: 'datetimerange',
autocomplete: false,
formatter: Table.api.formatter.datetime
},
{
field: 'create_time',
title: __('上架时间'),
operate: 'RANGE',
addclass: 'datetimerange',
autocomplete: false,
formatter: Table.api.formatter.datetime
},
//{field: sub?'mobile_sub.sub_sort':'sort', title: __('Sort'), operate: "BETWEEN"},
{field: 'sort', title: __('Sort'), operate: "BETWEEN"},
{field: 'hold_chan', title: __('预占通道'), operate: "="},
{field: 'hold_user', title: __('预占用户ID'), operate: "="},
{field: 'admin_id', title: __('上传用户'), operate: "="},
{field: 'search_precise', title: __('精准搜索'),visible:false,searchList(){
return Template('preciseInputs',{})
}},
{
field: 'operate',
title: __('Operate'),
table: table,
width: 150,
events: Table.api.events.operate,
formatter: Table.api.formatter.operate,
buttons: [
{
name: 'detail',
text: __('记录'),
title: __('记录'),
classname: 'btn btn-xs btn-info btn-dialog',
url: 'mobile_price_log/index?a=1',
callback: function (data) {
},
visible: function (row) {
return table.data('operate-mobile_price_log');
}
},
{
name: 'detail',
text: '排序',
title: '排序',
classname: 'btn btn-dialog btn-info btn-xs',
url: 'mobile/mobile_sort',
visible(row){
return table.data('operate-mobile_sort')
}
}
]
},
]
if(!admin_Info.is_manager){
Table.api.removeColumn('proxy_id',columns)
}
if(!showAmountDi){
Table.api.removeColumn('amount_di',columns)
}
if(!showAmountProxy){
Table.api.removeColumn('amount_proxy',columns)
}
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
search: false,
searchFormVisible: true,
fixedColumns: true,
fixedRightNumber:1,
columns: [columns],
onLoadSuccess(data){
if(data.delete_condition_msg){
layer.msg(data.delete_condition_msg)
}
layer.close(deleteIdx)
make_export=data.url
},
queryParams(params){
params._delete_condition=_delete_condition
params.secpwd=secpwd
let precise_search={}
for(var i=2;i<=11;i++){
precise_search[i]=$(`.form-commonsearch input[name="precise[${i}]"]`).val()
}
params.precise_search=precise_search
return params
}
});
$('.btn-add,.btn-edit').data('area',["100%","100%"])
let setStatus = function (_this, field) {
let a = layer.load()
$.post('mobile/batch', {
id: _this.attr('data-id'),
status: _this.attr('data-value') ? 0 : 1,
field: field
}, function (res) {
if (res.code) {
_this.attr('data-value', res.data.status)
if (res.data.status) {
_this.find('i').removeClass('fa-flip-horizontal text-gray')
} else {
_this.find('i').addClass('fa-flip-horizontal text-gray')
}
} else {
layer.msg('操作失败')
}
layer.close(a)
})
}
$(document).on('click', '.btn-change-top', function () {
setStatus($(this), 'top_time')
})
$(document).on('click', '.btn-change-rec', function () {
setStatus($(this), 'rec_time')
})
$(document).on('click', '.btn-set-discount', function () {
let set = $(this).data('set')
let select = table.bootstrapTable('getSelections'),
a = []
if (!select.length) {
return
}
select.forEach(item => {
a.push(item.id)
})
if (!set) {
$.post($.fn.bootstrapTable.defaults.extend.cancel_discount, {ids: a}, function () {
layer.msg('操作成功')
$('.btn-refresh').trigger('click')
})
} else {
Fast.api.open($.fn.bootstrapTable.defaults.extend.set_discount + `/ids/${a.join(',')}`, '设置特价', {
close() {
$('.btn-refresh').trigger('click')
}
})
}
})
$(document).on('click','.btn-import-disabled',function (){
let btn=$(this)
let input=document.createElement('input')
input.type='file'
input.accept='.xlsx'
input.onchange=function (){
let file=this.files[0]
let form=new FormData
form.append('file',file)
let idx=layer.load()
$.ajax('/admin.php/ajax/upload',{
error(){
layer.alert('上传出错')
layer.close(idx)
},
type:'post',
contentType:false,
processData:false,
data:form,
success({code,data,msg}){
if(!code){
layer.alert(msg)
}else{
$.ajax(btn.data('href'),{
error(){
layer.alert('导入出错')
},
complete(){
layer.close(idx)
},
type:'post',
data:{file:data.url},
success({code,data,msg}){
if(!code){
layer.alert(msg)
}else{
Toastr.success(msg)
//$('.btn-refresh').trigger('click')
}
}
})
}
}
})
}
input.click()
})
let next=0,prev=0
$('.form-commonsearch .preciseInput').bind('input keyup',function (){
if($(this).val()>9){
$(this).val($(this).val().substr(0,1))
}
if(next===1){
next=0
return
}
if($(this).val()){
if(!$(this).next()[0]){
return
}
let tagName=$(this).next()[0].tagName
if(tagName==='BR'){
$(this).next().next().focus().select()
}else {
$(this).next().focus().select()
}
next=1
}else{
$(this).prev().focus().select()
next=1
}
})
let searchForm=$('.form-commonsearch')
$('.btn-del-condition').click(function (){
var rows = table.bootstrapTable('getOptions').totalRows;
parent.layer.prompt(
{
title:'如果未选择条件则删除全部号码!',
formType:1,success(layero){
layero.find('.layui-layer-input').attr('placeholder','二级密码(本次删除'+rows+'项)')
}},function (pass,idx){
parent.layer.close(idx)
_delete_condition=true
secpwd=pass
deleteIdx=layer.load()
searchForm.find('button[type="submit"]').click()
_delete_condition=false
secpwd=null
})
})
$('.btn-del-all').click(function (){
let href=$(this).data('href')
parent.layer.prompt({title:'删除全部',formType:1,success(layero){
layero.find('.layui-layer-input').attr('placeholder','二级密码')
}},function (pass,idx1){
parent.layer.close(idx1)
let idx=layer.load()
$.ajax(href,{
type:'post',
success({code,msg,data}){
if(code===1){
let num=data.num||0
layer.alert(`成功删除${num}个号码`)
$('.btn-refresh').click()
}else{
layer.alert(msg)
}
},
error(){
layer.alert('请求出错')
},
complete(){
layer.close(idx)
}
})
})
})
$('.btn-php-export').click(function (){
let idx=parent.layer.load(1)
$.get(make_export,function (res){
parent.layer.alert(res)
parent.layer.close(idx)
})
})
window.refresh=()=>{
$('.btn-refresh').trigger('click')
}
// 为表格绑定事件
Table.api.bindevent(table);
},
mobile_kill: async function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'mobile/mobile_kill' + location.search,
edit_url: 'mobile/edit',
multi_url: 'mobile/multi',
batch_activity_cancel: 'mobile/batch_activity_cancel',
}
});
var table = $("#table");
let mobileStatus={},
sub=admin_Info.is_sub
mobile_status.forEach((item,idx)=>{
mobileStatus[idx]=item
})
let columns=[
{checkbox: true},
//{field: 'id', title: __('Id')},
{field: 'no', title: __('手机号'), operate: "LIKE"},
{field: 'province', title: __('Province'),operate: 'LIKE'},
{field: 'city', title: __('归属地'),operate: 'LIKE'},
{field: 'network', title: __('运营商'), formatter(network){
return `${network}`
},searchList: mobile_network},
{field: 'proxy.nickname', title: __('供应商'), formatter: Table.api.formatter.label,operate: 'LIKE'},
{field: 'brand', title: __('卡品牌'), formatter: Table.api.formatter.label, operate: "LIKE"},
{
field: 'rules', title: __('规律'), searchList: Object.keys(filters), formatter(a) {
return a.join('
')
}
},
{
field: 'info.describe',
title: __('套餐信息'),
operate: "like",
formatter: Table.api.formatter.content,
width: 200
},
{field: 'amount_original', title: __('Amount_original'), operate: false},
{field: 'amount_di', title: __('底价'), operate: 'BETWEEN'},
{field: 'amount_base', title: __('Amount'), operate: 'BETWEEN'},
{field: 'amount_kill', title: __('秒杀价'), operate: 'BETWEEN'},
{field: 'amount_charge', title: __('预存话费'), operate: 'BETWEEN'},
{field: 'remark', title: __('备注'), operate: 'like'},
{
//field: sub?'mobile_sub.sub_top_time':'top_time',
field: 'top_time',
title: __('Top_time'),
autocomplete: false,
formatter: Table.api.formatter.label,
searchList: {1:'置顶1',2:'置顶2',3:'置顶3',4:'置顶4',5:'置顶5',0:'否'},
},
{
//field: sub?'mobile_sub.sub_rec_time':'rec_time',
field: 'rec_time',
title: __('Rec_time'),
autocomplete: false,
formatter: Table.api.formatter.label,
searchList: {1:'推荐1',2:'推荐2',3:'推荐3',4:'推荐4',5:'推荐5',0:'否'},
},
//{field: 'is_hold', title: __('预占'),formatter: Table.api.formatter.toggle,searchList:{0:'否',1:'是'}},
{
field: 'buttons',
width: "120px",
title: __('操作'),
table: table,
events: Table.api.events.operate,
operate: false,
formatter: Table.api.formatter.buttons,
buttons: [
{
name: 'detail',
text: __('预占'),
title: __('预占'),
classname: 'btn btn-xs btn-info btn-dialog',
url: 'mobile/takeit',
callback: function (data) {
},
visible: function (row) {
return table.data('operate-mobile_takeit') && row.is_activity===0;
}
},
{
name: 'detail',
text: __('取消预占'),
title: __('取消预占'),
classname: 'btn btn-xs btn-warning btn-ajax',
confirm: '确认取消吗?',
url: 'mobile/activity_cancel?aaa=1',
success: function (data) {
$('.btn-refresh').trigger('click')
},
visible: function (row) {
return table.data('operate-activity_cancel') && row.is_activity===1;
},
disable(row){
return admin_Info.is_sub && row.hold_chan!==admin_Info.id
}
},
{
name: 'detail',
text: __('记录'),
title: __('记录'),
classname: 'btn btn-xs btn-info btn-dialog',
url: 'mobile_price_log/index?a=1',
callback: function (data) {
},
visible: function (row) {
return true;
}
},
]
},
{field: 'status', title: __('号码状态'), formatter (a,b){
if(b.is_activity){
return `●
预占`
}else{
return mobileStatus[a]
}
}, searchList: mobileStatus},
{
field: 'update_time',
title: __('Update_time'),
operate: 'RANGE',
addclass: 'datetimerange',
autocomplete: false,
formatter: Table.api.formatter.datetime
},
{
field: 'create_time',
title: __('上架时间'),
operate: 'RANGE',
addclass: 'datetimerange',
autocomplete: false,
formatter: Table.api.formatter.datetime
},
//{field: sub?'mobile_sub.sub_sort':'sort', title: __('Sort'), operate: "BETWEEN"},
{field: 'sort', title: __('Sort'), operate: "BETWEEN"},
{field: 'hold_chan', title: __('预占通道'), operate: "="},
{field: 'hold_user', title: __('预占用户ID'), operate: "="},
{field: 'admin_id', title: __('上传用户'), operate: "="},
/*{field: 'name', title: __('Name')},
{field: 'type', title: __('Type'),formatter: Table.api.formatter.label,searchList:no_type},
{field: 'amount_exists', title: __('Amount_exists'), operate:'BETWEEN'},
{field: 'amount_base', title: __('Amount_base'), operate:'BETWEEN'},
{field: 'summary', title: __('Summary')},
{field: 'saled', title: __('Saled'),formatter: Table.api.formatter.label,searchList:{0:'否',1:'是'}},
{field: 'is_activity', title: __('Is_activity'),formatter: Table.api.formatter.label,searchList:{0:'否',1:'是'}},
{field: 'activity_time_end', title: __('Activity_time_end'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'sort', title: __('Sort'),operate: "BETWEEN"},*/
{
field: 'operate',
title: __('Operate'),
table: table,
width: 150,
events: Table.api.events.operate,
formatter: Table.api.formatter.operate,
buttons: [
{
name: 'detail',
text: __('记录'),
title: __('记录'),
classname: 'btn btn-xs btn-info btn-dialog',
url: 'mobile_price_log/index?a=1',
callback: function (data) {
},
visible: function (row) {
return true;
}
},
]
},
]
if(admin_Info.is_sub){
Table.api.removeColumn('proxy.nickname',columns)
}
if(!showAmountDi){
Table.api.removeColumn('amount_di',columns)
}
if(!showAmountProxy){
Table.api.removeColumn('amount_proxy',columns)
}
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
search: false,
searchFormVisible: true,
fixedColumns: true,
fixedRightNumber:1,
columns: [
columns
]
});
let setStatus = function (_this, field) {
let a = layer.load()
$.post('mobile/batch', {
id: _this.attr('data-id'),
status: _this.attr('data-value') ? 0 : 1,
field: field
}, function (res) {
if (res.code) {
_this.attr('data-value', res.data.status)
if (res.data.status) {
_this.find('i').removeClass('fa-flip-horizontal text-gray')
} else {
_this.find('i').addClass('fa-flip-horizontal text-gray')
}
} else {
layer.msg('操作失败')
}
layer.close(a)
})
}
$(document).on('click', '.btn-change-top', function () {
setStatus($(this), 'top_time')
})
$(document).on('click', '.btn-change-rec', function () {
setStatus($(this), 'rec_time')
})
$(document).on('click', '.btn-set-discount', function () {
let set = $(this).data('set')
let select = table.bootstrapTable('getSelections'),
a = []
if (!select.length) {
return
}
select.forEach(item => {
a.push(item.id)
})
if (!set) {
$.post($.fn.bootstrapTable.defaults.extend.cancel_discount, {ids: a}, function () {
layer.msg('操作成功')
$('.btn-refresh').trigger('click')
})
} else {
Fast.api.open($.fn.bootstrapTable.defaults.extend.set_discount + `/ids/${a.join(',')}`, '设置特价', {
close() {
$('.btn-refresh').trigger('click')
}
})
}
})
$(document).on('click', '.btn-batch_activity_cancel', function () {
let select = table.bootstrapTable('getSelections'),
a = []
if (!select.length) {
return
}
select.forEach(item => {
a.push(item.id)
})
layer.confirm('确认取消吗?',function (){
let idx=layer.load()
$.post($.fn.bootstrapTable.defaults.extend.batch_activity_cancel, {ids: a}, function () {
layer.msg('操作成功')
$('.btn-refresh').trigger('click')
layer.close(idx)
})
})
})
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
$('.kill-discount-radio').change(function (){
let amount=$('#c-amount_base').val(),
dis=this.value
let total=amount*dis
$('#c-amount_kill').val(total.toFixed(0))
})
$('.kill-discount').bind('input propertychange',function (){
let amount=$('#c-amount_base').val(),
dis=this.value
let total=amount*dis/10
$('#c-amount_kill').val(total.toFixed(0))
})
},
setdiscount(){
Controller.api.bindevent();
$(document).on('click','#activity_forever input',function (){
if(this.value==0){
$('input[name="row[activity_time_end]"]').attr('disabled',false)
}else{
$('input[name="row[activity_time_end]"]').attr('disabled',true)
}
})
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
},
multi_edit(){
Controller.api.bindevent();
},
batch_set_amount(){
Controller.api.bindevent();
},
set_kill(){
Controller.api.bindevent();
},
set_online_clear(){
Controller.api.bindevent();
$('.btn-check').click(function (){
let idx=layer.load()
$.ajax(location.href,{
type:'post',
data:{act:'check'},
success({code,msg,data}){
if(code===1){
let num=data.num||0
$('.btn-check-show').text(`共${num}个重复号码`)
checkdNum=num
checked=true
}else{
layer.alert(msg)
}
},
error(){
layer.alert('请求出错')
},
complete(){
layer.close(idx)
}
})
})
$('.btn-makeDel').click(function (){
let idx=layer.load()
$.ajax(location.href,{
type:'post',
data:{act:'del',reserve:$('.reserve-field input:radio:checked').val()},
success({code,msg,data}){
if(code===1){
$('.btn-makeDel-show').text('删除成功')
checkdNum=0
checked=false
let num=data.num||0
layer.alert(`成功删除${num}个号码`)
}else{
layer.alert(msg)
}
},
error(){
layer.alert('请求出错')
},
complete(){
layer.close(idx)
}
})
})
},
multi_edit_proxy(){
Controller.api.bindevent();
},
batch_copy_operation(){
Controller.api.bindevent();
$(document).on('click','.btn-act',function (){
let act=$(this).data('act')
let idx=layer.load()
$.ajax(location.href,{
type:'post',
data:{row:{act:act,no:$('.input-no').val()}},
success({code,msg,data}){
if(code===1){
let num=data.num||0
layer.alert(`成功操作${num}个号码`)
parent.refresh()
}else{
layer.alert(msg)
}
},
error(){
layer.alert('请求出错')
},
complete(){
layer.close(idx)
}
})
})
},
multi_edit_status(){
Controller.api.bindevent();
},
mobile_sort(){
Controller.api.bindevent();
},
takeit(){
Controller.api.bindevent();
$('.kill-discount-radio').change(function (){
let amount=$('#c-amount_base').val(),
dis=this.value
let total=amount*dis
$('#c-amount_kill').val(total.toFixed(0))
})
$('.kill-discount').bind('input propertychange',function (){
let amount=$('#c-amount_base').val(),
dis=this.value
let total=amount*dis/10
$('#c-amount_kill').val(total.toFixed(0))
})
$('.kill-discount-radio[value="0.8"]').click()
}
};
return Controller;
});