index.vue 14 KB

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