index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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. {{ scope.row.schoolName }}
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="商品名" align="center" prop="goodsName"></el-table-column>
  86. <el-table-column label="手机类型" align="center" prop="goodsName">
  87. <template slot-scope="scope">{{ scope.row.phoneType == 1 ? '苹果' : '安卓' }}</template>
  88. </el-table-column>
  89. <el-table-column label="支付时间" align="center" prop="successTime"></el-table-column>
  90. <el-table-column label="是否分成" align="center" prop="isShare">
  91. <template slot-scope="scope">{{ scope.row.isShare == 1 ? '是' : '否' }}</template>
  92. </el-table-column>
  93. <el-table-column label="订单总额" align="center" prop="orderTotal">
  94. <template slot-scope="scope">
  95. {{ scope.row.total / 100 }}元
  96. </template>
  97. </el-table-column>
  98. <el-table-column label="驾校提成" align="center" prop="schoolCommission">
  99. <template slot-scope="scope">
  100. {{ scope.row.schoolCommission / 100 }}元
  101. </template>
  102. </el-table-column>
  103. <!-- schoolCommission -->
  104. <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  105. <template slot-scope="scope">
  106. <el-button :disabled="scope.row.outRefundNo" size="mini" type="text" icon="el-icon-remove-outline" @click="handleRefund(scope.row)"
  107. >退款</el-button>
  108. </template>
  109. </el-table-column> -->
  110. </el-table>
  111. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
  112. :limit.sync="queryParams.pageSize" @pagination="getList" />
  113. <!-- 添加或修改错题对话框 -->
  114. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  115. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  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="questionId">
  120. <el-input v-model="form.questionId" placeholder="请输入题目id" />
  121. </el-form-item>
  122. </el-form>
  123. <div slot="footer" class="dialog-footer">
  124. <el-button type="primary" @click="submitForm">确 定</el-button>
  125. <el-button @click="cancel">取 消</el-button>
  126. </div>
  127. </el-dialog>
  128. </div>
  129. </template>
  130. <script>
  131. import { getList } from "@/api/tool/reportDetail";
  132. export default {
  133. name: "Error",
  134. data() {
  135. return {
  136. // 遮罩层
  137. loading: true,
  138. // 选中数组
  139. ids: [],
  140. // 非单个禁用
  141. single: true,
  142. // 非多个禁用
  143. multiple: true,
  144. // 显示搜索条件
  145. showSearch: true,
  146. // 总条数
  147. total: 0,
  148. // 错题表格数据
  149. errorList: [],
  150. // 弹出层标题
  151. title: "",
  152. // 是否显示弹出层
  153. open: false,
  154. // 查询参数
  155. queryParams: {
  156. schoolName: '',
  157. startTime: null,
  158. endTime: null,
  159. pageNum: 1,
  160. pageSize: 10,
  161. tradeType: null,
  162. isShare: null
  163. // id: null,
  164. // outRefundNo: null,
  165. // payType: 1,
  166. // phoneType: 1,
  167. // school: "",
  168. // schoolCommission: 0,
  169. // schoolName: "",
  170. // isShare: 0,
  171. },
  172. // 表单参数
  173. form: {},
  174. // 表单校验
  175. rules: {
  176. }
  177. };
  178. },
  179. created() {
  180. this.queryParams.schoolName = this.$route.query.schoolName || ''
  181. this.queryParams.startTime = this.$route.query.startTime || null
  182. this.queryParams.endTime = this.$route.query.endTime || null
  183. this.getList();
  184. },
  185. methods: {
  186. /** 查询错题列表 */
  187. getList() {
  188. this.loading = true;
  189. getList(this.queryParams).then(response => {
  190. this.errorList = response.rows;
  191. this.total = response.total;
  192. this.loading = false;
  193. });
  194. },
  195. // 取消按钮
  196. cancel() {
  197. this.open = false;
  198. this.reset();
  199. },
  200. // 表单重置
  201. reset() {
  202. this.queryParams = {
  203. outTradeNo: "",
  204. startTime: null,
  205. endTime: null,
  206. pageNum: 1,
  207. pageSize: 10,
  208. tradeType: null,
  209. isShare: null
  210. // id: null,
  211. // outRefundNo: null,
  212. // payType: 1,
  213. // phoneType: 1,
  214. // school: "",
  215. // schoolCommission: 0,
  216. // schoolName: "",
  217. // isShare: 0,
  218. };
  219. this.resetForm("form");
  220. },
  221. handleRefund(row) {
  222. const outTradeNo = row.outTradeNo
  223. this.$confirm(`是否确认退款(${row.goodsName})`, "警告", {
  224. confirmButtonText: "确定",
  225. cancelButtonText: "取消",
  226. type: "warning"
  227. }).then(function () {
  228. return refundOrder(outTradeNo);
  229. }).then(() => {
  230. this.getList();
  231. this.msgSuccess("退款成功");
  232. })
  233. },
  234. /** 搜索按钮操作 */
  235. handleQuery() {
  236. if (this.queryParams.startTime && this.queryParams.endTime && Number(this.queryParams.startTime) > Number(this.queryParams.endTime)) {
  237. this.msgError('开始时间不能大于结束时间')
  238. return
  239. }
  240. this.queryParams.pageNum = 1;
  241. this.getList();
  242. },
  243. /** 重置按钮操作 */
  244. resetQuery() {
  245. this.reset()
  246. this.handleQuery();
  247. },
  248. // 多选框选中数据
  249. handleSelectionChange(selection) {
  250. this.ids = selection.map(item => item.id)
  251. this.single = selection.length !== 1
  252. this.multiple = !selection.length
  253. },
  254. /** 新增按钮操作 */
  255. handleAdd() {
  256. this.reset();
  257. this.open = true;
  258. this.title = "添加错题";
  259. },
  260. /** 修改按钮操作 */
  261. handleUpdate(row) {
  262. this.reset();
  263. const id = row.id || this.ids
  264. getError(id).then(response => {
  265. this.form = response.data;
  266. this.open = true;
  267. this.title = "修改错题";
  268. });
  269. },
  270. /** 提交按钮 */
  271. submitForm() {
  272. this.$refs["form"].validate(valid => {
  273. if (valid) {
  274. if (this.form.id != null) {
  275. updateError(this.form).then(response => {
  276. this.msgSuccess("修改成功");
  277. this.open = false;
  278. this.getList();
  279. });
  280. } else {
  281. addError(this.form).then(response => {
  282. this.msgSuccess("新增成功");
  283. this.open = false;
  284. this.getList();
  285. });
  286. }
  287. }
  288. });
  289. },
  290. /** 删除按钮操作 */
  291. handleDelete(row) {
  292. const ids = row.id || this.ids;
  293. this.$confirm('是否确认删除错题编号为"' + ids + '"的数据项?', "警告", {
  294. confirmButtonText: "确定",
  295. cancelButtonText: "取消",
  296. type: "warning"
  297. }).then(function () {
  298. return delError(ids);
  299. }).then(() => {
  300. this.getList();
  301. this.msgSuccess("删除成功");
  302. })
  303. },
  304. /** 导出按钮操作 */
  305. handleExport() {
  306. const queryParams = this.queryParams;
  307. this.$confirm('是否确认导出所有错题数据项?', "警告", {
  308. confirmButtonText: "确定",
  309. cancelButtonText: "取消",
  310. type: "warning"
  311. }).then(function () {
  312. return exportError(queryParams);
  313. }).then(response => {
  314. this.download(response.data);
  315. })
  316. }
  317. }
  318. };
  319. </script>
  320. <style scoped>
  321. .link-text {
  322. color: #1890ff;
  323. text-decoration: underline;
  324. text-decoration-color: #1890ff;
  325. }
  326. </style>