| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- 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 `
- <div>
- <div style="display: flex;align-items: center;justify-content: space-between;color: #666;margin-bottom: 10px;">
- <div>订单编号:${row.order.orderId}</div>
- <div style="margin-left: 20px;">ID:${row.order_id}</div>
- </div>
- <div style="display: flex">
- <image style="width: 112px;height: 112px;border-radius: 10px" src="${row.detail.image}"></image>
- <div style="margin-left: 25px;">
- <div style="display: flex;align-items: center;margin-bottom: 8px;">
- <div style="font-size: 16px;font-weight: bold;">${row.detail.name}</div>
-
- </div>
- <div style="display: flex;align-items: center;margin-bottom: 6px;">
- <span style="margin-right: 30px;color: #999;font-size: 14px;">规格</span>
- <span style="color: #333;font-size: 14px">${row.detail.sku_name}</span>
- </div>
- <div style="display: flex;align-items: center;margin-bottom: 6px;">
- <span style="margin-right: 30px;color: #999;font-size: 14px;">数量</span>
- <span style="color: #333;font-size: 14px">X${row.detail.num}</span>
- </div>
- <div style="display: flex;align-items: center;margin-bottom: 6px;">
- <span style="margin-right: 30px;color: #999;font-size: 14px;">价格</span>
- <span style="color: #333;font-size: 14px">${row.detail.price}</span>
- </div>
- </div>
- </div>
-
- </div>
- `
-
- }},
- {field: 'id', title: __('申请退款'),operate: false, cellStyle: function () {return {css: {"max-width": "400px","min-width": "300px"}}},formatter:function (value,row){
- let result=`
-
- <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;height: 66px;border-bottom: 1px solid #EEEEEE;">
- <span style="font-size: 14px;color: #999;">退款原因</span>
- <span style="color: #1677FF;font-size: 14px;margin-left: 20px;white-space: pre-line;">${row.refund_reason}</span>
- </div>
- <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;height: 66px;">
- <span style="font-size: 14px;color: #999;">申请退款金额</span>
- <span style="color: #FF1F2B;font-size: 14px;margin-left: 20px;">${row.refund_price}</span>
- </div>
- `;
- return result
- }},
-
- {field: 'id', title: __('补充说明'),operate: false, cellStyle: function () {return {css: {"max-width": "400px","min-width": "300px"}}},formatter:function (value,row){
- let result=`
-
- <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;height: 66px;">
- <span style="font-size: 14px;color: #999;">补充说明</span>
- <span style="color: #1677FF;font-size: 14px;margin-left: 20px;white-space: pre-line;">${row.content}</span>
- </div>
- `;
-
-
- if(row.images){
- let images = row.images.split(',')
- result +=`<div style="display: flex;align-items: center;justify-content:space-between;padding: 10px 20px;border-top: 1px solid #EEEEEE;">
- <span style="color: #999999;font-size: 12px;">图片</span>
- <div style="display: flex;align-items: center;margin-left: 20px;">`;
- for(let i=0; i < images.length; i++){
- result += `<img src="${images[i]}" alt="" style="width: 56px;height: 56px;margin-right:5px;border-radius: 8px;">`
- }
-
- result += `</div></div>`
- }
-
-
- return result
- }},
-
-
-
-
- {field: 'user_id', title: __('用户信息'),operate: false, cellStyle: function () {return {css: {"min-width": "248px"}}},formatter:function (value,row){
- let result = `<div style="display: flex;align-items: flex-start;">
- <img src="${row.user.avatar}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
- <div style="margin-left: 14px;flex: 1;">
- <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
- <span style="font-size: 16px;color: #333;">${row.user.nickname}</span>
- </div>
- <div style="display: flex;justify-content: space-between;">
- <span style="font-size: 14px;color: #666;">${row.user.mobile}</span>
- </div>
- `
- if(row.order.to_shop == 'door'){
- result += ` <div style="font-size: 14px;color: #666;text-align: left;margin-top:10px;">预约信息:${row.address.name+''+row.address.mobile}</div>
- <div style="font-size: 14px;color: #666;margin: 10px 0;text-align: left;">地址:${row.address.province+row.address.city+row.address.district+row.address.area+row.address.address}</div>
- `
- }else {
- result += `<div style="font-size: 14px;color: #666;text-align: left;margin-top:10px;">核销码:${row.order.check_name}</div>
- <div style="font-size: 14px;color: #666;text-align: left;margin-top:10px;">核销二维码:<img style="width:40px;height:40px;" src="${row.order.qrcode_image}" /></div>
- `
- }
- result += `</div>
- </div>`
- 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 `<div>
-
- <div style="background: #F7F7F7;padding: 12px;border-radius: 10px;margin-top: 16px;">
- <div style="display: flex;align-items: center;justify-content: center;width: 64px;height: 18px;background: #1677FF;color: #FFF;margin-bottom: 8px;font-size: 12px;border-radius: 2px;">门店信息</div>
- <div style="display: flex;align-items: center;">
- <img src="${row.shop.logo_image}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
- <div style="margin-left: 14px;flex: 1;">
- <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
- <span style="font-size: 16px;color: #333;">${row.shop.name}</span>
- </div>
- <div style="display: flex;justify-content: space-between;">
- <span style="font-size: 14px;color: #666;">${row.shop.leader_name+''+row.shop.leader_mobile}</span>
- </div>
- </div>
- </div>
- </div>
- <div style="background: #F7F7F7;padding: 12px;border-radius: 10px;margin-top: 16px;">
- <div style="display: flex;align-items: center;justify-content: center;width: 50px;height: 18px;background: #6116FF;color: #FFF;margin-bottom: 8px;font-size: 12px;border-radius: 2px;">服务者</div>
- <div style="display: flex;align-items: center;">
- <img src="${row.skill.image}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
- <div style="margin-left: 14px;flex: 1;">
- <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
- <span style="font-size: 16px;color: #333;">${row.skill.name}</span>
- </div>
- <div style="display: flex;justify-content: space-between;">
- <span style="font-size: 14px;color: #666;">${row.skill.mobile}</span>
- </div>
- </div>
- </div>
- </div>
-
- </div>`
- }else if(row.skill){
- return `<div>
-
- <div style="background: #F7F7F7;padding: 12px;border-radius: 10px;margin-top: 16px;">
- <div style="display: flex;align-items: center;justify-content: center;width: 50px;height: 18px;background: #6116FF;color: #FFF;margin-bottom: 8px;font-size: 12px;border-radius: 2px;">服务者</div>
- <div style="display: flex;align-items: center;">
- <img src="${row.skill.image}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
- <div style="margin-left: 14px;flex: 1;">
- <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
- <span style="font-size: 16px;color: #333;">${row.skill.name}</span>
- </div>
- <div style="display: flex;justify-content: space-between;">
- <span style="font-size: 14px;color: #666;">${row.skill.mobile}</span>
- </div>
- </div>
- </div>
- </div>
-
- </div>`
- }else if(row.shop){
- return `<div>
-
- <div style="background: #F7F7F7;padding: 12px;border-radius: 10px;margin-top: 16px;">
- <div style="display: flex;align-items: center;justify-content: center;width: 64px;height: 18px;background: #1677FF;color: #FFF;margin-bottom: 8px;font-size: 12px;border-radius: 2px;">门店信息</div>
- <div style="display: flex;align-items: center;">
- <img src="${row.shop.logo_image}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
- <div style="margin-left: 14px;flex: 1;">
- <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
- <span style="font-size: 16px;color: #333;">${row.shop.name}</span>
- </div>
- <div style="display: flex;justify-content: space-between;">
- <span style="font-size: 14px;color: #666;">${row.shop.leader_name+''+row.shop.leader_mobile}</span>
- </div>
- </div>
- </div>
- </div>
-
- </div>`
- }else {
- return ''
- }
-
- }},
-
- {field: 'price', title: __('付款信息'),operate: false, align:'left',cellStyle: function () {return {css: {"min-width": "108px"}}},formatter:function (value,row){
- return `<div>
-
- <div style="display:flex;align-items: center;margin-bottom: 10px;">
- <div style="color: #999999;font-size: 14px;width: 72px;">总计</div>
- <div style="color: #E4484B;font-size: 18px;font-weight: bold;">${row.order.payprice}</div>
- </div>
- <div style="display:flex;align-items: center;margin-bottom: 6px;">
- <div style="color: #999999;font-size: 14px;width: 72px;">项目费</div>
- <div style="color: #3C78FF;font-size: 14px;">${row.order.price}</div>
- </div>
- <div style="display:flex;align-items: center;margin-bottom: 6px;">
- <div style="color: #999999;font-size: 14px;width: 72px;">项目折扣</div>
- <div style="color: #3C78FF;font-size: 14px;">${row.order.discount/10}</div>
- </div>
- <div style="display:flex;align-items: center;margin-bottom: 6px;">
- <div style="color: #999999;font-size: 14px;width: 72px;">优惠券</div>
- <div style="color: #3C78FF;font-size: 14px;">${row.order.coupon_price}</div>
- </div>
- <div style="display:flex;align-items: center;margin-bottom: 6px;">
- <div style="color: #999999;font-size: 14px;width: 72px;">车费</div>
- <div style="color: #3C78FF;font-size: 14px;">${row.order.travel_price}</div>
- </div>
- <div style="display:flex;align-items: center;margin-bottom: 6px;">
- <div style="color: #999999;font-size: 14px;width: 72px;">补差价</div>
- <div style="color: #3C78FF;font-size: 14px;">${row.order.premium_price}</div>
- </div>
- <div style="display:flex;align-items: center;">
- <div style="color: #999999;font-size: 14px;width: 72px;">加项费</div>
- <div style="color: #3C78FF;font-size: 14px;">${row.order.add_price}</div>
- </div>
-
- </div>`
-
- }},
-
-
- {field: 'id', title: __('审核状态'),operate: false, cellStyle: function () {return {css: {"min-width": "250px"}}},formatter:function (value,row){
- let result = `<div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;">
- <span style="font-size: 14px;color: #999;">状态</span>
- <span style="color: #1677FF;font-size: 14px;">${row.state_text}</span>
- </div>`
- if(row.state == -1){
- result+=`
- <div style="display: flex;align-items: flex-start;justify-content:space-between;width: 250px;height: 66px;white-space:normal;padding:20px 20px 0;border-top: 1px solid #EEEEEE;">
- <div style="font-size: 14px;color: #999;flex-shrink:0;">拒绝原因</div>
- <div style="color: #FF1F2B;font-size: 14px;text-align:left;margin-left:20px">${row.note}</div>
- </div>
- `
- }
- return result
- }},
- {field: 'id', title: __('时间'),operate: false, cellStyle: function () {return {css: {"min-width": "180px"}}},formatter:function (value,row){
- return `
- <div style="margin-bottom: 10px;">
- <div style="color: #999999;font-size: 14px;margin-bottom: 8px;text-align:left;">创建时间</div>
- <div style="color: #333333;font-size: 14px;text-align:left;">${row.create_time}</div>
- </div>
- `
- }},
- // {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;
- });
|