skill.js 24 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. dragsort_url: '',
  8. index_url: 'service/skill/skill/index' + location.search,
  9. add_url: 'service/skill/skill/add',
  10. edit_url: 'service/skill/skill/edit',
  11. multi_url: 'service/skill/skill/multi',
  12. import_url: 'service/skill/skill/import',
  13. table: 'service_skill'
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'weigh',
  22. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. // {checkbox: true},
  27. {field: 'id', title: __('服务者信息'),operate: false,formatter:function (value,row){
  28. let result = `<div style="display: flex;">
  29. <img style="width: 100px;height: 100px;" src="${row.image}"/>
  30. <div style="margin-left: 16px;flex:1;">
  31. <div style="display: flex;align-items: center">
  32. <span style="font-size: 16px;color: #333;">${row.name}</span>
  33. <div style="background: rgba(248, 118, 121, 0.10);height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;margin-left: 8px;color: rgba(248, 118, 121, 1)">ID:${row.id}</div>
  34. <div style="background: rgba(98, 203, 129, 0.10);height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;margin-left: 8px;color: rgba(98, 203, 129, 1)">工号:${row.code}</div>
  35. <div style="background: rgba(123, 101, 251, 0.10);height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;margin-left: 8px;color: #7B65FB">${row.skill_cate_name}</div>
  36. <div style="flex: 1"></div>`
  37. if(row.is_rest == 0){
  38. result += `<div style="background: rgba(98, 203, 129, 0.10);height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;margin-left: 8px;color: rgba(98, 203, 129, 1)">${row.is_rest_text}</div>`
  39. }else{
  40. result += `<div style="background: #F7F7F7;height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;margin-left: 8px;color: #666666">${row.is_rest_text}</div>`
  41. }
  42. result += `
  43. </div>
  44. <div style="color: #333333;font-size: 14px;margin-top: 8px;display: flex;align-items: center;">
  45. <span style="color: #333;font-size: 14px;margin-right: 8px;">${row.sex_text}</span><span style="color: #333;font-size: 14px;margin-right: 8px;">${row.mobile}</span><span>身份证:</span>${row.idcard}
  46. </div>
  47. <div style="display: flex;align-items: center;margin-top: 8px;">
  48. <div style="background: #F0FAF3;height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;margin-right: 8px;"><span style="color: #999999">学历:</span>${row.edu_text}</div>
  49. <div style="background: #EFF5FF;height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;margin-right: 8px;"><span style="color: #999999">年龄:</span>${row.age}</div>
  50. <div style="background: #F6F1FF;height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;margin-right: 8px;"><span style="color: #999999">民族:</span>${row.nation}</div>
  51. <div style="background: #FFF7E6;height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;"><span style="color: #999999">经验:</span>${row.exper_text}</div>
  52. </div>
  53. <div style="display: flex;align-items: center;margin-top: 8px;width: 100%;">
  54. <div style="width: 100%;background: #F7F7F7;display: flex;align-items: center;padding: 8px;border-radius: 6px;"><span style="color: #999999">所在位置:</span>${row.province}${row.city}${row.district}${row.address}</div>
  55. </div>
  56. <div style="display: flex;align-items: center;margin-top: 8px;width: 100%;">
  57. <div style="width: 100%;background: #EFF5FF;display: flex;align-items: center;padding: 8px;border-radius: 6px;color: #1677FF;"><span style="color: #999999">所属商户:</span>${row.shop_name}</div>
  58. </div>
  59. </div>
  60. </div>`
  61. return result
  62. }},
  63. {field: 'id', title: __('钱包'),operate: false, cellStyle: function () {return {css: {"min-width": "250px"}}},formatter:function (value,row){
  64. return `
  65. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;border-bottom: 1px solid #EEEEEE;">
  66. <span style="font-size: 14px;color: #999;">保证金</span>
  67. <span style="color: #62CB81;font-size: 14px;">${row.ensure_price}</span>
  68. </div>
  69. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;border-bottom: 1px solid #EEEEEE;">
  70. <span style="font-size: 14px;color: #999;">平台钱包</span>
  71. <span style="color: #62CB81;font-size: 14px;">${row.skillmoney.money}</span>
  72. </div>
  73. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;">
  74. <span style="font-size: 14px;color: #999;">商户钱包</span>
  75. <span style="color: #62CB81;font-size: 14px;">${row.skillmoney.shop_money}</span>
  76. </div>
  77. `
  78. }},
  79. {field: 'id', title: __('接单信息'),operate: false,formatter:function (value,row){
  80. return `
  81. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;border-bottom: 1px solid #EEEEEE;">
  82. <span style="font-size: 14px;color: #999;">每日可接单数量</span>
  83. <span style="color: #333;font-size: 14px;">${row.accept_nums}</span>
  84. </div>
  85. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;border-bottom: 1px solid #EEEEEE;">
  86. <span style="font-size: 14px;color: #999;">已接单数量</span>
  87. <span style="color: #333;font-size: 14px;">${row.already_accept_nums}</span>
  88. </div>
  89. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;">
  90. <span style="font-size: 14px;color: #999;">订单收益分成%</span>
  91. <span style="color: #333;font-size: 14px;">${row.percent}</span>
  92. </div>
  93. `
  94. }},
  95. {field: 'id', title: __('证件'),operate: false,formatter:function (value,row){
  96. return `
  97. <div style="display: flex;align-items: center;border-bottom: 1px solid #EEEEEE; padding: 10px 0;">
  98. <div style="display: flex;flex-direction: column;align-items: center;margin-right: 10px;">
  99. <img src="${row.front_image}" alt="" style="width: 56px;height: 56px;border-radius: 8px;margin-bottom: 8px;">
  100. <span style="color: #999999;font-size: 12px;">身份证正面</span>
  101. </div>
  102. <div style="display: flex;flex-direction: column;align-items: center;">
  103. <img src="${row.opposite_image}" alt="" style="width: 56px;height: 56px;border-radius: 8px;margin-bottom: 8px;">
  104. <span style="color: #999999;font-size: 12px;">身份证反面</span>
  105. </div>
  106. </div>
  107. <div style="display: flex;align-items: center;padding: 10px 0 0;">
  108. <div style="display: flex;flex-direction: column;align-items: center;margin-right: 10px;">
  109. <img src="${row.certificate_image}" alt="" style="width: 56px;height: 56px;border-radius: 8px;margin-bottom: 8px;">
  110. <span style="color: #999999;font-size: 12px;">从业资格证</span>
  111. </div>
  112. <div style="display: flex;flex-direction: column;align-items: center;">
  113. <img src="${row.health_image}" alt="" style="width: 56px;height: 56px;border-radius: 8px;margin-bottom: 8px;">
  114. <span style="color: #999999;font-size: 12px;">健康证</span>
  115. </div>
  116. </div>
  117. `
  118. }},
  119. {field: 'id', title: __('照片'),operate: false,cellStyle: function () {return {css: {"min-width": "300px","max-width": "500px"}}},formatter:function (value,row){
  120. let word = row.goodsname.split(',')
  121. let result = '<div style="color: #333;font-size: 14px;margin-bottom: 8px;flex-wrap: wrap;display: flex;align-items: center">';
  122. for(let i=0; i < word.length; i++){
  123. result += `<div style="margin: 0 8px 8px;">${word[i]}</div>`
  124. }
  125. result+='</div>'
  126. return result
  127. }},
  128. {field: 'id', title: __('照片'),operate: false,formatter:function (value,row){
  129. let images = row.images.split(',')
  130. let result = `<div style="display: flex;align-items: flex-start;flex-direction: column;border-bottom: 1px solid #EEEEEE; padding: 10px 0;">
  131. <span style="color: #999999;font-size: 12px;">实拍照</span>
  132. <div style="display: flex;flex-direction: column;align-items: center;margin-top: 8px;">
  133. <img src="${row.user_image}" alt="" style="width: 56px;height: 56px;border-radius: 8px;">
  134. </div>
  135. </div>`
  136. if(row.images.length>0){
  137. result+=`<div style="display: flex;align-items: flex-start;flex-direction: column;padding: 10px 0 0;margin-top: 8px;">
  138. <span style="color: #999999;font-size: 12px;">相册</span>
  139. <div style="display: flex;align-items: center;margin-top: 8px;">`;
  140. for(let i=0; i < images.length; i++){
  141. result += `<img src="${images[i]}" alt="" style="width: 56px;height: 56px;margin-right:5px;border-radius: 8px;">`
  142. }
  143. result+='</div></div>'
  144. }
  145. return result
  146. }},
  147. {field: 'id', title: __('权重、状态'),operate: false, cellStyle: function () {return {css: {"min-width": "250px"}}},formatter:function (value,row){
  148. return `
  149. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;border-bottom: 1px solid #EEEEEE;">
  150. <span style="font-size: 14px;color: #999;">权重</span>
  151. <span style="color: #333;font-size: 14px;">${row.weigh}</span>
  152. </div>
  153. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;">
  154. <span style="font-size: 14px;color: #999;">状态</span>
  155. <span style="color: #1677FF;font-size: 14px;">${row.state_text}</span>
  156. </div>
  157. `
  158. }},
  159. {field: 'id', title: __('时间'),operate: false, cellStyle: function () {return {css: {"min-width": "180px"}}},formatter:function (value,row){
  160. return `
  161. <div style="margin-bottom: 10px;">
  162. <div style="color: #999999;font-size: 14px;margin-bottom: 8px;text-align:left;">创建时间</div>
  163. <div style="color: #333333;font-size: 14px;text-align:left;">${row.create_time}</div>
  164. </div>
  165. <div>
  166. <div style="color: #999999;font-size: 14px;margin-bottom: 8px;text-align:left;">更新时间</div>
  167. <div style="color: #333333;font-size: 14px;text-align:left;">${row.update_time}</div>
  168. </div>
  169. `
  170. }},
  171. {field: 'id', title: __('Id'),visible: false},
  172. {field: 'user_id', title: __('User_id'),visible: false},
  173. {field: 'shop_id', title: __('Shop_id'),visible: false},
  174. {field: 'shop_name', title: __('Shop_name'),operate:false,visible: false},
  175. {field: 'ensure_price', title: __('Ensure_price'), operate:'BETWEEN',visible: false},
  176. {field: 'code', title: __('Code'),visible: false},
  177. {field: 'skillmoney.money', title: __('Money'),operate: false,visible: false},
  178. {field: 'skillmoney.shop_money', title: __('Shop_money'),operate: false,visible: false},
  179. {field: 'mobile', title: __('Mobile'),visible: false},
  180. {field: 'accept_nums', title: __('Accept_nums'),visible: false},
  181. {field: 'already_accept_nums', title: __('Already_accept_nums'),visible: false},
  182. {field: 'percent', title: __('Percent'),visible: false},
  183. {field: 'name', title: __('Name'),visible: false},
  184. {field: 'sex', title: __('Sex'), searchList: {"1":__('Sex 1'),"0":__('Sex 0')}, formatter: Table.api.formatter.normal,visible: false},
  185. {field: 'idcard', title: __('Idcard'),visible: false},
  186. {field: 'front_image', title: __('Front_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image,visible: false},
  187. {field: 'opposite_image', title: __('Opposite_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image,visible: false},
  188. {field: 'user_image', title: __('User_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image,visible: false},
  189. {field: 'certificate_image', title: __('Certificate_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image,visible: false},
  190. {field: 'health_image', title: __('Health_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image,visible: false},
  191. {field: 'category_id', title: __('Category_id'),visible: false},
  192. {field: 'category_name', title: __('Category_name'),operate:false,visible: false},
  193. {field: 'skill_cate_id', title: __('Skill_cate_id'),visible: false},
  194. {field: 'skill_cate_name', title: __('Skill_cate_name'),operate:false,visible: false},
  195. {field: 'goods_ids', title: __('Goods_ids'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content,visible: false},
  196. {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image,visible: false},
  197. {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images,visible: false},
  198. {field: 'edu', title: __('Edu'), searchList: {"0":__('Edu 0'),"1":__('Edu 1'),"2":__('Edu 2'),"3":__('Edu 3'),"4":__('Edu 4'),"5":__('Edu 5'),"6":__('Edu 6')}, formatter: Table.api.formatter.normal,visible: false},
  199. {field: 'age', title: __('Age'),visible: false},
  200. {field: 'nation', title: __('Nation'),visible: false},
  201. {field: 'exper', title: __('Exper'), searchList: {"0":__('Exper 0'),"1":__('Exper 1'),"2":__('Exper 2'),"3":__('Exper 3')}, formatter: Table.api.formatter.normal,visible: false},
  202. {field: 'province', title: __('Province'), operate: 'LIKE',visible: false},
  203. {field: 'city', title: __('City'), operate: 'LIKE',visible: false},
  204. {field: 'district', title: __('District'), operate: 'LIKE',visible: false},
  205. {field: 'address', title: __('Address'), operate: 'LIKE',visible: false},
  206. {field: 'is_rest', title: __('Is_rest'), searchList: {"0":__('Is_rest 0'),"1":__('Is_rest 1')}, formatter: Table.api.formatter.normal,visible: false},
  207. {field: 'rebate_price', title: __('Rebate_price'), operate:'BETWEEN',visible: false},
  208. {field: 'state', title: __('State'), searchList: {"0":__('State 0'),"1":__('State 1')}, formatter: Table.api.formatter.normal,visible: false},
  209. {field: 'weigh', title: __('Weigh'), operate: false,visible: false},
  210. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible: false},
  211. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible: false},
  212. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
  213. buttons: [
  214. {
  215. name: 'list',
  216. text: __('平台余额明细'),
  217. title: __('平台余额明细'),
  218. classname: 'btn btn-xs btn-detail btn-dialog',
  219. icon: 'fa fa-list-o',
  220. url: function(row){
  221. return 'service/money/serviceusermoneylog/index?user_id='+row.user_id;
  222. },
  223. },
  224. {
  225. name: 'list',
  226. text: __('商户余额明细'),
  227. title: __('商户余额明细'),
  228. classname: 'btn btn-xs btn-change btn-dialog',
  229. icon: 'fa fa-list-o',
  230. url: function(row){
  231. return 'service/money/shopmoneylog/index?user_id='+row.user_id;
  232. },
  233. },
  234. {
  235. name: 'list',
  236. text: __('保证金明细'),
  237. title: __('保证金明细'),
  238. classname: 'btn btn-xs btn-list btn-dialog',
  239. icon: 'fa fa-list-o',
  240. url: function(row){
  241. return 'service/money/ensurelog/index?user_id='+row.user_id+'&type=0';
  242. },
  243. },
  244. {
  245. name: 'list',
  246. text: __('订单列表'),
  247. title: __('订单列表'),
  248. classname: 'btn btn-xs btn-list btn-success btn-dialog',
  249. icon: 'fa fa-list-o',
  250. url: function(row){
  251. return 'service/order/order/index?skill_id='+row.id;
  252. },
  253. },
  254. {
  255. name: 'info',
  256. text: __('扣除保证金'),
  257. title: __('扣除保证金'),
  258. classname: 'btn btn-xs btn-list btn-danger btn-dialog',
  259. icon: 'fa fa-list-o',
  260. url: 'service/skill/skill/deduct',
  261. },
  262. {
  263. name: 'edit',
  264. text: __('编辑'),
  265. title: __('编辑'),
  266. classname: 'btn btn-xs btn-status btn-dialog',
  267. icon: 'fa fa-list-o',
  268. url: 'service/skill/skill/edit',
  269. }
  270. ],
  271. formatter: Table.api.formatter.operate}
  272. ]
  273. ]
  274. });
  275. // 为表格绑定事件
  276. Table.api.bindevent(table);
  277. },
  278. recyclebin: function () {
  279. // 初始化表格参数配置
  280. Table.api.init({
  281. extend: {
  282. 'dragsort_url': ''
  283. }
  284. });
  285. var table = $("#table");
  286. // 初始化表格
  287. table.bootstrapTable({
  288. url: 'service/skill/skill/recyclebin' + location.search,
  289. pk: 'id',
  290. sortName: 'id',
  291. columns: [
  292. [
  293. {checkbox: true},
  294. {field: 'id', title: __('Id')},
  295. {field: 'name', title: __('Name'), align: 'left'},
  296. {
  297. field: 'deletetime',
  298. title: __('Deletetime'),
  299. operate: 'RANGE',
  300. addclass: 'datetimerange',
  301. formatter: Table.api.formatter.datetime
  302. },
  303. {
  304. field: 'operate',
  305. width: '140px',
  306. title: __('Operate'),
  307. table: table,
  308. events: Table.api.events.operate,
  309. buttons: [
  310. {
  311. name: 'Restore',
  312. text: __('Restore'),
  313. classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
  314. icon: 'fa fa-rotate-left',
  315. url: 'service/skill/skill/restore',
  316. refresh: true
  317. },
  318. {
  319. name: 'Destroy',
  320. text: __('Destroy'),
  321. classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
  322. icon: 'fa fa-times',
  323. url: 'service/skill/skill/destroy',
  324. refresh: true
  325. }
  326. ],
  327. formatter: Table.api.formatter.operate
  328. }
  329. ]
  330. ]
  331. });
  332. // 为表格绑定事件
  333. Table.api.bindevent(table);
  334. },
  335. add: function () {
  336. $("[data-toggle='addresspicker']").data("callback", function(res){
  337. //其中res则是包含了address/lat/lng/zoom等信息的JSON对象
  338. console.log(res)
  339. });
  340. Controller.api.bindevent();
  341. },
  342. edit: function () {
  343. Controller.api.bindevent();
  344. },
  345. api: {
  346. bindevent: function () {
  347. Form.api.bindevent($("form[role=form]"));
  348. }
  349. }
  350. };
  351. return Controller;
  352. });