company.js 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. layui.define(['table', 'form'], function(exports) {
  2. var $ = layui.$,
  3. table = layui.table,
  4. form = layui.form;
  5. //我的订单
  6. table.render({
  7. elem: '#company-order-table',
  8. url: layui.setter.urlbase + '/product_order/order'
  9. ,
  10. cols: [
  11. [{
  12. type: 'numbers',
  13. width: 80,
  14. title: '序号',
  15. sort: true
  16. }, {
  17. field: 'order_no',
  18. title: '订单编号'
  19. }, {
  20. title: '产品',
  21. field: 'product'
  22. },{
  23. field: 'pay_date',
  24. title: '时间'
  25. }, {
  26. field: 'money',
  27. title: '价格(元)',
  28. },{
  29. title: '订单状态',
  30. templet: '#orderState'
  31. }, {
  32. title: '操作',
  33. width: 150,
  34. align: 'center',
  35. fixed: 'right',
  36. toolbar: '#table-order-state'
  37. }]
  38. ],
  39. page: true,
  40. limit: 10,
  41. limits: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
  42. text: '对不起,加载出现异常!'
  43. });
  44. //监听工具条
  45. table.on('tool(company-order-table)', function(obj) {
  46. var data = obj.data;
  47. if(obj.event === 'look') {
  48. $.ajax({
  49. type: 'post',
  50. url: layui.setter.urlbase + '/module_open/loginunionaccount',
  51. data: {
  52. sys: data.type
  53. },
  54. success: function(res) {
  55. if(res.code == 0) {
  56. //跳转至应用
  57. if(data.type === 'boss_live') {
  58. window.open('https://live.yunxiekeji.cn/live/index/index.html?passport=' + res.passport + '&username=' + data.username, '_blank');
  59. } else if(data.type === 'wqbp') {
  60. window.open('http://wqbp.yunxiekeji.cn/guide/index/index.html?passport=' + res.passport + '&username=' + data.username, '_blank');
  61. } else if(data.type === 'zqxg'){
  62. window.open('https://www.shangxueshe.cn/zqxg/show.html', '_blank');
  63. }else {
  64. window.open('https://live.yunxiekeji.cn/live/index/index.html?passport=' + res.passport + '&username=' + data.username, '_blank');
  65. }
  66. }
  67. }
  68. });
  69. }
  70. });
  71. /*
  72. *订单管理
  73. */
  74. table.render({
  75. elem: '#company-buying-products-table',
  76. url: layui.setter.urlbase + '/product_order/buying_products'
  77. ,
  78. cols: [
  79. [{
  80. type: 'numbers',
  81. width: 80,
  82. title: '序号',
  83. sort: true
  84. }, {
  85. field: 'product',
  86. title: '产品'
  87. }, {
  88. field: 'end_date',
  89. title: '产品到期时间'
  90. }, {
  91. templet: '#orderState',
  92. title: '产品状态'
  93. }, {
  94. title: '操作',
  95. width: 300,
  96. align: 'center',
  97. fixed: 'right',
  98. toolbar: '#table-buying_products-state'
  99. }]
  100. ],
  101. page: true,
  102. limit: 10,
  103. limits: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
  104. text: '对不起,加载出现异常!'
  105. });
  106. //监听工具条
  107. table.on('tool(company-buying-products-table)', function(obj) {
  108. var data = obj.data;
  109. if(obj.event === 'look') {
  110. $.ajax({
  111. type: 'post',
  112. url: layui.setter.urlbase + '/module_open/loginunionaccount',
  113. data: {
  114. sys: data.type
  115. },
  116. success: function(res) {
  117. if(res.code == 0) {
  118. //跳转至应用
  119. if(data.type === 'boss_live') {
  120. window.open('https://live.yunxiekeji.cn/live/index/index.html?passport=' + res.passport + '&username=' + data.username, '_blank');
  121. } else if(data.type === 'wqbp') {
  122. window.open('http://wqbp.yunxiekeji.cn/guide/index/index.html?passport=' + res.passport + '&username=' + data.username, '_blank');
  123. }else if(data.type === 'zqxg'){
  124. window.open('https://www.shangxueshe.cn/zqxg/show.html', '_blank');
  125. }else if(data.type === 'crm'){
  126. window.open('http://crm.shangxueshe.cn/index/login/loginapi.html?passport=' + res.passport + '&username=' + data.username, '_blank');
  127. }else {
  128. window.open('https://live.yunxiekeji.cn/live/index/index.html?passport=' + res.passport + '&username=' + data.username, '_blank');
  129. }
  130. }
  131. }
  132. });
  133. }
  134. });
  135. /*
  136. * 优惠卷
  137. */
  138. table.render({
  139. elem: '#company-coupon-table',
  140. //url: layui.setter.urlbase + '/product_order/coupon' ,
  141. cols: [
  142. [{
  143. type: 'numbers',
  144. width: 80,
  145. title: '序号',
  146. sort: true
  147. }, {
  148. field: 'car',
  149. title: '优惠卷'
  150. }, {
  151. field: 'get_time',
  152. title: '获取时间'
  153. }, {
  154. field: 'end_time',
  155. title: '有效期'
  156. }, {
  157. field: 'state',
  158. title: '产品状态'
  159. }, {
  160. title: '操作',
  161. width: 150,
  162. align: 'center',
  163. fixed: 'right',
  164. toolbar: '#table-dailyWechatLabel-edit'
  165. }]
  166. ],
  167. data:[{
  168. "car": "200元全场通用卷",
  169. "get_time": "2020-11-19 10:45:64",
  170. "end_time": "2020-12-19 10:45:64",
  171. "state": "使用中"
  172. },{
  173. "car": "7折全场通用卷",
  174. "get_time": "2020-11-19 10:45:64",
  175. "end_time": "2020-12-19 10:45:64",
  176. "state": "使用中"
  177. }],
  178. page: true,
  179. limit: 10,
  180. limits: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
  181. text: '对不起,加载出现异常!'
  182. });
  183. //工单列表
  184. table.render({
  185. elem: '#work-order-table',
  186. url: layui.setter.urlbase + '/work_order/order'
  187. ,
  188. cols: [
  189. [{
  190. type: 'numbers',
  191. width: 80,
  192. title: '序号',
  193. sort: true
  194. }, {
  195. field: 'order_no',
  196. title: '工单编号'
  197. }, {
  198. title: '类型',
  199. field: 'type'
  200. },{
  201. field: 'addtime',
  202. title: '创建时间'
  203. },{
  204. title: '工单单状态',
  205. field: 'state'
  206. }, {
  207. title: '操作',
  208. width: 150,
  209. align: 'center',
  210. fixed: 'right',
  211. toolbar: '#table-order-state'
  212. }]
  213. ],
  214. page: true,
  215. limit: 10,
  216. limits: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
  217. text: '对不起,加载出现异常!'
  218. });
  219. //监听工具条
  220. table.on('tool(work-order-table)', function(obj) {
  221. var data = obj.data;
  222. if(obj.event === 'checkdetail') {
  223. var tr = $(obj.tr);
  224. layer.open({
  225. type: 2,
  226. title: '工单详情',
  227. content: '/company/work_order/workorderdetail?id=' + data.id,
  228. area: ['800px', '600px'],
  229. })
  230. }else if(obj.event === 'endOrder'){
  231. layer.confirm('确定结束工单吗?', function(index) {
  232. $.ajax({
  233. type: 'post',
  234. url: layui.setter.urlbase + "/work_order/endOrder",
  235. data: {
  236. id: data.id
  237. },
  238. success: function(res) {
  239. layer.msg(res.msg, {anim: 0}, function () {
  240. location.reload();
  241. });
  242. }
  243. });
  244. });
  245. }
  246. });
  247. /*
  248. * 优惠卷cypher
  249. */
  250. table.render({
  251. elem: '#company-cypher-table',
  252. url: layui.setter.urlbase + '/product_order/coupon' ,
  253. cols: [
  254. [{
  255. type: 'numbers',
  256. width: 80,
  257. title: '序号',
  258. sort: true
  259. }, {
  260. field: 'name',
  261. title: '优惠卷活动'
  262. }, {
  263. field: 'addtime',
  264. title: '获取时间'
  265. }, {
  266. field: 'end_time',
  267. title: '有效期'
  268. }, {
  269. templet: '#usedState',
  270. title: '状态'
  271. }, {
  272. title: '操作',
  273. width: 150,
  274. align: 'center',
  275. fixed: 'right',
  276. toolbar: '#table-dailyWechatLabel-edit'
  277. }]
  278. ],
  279. // data:[{
  280. // "car": "200元全场通用卷",
  281. // "get_time": "2020-11-19 10:45:64",
  282. // "end_time": "2020-12-19 10:45:64",
  283. // "state": "使用中"
  284. // },{
  285. // "car": "7折全场通用卷",
  286. // "get_time": "2020-11-19 10:45:64",
  287. // "end_time": "2020-12-19 10:45:64",
  288. // "state": "使用中"
  289. // }],
  290. page: true,
  291. limit: 10,
  292. limits: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
  293. text: '对不起,加载出现异常!'
  294. });
  295. exports('dailywechat', {})
  296. });