zxl
5 天以前 9797e46619f64bddb78d4b4eaa03d53069ac2ba4
manager/src/views/order/order/orderList.vue
@@ -320,21 +320,47 @@
          title: "操作",
          key: "action",
          align: "center",
          width: 100,
          width: 150,
          render: (h, params) => {
            return h(
              "Button",
              {
                props: { type: "info", size: "small" },
                style: { marginRight: "5px" },
                on: {
                  click: () => {
                    this.detail(params.row);
            const buttons = [];
            // 查看按钮 - 始终显示
            buttons.push(
              h(
                "Button",
                {
                  props: { type: "info", size: "small" },
                  style: { marginRight: "5px" },
                  on: {
                    click: () => {
                      this.detail(params.row);
                    },
                  },
                },
              },
              "查看"
                "查看"
              )
            );
            // 根据订单状态为'PAID'时显示额外操作按钮
            if (params.row.orderStatus === 'PAID') {
              buttons.push(
                h(
                  "Button",
                  {
                    props: { type: "primary", size: "small" },
                    style: { marginRight: "5px" },
                    on: {
                      click: () => {
                        this.handlePaidOrder(params.row);
                      },
                    },
                  },
                  "更新订单状态"
                )
              );
            }
            return h('div', buttons);
          },
        },
@@ -410,6 +436,42 @@
        query: { sn: sn },
      })
    },
    // 处理已付款订单的操作
    handlePaidOrder(order) {
      // 这里可以添加已付款订单的具体操作逻辑
      // 例如:显示确认对话框,发起发货请求等
      this.$Modal.confirm({
        title: '更新状态',
        content: `确认对订单号:${order.sn} 进行更新状操作吗?`,
        onOk: () => {
          // 调用发货API
          this.deliverOrder(order);
        },
        onCancel: () => {
          this.$Message.info('已取消操作');
        }
      });
    },
    // 发货操作
    deliverOrder(order) {
      console.log('------------->获取订单信息',order);
      console.log('订单sn编号',order.sn);
      // 这里可以调用相关的API进行发货操作
      API_Order.sendMessage(order.sn).then((res) => {
        console.log('-------------->',res);
        if (res.success) {
          this.$Message.success('更新状态成功');
          this.getDataList(); // 刷新列表
        } else {
          this.$Message.error('更新状态失败');
        }
      });
      // 暂时模拟操作
      this.$Message.success(`订单 ${order.sn} 更新状态成功!`);
      // 刷新列表数据
      this.getDataList();
    },
    // 导出订单
    async exportOrder() {
      if(this.searchForm.startDate==""||this.searchForm.endDate==""){