index.vue 16 KB

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