peng
2025-09-02 358edb064eba0e13627e85d60974d179ccbea0fe
manager/src/views/order/order/orderList.vue
@@ -320,21 +320,48 @@
          title: "操作",
          key: "action",
          align: "center",
          width: 100,
          width: 150,
          fixed:"right",
          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 +437,43 @@
        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('更新状态成功');
          // 延迟5秒刷新列表mq消息是异步的无法实时同步需要执行延迟刷新
          setTimeout(() => {
            this.getDataList();
          }, 5000);
        } else {
          this.$Message.error('更新状态失败');
        }
      }).catch((error) => {
        console.error('更新状态失败:', error);
        this.$Message.error('更新状态失败,请重试');
      });
    },
    // 导出订单
    async exportOrder() {
      if(this.searchForm.startDate==""||this.searchForm.endDate==""){