From b51f52bec4cf20fa6b0012bf9f55e428d0c2e07b Mon Sep 17 00:00:00 2001
From: wanghousheng <wanghousheng@njrzwl.cn>
Date: Sat, 23 Mar 2024 23:13:30 +0800
Subject: [PATCH] 1

---
 src/views/order/Index.vue | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/views/order/Index.vue b/src/views/order/Index.vue
index 7d4bf1d..c665a4c 100644
--- a/src/views/order/Index.vue
+++ b/src/views/order/Index.vue
@@ -87,6 +87,7 @@
                         <platform-icon :name="item.platform" :showTips="true" />
                       </td>
                     </tr>
+                    <!-- <div :key="`order_${item.order_id}_1`">{{ item.copy_text }}</div> -->
                     <tr v-for="(goodsItm, goodsIdx) in item.goods" :key="`orderGoods_${item.order_id}_${goodsIdx}`">
                       <td>
                         <GoodsItem
@@ -196,6 +197,7 @@
                               >审核取消</a
                             >
                             <a v-action:delete @click="handleDelete(item)">删除</a>
+                            <a @click="copyText(item.copy_text)">复制</a>
                           </div>
                         </td>
                       </template>
@@ -332,6 +334,7 @@ export default {
       // 当前页码
       page: 1,
       pageSizes: 15,
+      textToCopy: '',
       // 列表数据
       orderList: { data: [], total: 0 },
       pageSizeOptions: ['15', '30', '50'],
@@ -386,6 +389,15 @@ export default {
       return this.$route.path.split('/')[3].replace('-', '_')
     },
 
+    async copyText(text) {
+      try {
+        const textToCopy = text
+        await navigator.clipboard.writeText(textToCopy)
+        console.log('文本已复制到剪贴板')
+      } catch (err) {
+        console.error('复制到剪贴板失败', err)
+      }
+    },
     // 获取列表数据
     getList() {
       const { dataType, queryParam, page } = this