index.vue 13 KB

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