tb-purchaser-add.html 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>企业收购商-添加/修改</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  8. <!-- 所有的 css js 资源 -->
  9. <link rel="stylesheet" href="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
  10. <link rel="stylesheet" href="../../static/sa.css">
  11. <script src="../../static/kj/vue.min.js"></script>
  12. <script src="../../static/kj/element-ui/index.js"></script>
  13. <script src="../../static/kj/httpVueLoader.js"></script>
  14. <script src="../../static/kj/jquery.min.js"></script>
  15. <script src="../../static/kj/layer/layer.js"></script>
  16. <script src="../../static/sa.js"></script>
  17. <script src="../../static/kj/upload-util.js"></script>
  18. <style type="text/css">
  19. .c-panel .el-form .c-label {
  20. width: 7em !important;
  21. }
  22. .c-panel .el-form .el-input,
  23. .c-panel .el-form .el-textarea__inner {
  24. width: 250px;
  25. }
  26. table {
  27. font-family: arial, sans-serif;
  28. border-collapse: collapse;
  29. width: 90%;
  30. margin-top: 22px;
  31. margin-left: auto;
  32. margin-right: auto;
  33. }
  34. th {
  35. border: 1px solid darkgray;
  36. text-align: left;
  37. height: 22px;
  38. padding: 8px;
  39. background-color: #dddddd;
  40. }
  41. td {
  42. border: 1px solid darkgray;
  43. text-align: left;
  44. padding: 8px;
  45. }
  46. </style>
  47. </head>
  48. <body>
  49. <div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
  50. <!-- ------- 内容部分 ------- -->
  51. <div class="s-body">
  52. <div class="c-panel">
  53. <div class="c-title" v-if="id == 0">数据添加</div>
  54. <div class="c-title" v-else>数据修改</div>
  55. <el-form v-if="m">
  56. <table>
  57. <tr>
  58. <th>企业名称</th>
  59. <td>
  60. <el-input type="text" v-model="m.businessName" placeholder="请输入企业名称"></el-input>
  61. </td>
  62. <th>企业法人</th>
  63. <td>
  64. <el-input type="text" v-model="m.legalPerson" placeholder="请输入企业法人"></el-input>
  65. </td>
  66. </tr>
  67. <tr>
  68. <th>统一社会信用代码</th>
  69. <td>
  70. <el-input type="text" v-model="m.dutyParagraph"
  71. placeholder="请输入统一社会信用代码"></el-input>
  72. </td>
  73. <th>营业执照</th>
  74. <td>
  75. <sa-item type="img-list" v-model="m.businessLicense" br></sa-item>
  76. </td>
  77. </tr>
  78. <tr>
  79. <th>联系人</th>
  80. <td>
  81. <el-input type="text" v-model="m.name" placeholder="请输入联系人"></el-input>
  82. </td>
  83. <th>联系电话</th>
  84. <td>
  85. <el-input type="text" v-model="m.contact" placeholder="请输入联系电话"></el-input>
  86. </td>
  87. </tr>
  88. <tr>
  89. <th>身份证号</th>
  90. <td>
  91. <el-input type="text" v-model="m.idCard" placeholder="请输入身份证号"></el-input>
  92. </td>
  93. <th>邮箱</th>
  94. <td>
  95. <el-input type="text" v-model="m.email" placeholder="请输入邮箱"></el-input>
  96. </td>
  97. </tr>
  98. <tr>
  99. <th>银行名称</th>
  100. <td>
  101. <el-select v-model="m.bankNo" placeholder="请选择" filterable size="mini">
  102. <el-option label="请选择" :value="0" disabled></el-option>
  103. <el-option v-for="(item,index) in bankList" :key="index"
  104. :label="item.bankName+'('+item.bankCode+')'"
  105. :value="item.bankCode"></el-option>
  106. </el-select>
  107. </td>
  108. <th>银行账号</th>
  109. <td>
  110. <el-input type="text" v-model="m.bankAccount" placeholder="请输入银行账号"></el-input>
  111. </td>
  112. </tr>
  113. <tr>
  114. <th>企业地址</th>
  115. <td colspan="3">
  116. <el-input type="text" v-model="m.address" placeholder="请输入企业地址"
  117. style="width: 90%"></el-input>
  118. </td>
  119. </tr>
  120. </table>
  121. <sa-item name="" class="s-ok" br>
  122. <el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
  123. </sa-item>
  124. </el-form>
  125. </div>
  126. </div>
  127. <!-- ------- 底部按钮 ------- -->
  128. <div class="s-foot">
  129. <el-button type="primary" @click="ok()">确定</el-button>
  130. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  131. </div>
  132. </div>
  133. <script>
  134. var app = new Vue({
  135. components: {
  136. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  137. },
  138. el: '.vue-box',
  139. data: {
  140. bankList: [],
  141. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  142. m: null, // 实体对象
  143. },
  144. methods: {
  145. getBankList() {
  146. sa.ajax('/sp-admin/TbBank/getAll', function(resp) {
  147. this.bankList = resp.data;
  148. }.bind(this));
  149. },
  150. // 创建一个 默认Model
  151. createModel: function() {
  152. return {
  153. businessName: '', // 企业名称
  154. legalPerson: '', // 企业法人
  155. dutyParagraph: '', // 统一社会信用代码
  156. businessLicense: '', // 营业执照
  157. name: '', // 联系人
  158. email: '', // 邮箱
  159. contact: '', // 手机号码
  160. idCard: '', // 身份证号
  161. bankNo: '', // 银行编号
  162. bankName: '', // 银行名称
  163. bankAccount: '', // 银行账号
  164. address: '', // 企业地址
  165. }
  166. },
  167. // 提交数据
  168. ok: function() {
  169. // 表单校验
  170. let m = this.m;
  171. sa.checkNull(m.businessName, '请输入 [企业名称]');
  172. sa.checkNull(m.legalPerson, '请输入 [企业法人]');
  173. sa.checkNull(m.dutyParagraph, '请输入 [统一社会信用代码]');
  174. sa.checkNull(m.name, '请输入 [联系人]');
  175. // sa.checkNull(m.idCard, '请输入 [身份证号]');
  176. let contact = m.contact;
  177. if (!sa.isPhone(contact)) {
  178. sa.error('手机号不正确');
  179. return;
  180. }
  181. let bankNo = m.bankNo;
  182. sa.checkNull(bankNo, '请选择 [银行]');
  183. sa.checkNull(m.bankAccount, '请输入 [银行账号]');
  184. let bankList = this.bankList;
  185. let bank = bankList.filter(bank => bank.bankCode === bankNo)[0];
  186. this.m.bankName = bank.bankName;
  187. m.type = 1; // 类型:企业收购商
  188. // 开始增加或修改
  189. if (this.id <= 0) { // 添加
  190. sa.ajax('/level-two-server/TbPurchaser/add', m, function(res) {
  191. sa.alert('增加成功', this.clean);
  192. }.bind(this));
  193. } else { // 修改
  194. sa.ajax('/level-two-server/TbPurchaser/update', m, function(res) {
  195. sa.alert('修改成功', this.clean);
  196. }.bind(this));
  197. }
  198. },
  199. // 添加/修改 完成后的动作
  200. clean: function() {
  201. if (this.id == 0) {
  202. this.m = this.createModel();
  203. } else {
  204. parent.app.f5(); // 刷新父页面列表
  205. sa.closeCurrIframe(); // 关闭本页
  206. }
  207. }
  208. },
  209. mounted: function() {
  210. this.getBankList();
  211. // 初始化数据
  212. if (this.id <= 0) {
  213. this.m = this.createModel();
  214. } else {
  215. sa.ajax('/level-two-server/TbPurchaser/getById?id=' + this.id, function(res) {
  216. this.m = res.data;
  217. if (res.data == null) {
  218. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  219. }
  220. }.bind(this))
  221. }
  222. }
  223. })
  224. </script>
  225. </body>
  226. </html>