complaint.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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/complaint/index' + location.search,
  8. multi_url: 'service/order/complaint/multi',
  9. import_url: 'service/order/complaint/import',
  10. table: 'service_complaint',
  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: 'user_id', title: __('用户信息'),operate: false, cellStyle: function () {return {css: {"min-width": "248px"}}},formatter:function (value,row){
  54. let result = `<div>
  55. <div style="display: flex;align-items: flex-start;">
  56. <img src="${row.user.avatar}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
  57. <div style="margin-left: 14px;flex: 1;">
  58. <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
  59. <span style="font-size: 16px;color: #333;">${row.user.nickname}</span>
  60. </div>
  61. <div style="display: flex;justify-content: space-between;">
  62. <span style="font-size: 14px;color: #666;">${row.user.mobile}</span>
  63. </div>`
  64. if(row.order.to_shop == 'door'){
  65. result += ` <div style="font-size: 14px;color: #666;text-align: left;margin-top:10px;">预约信息:${row.address.name+''+row.address.mobile}</div>
  66. <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>
  67. `
  68. }else {
  69. result += `<div style="font-size: 14px;color: #666;text-align: left;margin-top:10px;">核销码:${row.order.check_name}</div>
  70. <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>
  71. `
  72. }
  73. result += `</div></div></div>`
  74. return result
  75. }},
  76. {field: 'shop_id', title: __('服务者/门店信息'),operate: false, cellStyle: function () {return {css: {"min-width": "248px"}}},formatter:function (value,row){
  77. if(row.shop && row.skill){
  78. return `<div>
  79. <div style="background: #F7F7F7;padding: 12px;border-radius: 10px;margin-top: 16px;">
  80. <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>
  81. <div style="display: flex;align-items: center;">
  82. <img src="${row.shop.logo_image}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
  83. <div style="margin-left: 14px;flex: 1;">
  84. <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
  85. <span style="font-size: 16px;color: #333;">${row.shop.name}</span>
  86. </div>
  87. <div style="display: flex;justify-content: space-between;">
  88. <span style="font-size: 14px;color: #666;">${row.shop.leader_name+''+row.shop.leader_mobile}</span>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. <div style="background: #F7F7F7;padding: 12px;border-radius: 10px;margin-top: 16px;">
  94. <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>
  95. <div style="display: flex;align-items: center;">
  96. <img src="${row.skill.image}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
  97. <div style="margin-left: 14px;flex: 1;">
  98. <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
  99. <span style="font-size: 16px;color: #333;">${row.skill.name}</span>
  100. </div>
  101. <div style="display: flex;justify-content: space-between;">
  102. <span style="font-size: 14px;color: #666;">${row.skill.mobile}</span>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. </div>`
  108. }else if(row.skill){
  109. return `<div>
  110. <div style="background: #F7F7F7;padding: 12px;border-radius: 10px;margin-top: 16px;">
  111. <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>
  112. <div style="display: flex;align-items: center;">
  113. <img src="${row.skill.image}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
  114. <div style="margin-left: 14px;flex: 1;">
  115. <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
  116. <span style="font-size: 16px;color: #333;">${row.skill.name}</span>
  117. </div>
  118. <div style="display: flex;justify-content: space-between;">
  119. <span style="font-size: 14px;color: #666;">${row.skill.mobile}</span>
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. </div>`
  125. }else if(row.shop){
  126. return `<div>
  127. <div style="background: #F7F7F7;padding: 12px;border-radius: 10px;margin-top: 16px;">
  128. <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>
  129. <div style="display: flex;align-items: center;">
  130. <img src="${row.shop.logo_image}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
  131. <div style="margin-left: 14px;flex: 1;">
  132. <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
  133. <span style="font-size: 16px;color: #333;">${row.shop.name}</span>
  134. </div>
  135. <div style="display: flex;justify-content: space-between;">
  136. <span style="font-size: 14px;color: #666;">${row.shop.leader_name+''+row.shop.leader_mobile}</span>
  137. </div>
  138. </div>
  139. </div>
  140. </div>
  141. </div>`
  142. }else {
  143. return ''
  144. }
  145. }},
  146. {field: 'price', title: __('付款信息'),operate: false, align:'left',cellStyle: function () {return {css: {"min-width": "108px"}}},formatter:function (value,row){
  147. return `<div>
  148. <div style="display:flex;align-items: center;margin-bottom: 10px;">
  149. <div style="color: #999999;font-size: 14px;width: 72px;">总计</div>
  150. <div style="color: #E4484B;font-size: 18px;font-weight: bold;">${row.order.payprice}</div>
  151. </div>
  152. <div style="display:flex;align-items: center;margin-bottom: 6px;">
  153. <div style="color: #999999;font-size: 14px;width: 72px;">项目费</div>
  154. <div style="color: #3C78FF;font-size: 14px;">${row.order.price}</div>
  155. </div>
  156. <div style="display:flex;align-items: center;margin-bottom: 6px;">
  157. <div style="color: #999999;font-size: 14px;width: 72px;">项目折扣</div>
  158. <div style="color: #3C78FF;font-size: 14px;">${row.order.discount/10}</div>
  159. </div>
  160. <div style="display:flex;align-items: center;margin-bottom: 6px;">
  161. <div style="color: #999999;font-size: 14px;width: 72px;">优惠券</div>
  162. <div style="color: #3C78FF;font-size: 14px;">${row.order.coupon_price}</div>
  163. </div>
  164. <div style="display:flex;align-items: center;margin-bottom: 6px;">
  165. <div style="color: #999999;font-size: 14px;width: 72px;">车费</div>
  166. <div style="color: #3C78FF;font-size: 14px;">${row.order.travel_price}</div>
  167. </div>
  168. <div style="display:flex;align-items: center;margin-bottom: 6px;">
  169. <div style="color: #999999;font-size: 14px;width: 72px;">补差价</div>
  170. <div style="color: #3C78FF;font-size: 14px;">${row.order.premium_price}</div>
  171. </div>
  172. <div style="display:flex;align-items: center;">
  173. <div style="color: #999999;font-size: 14px;width: 72px;">加项费</div>
  174. <div style="color: #3C78FF;font-size: 14px;">${row.order.add_price}</div>
  175. </div>
  176. </div>`
  177. }},
  178. {field: 'id', title: __('申请投诉'),operate: false, cellStyle: function () {return {css: {"max-width": "400px","min-width": "300px"}}},formatter:function (value,row){
  179. let result=`
  180. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;height: 66px;">
  181. <span style="font-size: 14px;color: #999;">投诉原因</span>
  182. <span style="color: #1677FF;font-size: 14px;margin-left: 20px;white-space: pre-line;">${row.complaint_content}</span>
  183. </div>
  184. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;height: 66px;">
  185. <span style="font-size: 14px;color: #999;">补充说明</span>
  186. <span style="color: #1677FF;font-size: 14px;margin-left: 20px;white-space: pre-line;">${row.content}</span>
  187. </div>
  188. `;
  189. if(row.images){
  190. let images = row.images.split(',')
  191. result +=`<div style="display: flex;align-items: center;justify-content:space-between;padding: 10px 20px;border-top: 1px solid #EEEEEE;">
  192. <span style="color: #999999;font-size: 12px;">图片</span>
  193. <div style="display: flex;align-items: center;margin-left: 20px;">`;
  194. for(let i=0; i < images.length; i++){
  195. result += `<img src="${images[i]}" alt="" style="width: 56px;height: 56px;margin-right:5px;border-radius: 8px;">`
  196. }
  197. result += `</div></div>`
  198. }
  199. return result
  200. }},
  201. {field: 'id', title: __('审核状态'),operate: false, cellStyle: function () {return {css: {"min-width": "250px"}}},formatter:function (value,row){
  202. return `
  203. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;border-bottom: 1px solid #EEEEEE;">
  204. <span style="font-size: 14px;color: #999;">状态</span>
  205. <span style="color: #1677FF;font-size: 14px;">${row.state_text}</span>
  206. </div>
  207. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;">
  208. <span style="font-size: 14px;color: #999;">时间</span>
  209. <span style="color: #FF1F2B;font-size: 14px;">${row.create_time}</span>
  210. </div>
  211. `
  212. }},
  213. {checkbox: true,visible: false},
  214. {field: 'id', title: __('Id'),visible: false},
  215. {field: 'user_id', title: __('User_id'),visible: false},
  216. {field: 'order_id', title: __('Order_id'),visible: false},
  217. {field: 'complaint_content', title: __('Complaint_content'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content,visible: false},
  218. {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images,visible: false},
  219. {field: 'state', title: __('State'), searchList: {"0":__('State 0'),"1":__('State 1'),"-1":__('State -1')}, formatter: Table.api.formatter.normal,visible: false},
  220. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible: false},
  221. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible: false},
  222. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
  223. buttons: [
  224. {
  225. name: 'detail',
  226. text: __('订单详情'),
  227. title: __('订单详情'),
  228. classname: 'btn btn-xs btn-detail btn-dialog',
  229. icon: 'fa fa-detail',
  230. url: function(row){
  231. return 'service/order/order/info?ids='+row.order_id;
  232. },
  233. },
  234. {
  235. name: 'deduct',
  236. text: __('扣除保证金'),
  237. title: __('扣除保证金'),
  238. classname: 'btn btn-xs btn-change btn-dialog',
  239. url: function(row){
  240. return 'service/order/complaint/deduct?ids='+row.order_id;
  241. },
  242. hidden:function(row){
  243. if(row.shop == '' && row.skill == ''){
  244. return true;
  245. }
  246. }
  247. },
  248. {
  249. name:'audit',
  250. text:'已处理',
  251. title:'已处理',
  252. classname: 'btn btn-xs btn-success btn-magic btn-ajax',
  253. confirm: '已经处理过了吗?',
  254. url: 'service/order/complaint/handle?state=1',
  255. success: function (data, ret) {
  256. $(".btn-refresh").trigger('click');
  257. },
  258. hidden:function(row){
  259. if(row.state !== 0){
  260. return true;
  261. }
  262. }
  263. }
  264. ],
  265. formatter: Table.api.formatter.operate}
  266. ]
  267. ]
  268. });
  269. // 为表格绑定事件
  270. Table.api.bindevent(table);
  271. },
  272. add: function () {
  273. Controller.api.bindevent();
  274. },
  275. edit: function () {
  276. Controller.api.bindevent();
  277. },
  278. deduct: function () {
  279. Controller.api.bindevent();
  280. },
  281. api: {
  282. bindevent: function () {
  283. Form.api.bindevent($("form[role=form]"));
  284. }
  285. }
  286. };
  287. return Controller;
  288. });