Explorar o código

add store-order print

yb hai 10 meses
pai
achega
2171dce294

+ 8 - 0
src/api/mall/order/storeOrder/index.ts

@@ -322,3 +322,11 @@ export const orderNoticeUrl = async () => {
 export const orderDueCancel = async (id: number) => {
   return await request.get({ url: `/order/store-order/dueCancel?id=` + id })
 }
+
+export interface IPrintOrderByIdQueryParams {
+  id: number
+}
+
+export const printOrderById = async (data: IPrintOrderByIdQueryParams) => {
+  return await request.post({ url: `/order/store-order/print`, data })
+}

+ 12 - 0
src/views/mall/order/storeOrder/index.vue

@@ -229,6 +229,7 @@
               <el-button type="primary" link><Icon icon="ep:d-arrow-right" /> {{ t('public.more') }}</el-button>
               <template #dropdown>
                 <el-dropdown-menu>
+                  <el-dropdown-item @click="printOrder(scope.row.id)">{{ t('mall.printTicket') }}</el-dropdown-item>
                   <el-dropdown-item v-if="scope.row.dueStatus == 1" @click="dueCancel(scope.row.id)">{{
                     t('mall.cancelReservation')
                   }}</el-dropdown-item>
@@ -409,6 +410,17 @@ const handleTake = async (id: number) => {
   } catch {}
 }
 
+const printOrder = async (id: number) => {
+  try {
+    const res = await StoreOrderApi.printOrderById({
+      id
+    })
+    if (res.code) {
+      message.success(t('infra.successfulExecution'))
+    }
+  } catch (error) {}
+}
+
 /** 取消预约 */
 const dueCancel = async (id: number) => {
   try {