Browse Source

JLHWEB: 1、床垫清单,优化历史价格显示

JohnnyChan 4 ngày trước cách đây
mục cha
commit
fcef1d870d

+ 25 - 2
JLHWEB/src/components/ToastWidget/HistoryPrice/components/Item.vue

@@ -29,7 +29,7 @@
           <AvatarIcon size="small" :username="item.empname"></AvatarIcon>
         </div> -->
         <!-- <div class="oa-flow-item__right-content flx-1 flx"> -->
-        <div class="oa-flow-item__right-content-title flx-col flx-center">
+        <!-- <div class="oa-flow-item__right-content-title flx-col flx-center">
           <div class="text-f-c text-disable">不含税部门价</div>
           <span class="text-h5-b text-primary-text">
             {{ isFilterPrice(item.nottax_dept_cost) }}
@@ -46,6 +46,30 @@
           <span class="text-h5-b text-primary-text">
             {{ isFilterPrice(item.foreign_cost) }}
           </span>
+        </div> -->
+        <div class="oa-flow-item__right-content-title flx-col flx-center">
+          <div class="text-f-c text-disable">散单金额</div>
+          <span class="text-h5-b text-primary-text">
+            {{ isFilterPrice(item?.dannum_cost1) }}
+          </span>
+        </div>
+        <div class="oa-flow-item__right-content-title flx-col flx-center">
+          <div class="text-f-c text-disable">小单金额</div>
+          <span class="text-h5-b text-primary-text">
+            {{ isFilterPrice(item?.dannum_cost4) }}
+          </span>
+        </div>
+        <div class="oa-flow-item__right-content-title flx-col flx-center">
+          <div class="text-f-c text-disable">标准金额</div>
+          <span class="text-h5-b text-primary-text">
+            {{ isFilterPrice(item?.dannum_cost2) }}
+          </span>
+        </div>
+        <div class="oa-flow-item__right-content-title flx-col flx-center">
+          <div class="text-f-c text-disable">大单金额</div>
+          <span class="text-h5-b text-primary-text">
+            {{ isFilterPrice(item?.dannum_cost3) }}
+          </span>
         </div>
         <!-- </div> -->
       </section>
@@ -60,7 +84,6 @@ import { Calendar } from "@element-plus/icons-vue";
 import { isFilterPrice } from "@/utils/index";
 
 interface wigetProps {
-  t: any;
   item: any;
   /**
    * @description 索引

+ 41 - 25
JLHWEB/src/components/ToastWidget/HistoryPrice/index.vue

@@ -1,23 +1,33 @@
 <template>
-  <div class="lj-toast-hisprice flx-col w-full">
+  <div class="lj-toast-hisprice flx-col">
     <header class="flx">
       <span class="flx-1 text-h5-b">{{ t("business.detail.historyPrice") }}</span>
       <el-button v-if="!hideClose" circle text :icon="Refresh" @click="refresh(id, typeid, true)"></el-button>
       <el-button v-if="!hideClose" circle text :icon="CloseBold" @click="emit('close-toast')"></el-button>
     </header>
     <main class="w-full lj-toast-hisprice__main" :class="{ 'is-empty': !data.length }">
-      <div class="lj-toast-hisprice__main-content" v-if="data.length">
-        <HisItem
-          :data-ref="'item' + index"
-          v-for="(itm, index) in data"
-          :t="t"
-          :item="itm"
-          :index="index"
-          :key="index"
-          @click="emit('todetail', itm)"
-        />
-      </div>
-      <el-empty v-else :description="t('sys.empty.nodate')" />
+      <el-skeleton animated :loading="loading">
+        <template #template>
+          <el-skeleton-item variant="text" style="height: 22px; width: 128px" />
+          <div class="flx-justify-between ml-24">
+            <div class="flx-col flx-center" v-for="itm in 4" :key="itm">
+              <el-skeleton-item variant="text" class="mt-4" style="height: 20px; width: 64px" />
+              <el-skeleton-item variant="text" class="mt-4" style="height: 24px; width: 90px" />
+            </div>
+          </div>
+        </template>
+        <div class="lj-toast-hisprice__main-content">
+          <HisItem
+            :data-ref="'item' + index"
+            v-for="(itm, index) in data"
+            :item="itm"
+            :index="index"
+            :key="index"
+            @click="emit('todetail', itm)"
+          />
+        </div>
+      </el-skeleton>
+      <!-- <el-empty v-else :description="t('sys.empty.nodate')" /> -->
     </main>
     <footer></footer>
   </div>
@@ -31,13 +41,10 @@ import { useUserStore } from "@/stores/modules/user";
 import HisItem from "./components/Item.vue";
 import { CloseBold, Refresh } from "@element-plus/icons-vue";
 import { ElButton, ElMessage } from "element-plus";
+import { t } from "@/utils/i18n";
 
 // 接收父组件参数并设置默认值
 interface WidgetProps {
-  /**
-   * @description i18n
-   */
-  t: any;
   /**
    * @description 单据id
    */
@@ -67,7 +74,10 @@ const data = ref<any>([]);
 const { userInfo } = useUserStore();
 // const { prefixCls } = useDesign("toast-oa-flow");
 
-const refresh = async (id: number, typeid: number, tips?: boolean) => {
+const loading = ref(false);
+
+const refresh = (id: number, typeid: number, tips?: boolean) => {
+  loading.value = true;
   let _params = {
     dsname: "web_his_price",
     queryparams: {
@@ -75,13 +85,19 @@ const refresh = async (id: number, typeid: number, tips?: boolean) => {
       arg_typeid: typeid
     }
   };
-  let res = await CommonDynamicSelect(_params);
-  console.log("watch res :>> ", res);
-  data.value = res?.datatable?.length ? res?.datatable : [];
+  CommonDynamicSelect(_params)
+    .then(res => {
+      console.log("watch res :>> ", res);
+      data.value = res?.datatable?.length ? res?.datatable : [];
+      loading.value = false;
 
-  if (tips) {
-    ElMessage.success(props.t("sys.api.sueccessToRefresh"));
-  }
+      if (tips) {
+        ElMessage.success(t("sys.api.sueccessToRefresh"));
+      }
+    })
+    .catch(err => {
+      loading.value = false;
+    });
 };
 
 watch(
@@ -105,7 +121,7 @@ watch(
 
 <style lang="scss" scoped>
 .lj-toast-hisprice {
-  width: 240px;
+  width: 480px;
 
   :deep(.el-tabs__header) {
     margin-bottom: 0;

+ 34 - 29
JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx

@@ -2678,39 +2678,44 @@ export const useHooks = (t?: any) => {
    * @param timeout
    * @param params
    */
-  const gotoHisprice = async (timeout = 0, params: any) => {
+  const gotoHisprice = async (timeout = 0, params: any, cbClose?: any) => {
     const toast = useToast();
-    toast(
-      {
-        component: ToastHistoryPrice,
-        props: {
-          ...params,
-          t: t
-        },
-        listeners: {
-          todetail: (row: any) => {
-            console.log("gotoHisprice dd val :>> ", row, router);
-            if (Number(row.typeid) == 1) {
-              router.push(`/mattressQuote/detail?id=${row.bednetid_mattressid}`);
-
-              // state.bednetDrawerProps.deptid = state.LjDetailRef._mainData.deptid;
-              // state.bednetDrawerProps.bednetid = row.bednetid_mattressid;
-              // state.bednetDrawerProps.state = "";
-              // state.LjDrawerRef.show();
-            } else if (Number(row.typeid) == 2) {
-              router.push(`/bednetQuote/detail?id=${row.bednetid_mattressid}`);
+    toast.clear();
+    nextTick(() => {
+      toast(
+        {
+          component: ToastHistoryPrice,
+          props: {
+            ...params
+          },
+          listeners: {
+            todetail: (row: any) => {
+              console.log("gotoHisprice dd val :>> ", row, router);
+              if (Number(row.typeid) == 1) {
+                router.push(`/mattressQuote/detail?id=${row.bednetid_mattressid}`);
+
+                // state.bednetDrawerProps.deptid = state.LjDetailRef._mainData.deptid;
+                // state.bednetDrawerProps.bednetid = row.bednetid_mattressid;
+                // state.bednetDrawerProps.state = "";
+                // state.LjDrawerRef.show();
+              } else if (Number(row.typeid) == 2) {
+                router.push(`/bednetQuote/detail?id=${row.bednetid_mattressid}`);
+              }
+            },
+            closeToast: () => {
+              cbClose && cbClose();
             }
           }
+        },
+        {
+          position: POSITION.BOTTOM_RIGHT,
+          icon: false,
+          timeout: timeout,
+          closeButton: false,
+          toastClassName: "longjoe-toast"
         }
-      },
-      {
-        position: POSITION.BOTTOM_RIGHT,
-        icon: false,
-        timeout: timeout,
-        closeButton: false,
-        toastClassName: "longjoe-toast"
-      }
-    );
+      );
+    });
   };
 
   const getFormulakindEnum = async () => {

+ 28 - 2
JLHWEB/src/views/quote/mattressQuote/index.vue

@@ -109,7 +109,8 @@ const {
   formulaKindEnum,
   fabricMxTabList,
   funcChaifenTabPro,
-  getQuoteListMxData
+  getQuoteListMxData,
+  gotoHisprice
 } = useHooks();
 const { toExcelQuote } = useHooksCpQuote();
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
@@ -124,6 +125,7 @@ const deptEnum = ref([]);
 const userListData = ref([]);
 const QuoteListDrawerRef = ref(null);
 const ifShowDrawer = ref(false);
+const ifShowHisprice = ref(false);
 
 const { isShowOriginFormulaMattress } = storeToRefs(globalStore);
 const loadingStatus = reactive({
@@ -202,6 +204,16 @@ const handleClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $colu
   if (ifShowDrawer.value) {
     funcShowQuoteList(row);
   }
+  if (ifShowHisprice.value) {
+    gotoHisprice(
+      0,
+      { id: row.mattressid, typeid: 1 },
+      () => {
+        ifShowHisprice.value = false;
+      },
+      true
+    );
+  }
 };
 
 const funcShowQuoteList = (curRecord: any) => {
@@ -551,7 +563,21 @@ const action: detailAction[] = [
     label: t("common.viewHistoricalQuotes"),
     power: 72,
     clickFunc: item => {
-      alert("功能维护中!");
+      const curRecord = vxeTableRef.value.element.getCurrentRecord() ?? null;
+
+      // console.log("curRecords :>> ", curRecords);
+      if (!curRecord) {
+        ElMessage.warning(t("business.tips.mattress.records"));
+        return;
+        // } else if (curRecords.length > 1) {
+        //   ElMessage.warning(`无法进行多单${t("common.showQuoteList")}`);
+        //   return;
+      }
+      ifShowHisprice.value = true;
+
+      gotoHisprice(0, { id: curRecord.mattressid, typeid: 1 }, () => {
+        ifShowHisprice.value = false;
+      });
     }
   }),
   buttonDefault({