index.vue 12 KB

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