order.js 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  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/order/index' + location.search,
  8. // edit_url: 'service/order/order/edit',
  9. multi_url: 'service/order/order/multi',
  10. import_url: 'service/order/order/import',
  11. table: 'service_order',
  12. }
  13. });
  14. var table = $("#table");
  15. // 初始化表格
  16. table.bootstrapTable({
  17. url: $.fn.bootstrapTable.defaults.extend.index_url,
  18. pk: 'id',
  19. sortName: 'id',
  20. fixedColumns: true,
  21. fixedRightNumber: 1,
  22. columns: [
  23. [
  24. {field: 'goods_id', title: __('项目信息'),operate: false, cellStyle: function () {return {css: {"min-width": "266px"}}},formatter:function (value,row) {
  25. return `
  26. <div>
  27. <div style="display: flex;align-items: center;justify-content: space-between;color: #666;margin-bottom: 10px;">
  28. <div>订单编号:${row.orderId}</div>
  29. <div style="margin-left: 20px;">ID:${row.id}</div>
  30. </div>
  31. <div style="display: flex">
  32. <image style="width: 112px;height: 112px;border-radius: 10px" src="${row.detail.image}"></image>
  33. <div style="margin-left: 25px;">
  34. <div style="display: flex;align-items: center;margin-bottom: 8px;">
  35. <div style="font-size: 16px;font-weight: bold;">${row.detail.name}</div>
  36. <div style="margin-left: 10px;width: 68px;height: 26px;line-height: 26px;text-align: center;background: rgba(97, 22, 255, 0.10);border-radius: 13px;color: #6116FF;font-size: 12px;">${row.to_shop_text}</div>
  37. </div>
  38. <div style="display: flex;align-items: center;margin-bottom: 6px;">
  39. <span style="margin-right: 30px;color: #999;font-size: 14px;">规格</span>
  40. <span style="color: #333;font-size: 14px">${row.detail.sku_name}</span>
  41. </div>
  42. <div style="display: flex;align-items: center;margin-bottom: 6px;">
  43. <span style="margin-right: 30px;color: #999;font-size: 14px;">数量</span>
  44. <span style="color: #333;font-size: 14px">X${row.detail.num}</span>
  45. </div>
  46. <div style="display: flex;align-items: center;margin-bottom: 6px;">
  47. <span style="margin-right: 30px;color: #999;font-size: 14px;">价格</span>
  48. <span style="color: #333;font-size: 14px">${row.detail.price}</span>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. `
  54. }},
  55. {field: 'status', title: __('状态'),operate: false, cellStyle: function () {return {css: {"width": "200px"}}},formatter:function (value,row){
  56. let result = '';
  57. if(row.to_shop == 'shop' && row.status == 2){
  58. result += ` <div style="height: 58px;width: 196px;background: linear-gradient(90deg, #F0FAF3 0%, rgba(240,250,243,0) 100%);display: flex;
  59. align-items: center;justify-content: flex-start;padding-left: 20px;">
  60. <span style="color: #999;font-size: 14px;margin-right: 30px;">订单状态</span>
  61. <span style="color: #62CB81;font-size: 14px;font-weight: bold;">待核销</span>
  62. </div>`
  63. } else {
  64. result += `<div style="height: 58px;width: 196px;background: linear-gradient(90deg, #F0FAF3 0%, rgba(240,250,243,0) 100%);display: flex;
  65. align-items: center;justify-content: flex-start;padding-left: 20px;">
  66. <span style="color: #999;font-size: 14px;margin-right: 30px;">订单状态</span>
  67. <span style="color: #62CB81;font-size: 14px;font-weight: bold;">${row.status_text}</span>
  68. </div>`
  69. }
  70. result += `<div style="height: 58px;width: 196px;background: linear-gradient(90deg, #FFF2F2 0%, rgba(255,242,242,0) 100%);display: flex;
  71. align-items: center;justify-content: flex-start;padding-left: 20px;">
  72. <span style="color: #999;font-size: 14px;margin-right: 30px;">售后状态</span>
  73. <span style="color: #62CB81;font-size: 14px;font-weight: bold;">${row.is_service_text}</span>
  74. </div>
  75. <div style="height: 58px;width: 196px;background: linear-gradient(90deg, #FFF7E6 0%, rgba(255,247,230,0) 100%);display: flex;
  76. align-items: center;justify-content: flex-start;padding-left: 20px;">
  77. <span style="color: #999;font-size: 14px;margin-right: 30px;">投诉状态</span>
  78. <span style="color: #62CB81;font-size: 14px;font-weight: bold;">${row.is_complaint_text}</span>
  79. </div>`
  80. return result
  81. }},
  82. {field: 'user_id', title: __('用户信息'),operate: false, cellStyle: function () {return {css: {"min-width": "248px"}}},formatter:function (value,row){
  83. let result = `<div>
  84. <div style="display: flex;align-items: flex-start;">
  85. <img src="${row.user.avatar}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
  86. <div style="margin-left: 14px;flex: 1;">
  87. <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
  88. <span style="font-size: 16px;color: #333;">${row.user.nickname}</span>
  89. </div>
  90. <div style="display: flex;justify-content: space-between;">
  91. <span style="font-size: 14px;color: #666;">${row.user.mobile}</span>
  92. </div>`
  93. if(row.to_shop == 'door'){
  94. result += ` <div style="font-size: 14px;color: #666;text-align: left;margin-top:10px;">预约信息:${row.address.name+''+row.address.mobile}</div>
  95. <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>
  96. <div style="font-size: 14px;color: #666;text-align: left;">预约时间:${row.starttime_text}</div>
  97. `
  98. }else {
  99. result += `<div style="font-size: 14px;color: #666;text-align: left;margin-top:10px;">核销码:${row.check_name}</div>
  100. <div style="font-size: 14px;color: #666;text-align: left;margin-top:10px;">核销二维码:<img style="width:40px;height:40px;" src="${row.qrcode_image}" /></div>
  101. `
  102. }
  103. result += `</div></div></div>`
  104. return result
  105. }},
  106. {field: 'shop_id', title: __('服务者/门店信息'),operate: false, cellStyle: function () {return {css: {"min-width": "248px"}}},formatter:function (value,row){
  107. if(row.shop && row.skill){
  108. return `<div>
  109. <div style="background: #F7F7F7;padding: 12px;border-radius: 10px;margin-top: 16px;">
  110. <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>
  111. <div style="display: flex;align-items: center;">
  112. <img src="${row.shop.logo_image}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
  113. <div style="margin-left: 14px;flex: 1;">
  114. <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
  115. <span style="font-size: 16px;color: #333;">${row.shop.name}</span>
  116. </div>
  117. <div style="display: flex;justify-content: space-between;">
  118. <span style="font-size: 14px;color: #666;">${row.shop.leader_name+''+row.shop.leader_mobile}</span>
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. <div style="background: #F7F7F7;padding: 12px;border-radius: 10px;margin-top: 16px;">
  124. <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>
  125. <div style="display: flex;align-items: center;">
  126. <img src="${row.skill.image}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
  127. <div style="margin-left: 14px;flex: 1;">
  128. <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
  129. <span style="font-size: 16px;color: #333;">${row.skill.name}</span>
  130. </div>
  131. <div style="display: flex;justify-content: space-between;">
  132. <span style="font-size: 14px;color: #666;">${row.skill.mobile}</span>
  133. </div>
  134. </div>
  135. </div>
  136. </div>
  137. </div>`
  138. }else if(row.skill){
  139. return `<div>
  140. <div style="background: #F7F7F7;padding: 12px;border-radius: 10px;margin-top: 16px;">
  141. <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>
  142. <div style="display: flex;align-items: center;">
  143. <img src="${row.skill.image}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
  144. <div style="margin-left: 14px;flex: 1;">
  145. <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
  146. <span style="font-size: 16px;color: #333;">${row.skill.name}</span>
  147. </div>
  148. <div style="display: flex;justify-content: space-between;">
  149. <span style="font-size: 14px;color: #666;">${row.skill.mobile}</span>
  150. </div>
  151. </div>
  152. </div>
  153. </div>
  154. </div>`
  155. }else if(row.shop){
  156. return `<div>
  157. <div style="background: #F7F7F7;padding: 12px;border-radius: 10px;margin-top: 16px;">
  158. <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>
  159. <div style="display: flex;align-items: center;">
  160. <img src="${row.shop.logo_image}" alt="" style="width: 48px;height: 48px;flex-shrink: 0;border-radius: 50%;">
  161. <div style="margin-left: 14px;flex: 1;">
  162. <div style="margin-bottom: 5px;display: flex;justify-content: space-between;">
  163. <span style="font-size: 16px;color: #333;">${row.shop.name}</span>
  164. </div>
  165. <div style="display: flex;justify-content: space-between;">
  166. <span style="font-size: 14px;color: #666;">${row.shop.leader_name+''+row.shop.leader_mobile}</span>
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. </div>`
  172. }else {
  173. return ''
  174. }
  175. }},
  176. {field: 'price', title: __('付款信息'),operate: false, cellStyle: function () {return {css: {"min-width": "108px"}}},formatter:function (value,row){
  177. return `<div>
  178. <div style="display:flex;align-items: center;margin-bottom: 10px;">
  179. <div style="color: #999999;font-size: 14px;width: 72px;text-align:right;margin-right:20px;">总计</div>
  180. <div style="color: #E4484B;font-size: 18px;font-weight: bold;">${row.payprice}</div>
  181. </div>
  182. <div style="display:flex;align-items: center;margin-bottom: 6px;">
  183. <div style="color: #999999;font-size: 14px;width: 72px;text-align:right;margin-right:20px;">项目费</div>
  184. <div style="color: #3C78FF;font-size: 14px;">${row.price}</div>
  185. </div>
  186. <div style="display:flex;align-items: center;margin-bottom: 6px;">
  187. <div style="color: #999999;font-size: 14px;width: 72px;text-align:right;margin-right:20px;">项目折扣</div>
  188. <div style="color: #3C78FF;font-size: 14px;">${row.discount/10}</div>
  189. </div>
  190. <div style="display:flex;align-items: center;margin-bottom: 6px;">
  191. <div style="color: #999999;font-size: 14px;width: 72px;text-align:right;margin-right:20px;">优惠券</div>
  192. <div style="color: #3C78FF;font-size: 14px;">${row.coupon_price}</div>
  193. </div>
  194. <div style="display:flex;align-items: center;margin-bottom: 6px;">
  195. <div style="color: #999999;font-size: 14px;width: 72px;text-align:right;margin-right:20px;">车费</div>
  196. <div style="color: #3C78FF;font-size: 14px;">${row.travel_price}</div>
  197. </div>
  198. <div style="display:flex;align-items: center;margin-bottom: 6px;">
  199. <div style="color: #999999;font-size: 14px;width: 72px;text-align:right;margin-right:20px;">补差价</div>
  200. <div style="color: #3C78FF;font-size: 14px;">${row.premium_price}</div>
  201. </div>
  202. <div style="display:flex;align-items: center;margin-bottom: 6px;">
  203. <div style="color: #999999;font-size: 14px;width: 72px;text-align:right;margin-right:20px;">加项费</div>
  204. <div style="color: #3C78FF;font-size: 14px;">${row.add_price}</div>
  205. </div>
  206. <div style="display:flex;align-items: center;">
  207. <div style="color: #999999;font-size: 14px;width: 72px;text-align:right;margin-right:20px;">退款金额</div>
  208. <div style="color: #3C78FF;font-size: 14px;">${row.refund_price}</div>
  209. </div>
  210. </div>`
  211. }},
  212. {field: 'id', title: __('财务'),operate: false, cellStyle: function () {return {css: {"min-width": "250px"}}},formatter:function (value,row){
  213. if(row.is_settle == 2){
  214. let result = `
  215. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;">
  216. <span style="font-size: 14px;color: #999;">付款方式</span>
  217. <span style="color: #3C78FF;font-size: 14px;">${row.paytype_text}</span>
  218. </div>
  219. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;">
  220. <span style="font-size: 14px;color: #999;">服务者佣金</span>
  221. <span style="color: #3C78FF;font-size: 14px;">${row.skillRebate || 0}</span>
  222. </div>`
  223. if(row.shop_id > 0){
  224. result +=`
  225. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;border-top: 1px solid #EEEEEE;">
  226. <span style="font-size: 14px;color: #999;">商户佣金</span>
  227. <span style="color: #3C78FF;font-size: 14px;">${row.shopRebate}</span>
  228. </div>
  229. `
  230. }
  231. return result
  232. }else {
  233. let result = `
  234. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;">
  235. <span style="font-size: 14px;color: #999;">付款方式</span>
  236. <span style="color: #3C78FF;font-size: 14px;">${row.paytype_text}</span>
  237. </div>
  238. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;">
  239. <span style="font-size: 14px;color: #999;">服务者佣金</span>
  240. <span style="color: #3C78FF;font-size: 14px;">${row.is_settle_text}</span>
  241. </div>`
  242. if(row.shop_id > 0){
  243. result +=`
  244. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;border-top: 1px solid #EEEEEE;">
  245. <span style="font-size: 14px;color: #999;">商户佣金</span>
  246. <span style="color: #3C78FF;font-size: 14px;">${row.is_settle_text}</span>
  247. </div>
  248. `
  249. }
  250. if(row.leader_id>0){
  251. result +=`
  252. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;border-top: 1px solid #EEEEEE;">
  253. <span style="font-size: 14px;color: #999;">一级佣金</span>
  254. <span style="color: #3C78FF;font-size: 14px;">${row.is_settle_text}</span>
  255. </div>
  256. `
  257. }
  258. if(row.rec_leader_id>0){
  259. result +=`
  260. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;border-top: 1px solid #EEEEEE;">
  261. <span style="font-size: 14px;color: #999;">二级佣金</span>
  262. <span style="color: #3C78FF;font-size: 14px;">${row.is_settle_text}</span>
  263. </div>
  264. `
  265. }
  266. return result
  267. }
  268. }},
  269. {field: 'id', title: __('时间'),operate: false, cellStyle: function () {return {css: {"min-width": "180px"}}},formatter:function (value,row){
  270. return `
  271. <div style="margin-bottom: 10px;">
  272. <div style="color: #999999;font-size: 14px;margin-bottom: 8px;text-align:left;">创建时间</div>
  273. <div style="color: #333333;font-size: 14px;text-align:left;">${row.create_time}</div>
  274. </div>
  275. <div style="margin-bottom: 10px;">
  276. <div style="color: #999999;font-size: 14px;margin-bottom: 8px;text-align:left;">支付时间</div>
  277. <div style="color: #333333;font-size: 14px;text-align:left;">${row.paytime_text}</div>
  278. </div>
  279. <div>
  280. <div style="color: #999999;font-size: 14px;margin-bottom: 8px;text-align:left;">预约时间</div>
  281. <div style="color: #333333;font-size: 14px;text-align:left;">${row.starttime_text}</div>
  282. </div>
  283. `
  284. }},
  285. // {checkbox: true},
  286. {field: 'id', title: __('Id'),visible: false},
  287. {field: 'orderId', title: __('Orderid'), operate: 'LIKE', width:148,visible: false},
  288. // {field: 'reach_images', title: __('Reach_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  289. // {field: 'finish_images', title: __('Finish_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  290. {field: 'user_id', title: __('User_id'),visible: false},
  291. {field: 'skill_id', title: __('Skill_id'),visible: false},
  292. {field: 'leader_id', title: __('leader_id'),visible: false},
  293. {field: 'rec_leader_id', title: __('rec_leader_id'),visible: false},
  294. {field: 'shop_id', title: __('Shop_id'),visible: false},
  295. {field: 'goods_id', title: __('Goods_id'),visible: false},
  296. {field: 'traveltype', title: __('Traveltype'), searchList: {"0":__('Traveltype 0'),"1":__('Traveltype 1'),"2":__('Traveltype 2')}, formatter: Table.api.formatter.normal,visible: false},
  297. {field: 'choose_skill_type', title: __('Choose_skill_type'), searchList: {"0":__('Choose_skill_type 0'),"1":__('Choose_skill_type 1')}, formatter: Table.api.formatter.normal,visible: false},
  298. {field: 'paytype', title: __('Paytype'), searchList: {"0":__('Paytype 0'),"1":__('Paytype 1'),"2":__('Paytype 2'),"3":__('Paytype 3'),"4":__('Paytype 4')}, formatter: Table.api.formatter.normal,visible: false},
  299. {field: 'to_shop', title: __('To_shop'), searchList: {"door":__('To_shop door'),"shop":__('To_shop shop')}, formatter: Table.api.formatter.normal,visible: false},
  300. {field: 'price', title: __('Price'), operate:'BETWEEN',visible: false},
  301. // {field: 'distance', title: __('Distance'), operate:'BETWEEN'},
  302. // {field: 'travel_price', title: __('Travel_price'), operate:'BETWEEN'},
  303. // {field: 'sumprice', title: __('Sumprice'), operate:'BETWEEN'},
  304. // {field: 'goods_total_price', title: __('Goods_total_price'), operate:'BETWEEN'},
  305. // {field: 'discount', title: __('Discount')},
  306. // {field: 'coupon_id', title: __('Coupon_id')},
  307. // {field: 'coupon_price', title: __('Coupon_price'), operate:'BETWEEN'},
  308. // {field: 'premium_price', title: __('Premium_price'), operate:'BETWEEN'},
  309. // {field: 'add_price', title: __('Add_price'), operate:'BETWEEN'},
  310. {field: 'payprice', title: __('Payprice'), operate:'BETWEEN',visible: false},
  311. {field: 'act_travel_price', title: __('Act_travel_price'), operate:'BETWEEN',visible: false},
  312. {field: 'refund_price', title: __('Refund_price'), operate:'BETWEEN',visible: false},
  313. {field: 'settle_price', title: __('Settle_price'), operate:'BETWEEN',visible: false},
  314. {field: 'total_cost_seconds', title: __('Total_cost_seconds'),visible: false},
  315. {field: 'starttime', title: __('Starttime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible: false},
  316. {field: 'endtime', title: __('Endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible: false},
  317. //{field: 'actendtime', title: __('Actendtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  318. //{field: 'trade_no', title: __('Trade_no'), operate: 'LIKE'},
  319. {field: 'memo', title: __('Memo'), operate: 'LIKE',visible: false},
  320. {field: 'qrcode_image', title: __('Qrcode_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image,visible: false},
  321. {field: 'check_name', title: __('Check_name'),visible: false},
  322. {field: 'is_service', title: __('Is_service'), searchList: {"0":__('Is_service 0'),"1":__('Is_service 1'),"2":__('Is_service 2'),"-1":__('Is_service -1')}, formatter: Table.api.formatter.normal,visible: false},
  323. {field: 'is_complaint', title: __('Is_complaint'), searchList: {"0":__('Is_complaint 0'),"1":__('Is_complaint 1')}, formatter: Table.api.formatter.normal,visible: false},
  324. //{field: 'is_pool', title: __('Is_pool'), searchList: {"0":__('Is_pool 0'),"1":__('Is_pool 1')}, formatter: Table.api.formatter.normal},
  325. {field: 'is_settle', title: __('Is_settle'), searchList: {"0":__('Is_settle 0'),"1":__('Is_settle 1'),"2":__('Is_settle 2')}, formatter: Table.api.formatter.normal,visible: false},
  326. // {field: 'reach_images', title: __('Reach_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  327. // {field: 'finish_images', title: __('Finish_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  328. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4'),"5":__('Status 5'),"6":__('Status 6'),"7":__('Status 7'),"-1":__('Status -1')}, formatter: Table.api.formatter.status,visible: false},
  329. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible: false},
  330. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
  331. buttons: [
  332. {
  333. name: 'detail',
  334. text: __('订单详情'),
  335. title: __('订单详情'),
  336. classname: 'btn btn-xs btn-detail btn-dialog',
  337. icon: 'fa fa-detail',
  338. url: function(row){
  339. return 'service/order/order/info?ids='+row.id;
  340. },
  341. },
  342. {
  343. name: 'users',
  344. text: __('分配商户'),
  345. title: __('分配商户'),
  346. classname: 'btn btn-xs btn-change btn-dialog',
  347. url: function(row){
  348. return 'service/order/order/updateshop?ids='+row.id;
  349. },
  350. visible:function(row){
  351. if(row.status == 1 && !row.shop_id && !row.skill_id && (row.is_service == 0 || row.is_service == -1)){
  352. return true;
  353. }
  354. }
  355. },
  356. {
  357. name: 'users',
  358. text: __('分配服务者'),
  359. title: __('分配服务者'),
  360. classname: 'btn btn-xs btn-change btn-dialog',
  361. url: function(row){
  362. return 'service/order/order/updateskill?ids='+row.id;
  363. },
  364. visible:function(row){
  365. if(row.status == 1 && !row.skill_id && row.to_shop == 'door' && (row.is_service == 0 || row.is_service == -1)){
  366. return true;
  367. }
  368. }
  369. },
  370. {
  371. name: 'users',
  372. text: __('更换服务者'),
  373. title: __('更换服务者'),
  374. classname: 'btn btn-xs btn-change btn-dialog',
  375. url: function(row){
  376. return 'service/order/order/updateskill?ids='+row.id;
  377. },
  378. visible:function(row){
  379. if(row.skill_id && (row.status == 1 || row.status == 2) && (row.is_service == 0 || row.is_service == -1)){
  380. return true;
  381. }
  382. }
  383. },
  384. {
  385. name: 'accept',
  386. text: __('订单接取'),
  387. title: __('订单接取'),
  388. classname: 'btn btn-xs btn-status btn-ajax',
  389. url: 'service/order/order/handleOrder?state=2',
  390. success: function (data, ret) {
  391. $(".btn-refresh").trigger('click');
  392. },
  393. visible:function(row){
  394. if((row.skill_id) && row.status === 1 && (row.is_service == 0 || row.is_service == -1)){
  395. return true;
  396. }
  397. }
  398. },
  399. {
  400. name: 'go',
  401. text: __('服务者出发'),
  402. title: __('服务者出发'),
  403. classname: 'btn btn-xs btn-status btn-ajax',
  404. url: 'service/order/order/handleOrder?state=3',
  405. success: function (data, ret) {
  406. $(".btn-refresh").trigger('click');
  407. },
  408. visible:function(row){
  409. if(row.status === 2 && row.to_shop == 'door' && (row.is_service == 0 || row.is_service == -1)){
  410. return true;
  411. }
  412. }
  413. },
  414. {
  415. name: 'check',
  416. text: __('订单已核销'),
  417. title: __('订单已核销'),
  418. classname: 'btn btn-xs btn-status btn-ajax',
  419. url: 'service/order/order/handleOrder?state=6',
  420. success: function (data, ret) {
  421. $(".btn-refresh").trigger('click');
  422. },
  423. visible:function(row){
  424. if(row.status === 2 && row.to_shop == 'shop' && (row.is_service == 0 || row.is_service == -1)){
  425. return true;
  426. }
  427. }
  428. },
  429. {
  430. name: '',
  431. text: __('服务者到达'),
  432. title: __('服务者到达'),
  433. classname: 'btn btn-xs btn-status btn-ajax',
  434. url: 'service/order/order/handleOrder?state=4',
  435. success: function (data, ret) {
  436. $(".btn-refresh").trigger('click');
  437. },
  438. visible:function(row){
  439. if(row.status === 3 && row.to_shop == 'door' && (row.is_service == 0 || row.is_service == -1)){
  440. return true;
  441. }
  442. }
  443. },
  444. {
  445. name: '',
  446. text: __('开始服务'),
  447. title: __('开始服务'),
  448. classname: 'btn btn-xs btn-status btn-ajax',
  449. url: 'service/order/order/handleOrder?state=5',
  450. success: function (data, ret) {
  451. $(".btn-refresh").trigger('click');
  452. },
  453. visible:function(row){
  454. if(row.status === 4 && row.to_shop == 'door' && (row.is_service == 0 || row.is_service == -1)){
  455. return true;
  456. }
  457. }
  458. },
  459. {
  460. name: '',
  461. text: __('服务完成'),
  462. title: __('服务完成'),
  463. classname: 'btn btn-xs btn-status btn-ajax',
  464. url: 'service/order/order/handleOrder?state=6',
  465. success: function (data, ret) {
  466. $(".btn-refresh").trigger('click');
  467. },
  468. visible:function(row){
  469. if(row.status === 5 && (row.is_service == 0 || row.is_service == -1)){
  470. return true;
  471. }
  472. }
  473. },
  474. {
  475. name: 'comment',
  476. text: __('订单评价'),
  477. title: __('订单评价'),
  478. classname: 'btn btn-xs btn-success btn-comment btn-dialog',
  479. url: function(row){
  480. return 'service/order/comment/index?order_id='+row.id;
  481. },
  482. visible:function(row){
  483. if(row.status === 7){
  484. return true;
  485. }
  486. }
  487. },
  488. {
  489. name: 'refund',
  490. text: __('退款'),
  491. title: __('退款'),
  492. classname: 'btn btn-xs btn-cancel btn-dialog',
  493. url: function(row){
  494. return 'service/order/order/refund?ids='+row.id;
  495. },
  496. hidden:function(row){
  497. if(row.is_settle === 2 || row.is_service === 2 || row.status == -1 || row.status == 0){
  498. return true;
  499. }
  500. }
  501. },
  502. ],
  503. formatter: Table.api.formatter.operate}
  504. ]
  505. ]
  506. });
  507. // 为表格绑定事件
  508. Table.api.bindevent(table);
  509. },
  510. recyclebin: function () {
  511. // 初始化表格参数配置
  512. Table.api.init({
  513. extend: {
  514. 'dragsort_url': ''
  515. }
  516. });
  517. var table = $("#table");
  518. // 初始化表格
  519. table.bootstrapTable({
  520. url: 'service/order/order/recyclebin' + location.search,
  521. pk: 'id',
  522. sortName: 'id',
  523. columns: [
  524. [
  525. {checkbox: true},
  526. {field: 'id', title: __('Id')},
  527. {
  528. field: 'deletetime',
  529. title: __('Deletetime'),
  530. operate: 'RANGE',
  531. addclass: 'datetimerange',
  532. formatter: Table.api.formatter.datetime
  533. },
  534. {
  535. field: 'operate',
  536. width: '140px',
  537. title: __('Operate'),
  538. table: table,
  539. events: Table.api.events.operate,
  540. buttons: [
  541. {
  542. name: 'Restore',
  543. text: __('Restore'),
  544. classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
  545. icon: 'fa fa-rotate-left',
  546. url: 'service/order/order/restore',
  547. refresh: true
  548. },
  549. {
  550. name: 'Destroy',
  551. text: __('Destroy'),
  552. classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
  553. icon: 'fa fa-times',
  554. url: 'service/order/order/destroy',
  555. refresh: true
  556. }
  557. ],
  558. formatter: Table.api.formatter.operate
  559. }
  560. ]
  561. ]
  562. });
  563. // 为表格绑定事件
  564. Table.api.bindevent(table);
  565. },
  566. add: function () {
  567. Controller.api.bindevent();
  568. },
  569. edit: function () {
  570. Controller.api.bindevent();
  571. },
  572. updateshop: function () {
  573. $(document).on('click', '.btn-embossed', function () {
  574. parent.$(".btn-refresh").trigger('click');
  575. });
  576. Controller.api.bindevent();
  577. },
  578. updateskill: function () {
  579. $(document).on('click', '.btn-embossed', function () {
  580. parent.$(".btn-refresh").trigger('click');
  581. });
  582. Controller.api.bindevent();
  583. },
  584. refund: function () {
  585. $(document).on('click', '.btn-embossed', function () {
  586. parent.$(".btn-refresh").trigger('click');
  587. });
  588. Controller.api.bindevent();
  589. },
  590. api: {
  591. bindevent: function () {
  592. Form.api.bindevent($("form[role=form]"));
  593. }
  594. }
  595. };
  596. return Controller;
  597. });