tb-costomer-list.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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. <sa-item name="综合排序">
  39. <el-radio-group v-model="p.sortType" class="s-radio-text">
  40. <el-radio :label="0">默认</el-radio>
  41. <el-radio :label="2">名称</el-radio>
  42. <el-radio :label="8">创建时间</el-radio>
  43. </el-radio-group>
  44. </sa-item>
  45. </el-form>
  46. <el-button type="primary" icon="el-icon-plus" @click="add()" v-if="currentCustomerId=='1'">新增
  47. </el-button>
  48. <el-button type="success" icon="el-icon-view" @click="getBySelect()">查看</el-button>
  49. <el-button type="danger" icon="el-icon-delete" @click="deleteByIds()" v-if="currentCustomerId=='1'">删除
  50. </el-button>
  51. <el-button type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
  52. <!-- ------------- 数据列表 ------------- -->
  53. <el-table class="data-table" ref="data-table" :data="dataList">
  54. <sa-td type="selection"></sa-td>
  55. <sa-td name="名称" prop="name"></sa-td>
  56. <sa-td name="联系人" prop="dutyPeople"></sa-td>
  57. <sa-td name="联系号码" prop="phone"></sa-td>
  58. <sa-td name="结算类型" prop="payType" type="enum" :jv="{1: '现结', 2: '月结'}"></sa-td>
  59. <!-- <sa-td name="地址" prop="addressStr" ></sa-td> -->
  60. <sa-td name="营业执照" prop="businessLicence" type="img"></sa-td>
  61. <sa-td name="是否启用" prop="status" type="switch" :jv="{0: '否[#ff0000]', 1: '是[#005500]'}"
  62. @change="s => updateStatus(s.row)"></sa-td>
  63. <sa-td name="创建时间" prop="creareTime"></sa-td>
  64. <sa-td name="审核状态" prop="judgeStatus" type="enum" :jv="{1: '未审核', 2: '已通过', 3: '不通过'}"></sa-td>
  65. <sa-td name="审核时间" prop="judgeTime" width="160px"></sa-td>
  66. <el-table-column label="操作" fixed="right" width="320px">
  67. <template slot-scope="s">
  68. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看
  69. </el-button>
  70. <el-button class="c-btn" type="success" icon="el-icon-view" v-if="s.row.judgeStatus==1"
  71. @click="judgeFn(s.row)">
  72. 审核
  73. </el-button>
  74. <el-button class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改
  75. </el-button>
  76. <el-button class="c-btn" type="primary" icon="el-icon-user-solid" @click="userFn(s.row)">用户
  77. </el-button>
  78. <el-button v=if="currentCustomerId==1" class="c-btn" type="danger" icon="el-icon-delete"
  79. @click="del(s.row)">删除</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. id: '', // 主键
  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. judgeFn(data) {
  138. Object.assign(this.modal, {
  139. visible: true,
  140. form: {
  141. id: data.id,
  142. judgeContent: data.judgeContent,
  143. judgeStatus: data.judgeStatus
  144. }
  145. })
  146. },
  147. sureJudge(status) {
  148. if (this.modal.form.judgeStatus == 2) {
  149. sa.error('已审核通过,无需再审核')
  150. return;
  151. }
  152. let content = "审核通过";
  153. if (status == 3) {
  154. if (!this.modal.form.judgeContent) {
  155. sa.error('请输入审核意见');
  156. return;
  157. }
  158. } else {
  159. this.modal.form.judgeContent = content;
  160. }
  161. this.modal.form.judgeStatus = status;
  162. sa.ajax('/TbCostomer/judge', this.modal.form, function(resp) {
  163. this.modal.visible = false;
  164. this.f5();
  165. }.bind(this))
  166. },
  167. getCustomer() {
  168. sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
  169. this.currentCustomerId = resp.data;
  170. }.bind(this));
  171. },
  172. userFn(data) {
  173. sa.showIframe('企业用户', 'customer-admin-list.html?customerId=' + data.id, '1050px', '90%');
  174. },
  175. // 刷新
  176. f5: function() {
  177. sa.ajax('/TbCostomer/getList', sa.removeNull(this.p), function(res) {
  178. this.dataList = res.data; // 数据
  179. this.dataCount = res.dataCount; // 数据总数
  180. sa.f5TableHeight(); // 刷新表格高度
  181. }.bind(this));
  182. },
  183. // 查看
  184. get: function(data) {
  185. sa.showIframe('数据详情', 'tb-costomer-info.html?id=' + data.id, '1050px', '90%');
  186. },
  187. // 查看 - 根据选中的
  188. getBySelect: function(data) {
  189. var selection = this.$refs['data-table'].selection;
  190. if (selection.length == 0) {
  191. return sa.msg('请选择一条数据')
  192. }
  193. this.get(selection[0]);
  194. },
  195. // 修改
  196. update: function(data) {
  197. sa.showIframe('修改数据', 'tb-costomer-add.html?id=' + data.id, '1000px', '90%');
  198. },
  199. // 新增
  200. add: function(data) {
  201. sa.showIframe('新增数据', 'tb-costomer-add.html?id=-1', '550px', '80%');
  202. },
  203. // 删除
  204. del: function(data) {
  205. sa.confirm('是否删除,此操作不可撤销', function() {
  206. sa.ajax('/TbCostomer/delete?id=' + data.id, function(res) {
  207. sa.arrayDelete(this.dataList, data);
  208. sa.ok('删除成功');
  209. sa.f5TableHeight(); // 刷新表格高度
  210. }.bind(this))
  211. }.bind(this));
  212. },
  213. // 批量删除
  214. deleteByIds: function() {
  215. // 获取选中元素的id列表
  216. let selection = this.$refs['data-table'].selection;
  217. let ids = sa.getArrayField(selection, 'id');
  218. if (selection.length == 0) {
  219. return sa.msg('请至少选择一条数据')
  220. }
  221. // 提交删除
  222. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  223. sa.ajax('/TbCostomer/deleteByIds', {
  224. ids: ids.join(',')
  225. }, function(res) {
  226. sa.arrayDelete(this.dataList, selection);
  227. sa.ok('删除成功');
  228. sa.f5TableHeight(); // 刷新表格高度
  229. }.bind(this))
  230. }.bind(this));
  231. },
  232. // 改 - 状态(0=否,1=是)
  233. updateStatus: function(data) {
  234. // 声明变量记录是否成功
  235. var isOk = false;
  236. var oldValue = data.status;
  237. var ajax = sa.ajax('/TbCostomer/updateStatus', {
  238. id: data.id,
  239. value: data.status
  240. }, function(res) {
  241. isOk = true;
  242. sa.msg('修改成功');
  243. }.bind(this));
  244. // 如果未能修改成功, 则回滚
  245. $.when(ajax).done(function() {
  246. if (isOk == false) {
  247. data.status = oldValue;
  248. }
  249. })
  250. },
  251. },
  252. created: function() {
  253. this.f5();
  254. this.getCustomer();
  255. sa.onInputEnter();
  256. }
  257. })
  258. </script>
  259. </body>
  260. </html>