7-15 修复小程序中审批复制功能
This commit is contained in:
parent
a9b3d4198e
commit
02eedfcea9
@ -1,4 +1,4 @@
|
|||||||
/**
|
/**
|
||||||
* 订单详情页面(审批 + 完整信息展示)
|
* 订单详情页面(审批 + 完整信息展示)
|
||||||
* 职责:展示订单完整信息(基础信息、费用明细、产品列表、收货信息、审批记录),
|
* 职责:展示订单完整信息(基础信息、费用明细、产品列表、收货信息、审批记录),
|
||||||
* 支持审批通过/退回,待审批状态下可选择下发工厂。
|
* 支持审批通过/退回,待审批状态下可选择下发工厂。
|
||||||
@ -398,14 +398,14 @@ Page({
|
|||||||
var app = getApp();
|
var app = getApp();
|
||||||
that.setData({ actionLoading: true, message: "" });
|
that.setData({ actionLoading: true, message: "" });
|
||||||
|
|
||||||
// 在 API 调用前捕获当前订单信息,用于审批通过后复制到剪贴板
|
// 审批通过且非自发订单时,先将收货/需求信息复制到剪贴板(必须在同步上下文中调用)
|
||||||
var clipboardText = "";
|
var clipboardText = "";
|
||||||
if (payload.approve_result === "pass" && !payload.factory_id) {
|
if (payload.approve_result === "pass") {
|
||||||
var orderData = that.data.orderInfo;
|
var orderData = that.data.orderInfo;
|
||||||
if (orderData) {
|
if (orderData) {
|
||||||
var lines = [];
|
var lines = [];
|
||||||
var isPickup = orderData.delivery_type === "自提";
|
if (orderData.order_no) lines.push("订单号:" + orderData.order_no);
|
||||||
if (!isPickup) {
|
if (orderData.customer_name || orderData.customer_mobile || orderData.customer_address) {
|
||||||
var contactParts = [orderData.customer_name, orderData.customer_mobile, orderData.customer_address].filter(function(v) { return v; });
|
var contactParts = [orderData.customer_name, orderData.customer_mobile, orderData.customer_address].filter(function(v) { return v; });
|
||||||
if (contactParts.length) lines.push("收货信息:" + contactParts.join(" "));
|
if (contactParts.length) lines.push("收货信息:" + contactParts.join(" "));
|
||||||
}
|
}
|
||||||
@ -414,6 +414,19 @@ Page({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 先复制到剪贴板(在同步上下文中确保系统剪贴板可用)
|
||||||
|
if (clipboardText) {
|
||||||
|
wx.setClipboardData({
|
||||||
|
data: clipboardText,
|
||||||
|
success: function () {
|
||||||
|
wx.showToast({ title: "已复制到剪贴板", icon: "success", duration: 2000 });
|
||||||
|
},
|
||||||
|
fail: function () {
|
||||||
|
wx.showToast({ title: "复制失败,请手动复制", icon: "none", duration: 2000 });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 请求订阅消息授权
|
// 请求订阅消息授权
|
||||||
await subscribe.ensureSubscribePermission("approve");
|
await subscribe.ensureSubscribePermission("approve");
|
||||||
|
|
||||||
@ -427,21 +440,6 @@ Page({
|
|||||||
wx.showToast({ title: "审批通过,已下发工厂并分配司机", icon: "success" });
|
wx.showToast({ title: "审批通过,已下发工厂并分配司机", icon: "success" });
|
||||||
} else if (payload.factory_id) {
|
} else if (payload.factory_id) {
|
||||||
wx.showToast({ title: "审批通过,已下发工厂,待后续分配司机", icon: "success" });
|
wx.showToast({ title: "审批通过,已下发工厂,待后续分配司机", icon: "success" });
|
||||||
} else if (clipboardText) {
|
|
||||||
// 使用预先捕获的文本复制到剪贴板
|
|
||||||
wx.setClipboardData({
|
|
||||||
data: clipboardText,
|
|
||||||
success: function () {
|
|
||||||
wx.showToast({ title: "内容已复制到剪贴板", icon: "none", duration: 2000 });
|
|
||||||
},
|
|
||||||
fail: function () {
|
|
||||||
wx.showToast({ title: "复制失败,请手动复制", icon: "none", duration: 2000 });
|
|
||||||
},
|
|
||||||
complete: function () {
|
|
||||||
that.loadDetail();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
wx.showToast({ title: "审批通过", icon: "success" });
|
wx.showToast({ title: "审批通过", icon: "success" });
|
||||||
}
|
}
|
||||||
@ -957,4 +955,4 @@ Page({
|
|||||||
query: "id=" + this.data.taskId,
|
query: "id=" + this.data.taskId,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
Loading…
Reference in New Issue
Block a user