index.vue 13 KB

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