|
@@ -1,7 +1,7 @@
|
|
|
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
|
|
var Controller = {
|
|
|
- index: function () {
|
|
|
+ index: async function () {
|
|
|
// 初始化表格参数配置
|
|
|
Table.api.init({
|
|
|
extend: {
|
|
@@ -19,46 +19,76 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
});
|
|
|
|
|
|
var table = $("#table");
|
|
|
+ let status = await $.getJSON('mobile/status')
|
|
|
|
|
|
// 初始化表格
|
|
|
table.bootstrapTable({
|
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
|
pk: 'id',
|
|
|
sortName: 'id',
|
|
|
- search:false,
|
|
|
- searchFormVisible:true,
|
|
|
+ search: false,
|
|
|
+ searchFormVisible: true,
|
|
|
columns: [
|
|
|
[
|
|
|
{checkbox: true},
|
|
|
{field: 'id', title: __('Id')},
|
|
|
- {field: 'no', title: __('手机号'),operate: "LIKE"},
|
|
|
+ {field: 'no', title: __('手机号'), operate: "LIKE"},
|
|
|
{field: 'province', title: __('Province')},
|
|
|
{field: 'city', title: __('归属地')},
|
|
|
- {field: 'network', title: __('运营商'),formatter: Table.api.formatter.label},
|
|
|
- {field: 'proxy.nickname', title: __('代理商'),formatter: Table.api.formatter.label},
|
|
|
- {field: 'brand', title: __('卡品牌'),formatter: Table.api.formatter.label},
|
|
|
- {field: 'rules', title: __('规律'),searchList: Object.keys(filters),formatter(a){
|
|
|
- return a.join('<br>')
|
|
|
- }},
|
|
|
- {field: 'info.describe', title: __('套餐信息'),operate: "like",formatter: Table.api.formatter.content,width: 300},
|
|
|
- {field: 'amount_original', title: __('Amount_original'), operate:'BETWEEN'},
|
|
|
- {field: 'amount_di', title: __('底价'), operate:'BETWEEN'},
|
|
|
- {field: 'amount_base', title: __('Amount'), operate:'BETWEEN'},
|
|
|
- {field: 'amount_charge', title: __('预存话费'), operate:'BETWEEN'},
|
|
|
- {field: 'remark', title: __('备注'), operate:'like'},
|
|
|
- {field: 'top_time', title: __('Top_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false,formatter(a,b,c){
|
|
|
- return `<a data-toggle="switcher" class="btn-switcher btn-change-top" data-id="${b.id}" data-value="${a?a:''}">
|
|
|
- <i class="fa fa-toggle-on text-success ${a?'':'fa-flip-horizontal text-gray'} fa-2x"></i>
|
|
|
+ {field: 'network', title: __('运营商'), formatter: Table.api.formatter.label},
|
|
|
+ {field: 'proxy.nickname', title: __('代理商'), formatter: Table.api.formatter.label},
|
|
|
+ {field: 'brand', title: __('卡品牌'), formatter: Table.api.formatter.label},
|
|
|
+ {
|
|
|
+ field: 'rules', title: __('规律'), searchList: Object.keys(filters), formatter(a) {
|
|
|
+ return a.join('<br>')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'info.describe',
|
|
|
+ title: __('套餐信息'),
|
|
|
+ operate: "like",
|
|
|
+ formatter: Table.api.formatter.content,
|
|
|
+ width: 300
|
|
|
+ },
|
|
|
+ {field: 'amount_original', title: __('Amount_original'), operate: 'BETWEEN'},
|
|
|
+ {field: 'amount_di', title: __('底价'), operate: 'BETWEEN'},
|
|
|
+ {field: 'amount_base', title: __('Amount'), operate: 'BETWEEN'},
|
|
|
+ {field: 'amount_charge', title: __('预存话费'), operate: 'BETWEEN'},
|
|
|
+ {field: 'remark', title: __('备注'), operate: 'like'},
|
|
|
+ {
|
|
|
+ field: 'top_time',
|
|
|
+ title: __('Top_time'),
|
|
|
+ operate: 'RANGE',
|
|
|
+ addclass: 'datetimerange',
|
|
|
+ autocomplete: false,
|
|
|
+ formatter(a, b, c) {
|
|
|
+ return `<a data-toggle="switcher" class="btn-switcher btn-change-top" data-id="${b.id}" data-value="${a ? a : ''}">
|
|
|
+ <i class="fa fa-toggle-on text-success ${a ? '' : 'fa-flip-horizontal text-gray'} fa-2x"></i>
|
|
|
</a>`
|
|
|
- }},
|
|
|
- {field: 'rec_time', title: __('Rec_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false,formatter(a,b,c){
|
|
|
- return `<a data-toggle="switcher" class="btn-switcher btn-change-rec" data-id="${b.id}" data-value="${a?a:''}">
|
|
|
- <i class="fa fa-toggle-on text-success ${a?'':'fa-flip-horizontal text-gray'} fa-2x"></i>
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'rec_time',
|
|
|
+ title: __('Rec_time'),
|
|
|
+ operate: 'RANGE',
|
|
|
+ addclass: 'datetimerange',
|
|
|
+ autocomplete: false,
|
|
|
+ formatter(a, b, c) {
|
|
|
+ return `<a data-toggle="switcher" class="btn-switcher btn-change-rec" data-id="${b.id}" data-value="${a ? a : ''}">
|
|
|
+ <i class="fa fa-toggle-on text-success ${a ? '' : 'fa-flip-horizontal text-gray'} fa-2x"></i>
|
|
|
</a>`
|
|
|
- }},
|
|
|
+ }
|
|
|
+ },
|
|
|
//{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:[
|
|
|
+ {
|
|
|
+ field: 'buttons',
|
|
|
+ width: "120px",
|
|
|
+ title: __('操作'),
|
|
|
+ table: table,
|
|
|
+ events: Table.api.events.operate,
|
|
|
+ operate: false,
|
|
|
+ formatter: Table.api.formatter.buttons,
|
|
|
+ buttons: [
|
|
|
{
|
|
|
name: 'detail',
|
|
|
text: __('预占'),
|
|
@@ -83,14 +113,29 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
return true;
|
|
|
}
|
|
|
},
|
|
|
- ]},
|
|
|
- {field: 'is_hold', title: __('状态'),formatter: Table.api.formatter.normal,searchList:{0:'正常',1:'预占'}},
|
|
|
- {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: 'sort', title: __('Sort'),operate: "BETWEEN"},
|
|
|
- {field: 'hold_chan', title: __('预占通道'),operate: "="},
|
|
|
- {field: 'hold_user', title: __('预占用户ID'),operate: "="},
|
|
|
- {field: 'admin_id', title: __('上传用户'),operate: "="},
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {field: 'status', title: __('状态'), formatter: Table.api.formatter.label, searchList: status},
|
|
|
+ {
|
|
|
+ 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: '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},
|
|
@@ -101,7 +146,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
{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, events: Table.api.events.operate, formatter: Table.api.formatter.operate,buttons:[
|
|
|
+ {
|
|
|
+ field: 'operate',
|
|
|
+ title: __('Operate'),
|
|
|
+ table: table,
|
|
|
+ events: Table.api.events.operate,
|
|
|
+ formatter: Table.api.formatter.operate,
|
|
|
+ buttons: [
|
|
|
{
|
|
|
name: 'detail',
|
|
|
text: __('取消预占'),
|
|
@@ -111,7 +162,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
callback: function (data) {
|
|
|
},
|
|
|
visible: function (row) {
|
|
|
- return row.is_hold===1;
|
|
|
+ return row.is_hold === 1;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
@@ -126,52 +177,57 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
return true;
|
|
|
}
|
|
|
},
|
|
|
- ]},
|
|
|
+ ]
|
|
|
+ },
|
|
|
]
|
|
|
]
|
|
|
});
|
|
|
|
|
|
- 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){
|
|
|
+ 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{
|
|
|
+ } else {
|
|
|
_this.find('i').addClass('fa-flip-horizontal text-gray')
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
layer.msg('操作失败')
|
|
|
}
|
|
|
layer.close(a)
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- $(document).on('click','.btn-change-top',function (){
|
|
|
- setStatus($(this),'top_time')
|
|
|
+ $(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-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){
|
|
|
+ $(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=>{
|
|
|
+ select.forEach(item => {
|
|
|
a.push(item.id)
|
|
|
})
|
|
|
- if(!set){
|
|
|
- $.post($.fn.bootstrapTable.defaults.extend.cancel_discount,{ids:a},function (){
|
|
|
+ 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(){
|
|
|
+ } else {
|
|
|
+ Fast.api.open($.fn.bootstrapTable.defaults.extend.set_discount + `/ids/${a.join(',')}`, '设置特价', {
|
|
|
+ close() {
|
|
|
$('.btn-refresh').trigger('click')
|
|
|
}
|
|
|
})
|