Ver Fonte

fix:首页个人报表增加季度查询、项目增加产品详情,增加详情组件

liuzl há 2 anos atrás
pai
commit
193740407c

+ 2 - 2
api/base/distr.js

@@ -4,9 +4,9 @@ const basePath = process.uniEnv.VUE_APP_ParentPath
 export default {
   // 获取省列表
   getProvinceInfo(query) {
-    return micro_request.postRequest(basePath, 'District', 'GetProvinceList', query)
+    return micro_request.postRequest(basePath, 'District', 'GetList', query)
   },
-  // 获取列表
+  // 获取经销商列表
   getList(query) {
     return micro_request.postRequest(basePath, 'Distributor', 'GetList', query)
   },

+ 4 - 0
api/project/index.js

@@ -39,6 +39,10 @@ export default {
   upgrade(query) {
     return micro_request.postRequest(basePath, 'Business', 'BusinessUpgrade', query)
   },
+  // 产品详情
+  getBusinessProduct(query) {
+    return micro_request.postRequest(basePath, 'Business', 'GetBusinessProduct', query)
+  },
   businessUpgradeA(query) {
     return micro_request.postFormDataRequest(basePath, 'BusinessHandler', 'BusinessUpgradeA', query)
   },

+ 137 - 0
components/FormList/index.vue

@@ -0,0 +1,137 @@
+<!--
+ * @Author: liuzhenlin 461480418@qq.ocm
+ * @Date: 2023-03-09 14:30:53
+ * @LastEditors: liuzhenlin
+ * @LastEditTime: 2023-03-13 10:05:18
+ * @Description: file content
+ * @FilePath: \oms\pages\project\components\list.vue
+-->
+<template>
+  <view class="card-wrap">
+    <!-- 表单头部 -->
+    <view class="card-item" v-for="(item, index) in dataList" :key="index">
+      <view class="card-header">
+        <u-row>
+          <u-col :span="7">
+            <view class="no">{{ index + 1 }}</view>
+          </u-col>
+          <u-col :span="5">
+            <view class="flex">
+              <u-text customStyle="margin-right:20rpx" align="right" size="26rpx" color="#5B8DCD"></u-text>
+              <view class="flex1" v-if="item.open" @click="changeOpen(index, false)">
+                <u-text customStyle="margin-right:10rpx" size="26rpx" color="#5B8DCD" text="收起"></u-text>
+                <u-icon name="arrow-up"></u-icon>
+              </view>
+              <view class="flex1" v-else @click="changeOpen(index, true)">
+                <u-text customStyle="margin-right:10rpx" size="26rpx" color="#5B8DCD" text="展开"></u-text>
+                <u-icon name="arrow-down"></u-icon>
+              </view>
+            </view>
+          </u-col>
+        </u-row>
+      </view>
+      <!-- 内容 -->
+      <view class="content">
+        <view class="desc-area" v-if="!item.open">
+          <slot name="header" :dataItem="item"></slot>
+        </view>
+        <view class="form-area" v-else>
+          <view class="form-item" v-for="(v, i) in columns" :key="i">
+            <!-- label -->
+            <view class="form-label flex_l">
+              <view class="label-tag"></view>
+              {{ v.label }}
+            </view>
+            <!-- input -->
+            <u-textarea v-if="!v.customRender" autoHeight :disabled="v.disabled" v-model="item[v.prop]"></u-textarea>
+            <slot name="content" :dataItem="item" :propsss="v.prop" v-else></slot>
+          </view>
+        </view>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+  export default {
+    props: {
+      data: {
+        type: Object | Array,
+        required: true,
+        default: () => [],
+      },
+      columns: {
+        type: Object | Array,
+        required: true,
+        default: () => [],
+      },
+    },
+    data() {
+      return {
+        dataList: [],
+      }
+    },
+    mounted() {
+      this.dataList = this.data.map((item) => ({ ...item, open: true }))
+    },
+    methods: {
+      changeOpen(index, status) {
+        this.dataList[index].open = status
+      },
+      getData() {
+        let result = []
+        this.dataList.map((item) => {
+          console.log(item)
+          const { open, ...items } = item
+          console.log({ ...items })
+          result.push({ ...items })
+        })
+        console.log(result)
+      },
+    },
+    components: {},
+  }
+</script>
+
+<style lang="scss" scoped>
+  .card-item {
+    border-radius: 10px;
+    border: 1px solid #bdbdbd;
+    overflow: hidden;
+    margin-bottom: 20rpx;
+    .card-header {
+      padding: 20rpx 30rpx;
+      padding-bottom: 20rpx;
+      background: -webkit-linear-gradient(top, #eeeff3, #fbfbfd);
+      .no {
+        width: 50rpx;
+        height: 50rpx;
+        background: #78b0ed;
+        border-radius: 50%;
+        text-align: center;
+        line-height: 50rpx;
+        color: #fff;
+      }
+    }
+    .form-item {
+      padding-bottom: 30rpx;
+      .form-label {
+        font-size: 30rpx;
+        font-weight: bold;
+        color: #323232;
+        padding-bottom: 18rpx;
+
+        .label-tag {
+          width: 15rpx;
+          height: 15rpx;
+          background: #ff4d4f;
+          border-radius: 50%;
+          margin-right: 10rpx;
+        }
+      }
+    }
+    .content {
+      padding: 20rpx 30rpx;
+    }
+  }
+</style>

+ 1 - 1
pages/contract/components/contractProduct.vue

@@ -10,7 +10,7 @@
           </view>
           <view class="flex_l">
             <view class="label">产品型号:</view>
-            <view class="val">{{ prodCode }}</view>
+            <view class="val">{{ v.prodCode }}</view>
           </view>
           <view class="flex_l">
             <view class="label">单价:</view>

+ 8 - 8
pages/customer/add.vue

@@ -64,7 +64,7 @@
             clearable
             customStyle="padding: 0 30rpx 0 12rpx"></u-input>
         </u-form-item> -->
-        <u-form-item prop="source" borderBottom customStyle="padding:40rpx 0 30rpx" @click="showSource = true">
+        <u-form-item prop="custSource" borderBottom customStyle="padding:40rpx 0 30rpx" @click="showSource = true">
           <view class="form-label flex_l">
             <view class="label-tag"></view>
             客户来源
@@ -72,7 +72,7 @@
           <u-input
             :readonly="true"
             placeholder="请选择客户来源"
-            v-model="addForm.source"
+            v-model="addForm.custSource"
             border="none"
             suffixIcon="arrow-down"
             suffixIconStyle="color:#CDCDCD"
@@ -175,8 +175,8 @@
           industryId: null,
           // level: '', //级别
           // levelId: null,
-          source: '', //来源
-          sourceId: null,
+          custSource: '', //来源
+          custSourceId: null,
           remark: '', //备注
         },
         rules: {
@@ -198,7 +198,7 @@
           //   message: '请选择客户级别',
           //   trigger: ['blur', 'change'],
           // },
-          source: {
+          custSource: {
             type: 'string',
             required: true,
             message: '请选择客户来源',
@@ -253,8 +253,8 @@
       // },
       // 来源选择
       pickSource(e) {
-        this.addForm.sourceId = e.value[0].key
-        this.addForm.source = e.value[0].value
+        this.addForm.custSourceId = e.value[0].key
+        this.addForm.custSource = e.value[0].value
         this.showSource = false
       },
       // 初始化地区
@@ -358,7 +358,7 @@
               custIndustry: this.addForm.industry,
               // custLevel: this.addForm.level,
               custIndustry: this.addForm.industry,
-              source: this.addForm.source,
+              custSource: this.addForm.custSourceId,
               custLocation: this.addForm.area,
               remark: this.addForm.remark,
               custDistCode: this.selectLocation.value[0].id,

+ 128 - 20
pages/home/index.vue

@@ -2,7 +2,7 @@
  * @Author: liuzhenlin 461480418@qq.ocm
  * @Date: 2023-01-12 11:57:48
  * @LastEditors: liuzhenlin
- * @LastEditTime: 2023-03-06 16:46:52
+ * @LastEditTime: 2023-03-10 16:59:38
  * @Description: file content
  * @FilePath: \oms\pages\home\index.vue
 -->
@@ -149,7 +149,29 @@
         <view class="data-container">
           <h4>个人报表</h4>
           <view class="echarts" v-for="item in echarts" :key="item.id">
-            <h4>{{ item.report_name }}</h4>
+            <view class="flex">
+              <h4>{{ item.report_name }}</h4>
+              <view class="center" style="padding-left: 30rpx" v-if="item.id == 20006">
+                <u-button
+                  :text="saleVal"
+                  type="primary"
+                  size="mini"
+                  @click="
+                    showSaleType = true
+                    hideKeyboard()
+                  "></u-button>
+              </view>
+              <view class="center" style="padding-left: 30rpx" v-if="item.id == 20007">
+                <u-button
+                  :text="collectionVal"
+                  type="primary"
+                  size="mini"
+                  @click="
+                    showCollectionType = true
+                    hideKeyboard()
+                  "></u-button>
+              </view>
+            </view>
             <view class="chart">
               <l-echart :ref="item.id + ''" @finished="init(item.id)"></l-echart>
             </view>
@@ -205,6 +227,18 @@
       </view> -->
     </view>
     <view class="check" @click="toCheckIn">卡</view>
+    <u-action-sheet
+      :show="showSaleType"
+      :actions="quarter"
+      title="请选择季度"
+      @close="showSaleType = false"
+      @select="selectSaleVal"></u-action-sheet>
+    <u-action-sheet
+      :show="showCollectionType"
+      :actions="quarter"
+      title="请选择季度"
+      @close="showCollectionType = false"
+      @select="selectCollectionVal"></u-action-sheet>
   </view>
 </template>
 
@@ -218,6 +252,34 @@
     name: 'omsIndex',
     data() {
       return {
+        showSaleType: false,
+        showCollectionType: false,
+        saleVal: '全年',
+        collectionVal: '全年',
+        saleType: 0,
+        collectionType: 0,
+        quarter: [
+          {
+            name: '一季度',
+            type: 1,
+          },
+          {
+            name: '二季度',
+            type: 2,
+          },
+          {
+            name: '三季度',
+            type: 3,
+          },
+          {
+            name: '四季度',
+            type: 4,
+          },
+          {
+            name: '全年',
+            type: 0,
+          },
+        ],
         bannerList: [
           require('@/static/images/swiper/banner1.png'),
           require('@/static/images/swiper/banner2.png'),
@@ -270,6 +332,16 @@
       LEchart,
     },
     methods: {
+      selectSaleVal(e) {
+        this.saleVal = e.name
+        this.saleType = e.type
+        this.init(20006)
+      },
+      selectCollectionVal(e) {
+        this.collectionVal = e.name
+        this.collectionType = e.type
+        this.init(20007)
+      },
       async getReport(type) {
         this.tabDate = type
         let params = { viewInterval: this.tabDate }
@@ -335,17 +407,59 @@
       },
       async init(id) {
         // console.log(id, 'id')
-        const [err, res] = await to(
-          indexApi.getHomeDataReportData({
+        let params = {}
+        if (id == 20006) {
+          params = {
+            Params: { year: new Date().getFullYear(), quarter: this.saleType },
             id,
-          })
-        )
+          }
+        } else if (id == 20007) {
+          params = {
+            Params: { year: new Date().getFullYear(), quarter: this.collectionType },
+            id,
+          }
+        } else {
+          params = {
+            Params: {},
+            id,
+          }
+        }
+        const [err, res] = await to(indexApi.getHomeDataReportData(params))
+        console.log(res)
         if (err) return
+        let yAxis =
+          id == 20006 || id == 20007
+            ? [
+                {
+                  type: 'value',
+                  name: '金额(元)',
+                  alignTicks: true,
+                },
+              ]
+            : [
+                {
+                  type: 'value',
+                  name: '金额(元)',
+                  alignTicks: true,
+                },
+                {
+                  type: 'value',
+                  name: res.data.id == 20000 ? '签约完成率(%)' : '回款率(%)',
+                  min: 0,
+                  max: 100,
+                  alignTicks: true,
+                  interval: 20,
+                  axisLabel: {
+                    formatter: '{value} %',
+                  },
+                },
+              ]
         const option = {
           grid: {
-            bottom: 10,
-            top: 20,
+            bottom: 30,
+            top: 40,
             right: 10,
+            left: 10,
             containLabel: true,
           },
           tooltip: {
@@ -354,29 +468,23 @@
           xAxis: [
             {
               type: 'category',
-              data: res.data.data.xData,
+              data: res.data.data ? res.data.data.xData : [],
               axisTick: {
                 alignWithLabel: true,
               },
             },
           ],
-          yAxis: [
-            {
-              type: 'value',
-              name: '(元)',
-              nameLocation: 'start',
-            },
-          ],
+          yAxis,
           series: [
             {
               name: '销售指标',
               type: 'bar',
-              data: res.data.data.yDataTarget,
+              data: res.data.data ? res.data.data.yDataTarget : [],
             },
             {
               name: '销售额度',
               type: 'bar',
-              data: res.data.data.yDataReal,
+              data: res.data.data ? res.data.data.yDataReal : [],
             },
           ],
         }
@@ -610,7 +718,7 @@
           margin-bottom: 20rpx;
         }
         .echarts {
-          height: 480rpx;
+          height: 500rpx;
           box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
           border-radius: 31rpx 31rpx 31rpx 31rpx;
 
@@ -619,7 +727,7 @@
           }
 
           .chart {
-            height: 400rpx;
+            height: 420rpx;
           }
         }
       }

+ 12 - 2
pages/project/components/projectDetail.vue

@@ -2,7 +2,7 @@
  * @Author: liuzhenlin 461480418@qq.ocm
  * @Date: 2023-02-15 16:25:58
  * @LastEditors: liuzhenlin
- * @LastEditTime: 2023-02-17 17:16:54
+ * @LastEditTime: 2023-03-09 11:07:57
  * @Description: file content
  * @FilePath: \oms\pages\project\components\projectDetail.vue
 -->
@@ -33,7 +33,17 @@
         <u-col span="12">
           <view class="flex_l">
             <view class="label">预计成交价格:</view>
-            <view class="desc">{{ detail.estTransPrice }}</view>
+            <view class="desc">{{ formatPrice(detail.estTransPrice) }}</view>
+          </view>
+        </u-col>
+      </u-row>
+    </view>
+    <view class="info-item">
+      <u-row justify="space-between" gutter="10">
+        <u-col span="12">
+          <view class="flex_l">
+            <view class="label">出货金额:</view>
+            <view class="desc">{{ formatPrice(detail.estTransPrice) }}</view>
           </view>
         </u-col>
       </u-row>

+ 9 - 1
pages/project/create.vue

@@ -131,7 +131,11 @@
               clearable
               customStyle="padding: 0 30rpx 0 12rpx"></u-input>
           </u-form-item>
-          <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx" @click="$refs.dealer.open()">
+          <u-form-item
+            borderBottom
+            customStyle="padding:40rpx 0 30rpx"
+            @click="$refs.dealer.open()"
+            v-if="addForm.salesModel != '10'">
             <view class="form-label flex_l">
               <view class="label-tag"></view>
               经销商/代理商
@@ -630,6 +634,10 @@
       pickModel(e) {
         this.addForm.salesModel = e.value[0].key
         this.addForm.salesVal = e.value[0].value
+        if (e.value[0].key == '10') {
+          this.distributorId = ''
+          this.distributorName = ''
+        }
         this.showModel = false
       },
       // 是否大项目

+ 86 - 6
pages/project/details.vue

@@ -2,9 +2,9 @@
  * @Author: liuzhenlin 461480418@qq.ocm
  * @Date: 2023-01-12 11:57:48
  * @LastEditors: liuzhenlin
- * @LastEditTime: 2023-02-21 12:00:38
+ * @LastEditTime: 2023-03-13 14:45:47
  * @Description: file content
- * @FilePath: \frontend_mobile\pages\project\details.vue
+ * @FilePath: \oms\pages\project\details.vue
 -->
 <template>
   <view class="home">
@@ -82,9 +82,30 @@
         <!-- 跟进记录 -->
         <follow-records v-if="curTabIndex == 0" ref="follow" :projectId="projectId"></follow-records>
         <!-- 详情 -->
-        <project-detail v-if="curTabIndex == 1" :detail="projectData"></project-detail>
+        <project-detail v-else-if="curTabIndex == 1" :detail="projectData"></project-detail>
         <!-- 联系人 -->
-        <contacts v-if="curTabIndex == 2" :projectId="projectId"></contacts>
+        <contacts v-else-if="curTabIndex == 2" :projectId="projectId"></contacts>
+        <!-- 产品详情 -->
+        <form-list
+          v-else-if="curTabIndex == 3 && productList.length > 0"
+          :data="productList"
+          :columns="columns"
+          ref="list">
+          <template v-slot:header="{ dataItem }">
+            <view>{{ dataItem.prodName }}</view>
+          </template>
+          <template v-slot:content="{ dataItem, propsss }">
+            <!-- <view v-if="propsss === 'prodClass' && productList.length > 0">
+              <u-input
+                disabled
+                :value="selectDictLabel(productLineOptions, dataItem['prodClass'], productList)"></u-input>
+            </view> -->
+            <view v-if="propsss === 'prodPrice'">
+              <u-input disabled :value="'¥' + dataItem['prodPrice']"></u-input>
+            </view>
+          </template>
+          <view @click="$refs.list.getData()">获取数据</view>
+        </form-list>
       </view>
     </view>
     <!-- 新增按钮 -->
@@ -112,11 +133,45 @@
   import followRecords from './components/followRecords'
   import Contacts from './components/contacts'
   import TransferReserve from './components/transferReserve'
+  import FormList from '@/components/FormList/index'
   export default {
     name: 'omsIndex',
-    components: { projectDetail, followRecords, Contacts, TransferReserve },
+    components: { projectDetail, followRecords, Contacts, TransferReserve, FormList },
     data() {
       return {
+        columns: [
+          {
+            prop: 'prodCode',
+            label: '产品编码',
+            disabled: true,
+          },
+          {
+            prop: 'prodName',
+            label: '产品名称',
+            disabled: true,
+          },
+          // {
+          //   prop: 'prodClass',
+          //   label: '产品类别',
+          //   customRender: true,
+          // },
+          {
+            prop: 'prodPrice',
+            label: '产品单价',
+            customRender: true,
+          },
+          {
+            prop: 'prodNum',
+            label: '数量',
+            disabled: true,
+          },
+          {
+            prop: 'totalPrice',
+            label: '合计',
+            disabled: true,
+          },
+        ],
+        productList: [],
         openBtnWidth: false,
         curTabIndex: 0,
         fllowList: [], //跟进数据
@@ -133,6 +188,10 @@
             name: '联系人',
             index: 2,
           },
+          {
+            name: '产品信息',
+            index: 3,
+          },
         ],
         height: '',
         paddingTop: '',
@@ -155,7 +214,17 @@
     onShow() {
       this.getProjectDetail()
     },
+    watch: {
+      curTabIndex(idx) {
+        if (idx == 3) {
+          this.getProductList()
+        }
+      },
+    },
     methods: {
+      dictLabel(datas, value) {
+        return '32322332'
+      },
       getOptions() {
         Promise.all([
           // this.getDicts('proj_sales_model'),
@@ -169,12 +238,23 @@
           })
           .catch((err) => console.log(err))
       },
+      async getProductList() {
+        const [err, res] = await to(projectApi.getBusinessProduct({ id: this.projectId }))
+        if (err) return
+        if (res && res.code == 200) {
+          console.log(res)
+          this.productList = res.data
+        }
+      },
       async getProjectDetail() {
         const [err, res] = await to(projectApi.getDetail({ id: this.projectId }))
         if (err) return
         if (res && res.code == 200) {
-          this.$refs.follow.getRecords()
           this.projectData = res.data
+          //跟进记录
+          if (this.curTabIndex == 0) {
+            this.$refs.follow.getRecords()
+          }
         }
       },
       // 改变tab

+ 4 - 0
pages/project/index.vue

@@ -93,6 +93,10 @@
                   <text class="info-label">项目预算:</text>
                   <u-text color="#323232" size="24rpx" :text="formatPrice(v.nboBudget)"></u-text>
                 </view>
+                <view class="info-row flex_l">
+                  <text class="info-label">出货金额:</text>
+                  <u-text color="#323232" size="24rpx" :text="formatPrice(v.estTransPrice)"></u-text>
+                </view>
                 <view class="flex_l">
                   <view class="transfer-btn mr20" @click.stop="linkToTransfer(v.id)">
                     <u-button type="primary" size="small" text="转移项目"></u-button>

+ 2 - 0
pages/publicPages/follow.vue

@@ -95,6 +95,7 @@
       <!-- 选择下次时间 -->
       <u-datetime-picker
         v-if="showDate"
+        :maxDate="maxDate"
         :show="showDate"
         mode="datetime"
         v-model="addForm.date"
@@ -130,6 +131,7 @@
         paddingTop: '',
         showMode: false, //选择行业
         showDate: false,
+        maxDate: new Date() * 1,
         modeColumns: [
           [
             {

+ 4 - 3
utils/index.js

@@ -267,12 +267,13 @@ export function shuffle(array) {
 export function formatPrice(price, currency = 'CNY') {
   if (!price) price = 0
   // return price.toLocaleString('zh-CN', { style: 'currency', currency })
-  return '¥' + String(price).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
+  return '¥' + String(price).replace(/\B(?=(\d{3})+(?!\d))/g, ',')
 }
 
 // 回显数据字典
-export function selectDictLabel(datas, value) {
-  if (!datas) {
+export function selectDictLabel(datas, value, productList) {
+  console.log(datas, productList)
+  if (!datas || datas.length == 0) {
     return value
   }
   var actions = []