refundorder.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'service/order/refundorder/index' + location.search,
  8. multi_url: 'service/order/refundorder/multi',
  9. import_url: 'service/order/refundorder/import',
  10. table: 'service_refund_order',
  11. }
  12. });
  13. var table = $("#table");
  14. // 初始化表格
  15. table.bootstrapTable({
  16. url: $.fn.bootstrapTable.defaults.extend.index_url,
  17. pk: 'id',
  18. sortName: 'id',
  19. fixedColumns: true,
  20. fixedRightNumber: 1,
  21. columns: [
  22. [
  23. {field: 'goods_id', title: __('项目信息'),operate: false, cellStyle: function () {return {css: {"min-width": "266px"}}},formatter:function (value,row) {
  24. return `
  25. <div>
  26. <div style="display: flex;align-items: center;justify-content: space-between;color: #666;margin-bottom: 10px;">
  27. <div>订单编号:${row.order.orderId}</div>
  28. <div style="margin-left: 20px;">ID:${row.order_id}</div>
  29. </div>
  30. <div style="display: flex">
  31. <image style="width: 112px;height: 112px;border-radius: 10px" src="${row.detail.image}"></image>
  32. <div style="margin-left: 25px;">
  33. <div style="display: flex;align-items: center;margin-bottom: 8px;">
  34. <div style="font-size: 16px;font-weight: bold;">${row.detail.name}</div>
  35. </div>
  36. <div style="display: flex;align-items: center;margin-bottom: 6px;">
  37. <span style="margin-right: 30px;color: #999;font-size: 14px;">规格</span>
  38. <span style="color: #333;font-size: 14px">${row.detail.sku_name}</span>
  39. </div>
  40. <div style="display: flex;align-items: center;margin-bottom: 6px;">
  41. <span style="margin-right: 30px;color: #999;font-size: 14px;">数量</span>
  42. <span style="color: #333;font-size: 14px">X${row.detail.num}</span>
  43. </div>
  44. <div style="display: flex;align-items: center;margin-bottom: 6px;">
  45. <span style="margin-right: 30px;color: #999;font-size: 14px;">价格</span>
  46. <span style="color: #333;font-size: 14px">${row.detail.price}</span>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. `
  52. }},
  53. {field: 'id', title: __('申请退款'),operate: false, cellStyle: function () {return {css: {"max-width": "400px","min-width": "300px"}}},formatter:function (value,row){
  54. let result=`
  55. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;height: 66px;border-bottom: 1px solid #EEEEEE;">
  56. <span style="font-size: 14px;color: #999;">退款原因</span>
  57. <span style="color: #1677FF;font-size: 14px;margin-left: 20px;white-space: pre-line;">${row.refund_reason}</span>
  58. </div>
  59. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;height: 66px;">
  60. <span style="font-size: 14px;color: #999;">申请退款金额</span>
  61. <span style="color: #FF1F2B;font-size: 14px;margin-left: 20px;">${row.refund_price}</span>
  62. </div>
  63. `;
  64. return result
  65. }},
  66. {field: 'id', title: __('补充说明'),operate: false, cellStyle: function () {return {css: {"max-width": "400px","min-width": "300px"}}},formatter:function (value,row){
  67. let result=`
  68. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;height: 66px;">
  69. <span style="font-size: 14px;color: #999;">补充说明</span>
  70. <span style="color: #1677FF;font-size: 14px;margin-left: 20px;white-space: pre-line;">${row.content}</span>
  71. </div>
  72. `;
  73. if(row.images){
  74. let images = row.images.split(',')
  75. result +=`<div style="display: flex;align-items: center;justify-content:space-between;padding: 10px 20px;border-top: 1px solid #EEEEEE;">
  76. <span style="color: #999999;font-size: 12px;">图片</span>
  77. <div style="display: flex;align-items: center;margin-left: 20px;">`;
  78. for(let i=0; i < images.length; i++){
  79. result += `<img src="${images[i]}" alt="" style="width: 56px;height: 56px;margin-right:5px;border-radius: 8px;">`
  80. }
  81. result += `</div></div>`
  82. }
  83. return result
  84. }},
  85. {field: 'user_id', title: __('用户信息'),operate: false, cellStyle: function () {return {css: {"min-width": "248px"}}},formatter:function (value,row){
  86. let result = `<div style="display: flex;align-items: flex-start;">
  87. <img src="${row.user.avatar}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
  88. <div style="margin-left: 14px;flex: 1;">
  89. <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
  90. <span style="font-size: 16px;color: #333;">${row.user.nickname}</span>
  91. </div>
  92. <div style="display: flex;justify-content: space-between;">
  93. <span style="font-size: 14px;color: #666;">${row.user.mobile}</span>
  94. </div>
  95. `
  96. if(row.order.to_shop == 'door'){
  97. result += ` <div style="font-size: 14px;color: #666;text-align: left;margin-top:10px;">预约信息:${row.address.name+''+row.address.mobile}</div>
  98. <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>
  99. `
  100. }else {
  101. result += `<div style="font-size: 14px;color: #666;text-align: left;margin-top:10px;">核销码:${row.order.check_name}</div>
  102. <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>
  103. `
  104. }
  105. result += `</div>
  106. </div>`
  107. return result
  108. }},
  109. {field: 'shop_id', title: __('服务者/门店信息'),operate: false, cellStyle: function () {return {css: {"min-width": "248px"}}},formatter:function (value,row){
  110. if(row.shop && row.skill){
  111. return `<div>
  112. <div style="background: #F7F7F7;padding: 12px;border-radius: 10px;margin-top: 16px;">
  113. <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>
  114. <div style="display: flex;align-items: center;">
  115. <img src="${row.shop.logo_image}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
  116. <div style="margin-left: 14px;flex: 1;">
  117. <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
  118. <span style="font-size: 16px;color: #333;">${row.shop.name}</span>
  119. </div>
  120. <div style="display: flex;justify-content: space-between;">
  121. <span style="font-size: 14px;color: #666;">${row.shop.leader_name+''+row.shop.leader_mobile}</span>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. <div style="background: #F7F7F7;padding: 12px;border-radius: 10px;margin-top: 16px;">
  127. <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>
  128. <div style="display: flex;align-items: center;">
  129. <img src="${row.skill.image}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
  130. <div style="margin-left: 14px;flex: 1;">
  131. <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
  132. <span style="font-size: 16px;color: #333;">${row.skill.name}</span>
  133. </div>
  134. <div style="display: flex;justify-content: space-between;">
  135. <span style="font-size: 14px;color: #666;">${row.skill.mobile}</span>
  136. </div>
  137. </div>
  138. </div>
  139. </div>
  140. </div>`
  141. }else if(row.skill){
  142. return `<div>
  143. <div style="background: #F7F7F7;padding: 12px;border-radius: 10px;margin-top: 16px;">
  144. <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>
  145. <div style="display: flex;align-items: center;">
  146. <img src="${row.skill.image}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
  147. <div style="margin-left: 14px;flex: 1;">
  148. <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
  149. <span style="font-size: 16px;color: #333;">${row.skill.name}</span>
  150. </div>
  151. <div style="display: flex;justify-content: space-between;">
  152. <span style="font-size: 14px;color: #666;">${row.skill.mobile}</span>
  153. </div>
  154. </div>
  155. </div>
  156. </div>
  157. </div>`
  158. }else if(row.shop){
  159. return `<div>
  160. <div style="background: #F7F7F7;padding: 12px;border-radius: 10px;margin-top: 16px;">
  161. <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>
  162. <div style="display: flex;align-items: center;">
  163. <img src="${row.shop.logo_image}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
  164. <div style="margin-left: 14px;flex: 1;">
  165. <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
  166. <span style="font-size: 16px;color: #333;">${row.shop.name}</span>
  167. </div>
  168. <div style="display: flex;justify-content: space-between;">
  169. <span style="font-size: 14px;color: #666;">${row.shop.leader_name+''+row.shop.leader_mobile}</span>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. </div>`
  175. }else {
  176. return ''
  177. }
  178. }},
  179. {field: 'price', title: __('付款信息'),operate: false, align:'left',cellStyle: function () {return {css: {"min-width": "108px"}}},formatter:function (value,row){
  180. return `<div>
  181. <div style="display:flex;align-items: center;margin-bottom: 10px;">
  182. <div style="color: #999999;font-size: 14px;width: 72px;">总计</div>
  183. <div style="color: #E4484B;font-size: 18px;font-weight: bold;">${row.order.payprice}</div>
  184. </div>
  185. <div style="display:flex;align-items: center;margin-bottom: 6px;">
  186. <div style="color: #999999;font-size: 14px;width: 72px;">项目费</div>
  187. <div style="color: #3C78FF;font-size: 14px;">${row.order.price}</div>
  188. </div>
  189. <div style="display:flex;align-items: center;margin-bottom: 6px;">
  190. <div style="color: #999999;font-size: 14px;width: 72px;">项目折扣</div>
  191. <div style="color: #3C78FF;font-size: 14px;">${row.order.discount/10}</div>
  192. </div>
  193. <div style="display:flex;align-items: center;margin-bottom: 6px;">
  194. <div style="color: #999999;font-size: 14px;width: 72px;">优惠券</div>
  195. <div style="color: #3C78FF;font-size: 14px;">${row.order.coupon_price}</div>
  196. </div>
  197. <div style="display:flex;align-items: center;margin-bottom: 6px;">
  198. <div style="color: #999999;font-size: 14px;width: 72px;">车费</div>
  199. <div style="color: #3C78FF;font-size: 14px;">${row.order.travel_price}</div>
  200. </div>
  201. <div style="display:flex;align-items: center;margin-bottom: 6px;">
  202. <div style="color: #999999;font-size: 14px;width: 72px;">补差价</div>
  203. <div style="color: #3C78FF;font-size: 14px;">${row.order.premium_price}</div>
  204. </div>
  205. <div style="display:flex;align-items: center;">
  206. <div style="color: #999999;font-size: 14px;width: 72px;">加项费</div>
  207. <div style="color: #3C78FF;font-size: 14px;">${row.order.add_price}</div>
  208. </div>
  209. </div>`
  210. }},
  211. {field: 'id', title: __('审核状态'),operate: false, cellStyle: function () {return {css: {"min-width": "250px"}}},formatter:function (value,row){
  212. let result = `<div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;">
  213. <span style="font-size: 14px;color: #999;">状态</span>
  214. <span style="color: #1677FF;font-size: 14px;">${row.state_text}</span>
  215. </div>`
  216. if(row.state == -1){
  217. result+=`
  218. <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;">
  219. <div style="font-size: 14px;color: #999;flex-shrink:0;">拒绝原因</div>
  220. <div style="color: #FF1F2B;font-size: 14px;text-align:left;margin-left:20px">${row.note}</div>
  221. </div>
  222. `
  223. }
  224. return result
  225. }},
  226. {field: 'id', title: __('时间'),operate: false, cellStyle: function () {return {css: {"min-width": "180px"}}},formatter:function (value,row){
  227. return `
  228. <div style="margin-bottom: 10px;">
  229. <div style="color: #999999;font-size: 14px;margin-bottom: 8px;text-align:left;">创建时间</div>
  230. <div style="color: #333333;font-size: 14px;text-align:left;">${row.create_time}</div>
  231. </div>
  232. `
  233. }},
  234. // {checkbox: true},
  235. {field: 'id', title: __('Id'),visible: false},
  236. {field: 'user_id', title: __('User_id'),visible: false},
  237. {field: 'user.nickname', title: __('Nickname'),operate: false,visible: false},
  238. {field: 'user.mobile', title: __('Mobile'),operate: false,visible: false},
  239. {field: 'order.travel_price', title: __('Travel_price'),operate: false,visible: false},
  240. {field: 'order.payprice', title: __('Payprice'),operate: false,visible: false},
  241. {field: 'order_id', title: __('Order_id'),visible: false},
  242. {field: 'refund_reason', title: __('Refund_reason'), operate: 'LIKE',visible: false},
  243. {field: 'refund_price', title: __('Refund_price'), operate:'BETWEEN',visible: false},
  244. {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images,visible: false},
  245. {field: 'state', title: __('State'), searchList: {"0":__('State 0'),"1":__('State 1'),"-1":__('State -1')}, formatter: Table.api.formatter.normal,visible: false},
  246. {field: 'note', title: __('Note'), operate: 'LIKE',visible: false},
  247. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible: false},
  248. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible: false},
  249. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
  250. buttons: [
  251. {
  252. name: 'detail',
  253. text: __('订单详情'),
  254. title: __('订单详情'),
  255. classname: 'btn btn-xs btn-detail btn-dialog',
  256. icon: 'fa fa-detail',
  257. url: function(row){
  258. return 'service/order/order/info?ids='+row.order_id;
  259. },
  260. },
  261. {
  262. name: 'agree',
  263. text: __('同意退款'),
  264. title: __('同意退款'),
  265. classname: 'btn btn-xs btn-success btn-dialog',
  266. url: function(row){
  267. return 'service/order/order/refund?ids='+row.order_id;
  268. },
  269. hidden:function(row){
  270. if(row.state != 0){
  271. return true;
  272. }
  273. },
  274. success: function (data, ret) {
  275. $(".btn-refresh").trigger('click');
  276. },
  277. },
  278. {
  279. name: 'refund',
  280. text: __('拒绝退款'),
  281. title: __('拒绝退款'),
  282. classname: 'btn btn-xs btn-danger btn-dialog',
  283. url: function(row){
  284. return 'service/order/refundorder/refund?ids='+row.id;
  285. },
  286. hidden:function(row){
  287. if(row.state != 0){
  288. return true;
  289. }
  290. },
  291. success: function (data, ret) {
  292. $(".btn-refresh").trigger('click');
  293. },
  294. },
  295. ],
  296. formatter: Table.api.formatter.operate}
  297. ]
  298. ]
  299. });
  300. // 为表格绑定事件
  301. Table.api.bindevent(table);
  302. },
  303. add: function () {
  304. Controller.api.bindevent();
  305. },
  306. edit: function () {
  307. Controller.api.bindevent();
  308. },
  309. agree: function () {
  310. $(document).on('click', '.btn-embossed', function () {
  311. parent.$(".btn-refresh").trigger('click');
  312. });
  313. Controller.api.bindevent();
  314. },
  315. refund: function () {
  316. $(document).on('click', '.btn-embossed', function () {
  317. parent.$(".btn-refresh").trigger('click');
  318. });
  319. Controller.api.bindevent();
  320. },
  321. api: {
  322. bindevent: function () {
  323. Form.api.bindevent($("form[role=form]"));
  324. }
  325. }
  326. };
  327. return Controller;
  328. });