From 358edb064eba0e13627e85d60974d179ccbea0fe Mon Sep 17 00:00:00 2001 From: peng <peng.com> Date: 星期二, 02 九月 2025 11:16:27 +0800 Subject: [PATCH] 操作栏固定右边 --- manager/src/views/order/order/orderList.vue | 86 +++++++++++++++++++++++++++++++++++++----- 1 files changed, 75 insertions(+), 11 deletions(-) diff --git a/manager/src/views/order/order/orderList.vue b/manager/src/views/order/order/orderList.vue index 78dc30c..7b793fd 100644 --- a/manager/src/views/order/order/orderList.vue +++ b/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绉掑埛鏂板垪琛╩q娑堟伅鏄紓姝ョ殑鏃犳硶瀹炴椂鍚屾闇�瑕佹墽琛屽欢杩熷埛鏂� + 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==""){ -- Gitblit v1.8.0