tb-partner-add.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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="../../static/kj/element-ui/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. </style>
  27. </head>
  28. <body>
  29. <div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
  30. <!-- ------- 内容部分 ------- -->
  31. <div class="s-body">
  32. <div class="c-panel">
  33. <div class="c-title" v-if="id == 0">数据添加</div>
  34. <div class="c-title" v-else>数据修改</div>
  35. <el-form v-if="m">
  36. <el-row>
  37. <sa-item type="text" name="名称" v-model="m.name" placeholder="请输入名称" br></sa-item>
  38. <sa-item type="text" name="联系人" v-model="m.dutyPeople" placeholder="请输入联系人" br></sa-item>
  39. <sa-item type="text" name="联系电话" v-model="m.phone" placeholder="请输入联系号码" br></sa-item>
  40. <div class="c-item">
  41. <label class="c-label">公众号通知:</label>
  42. <el-select v-model="messageType" multiple :disabled="currentCustomerId!=='1'">
  43. <el-option v-for="good in goodsList" :key="good.id"
  44. :label="good.name" :value="good.id">
  45. </el-option>
  46. </el-select>
  47. </div>
  48. <div class="c-item">
  49. <label class="c-label">业务录入权限:</label>
  50. <el-select v-model="businessType" multiple :disabled="currentCustomerId!=='1'">
  51. <el-option v-for="good in goodsList" :key="good.id"
  52. :label="good.name" :value="good.id">
  53. </el-option>
  54. </el-select>
  55. </div>
  56. <div class="c-item">
  57. <label class="c-label">类型:</label>
  58. <el-select v-model="type" multiple :disabled="currentCustomerId!=='1'">
  59. <el-option label="消杀公司" value="1"></el-option>
  60. <el-option label="装卸公司" value="2"></el-option>
  61. <el-option label="核酸检测单位" value="3"></el-option>
  62. </el-select>
  63. </div>
  64. <sa-item type="img" name="营业执照" v-model="m.businessLicence" br></sa-item>
  65. </el-row>
  66. </el-form>
  67. </div>
  68. </div>
  69. <!-- ------- 底部按钮 ------- -->
  70. <div class="s-foot">
  71. <el-button v-if="sa.isAuth('tb-partner-add')" type="primary" @click="ok()">确定</el-button>
  72. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  73. </div>
  74. </div>
  75. <script>
  76. var app = new Vue({
  77. components: {
  78. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  79. },
  80. el: '.vue-box',
  81. data: {
  82. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  83. m: null, // 实体对象
  84. options: [],
  85. currentCustomerId: '1',
  86. type: [],
  87. businessType: [],
  88. messageType: [],
  89. goodsList: [],
  90. },
  91. methods: {
  92. getGoodsList() {
  93. sa.ajax('/TbGoods/getList', function (resp) {
  94. this.goodsList = resp.data;
  95. }.bind(this));
  96. },
  97. getCurrendCustomer() {
  98. sa.ajax('/TbCostomer/getCurrentCustomerId', function (resp) {
  99. this.currentCustomerId = resp.data;
  100. }.bind(this));
  101. },
  102. // 创建一个 默认Model
  103. createModel: function () {
  104. return {
  105. name: '', // 名称
  106. phone: '', // 联系号码
  107. dutyPeople: '', // 负责人
  108. addressIds: '', // 地址id
  109. addressStr: '', // 地址
  110. businessLicence: '', // 营业执照
  111. address_arry: [],
  112. payType: 1,
  113. type: 1,
  114. status: '1', // 状态(0=否,1=是)
  115. judgeStatus: '2', // 审核状态(1=未审核,2审核通过,3审核不通过)
  116. }
  117. },
  118. // 提交数据
  119. ok: function () {
  120. // 表单校验
  121. let m = this.m;
  122. sa.checkNull(m.name, '请输入 [名称]');
  123. if (!sa.isPhone(m.phone)) {
  124. sa.error('联系号码不正确')
  125. return;
  126. }
  127. sa.checkNull(m.dutyPeople, '请输入 [联系人]');
  128. m.type = this.type.join(",")
  129. m.businessType = this.businessType.join(",");
  130. m.messageType = this.messageType.join(",");
  131. sa.checkNull(m.type, '请输入 [类型]');
  132. sa.checkNull(m.businessType, '请选择 [业务项]');
  133. sa.checkNull(m.messageType, '请选择 [公众号通知]');
  134. if (this.id <= 0) { // 添加
  135. sa.ajax('/TbCostomer/add', m, function (res) {
  136. sa.alert('增加成功', this.clean);
  137. }.bind(this));
  138. } else { // 修改
  139. sa.ajax('/TbCostomer/update/partner', m, function (res) {
  140. sa.alert('修改成功', this.clean);
  141. }.bind(this));
  142. }
  143. },
  144. // 添加/修改 完成后的动作
  145. clean: function () {
  146. if (this.id == 0) {
  147. this.m = this.createModel();
  148. } else {
  149. parent.app.f5(); // 刷新父页面列表
  150. sa.closeCurrIframe(); // 关闭本页
  151. }
  152. }
  153. },
  154. mounted: function () {
  155. this.getCurrendCustomer()
  156. this.getGoodsList();
  157. // 初始化数据
  158. if (this.id <= 0) {
  159. this.m = this.createModel();
  160. } else {
  161. sa.ajax('/TbCostomer/getById?id=' + this.id, function (res) {
  162. this.m = res.data;
  163. this.type = this.m.type.split(',')
  164. this.businessType = this.m.businessType.split(',')
  165. this.messageType = this.m.messageType.split(',')
  166. if (res.data == null) {
  167. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  168. }
  169. }.bind(this))
  170. }
  171. }
  172. })
  173. </script>
  174. </body>
  175. </html>