tb-purchaser-personal-add.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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.name" placeholder="请输入姓名"></el-input>
  61. </td>
  62. <th>邮箱</th>
  63. <td>
  64. <el-input type="text" v-model="m.email" placeholder="请输入邮箱"></el-input>
  65. </td>
  66. </tr>
  67. <tr>
  68. <th>联系电话</th>
  69. <td>
  70. <el-input type="text" v-model="m.contact" placeholder="请输入联系电话"></el-input>
  71. </td>
  72. <th>身份证号</th>
  73. <td>
  74. <el-input type="text" v-model="m.idCard" placeholder="请输入身份证号"></el-input>
  75. </td>
  76. </tr>
  77. <tr>
  78. <th>银行名称</th>
  79. <td>
  80. <el-select v-model="m.bankNo" placeholder="请选择" filterable size="mini">
  81. <el-option label="请选择" :value="0" disabled></el-option>
  82. <el-option v-for="(item,index) in bankList" :key="index" :label="item.bankName" :value="item.bankCode"></el-option>
  83. </el-select>
  84. </td>
  85. <th>银行账号</th>
  86. <td>
  87. <el-input type="text" v-model="m.bankAccount" placeholder="请输入银行账号"></el-input>
  88. </td>
  89. </tr>
  90. <tr>
  91. <th>地址</th>
  92. <td colspan="3">
  93. <el-input type="text" v-model="m.address" placeholder="请输入地址" style="width: 90%"></el-input>
  94. </td>
  95. </tr>
  96. </table>
  97. <sa-item name="" class="s-ok" br>
  98. <el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
  99. </sa-item>
  100. </el-form>
  101. </div>
  102. </div>
  103. <!-- ------- 底部按钮 ------- -->
  104. <div class="s-foot">
  105. <el-button type="primary" @click="ok()">确定</el-button>
  106. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  107. </div>
  108. </div>
  109. <script>
  110. var app = new Vue({
  111. components: {
  112. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  113. },
  114. el: '.vue-box',
  115. data: {
  116. bankList: [],
  117. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  118. m: null, // 实体对象
  119. },
  120. methods: {
  121. getBankList() {
  122. sa.ajax('/sp-admin/TbBank/getAll', function(resp) {
  123. this.bankList = resp.data;
  124. }.bind(this));
  125. },
  126. // 创建一个 默认Model
  127. createModel: function() {
  128. return {
  129. name: '', // 姓名
  130. email: '', // 邮箱
  131. idCard: '', // 身份证号
  132. contact: '', // 手机号码
  133. bankNo: '', // 银行编号
  134. bankName: '', // 银行名称
  135. bankAccount: '', // 银行账号
  136. address: '', // 地址
  137. // judgeStatus: '', // 审核状态(0=未通过,1=已通过)
  138. // judgeContent: '', // 审核意见
  139. // judgeTime: '', // 上次审核时间
  140. // personId: '', // 人脸编号
  141. // deleteStatus: '', // 删除状态(0=禁用,1=启用)
  142. }
  143. },
  144. // 提交数据
  145. ok: function() {
  146. // 表单校验
  147. let m = this.m;
  148. sa.checkNull(m.name, '请输入 [姓名]');
  149. sa.checkNull(m.idCard, '请输入 [身份证号]');
  150. let contact = m.contact;
  151. if (!sa.isPhone(contact)) {
  152. sa.error('手机号不正确');
  153. return;
  154. }
  155. let bankNo = m.bankNo;
  156. sa.checkNull(bankNo, '请选择 [银行]');
  157. sa.checkNull(m.bankAccount, '请输入 [银行账号]');
  158. let bankList = this.bankList;
  159. let bank = bankList.filter(bank => bank.bankCode === bankNo)[0];
  160. this.m.bankName = bank.bankName;
  161. m.type = 2; // 类型:个人收购商
  162. // 开始增加或修改
  163. if (this.id <= 0) { // 添加
  164. sa.ajax('/level-two-server/TbPurchaser/add', m, function(res) {
  165. sa.alert('增加成功', this.clean);
  166. }.bind(this));
  167. } else { // 修改
  168. sa.ajax('/level-two-server/TbPurchaser/update', m, function(res) {
  169. sa.alert('修改成功', this.clean);
  170. }.bind(this));
  171. }
  172. },
  173. // 添加/修改 完成后的动作
  174. clean: function() {
  175. if (this.id == 0) {
  176. this.m = this.createModel();
  177. } else {
  178. parent.app.f5(); // 刷新父页面列表
  179. sa.closeCurrIframe(); // 关闭本页
  180. }
  181. }
  182. },
  183. mounted: function() {
  184. this.getBankList();
  185. // 初始化数据
  186. if (this.id <= 0) {
  187. this.m = this.createModel();
  188. } else {
  189. sa.ajax('/level-two-server/TbPurchaser/getById?id=' + this.id, function(res) {
  190. this.m = res.data;
  191. if (res.data == null) {
  192. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  193. }
  194. }.bind(this))
  195. }
  196. }
  197. })
  198. </script>
  199. </body>
  200. </html>