فهرست منبع

新建页面销售分析

cz 2 سال پیش
والد
کامیت
e74ee9b0a1

+ 12 - 4
src/components/WDLY/product/SelectProduct.vue

@@ -287,7 +287,7 @@ const { proxy } = getCurrentInstance();
 const props = defineProps({
   isCombination: {
     type: Boolean,
-    default:false,
+    default: false,
   },
 });
 const selectConfig = computed(() => {
@@ -352,6 +352,9 @@ const config = computed(() => {
         label: "单位",
         prop: "unit",
       },
+      render(unit) {
+        return proxy.dictValueLabel(unit, productUnit.value);
+      },
     },
     {
       attrs: {
@@ -594,7 +597,9 @@ const getList = async (req) => {
   loading.value = true;
   proxy
     .post(
-      props.isCombination ? "/productInfo/getCombinationPage" : "/productInfo/page",
+      props.isCombination
+        ? "/productInfo/getCombinationPage"
+        : "/productInfo/page",
       sourceList.value.pagination
     )
     .then((message) => {
@@ -812,8 +817,11 @@ const productUnit = ref([]);
 const productType = ref([]);
 
 const getDict = () => {
-  proxy.getDict(["unit", "product_type"]).then((res) => {
-    productUnit.value = res["unit"];
+  proxy.getDictOne(["unit", "product_type"]).then((res) => {
+    productUnit.value = res["unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
     productType.value = res["product_type"];
     // formConfig.value[1].data = productType.value.map((x) => ({
     //   label: x.dictValue,

+ 74 - 15
src/views/WDLY/outInBound/waitOutBound/index.vue

@@ -172,7 +172,7 @@ let rules = ref({
   inWarehouseId: [
     { required: true, message: "请选择调入仓库", trigger: "change" },
   ],
-  quantity: [{ required: true, message: "请输入调仓数量", trigger: "blur" }],
+  quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
 });
 const { proxy } = getCurrentInstance();
 const selectConfig = reactive([
@@ -254,6 +254,9 @@ const config = computed(() => {
         label: "单位",
         prop: "productUnit",
       },
+      render(unit) {
+        return proxy.dictValueLabel(unit, productUnit.value);
+      },
     },
     {
       attrs: {
@@ -309,6 +312,10 @@ const formOption = reactive({
 });
 const byform = ref(null);
 let formConfig = ref([]);
+const businessType = [
+  { label: "销售订单出库", value: "6" },
+  { label: "京东订单出库", value: "5" },
+];
 const configData = [
   [
     {
@@ -322,11 +329,11 @@ const configData = [
       required: true,
       disabled: true,
       itemWidth: 100,
-      data: [],
+      data: businessType,
     },
     {
       type: "input",
-      prop: "businessType",
+      prop: "businessCode",
       label: "单号",
       required: true,
       disabled: true,
@@ -334,7 +341,7 @@ const configData = [
     },
     {
       type: "input",
-      prop: "businessType",
+      prop: "productName",
       label: "物品名称",
       required: true,
       disabled: true,
@@ -342,7 +349,7 @@ const configData = [
     },
     {
       type: "input",
-      prop: "businessType",
+      prop: "waitQuantity",
       label: "待出库数量",
       required: true,
       disabled: true,
@@ -370,11 +377,14 @@ const configData = [
       },
     },
     {
-      type: "input",
-      prop: "code",
+      type: "number",
+      prop: "quantity",
       label: "出库数量",
       disabled: false,
       itemWidth: 33,
+      precision: 2,
+      min: 0,
+      controls: false,
     },
   ],
   [
@@ -424,6 +434,7 @@ const getList = async (req) => {
       sourceList.value.data = message.rows.map((x) => ({
         ...x,
         ...JSON.parse(x.victoriatouristJson),
+        quantity: Number(x.quantity) - Number(x.receiptQuantity),
       }));
       sourceList.value.pagination.total = message.total;
       setTimeout(() => {
@@ -470,6 +481,39 @@ const submitForm = () => {
         },
         (err) => (submitLoading.value = false)
       );
+    } else if (modalType.value === "edit") {
+      const data = {
+        id: formData.data.id,
+        businessType: formData.data.businessType,
+        warehouseId: formData.data.warehouseId,
+        quantity: formData.data.quantity,
+        waitQuantity: formData.data.waitQuantity,
+      };
+      if (!(data.quantity > 0)) {
+        return ElMessage({
+          message: "出库数量不能为0!",
+          type: "info",
+        });
+      }
+      if (data.quantity > data.waitQuantity) {
+        return ElMessage({
+          message: "出库数量不能大于待出库数量!",
+          type: "info",
+        });
+      }
+      submitLoading.value = true;
+      proxy.post("/stockWaitDetails/add", data).then(
+        (res) => {
+          ElMessage({
+            message: "操作成功",
+            type: "success",
+          });
+          dialogVisible.value = false;
+          submitLoading.value = false;
+          getList();
+        },
+        (err) => (submitLoading.value = false)
+      );
     }
   });
 };
@@ -495,20 +539,25 @@ const outBound = (row) => {
       };
       dialogVisible.value = true;
     });
-  } else {
+  } else if (row.businessType == 6) {
     modalType.value = "edit";
     formConfig.value = configData[0];
+    proxy.post("/orderInfo/detail", { id: row.businessId }).then((res) => {
+      formData.data = {
+        id: row.id,
+        warehouseId: "",
+        businessType: row.businessType + "",
+        businessCode: row.businessCode,
+        productName: row.productName,
+        waitQuantity: row.quantity,
+        quantity: undefined,
+      };
+      dialogVisible.value = true;
+    });
   }
-
-  dialogVisible.value = true;
 };
 const warehouseType = ref([]);
 
-const businessType = [
-  { label: "销售订单出库", value: "6" },
-  { label: "京东订单出库", value: "5" },
-];
-
 const handleRemove = (index) => {
   formData.data.jdOrderDetailsList.splice(index, 1);
   return ElMessage({
@@ -574,6 +623,16 @@ const warehouseListData = () => {
 };
 warehouseListData();
 getList();
+const productUnit = ref([]);
+const getDict = () => {
+  proxy.getDictOne(["unit"]).then((res) => {
+    productUnit.value = res["unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+  });
+};
+getDict();
 onMounted(() => {
   selectConfig[0].data = businessType;
   selectConfig[1].data = outboundType.value;

+ 1 - 1
src/views/WDLY/purchaseManage/alreadyPurchase/index.vue

@@ -762,7 +762,7 @@ watch(
           productCode: x.code,
           bussinessId: x.productId,
           purchaseDetailId: x.purchaseDetailId,
-          deliverGoodsDetailsId: x.deliverGoodsId,
+          deliverGoodsDetailsId: x.id,
           transitQuantity: x.transitQuantity,
           deliverGoodsQuantity: x.deliverGoodsQuantity,
           productDefinition: x.definition,

+ 1 - 1
src/views/dataBoard/board/customerAnalysis/index.vue

@@ -159,7 +159,7 @@
     </div>
     <div class="three bck" v-loading="loadingTwo">
       <TitleInfo :content="titleList[2]"></TitleInfo>
-      <div ref="echartDom" style="min-height: 400px"></div>
+      <div ref="echartDom" style="height: 40vh"></div>
     </div>
   </div>
 </template>

+ 314 - 0
src/views/dataBoard/board/salesAnalysis/index.vue

@@ -0,0 +1,314 @@
+<template>
+  <div class="content">
+    <div class="bck">
+      <el-form :inline="true" :model="queryForm">
+        <el-form-item label="">
+          <el-date-picker
+            v-model="queryForm.aa"
+            type="month"
+            placeholder="月份"
+            @change="onQuery"
+          />
+        </el-form-item>
+        <el-form-item label="">
+          <el-radio-group v-model="queryForm.bb" size="large" @change="onQuery">
+            <el-radio-button label="本日" />
+            <el-radio-button label="本周" />
+            <el-radio-button label="本月" />
+            <el-radio-button label="今年" />
+            <el-radio-button label="其他" />
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item>
+          <el-date-picker
+            v-model="queryForm.timeArr"
+            type="daterange"
+            unlink-panels
+            range-separator="-"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            value-format="YYYY-MM-DD"
+            @change="onQuery"
+          />
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" @click="onQuery">搜索</el-button>
+          <el-button type="defualt" @click="onReset">重置</el-button>
+        </el-form-item>
+      </el-form>
+    </div>
+    <div class="bck statistics" style="margin-top: 10px">
+      <div class="item first">
+        <div class="left_">
+          <div class="money">
+            {{ moneyFormat(0, 2) }}
+          </div>
+          <div>销售额({{ 0 }})</div>
+        </div>
+        <div class="right_">
+          <div class="icon">
+            <img src="@/assets/images/portrait/icon_sales.png" alt="" />
+          </div>
+        </div>
+      </div>
+      <div class="item two">
+        <div class="left_">
+          <div class="money">
+            {{ moneyFormat(0, 2) }}
+          </div>
+          <div>订单(单)</div>
+        </div>
+        <div class="right_">
+          <div class="icon">
+            <img src="@/assets/images/portrait/icon_profits.png" alt="" />
+          </div>
+        </div>
+      </div>
+      <div class="item three">
+        <div class="left_">
+          <div class="money">
+            {{ 0 }}
+          </div>
+          <div>下单客户数(人)</div>
+        </div>
+        <div class="right_">
+          <div class="icon">
+            <img src="@/assets/images/portrait/icon_email.png" alt="" />
+          </div>
+        </div>
+      </div>
+    </div>
+
+    <div class="bck scatter" style="margin-top: 10px">
+      <el-row>
+        <el-col :span="8">
+          <TitleInfo :content="titleList[0]"></TitleInfo>
+          <div ref="echartDom" style="height: 40vh"></div>
+        </el-col>
+        <el-col :span="16">
+          <byTable
+            :source="sourceList.scatterData"
+            :pagination="sourceList.scatterPagination"
+            :config="scatterConfig"
+            :loading="scatterLoading"
+            highlight-current-row
+            :selectConfig="[]"
+            @get-list="getList"
+          >
+          </byTable>
+        </el-col>
+      </el-row>
+    </div>
+  </div>
+</template>
+
+<script setup>
+import * as echarts from "echarts";
+
+import TitleInfo from "@/components/TitleInfo/index.vue";
+const titleList = [
+  "销售分布",
+  "客户分类",
+  "业务员销售趋势",
+  "商品销售额",
+  "商品销量",
+];
+const { proxy } = getCurrentInstance();
+const scatterLoading = ref(false);
+const loadingOne = ref(false);
+const loadingTwo = ref(false);
+const queryForm = reactive({
+  beginTime: "",
+  endTime: "",
+  timeArr: "",
+});
+const sourceList = ref({
+  scatterData: [],
+  scatterPagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+  },
+});
+//图表
+const echartDom = ref(null);
+let myChart = null;
+const option = reactive({
+  data: {
+    tooltip: {
+      trigger: "item",
+    },
+    legend: {
+      top: "0%",
+      left: "center",
+    },
+    series: [
+      {
+        name: "销售分布",
+        type: "pie",
+        radius: ["20%", "50%"],
+        avoidLabelOverlap: false,
+        itemStyle: {
+          borderRadius: 10,
+          borderColor: "#fff",
+          borderWidth: 2,
+        },
+        label: {
+          show: false,
+          position: "center",
+        },
+        emphasis: {
+          label: {
+            show: true,
+            fontSize: 40,
+            fontWeight: "bold",
+          },
+        },
+        labelLine: {
+          show: false,
+        },
+        data: [2000, 1000],
+      },
+    ],
+  },
+});
+const scatterConfig = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "序列",
+        prop: "receiptWarehouseName",
+      },
+    },
+    {
+      attrs: {
+        label: "国家",
+        prop: "receiptWarehouseName",
+      },
+    },
+    {
+      attrs: {
+        label: "订单量(单)",
+        prop: "receiptWarehouseName",
+      },
+    },
+    {
+      attrs: {
+        label: "交易金额(¥)",
+        prop: "amount",
+      },
+      render(amount) {
+        return proxy.moneyFormat(amount, 2);
+      },
+    },
+  ];
+});
+
+const getData = () => {
+  // loading.value = true;
+  loadingOne.value = true;
+  loadingTwo.value = true;
+  // proxy.post("/saleQuotation/sourceStatistics", queryForm).then((res) => {
+  //   allData.sourceData = res;
+  //   setTimeout(() => {
+  //     loading.value = false;
+  //   }, 200);
+  // });
+  // proxy.post("/saleQuotation/typeStatistics", queryForm).then((res) => {
+  //   allData.typeData = res;
+  //   setTimeout(() => {
+  //     loadingOne.value = false;
+  //   }, 200);
+  // });
+  proxy.post("/contract/salesStatistics", queryForm).then((res) => {
+    console.log(res, "aa");
+  });
+};
+
+const onQuery = () => {
+  queryForm.beginTime = queryForm.timeArr[0];
+  queryForm.endTime = queryForm.timeArr[1];
+  getData();
+};
+
+const onReset = () => {};
+onMounted(() => {
+  myChart = echarts.init(echartDom.value);
+  window.addEventListener("resize", () => {
+    myChart.resize();
+  });
+  myChart.setOption(option.data);
+  getData();
+});
+</script>
+
+<style lang="scss" scoped>
+.content {
+  margin: 20px;
+}
+:deep(.el-form-item) {
+  margin-bottom: 0px;
+}
+.bck {
+  background-color: #fff;
+  padding: 15px;
+}
+.statistics {
+  display: flex;
+  // justify-content: space-around;
+  .item {
+    border-radius: 10px;
+    margin-right: 20px;
+    width: 13vw;
+    height: 70px;
+    padding: 10px;
+    box-sizing: border-box;
+    display: flex;
+    justify-content: space-between;
+    .left_ {
+      display: flex;
+      flex-direction: column;
+      justify-content: space-around;
+      .money {
+        font-weight: 700;
+        color: #333333;
+        font-size: 15px;
+      }
+    }
+    .right_ {
+      .icon {
+        img {
+          width: 20px;
+          height: 20px;
+          margin-top: 6px;
+        }
+        width: 34px;
+        height: 34px;
+        margin-top: 10px;
+        border-radius: 8px;
+        background-color: #ffffff;
+        text-align: center;
+        line-height: 34px;
+      }
+    }
+  }
+  .first {
+    background: linear-gradient(#c7e3fe, #dfecff);
+  }
+  .two {
+    background: linear-gradient(#eae8fb, #ded9ff);
+  }
+  .three {
+    background: linear-gradient(#fcf1e4, #fce5ca);
+  }
+  .four {
+    background: linear-gradient(#e2fbe8, #e2fbe8);
+  }
+  .five {
+    background: linear-gradient(#ffebe9, #ffebe9);
+  }
+}
+.scatter {
+  // display: flex;
+}
+</style>