Browse Source

订单再次改版前

JXDS18FUJT 2 years ago
parent
commit
a897a5af82
3 changed files with 151 additions and 5 deletions
  1. 6 3
      src/api/order.js
  2. 2 2
      src/views/login.vue
  3. 143 0
      src/views/mobile/order/index.vue

+ 6 - 3
src/api/order.js

@@ -9,10 +9,13 @@ export function list(params) {
 }
 
 // 订单退款
-export function refund(outTradeNo) {
+export function refund(params) {
   return request({
-    url: "activities/wx",
+    url: "order/info/refund/" + params.outTradeNo,
     method: "put",
-    params: { outTradeNo }
+    params: {
+      reason: params.reason
+
+    }
   });
 }

+ 2 - 2
src/views/login.vue

@@ -65,8 +65,8 @@ export default {
       codeUrl: "",
       cookiePassword: "",
       loginForm: {
-        username: "admin",
-        password: "admin123",
+        username: "",
+        password: "",
         rememberMe: false,
         code: "",
         uuid: ""

+ 143 - 0
src/views/mobile/order/index.vue

@@ -0,0 +1,143 @@
+<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)" 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.$prompt("是否确认退款订单: " + outTradeNo, "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+        inputPlaceholder: "请输入退款理由",
+        dangerouslyUseHTMLString: true,
+        inputPattern: /[\u4E00-\u9FA5]/,
+        inputErrorMessage: "至少输入一个中文",
+      }).then(async function () {
+        let res = await refund({ outTradeNo, reason });
+        this.getList();
+        this.msgSuccess("退款成功");
+      });
+    },
+  },
+};
+</script>
+
+<style>
+</style>