tugou.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. define(function (require) {
  2. return function (context) {
  3. var $grid1, $form;
  4. // 输入搜索文本后点击回车按钮查询列表
  5. function enterQueryGrid1(e) {
  6. if (e.keyCode === 13) {
  7. var tmp = $(this).val();
  8. $form.formSet({queryProperties: tmp});
  9. queryGrid1();
  10. }
  11. }
  12. // 检索条件查询
  13. function queryGrid1() {
  14. var queryUrl = '';// 自行替换此参数
  15. var queryForm = $form.formGet();
  16. queryForm.roleCode = App.currentRoleCode;
  17. $grid1.reload({
  18. mtype: 'GET',
  19. url: api(queryUrl),
  20. queryParams: queryForm
  21. }, true);
  22. }
  23. // 搜索按钮
  24. var queryToolbarTitle = '团购信息管理';// 自行替换此参数
  25. var queryToolbar = {
  26. xtype: 'toolbar', title: queryToolbarTitle, items: [
  27. {
  28. text: '查询', iconCls: 'fa fa-search', onClick: function () {
  29. queryGrid1();
  30. }
  31. }, {
  32. text: '重置', iconCls: 'fa fa-refresh', onClick: function () {
  33. $form.formClear();
  34. queryGrid1();
  35. }
  36. }, {
  37. text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
  38. App.closeMe(this);
  39. }
  40. }
  41. ]
  42. };
  43. // 搜索条件
  44. var queryFormPrompt = '团购标题';// 自行替换此参数
  45. var queryForm = {
  46. onRender: function () {
  47. $form = $(this);
  48. },
  49. xtype: 'form',
  50. items: [[
  51. {
  52. xtype: 'textbox',
  53. label: '检索条件',
  54. name: 'queryProperties',
  55. prompt: queryFormPrompt,
  56. labelWidth: 'auto',
  57. events: {keydown: enterQueryGrid1}, width: 350
  58. },
  59. {
  60. xtype: 'yvselect',
  61. name: 'uptownId',
  62. label: '小区',
  63. data: [{id: '1', text: '在团'}, {id: '2', text: '发货'}, {id: '3', text: '完成'}, {
  64. id: '4',
  65. text: '取消'
  66. }],
  67. multiple: true,
  68. labelWidth: 'auto',
  69. width: 350,
  70. onChange: function (data) {
  71. queryGrid1();
  72. },
  73. },
  74. {
  75. xtype: 'yvselect',
  76. name: 'tgStatus',
  77. label: '状态',//,2,3完成,4取消
  78. data: [{id: '', text: '全部'}, {id: '1', text: '在团'}, {id: '2', text: '发货'}, {id: '3', text: '完成'}, {
  79. id: '4',
  80. text: '取消'
  81. }],
  82. labelWidth: 'auto',
  83. width: 200,
  84. onChange: function (data) {
  85. queryGrid1();
  86. },
  87. }
  88. ]]
  89. };
  90. var gridToolbarTitle = '团购信息列表';// 自行替换此参数
  91. var gridToolbar = {
  92. xtype: 'toolbar',
  93. title: gridToolbarTitle,
  94. items: [
  95. {
  96. text: '新增', iconCls: 'fa fa-plus-circle fa-lg', onClick: function () {
  97. $.yvan.showDialog(this,
  98. require('/app/whepi/tugou/dialogTugou.js')({
  99. isEdit: false,
  100. confirm: function () {
  101. $grid1.reload();
  102. }
  103. })
  104. );
  105. }
  106. },
  107. {
  108. text: '取消', iconCls: 'fa fa-pencil-square-o', onClick: function () {
  109. var row = $grid1.rowData();
  110. if (!row) {
  111. $.yvan.msg('请先选择一行数据');
  112. return;
  113. }
  114. if (row.tgStatus != 1) {
  115. $.yvan.msg('在团状态才能取消');
  116. return;
  117. }
  118. $.yvan.confirm('是否' + "<span style='color: red; font-weight:bold;'>取消</span>" + '[' + (row.joName) + ']任务?', {
  119. yes: function (index) {
  120. $.yvan.ajax({
  121. method: 'post',
  122. url: api(''),
  123. data: {
  124. jmId: row.jmId,
  125. },
  126. success: function (data) {
  127. $.yvan.msg('成功');
  128. $grid1.reload();
  129. }
  130. });
  131. }
  132. });
  133. }
  134. }
  135. ]
  136. };
  137. return {
  138. north: {
  139. height: 88,
  140. /* split: true,
  141. border: false,*///底框是否可变动
  142. items: [
  143. queryToolbar,
  144. queryForm
  145. ]
  146. },
  147. center: {
  148. height: '60%',
  149. split: true,
  150. items:
  151. {
  152. onRender: function () {
  153. $grid1 = $(this);
  154. queryGrid1()
  155. },
  156. xtype: 'grid',
  157. toolbar:
  158. gridToolbar,
  159. idField: 'joId',
  160. autoSizeColumns: true,//序号多 正确显示
  161. columns:
  162. [
  163. [
  164. {field: 'jmId', title: '信息id', hidden: true},
  165. {field: 'uptown_id', title: '小区id', maxWidth: 200, align: 'left', hidden: true},
  166. {field: 'uptownName', title: '小区', maxWidth: 200, align: 'left',},
  167. {field: 'tgTitle', title: '组团标题', maxWidth: 200, align: 'left',},
  168. {field: 'tgSupplier', title: '供应商', maxWidth: 200,},
  169. {
  170. field: 'tgGoods',
  171. title: '团购套餐', maxWidth: 200,
  172. },
  173. {
  174. field: 'tgPrice',
  175. title: '单价',
  176. },
  177. {
  178. field: 'tgMinNum',
  179. title: '最小起订量',
  180. align: 'left',
  181. },
  182. {
  183. field: 'tgMaxNum',
  184. title: '最大上限',
  185. align: 'left',
  186. },
  187. {
  188. field: 'tgEndTime',
  189. title: '团购截止时间',
  190. align: 'center',
  191. },
  192. {
  193. field: 'tgDeliverTime', title: '预计送货时间', align: 'center',
  194. },
  195. {field: 'tgPhoneNumber', title: '联系电话', align: 'center'},
  196. {field: 'remark', title: '备注', maxWidth: 200, align: 'left'},
  197. {
  198. field: 'tgStatus', title: '状态',
  199. align: 'center',
  200. },
  201. ]
  202. ]
  203. }
  204. }
  205. };
  206. };
  207. }
  208. );