tb-costomer-list.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>客户管理-列表</title>
  5. <meta 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. </head>
  18. <body>
  19. <div class="vue-box" style="display: none;" :style="'display: block;'">
  20. <div class="c-panel">
  21. <!-- ------------- 检索参数 ------------- -->
  22. <div class="c-title">检索参数</div>
  23. <el-form ref="form" :model='p' @submit.native.prevent>
  24. <sa-item type="text" name="企业名称" v-model="p.name"></sa-item>
  25. <sa-item type="text" name="联系电话" v-model="p.phone"></sa-item>
  26. <sa-item type="text" name="联系人" v-model="p.dutyPeople"></sa-item>
  27. <div class="c-item">
  28. <label class="c-label">审核状态:</label>
  29. <el-select v-model="p.judgeStatus" placeholder="请选择" filterable>
  30. <el-option label="-全部-" value=""> </el-option>
  31. <el-option label="未审核" value="1"> </el-option>
  32. <el-option label="审核通过" value="2"> </el-option>
  33. <el-option label="审核不通过" value="3"> </el-option>
  34. </el-select>
  35. </div>
  36. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  37. <br />
  38. </el-form>
  39. <el-button type="primary" icon="el-icon-plus" @click="add()" v-if="sa.isAuth('tb-costomer-add')">新增
  40. </el-button>
  41. <!-- <el-button type="success" icon="el-icon-view" @click="getBySelect()">查看</el-button>-->
  42. <el-button type="danger" icon="el-icon-delete" @click="deleteByIds()" v-if="sa.isAuth('tb-costomer-del')">删除
  43. </el-button>
  44. <el-button type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
  45. <!-- ------------- 数据列表 ------------- -->
  46. <el-table class="data-table" ref="data-table" :data="dataList">
  47. <sa-td type="selection"></sa-td>
  48. <sa-td name="企业名称" prop="name"></sa-td>
  49. <sa-td name="联系人" prop="dutyPeople"></sa-td>
  50. <sa-td name="联系电话" prop="phone"></sa-td>
  51. <sa-td name="结算类型" prop="payType" type="enum" :jv="{1: '现结', 2: '月结'}"></sa-td>
  52. <!-- <sa-td name="地址" prop="addressStr" ></sa-td> -->
  53. <sa-td name="营业执照" prop="businessLicence" type="img"></sa-td>
  54. <sa-td name="状态" prop="status" type="switch" :jv="{0: '禁用[#ff0000]', 1: '启用[#005500]'}"
  55. @change="s => updateStatus(s.row)"></sa-td>
  56. <sa-td name="审核状态" prop="judgeStatus" type="enum" :jv="{1: '未审核', 2: '已通过', 3: '不通过'}"></sa-td>
  57. <sa-td name="审核时间" prop="judgeTime" width="160px"></sa-td>
  58. <el-table-column label="操作" fixed="right" width="320px">
  59. <template slot-scope="s">
  60. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看
  61. </el-button>
  62. <el-button class="c-btn" type="success" icon="el-icon-view" v-if="(s.row.judgeStatus==1||s.row.judgeStatus==3)&&sa.isAuth('tb-costomer-judge')"
  63. @click="judgeFn(s.row)">
  64. 审核
  65. </el-button>
  66. <el-button v-if="sa.isAuth('tb-costomer-edit')" class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改
  67. </el-button>
  68. <el-button v-if="sa.isAuth('tb-costomer-user')" class="c-btn" type="primary" icon="el-icon-user-solid" @click="userFn(s.row)">用户
  69. </el-button>
  70. <el-button class="c-btn" type="primary" icon="el-icon-user-solid" v-if="s.row.judgeStatus==2&&sa.isAuth('tb-costomer-account')" @click="accountFn(s.row)">账户
  71. </el-button>
  72. <el-button v-if="sa.isAuth('tb-costomer-del')" class="c-btn" type="danger" icon="el-icon-delete"
  73. @click="del(s.row)">删除</el-button>
  74. </template>
  75. </el-table-column>
  76. </el-table>
  77. <!-- ------------- 分页 ------------- -->
  78. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
  79. </sa-item>
  80. </div>
  81. <el-dialog title="审核" :visible="modal.visible" width="500px">
  82. <el-form size="mini">
  83. <div class="c-item br">
  84. <label class="c-label"><label style="color: red">*</label>审核意见:</label>
  85. <el-input placeholder="请输入审核意见" v-model="modal.form.judgeContent"></el-input>
  86. </div>
  87. </el-form>
  88. <span slot="footer" class="dialog-footer">
  89. <el-button @click="modal.visible=false">关闭</el-button>
  90. <el-button type="danger" @click="sureJudge(3)">不通过</el-button>
  91. <el-button type="primary" @click="sureJudge(2)">通过</el-button>
  92. </span>
  93. </el-dialog>
  94. </div>
  95. <script>
  96. var app = new Vue({
  97. components: {
  98. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  99. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  100. },
  101. el: '.vue-box',
  102. data: {
  103. modal: {
  104. visible: false,
  105. form: {
  106. id: '',
  107. judgeContent: '审核通过'
  108. }
  109. },
  110. p: { // 查询参数
  111. type: 0, // 主键
  112. name: '', // 名称
  113. phone: '', // 联系号码
  114. dutyPeople: '', // 负责人
  115. addressIds: '', // 地址id
  116. addressStr: '', // 地址
  117. status: '', // 状态(0=否,1=是)
  118. creareTime: '', // 创建时间
  119. judgeStatus: '', // 审核状态(1=未审核,2审核通过,3审核不通过)
  120. judgeTime: '', // 审核时间
  121. judgeContent: '', // 审核意见
  122. pageNo: 1, // 当前页
  123. pageSize: 10, // 页大小
  124. sortType: 0 // 排序方式
  125. },
  126. dataCount: 0,
  127. dataList: [], // 数据集合
  128. currentCustomerId: '1',
  129. },
  130. methods: {
  131. accountFn(data){
  132. sa.showIframe('企业账户', 'tb-account-manager.html?customerId=' + data.id, '450px', '60%');
  133. },
  134. judgeFn(data) {
  135. Object.assign(this.modal, {
  136. visible: true,
  137. form: {
  138. id: data.id,
  139. judgeContent: data.judgeContent,
  140. judgeStatus: data.judgeStatus
  141. }
  142. })
  143. },
  144. sureJudge(status) {
  145. if (this.modal.form.judgeStatus == 2) {
  146. sa.error('已审核通过,无需再审核')
  147. return;
  148. }
  149. let content = "审核通过";
  150. if (status == 3) {
  151. if (!this.modal.form.judgeContent) {
  152. sa.error('请输入审核意见');
  153. return;
  154. }
  155. } else {
  156. this.modal.form.judgeContent = content;
  157. }
  158. this.modal.form.judgeStatus = status;
  159. sa.ajax('/TbCostomer/judge', this.modal.form, function(resp) {
  160. this.modal.visible = false;
  161. this.f5();
  162. }.bind(this))
  163. },
  164. getCustomer() {
  165. sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
  166. this.currentCustomerId = resp.data;
  167. }.bind(this));
  168. },
  169. userFn(data) {
  170. sa.showIframe('企业用户', 'customer-admin-list.html?customerId=' + data.id, '1050px', '90%');
  171. },
  172. // 刷新
  173. f5: function() {
  174. sa.ajax('/TbCostomer/getList', sa.removeNull(this.p), function(res) {
  175. this.dataList = res.data; // 数据
  176. this.dataCount = res.dataCount; // 数据总数
  177. sa.f5TableHeight(); // 刷新表格高度
  178. }.bind(this));
  179. },
  180. // 查看
  181. get: function(data) {
  182. sa.showIframe('数据详情', 'tb-costomer-info.html?id=' + data.id, '800px', '80%');
  183. },
  184. // 查看 - 根据选中的
  185. getBySelect: function(data) {
  186. var selection = this.$refs['data-table'].selection;
  187. if (selection.length == 0) {
  188. return sa.msg('请选择一条数据')
  189. }
  190. this.get(selection[0]);
  191. },
  192. // 修改
  193. update: function(data) {
  194. sa.showIframe('修改数据', 'tb-costomer-add.html?id=' + data.id, '500px', '70%');
  195. },
  196. // 新增
  197. add: function(data) {
  198. sa.showIframe('新增数据', 'tb-costomer-add.html?id=-1', '550px', '80%');
  199. },
  200. // 删除
  201. del: function(data) {
  202. sa.confirm('是否删除,此操作不可撤销', function() {
  203. sa.ajax('/TbCostomer/delete?id=' + data.id, function(res) {
  204. sa.arrayDelete(this.dataList, data);
  205. sa.ok('删除成功');
  206. sa.f5TableHeight(); // 刷新表格高度
  207. }.bind(this))
  208. }.bind(this));
  209. },
  210. // 批量删除
  211. deleteByIds: function() {
  212. // 获取选中元素的id列表
  213. let selection = this.$refs['data-table'].selection;
  214. let ids = sa.getArrayField(selection, 'id');
  215. if (selection.length == 0) {
  216. return sa.msg('请至少选择一条数据')
  217. }
  218. // 提交删除
  219. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  220. sa.ajax('/TbCostomer/deleteByIds', {
  221. ids: ids.join(',')
  222. }, function(res) {
  223. sa.arrayDelete(this.dataList, selection);
  224. sa.ok('删除成功');
  225. sa.f5TableHeight(); // 刷新表格高度
  226. }.bind(this))
  227. }.bind(this));
  228. },
  229. // 改 - 状态(0=否,1=是)
  230. updateStatus: function(data) {
  231. // 声明变量记录是否成功
  232. var isOk = false;
  233. var oldValue = data.status;
  234. var ajax = sa.ajax('/TbCostomer/updateStatus', {
  235. id: data.id,
  236. value: data.status
  237. }, function(res) {
  238. isOk = true;
  239. sa.msg('修改成功');
  240. }.bind(this));
  241. // 如果未能修改成功, 则回滚
  242. $.when(ajax).done(function() {
  243. if (isOk == false) {
  244. data.status = oldValue;
  245. }
  246. })
  247. },
  248. },
  249. created: function() {
  250. this.f5();
  251. this.getCustomer();
  252. sa.onInputEnter();
  253. }
  254. })
  255. </script>
  256. </body>
  257. </html>