index.vue 12 KB

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