|
@@ -3,16 +3,17 @@ import { reactive, onMounted, ref } from "vue"
|
|
|
|
|
|
import {
|
|
import {
|
|
Tabs, Tab, List, Image, showLoadingToast, closeToast, Button, showImagePreview, showFailToast, Dialog, Search, Field, showSuccessToast, showConfirmDialog,
|
|
Tabs, Tab, List, Image, showLoadingToast, closeToast, Button, showImagePreview, showFailToast, Dialog, Search, Field, showSuccessToast, showConfirmDialog,
|
|
- Loading, Popup, Picker, BackTop
|
|
|
|
|
|
+ Loading, Popup, Picker, BackTop,
|
|
|
|
+ Checkbox
|
|
} from "vant"
|
|
} from "vant"
|
|
|
|
|
|
-
|
|
|
|
import { requestSeeklist, requestSeekstatus, requestCompanyCategores, requestBusinessInfo, requestSupplierInfo } from "~/service/modules/home"
|
|
import { requestSeeklist, requestSeekstatus, requestCompanyCategores, requestBusinessInfo, requestSupplierInfo } from "~/service/modules/home"
|
|
|
|
+import { utils, writeFile } from "xlsx";
|
|
import axios from "axios"
|
|
import axios from "axios"
|
|
|
|
|
|
const CancelToken = axios.CancelToken
|
|
const CancelToken = axios.CancelToken
|
|
|
|
|
|
-const mapSpuCode = ref<string[]>([])
|
|
|
|
|
|
+const mapIds = ref<string[]>([])
|
|
const selection = ref<Record<string, any>>([])
|
|
const selection = ref<Record<string, any>>([])
|
|
|
|
|
|
const state = reactive({
|
|
const state = reactive({
|
|
@@ -86,6 +87,8 @@ async function onSearch(bidNo?: string, isReset?: boolean){
|
|
list.value = [...list.value, ...data.list]
|
|
list.value = [...list.value, ...data.list]
|
|
state.finished = data.list.length < 10;
|
|
state.finished = data.list.length < 10;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ checkCheckbox()
|
|
state.total = data.count
|
|
state.total = data.count
|
|
}
|
|
}
|
|
|
|
|
|
@@ -100,7 +103,7 @@ function handleTabChange(){
|
|
state.skuOrName = ''
|
|
state.skuOrName = ''
|
|
state.isCheckAll = false
|
|
state.isCheckAll = false
|
|
state.isIndeterminate = false
|
|
state.isIndeterminate = false
|
|
- mapSpuCode.value = []
|
|
|
|
|
|
+ mapIds.value = []
|
|
selection.value = []
|
|
selection.value = []
|
|
state.page = 0
|
|
state.page = 0
|
|
state.finished = false
|
|
state.finished = false
|
|
@@ -262,6 +265,81 @@ function handlePickerConfirm({ selectedOptions }){
|
|
state.showPicker = false
|
|
state.showPicker = false
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function handleSelectChange(item){
|
|
|
|
+ const findIndex = selection.value.findIndex(({ id }) =>item.id === id)
|
|
|
|
+
|
|
|
|
+ if (findIndex === -1) {
|
|
|
|
+ selection.value.push(item)
|
|
|
|
+ mapIds.value.push(item.id)
|
|
|
|
+ } else {
|
|
|
|
+ selection.value.splice(findIndex, 1)
|
|
|
|
+ mapIds.value.splice(findIndex, 1)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ checkCheckbox()
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function handleExport() {
|
|
|
|
+ if(selection.value.length === 0){
|
|
|
|
+ showFailToast('至少选择一条数据!')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const isOk = selection.value.every(item => item.tax_status == '0')
|
|
|
|
+ if(!isOk){
|
|
|
|
+ showFailToast('只能导出状态为待审核的数据')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ const data = selection.value.map(item => ({
|
|
|
|
+ 'SKU编号': item.spuCode,
|
|
|
|
+ '类目编码': item.in_info.merge_code,
|
|
|
|
+ '类目名称': item.in_info.cat_name,
|
|
|
|
+ '进项税率': item.tax + '%',
|
|
|
|
+ '工艺材质': item.cost_desc
|
|
|
|
+ }))
|
|
|
|
+
|
|
|
|
+ //创建数据表
|
|
|
|
+ const workBook = utils.book_new();
|
|
|
|
+ const workSheet = utils.json_to_sheet(data);
|
|
|
|
+ utils.book_append_sheet(workBook, workSheet, "sheet");
|
|
|
|
+ //导出模板
|
|
|
|
+ writeFile(workBook, "咨询商品类目信息.xlsx", { bookType: "xlsx" });
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function checkCheckbox(){
|
|
|
|
+ if(selection.value.length === list.value.length && list.value.length !== 0){
|
|
|
|
+ state.isIndeterminate = false
|
|
|
|
+ state.isCheckAll = true
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(selection.value.length === 0){
|
|
|
|
+ state.isIndeterminate = false
|
|
|
|
+ state.isCheckAll = false
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(selection.value.length !== 0){
|
|
|
|
+ state.isIndeterminate = true
|
|
|
|
+ state.isCheckAll = false
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function handleCheckAll(){
|
|
|
|
+ if(selection.value.length !== list.value.length){
|
|
|
|
+ selection.value = list.value.map(item => ({ ...item }))
|
|
|
|
+ mapIds.value = list.value.map(item => item.id)
|
|
|
|
+ } else {
|
|
|
|
+ selection.value = []
|
|
|
|
+ mapIds.value = []
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ checkCheckbox()
|
|
|
|
+}
|
|
|
|
+
|
|
const isApproval = (item) => item.tax_status == '0'
|
|
const isApproval = (item) => item.tax_status == '0'
|
|
</script>
|
|
</script>
|
|
|
|
|
|
@@ -272,7 +350,7 @@ const isApproval = (item) => item.tax_status == '0'
|
|
</Tabs>
|
|
</Tabs>
|
|
|
|
|
|
<div
|
|
<div
|
|
- class="w-full flex bg-[#fff] fixed top-[43px] left-0 items-center"
|
|
|
|
|
|
+ class="w-full flex bg-[#fff] fixed top-[43px] left-0 items-center"
|
|
style="z-index:1000; border-bottom: 1px solid #f5f5f5"
|
|
style="z-index:1000; border-bottom: 1px solid #f5f5f5"
|
|
>
|
|
>
|
|
<Search
|
|
<Search
|
|
@@ -289,10 +367,51 @@ const isApproval = (item) => item.tax_status == '0'
|
|
@click="onSearch('', true)"
|
|
@click="onSearch('', true)"
|
|
>搜索</Button>
|
|
>搜索</Button>
|
|
</div>
|
|
</div>
|
|
|
|
+
|
|
|
|
+ <div
|
|
|
|
+ v-if="state.status == 0 && state.status != ''"
|
|
|
|
+ class="w-full h-[30px] bg-white fixed top-[98px] left-0 flex items-center justify-between"
|
|
|
|
+ style="font-size: 14px;border-bottom: 1px solid #f5f5f5;z-index:1000; "
|
|
|
|
+ >
|
|
|
|
+ <Checkbox
|
|
|
|
+ class="ml-[15px]"
|
|
|
|
+ shape="square"
|
|
|
|
+ size="small"
|
|
|
|
+ style="font-size:12px"
|
|
|
|
+ :modelValue="state.isCheckAll"
|
|
|
|
+ :indeterminate="state.isIndeterminate"
|
|
|
|
+ @click="handleCheckAll"
|
|
|
|
+ :disabled="list.length === 0"
|
|
|
|
+ >
|
|
|
|
+ 全选
|
|
|
|
+ </Checkbox>
|
|
|
|
+
|
|
|
|
+ <div>选中 {{ selection.length }} 条 , 显示 {{ list.length }} / {{ state.total }} 条</div>
|
|
|
|
+ <Button
|
|
|
|
+ class="mr-[15px] h-[22px]" size="small"
|
|
|
|
+ :disabled="list.length === 0"
|
|
|
|
+ @click="handleExport"
|
|
|
|
+ type="primary"
|
|
|
|
+ >导出</Button>
|
|
|
|
+ </div>
|
|
|
|
|
|
- <List class="mt-[95px] w-full" v-model:loading="state.loading" :finished="state.finished" finished-text="没有更多了" @load="onSearch">
|
|
|
|
|
|
+ <List
|
|
|
|
+ :class="`w-full ${state.status == 0 && state.status != '' ? 'mt-[120px]' : 'mt-[90px]'}`"
|
|
|
|
+ v-model:loading="state.loading"
|
|
|
|
+ :finished="state.finished"
|
|
|
|
+ finished-text="没有更多了"
|
|
|
|
+ @load="onSearch"
|
|
|
|
+ >
|
|
<div :show="true" class="bg-[#fff] my-[3px] border-[#f5f5f5]" v-for="item in list" :key="item.id">
|
|
<div :show="true" class="bg-[#fff] my-[3px] border-[#f5f5f5]" v-for="item in list" :key="item.id">
|
|
<div class="p-[15px] flex items-start">
|
|
<div class="p-[15px] flex items-start">
|
|
|
|
+ <Checkbox
|
|
|
|
+ v-if="state.status == 0"
|
|
|
|
+ shape="square"
|
|
|
|
+ class="w-[24px] mt-[5px] mr-[5px]"
|
|
|
|
+ :modelValue="mapIds.includes(item.id)"
|
|
|
|
+ @click="() => handleSelectChange(item)"
|
|
|
|
+ />
|
|
|
|
+
|
|
<div class="float-right items-start w-full">
|
|
<div class="float-right items-start w-full">
|
|
<div class="flex flex-col ml-[10px]" style="line-height:22px">
|
|
<div class="flex flex-col ml-[10px]" style="line-height:22px">
|
|
<div class="color-[#0f0f0f] flex items-start">
|
|
<div class="color-[#0f0f0f] flex items-start">
|