补齐店务端改密导出员工订单
This commit is contained in:
@@ -2,6 +2,7 @@ const dateUtil = require('../../utils/date')
|
||||
const planningApi = require('../../api/planning')
|
||||
const customersApi = require('../../api/customers')
|
||||
const employeesApi = require('../../api/employees')
|
||||
const shopApi = require('../../api/shop')
|
||||
|
||||
const PREVIEW_SIZE = 10
|
||||
|
||||
@@ -40,7 +41,8 @@ Page({
|
||||
previewColumns: [],
|
||||
previewRows: [],
|
||||
previewLoading: false,
|
||||
previewError: ''
|
||||
previewError: '',
|
||||
exporting: false
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
@@ -131,7 +133,31 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
exportExcel() { wx.showToast({ title: '导出任务已创建', icon: 'none' }) },
|
||||
async exportExcel() {
|
||||
if (this.data.exporting) {
|
||||
return
|
||||
}
|
||||
this.setData({ exporting: true })
|
||||
try {
|
||||
const filePath = await shopApi.downloadExport({
|
||||
type: this.data.type,
|
||||
startDate: this.data.startDate,
|
||||
endDate: this.data.endDate
|
||||
})
|
||||
wx.openDocument({
|
||||
filePath,
|
||||
fileType: 'xlsx',
|
||||
showMenu: true,
|
||||
fail(error) {
|
||||
wx.showToast({ title: error.errMsg || 'Excel 打开失败', icon: 'none' })
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || 'Excel 导出失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ exporting: false })
|
||||
}
|
||||
},
|
||||
|
||||
back() { wx.navigateBack() }
|
||||
})
|
||||
|
||||
@@ -42,5 +42,5 @@
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="fixed-bottom"><button class="primary-btn" bindtap="exportExcel">导出 Excel</button></view>
|
||||
<view class="fixed-bottom"><button class="primary-btn" loading="{{exporting}}" disabled="{{exporting}}" bindtap="exportExcel">导出 Excel</button></view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user