Commit cf5217f4 by LJM

订单明细

parent d92c582b
layui.use(['form', 'table', 'laydate'], function () {
var $ = layui.$;
var form = layui.form;
var table = layui.table;
var order_id = $("input[name='order_id']").val();
window.IndexController = {
init: function () {
this.created(this).render(this).handleBind(this);
},
created: function () {
return this;
},
render: function () {
//列表
table.render({
elem: '#list',
url: '/api/orderList',
toolbar: '#toolbar',
method: 'GET',
where: {
order_id: order_id
},
cols: [[
{type: 'numbers', fixed: true, title: '序号', width: 60},
{field: 'goods_id', title: 'SKUID', width: 164},
{field: 'goods_name', title: '商品型号', width: 164},
{field: 'standard_brand_name', title: '标准品牌', width: 120},
{field: 'supplier_name', title: '供应商', width: 120},
{field: 'raw_goods_sn', title: '供应商物料唯一编码', width: 160},
{field: 'raw_brand_name', title: '供应商物料品牌', width: 160},
{field: 'purchase_name', title: '采购员', width: 120},
{
field: '', title: '币种', width: 80, templet(d) {
return '美元'
}
},
{
field: 'goods_price', title: '单价', width: 120, templet(d) {
return '<span>' + d.goods_price + '</span><input data-order-items-id="' + d.rec_id + '" class="hide-input input-style goods_price" value="' + d.goods_price + '"/>'
}
},
{
field: 'goods_number', title: '数量', width: 120, templet(d) {
return '<span>' + d.goods_number + '</span><input class="hide-input input-style goods_number" value="' + d.goods_number + '"/>'
}
},
{field: 'total_amount', title: '小计', width: 120},
{field: 'delivery_time', title: '货期', width: 120},
{field: 'batch', title: '批次', width: 120},
{field: 'remarks', title: '客户备注', width: 120},
{
field: 'type_cn', title: '售后类型', width: 120, templet(d) {
return '<span>' + d.type_cn + '</span><div class="hide-input"><select class="input-style return_type" lay-ignore=""><option>全部</option><option value="1">退货退款</option><option value="2">仅退款</option></select></div>'
}
},
{
field: 'return_num', title: '售后数量', width: 120, templet(d) {
return '<span>' + d.return_num + '</span><input class="hide-input input-style return_goods_number" value="' + d.return_num + '"/>'
}
},
{
field: 'return_price', title: '售后单价', width: 120, templet(d) {
return '<span>' + d.return_price + '</span><input class="hide-input input-style return_goods_price" value="' + d.return_price + '"/>'
}
},
{
field: 'return_amount', title: '售后金额', width: 120, templet(d) {
return '<span>' + d.return_amount + '</span><input class="hide-input input-style return_amount" value="' + d.return_amount + '"/>'
}
}
]],
parseData: function (res) {
$("#order_remark").val(res.data.order_remark);
$("#order_remark").next().empty().text(res.data.order_remark);
$("#order_amount").empty().text(res.data.order_amount);
$("#return_order_amount").empty().text(res.data.return_order_amount_format);
return {
code: res.code,
msg: "",
count: res.count ? res.count : 0,
data: res.data.list
}
},
page: true,
size: 'sm',
cellMinWidth: 80,
defaultToolbar: ['filter'],
limit: 15,
limits: [15, 50, 100, 200],
done: function (res, curr, count) {
layui.form.render();
}
});
//监听头工具栏事件
table.on('toolbar(list)', function (obj) {
var checkStatus = table.checkStatus(obj.config.id);
var data = checkStatus.data;
switch (obj.event) {
//修改
case 'editOrderItems':
var text = $("#editOrderItems").text();
if (text == '保存') {
var order_items = [];
$(".layui-table-main tr").each(function (index, element) {
order_items.push({
"order_items_id": $(element).find('.goods_price').attr('data-order-items-id'),
"goods_price": $(element).find('.goods_price').val(),
"goods_number": $(element).find('.goods_number').val(),
"return_type": $(element).find('.return_type').val(),
"return_goods_price": $(element).find('.return_goods_price').val(),
"return_goods_number": $(element).find('.return_goods_number').val(),
"return_amount": $(element).find('.return_amount').val()
})
});
var params = {
order_id: order_id,
order_remark: form.val('orderListForn').order_remark,
order_items: JSON.stringify(order_items)
}
Request('/api/order/editOrderItems', 'POST', params, function (res) {
if (res.code === 0) {
} else {
layer.msg(res.msg);
}
});
return false;
}
$("#editOrderItems").empty().text('保存');
$("#editOrderItems").next().show();
$("#order_remark").show().next().hide();//订单备注
$(".layui-table-main tr").each(function (index, element) {
$(element).find('.hide-input').show().prev().hide();
});
break;
//取消
case 'canel':
$("#editOrderItems").empty().text('修改');
$("#editOrderItems").next().hide();
$("#order_remark").hide().next().show();//订单备注
table.reloadData('list', {
page: {
curr: 1
}
});
break;
}
});
return this;
},
handleBind: function () {
return this;
}
}
IndexController.init();
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment