snow před 5 měsíci
rodič
revize
8d1e1bfd3f

+ 74 - 90
src/pages/home/components/seek-product.vue

@@ -1,14 +1,10 @@
 <script setup lang="ts">
 import { reactive, onMounted, ref } from "vue"
 
-import { Tabs, Tab, List, Image, showLoadingToast, closeToast, Button, showImagePreview, showFailToast, Dialog, Search, Field } from "vant"
-
-import { requestSeeklist, requestSeekstatus } from "~/service/modules/home"
-import { utils, writeFile } from "xlsx";
+import { Tabs, Tab, List, Image, showLoadingToast, closeToast, Button, showImagePreview, showFailToast, Dialog, Search, Field, showSuccessToast } from "vant"
+import { requestSeeklist, requestSeekstatus, requestCompanyCategores } from "~/service/modules/home"
 import axios from "axios"
 
-const props = defineProps<{ status?: string }>()
-
 const CancelToken = axios.CancelToken
 
 const mapSpuCode = ref<string[]>([])
@@ -55,19 +51,17 @@ async function onSearch(bidNo?: string, isReset?: boolean){
   state.loading = true
   source = CancelToken.source()
 
-
   const { code, data } = await requestSeeklist({ 
     tax_status: bidNo ? '' : state.status,
     page: bidNo ? 1 : state.page,
-    bidNo: bidNo || '',
+    skuOrName: state.skuOrName,
     info_status: ['2', '7'],
+    bidNo: bidNo || '',
     // platform_id: 76,
-    skuOrName: state.skuOrName,
-    is_combind: 0
+    // is_combind: 0
   }, 
     source.token
   )
-
   state.loading = false
   if(code == 0){
     if(bidNo){
@@ -77,9 +71,7 @@ async function onSearch(bidNo?: string, isReset?: boolean){
       list.value = [...list.value, ...data.list]
       state.finished = data.list.length < 10;
     }
-
     state.total = data.count
-    resetCheckBox()
   }
 
   if(state.isInit || isReset){
@@ -90,14 +82,11 @@ async function onSearch(bidNo?: string, isReset?: boolean){
 
 function handleTabChange(){
   source && source.cancel()
-
   state.skuOrName = ''
   state.isCheckAll = false
   state.isIndeterminate = false
-
   mapSpuCode.value = []
   selection.value = []
-
   state.page = 0
   state.finished = false
   state.loading = false
@@ -111,52 +100,51 @@ async function handleNoStatus(){
     showFailToast('请输入驳回原因!')
     return
   }
-
   showLoadingToast({ message: '审核中...', forbidClick: true })
-
   const { code } = await requestSeekstatus({
     "status": '2',
     "out_tax": "",
     "out_tax_id": "",
+    "goodCombind": [],
     "remark": remark.value,
-    "bidNo": currentItem.value.bidNo,
-    "goodCombind": []
+    "bidNo": currentItem.value.bidNo
   })
-
   if(code == 0){
     showSuccessToast('审核成功')
     visible.value = false
+    approvalVisible.value = false
     onSearch(currentItem.value.bidNo)
   }
 }
 
-const isApproval = (item) => item.tax_status == '0'
-
-function checkAllChange(value){
-  if(value){
-    selection.value = [ ...list.value ]
-    mapSpuCode.value = list.value.map(item => item.spuCode)
+async function handleSubmit(item = ({} as any)){
+  approvalVisible.value = true; 
+  currentItem.value = item;
+
+  const { in_info } = item;
+  if(in_info.merge_code){
+    const result = await requestCompanyCategores({ companyNo: item.companyNo, output_status: '1', cat_code: in_info.merge_code })
+    if(result.data.code == 0){
+      if(result.data.length === 0){
+        currentItem.value.isOk = false
+      } else {
+      }
+    }else {
+      currentItem.value.isOk = false
+    }
   } else {
-    selection.value = []
-    mapSpuCode.value = []
+    console.log('TODO..')
   }
-
-  resetCheckBox()
 }
 
-function resetCheckBox(){
-  if(mapSpuCode.value.length === 0){
-    state.isIndeterminate = false;
-    state.isCheckAll = false;
-  } else if(mapSpuCode.value.length === list.value.length){
-    state.isIndeterminate = false;
-    state.isCheckAll = true;
-  } else {
-    state.isIndeterminate = true;
-    state.isCheckAll = false;
-  }
+
+function handleApprovalResult(){
+  visible.value = true
+  remark.value = ''
 }
 
+const isApproval = (item) => item.tax_status == '0'
+
 onMounted(onSearch)
 </script>
 
@@ -166,7 +154,10 @@ onMounted(onSearch)
       <Tab v-for="tab in tabList" :title="tab.label" :key="tab.value" :name="tab.value" />
     </Tabs>
 
-    <div class="w-full flex bg-[#fff] fixed top-[43px] left-0 items-center" style="z-index:1000;border-bottom: 1px solid #f5f5f5" >
+    <div 
+      class="w-full flex bg-[#fff] fixed top-[43px] left-0 items-center" 
+      style="z-index:1000; border-bottom: 1px solid #f5f5f5" 
+    >
       <Search 
         class="flex-1"
         v-model="state.skuOrName"
@@ -181,51 +172,26 @@ onMounted(onSearch)
       >搜索</Button>
     </div>
     
-
-    <!-- <div class="flex w-full bg-[#fff] justify-between items-center" >
-      <div class="flex">
-        <Checkbox 
-          class="ml-[15px] color-[#ed6a0c]" 
-          shape="square" 
-          :indeterminate='state.isIndeterminate' 
-          v-model="state.isCheckAll"
-          @change="checkAllChange"
-          :disabled="list.length === 0"
-          icon-size="22px"
-        >全选</Checkbox>
-
-        <p class="ml-[5px]" style="font-size: 13px">已选 {{ selection.length }} 条, 显示 {{ list.length }} / {{ state.total }} 条</p>
-      </div>
-
-      <Button 
-          class="mr-[15px] h-[28px] mb-[4px]" 
-          size="small" 
-          type="warning"
-          :disabled="list.length === 0"
-          @click="handleDownload"
-        >下载</Button>
-    </div> -->
-
     <List class="mt-[95px] w-full" 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 class="p-[15px] flex items-start">
-          <!-- <Checkbox
-            class="mt-[3px] w-[30px]"
-            shape="square"
-            icon-size="22px"
-            @click="onSelection($event, item)"
-            :modelValue="mapSpuCode.includes(item.spuCode)"
-          /> -->
-
           <div class="float-right items-start w-full">
            <div class="flex flex-col ml-[10px]" style="line-height:22px">
              <div class="color-[#0f0f0f] flex items-start">
                 <Image 
-                  style="height:28px;width:28px;min-height:28px;min-width:28px;margin-right: 10px;border-radius:2px;border:1px solid #dcdfe6;overflow:hidden" 
+                  style="
+                    height:28px;
+                    width:28px;
+                    min-height:28px;
+                    min-width:28px;
+                    margin-right: 10px;
+                    border-radius: 2px;
+                    border: 1px solid #dcdfe6;
+                    overflow:hidden
+                  " 
                   @click="showImagePreview([item.good_img])"
                   :src="item.good_img"
                 />
-
                 <p class="font-[16px] font-700 py-[5px]">{{ item.good_name }}</p>
              </div>
              
@@ -241,7 +207,7 @@ onMounted(onSearch)
               </div>
 
               <div class="flex">
-                <p  class="w-[65px]  text-right pr-[5px]">类目编码:</p>
+                <p class="w-[65px]  text-right pr-[5px]">类目编码:</p>
                 <p>{{ item.in_info.merge_code }}</p>
               </div>
 
@@ -267,13 +233,12 @@ onMounted(onSearch)
                     size="small"
                   >审核不通过</Button>
                    <!-- @click="handleOkStatus" -->
-
                   <Button
                     class="px-[15px] h-[25px]"
                     round
                     type="warning"
                     size="small"
-                    @click="approvalVisible = true; currentItem = item"
+                    @click="handleSubmit(item)"
                   >提交审核结果</Button>
                 </div>
               </div>
@@ -300,7 +265,11 @@ onMounted(onSearch)
       </template>
     </Dialog>
 
-    <Dialog v-model:show="approvalVisible" title="提交审核结果">
+    <Dialog 
+      v-model:show="approvalVisible" 
+      title="提交审核结果"
+      :closeOnClickOverlay="true"
+    >
       <div class="flex flex-col ml-[10px] p-[10px]" style="line-height:22px">
          <div class="color-[#0f0f0f] flex items-start">
             <Image 
@@ -308,41 +277,56 @@ onMounted(onSearch)
               @click="showImagePreview([currentItem.good_img])"
               :src="currentItem.good_img"
             />
-          <p class="font-[16px] font-700 py-[5px]">{{ currentItem.good_name }}</p>
+
+            <p class="font-[16px] font-700 py-[5px]">{{ currentItem.good_name }}</p>
          </div>
          
         <div class="flex flex-col color-[#34495e] font-500" style="font-size: 13px">
           <div class="flex">
-            <p  class="w-[65px] text-right pr-[5px]">审核状态:</p>
+            <p  class="w-[85px] text-right pr-[5px]">审核状态:</p>
             <p>{{ tabList.find(({ value }) => currentItem.tax_status == value)?.label || '--' }}</p>
           </div>
 
           <div class="flex">
-            <p class="w-[65px]  text-right pr-[5px]">SKU编号:</p>
+            <p class="w-[85px]  text-right pr-[5px]">SKU编号:</p>
             <p>{{ currentItem.spuCode }}</p>
           </div>
 
           <div class="flex">
-            <p  class="w-[65px]  text-right pr-[5px]">类目编码:</p>
+            <p  class="w-[85px]  text-right pr-[5px]">{{ currentItem.isOk ? '类目编码:' : '预计类目编码:' }}</p>
             <p>{{ currentItem.in_info.merge_code }}</p>
           </div>
 
           <div class="flex">
-            <p  class="w-[65px]  text-right pr-[5px]">类目名称:</p>
+            <p  class="w-[85px]  text-right pr-[5px]">{{ currentItem.isOk ? '类目名称:' : '预计类目名称:' }}</p>
             <p>{{ currentItem.in_info.cat_name }}</p>
           </div>
 
           <div class="flex">
-            <p  class="w-[65px]  text-right pr-[5px]">工艺材质:</p>
+            <p  class="w-[85px]  text-right pr-[5px]">工艺材质:</p>
             <p>{{ currentItem.cost_desc }}</p>
           </div>
+
+          <p 
+            class="text-center w-full my-[10px] color-red" 
+            v-if="!currentItem.isOk"
+          >当前业务公司销项没有该类目,请驳回</p>
          </div>
        </div>
 
        <template #footer>
           <div class="flex">
-            <Button class="flex-1" @click="visible = false; remark = ''">驳回</Button>
-            <Button class="flex-1" type="warning" @click="handleNoStatus">通过</Button>
+            <Button
+              class="flex-1" 
+              @click="handleApprovalResult"
+            >驳回</Button>
+            
+            <Button 
+              v-if="currentItem.isOk"
+              @click="handleNoStatus"
+              class="flex-1" 
+              type="warning" 
+            >通过</Button>
           </div>
        </template>
     </Dialog>

+ 5 - 0
src/service/modules/home/index.ts

@@ -8,6 +8,8 @@ enum HomeAPI {
   cost = '/admin/gooduplist',
   costDetail = '/admin/goodupinfo',
   costStatus = '/admin/goodexam',
+
+  categories = '/user/TaxCategory/listByCompany'
 }
 
 export const requestSeeklist = (data: any, cancelToken) => {
@@ -35,3 +37,6 @@ export const requestCoststatus = (data: any) => {
   return service.post<any>({ url: HomeAPI.costStatus, data });
 };
 
+export const requestCompanyCategores = (data: any) => {
+  return service.post<any>({ url: 'http://project.test241.wanyuhengtong.com/user/TaxCategory/listByCompany', data })
+}