index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  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="phoneType">
  5. <el-select v-model="queryParams.isShare" placeholder="">
  6. <el-option :value="1" label="是"></el-option>
  7. <el-option :value="0" label="否"></el-option>
  8. </el-select>
  9. </el-form-item> -->
  10. <el-form-item label="开始时间" label-width="120px" prop="outTradeNo">
  11. <el-date-picker v-model="queryParams.startTime" type="date" placeholder="请选择月份"
  12. format="yyyy 年 MM 月 dd 日" value-format="yyyyMMdd">
  13. </el-date-picker>
  14. </el-form-item>
  15. <el-form-item label="结束时间" label-width="120px" prop="outTradeNo">
  16. <el-date-picker v-model="queryParams.endTime" type="date" placeholder="请选择月份"
  17. format="yyyy 年 MM 月 dd 日" value-format="yyyyMMdd">
  18. </el-date-picker>
  19. </el-form-item>
  20. <el-form-item label="驾校名称" prop="schoolName">
  21. <el-input v-model="queryParams.schoolName" placeholder="请输入驾校名称" clearable size="small"
  22. @keyup.enter.native="handleQuery" />
  23. </el-form-item>
  24. <el-form-item label="是否合作" prop="isShare">
  25. <el-select v-model="queryParams.isShare">
  26. <el-option value="" key="3" label="全部"></el-option>
  27. <el-option value="1" key="1" label="是"></el-option>
  28. <el-option value="0" key="2" label="否"></el-option>
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item label="支付状态" prop="tradeType">
  32. <el-select v-model="queryParams.tradeType">
  33. <el-option value="" key="4" label="全部"></el-option>
  34. <el-option value="1" key="1" label="支付成功">支付成功</el-option>
  35. <el-option value="2" key="2" label="支付失败">支付失败</el-option>
  36. <el-option value="3" key="3" label="已退款"></el-option>
  37. </el-select>
  38. </el-form-item>
  39. <!-- <el-form-item label="支付类型" prop="payType">
  40. <el-select v-model="queryParams.payType" placeholder="">
  41. <el-option :value="1" label="微信"></el-option>
  42. <el-option :value="2" label="支付宝"></el-option>
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item label="手机类型" prop="payType">
  46. <el-select v-model="queryParams.payType" placeholder="">
  47. <el-option :value="1" label="苹果"></el-option>
  48. <el-option :value="2" label="安卓"></el-option>
  49. </el-select>
  50. </el-form-item>
  51. <el-form-item label="驾校名称" prop="school">
  52. <el-input v-model="queryParams.school" placeholder="请输入驾校名称" clearable size="small"
  53. @keyup.enter.native="handleQuery" />
  54. </el-form-item>
  55. <el-form-item label="驾校提成" prop="questionId">
  56. <el-input v-model="queryParams.schoolCommission" placeholder="请输入驾校提成" clearable size="small"
  57. @keyup.enter.native="handleQuery" />
  58. </el-form-item>
  59. -->
  60. <el-form-item>
  61. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  62. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  63. </el-form-item>
  64. </el-form>
  65. <!-- <el-row :gutter="10" class="mb8">
  66. <el-col :span="1.5">
  67. <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
  68. v-hasPermi="['question:error:add']">新增</el-button>
  69. </el-col>
  70. <el-col :span="1.5">
  71. <el-button type="success" icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
  72. v-hasPermi="['question:error:edit']">修改</el-button>
  73. </el-col>
  74. <el-col :span="1.5">
  75. <el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
  76. v-hasPermi="['question:error:remove']">删除</el-button>
  77. </el-col>
  78. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  79. </el-row> -->
  80. <el-table v-loading="loading" :data="errorList" @selection-change="handleSelectionChange">
  81. <el-table-column type="selection" width="55" align="center" />
  82. <el-table-column label="用户id" align="center" prop="userId"></el-table-column>
  83. <el-table-column label="驾校名" align="center" prop="schoolName">
  84. <template slot-scope="scope">
  85. {{ scope.row.schoolName }}
  86. </template>
  87. </el-table-column>
  88. <el-table-column label="商品名" align="center" prop="goodsName"></el-table-column>
  89. <el-table-column label="订单流水号" align="center" prop="outTradeNo"></el-table-column>
  90. <el-table-column label="手机类型" align="center" prop="goodsName">
  91. <template slot-scope="scope">{{ scope.row.phoneType == 1 ? '苹果' : '安卓' }}</template>
  92. </el-table-column>
  93. <el-table-column label="支付时间" align="center" prop="successTime"></el-table-column>
  94. <el-table-column label="是否分成" align="center" prop="isShare">
  95. <template slot-scope="scope">{{ scope.row.isShare == 1 ? '是' : '否' }}</template>
  96. </el-table-column>
  97. <el-table-column label="支付状态" align="center" prop="tradeType">
  98. <template slot-scope="scope">
  99. <span v-if="scope.row.tradeType==1">支付成功</span>
  100. <span v-if="scope.row.tradeType==2">支付失败</span>
  101. <span v-if="scope.row.tradeType==3" style="color:red">已退款</span>
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="订单总额" align="center" prop="orderTotal">
  105. <template slot-scope="scope">
  106. {{ scope.row.total / 100 }}元
  107. </template>
  108. </el-table-column>
  109. <el-table-column label="驾校提成" align="center" prop="schoolCommission">
  110. <template slot-scope="scope">
  111. {{ scope.row.schoolCommission / 100 }}元
  112. </template>
  113. </el-table-column>
  114. <!-- schoolCommission -->
  115. <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  116. <template slot-scope="scope">
  117. <el-button :disabled="scope.row.outRefundNo" size="mini" type="text" icon="el-icon-remove-outline" @click="handleRefund(scope.row)"
  118. >退款</el-button>
  119. </template>
  120. </el-table-column> -->
  121. </el-table>
  122. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
  123. :limit.sync="queryParams.pageSize" @pagination="getList" />
  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="userId">
  128. <el-input v-model="form.userId" placeholder="请输入用户id" />
  129. </el-form-item>
  130. <el-form-item label="题目id" prop="questionId">
  131. <el-input v-model="form.questionId" placeholder="请输入题目id" />
  132. </el-form-item>
  133. </el-form>
  134. <div slot="footer" class="dialog-footer">
  135. <el-button type="primary" @click="submitForm">确 定</el-button>
  136. <el-button @click="cancel">取 消</el-button>
  137. </div>
  138. </el-dialog>
  139. </div>
  140. </template>
  141. <script>
  142. import { getList } from "@/api/tool/reportDetail";
  143. export default {
  144. name: "reportDetail",
  145. data() {
  146. return {
  147. // 遮罩层
  148. loading: true,
  149. // 选中数组
  150. ids: [],
  151. // 非单个禁用
  152. single: true,
  153. // 非多个禁用
  154. multiple: true,
  155. // 显示搜索条件
  156. showSearch: true,
  157. // 总条数
  158. total: 0,
  159. // 错题表格数据
  160. errorList: [],
  161. // 弹出层标题
  162. title: "",
  163. // 是否显示弹出层
  164. open: false,
  165. // 查询参数
  166. queryParams: {
  167. schoolName: '',
  168. startTime: null,
  169. endTime: null,
  170. pageNum: 1,
  171. pageSize: 10,
  172. tradeType: '',
  173. isShare: ''
  174. // id: null,
  175. // outRefundNo: null,
  176. // payType: 1,
  177. // phoneType: 1,
  178. // school: "",
  179. // schoolCommission: 0,
  180. // schoolName: "",
  181. // isShare: 0,
  182. },
  183. // 表单参数
  184. form: {},
  185. // 表单校验
  186. rules: {
  187. }
  188. };
  189. },
  190. created() {
  191. this.queryParams.schoolName = this.$route.query.schoolName || ''
  192. this.queryParams.startTime = this.$route.query.startTime || null
  193. this.queryParams.endTime = this.$route.query.endTime || null
  194. this.queryParams.isShare = this.$route.query.isShare || ''
  195. this.queryParams.tradeType = this.$route.query.tradeType || ''
  196. this.getList();
  197. },
  198. methods: {
  199. /** 查询错题列表 */
  200. getList() {
  201. this.loading = true;
  202. getList(this.queryParams).then(response => {
  203. this.errorList = response.rows;
  204. this.total = response.total;
  205. this.loading = false;
  206. });
  207. },
  208. // 取消按钮
  209. cancel() {
  210. this.open = false;
  211. this.reset();
  212. },
  213. // 表单重置
  214. reset() {
  215. this.queryParams = {
  216. outTradeNo: "",
  217. startTime: null,
  218. endTime: null,
  219. pageNum: 1,
  220. pageSize: 10,
  221. tradeType: '',
  222. isShare: ''
  223. // id: null,
  224. // outRefundNo: null,
  225. // payType: 1,
  226. // phoneType: 1,
  227. // school: "",
  228. // schoolCommission: 0,
  229. // schoolName: "",
  230. // isShare: 0,
  231. };
  232. this.resetForm("form");
  233. },
  234. handleRefund(row) {
  235. const outTradeNo = row.outTradeNo
  236. this.$confirm(`是否确认退款(${row.goodsName})`, "警告", {
  237. confirmButtonText: "确定",
  238. cancelButtonText: "取消",
  239. type: "warning"
  240. }).then(function () {
  241. return refundOrder(outTradeNo);
  242. }).then(() => {
  243. this.getList();
  244. this.msgSuccess("退款成功");
  245. })
  246. },
  247. /** 搜索按钮操作 */
  248. handleQuery() {
  249. if (this.queryParams.startTime && this.queryParams.endTime && Number(this.queryParams.startTime) > Number(this.queryParams.endTime)) {
  250. this.msgError('开始时间不能大于结束时间')
  251. return
  252. }
  253. this.queryParams.pageNum = 1;
  254. this.getList();
  255. },
  256. /** 重置按钮操作 */
  257. resetQuery() {
  258. this.reset()
  259. this.handleQuery();
  260. },
  261. // 多选框选中数据
  262. handleSelectionChange(selection) {
  263. this.ids = selection.map(item => item.id)
  264. this.single = selection.length !== 1
  265. this.multiple = !selection.length
  266. },
  267. /** 新增按钮操作 */
  268. handleAdd() {
  269. this.reset();
  270. this.open = true;
  271. this.title = "添加错题";
  272. },
  273. /** 修改按钮操作 */
  274. handleUpdate(row) {
  275. this.reset();
  276. const id = row.id || this.ids
  277. getError(id).then(response => {
  278. this.form = response.data;
  279. this.open = true;
  280. this.title = "修改错题";
  281. });
  282. },
  283. /** 提交按钮 */
  284. submitForm() {
  285. this.$refs["form"].validate(valid => {
  286. if (valid) {
  287. if (this.form.id != null) {
  288. updateError(this.form).then(response => {
  289. this.msgSuccess("修改成功");
  290. this.open = false;
  291. this.getList();
  292. });
  293. } else {
  294. addError(this.form).then(response => {
  295. this.msgSuccess("新增成功");
  296. this.open = false;
  297. this.getList();
  298. });
  299. }
  300. }
  301. });
  302. },
  303. /** 删除按钮操作 */
  304. handleDelete(row) {
  305. const ids = row.id || this.ids;
  306. this.$confirm('是否确认删除错题编号为"' + ids + '"的数据项?', "警告", {
  307. confirmButtonText: "确定",
  308. cancelButtonText: "取消",
  309. type: "warning"
  310. }).then(function () {
  311. return delError(ids);
  312. }).then(() => {
  313. this.getList();
  314. this.msgSuccess("删除成功");
  315. })
  316. },
  317. /** 导出按钮操作 */
  318. handleExport() {
  319. const queryParams = this.queryParams;
  320. this.$confirm('是否确认导出所有错题数据项?', "警告", {
  321. confirmButtonText: "确定",
  322. cancelButtonText: "取消",
  323. type: "warning"
  324. }).then(function () {
  325. return exportError(queryParams);
  326. }).then(response => {
  327. this.download(response.data);
  328. })
  329. }
  330. }
  331. };
  332. </script>
  333. <style scoped>
  334. .link-text {
  335. color: #1890ff;
  336. text-decoration: underline;
  337. text-decoration-color: #1890ff;
  338. }
  339. </style>