index.vue 13 KB

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