You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ymww_backend/public/assets/js/backend/order.js

191 lines
11 KiB

1 year ago
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'order/index' + location.search,
add_url: 'order/add',
edit_url: 'order/edit',
del_url: 'order/del',
multi_url: 'order/multi',
import_url: 'order/import',
table: 'order',
}
});
var table = $("#table");
1 year ago
table.on('load-success.bs.table', function (e, data) {
//这里可以获取从服务端获取的JSON数据console.log(data);//这里我们手动设置底部的值
$("#order_count").text(data.extend.order_count);
$("#order_amount").text(data.extend.order_amount);
$("#coupon_price").text(data.extend.coupon_price);
1 year ago
$("#dikou_price").text(data.extend.dikou_price);
1 year ago
$("#user_count").text(data.extend.user_count);
1 year ago
$("#new_user_count").text(data.extend.new_user_count);
1 year ago
});
1 year ago
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'warehouse.title', title: __('所属仓库'),operate: 'LIKE'},
{field: 'bank', title: __('商品名称'),operate:'LIKE', align: 'left', formatter: function (value, row) {
var _html = ' ';
_html += '<img decoding="async" src="'+ row.detail.goods_image +'" alt="Smiley face" width="42" height="42">';
_html += '<br/>' + row.detail.goods_name;
_html += '<br/>订单号:' + row.order_sn;
return _html;
}, operate:false},
{field: 'price', title: __('委托价/商品价/手续费/佣金抵扣手续费'),operate:'LIKE', align: 'left', formatter: function (value, row) {
var _html = ' ';
_html += '<br/>' + row.detail.commission_price;
_html += '<br/>' + row.detail.goods_price;
_html += '<br/>' + row.detail.fee;
_html += '<br/>' + row.detail.dikou_price;
return _html;
}, operate:false},
{field: 'user', title: __('卖家/买家'),operate:'LIKE', align: 'left', formatter: function (value, row) {
var _html = ' ';
_html += '<br/>' + row.user1.nickname;
_html += '<br/>' + row.user1.mobile;
_html += '<br/>---------';
_html += '<br/>' + row.user.nickname;
_html += '<br/>' + row.user.mobile;
return _html;
}, operate:false},
1 year ago
{field: 'user.nickname', title: __('联系人'),operate:"LIKE",sortable:true},
1 year ago
{field: 'user', title: __('状态/下单时间/支付时间'),operate:'LIKE', align: 'left', formatter: function (value, row) {
var _html = ' ';
_html += '<br/>' + row.status_text;
_html += '<br/>---------';
_html += '<br/>' + row.createtime_text;
_html += '<br/>---------';
_html += '<br/>' + row.pay_time_text;
return _html;
}, operate:false},
{field: 'order_sn', title: __('Order_sn'), visible:false,operate:"LIKE"},
{field: 'user.mobile', title: __('购买人手机号'),visible:false,operate:"LIKE"},
{field: 'user1.mobile', title: __('售卖人手机号'),visible:false,operate:"LIKE"},
1 year ago
{field: 'tuiguang', title: __('推广'), operate:false},
1 year ago
{field: 'order_amount', title: __('应付金额'), operate:'BETWEEN'},
{field: 'pay_amount', title: __('实付金额'), operate:'BETWEEN'},
{field: 'coupon_price', title: __('委托优惠金额'), operate:'BETWEEN'},
{field: 'createtime', title: __('下单时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible:false},
//{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: Config.statusList,visible:false},
{field: 'cancel_time', title: __('取消时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'pay_method', title: __('Pay_method'), formatter: Table.api.formatter.status, searchList: {1: __('支付宝'), 0: __('银行卡'), 2: __('微信')}},
{field: 'pay_time', title: __('Pay_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible:false},
// {field: 'pay_voucher', title: __('Pay_voucher'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
// {field: 'coupon_id', title: __('Coupon_id')},
// {field: 'consignee', title: __('Consignee'), operate: 'LIKE'},
// {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
// {field: 'province', title: __('Province'), operate: 'LIKE'},
// {field: 'city', title: __('City'), operate: 'LIKE'},
// {field: 'address', title: __('Address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
{field: 'operate', title: __('Operate'), table: table,events: Table.api.events.operate,
buttons:[
1 year ago
{
name:'cancel',
text:'取消订单',
title:'取消订单',
classname: 'btn btn-xs btn-info btn-ajax',
icon: 'fa fa-check',
url: 'order/cancel',
visible:function(row){
if (row.status == 0) {
return true;
}
return false;
},
refresh:true
},
1 year ago
{
name:'split',
text:'发货',
title:'发货',
classname: 'btn btn-xs btn-info btn-view btn-dialog',
icon: 'fa fa-check',
url: 'order/send/type/1',
visible:function(row){
if (row.status == 4) {
return true;
}
return false;
},
//refresh:true
},
{
name:'split',
text:'查看物流',
title:'查看物流',
classname: 'btn btn-xs btn-info btn-view btn-dialog',
icon: 'fa fa-check',
url: 'order/send/type/2',
visible:function(row){
if (row.status == 5 || row.status == 6) {
return true;
}
return false;
},
//refresh:true
},
],
formatter: function(value, row, index) {
var that = $.extend({}, this);
var table = $(that.table).clone(true);
// operate-edit编辑 perate-del删除
//判断什么时候显示什么时候不显示
if (row.status == 1) {
//$(table).data("operate-edit", null); // 列表页面隐藏 .编辑operate-edit - 删除按钮operate-del
//$(table).data("operate-del", null); // 列表页面隐藏 .编辑operate-edit - 删除按钮operate-del
}
that.table = table;
return Table.api.formatter.operate.call(that, value, row, index);
},
// cellStyle: {css: {"max-width": "100px","white-space":"pre-line","word-wrap":"break-word","word-break":"break-all"}}
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
send: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});