index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="公司名" prop="companyId">
  5. <select-tree
  6. v-model="selectedCompanyList"
  7. :raw-data="deptList"
  8. placeholder="请选择销售"
  9. :parentSelectable="true"
  10. :multiple="true"
  11. component-width="300px"
  12. :max-display-tags="3"
  13. :check-strictly="false"
  14. :return-leaf-only="false"
  15. ></select-tree>
  16. </el-form-item>
  17. <el-form-item label="员工" prop="companyUserName">
  18. <el-input
  19. v-model="queryParams.companyUserName"
  20. placeholder="员工"
  21. clearable
  22. size="small"
  23. @keyup.enter.native="handleQuery"
  24. />
  25. </el-form-item>
  26. <el-form-item label="用户ID" prop="userId">
  27. <el-input
  28. v-model="queryParams.userId"
  29. placeholder="请输入用户ID"
  30. clearable
  31. size="small"
  32. @keyup.enter.native="handleQuery"
  33. />
  34. </el-form-item>
  35. <el-form-item label="用户昵称" prop="nickName">
  36. <el-input
  37. v-model="queryParams.nickName"
  38. placeholder="请输入用户昵称"
  39. clearable
  40. size="small"
  41. @keyup.enter.native="handleQuery"
  42. />
  43. </el-form-item>
  44. <el-form-item label="电话" prop="phone">
  45. <el-input
  46. v-model="queryParams.phone"
  47. placeholder="请输入电话"
  48. clearable
  49. size="small"
  50. @keyup.enter.native="handleQuery"
  51. />
  52. </el-form-item>
  53. <el-form-item label="加密电话" prop="phoneMk">
  54. <el-input
  55. v-model="queryParams.phoneMk"
  56. placeholder="请输入电话"
  57. clearable
  58. size="small"
  59. @keyup.enter.native="handleQuery"
  60. />
  61. </el-form-item>
  62. <el-form-item label="营期" prop="courseId">
  63. <el-select
  64. v-model="queryParams.periodId"
  65. placeholder="请选择课程"
  66. filterable
  67. clearable
  68. size="small"
  69. remote
  70. :remote-method="remoteMethod"
  71. :loading="loadingPeriod"
  72. @focus="handleFocus"
  73. >
  74. <el-option
  75. v-for="dict in periodLists"
  76. :key="dict.periodId"
  77. :label="dict.periodName"
  78. :value="parseInt(dict.periodId)"
  79. />
  80. </el-select>
  81. </el-form-item>
  82. <el-form-item label="课程" prop="courseId">
  83. <el-select filterable v-model="queryParams.courseId" placeholder="请选择课程" clearable size="small" @change="courseChange(queryParams.courseId)">
  84. <el-option
  85. v-for="dict in courseLists"
  86. :key="dict.dictValue"
  87. :label="dict.dictLabel"
  88. :value="parseInt(dict.dictValue)"
  89. />
  90. </el-select>
  91. </el-form-item>
  92. <el-form-item label="小节" prop="videoId">
  93. <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small">
  94. <el-option
  95. v-for="dict in videoList"
  96. :key="dict.dictValue"
  97. :label="dict.dictLabel"
  98. :value="parseInt(dict.dictValue)"
  99. />
  100. </el-select>
  101. </el-form-item>
  102. <el-form-item label="创建时间" prop="createTime">
  103. <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange"
  104. range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="change"></el-date-picker>
  105. </el-form-item>
  106. <el-form-item>
  107. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  108. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  109. </el-form-item>
  110. </el-form>
  111. <el-row :gutter="10" class="mb8">
  112. <el-col :span="1.5">
  113. <el-button
  114. type="warning"
  115. plain
  116. icon="el-icon-download"
  117. size="mini"
  118. :loading="exportLoading"
  119. @click="handleExport"
  120. v-hasPermi="['course:courseRedPacketLog:export']"
  121. >导出</el-button>
  122. </el-col>
  123. <el-col :span="1.5">
  124. <el-button
  125. type="warning"
  126. plain
  127. icon="el-icon-download"
  128. size="mini"
  129. :loading="exportLoading"
  130. @click="handleRetry"
  131. >重新发送</el-button>
  132. </el-col>
  133. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  134. </el-row>
  135. <el-tabs type="card" v-model="activeName" @tab-click="handleClick">
  136. <el-tab-pane label="全部订单" name="00"></el-tab-pane>
  137. <el-tab-pane label="待发送" name="0"></el-tab-pane>
  138. <el-tab-pane label="已发送" name="1"></el-tab-pane>
  139. <el-tab-pane label="待补发" name="2"></el-tab-pane>
  140. </el-tabs>
  141. <el-table border v-loading="loading" :data="courseRedPacketLogList" @selection-change="handleSelectionChange">
  142. <el-table-column type="selection" width="55" align="center" />
  143. <el-table-column label="记录编号" align="center" prop="logId" />
  144. <el-table-column label="批次单号" align="center" prop="outBatchNo" />
  145. <el-table-column label="营期名称" align="center" prop="periodName" />
  146. <el-table-column label="课程名称" align="center" prop="courseName" />
  147. <el-table-column label="小节名称" align="center" prop="title" />
  148. <el-table-column label="会员id" align="center" prop="userId" />
  149. <el-table-column label="会员昵称" align="center" prop="fsNickName">
  150. <template slot-scope="scope">
  151. <div style="display: flex;white-space: nowrap">
  152. <div style="margin: auto">
  153. {{scope.row.fsNickName}}
  154. </div>
  155. <el-popover
  156. placement="right"
  157. title=""
  158. trigger="hover">
  159. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  160. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  161. </el-popover>
  162. </div>
  163. </template>
  164. </el-table-column>
  165. <el-table-column label="会员电话" align="center" prop="phone" />
  166. <el-table-column label="所属销售" align="center" prop="companyUserName" />
  167. <el-table-column label="所属公司" align="center" prop="companyName" />
  168. <el-table-column label="企微员工名称" align="center" prop="qwUserName" />
  169. <el-table-column label="转账金额" align="center" prop="amount" />
  170. <el-table-column label="状态" align="center" prop="status" >
  171. <template slot-scope="scope">
  172. <el-tag>{{ scope.row.status === 0 ? "发送中" : scope.row.status === 1 ? "已完成" : "待补发" }}</el-tag>
  173. </template>
  174. </el-table-column>
  175. <el-table-column label="企微账号" align="center" prop="qwUserName" />
  176. <el-table-column label="创建时间" align="center" prop="createTime" />
  177. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  178. <template slot-scope="scope">
  179. <el-button v-if="scope.row.status==2"
  180. size="mini"
  181. type="text"
  182. @click="handleRetry(scope.row)"
  183. >重新发送</el-button>
  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. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  196. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  197. <el-form-item label="课程id" prop="courseId">
  198. <el-input v-model="form.courseId" placeholder="请输入课程id" />
  199. </el-form-item>
  200. <el-form-item label="会员id" prop="userId">
  201. <el-input v-model="form.userId" placeholder="请输入会员id" />
  202. </el-form-item>
  203. <el-form-item label="小节id" prop="videoId">
  204. <el-input v-model="form.videoId" placeholder="请输入小节id" />
  205. </el-form-item>
  206. <el-form-item label="公司员工id" prop="companyUserId">
  207. <el-input v-model="form.companyUserId" placeholder="请输入公司员工id" />
  208. </el-form-item>
  209. <el-form-item label="公司id" prop="companyId">
  210. <el-input v-model="form.companyId" placeholder="请输入公司id" />
  211. </el-form-item>
  212. <el-form-item label="转账金额" prop="amount">
  213. <el-input v-model="form.amount" placeholder="请输入转账金额" />
  214. </el-form-item>
  215. <el-form-item label="企微userid" prop="qwUserId">
  216. <el-input v-model="form.qwUserId" placeholder="请输入分享企微userid" />
  217. </el-form-item>
  218. </el-form>
  219. <div slot="footer" class="dialog-footer">
  220. <el-button type="primary" @click="submitForm">确 定</el-button>
  221. <el-button @click="cancel">取 消</el-button>
  222. </div>
  223. </el-dialog>
  224. </div>
  225. </template>
  226. <script>
  227. import { courseList,videoList,listCourseRedPacketLog,retryCourseRedPacketLog, myListCourseRedPacketLogNew, getCourseRedPacketLog, delCourseRedPacketLog, addCourseRedPacketLog, updateCourseRedPacketLog, exportCourseRedPacketLog } from "@/api/course/courseRedPacketLog";
  228. import { getCompanyList } from "@/api/company/company";
  229. import { periodList } from "@/api/course/userCoursePeriod";
  230. import SelectTree from '@/components/TreeSelect/index.vue'
  231. import { getDeptData } from '@/api/system/employeeStats'
  232. export default {
  233. name: "CourseRedPacketLog",
  234. components: {SelectTree},
  235. data() {
  236. return {
  237. companys:[],
  238. deptOptions:[],
  239. // 遮罩层
  240. loading: true,
  241. loadingPeriod: false,
  242. // 导出遮罩层
  243. exportLoading: false,
  244. // 选中数组
  245. ids: [],
  246. // 非单个禁用
  247. single: true,
  248. // 非多个禁用
  249. multiple: true,
  250. // 显示搜索条件
  251. showSearch: true,
  252. activeName:"00",
  253. courseLists:[],
  254. periodLists:[],
  255. videoList:[],
  256. // 总条数
  257. total: 0,
  258. // 短链课程看课记录表格数据
  259. courseRedPacketLogList: [],
  260. // 弹出层标题
  261. title: "",
  262. // 是否显示弹出层
  263. open: false,
  264. selectedCompanyList: [],
  265. deptList: [],
  266. // 查询参数
  267. queryParams: {
  268. pageNum: 1,
  269. pageSize: 10,
  270. courseId: null,
  271. periodId: null,
  272. userId: null,
  273. nickName:null,
  274. videoId: null,
  275. companyUserId: null,
  276. companyId: null,
  277. amount: null,
  278. qwUserId: null,
  279. subCateId: null,
  280. phone: null,
  281. phoneMk: null,
  282. sTime:null,
  283. eTime:null,
  284. },
  285. queryPeriod: {
  286. pageNum: 1,
  287. pageSize: 20
  288. },
  289. createTime:null,
  290. // 表单参数
  291. form: {},
  292. // 表单校验
  293. rules: {
  294. }
  295. };
  296. },
  297. created() {
  298. this.getList();
  299. getCompanyList().then(response => {
  300. this.companys = response.data;
  301. });
  302. courseList().then(response => {
  303. this.courseLists = response.list;
  304. });
  305. getDeptData().then(response => {
  306. this.deptList = response.data;
  307. })
  308. periodList(this.queryPeriod).then(response => {
  309. this.periodLists = response.data;
  310. });
  311. },
  312. methods: {
  313. // 远程搜索方法
  314. async remoteMethod(query) {
  315. this.searchKeyword = query
  316. if (query !== '') {
  317. this.loadingPeriod = true
  318. await this.getPeriodList(query)
  319. this.loadingPeriod = false
  320. } else {
  321. // 如果输入为空,可以清空列表或加载默认数据
  322. this.periodLists = []
  323. }
  324. },
  325. // 获取营期列表
  326. async getPeriodList(keyword = '') {
  327. try {
  328. const params = {
  329. periodName: keyword, // 搜索关键词
  330. pageNum: 1,
  331. pageSize: 50 // 根据需求调整
  332. }
  333. const response = await periodList(params)
  334. this.periodLists = response.data.list || response.data || []
  335. } catch (error) {
  336. console.error('获取营期列表失败:', error)
  337. this.periodLists = []
  338. }
  339. },
  340. // 下拉框获取焦点时加载数据
  341. async handleFocus() {
  342. if (this.periodLists.length === 0) {
  343. this.getPeriodList();
  344. }
  345. },
  346. handleClick(tab, event) {
  347. this.activeName=tab.name;
  348. this.queryParams.status=tab.name
  349. console.log(this.queryParams.status)
  350. this.getList();
  351. },
  352. /** 查询短链课程看课记录列表 */
  353. getList() {
  354. if(this.selectedCompanyList != null && this.selectedCompanyList.length > 0) {
  355. this.queryParams.userIds = this.selectedCompanyList;
  356. }else {
  357. this.queryParams.userIds = [];
  358. }
  359. this.loading = true;
  360. listCourseRedPacketLog(this.queryParams).then(response => {
  361. this.courseRedPacketLogList = response.rows;
  362. this.total = response.total;
  363. this.loading = false;
  364. });
  365. },
  366. change(){
  367. if(this.createTime!=null){
  368. this.queryParams.sTime=this.createTime[0];
  369. this.queryParams.eTime=this.createTime[1];
  370. }else{
  371. this.queryParams.sTime=null;
  372. this.queryParams.eTime=null;
  373. }
  374. },
  375. courseChange(row){
  376. if(row==""){
  377. this.videoList=[]
  378. this.queryParams.videoId=null
  379. }else{
  380. videoList(row).then(response => {
  381. this.videoList=response.list
  382. });
  383. }
  384. },
  385. // 取消按钮
  386. cancel() {
  387. this.open = false;
  388. this.reset();
  389. },
  390. // 表单重置
  391. reset() {
  392. this.form = {
  393. logId: null,
  394. courseId: null,
  395. periodId: null,
  396. userId: null,
  397. videoId: null,
  398. companyUserId: null,
  399. companyId: null,
  400. amount: null,
  401. createTime: null,
  402. qwUserId: null
  403. };
  404. this.resetForm("form");
  405. },
  406. /** 搜索按钮操作 */
  407. handleQuery() {
  408. this.queryParams.pageNum = 1;
  409. this.getList();
  410. },
  411. /** 重置按钮操作 */
  412. resetQuery() {
  413. this.resetForm("queryForm");
  414. this.createTime=null;
  415. this.queryParams.sTime=null;
  416. this.queryParams.eTime=null;
  417. this.queryParams.periodId=null;
  418. this.selectedCompanyList = [];
  419. this.handleQuery();
  420. },
  421. // 多选框选中数据
  422. handleSelectionChange(selection) {
  423. this.ids = selection.map(item => item.logId)
  424. this.single = selection.length!==1
  425. this.multiple = !selection.length
  426. },
  427. /** 新增按钮操作 */
  428. handleAdd() {
  429. this.reset();
  430. this.open = true;
  431. this.title = "添加短链课程看课记录";
  432. },
  433. /** 修改按钮操作 */
  434. handleUpdate(row) {
  435. this.reset();
  436. const logId = row.logId || this.ids
  437. getCourseRedPacketLog(logId).then(response => {
  438. this.form = response.data;
  439. this.open = true;
  440. this.title = "修改短链课程看课记录";
  441. });
  442. },
  443. /** 提交按钮 */
  444. submitForm() {
  445. this.$refs["form"].validate(valid => {
  446. if (valid) {
  447. if (this.form.logId != null) {
  448. updateCourseRedPacketLog(this.form).then(response => {
  449. this.msgSuccess("修改成功");
  450. this.open = false;
  451. this.getList();
  452. });
  453. } else {
  454. addCourseRedPacketLog(this.form).then(response => {
  455. this.msgSuccess("新增成功");
  456. this.open = false;
  457. this.getList();
  458. });
  459. }
  460. }
  461. });
  462. },
  463. /** 删除按钮操作 */
  464. handleRetry(row) {
  465. const logIds = row.logId || this.ids;
  466. this.$confirm('是否确认重新发送红包?', "警告", {
  467. confirmButtonText: "确定",
  468. cancelButtonText: "取消",
  469. type: "warning"
  470. }).then(function() {
  471. return retryCourseRedPacketLog(logIds);
  472. }).then((response) => {
  473. this.getList();
  474. this.msgSuccess(response.msg); // Fallback message
  475. }).catch(() => {});
  476. },
  477. getSubCateList(pid){
  478. this.form.subCateId=null;
  479. if(pid == ''){
  480. this.subCategoryOptions=[];
  481. return
  482. }
  483. getCateListByPid(pid).then(response => {
  484. this.subCategoryOptions = response.data;
  485. });
  486. },
  487. /** 导出按钮操作 */
  488. handleExport() {
  489. if(this.selectedCompanyList != null && this.selectedCompanyList.length > 0) {
  490. this.queryParams.userIds = this.selectedCompanyList;
  491. }else {
  492. this.queryParams.userIds = [];
  493. }
  494. const queryParams = this.queryParams;
  495. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  496. confirmButtonText: "确定",
  497. cancelButtonText: "取消",
  498. type: "warning"
  499. }).then(() => {
  500. this.exportLoading = true;
  501. return exportCourseRedPacketLog(queryParams);
  502. }).then(response => {
  503. this.download(response.msg);
  504. this.exportLoading = false;
  505. }).catch(() => {});
  506. }
  507. }
  508. };
  509. </script>