index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item label="团队名称" label-width="70px">
  5. <el-input
  6. v-model="queryParams.name"
  7. placeholder="请输入团队名称"
  8. clearable
  9. style="width: 140px;"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="团队类型">
  14. <el-select
  15. v-model="queryParams.type"
  16. placeholder="团队类型"
  17. clearable
  18. style="width: 240px"
  19. >
  20. <el-option
  21. v-for="dict in dict.type.team_type"
  22. :key="dict.value"
  23. :label="dict.label"
  24. :value="dict.value"
  25. />
  26. </el-select>
  27. </el-form-item>
  28. <el-form-item label="销售员" label-width="70px">
  29. <el-input
  30. v-model="queryParams.salerPerson"
  31. placeholder="请输入销售员"
  32. clearable
  33. style="width: 140px;"
  34. @keyup.enter.native="handleQuery"
  35. />
  36. </el-form-item>
  37. <el-form-item label="创建人" label-width="70px">
  38. <el-input
  39. v-model="queryParams.createBy"
  40. placeholder="请输入创建人"
  41. clearable
  42. style="width: 140px;"
  43. @keyup.enter.native="handleQuery"
  44. />
  45. </el-form-item>
  46. <el-form-item>
  47. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  48. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  49. </el-form-item>
  50. </el-form>
  51. <el-row :gutter="10" class="mb8">
  52. <el-col :span="1.5">
  53. <el-button
  54. type="primary"
  55. plain
  56. icon="el-icon-plus"
  57. size="mini"
  58. @click="handleAdd"
  59. v-hasPermi="['teamMr:teamMr:add']"
  60. >新增</el-button>
  61. </el-col>
  62. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  63. </el-row>
  64. <el-table ref="tables" v-loading="loading" :data="dataList" max-height="520px" border>
  65. <el-table-column label="序号" align="center" type="index" width="50"></el-table-column>
  66. <el-table-column label="团队名称" align="center" prop="name" width="170" />
  67. <el-table-column label="团队类型" align="center" prop="type">
  68. <template slot-scope="scope">
  69. <dict-tag :options="dict.type.team_type" :value="scope.row.type"/>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="客户负责人" align="center" prop="contact" width="110" />
  73. <el-table-column label="客户账号/电话" align="center" prop="mobile" width="120" />
  74. <el-table-column label="销售员" align="center" prop="salerPerson" />
  75. <el-table-column label="销售员联系电话" align="center" prop="salerMobile" width="120" />
  76. <el-table-column label="合约信息" align="center" prop="type">
  77. <template slot-scope="scope">
  78. <el-button type="text" @click="seeCenter(scope.row, 'img')">查看</el-button>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="储值额度" align="center" prop="regTotalAmount" />
  82. <el-table-column label="储值余额" align="center" prop="balance" />
  83. <el-table-column label="授信额度" align="center" prop="grantQuota" />
  84. <el-table-column label="授信余额" align="center" prop="grantSurplus" />
  85. <el-table-column label="授信欠款" align="center" prop="grantUsed" />
  86. <el-table-column label="账户状态" align="center" prop="status">
  87. <template slot-scope="scope">
  88. <el-switch
  89. @change="updateStatusApi(scope.row)"
  90. v-model="scope.row.switchValue"
  91. :active-value="1"
  92. active-color="#13ce66"
  93. inactive-color="#ff4949">
  94. </el-switch>
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="创建人" align="center" prop="createBy" />
  98. <el-table-column label="创建时间" align="center" prop="createTime" width="170">
  99. <template slot-scope="scope">
  100. <span>{{ parseTime(scope.row.createTime) }}</span>
  101. </template>
  102. </el-table-column>
  103. <el-table-column label="审核状态" align="center" prop="checkStatus" width="110">
  104. <template slot-scope="scope">
  105. <el-tag type="info" v-if="scope.row.checkStatus == 0">待审核</el-tag>
  106. <el-tag type="success" v-if="scope.row.checkStatus == 1">审核成功</el-tag>
  107. <el-popover
  108. placement="top-start"
  109. width="200"
  110. trigger="hover"
  111. :content="'驳回原因:'+scope.row.checkRemark">
  112. <el-tag slot="reference" type="danger" v-if="scope.row.checkStatus == 2">审核不通过</el-tag>
  113. </el-popover>
  114. </template>
  115. </el-table-column>
  116. <el-table-column label="审核时间" align="center" prop="checkTime" width="170" />
  117. <el-table-column label="审核人" align="center" prop="checkBy" />
  118. <el-table-column label="操作" align="center" width="200" fixed="right" class-name="small-padding fixed-width">
  119. <template slot-scope="scope">
  120. <el-button
  121. size="mini"
  122. type="text"
  123. @click="handleAudit(scope.row,'details')"
  124. v-hasPermi="['teamMr:teamMr:details']"
  125. >详情</el-button>
  126. <span v-hasPermi="['teamMr:teamMr:audit']" style="display: inline-block;">
  127. <el-button
  128. size="mini"
  129. type="text"
  130. @click="handleAudit(scope.row,'Audit')"
  131. style="margin-left: 10px;"
  132. v-if="scope.row.checkStatus == 0 && ( name!=scope.row.createBy || scope.row.bigCustomer == 2 )"
  133. >审核</el-button>
  134. </span>
  135. <span v-hasPermi="['teamMr:teamMr:edit']" style="display: inline-block;">
  136. <el-button
  137. size="mini"
  138. type="text"
  139. @click="handleUpdate(scope.row)"
  140. style="margin-left: 10px;"
  141. v-if="scope.row.checkStatus == 1 && ( name!=scope.row.createBy || scope.row.bigCustomer == 2 )"
  142. >编辑</el-button>
  143. </span>
  144. <span v-hasPermi="['teamMr:teamMr:edit']" style="display: inline-block;">
  145. <el-button
  146. size="mini"
  147. type="text"
  148. style="margin-left: 10px;"
  149. @click="handleUpdate(scope.row)"
  150. v-if="scope.row.checkStatus == 2 && name==scope.row.createBy"
  151. >修改重新提交</el-button>
  152. </span>
  153. <span v-hasPermi="['teamMr:teamMr:delete']" style="display: inline-block;">
  154. <el-button
  155. size="mini"
  156. type="text"
  157. @click="handleDelete(scope.row,scope.index)"
  158. style="margin-left: 10px;"
  159. v-if="(scope.row.checkStatus == 1 && name!=scope.row.createBy)||scope.row.checkStatus != 1 || (scope.row.checkStatus == 1 && scope.row.bigCustomer == 2)"
  160. >删除</el-button>
  161. </span>
  162. <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row,scope.index)">
  163. <el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
  164. <el-dropdown-menu slot="dropdown">
  165. <el-dropdown-item command="handleResetPwd" icon="el-icon-key"
  166. v-if="scope.row.checkStatus == 1"
  167. v-hasPermi="['teamMr:teamMr:resetting']">重置密码</el-dropdown-item>
  168. <el-dropdown-item command="rechargeBox" icon="el-icon-key"
  169. v-if="scope.row.checkStatus == 1 && ( name!=scope.row.createBy || scope.row.bigCustomer == 2 )"
  170. v-hasPermi="['teamMr:teamMr:rechargeBox']"
  171. >储值额度充值</el-dropdown-item>
  172. <el-dropdown-item command="creditGranting" icon="el-icon-circle-check"
  173. v-if="scope.row.checkStatus == 1 && ( name!=scope.row.createBy || scope.row.bigCustomer == 2 )"
  174. v-hasPermi="['teamMr:teamMr:creditGranting']"
  175. >账户授信额度</el-dropdown-item>
  176. <el-dropdown-item command="creditGrantingBox" icon="el-icon-circle-check"
  177. v-if="scope.row.checkStatus == 1 && ( name!=scope.row.createBy || scope.row.bigCustomer == 2 )"
  178. v-hasPermi="['teamMr:teamMr:creditGrantingBox']"
  179. >账户授信欠款</el-dropdown-item>
  180. <el-dropdown-item command="orderAll" icon="el-icon-circle-check"
  181. v-hasPermi="['teamMr:teamMr:orderAll']"
  182. >查看团购订单</el-dropdown-item>
  183. </el-dropdown-menu>
  184. </el-dropdown>
  185. </template>
  186. </el-table-column>
  187. </el-table>
  188. <pagination
  189. v-show="total>0"
  190. :total="total"
  191. :page.sync="queryParams.pageNum"
  192. :limit.sync="queryParams.pageSize"
  193. @pagination="getList"
  194. />
  195. <!-- 新增/编辑弹框 -->
  196. <add-and-edit
  197. ref="addAndEdit"
  198. :dict="dict"
  199. @getList="getList"
  200. />
  201. <!-- 账户充值 -->
  202. <rechargeBox
  203. ref="rechargeBox"
  204. @getList="getList"
  205. />
  206. <!-- 账户授信余额 -->
  207. <creditGranting
  208. ref="creditGranting"
  209. @getList="getList"
  210. />
  211. <!-- 账户授信余额 -->
  212. <creditGrantingBox
  213. ref="creditGrantingBox"
  214. @getList="getList"
  215. />
  216. <!-- 账户授信余额 -->
  217. <orderAllBox
  218. ref="orderAllBox"
  219. @getList="getList"
  220. />
  221. <!-- 详情 / 审核 -->
  222. <auditBox ref="auditBox" :dict="dict" @getList="getList" />
  223. <el-dialog
  224. title="查看"
  225. :visible.sync="visibleStatus"
  226. width="600px"
  227. :destroy-on-close="true"
  228. :close-on-click-modal="false"
  229. >
  230. <div v-if="visibleType == 'img'">
  231. <el-image
  232. style="width: 400px; height: 100%"
  233. v-for="(item, index) in newObj.contractImgList"
  234. :key="index"
  235. :src="item"
  236. fit="cover"
  237. />
  238. </div>
  239. <div v-if="visibleType == 'html'">
  240. <div v-html="newObj.centent"></div>
  241. </div>
  242. <div slot="footer" class="dialog-footer">
  243. <el-button type="primary" @click="visibleStatus = false">确 定</el-button>
  244. </div>
  245. </el-dialog>
  246. </div>
  247. </template>
  248. <script>
  249. import { pageList, deleteById, updateStatus } from '@/api/team/teamMr'
  250. import addAndEdit from "./dialog/addAndEdit.vue";
  251. import creditGranting from './dialog/creditGranting.vue';
  252. import rechargeBox from './dialog/rechargeBox.vue';
  253. import auditBox from './dialog/auditBox.vue';
  254. import creditGrantingBox from './dialog/creditGrantingBox.vue';
  255. import orderAllBox from './dialog/orderAllBox.vue';
  256. import { mapGetters } from 'vuex'
  257. export default {
  258. name: "TeamMr",
  259. dicts: ['team_type','order_form_type'],
  260. components: { addAndEdit, creditGranting, rechargeBox, auditBox, creditGrantingBox, orderAllBox },
  261. data() {
  262. return {
  263. // 遮罩层
  264. loading: true,
  265. // 选中数组
  266. ids: [],
  267. // 非单个禁用
  268. single: true,
  269. // 非多个禁用
  270. multiple: true,
  271. // 显示搜索条件
  272. showSearch: true,
  273. // 总条数
  274. total: 0,
  275. // 用户表格数据
  276. dataList: null,
  277. // 弹出层标题
  278. title: "",
  279. // 是否显示弹出层
  280. open: false,
  281. // 日期范围
  282. dateRange: [],
  283. // 查询参数
  284. queryParams: {
  285. pageNum: 1,
  286. pageSize: 10,
  287. type: undefined
  288. },
  289. statusList: [
  290. {id: 1, name: '未发布', value: 0},
  291. {id: 2, name: '发布', value: 1},
  292. {id: 3, name: '下架', value: 2},
  293. ],
  294. visibleStatus: false,
  295. newObj: {},
  296. visibleType: ''
  297. };
  298. },
  299. computed: {
  300. ...mapGetters([
  301. 'name',
  302. ]),
  303. },
  304. created() {
  305. this.getList();
  306. },
  307. methods: {
  308. /** 查询列表 */
  309. getList() {
  310. this.loading = true;
  311. this.dataList = []
  312. pageList(this.addDateRange(this.queryParams, this.dateRange))
  313. .then(response => {
  314. this.dataList = response.data.rows;
  315. this.dataList.forEach(item =>{
  316. item.switchValue = item.status;
  317. })
  318. this.total = response.data.total;
  319. this.loading = false;
  320. }
  321. ).catch(()=>{
  322. this.dataList = []
  323. this.total = 0
  324. this.loading = false;
  325. })
  326. },
  327. // 取消按钮
  328. cancel() {
  329. this.open = false;
  330. },
  331. /** 搜索按钮操作 */
  332. handleQuery() {
  333. this.queryParams.pageNum = 1;
  334. this.getList();
  335. },
  336. /** 重置按钮操作 */
  337. resetQuery() {
  338. this.dateRange = [];
  339. this.$set(this.queryParams, 'name', '');
  340. this.$set(this.queryParams, 'type', '');
  341. this.$set(this.queryParams, 'salerPerson', '');
  342. this.$set(this.queryParams, 'createBy', '');
  343. this.queryParams.pageNum = 1;
  344. this.handleQuery();
  345. },
  346. /** 新增按钮操作 */
  347. handleAdd() {
  348. this.$refs["addAndEdit"].openDialog("新增数据", null);
  349. },
  350. /** 修改按钮操作 */
  351. handleUpdate(row) {
  352. this.$refs["addAndEdit"].openDialog("修改数据", row);
  353. },
  354. /** 详情 或 审核 */
  355. handleAudit(row,type) {
  356. this.$refs["auditBox"].openDialog("审核数据", row, type);
  357. },
  358. /** 启用或者禁用按钮操作 */
  359. updateStatusApi(row) {
  360. this.$confirm("是否对团队名称为" + row.name + "的数据进行" + (row.status == 1 ? '禁用?' : '启用?'), '提示', {
  361. confirmButtonText: '确定',
  362. cancelButtonText: '取消',
  363. type: 'warning'
  364. }).then(() => {
  365. updateStatus({ id: row.id, status: row.status == 1 ? 0 : 1 }).then((res) => {
  366. if (res.code == 200) {
  367. this.$message({
  368. type: 'success',
  369. message: '操作成功!'
  370. });
  371. this.getList();
  372. }
  373. });
  374. }).catch(() => {});
  375. },
  376. /** 重置密码按钮操作 */
  377. resettingApi(row) {
  378. this.$confirm("是否对团队名称为" + row.name + "的数据进行密码重置?重置后的密码为123456!", '提示', {
  379. confirmButtonText: '确定',
  380. cancelButtonText: '取消',
  381. type: 'warning'
  382. }).then(() => {
  383. updateStatus({ id: row.id, password: '123456' }).then((res) => {
  384. if (res.code == 200) {
  385. this.$message({
  386. type: 'success',
  387. message: '操作成功!'
  388. });
  389. this.getList();
  390. }
  391. });
  392. }).catch(() => {});
  393. },
  394. /** 删除按钮操作 */
  395. handleDelete(row) {
  396. this.$modal.confirm('是否确认删除数据团队名称为"' + row.name + '"的数据项?').then(function() {
  397. return deleteById(row.id);
  398. }).then(() => {
  399. this.getList();
  400. this.$modal.msgSuccess("删除成功");
  401. }).catch(() => {});
  402. },
  403. /** 查看按钮操作 */
  404. seeCenter(obj, type) {
  405. this.visibleStatus = true
  406. this.visibleType = type;
  407. this.newObj = obj;
  408. if(obj.contractImg){
  409. this.newObj.contractImgList = obj.contractImg.split(',')
  410. }
  411. },
  412. // 更多操作触发
  413. handleCommand(command, row,index) {
  414. switch (command) {
  415. case "handleResetPwd": // 重置密码
  416. this.resettingApi(row);
  417. break;
  418. case "rechargeBox":
  419. this.rechargeBoxFun(row);
  420. break;
  421. case "creditGranting":
  422. this.creditGrantingFun(row);
  423. break;
  424. case "creditGrantingBox":
  425. this.creditGrantingBoxFun(row);
  426. break;
  427. case "orderAll":
  428. this.orderAllBoxFun(row);
  429. break;
  430. default:
  431. break;
  432. }
  433. },
  434. creditGrantingFun(row) {
  435. this.$refs["creditGranting"].openDialog("账户授信额度", row);
  436. },
  437. rechargeBoxFun(row) {
  438. this.$refs["rechargeBox"].openDialog("账户储值余额充值", row);
  439. },
  440. creditGrantingBoxFun(row) {
  441. this.$refs["creditGrantingBox"].openDialog("账户授信欠款", row);
  442. },
  443. orderAllBoxFun(row) {
  444. this.$refs["orderAllBox"].openDialog("查看团购订单", row);
  445. },
  446. }
  447. };
  448. </script>