index.vue 13 KB

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