This commit is contained in:
2025-09-30 09:42:43 +08:00
parent 9719228d6d
commit c5ac27cdec
15 changed files with 222 additions and 139 deletions

View File

@@ -4,6 +4,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import { zebraApi, type ZebraOrder, type BanmaAccount } from '../../api/zebra'
import AccountManager from '../common/AccountManager.vue'
import { batchConvertImages } from '../../utils/imageProxy'
import { handlePlatformFileExport } from '../../utils/settings'
type Shop = { id: string; shopName: string }
@@ -234,12 +235,9 @@ async function exportToExcel() {
const blob = new Blob([buffer], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
})
const fileName = `斑马订单数据_${new Date().toISOString().slice(0, 10)}.xlsx`
const link = document.createElement('a')
link.href = URL.createObjectURL(blob)
link.download = `斑马订单数据_${new Date().toISOString().slice(0, 10)}.xlsx`
link.click()
URL.revokeObjectURL(link.href)
await handlePlatformFileExport('zebra', blob, fileName)
showMessage('Excel文件导出成功', 'success')
} catch (error) {
@@ -266,6 +264,7 @@ const formUsername = ref('')
const formPassword = ref('')
const rememberPwd = ref(true)
const managerVisible = ref(false)
const accountManagerRef = ref()
function openAddAccount() {
isEditMode.value = false
@@ -302,6 +301,9 @@ async function submitAccount() {
accountDialogVisible.value = false
await loadAccounts()
if (id) accountId.value = id
if (managerVisible.value && accountManagerRef.value?.load) {
accountManagerRef.value.load()
}
} catch (e: any) {
ElMessage({ message: e?.message || '账号或密码错误无法获取Token', type: 'error' })
}
@@ -519,7 +521,7 @@ async function removeCurrentAccount() {
<el-button type="primary" class="btn-blue" style="width: 100%" @click="submitAccount">登录</el-button>
</template>
</el-dialog>
<AccountManager v-model="managerVisible" platform="zebra" @add="openAddAccount" />
<AccountManager ref="accountManagerRef" v-model="managerVisible" platform="zebra" @add="openAddAccount" @refresh="loadAccounts" />
</div>
</template>