shop.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  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/shop/shop/index' + location.search,
  9. edit_url: 'service/shop/shop/edit',
  10. multi_url: 'service/shop/shop/multi',
  11. import_url: 'service/shop/shop/import',
  12. table: 'service_shop'
  13. }
  14. });
  15. var table = $("#table");
  16. // 初始化表格
  17. table.bootstrapTable({
  18. url: $.fn.bootstrapTable.defaults.extend.index_url,
  19. pk: 'id',
  20. sortName: 'weigh',
  21. fixedColumns: true,
  22. fixedRightNumber: 1,
  23. columns: [
  24. [
  25. // {checkbox: true},
  26. {field: 'id', title: __('商户信息'),operate: false,formatter:function (value,row){
  27. return `<div style="display: flex">
  28. <img style="width: 100px;height: 100px;" src="${row.logo_image}"/>
  29. <div style="margin-left: 16px;">
  30. <div style=";display: flex;align-items: center;justify-content: space-between">
  31. <span style="font-size: 16px;color: #333;">${row.name}</span>
  32. <div style="background: rgba(248, 118, 121, 0.10);height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;margin-right: 8px;color:rgba(248, 118, 121, 1);"><span style="color: rgba(248, 118, 121, 1)">ID:</span>${row.id}</div>
  33. </div>
  34. <div style="color: #333333;font-size: 14px;margin-top: 8px;display: flex;align-items: center;">
  35. <span style="font-size: 14px;color: #999;margin-right: 20px;">简称:${row.abbr}</span>
  36. </div>
  37. <div style="color: #333333;font-size: 14px;margin-top: 8px;display: flex;align-items: center;">
  38. <span>法人:</span>${row.username} &nbsp;&nbsp; ${row.mobile}
  39. <span style="margin-left:10px;">身份证:</span>${row.idcard}
  40. </div>
  41. <div style="display: flex;align-items: center;margin-top: 8px;">
  42. <div style="background: #FFF7E6;height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;margin-right: 8px;"><span style="color: #999999">类型:</span>${row.type_text}</div>
  43. <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.code}</div>
  44. <div style="background: rgba(22, 119, 255, 0.07);height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;"><span style="color: #999999">证金:</span>¥${row.ensure_price}</div>
  45. </div>
  46. <div style="display: flex;align-items: center;margin-top: 8px;">
  47. <div style="background: rgba(240, 250, 243, 1);height: 26px;display: flex;align-items: center;padding: 0 8px;border-radius: 13px;"><span style="color: #999999">统一社会信用代码:</span>${row.credit_code}</div>
  48. </div>
  49. </div>
  50. </div>`
  51. }},
  52. {field: 'id', title: __('接单信息'),operate: false,formatter:function (value,row){
  53. return `
  54. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;border-bottom: 1px solid #EEEEEE;">
  55. <span style="font-size: 14px;color: #999;">每日可接单数量</span>
  56. <span style="color: #333;font-size: 14px;">${row.accept_nums}</span>
  57. </div>
  58. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;border-bottom: 1px solid #EEEEEE;">
  59. <span style="font-size: 14px;color: #999;">已接单数量</span>
  60. <span style="color: #333;font-size: 14px;">${row.already_accept_nums}</span>
  61. </div>
  62. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;">
  63. <span style="font-size: 14px;color: #999;">商户订单收益分成%</span>
  64. <span style="color: #333;font-size: 14px;">${row.percent}</span>
  65. </div>
  66. `
  67. }},
  68. {field: 'id', title: __('人员信息'),operate: false,formatter:function (value,row){
  69. return `
  70. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;border-bottom: 1px solid #EEEEEE;">
  71. <span style="font-size: 14px;color: #999;">服务人员数量</span>
  72. <span style="color: #333;font-size: 14px;">${row.service_nums}</span>
  73. </div>
  74. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;border-bottom: 1px solid #EEEEEE;">
  75. <span style="font-size: 14px;color: #999;">已拥有人员数量</span>
  76. <span style="color: #333;font-size: 14px;">${row.already_service_nums}</span>
  77. </div>
  78. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;">
  79. <span style="font-size: 14px;color: #999;">订单结算周期/天</span>
  80. <span style="color: #333;font-size: 14px;">${row.settle_day}</span>
  81. </div>
  82. `
  83. }},
  84. {field: 'id', title: __('证件'),operate: false,formatter:function (value,row){
  85. return `
  86. <div style="display: flex;align-items: center;border-bottom: 1px solid #EEEEEE; padding: 10px 0;">
  87. <div style="display: flex;flex-direction: column;align-items: center;margin-right: 10px;">
  88. <img src="${row.front_image}" alt="" style="width: 56px;height: 56px;border-radius: 8px;margin-bottom: 8px;">
  89. <span style="color: #999999;font-size: 12px;">身份证正面</span>
  90. </div>
  91. <div style="display: flex;flex-direction: column;align-items: center;">
  92. <img src="${row.opposite_image}" alt="" style="width: 56px;height: 56px;border-radius: 8px;margin-bottom: 8px;">
  93. <span style="color: #999999;font-size: 12px;">身份证反面</span>
  94. </div>
  95. </div>
  96. <div style="display: flex;align-items: center;padding: 10px 0 0;">
  97. <div style="display: flex;flex-direction: column;align-items: center;">
  98. <img src="${row.license_image}" alt="" style="width: 56px;height: 56px;border-radius: 8px;margin-bottom: 8px;">
  99. <span style="color: #999999;font-size: 12px;">营业执照</span>
  100. </div>
  101. </div>
  102. `
  103. }},
  104. {field: 'id', title: __('经营分类'),operate: false,cellStyle: function () {return {css: {"min-width": "200px","max-width": "400px"}}},formatter:function (value,row){
  105. let word = row.categoryname.split(',')
  106. let result = '<div style="color: #333;font-size: 14px;margin-bottom: 8px;flex-wrap: wrap;display: flex;align-items: center">';
  107. for(let i=0; i < word.length; i++){
  108. result += `<div style="margin: 0 8px 8px;">${word[i]}</div>`
  109. }
  110. result+='</div>'
  111. return result
  112. }},
  113. {field: 'id', title: __('项目'),operate: false,cellStyle: function () {return {css: {"min-width": "300px","max-width": "500px"}}},formatter:function (value,row){
  114. let word = row.goodsname.split(',')
  115. let result = '<div style="color: #333;font-size: 14px;margin-bottom: 8px;flex-wrap: wrap;display: flex;align-items: center">';
  116. for(let i=0; i < word.length; i++){
  117. result += `<div style="margin: 0 8px 8px;">${word[i]}</div>`
  118. }
  119. result+='</div>'
  120. return result
  121. }},
  122. {field: 'id', title: __('店铺信息'),operate: false, cellStyle: function () {return {css: {"min-width": "400px"}}},formatter:function (value,row){
  123. return `
  124. <div style="color: #333333;font-size: 14px;margin-top: 8px;display: flex;align-items: center;">
  125. <div style="width: 90px;color: #999;text-align: left;">负责人姓名</div>
  126. <div>${row.leader_name}</div>
  127. </div>
  128. <div style="color: #333333;font-size: 14px;margin-top: 8px;display: flex;align-items: center;">
  129. <div style="width: 90px;color: #999;text-align: left;">手机号</div>
  130. <div>${row.leader_mobile}</div>
  131. </div>
  132. <div style="color: #333333;font-size: 14px;margin-top: 8px;display: flex;align-items: flex-start;">
  133. <div style="width: 90px;color: #999;text-align: left;flex-shrink: 0">营业时间</div>
  134. <p style="white-space: pre-line;text-align: left;">${row.trade_hour}</p>
  135. </div>
  136. <div style="color: #333333;font-size: 14px;margin-top: 8px;display: flex;align-items: flex-start;">
  137. <div style="width: 90px;color: #999;text-align: left;flex-shrink: 0">地 址</div>
  138. <p style="white-space: pre-line;text-align: left;">${row.province}${row.city}${row.district}${row.address}</p>
  139. </div>
  140. `
  141. }},
  142. {field: 'id', title: __('店铺简介'),operate: false, cellStyle: function () {return {css: {"min-width": "400px"}}},formatter:function (value,row){
  143. return `
  144. <div style="color: #333333;font-size: 14px;margin-top: 8px;display: flex;align-items: flex-start;">
  145. <p style="white-space: pre-line;text-align: left;">${row.intro}</p>
  146. </div>
  147. `
  148. }},
  149. {field: 'id', title: __('状态'),operate: false, cellStyle: function () {return {css: {"min-width": "250px"}}},formatter:function (value,row){
  150. return `
  151. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;border-bottom: 1px solid #EEEEEE;">
  152. <span style="font-size: 14px;color: #999;">开启到店</span>
  153. <span style="color: #62CB81;font-size: 14px;">${row.to_shop_text}</span>
  154. </div>
  155. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;border-bottom: 1px solid #EEEEEE;">
  156. <span style="font-size: 14px;color: #999;">权重</span>
  157. <span style="color: #333;font-size: 14px;">${row.weigh}</span>
  158. </div>
  159. <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;">
  160. <span style="font-size: 14px;color: #999;">状态</span>
  161. <span style="color: #1677FF;font-size: 14px;">${row.state_text}</span>
  162. </div>
  163. `
  164. }},
  165. {field: 'id', title: __('时间'),operate: false, cellStyle: function () {return {css: {"min-width": "180px"}}},formatter:function (value,row){
  166. return `
  167. <div style="margin-bottom: 10px;">
  168. <div style="color: #999999;font-size: 14px;margin-bottom: 8px;text-align:left;">创建时间</div>
  169. <div style="color: #333333;font-size: 14px;text-align:left;">${row.create_time}</div>
  170. </div>
  171. <div>
  172. <div style="color: #999999;font-size: 14px;margin-bottom: 8px;text-align:left;">更新时间</div>
  173. <div style="color: #333333;font-size: 14px;text-align:left;">${row.update_time}</div>
  174. </div>
  175. `
  176. }},
  177. {field: 'id', title: __('Id'),visible: false},
  178. {field: 'user_id', title: __('User_id'),visible: false},
  179. {field: 'to_shop', title: __('To_shop'), searchList: {"0":__('To_shop 0'),"1":__('To_shop 1')}, formatter: Table.api.formatter.normal,visible: false},
  180. {field: 'ensure_price', title: __('Ensure_price'), operate:'BETWEEN',visible: false},
  181. {field: 'accept_nums', title: __('Accept_nums'),visible: false},
  182. {field: 'already_accept_nums', title: __('Already_accept_nums'),visible: false},
  183. {field: 'service_nums', title: __('Service_nums'),visible: false},
  184. {field: 'already_service_nums', title: __('Already_service_nums'),visible: false},
  185. {field: 'name', title: __('Name'), operate: 'LIKE',visible: false},
  186. {field: 'abbr', title: __('Abbr'), operate: 'LIKE',visible: false},
  187. {field: 'percent', title: __('Percent'),visible: false},
  188. {field: 'type', title: __('Type'), searchList: {"0":__('Type 0'),"1":__('Type 1')}, formatter: Table.api.formatter.normal,visible: false},
  189. {field: 'code', title: __('Code'),visible: false},
  190. {field: 'credit_code', title: __('Credit_code'), operate: 'LIKE',visible: false},
  191. {field: 'license_image', title: __('License_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image,visible: false},
  192. {field: 'username', title: __('Username'),visible: false},
  193. {field: 'mobile', title: __('Mobile'),visible: false},
  194. {field: 'idcard', title: __('Idcard'),visible: false},
  195. {field: 'front_image', title: __('Front_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image,visible: false},
  196. {field: 'opposite_image', title: __('Opposite_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image,visible: false},
  197. {field: 'intro', title: __('Intro'), operate: 'LIKE',visible: false},
  198. {field: 'logo_image', title: __('Logo_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image,visible: false},
  199. {field: 'categoryname', title: __('Category_name'),operate:false,visible: false},
  200. {field: 'goodsname', title: __('Goods_name'),operate:false,visible: false},
  201. {field: 'leader_name', title: __('Leader_name'),visible: false},
  202. {field: 'leader_mobile', title: __('Leader_mobile'),visible: false},
  203. {field: 'province', title: __('Province'), operate: 'LIKE',visible: false},
  204. {field: 'city', title: __('City'), operate: 'LIKE',visible: false},
  205. {field: 'district', title: __('District'), operate: 'LIKE',visible: false},
  206. {field: 'address', title: __('Address'), operate: 'LIKE',visible: false},
  207. {field: 'lng', title: __('Lng'),visible: false},
  208. {field: 'lat', title: __('Lat'),visible: false},
  209. {field: 'weigh', title: __('Weigh'), operate: false,visible: false},
  210. {field: 'state', title: __('State'), searchList: {"0":__('State 0'),"1":__('State 1')}, formatter: Table.api.formatter.normal,visible: false},
  211. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible: false},
  212. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible: false},
  213. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
  214. buttons: [
  215. {
  216. name: 'list',
  217. text: __('平台余额明细'),
  218. title: __('平台余额明细'),
  219. classname: 'btn btn-xs btn-detail btn-dialog',
  220. icon: 'fa fa-list-o',
  221. url: function(row){
  222. return 'service/money/shopusermoneylog/index?user_id='+row.user_id;
  223. },
  224. },
  225. {
  226. name: 'list',
  227. text: __('保证金明细'),
  228. title: __('保证金明细'),
  229. classname: 'btn btn-xs btn-change btn-dialog',
  230. icon: 'fa fa-list-o',
  231. url: function(row){
  232. return 'service/money/ensurelog/index?user_id='+row.user_id+'&type=1';
  233. },
  234. },
  235. {
  236. name: 'list',
  237. text: __('订单列表'),
  238. title: __('订单列表'),
  239. classname: 'btn btn-xs btn-list btn-success btn-dialog',
  240. icon: 'fa fa-list-o',
  241. url: function(row){
  242. return 'service/order/order/index?shop_id='+row.id;
  243. },
  244. },
  245. {
  246. name: 'list',
  247. text: __('服务者列表'),
  248. title: __('服务者列表'),
  249. classname: 'btn btn-xs btn-list btn-danger btn-dialog',
  250. url: function(row){
  251. return 'service/skill/skill/index?shop_id='+row.id;
  252. },
  253. },
  254. {
  255. name: 'edit',
  256. text: __('编辑'),
  257. title: __('编辑'),
  258. classname: 'btn btn-xs btn-status btn-dialog',
  259. icon: 'fa fa-list-o',
  260. url: 'service/shop/shop/edit',
  261. }
  262. ],
  263. formatter: Table.api.formatter.operate}
  264. ]
  265. ]
  266. });
  267. // 为表格绑定事件
  268. Table.api.bindevent(table);
  269. },
  270. recyclebin: function () {
  271. // 初始化表格参数配置
  272. Table.api.init({
  273. extend: {
  274. 'dragsort_url': ''
  275. }
  276. });
  277. var table = $("#table");
  278. // 初始化表格
  279. table.bootstrapTable({
  280. url: 'service/shop/shop/recyclebin' + location.search,
  281. pk: 'id',
  282. sortName: 'id',
  283. columns: [
  284. [
  285. // {checkbox: true},
  286. {field: 'name', title: __('Name'), align: 'left'},
  287. {
  288. field: 'deletetime',
  289. title: __('Deletetime'),
  290. operate: 'RANGE',
  291. addclass: 'datetimerange',
  292. formatter: Table.api.formatter.datetime
  293. },
  294. {
  295. field: 'operate',
  296. width: '140px',
  297. title: __('Operate'),
  298. table: table,
  299. events: Table.api.events.operate,
  300. buttons: [
  301. {
  302. name: 'Restore',
  303. text: __('Restore'),
  304. classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
  305. icon: 'fa fa-rotate-left',
  306. url: 'service/shop/shop/restore',
  307. refresh: true
  308. },
  309. {
  310. name: 'Destroy',
  311. text: __('Destroy'),
  312. classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
  313. icon: 'fa fa-times',
  314. url: 'service/shop/shop/destroy',
  315. refresh: true
  316. }
  317. ],
  318. formatter: Table.api.formatter.operate
  319. }
  320. ]
  321. ]
  322. });
  323. // 为表格绑定事件
  324. Table.api.bindevent(table);
  325. },
  326. add: function () {
  327. Controller.api.bindevent();
  328. },
  329. edit: function () {
  330. Controller.api.bindevent();
  331. },
  332. api: {
  333. bindevent: function () {
  334. Form.api.bindevent($("form[role=form]"));
  335. }
  336. }
  337. };
  338. return Controller;
  339. });