perfect.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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/shop/perfect/index' + location.search,
  8. add_url: 'service/shop/perfect/add',
  9. // edit_url: 'service/shop/perfect/edit',
  10. // del_url: 'service/shop/perfect/del',
  11. multi_url: 'service/shop/perfect/multi',
  12. import_url: 'service/shop/perfect/import',
  13. table: 'service_apply_shop',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'updatetime',
  22. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  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: 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>
  44. </div>
  45. </div>
  46. </div>`
  47. }},
  48. {field: 'id', title: __('证件'),operate: false,formatter:function (value,row){
  49. return `
  50. <div style="display: flex;align-items: center;border-bottom: 1px solid #EEEEEE; padding: 10px 0;">
  51. <div style="display: flex;flex-direction: column;align-items: center;margin-right: 10px;">
  52. <img src="${row.front_image}" alt="" style="width: 56px;height: 56px;border-radius: 8px;margin-bottom: 8px;">
  53. <span style="color: #999999;font-size: 12px;">身份证正面</span>
  54. </div>
  55. <div style="display: flex;flex-direction: column;align-items: center;">
  56. <img src="${row.opposite_image}" alt="" style="width: 56px;height: 56px;border-radius: 8px;margin-bottom: 8px;">
  57. <span style="color: #999999;font-size: 12px;">身份证反面</span>
  58. </div>
  59. </div>
  60. <div style="display: flex;align-items: center;padding: 10px 0 0;">
  61. <div style="display: flex;flex-direction: column;align-items: center;">
  62. <img src="${row.license_image}" alt="" style="width: 56px;height: 56px;border-radius: 8px;margin-bottom: 8px;">
  63. <span style="color: #999999;font-size: 12px;">营业执照</span>
  64. </div>
  65. </div>
  66. `
  67. }},
  68. {field: 'id', title: __('经营分类'),operate: false,cellStyle: function () {return {css: {"min-width": "200px","max-width": "400px"}}},formatter:function (value,row){
  69. let word = row.categoryname.split(',')
  70. let result = '<div style="color: #333;font-size: 14px;margin-bottom: 8px;flex-wrap: wrap;display: flex;align-items: center">';
  71. for(let i=0; i < word.length; i++){
  72. result += `<div style="margin: 0 8px 8px;">${word[i]}</div>`
  73. }
  74. result+='</div>'
  75. return result
  76. }},
  77. {field: 'id', title: __('项目'),operate: false,cellStyle: function () {return {css: {"min-width": "300px","max-width": "500px"}}},formatter:function (value,row){
  78. let word = row.goodsname.split(',')
  79. let result = '<div style="color: #333;font-size: 14px;margin-bottom: 8px;flex-wrap: wrap;display: flex;align-items: center">';
  80. for(let i=0; i < word.length; i++){
  81. result += `<div style="margin: 0 8px 8px;">${word[i]}</div>`
  82. }
  83. result+='</div>'
  84. return result
  85. }},
  86. {field: 'id', title: __('店铺信息'),operate: false, cellStyle: function () {return {css: {"min-width": "400px"}}},formatter:function (value,row){
  87. return `
  88. <div style="color: #333333;font-size: 14px;margin-top: 8px;display: flex;align-items: center;">
  89. <div style="width: 90px;color: #999;text-align: left;">负责人姓名</div>
  90. <div>${row.leader_name}</div>
  91. </div>
  92. <div style="color: #333333;font-size: 14px;margin-top: 8px;display: flex;align-items: center;">
  93. <div style="width: 90px;color: #999;text-align: left;">手机号</div>
  94. <div>${row.leader_mobile}</div>
  95. </div>
  96. <div style="color: #333333;font-size: 14px;margin-top: 8px;display: flex;align-items: flex-start;">
  97. <div style="width: 90px;color: #999;text-align: left;flex-shrink: 0">营业时间</div>
  98. <p style="white-space: pre-line;text-align: left;">${row.trade_hour}</p>
  99. </div>
  100. <div style="color: #333333;font-size: 14px;margin-top: 8px;display: flex;align-items: flex-start;">
  101. <div style="width: 90px;color: #999;text-align: left;flex-shrink: 0">地 址</div>
  102. <p style="white-space: pre-line;text-align: left;">${row.province}${row.city}${row.district}${row.address}</p>
  103. </div>
  104. `
  105. }},
  106. {field: 'id', title: __('店铺简介'),operate: false, cellStyle: function () {return {css: {"min-width": "400px"}}},formatter:function (value,row){
  107. return `
  108. <div style="color: #333333;font-size: 14px;margin-top: 8px;display: flex;align-items: flex-start;">
  109. <p style="white-space: pre-line;text-align: left;">${row.intro}</p>
  110. </div>
  111. `
  112. }},
  113. {field: 'id', title: __('状态'),operate: false, cellStyle: function () {return {css: {"max-width": "400px","min-width": "300px"}}},formatter:function (value,row){
  114. let result = ` <div style="display: flex;align-items: center;justify-content:space-between;padding: 0 20px;width: 250px;height: 66px;">
  115. <span style="font-size: 14px;color: #999;">状态</span>
  116. <span style="color: #1677FF;font-size: 14px;">${row.state_text}</span>
  117. </div>`
  118. if(row.state == -1){
  119. result+=`
  120. <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;">
  121. <div style="font-size: 14px;color: #999;flex-shrink:0;">拒绝原因</div>
  122. <div style="color: #FF1F2B;font-size: 14px;text-align:left;margin-left:20px;white-space: pre-line;">${row.note}</div>
  123. </div>
  124. `
  125. }
  126. return result
  127. }},
  128. {field: 'id', title: __('时间'),operate: false, cellStyle: function () {return {css: {"min-width": "180px"}}},formatter:function (value,row){
  129. return `
  130. <div style="margin-bottom: 10px;">
  131. <div style="color: #999999;font-size: 14px;margin-bottom: 8px;text-align:left;">创建时间</div>
  132. <div style="color: #333333;font-size: 14px;text-align:left;">${row.create_time}</div>
  133. </div>
  134. <div>
  135. <div style="color: #999999;font-size: 14px;margin-bottom: 8px;text-align:left;">更新时间</div>
  136. <div style="color: #333333;font-size: 14px;text-align:left;">${row.update_time}</div>
  137. </div>
  138. `
  139. }},
  140. // {checkbox: true},
  141. {field: 'id', title: __('Id'),visible: false},
  142. {field: 'user_id', title: __('User_id'),visible: false},
  143. {field: 'name', title: __('Name'), operate: 'LIKE',visible: false},
  144. {field: 'abbr', title: __('Abbr'), operate: 'LIKE',visible: false},
  145. {field: 'type', title: __('Type'), searchList: {"0":__('Type 0'),"1":__('Type 1')}, formatter: Table.api.formatter.normal,visible: false},
  146. {field: 'credit_code', title: __('Credit_code'), operate: 'LIKE',visible: false},
  147. // {field: 'license_image', title: __('License_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  148. {field: 'username', title: __('Username'),visible: false},
  149. {field: 'mobile', title: __('Mobile'),visible: false},
  150. {field: 'idcard', title: __('Idcard'),visible: false},
  151. // {field: 'front_image', title: __('Front_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  152. // {field: 'opposite_image', title: __('Opposite_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  153. {field: 'intro', title: __('Intro'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content,visible: false},
  154. // {field: 'logo_image', title: __('Logo_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  155. {field: 'categoryname', title: __('Category_list'), operate: false,visible: false},
  156. {field: 'goodsname', title: __('Goods_list'), operate: false,visible: false},
  157. {field: 'leader_name', title: __('Leader_name'),visible: false},
  158. {field: 'leader_mobile', title: __('Leader_mobile'),visible: false},
  159. {field: 'province', title: __('Province'), operate: 'LIKE',visible: false},
  160. {field: 'city', title: __('City'), operate: 'LIKE',visible: false},
  161. {field: 'district', title: __('District'), operate: 'LIKE',visible: false},
  162. {field: 'address', title: __('Address'), operate: 'LIKE',visible: false},
  163. // {field: 'lng', title: __('Lng')},
  164. // {field: 'lat', title: __('Lat')},
  165. {field: 'state', title: __('State'), searchList: {"0":__('State 0'),"1":__('State 1'),"-1":__('State -1')}, formatter: Table.api.formatter.normal,visible: false},
  166. {field: 'note', title: __('Note'), operate: 'LIKE',visible: false},
  167. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible: false},
  168. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible: false},
  169. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
  170. buttons: [
  171. {
  172. name:'audit',
  173. text:'通过',
  174. title:'通过',
  175. classname: 'btn btn-xs btn-success btn-ajax',
  176. url: 'service/shop/perfect/agree',
  177. hidden:function(row){
  178. if(row.state != 0){
  179. return true;
  180. }
  181. },
  182. success: function (data, ret) {
  183. $(".btn-refresh").trigger('click');
  184. }
  185. },
  186. {
  187. name: 'refuse',
  188. text: __('拒绝'),
  189. title: __('拒绝'),
  190. classname: 'btn btn-xs btn-danger btn-dialog',
  191. url: function(row){
  192. return 'service/shop/perfect/refuse?ids='+row.id;
  193. },
  194. success: function (data, ret) {
  195. $(".btn-refresh").trigger('click');
  196. },
  197. hidden:function(row){
  198. if(row.state != 0){
  199. return true;
  200. }
  201. }
  202. },
  203. ],
  204. formatter: Table.api.formatter.operate}
  205. ]
  206. ]
  207. });
  208. // 为表格绑定事件
  209. Table.api.bindevent(table);
  210. },
  211. add: function () {
  212. Controller.api.bindevent();
  213. },
  214. edit: function () {
  215. Controller.api.bindevent();
  216. },
  217. agree: function () {
  218. $(document).on('click', '.btn-embossed', function () {
  219. parent.$(".btn-refresh").trigger('click');
  220. });
  221. Controller.api.bindevent();
  222. },
  223. refuse: function () {
  224. $(document).on('click', '.btn-embossed', function () {
  225. parent.$(".btn-refresh").trigger('click');
  226. });
  227. Controller.api.bindevent();
  228. },
  229. api: {
  230. bindevent: function () {
  231. Form.api.bindevent($("form[role=form]"));
  232. }
  233. }
  234. };
  235. return Controller;
  236. });