Procházet zdrojové kódy

新增订单管理模块

wyling před 3 roky
rodič
revize
6c436807b2
2 změnil soubory, kde provedl 177 přidání a 0 odebrání
  1. 18 0
      src/api/order.js
  2. 159 0
      src/views/order/index.vue

+ 18 - 0
src/api/order.js

@@ -0,0 +1,18 @@
+import request from "@/utils/request";
+
+// 查询订单列表
+export function list(params) {
+  return request({
+    url: "/activities/wx/order/list",
+    params
+  });
+}
+
+// 订单退款
+export function refund(outTradeNo) {
+  return request({
+    url: "activities/wx",
+    method: "put",
+    params: { outTradeNo }
+  });
+}

+ 159 - 0
src/views/order/index.vue

@@ -0,0 +1,159 @@
+<template>
+  <div class="app-container">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      :inline="true"
+      v-show="showSearch"
+      label-width="68px"
+    >
+      <el-form-item label="订单号" prop="outTradeNo">
+        <el-input
+          v-model="queryParams.outTradeNo"
+          placeholder="请输入订单号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button
+          type="cyan"
+          icon="el-icon-search"
+          size="mini"
+          @click="handleQuery"
+          >搜索</el-button
+        >
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
+          >重置</el-button
+        >
+      </el-form-item>
+    </el-form>
+
+    <el-table
+      v-loading="loading"
+      :data="orderList"
+      :row-class-name="tableRowClassName"
+    >
+      <el-table-column label="订单号" align="center" prop="outTradeNo" />
+      <el-table-column
+        label="操作"
+        align="center"
+        class-name="small-padding fixed-width"
+      >
+        <template slot-scope="scope">
+          <el-button
+            type="danger"
+            @click="handleRefund(scope.row)"
+            v-hasPermi="['order:refund']"
+            round
+            >发起退款</el-button
+          >
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+  </div>
+</template>
+
+<script>
+import { list, refund } from "@/api/order";
+
+export default {
+  name: "Code",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 激活码表格数据
+      orderList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {}
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询激活码列表 */
+    getList() {
+      this.loading = true;
+      list(this.queryParams).then(response => {
+        this.orderList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    //发起退款按钮点击
+    handleRefund(row){
+      const outTradeNo = row.outTradeNo;
+      this.$confirm("是否确认退款订单: " + outTradeNo, "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(async function() {
+          let res=await refund(outTradeNo);
+          this.getList();
+          this.msgSuccess("退款成功");
+        })
+
+    }
+  }
+};
+</script>
+
+<style>
+.jihuoma {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  font-size: 30px;
+}
+.el-table .warning-row {
+  background: rgb(228, 213, 187);
+}
+
+.el-table .success-row {
+  background: #cde6bf;
+}
+</style>