index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. :inline="true"
  7. v-show="showSearch"
  8. label-width="68px"
  9. >
  10. <!-- <el-form-item label="开始时间" label-width="120px" prop="outTradeNo">
  11. <el-date-picker
  12. format="yyyy-MM-dd HH:mm:ss"
  13. value-format="yyyy-MM-dd HH:mm:ss"
  14. v-model="queryParams.startTime"
  15. type="datetime"
  16. placeholder="默认是当前月份第一天"
  17. >
  18. </el-date-picker>
  19. </el-form-item>
  20. <el-form-item label="结束时间" label-width="120px" prop="outTradeNo">
  21. <el-date-picker
  22. format="yyyy-MM-dd HH:mm:ss"
  23. value-format="yyyy-MM-dd HH:mm:ss"
  24. v-model="queryParams.endTime"
  25. type="datetime"
  26. placeholder="默认是当前月份最后一天"
  27. >
  28. </el-date-picker>
  29. </el-form-item> -->
  30. <!-- <el-form-item label="用户ID" label-width="120px" prop="goodsId">
  31. <el-input
  32. v-model="queryParams.id"
  33. placeholder="用户ID"
  34. clearable
  35. size="small"
  36. @keyup.enter.native="handleQuery"
  37. />
  38. </el-form-item> -->
  39. <!-- <el-form-item label="订单号" label-width="120px" prop="outTradeNo">
  40. <el-input
  41. v-model="queryParams.outTradeNo"
  42. placeholder="订单号"
  43. clearable
  44. size="small"
  45. @keyup.enter.native="handleQuery"
  46. />
  47. </el-form-item> -->
  48. <el-form-item label="设备" label-width="120px" prop="deviceType">
  49. <el-select clearable v-model="queryParams.deviceType" placeholder="">
  50. <el-option label="苹果" :value="1"></el-option>
  51. <el-option label="安卓" :value="2"></el-option>
  52. <el-option label="小程序" :value="3"></el-option>
  53. </el-select>
  54. </el-form-item>
  55. <el-form-item label="类型" label-width="120px" prop="deviceType">
  56. <el-select clearable v-model="queryParams.type" placeholder="">
  57. <el-option label="遇到问题" :value="1"></el-option>
  58. <el-option label="使用建议" :value="2"></el-option>
  59. </el-select>
  60. </el-form-item>
  61. <el-form-item label="关键字" label-width="120px" prop="content">
  62. <el-input
  63. v-model="queryParams.content"
  64. placeholder="请输入名称"
  65. clearable
  66. size="small"
  67. @keyup.enter.native="handleQuery"
  68. />
  69. </el-form-item>
  70. <!-- <el-form-item label="是否分成" label-width="120px" prop="phoneType">
  71. <el-select v-model="queryParams.isShare" placeholder="">
  72. <el-option value="" label="全部"></el-option>
  73. <el-option :value="1" label="是"></el-option>
  74. <el-option :value="0" label="否"></el-option>
  75. </el-select>
  76. </el-form-item> -->
  77. <!-- <el-form-item label="支付状态" label-width="120px" prop="tradeType">
  78. <el-select v-model="queryParams.tradeType">
  79. <el-option value="" key="4" label="全部"></el-option>
  80. <el-option value="1" key="1" label="支付成功">支付成功</el-option>
  81. <el-option value="2" key="2" label="支付失败">支付失败</el-option>
  82. <el-option value="3" key="3" label="已退款"></el-option>
  83. </el-select>
  84. </el-form-item> -->
  85. <!-- <el-form-item label="支付类型" prop="payType">
  86. <el-select v-model="queryParams.payType" placeholder="">
  87. <el-option :value="1" label="微信"></el-option>
  88. <el-option :value="2" label="支付宝"></el-option>
  89. </el-select>
  90. </el-form-item>
  91. <el-form-item label="手机类型" prop="payType">
  92. <el-select v-model="queryParams.payType" placeholder="">
  93. <el-option :value="1" label="苹果"></el-option>
  94. <el-option :value="2" label="安卓"></el-option>
  95. </el-select>
  96. </el-form-item>
  97. <el-form-item label="驾校名称" prop="school">
  98. <el-input v-model="queryParams.school" placeholder="请输入驾校名称" clearable size="small"
  99. @keyup.enter.native="handleQuery" />
  100. </el-form-item>
  101. <el-form-item label="驾校提成" prop="questionId">
  102. <el-input v-model="queryParams.schoolCommission" placeholder="请输入驾校提成" clearable size="small"
  103. @keyup.enter.native="handleQuery" />
  104. </el-form-item>
  105. <el-form-item label="驾校名称" prop="schoolName">
  106. <el-input v-model="queryParams.schoolName" placeholder="请输入驾校名称" clearable size="small"
  107. @keyup.enter.native="handleQuery" />
  108. </el-form-item> -->
  109. <el-form-item>
  110. <el-button
  111. type="cyan"
  112. icon="el-icon-search"
  113. size="mini"
  114. @click="handleQuery"
  115. >搜索</el-button
  116. >
  117. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  118. >重置</el-button
  119. >
  120. </el-form-item>
  121. </el-form>
  122. <!-- <el-row :gutter="10" class="mb8">
  123. <el-col :span="1.5">
  124. <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
  125. v-hasPermi="['question:error:add']">新增</el-button>
  126. </el-col>
  127. <el-col :span="1.5">
  128. <el-button type="success" icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
  129. v-hasPermi="['question:error:edit']">修改</el-button>
  130. </el-col>
  131. <el-col :span="1.5">
  132. <el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
  133. v-hasPermi="['question:error:remove']">删除</el-button>
  134. </el-col>
  135. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  136. </el-row> -->
  137. <el-table
  138. v-loading="loading"
  139. :data="errorList"
  140. @selection-change="handleSelectionChange"
  141. >
  142. <!-- <el-table-column type="selection" width="55" align="center" /> -->
  143. <el-table-column type="index" width="55" align="center" />
  144. <!-- <el-table-column label="用户id" align="center" prop="userId" /> -->
  145. <el-table-column label="内容" align="center" prop="content" />
  146. <!-- <el-table-column label="身份证" align="center" prop="logincode" /> -->
  147. <el-table-column
  148. label="创建时间"
  149. align="center"
  150. width="180px"
  151. prop="createTime"
  152. />
  153. <!-- <el-table-column label="商品名称" align="center" prop="goodsName" /> -->
  154. <!-- <el-table-column label="是否分成" align="center" prop="isShare">
  155. <template slot-scope="scope">
  156. <span v-if="scope.row.isShare == 1">是</span>
  157. <span v-else-if="scope.row.isShare == 0">否</span>
  158. <span v-else>其他</span>
  159. </template>
  160. </el-table-column> -->
  161. <!-- <el-table-column
  162. label="极速驾培订单ID"
  163. align="center"
  164. prop="outTradeNo"
  165. /> -->
  166. <el-table-column label="类型" align="center" prop="goodsName">
  167. <template slot-scope="scope">{{
  168. scope.row.type == 1 ? "遇到问题" : "使用建议"
  169. }}</template>
  170. </el-table-column>
  171. <el-table-column label="设备类型" align="center" prop="deviceType">
  172. <template slot-scope="scope">
  173. <span v-if="scope.row.deviceType == 1">苹果</span>
  174. <span v-else-if="scope.row.deviceType == 2">安卓</span>
  175. <span v-else-if="scope.row.deviceType == 3">小程序</span>
  176. <span v-else>其他</span>
  177. </template>
  178. </el-table-column>
  179. <!-- <el-table-column label="客户端类型" align="center" prop="goodsName">
  180. <template slot-scope="scope">
  181. <span v-if="scope.row.foreType == 1">app</span>
  182. <span v-if="scope.row.foreType == 2">小程序</span>
  183. <span v-if="scope.row.foreType == 3">公众号</span>
  184. </template>
  185. </el-table-column> -->
  186. <!-- <el-table-column label="驾校名称" align="center" prop="schoolName" /> -->
  187. <!-- <el-table-column label="驾校提成" align="center" prop="schoolName">
  188. <template slot-scope="scope">
  189. {{ scope.row.schoolCommission / 100 }}元
  190. </template>
  191. </el-table-column> -->
  192. <!-- <el-table-column label="订单价格" align="center" prop="total">
  193. <template slot-scope="scope"> {{ scope.row.total / 100 }}元 </template>
  194. </el-table-column> -->
  195. <el-table-column
  196. label="操作"
  197. align="center"
  198. class-name="small-padding fixed-width"
  199. >
  200. <template slot-scope="scope">
  201. <el-button :disabled="!scope.row.imgIds" @click="getAdviseImgFile(scope.row)" type="primary"
  202. >图片</el-button
  203. >
  204. <el-button @click="handleDelete(scope.row)" type="danger"
  205. >删除</el-button
  206. >
  207. </template>
  208. </el-table-column>
  209. </el-table>
  210. <pagination
  211. v-show="total > 0"
  212. :total="total"
  213. :page.sync="queryParams.pageNum"
  214. :limit.sync="queryParams.pageSize"
  215. @pagination="getList"
  216. />
  217. <el-dialog
  218. title="图片"
  219. :visible.sync="adviseImg"
  220. width="800px"
  221. custom-class="overflow-x-auto"
  222. append-to-body
  223. >
  224. <span style="padding-right:20px;cursor: pointer;" v-for="(item, index) in adviseImgs" :key="index">
  225. <el-image style="width:100px" fit="fill" :preview-src-list="adviseImgs.map(item=>item.fileUrl)" :src="item.fileUrl" />
  226. </span>
  227. </el-dialog>
  228. <!-- 添加或修改错题对话框 -->
  229. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  230. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  231. <el-form-item label="用户id" prop="userId">
  232. <el-input v-model="form.userId" placeholder="请输入用户id" />
  233. </el-form-item>
  234. <el-form-item label="题目id" prop="questionId">
  235. <el-input v-model="form.questionId" placeholder="请输入题目id" />
  236. </el-form-item>
  237. </el-form>
  238. <div slot="footer" class="dialog-footer">
  239. <el-button type="primary" @click="submitForm">确 定</el-button>
  240. <el-button @click="cancel">取 消</el-button>
  241. </div>
  242. </el-dialog>
  243. </div>
  244. </template>
  245. <script>
  246. import {
  247. getList,
  248. getError,
  249. refundOrder,
  250. delList,
  251. addError,
  252. updateError,
  253. exportError,
  254. } from "@/api/advise";
  255. import { getFileInfoByIds } from "@/api/file";
  256. let date = new Date();
  257. let defaultStartTime = `${date.getFullYear()}-${
  258. date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1
  259. }-01 00:00:00`;
  260. let defaultEndTime = `${date.getFullYear()}-${
  261. date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1
  262. }-${new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate()} 23:59:59`;
  263. export default {
  264. name: "Order",
  265. data() {
  266. return {
  267. // 遮罩层
  268. loading: true,
  269. // 选中数组
  270. ids: [],
  271. // 非单个禁用
  272. single: true,
  273. // 非多个禁用
  274. multiple: true,
  275. // 显示搜索条件
  276. showSearch: true,
  277. // 总条数
  278. total: 0,
  279. // 错题表格数据
  280. errorList: [],
  281. // 弹出层标题
  282. title: "",
  283. // 是否显示弹出层
  284. open: false,
  285. // 查询参数
  286. queryParams: {
  287. deviceType: null,
  288. id: null,
  289. type: null,
  290. // isShare: "",
  291. // userName: "",
  292. // logincode: "",
  293. outTradeNo: null,
  294. content: null,
  295. pageNum: 1,
  296. pageSize: 10,
  297. // id: null,
  298. // outRefundNo: null,
  299. // payType: 1,
  300. // phoneType: 1,
  301. // school: "",
  302. // schoolCommission: 0,
  303. // schoolName: "",
  304. // isShare: 0,
  305. },
  306. // 表单参数
  307. form: {},
  308. // 表单校验
  309. rules: {},
  310. //建议
  311. adviseImg: false,
  312. adviseImgs: [],
  313. };
  314. },
  315. created() {
  316. this.getList();
  317. },
  318. methods: {
  319. getAdviseImgFile(row) {
  320. console.log(row);
  321. this.adviseImg = true;
  322. getFileInfoByIds(row.imgIds).then((res) => {
  323. this.adviseImgs = res.data;
  324. });
  325. },
  326. /** 查询错题列表 */
  327. getList() {
  328. this.loading = true;
  329. getList(this.queryParams).then((response) => {
  330. this.errorList = response.rows;
  331. this.total = response.total;
  332. this.loading = false;
  333. });
  334. },
  335. // 取消按钮
  336. cancel() {
  337. this.open = false;
  338. this.reset();
  339. },
  340. // 表单重置
  341. reset() {
  342. this.form = {
  343. tradeType: "",
  344. userId: null,
  345. isShare: "",
  346. userName: "",
  347. logincode: "",
  348. outTradeNo: null,
  349. pageNum: 1,
  350. pageSize: 10,
  351. // id: null,
  352. // outRefundNo: null,
  353. // payType: 1,
  354. // phoneType: 1,
  355. // school: "",
  356. // schoolCommission: 0,
  357. // schoolName: "",
  358. // ,
  359. };
  360. this.resetForm("form");
  361. },
  362. handleRefund(row) {
  363. const outTradeNo = row.outTradeNo;
  364. this.$prompt(
  365. `确认退款${row.goodsName}吗?
  366. 请附带退款理由: <div>用户ID:${row.userId}</div><div>退款金额:${
  367. row.total / 100
  368. }元</div> <div>订单号:${row.outTradeNo}</div> `,
  369. "警告",
  370. {
  371. confirmButtonText: "确定",
  372. cancelButtonText: "取消",
  373. type: "warning",
  374. inputPlaceholder: "请输入退款理由",
  375. dangerouslyUseHTMLString: true,
  376. inputPattern: /[\u4E00-\u9FA5]/,
  377. inputErrorMessage: "至少输入一个中文",
  378. }
  379. )
  380. .then(function (obj) {
  381. return refundOrder({
  382. outTradeNo,
  383. reason: obj.value,
  384. });
  385. })
  386. .then(() => {
  387. this.getList();
  388. this.msgSuccess("退款成功");
  389. });
  390. },
  391. /** 搜索按钮操作 */
  392. handleQuery() {
  393. this.queryParams.pageNum = 1;
  394. this.getList();
  395. },
  396. /** 重置按钮操作 */
  397. resetQuery() {
  398. this.resetForm("queryForm");
  399. this.handleQuery();
  400. },
  401. // 多选框选中数据
  402. handleSelectionChange(selection) {
  403. this.ids = selection.map((item) => item.id);
  404. this.single = selection.length !== 1;
  405. this.multiple = !selection.length;
  406. },
  407. /** 新增按钮操作 */
  408. handleAdd() {
  409. this.reset();
  410. this.open = true;
  411. this.title = "添加错题";
  412. },
  413. /** 修改按钮操作 */
  414. handleUpdate(row) {
  415. this.reset();
  416. const id = row.id || this.ids;
  417. getError(id).then((response) => {
  418. this.form = response.data;
  419. this.open = true;
  420. this.title = "修改错题";
  421. });
  422. },
  423. /** 提交按钮 */
  424. submitForm() {
  425. this.$refs["form"].validate((valid) => {
  426. if (valid) {
  427. if (this.form.id != null) {
  428. updateError(this.form).then((response) => {
  429. this.msgSuccess("修改成功");
  430. this.open = false;
  431. this.getList();
  432. });
  433. } else {
  434. addError(this.form).then((response) => {
  435. this.msgSuccess("新增成功");
  436. this.open = false;
  437. this.getList();
  438. });
  439. }
  440. }
  441. });
  442. },
  443. /** 删除按钮操作 */
  444. handleDelete(row) {
  445. const ids = row.id || this.ids;
  446. this.$confirm('是否确认删除id为"' + ids + '"的数据项?', "警告", {
  447. confirmButtonText: "确定",
  448. cancelButtonText: "取消",
  449. type: "warning",
  450. })
  451. .then(function () {
  452. return delList(ids);
  453. })
  454. .then(() => {
  455. this.getList();
  456. this.msgSuccess("删除成功");
  457. });
  458. },
  459. /** 导出按钮操作 */
  460. handleExport() {
  461. const queryParams = this.queryParams;
  462. this.$confirm("是否确认导出所有错题数据项?", "警告", {
  463. confirmButtonText: "确定",
  464. cancelButtonText: "取消",
  465. type: "warning",
  466. })
  467. .then(function () {
  468. return exportError(queryParams);
  469. })
  470. .then((response) => {
  471. this.download(response.data);
  472. });
  473. },
  474. },
  475. };
  476. </script>
  477. <style>
  478. .overflow-x-auto{
  479. overflow-x: auto;
  480. }
  481. </style>