index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  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 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-if="scope.row.checkStatus == 1"
  158. v-hasPermi="['teamMr:teamMr:resetting']">重置密码</el-dropdown-item>
  159. <el-dropdown-item command="rechargeBox" icon="el-icon-key"
  160. v-if="scope.row.checkStatus == 1 && name!=scope.row.createBy && scope.row.checkStatus == 1"
  161. v-hasPermi="['teamMr:teamMr:rechargeBox']"
  162. >账户充值</el-dropdown-item>
  163. <el-dropdown-item command="creditGranting" icon="el-icon-circle-check"
  164. v-if="scope.row.checkStatus == 1 && name!=scope.row.createBy && scope.row.checkStatus == 1"
  165. v-hasPermi="['teamMr:teamMr:creditGranting']"
  166. >账户授信额度</el-dropdown-item>
  167. <el-dropdown-item command="creditGrantingBox" icon="el-icon-circle-check"
  168. v-if="scope.row.checkStatus == 1 && name!=scope.row.createBy && scope.row.checkStatus == 1"
  169. v-hasPermi="['teamMr:teamMr:creditGrantingBox']"
  170. >账户授信欠款</el-dropdown-item>
  171. <el-dropdown-item command="orderAll" icon="el-icon-circle-check"
  172. v-hasPermi="['teamMr:teamMr:orderAll']"
  173. >查看团购订单</el-dropdown-item>
  174. </el-dropdown-menu>
  175. </el-dropdown>
  176. </template>
  177. </el-table-column>
  178. </el-table>
  179. <pagination
  180. v-show="total>0"
  181. :total="total"
  182. :page.sync="queryParams.pageNum"
  183. :limit.sync="queryParams.pageSize"
  184. @pagination="getList"
  185. />
  186. <!-- 新增/编辑弹框 -->
  187. <add-and-edit
  188. ref="addAndEdit"
  189. :dict="dict"
  190. @getList="getList"
  191. />
  192. <!-- 账户充值 -->
  193. <rechargeBox
  194. ref="rechargeBox"
  195. @getList="getList"
  196. />
  197. <!-- 账户授信余额 -->
  198. <creditGranting
  199. ref="creditGranting"
  200. @getList="getList"
  201. />
  202. <!-- 账户授信余额 -->
  203. <creditGrantingBox
  204. ref="creditGrantingBox"
  205. @getList="getList"
  206. />
  207. <!-- 账户授信余额 -->
  208. <orderAllBox
  209. ref="orderAllBox"
  210. @getList="getList"
  211. />
  212. <!-- 详情 / 审核 -->
  213. <auditBox ref="auditBox" :dict="dict" @getList="getList" />
  214. <el-dialog
  215. title="查看"
  216. :visible.sync="visibleStatus"
  217. width="600px"
  218. :destroy-on-close="true"
  219. :close-on-click-modal="false"
  220. >
  221. <div v-if="visibleType == 'img'">
  222. <el-image
  223. style="width: 400px; height: 100%"
  224. v-for="(item, index) in newObj.contractImgList"
  225. :key="index"
  226. :src="item"
  227. fit="cover"
  228. />
  229. </div>
  230. <div v-if="visibleType == 'html'">
  231. <div v-html="newObj.centent"></div>
  232. </div>
  233. <div slot="footer" class="dialog-footer">
  234. <el-button type="primary" @click="visibleStatus = false">确 定</el-button>
  235. </div>
  236. </el-dialog>
  237. </div>
  238. </template>
  239. <script>
  240. import { pageList, deleteById, updateStatus } from '@/api/team/teamMr'
  241. import addAndEdit from "./dialog/addAndEdit.vue";
  242. import creditGranting from './dialog/creditGranting.vue';
  243. import rechargeBox from './dialog/rechargeBox.vue';
  244. import auditBox from './dialog/auditBox.vue';
  245. import creditGrantingBox from './dialog/creditGrantingBox.vue';
  246. import orderAllBox from './dialog/orderAllBox.vue';
  247. import { mapGetters } from 'vuex'
  248. export default {
  249. name: "agreement",
  250. dicts: ['team_type','order_form_type'],
  251. components: { addAndEdit, creditGranting, rechargeBox, auditBox, creditGrantingBox, orderAllBox },
  252. data() {
  253. return {
  254. // 遮罩层
  255. loading: true,
  256. // 选中数组
  257. ids: [],
  258. // 非单个禁用
  259. single: true,
  260. // 非多个禁用
  261. multiple: true,
  262. // 显示搜索条件
  263. showSearch: true,
  264. // 总条数
  265. total: 0,
  266. // 用户表格数据
  267. dataList: null,
  268. // 弹出层标题
  269. title: "",
  270. // 是否显示弹出层
  271. open: false,
  272. // 日期范围
  273. dateRange: [],
  274. // 查询参数
  275. queryParams: {
  276. pageNum: 1,
  277. pageSize: 10,
  278. type: undefined
  279. },
  280. statusList: [
  281. {id: 1, name: '未发布', value: 0},
  282. {id: 2, name: '发布', value: 1},
  283. {id: 3, name: '下架', value: 2},
  284. ],
  285. visibleStatus: false,
  286. newObj: {},
  287. visibleType: ''
  288. };
  289. },
  290. computed: {
  291. ...mapGetters([
  292. 'name',
  293. ]),
  294. },
  295. created() {
  296. this.getList();
  297. },
  298. methods: {
  299. /** 查询列表 */
  300. getList() {
  301. this.loading = true;
  302. this.dataList = []
  303. pageList(this.addDateRange(this.queryParams, this.dateRange))
  304. .then(response => {
  305. this.dataList = response.data.rows;
  306. this.dataList.forEach(item =>{
  307. item.switchValue = item.status;
  308. })
  309. this.total = response.data.total;
  310. this.loading = false;
  311. }
  312. ).catch(()=>{
  313. this.dataList = []
  314. this.total = 0
  315. this.loading = false;
  316. })
  317. },
  318. // 取消按钮
  319. cancel() {
  320. this.open = false;
  321. },
  322. /** 搜索按钮操作 */
  323. handleQuery() {
  324. this.queryParams.pageNum = 1;
  325. this.getList();
  326. },
  327. /** 重置按钮操作 */
  328. resetQuery() {
  329. this.dateRange = [];
  330. this.$set(this.queryParams, 'name', '');
  331. this.$set(this.queryParams, 'type', '');
  332. this.$set(this.queryParams, 'salerPerson', '');
  333. this.$set(this.queryParams, 'createBy', '');
  334. this.queryParams.pageNum = 1;
  335. this.handleQuery();
  336. },
  337. /** 新增按钮操作 */
  338. handleAdd() {
  339. this.$refs["addAndEdit"].openDialog("新增数据", null);
  340. },
  341. /** 修改按钮操作 */
  342. handleUpdate(row) {
  343. this.$refs["addAndEdit"].openDialog("修改数据", row);
  344. },
  345. /** 详情 或 审核 */
  346. handleAudit(row,type) {
  347. this.$refs["auditBox"].openDialog("审核数据", row, type);
  348. },
  349. /** 启用或者禁用按钮操作 */
  350. updateStatusApi(row) {
  351. this.$confirm("是否对团队名称为" + row.name + "的数据进行" + (row.status == 1 ? '禁用?' : '启用?'), '提示', {
  352. confirmButtonText: '确定',
  353. cancelButtonText: '取消',
  354. type: 'warning'
  355. }).then(() => {
  356. updateStatus({ id: row.id, status: row.status == 1 ? 0 : 1 }).then((res) => {
  357. if (res.code == 200) {
  358. this.$message({
  359. type: 'success',
  360. message: '操作成功!'
  361. });
  362. this.getList();
  363. }
  364. });
  365. }).catch(() => {});
  366. },
  367. /** 重置密码按钮操作 */
  368. resettingApi(row) {
  369. this.$confirm("是否对团队名称为" + row.name + "的数据进行密码重置?重置后的密码为123456!", '提示', {
  370. confirmButtonText: '确定',
  371. cancelButtonText: '取消',
  372. type: 'warning'
  373. }).then(() => {
  374. updateStatus({ id: row.id, password: '123456' }).then((res) => {
  375. if (res.code == 200) {
  376. this.$message({
  377. type: 'success',
  378. message: '操作成功!'
  379. });
  380. this.getList();
  381. }
  382. });
  383. }).catch(() => {});
  384. },
  385. /** 删除按钮操作 */
  386. handleDelete(row) {
  387. this.$modal.confirm('是否确认删除数据团队名称为"' + row.name + '"的数据项?').then(function() {
  388. return deleteById(row.id);
  389. }).then(() => {
  390. this.getList();
  391. this.$modal.msgSuccess("删除成功");
  392. }).catch(() => {});
  393. },
  394. /** 查看按钮操作 */
  395. seeCenter(obj, type) {
  396. this.visibleStatus = true
  397. this.visibleType = type;
  398. this.newObj = obj;
  399. if(obj.contractImg){
  400. this.newObj.contractImgList = obj.contractImg.split(',')
  401. }
  402. },
  403. // 更多操作触发
  404. handleCommand(command, row,index) {
  405. switch (command) {
  406. case "handleResetPwd": // 重置密码
  407. this.resettingApi(row);
  408. break;
  409. case "rechargeBox":
  410. this.rechargeBoxFun(row);
  411. break;
  412. case "creditGranting":
  413. this.creditGrantingFun(row);
  414. break;
  415. case "creditGrantingBox":
  416. this.creditGrantingBoxFun(row);
  417. break;
  418. case "orderAll":
  419. this.orderAllBoxFun(row);
  420. break;
  421. default:
  422. break;
  423. }
  424. },
  425. creditGrantingFun(row) {
  426. this.$refs["creditGranting"].openDialog("账户授信额度", row);
  427. },
  428. rechargeBoxFun(row) {
  429. this.$refs["rechargeBox"].openDialog("账户充值", row);
  430. },
  431. creditGrantingBoxFun(row) {
  432. this.$refs["creditGrantingBox"].openDialog("账户授信欠款", row);
  433. },
  434. orderAllBoxFun(row) {
  435. this.$refs["orderAllBox"].openDialog("查看团购订单", row);
  436. },
  437. }
  438. };
  439. </script>