index.vue 15 KB

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