define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'service/order/refundorder/index' + location.search, multi_url: 'service/order/refundorder/multi', import_url: 'service/order/refundorder/import', table: 'service_refund_order', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', fixedColumns: true, fixedRightNumber: 1, columns: [ [ {field: 'goods_id', title: __('项目信息'),operate: false, cellStyle: function () {return {css: {"min-width": "266px"}}},formatter:function (value,row) { return `
订单编号:${row.order.orderId}
ID:${row.order_id}
${row.detail.name}
规格 ${row.detail.sku_name}
数量 X${row.detail.num}
价格 ${row.detail.price}
` }}, {field: 'id', title: __('申请退款'),operate: false, cellStyle: function () {return {css: {"max-width": "400px","min-width": "300px"}}},formatter:function (value,row){ let result=`
退款原因 ${row.refund_reason}
申请退款金额 ${row.refund_price}
`; return result }}, {field: 'id', title: __('补充说明'),operate: false, cellStyle: function () {return {css: {"max-width": "400px","min-width": "300px"}}},formatter:function (value,row){ let result=`
补充说明 ${row.content}
`; if(row.images){ let images = row.images.split(',') result +=`
图片
`; for(let i=0; i < images.length; i++){ result += `` } result += `
` } return result }}, {field: 'user_id', title: __('用户信息'),operate: false, cellStyle: function () {return {css: {"min-width": "248px"}}},formatter:function (value,row){ let result = `
${row.user.nickname}
${row.user.mobile}
` if(row.order.to_shop == 'door'){ result += `
预约信息:${row.address.name+''+row.address.mobile}
地址:${row.address.province+row.address.city+row.address.district+row.address.area+row.address.address}
` }else { result += `
核销码:${row.order.check_name}
核销二维码:
` } result += `
` return result }}, {field: 'shop_id', title: __('服务者/门店信息'),operate: false, cellStyle: function () {return {css: {"min-width": "248px"}}},formatter:function (value,row){ if(row.shop && row.skill){ return `
门店信息
${row.shop.name}
${row.shop.leader_name+''+row.shop.leader_mobile}
服务者
${row.skill.name}
${row.skill.mobile}
` }else if(row.skill){ return `
服务者
${row.skill.name}
${row.skill.mobile}
` }else if(row.shop){ return `
门店信息
${row.shop.name}
${row.shop.leader_name+''+row.shop.leader_mobile}
` }else { return '' } }}, {field: 'price', title: __('付款信息'),operate: false, align:'left',cellStyle: function () {return {css: {"min-width": "108px"}}},formatter:function (value,row){ return `
总计
${row.order.payprice}
项目费
${row.order.price}
项目折扣
${row.order.discount/10}
优惠券
${row.order.coupon_price}
车费
${row.order.travel_price}
补差价
${row.order.premium_price}
加项费
${row.order.add_price}
` }}, {field: 'id', title: __('审核状态'),operate: false, cellStyle: function () {return {css: {"min-width": "250px"}}},formatter:function (value,row){ let result = `
状态 ${row.state_text}
` if(row.state == -1){ result+=`
拒绝原因
${row.note}
` } return result }}, {field: 'id', title: __('时间'),operate: false, cellStyle: function () {return {css: {"min-width": "180px"}}},formatter:function (value,row){ return `
创建时间
${row.create_time}
` }}, // {checkbox: true}, {field: 'id', title: __('Id'),visible: false}, {field: 'user_id', title: __('User_id'),visible: false}, {field: 'user.nickname', title: __('Nickname'),operate: false,visible: false}, {field: 'user.mobile', title: __('Mobile'),operate: false,visible: false}, {field: 'order.travel_price', title: __('Travel_price'),operate: false,visible: false}, {field: 'order.payprice', title: __('Payprice'),operate: false,visible: false}, {field: 'order_id', title: __('Order_id'),visible: false}, {field: 'refund_reason', title: __('Refund_reason'), operate: 'LIKE',visible: false}, {field: 'refund_price', title: __('Refund_price'), operate:'BETWEEN',visible: false}, {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images,visible: false}, {field: 'state', title: __('State'), searchList: {"0":__('State 0'),"1":__('State 1'),"-1":__('State -1')}, formatter: Table.api.formatter.normal,visible: false}, {field: 'note', title: __('Note'), operate: 'LIKE',visible: false}, {field: 'createtime', title: __('Createtime'), 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,visible: false}, {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, buttons: [ { name: 'detail', text: __('订单详情'), title: __('订单详情'), classname: 'btn btn-xs btn-detail btn-dialog', icon: 'fa fa-detail', url: function(row){ return 'service/order/order/info?ids='+row.order_id; }, }, { name: 'agree', text: __('同意退款'), title: __('同意退款'), classname: 'btn btn-xs btn-success btn-dialog', url: function(row){ return 'service/order/order/refund?ids='+row.order_id; }, hidden:function(row){ if(row.state != 0){ return true; } }, success: function (data, ret) { $(".btn-refresh").trigger('click'); }, }, { name: 'refund', text: __('拒绝退款'), title: __('拒绝退款'), classname: 'btn btn-xs btn-danger btn-dialog', url: function(row){ return 'service/order/refundorder/refund?ids='+row.id; }, hidden:function(row){ if(row.state != 0){ return true; } }, success: function (data, ret) { $(".btn-refresh").trigger('click'); }, }, ], formatter: Table.api.formatter.operate} ] ] }); // 为表格绑定事件 Table.api.bindevent(table); }, add: function () { Controller.api.bindevent(); }, edit: function () { Controller.api.bindevent(); }, agree: function () { $(document).on('click', '.btn-embossed', function () { parent.$(".btn-refresh").trigger('click'); }); Controller.api.bindevent(); }, refund: function () { $(document).on('click', '.btn-embossed', function () { parent.$(".btn-refresh").trigger('click'); }); Controller.api.bindevent(); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); } } }; return Controller; });