tb-costomer-list.html 12 KB

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