myCourseRedPacketLog.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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="qwUserId">
  5. <el-select v-model="queryParams.qwUserId" placeholder="企微账号" size="small" @change="updateQwuser()">
  6. <el-option
  7. v-for="dict in myQwUserList"
  8. :key="dict.dictValue"
  9. :label="dict.dictLabel + '('+dict.corpName+')'"
  10. :value="dict.dictValue"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="会员ID" prop="userId">
  15. <el-input
  16. v-model="queryParams.userId"
  17. placeholder="请输入会员ID"
  18. clearable
  19. size="small"
  20. @keyup.enter.native="handleQuery"
  21. />
  22. </el-form-item>
  23. <el-form-item label="会员昵称" prop="nickName">
  24. <el-input
  25. v-model="queryParams.nickName"
  26. placeholder="请输入会员昵称"
  27. clearable
  28. size="small"
  29. @keyup.enter.native="handleQuery"
  30. />
  31. </el-form-item>
  32. <el-form-item label="电话" prop="phone">
  33. <el-input
  34. v-model="queryParams.phone"
  35. placeholder="请输入电话"
  36. clearable
  37. size="small"
  38. @keyup.enter.native="handleQuery"
  39. />
  40. </el-form-item>
  41. <el-form-item label="加密电话" prop="phoneMk">
  42. <el-input
  43. v-model="queryParams.phoneMk"
  44. placeholder="请输入电话"
  45. clearable
  46. size="small"
  47. @keyup.enter.native="handleQuery"
  48. />
  49. </el-form-item>
  50. <el-form-item label="课程" prop="courseId">
  51. <el-select filterable v-model="queryParams.courseId" placeholder="请选择课程" clearable size="small" @change="courseChange(queryParams.courseId)">
  52. <el-option
  53. v-for="dict in courseLists"
  54. :key="dict.dictValue"
  55. :label="dict.dictLabel"
  56. :value="parseInt(dict.dictValue)"
  57. />
  58. </el-select>
  59. </el-form-item>
  60. <el-form-item label="小节" prop="videoId">
  61. <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small">
  62. <el-option
  63. v-for="dict in videoList"
  64. :key="dict.dictValue"
  65. :label="dict.dictLabel"
  66. :value="parseInt(dict.dictValue)"
  67. />
  68. </el-select>
  69. </el-form-item>
  70. <el-form-item label="创建时间" prop="createTime">
  71. <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange"
  72. range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="change"></el-date-picker>
  73. </el-form-item>
  74. <el-form-item>
  75. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  76. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  77. </el-form-item>
  78. </el-form>
  79. <el-row :gutter="10" class="mb8">
  80. <el-col :span="1.5">
  81. <el-button
  82. type="warning"
  83. plain
  84. icon="el-icon-download"
  85. size="mini"
  86. :loading="exportLoading"
  87. @click="handleExport"
  88. v-hasPermi="['course:courseRedPacketLog:myExport']"
  89. >导出</el-button>
  90. </el-col>
  91. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  92. </el-row>
  93. <el-tabs type="card" v-model="activeName" @tab-click="handleClick">
  94. <el-tab-pane label="全部订单" name="00"></el-tab-pane>
  95. <el-tab-pane label="待发送" name="0"></el-tab-pane>
  96. <el-tab-pane label="已发送" name="1"></el-tab-pane>
  97. <el-tab-pane label="待补发" name="2"></el-tab-pane>
  98. </el-tabs>
  99. <el-table border v-loading="loading" :data="courseRedPacketLogList" @selection-change="handleSelectionChange">
  100. <el-table-column type="selection" width="55" align="center" />
  101. <el-table-column label="记录编号" align="center" prop="logId" />
  102. <el-table-column label="批次单号" align="center" prop="outBatchNo" />
  103. <el-table-column label="课程名称" align="center" prop="courseName" />
  104. <el-table-column label="小节名称" align="center" prop="title" />
  105. <el-table-column label="会员id" align="center" prop="userId" />
  106. <el-table-column label="会员昵称" align="center" prop="fsNickName">
  107. <template slot-scope="scope">
  108. <div style="display: flex;white-space: nowrap">
  109. <div style="margin: auto">
  110. {{scope.row.fsNickName}}
  111. </div>
  112. <el-popover
  113. placement="right"
  114. title=""
  115. trigger="hover">
  116. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  117. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  118. </el-popover>
  119. </div>
  120. </template>
  121. </el-table-column>
  122. <el-table-column label="会员电话" align="center" prop="phone" />
  123. <el-table-column label="所属销售" align="center" prop="companyUserName" />
  124. <el-table-column label="所属公司" align="center" prop="companyName" />
  125. <el-table-column label="转账金额" align="center" prop="amount" />
  126. <el-table-column label="状态" align="center" prop="status" >
  127. <template slot-scope="scope">
  128. <el-tag>{{ scope.row.status === 0 ? "发送中" : scope.row.status === 1 ? "已完成" : "待补发" }}</el-tag>
  129. </template>
  130. </el-table-column>
  131. <el-table-column label="企微员工名称" align="center" prop="qwUserName" />
  132. <el-table-column label="创建时间" align="center" prop="createTime" />
  133. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  134. <template slot-scope="scope">
  135. <el-button v-if="scope.row.status==2"
  136. size="mini"
  137. type="text"
  138. @click="handleRetry(scope.row)"
  139. >重新发送</el-button>
  140. </template>
  141. </el-table-column>
  142. </el-table>
  143. <pagination
  144. v-show="total>0"
  145. :total="total"
  146. :page.sync="queryParams.pageNum"
  147. :limit.sync="queryParams.pageSize"
  148. @pagination="getList"
  149. />
  150. <!-- 添加或修改短链课程看课记录对话框 -->
  151. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  152. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  153. <el-form-item label="课程id" prop="courseId">
  154. <el-input v-model="form.courseId" placeholder="请输入课程id" />
  155. </el-form-item>
  156. <el-form-item label="用户id" prop="userId">
  157. <el-input v-model="form.userId" placeholder="请输入用户id" />
  158. </el-form-item>
  159. <el-form-item label="小节id" prop="videoId">
  160. <el-input v-model="form.videoId" placeholder="请输入小节id" />
  161. </el-form-item>
  162. <el-form-item label="公司员工id" prop="companyUserId">
  163. <el-input v-model="form.companyUserId" placeholder="请输入公司员工id" />
  164. </el-form-item>
  165. <el-form-item label="公司id" prop="companyId">
  166. <el-input v-model="form.companyId" placeholder="请输入公司id" />
  167. </el-form-item>
  168. <el-form-item label="转账金额" prop="amount">
  169. <el-input v-model="form.amount" placeholder="请输入转账金额" />
  170. </el-form-item>
  171. <el-form-item label="企微userid" prop="qwUserId">
  172. <el-input v-model="form.qwUserId" placeholder="请输入分享企微userid" />
  173. </el-form-item>
  174. </el-form>
  175. <div slot="footer" class="dialog-footer">
  176. <el-button type="primary" @click="submitForm">确 定</el-button>
  177. <el-button @click="cancel">取 消</el-button>
  178. </div>
  179. </el-dialog>
  180. </div>
  181. </template>
  182. <script>
  183. import { courseList,videoList,myListCourseRedPacketLog, getCourseRedPacketLog, delCourseRedPacketLog, addCourseRedPacketLog, updateCourseRedPacketLog, exportCourseRedPacketLog } from "@/api/course/courseRedPacketLog";
  184. import {getMyQwUserList} from "@/api/qw/user";
  185. export default {
  186. name: "CourseRedPacketLog",
  187. data() {
  188. return {
  189. deptOptions:[],
  190. // 遮罩层
  191. loading: false,
  192. // 导出遮罩层
  193. exportLoading: false,
  194. // 选中数组
  195. ids: [],
  196. // 非单个禁用
  197. single: true,
  198. // 非多个禁用
  199. multiple: true,
  200. // 显示搜索条件
  201. showSearch: true,
  202. activeName:"00",
  203. myQwUserList:[],
  204. courseLists:[],
  205. videoList:[],
  206. // 总条数
  207. total: 0,
  208. // 短链课程看课记录表格数据
  209. courseRedPacketLogList: [],
  210. // 弹出层标题
  211. title: "",
  212. // 是否显示弹出层
  213. open: false,
  214. // 查询参数
  215. queryParams: {
  216. pageNum: 1,
  217. pageSize: 10,
  218. courseId: null,
  219. userId: null,
  220. nickName:null,
  221. videoId: null,
  222. companyUserId: null,
  223. companyId: null,
  224. amount: null,
  225. qwUserId: null,
  226. subCateId: null,
  227. phone: null,
  228. phoneMk: null,
  229. sTime:null,
  230. eTime:null,
  231. },
  232. createTime:null,
  233. // 表单参数
  234. form: {},
  235. // 表单校验
  236. rules: {
  237. }
  238. };
  239. },
  240. created() {
  241. this.getList();
  242. courseList().then(response => {
  243. this.courseLists = response.list;
  244. });
  245. getMyQwUserList().then(response => {
  246. this.myQwUserList = response.data;
  247. if(this.myQwUserList!=null){
  248. this.queryParams.qwUserId=this.myQwUserList[0].dictValue
  249. this.queryParams.corpId=this.myQwUserList[0].corpId
  250. this.getList();
  251. }
  252. });
  253. },
  254. methods: {
  255. handleClick(tab, event) {
  256. this.activeName=tab.name;
  257. this.queryParams.status=tab.name
  258. console.log(this.queryParams.status)
  259. this.getList();
  260. },
  261. /** 查询短链课程看课记录列表 */
  262. getList() {
  263. this.loading = true;
  264. myListCourseRedPacketLog(this.queryParams).then(response => {
  265. this.courseRedPacketLogList = response.rows;
  266. this.total = response.total;
  267. this.loading = false;
  268. });
  269. },
  270. updateQwuser(){
  271. for (const user of this.myQwUserList) {
  272. if (user.dictValue == this.queryParams.qwUserId) {
  273. this.queryParams.corpId=user.corpId;
  274. break;
  275. }
  276. }
  277. this.getList();
  278. },
  279. change(){
  280. if(this.createTime!=null){
  281. this.queryParams.sTime=this.createTime[0];
  282. this.queryParams.eTime=this.createTime[1];
  283. }else{
  284. this.queryParams.sTime=null;
  285. this.queryParams.eTime=null;
  286. }
  287. },
  288. courseChange(row){
  289. if(row==""){
  290. this.videoList=[]
  291. this.queryParams.videoId=null
  292. }else{
  293. videoList(row).then(response => {
  294. this.videoList=response.list
  295. });
  296. }
  297. },
  298. // 取消按钮
  299. cancel() {
  300. this.open = false;
  301. this.reset();
  302. },
  303. // 表单重置
  304. reset() {
  305. this.form = {
  306. logId: null,
  307. courseId: null,
  308. userId: null,
  309. videoId: null,
  310. companyUserId: null,
  311. companyId: null,
  312. amount: null,
  313. createTime: null,
  314. qwUserId: null
  315. };
  316. this.resetForm("form");
  317. },
  318. /** 搜索按钮操作 */
  319. handleQuery() {
  320. this.queryParams.pageNum = 1;
  321. this.getList();
  322. },
  323. /** 重置按钮操作 */
  324. resetQuery() {
  325. this.resetForm("queryForm");
  326. this.queryParams.qwUserId=this.myQwUserList[0].dictValue;
  327. this.queryParams.corpId=this.myQwUserList[0].corpId;
  328. this.createTime=null;
  329. this.queryParams.sTime=null;
  330. this.queryParams.eTime=null;
  331. this.handleQuery();
  332. },
  333. // 多选框选中数据
  334. handleSelectionChange(selection) {
  335. this.ids = selection.map(item => item.logId)
  336. this.single = selection.length!==1
  337. this.multiple = !selection.length
  338. },
  339. /** 新增按钮操作 */
  340. handleAdd() {
  341. this.reset();
  342. this.open = true;
  343. this.title = "添加短链课程看课记录";
  344. },
  345. /** 修改按钮操作 */
  346. handleUpdate(row) {
  347. this.reset();
  348. const logId = row.logId || this.ids
  349. getCourseRedPacketLog(logId).then(response => {
  350. this.form = response.data;
  351. this.open = true;
  352. this.title = "修改短链课程看课记录";
  353. });
  354. },
  355. /** 提交按钮 */
  356. submitForm() {
  357. this.$refs["form"].validate(valid => {
  358. if (valid) {
  359. if (this.form.logId != null) {
  360. updateCourseRedPacketLog(this.form).then(response => {
  361. this.msgSuccess("修改成功");
  362. this.open = false;
  363. this.getList();
  364. });
  365. } else {
  366. addCourseRedPacketLog(this.form).then(response => {
  367. this.msgSuccess("新增成功");
  368. this.open = false;
  369. this.getList();
  370. });
  371. }
  372. }
  373. });
  374. },
  375. handleRetry(row) {
  376. const logIds = row.logId || this.ids;
  377. this.$confirm('是否确认重新发送红包?', "警告", {
  378. confirmButtonText: "确定",
  379. cancelButtonText: "取消",
  380. type: "warning"
  381. }).then(function() {
  382. return retryCourseRedPacketLog(logIds);
  383. }).then((response) => {
  384. this.getList();
  385. this.msgSuccess(response.msg); // Fallback message
  386. }).catch(() => {});
  387. },
  388. getSubCateList(pid){
  389. this.form.subCateId=null;
  390. if(pid == ''){
  391. this.subCategoryOptions=[];
  392. return
  393. }
  394. getCateListByPid(pid).then(response => {
  395. this.subCategoryOptions = response.data;
  396. });
  397. },
  398. /** 导出按钮操作 */
  399. handleExport() {
  400. const queryParams = this.queryParams;
  401. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  402. confirmButtonText: "确定",
  403. cancelButtonText: "取消",
  404. type: "warning"
  405. }).then(() => {
  406. this.exportLoading = true;
  407. return exportCourseRedPacketLog(queryParams);
  408. }).then(response => {
  409. this.download(response.msg);
  410. this.exportLoading = false;
  411. }).catch(() => {});
  412. }
  413. }
  414. };
  415. </script>