index.vue 15 KB

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