index.vue 14 KB

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