dialogTugou.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. define(function (require) {
  2. return function (context) {
  3. var $dlg, $form;
  4. function queryGrid1(data) {
  5. console.log(data);
  6. }
  7. return {
  8. xtype: 'dialog',
  9. dialogId: 'dialogTugou',
  10. title: context.isEdit ? '编辑团购信息' : '新增团购信息',
  11. width: '100%',
  12. height: '100%',
  13. onOpen: function () {
  14. $dlg = $(this);
  15. if (context.isEdit) {
  16. $.yvan.ajax({
  17. loadingMask: false,
  18. url: api(''),
  19. type: 'GET',
  20. data: {joId: context.joId},
  21. success: function (data) {
  22. $dlg.find('form');
  23. $form.formSet(data.data);
  24. }
  25. });
  26. }
  27. },
  28. center: {
  29. items: {
  30. width: '100%',
  31. height: '100%',
  32. autoSizeColumns: true,
  33. xtype: 'formgroup',
  34. onRender: function () {
  35. $form = $(this);
  36. },
  37. items: [
  38. [
  39. {name: 'uptownId', xtype: 'hidden'},
  40. {
  41. xtype: 'yvselect',
  42. name: 'uptownName',
  43. multiple: true,
  44. label: '小区',
  45. data: [{id: '1', text: '在团'}, {id: '2', text: '发货'}, {id: '3', text: '完成'}, {
  46. id: '4',
  47. text: '取消'
  48. }],
  49. width: 900,
  50. height: 35,
  51. validType: 'isBlank',
  52. onChange: function (data) {
  53. queryGrid1(data);
  54. },
  55. }],
  56. [
  57. {
  58. name: 'tgTitle',
  59. label: '组团标题',
  60. required: true,
  61. maxlength: 20,
  62. width: 450,
  63. height: 35, validType: 'isBlank'
  64. },
  65. {
  66. name: 'tgSupplier', label: '供应商', maxlength: 20,
  67. width: 450, height: 35,
  68. required: true,
  69. },
  70. [{
  71. name: 'tgGoods', label: '团购套餐',
  72. required: true, width: 900, height: 35,
  73. maxlength: 100,
  74. height: '100px', multiline: true,
  75. }],
  76. {
  77. name: 'tgPrice',
  78. label: '单价',
  79. maxlength: 4, validType: 'integer',
  80. required: true, width: 450, height: 35,
  81. },
  82. {
  83. name: 'tgMinNum',
  84. label: '最小起订量',
  85. maxlength: 4, validType: 'integer',
  86. required: true, width: 450, height: 35,
  87. },
  88. [{
  89. name: 'tgMaxNum',
  90. label: '最大上限', required: true, validType: 'integer',
  91. maxlength: 4, width: 450, height: 35,
  92. },
  93. {
  94. name: 'tgEndTime',
  95. label: '团购截止时间',
  96. xtype: 'datetimebox',
  97. required: true, width: 450, height: 35,
  98. },],
  99. [{
  100. name: 'tgDeliverTime',
  101. multiline: true,
  102. xtype: 'datetimebox',
  103. label: '预计送货时间',
  104. required: true, width: 450, height: 35,
  105. },
  106. {
  107. name: 'tgPhoneNumber', validType: 'telNum',
  108. label: '联系电话', width: 450, height: 35,
  109. required: true, maxlength: 11,
  110. }],
  111. [{
  112. name: 'remarks',
  113. label: '备注',
  114. width: 900,
  115. height: '100px',
  116. maxlength: 500,
  117. }]]
  118. ],
  119. }
  120. },
  121. buttons: [
  122. {
  123. text: "保存", iconCls: "fa fa-save", onClick: function () {
  124. if ($form.formGet().uptownName.trim() == '' ) {
  125. $.yvan.msg('请先选择小区');
  126. return;
  127. }
  128. alert($form.formGet().uptownName)
  129. $.yvan.postForm($form, {
  130. url: (context.isEdit ? api('/record/CustInfo/update') : api('/record/CustInfo/insert')),
  131. success: function (data) {
  132. if (data.data == 1) {
  133. $.yvan.msg('保存成功');
  134. $dlg.window('close');
  135. } else {
  136. $.yvan.msg('保存失败');
  137. }
  138. }
  139. });
  140. }
  141. }, {
  142. text: "关闭", iconCls: "fa fa-times", onClick: function () {
  143. $dlg.dialog('close');
  144. }
  145. }
  146. ]
  147. };
  148. };
  149. });