index.vue 16 KB

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