Explorar el Código

feature:更新经销商功能

liuyaqi hace 2 años
padre
commit
3846a6ada3

+ 3 - 0
src/api/base/distr.js

@@ -26,4 +26,7 @@ export default {
   getEntity(query) {
     return micro_request.postRequest(basePath, 'Distributor', 'GetEntityById', query)
   },
+  getDynamicsList(query) {
+    return micro_request.postRequest(basePath, 'Distributor', 'DynamicsList', query)
+  },
 }

+ 127 - 0
src/views/base/distributor/components/DetailsRecords.vue

@@ -0,0 +1,127 @@
+<!--
+ * @Author: liuzl 461480418@qq.com
+ * @Date: 2023-01-09 17:42:13
+ * @LastEditors: wanglj
+ * @LastEditTime: 2023-02-21 17:14:52
+ * @Description: file content
+ * @FilePath: \opms_frontend\src\views\contract\components\DetailsRecords.vue
+-->
+<template>
+  <ul class="records">
+    <li v-for="(value, key) in dynamicsList" :key="key">
+      <div class="date">
+        {{ key }}
+        <h2>{{ key.split('-')[2] }}</h2>
+        <h3>{{ key.split('-').splice(0, 2).join('.') }}</h3>
+      </div>
+      <ul class="content">
+        <li v-for="(item, index) in dynamicsList[key]" :key="index">
+          <!-- <el-avatar class="user-avatar"
+                           :src="avatar" /> -->
+          <vab-icon class="user-avatar" icon="account-circle-fill" />
+          <div class="text">
+            <p class="action">{{ item.opnPeople }} {{ item.opnType }}</p>
+            <p>{{ parseTime(item.opnDate, '{y}-{m}-{d}') }}</p>
+          </div>
+        </li>
+      </ul>
+    </li>
+  </ul>
+</template>
+
+<script>
+  export default {
+    name: 'Records',
+    props: {
+      dynamicsList: {
+        // eslint-disable-next-line vue/require-prop-type-constructor
+        type: Array | Object,
+        default: () => [],
+      },
+    },
+    data() {
+      return {}
+    },
+
+    mounted() {},
+
+    methods: {},
+  }
+</script>
+
+<style lang="scss" scoped>
+  .records {
+    margin: 0;
+    padding: 10px 20px;
+    list-style: none;
+    height: calc(100% - 60px);
+    margin-top: 6px;
+    overflow-y: auto;
+
+    > li {
+      display: flex;
+
+      & + li {
+        margin-top: 10px;
+      }
+    }
+
+    .date {
+      width: 100px;
+      display: flex;
+      flex-direction: column;
+      align-items: center;
+
+      h2,
+      h3 {
+        margin: 0;
+      }
+
+      h2 {
+        font-size: 26px;
+        line-height: 32px;
+      }
+    }
+
+    .content {
+      flex: 1;
+      list-style: none;
+
+      li {
+        display: flex;
+
+        & + li {
+          margin-top: 10px;
+        }
+      }
+
+      .user-avatar {
+        font-size: 40px;
+      }
+
+      .text {
+        flex: 1;
+        padding-left: 20px;
+
+        p {
+          font-weight: 500;
+          margin: 0;
+          line-height: 20px;
+
+          span {
+            color: #1d66dc;
+          }
+        }
+
+        p:nth-child(2) {
+          margin-bottom: 10px;
+        }
+
+        .action {
+          font-weight: bold;
+          color: #333;
+        }
+      }
+    }
+  }
+</style>

+ 77 - 47
src/views/base/distributor/components/DistrEdit.vue

@@ -13,28 +13,6 @@
           </el-form-item>
         </el-col>
       </el-row>
-      <el-row :gutter="20">
-        <el-col :span="12">
-          <el-form-item label="说明" prop="distDesc">
-            <el-input v-model.trim="form.distDesc" />
-          </el-form-item>
-        </el-col>
-        <el-col :span="12">
-          <el-form-item label="负责人" prop="distBoss">
-            <el-input v-model.trim="form.distBoss" />
-          </el-form-item>
-        </el-col>
-        <el-col :span="12">
-          <el-form-item label="电话" prop="distBossPhone">
-            <el-input v-model.trim="form.distBossPhone" />
-          </el-form-item>
-        </el-col>
-        <el-col :span="12">
-          <el-form-item label="业务范围" prop="businessScope">
-            <el-input v-model="form.businessScope" placeholder="请输入业务范围" />
-          </el-form-item>
-        </el-col>
-      </el-row>
       <el-row :gutter="20">
         <el-col :span="12">
           <el-form-item label="选择省份" prop="provinceDesc">
@@ -56,9 +34,6 @@
           </el-form-item>
         </el-col>
         <el-col :span="12">
-          <!-- <el-form-item label="销售人员" prop="businessScope">
-            <el-input v-model.trim="form.businessScope" />
-          </el-form-item> -->
           <select-user
             ref="selectUser"
             :query-params="{ roles: ['SalesEngineer', 'ProductLineManager'] }"
@@ -68,16 +43,52 @@
           </el-form-item>
         </el-col>
       </el-row>
-      <!-- <el-row :gutter="20">
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item label="注册资金/万元" prop="capital">
+            <el-input v-model.number="form.capital" />
+          </el-form-item>
+        </el-col>
         <el-col :span="12">
-          <el-form-item label="开票抬头" prop="invoiceHeader">
-            <el-input v-model="form.invoiceHeader" placeholder="请输入详细地址" />
+          <el-form-item label="注册地" prop="registerDistrict">
+            <el-input v-model.trim="form.registerDistrict" />
           </el-form-item>
         </el-col>
-      </el-row> -->
-      <el-form-item label="备注" prop="remark">
+      </el-row>
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item label="业务范围" prop="businessScope">
+            <el-input v-model.trim="form.businessScope" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="现有销售人数" prop="saleNum">
+            <el-input v-model.number="form.saleNum" />
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item label="授权客户类型" prop="customerType">
+            <el-select v-model="form.customerType" placeholder="授权客户类型" style="width: 100%">
+              <el-option v-for="item in customerOptions" :key="item.value" :label="item.value" :value="item.key" />
+            </el-select>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-form-item label="已有代理品牌和产品" prop="existedProduct">
         <el-input
-          v-model="form.remark"
+          v-model="form.existedProduct"
+          maxlength="500"
+          placeholder="请输入备注"
+          resize="none"
+          :rows="5"
+          show-word-limit
+          type="textarea" />
+      </el-form-item>
+      <el-form-item label="历史合作的终端客户名称" prop="historyCustomer">
+        <el-input
+          v-model="form.historyCustomer"
           maxlength="500"
           placeholder="请输入备注"
           resize="none"
@@ -106,29 +117,38 @@
     data() {
       return {
         form: {
-          dist: [],
+          distName: '',
+          abbrName: '',
+          provinceDesc: '',
+          provinceId: 0,
           belongSale: '',
-          invoiceHeader: '',
+          belongSaleId: 0,
+          capital: 0,
+          registerDistrict: '',
+          businessScope: '',
+          saleNum: 0,
+          customerType: '',
+          existedProduct: '',
+          historyCustomer: '',
         },
         dist: {
-          distName: [{ required: true, trigger: 'blur', message: '请输入名称' }],
-          distBoss: [{ required: true, trigger: 'blur', message: '请输入负责人' }],
-          distBossPhone: [
-            {
-              pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
-              message: '请输入正确的手机号码',
-              trigger: 'blur',
-              required: true,
-            },
-          ],
-          businessScope: [{ required: true, trigger: 'blur', message: '请填写业务范围' }],
-          provinceDesc: [{ required: true, trigger: 'blur', message: '请选择省份' }],
-          belongSale: [{ required: true, trigger: 'blur', message: '请填写归属销售' }],
+          distName: [{ required: true, trigger: 'blur', message: '请输入经销商名称' }],
+          provinceDesc: [{ required: true, trigger: 'blur', message: '请输入省份' }],
+          provinceId: [{ required: true, trigger: 'blur', message: '请输入省份' }],
+          belongSale: [{ required: true, trigger: 'blur', message: '请输入销售人员' }],
+          capital: [{ required: true, trigger: 'blur', message: '请输入注册资金' }],
+          registerDistrict: [{ required: true, trigger: 'blur', message: '请输入注册地' }],
+          businessScope: [{ required: true, trigger: 'blur', message: '请输入业务范围' }],
+          saleNum: [{ required: true, trigger: 'blur', message: '请输入现有销售人数' }],
+          customerType: [{ required: true, trigger: 'blur', message: '请输入授权客户类型' }],
+          existedProduct: [{ required: true, trigger: 'blur', message: '请输入已有代理品牌和产品' }],
+          historyCustomer: [{ required: true, trigger: 'blur', message: '请输入历史合作的终端客户名称' }],
         },
         //省份
         district: [],
         title: '',
         dialogFormVisible: false,
+        customerOptions: [],
       }
     },
     created() {
@@ -136,7 +156,17 @@
       // this.getProvinceInfo()
       this.getUserSalesProvince()
     },
+    mounted() {
+      this.getOptions()
+    },
     methods: {
+      getOptions() {
+        Promise.all([this.getDicts('dis_customer_type')])
+          .then(([data]) => {
+            this.customerOptions = data.data.values || []
+          })
+          .catch((err) => console.log(err))
+      },
       showEdit(row) {
         if (!row) {
           this.title = '新建'
@@ -182,8 +212,8 @@
         this.$refs['form'].validate(async (valid) => {
           if (valid) {
             console.log(this.form)
-            this.form.distBossPhone = this.form.distBossPhone.toString()
             this.form.provinceId = parseInt(this.form.provinceId)
+            this.form.distType = '10'
 
             if (this.form.id) {
               console.log('表单修改提交内容:', this.form)

+ 117 - 36
src/views/base/distributor/detail.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="detail">
-    <el-row :gutter="30">
-      <el-col :span="25">
+    <div class="side-layout">
+      <div class="info">
         <div class="title">
           <p>经销商</p>
           <h3>
@@ -9,59 +9,111 @@
           </h3>
         </div>
         <header>
-          <el-descriptions :colon="false" :column="10" direction="vertical" style="padding-top: 15px">
-            <el-descriptions-item
-              content-class-name="my-content"
-              label="经销商编码"
-              label-class-name="my-label"
-              style="width: auto">
-              {{ detail.distCode.substring(1, 7) }}
+          <el-descriptions :colon="false" :column="6" direction="vertical" style="padding-top: 15px">
+            <el-descriptions-item content-class-name="my-content" label="所在省" label-class-name="my-label">
+              {{ detail.provinceDesc }}
             </el-descriptions-item>
-            <el-descriptions-item content-class-name="my-content" label="经销商名称" label-class-name="my-label">
-              {{ detail.distName }}
+            <el-descriptions-item content-class-name="my-content" label="现有销售人数" label-class-name="my-label">
+              {{ detail.saleNum }}
             </el-descriptions-item>
-            <el-descriptions-item content-class-name="my-content" label="助记名" label-class-name="my-label">
-              {{ detail.abbrName }}
+            <el-descriptions-item content-class-name="my-content" label="ABC项目总数量" label-class-name="my-label">
+              {{ detail.projectNum }}
             </el-descriptions-item>
-            <el-descriptions-item content-class-name="my-content" label="负责人" label-class-name="my-label">
-              {{ detail.distBoss }}
+            <el-descriptions-item content-class-name="my-content" label="成交项目数量" label-class-name="my-label">
+              {{ detail.saledProjectNum }}
             </el-descriptions-item>
-            <el-descriptions-item content-class-name="my-content" label="负责人电话" label-class-name="my-label">
-              {{ detail.distBossPhone }}
+            <el-descriptions-item content-class-name="my-content" label="成交总金额" label-class-name="my-label">
+              {{ formatPrice(detail.saledAmount) }}
             </el-descriptions-item>
-            <el-descriptions-item content-class-name="my-content" label="销售人" label-class-name="my-label">
+            <el-descriptions-item content-class-name="my-content" label="归属人员" label-class-name="my-label">
               {{ detail.belongSale }}
             </el-descriptions-item>
-            <el-descriptions-item content-class-name="my-content" label="归属省份" label-class-name="my-label">
-              {{ detail.provinceDesc }}
-            </el-descriptions-item>
-            <el-descriptions-item content-class-name="my-content" label="业务范围" label-class-name="my-label">
-              {{ detail.businessScope }}
-            </el-descriptions-item>
-            <el-descriptions-item content-class-name="my-content" label="创建人" label-class-name="my-label">
-              {{ detail.createdName }}
-            </el-descriptions-item>
-            <el-descriptions-item content-class-name="my-content" label="创建时间" label-class-name="my-label">
-              {{ parseTime(detail.createdTime, '{y}-{m}-{d}') }}
-            </el-descriptions-item>
           </el-descriptions>
         </header>
-      </el-col>
-    </el-row>
+        <el-tabs v-model="activeName">
+          <el-tab-pane label="详细信息" name="details">
+            <el-descriptions border :column="2" size="medium" title="经销商详情">
+              <el-descriptions-item content-class-name="my-content" label="经销商名称" label-class-name="my-label">
+                {{ detail.distName }}
+              </el-descriptions-item>
+              <el-descriptions-item content-class-name="my-content" label="助记名称" label-class-name="my-label">
+                {{ detail.abbrName }}
+              </el-descriptions-item>
+              <el-descriptions-item content-class-name="my-content" label="业务范围" label-class-name="my-label">
+                {{ detail.businessScope }}
+              </el-descriptions-item>
+              <el-descriptions-item content-class-name="my-content" label="注册资金" label-class-name="my-label">
+                {{ detail.capital }}
+              </el-descriptions-item>
+              <el-descriptions-item content-class-name="my-content" label="注册地" label-class-name="my-label">
+                {{ detail.registerDistrict }}
+              </el-descriptions-item>
+              <el-descriptions-item content-class-name="my-content" label="授权客户类型" label-class-name="my-label">
+                {{ customerOptions[detail.customerType] }}
+              </el-descriptions-item>
+              <el-descriptions-item
+                content-class-name="my-content"
+                label="ABC项目出货总金额"
+                label-class-name="my-label">
+                {{ formatPrice(detail.allProductAmount) }}
+              </el-descriptions-item>
+              <el-descriptions-item content-class-name="my-content" label="未回款金额" label-class-name="my-label">
+                {{ formatPrice(detail.unpaidAmount) }}
+              </el-descriptions-item>
+              <el-descriptions-item
+                content-class-name="my-content"
+                label="已有代理品牌和产品"
+                label-class-name="my-label">
+                {{ detail.existedProduct }}
+              </el-descriptions-item>
+              <el-descriptions-item
+                content-class-name="my-content"
+                label="历史合作终端客户名称"
+                label-class-name="my-label">
+                {{ detail.historyCustomer }}
+              </el-descriptions-item>
+              <el-descriptions-item content-class-name="my-content" label="归属销售" label-class-name="my-label">
+                {{ detail.belongSale }}
+              </el-descriptions-item>
+              <el-descriptions-item content-class-name="my-content" label="销售人数" label-class-name="my-label">
+                {{ detail.saleNum }}
+              </el-descriptions-item>
+              <el-descriptions-item content-class-name="my-content" label="创建时间" label-class-name="my-label">
+                {{ parseTime(detail.createdTime, '{y}-{m}-{d}') }}
+              </el-descriptions-item>
+              <el-descriptions-item content-class-name="my-content" label="更新时间" label-class-name="my-label">
+                {{ parseTime(detail.updatedTime, '{y}-{m}-{d}') }}
+              </el-descriptions-item>
+            </el-descriptions>
+          </el-tab-pane>
+        </el-tabs>
+      </div>
+      <div class="info-side">
+        <div class="buttons">
+          <!-- <el-button v-permissions="['contract:manage:edit']" type="primary" @click="handleEdit">编辑</el-button>
+          <el-button v-permissions="['contract:manage:delete']" @click="handleDelete">删除</el-button> -->
+          <el-button @click="back">返回</el-button>
+        </div>
+        <details-records :dynamics-list="dynamicsList" />
+      </div>
+    </div>
   </div>
 </template>
 
 <script>
+  import to from 'await-to-js'
   import { mapGetters } from 'vuex'
   import api from '@/api/base/distr'
+  import DetailsRecords from './components/DetailsRecords'
   export default {
     name: 'DistributorDetail',
-    components: {},
+    components: { DetailsRecords },
     data() {
       return {
-        id: '',
+        id: 0,
         privateCus: '',
         list: [],
+        activeName: 'details',
         detail: {
           distCode: '', //经销商编码
           distName: '', //经销商名称
@@ -74,6 +126,8 @@
           createdName: '', //创建人名字
           createdTime: '', //创建时间
         },
+        customerOptions: {},
+        dynamicsList: [],
       }
     },
     computed: {
@@ -83,22 +137,49 @@
       }),
     },
     mounted() {
-      this.id = this.$route.query.id
+      this.id = parseInt(this.$route.query.id)
       this.privateCus = this.$route.query.privateCus
       this.init()
+      this.getOptions()
+      this.getRecord()
       //this.getDynamics()
     },
     methods: {
+      getOptions() {
+        Promise.all([this.getDicts('dis_customer_type')])
+          .then(([data]) => {
+            data.data.values.filter((i) => {
+              this.customerOptions[i.key] = i.value
+            })
+          })
+          .catch((err) => console.log(err))
+      },
       async init() {
-        Promise.all([api.getEntity({ id: parseInt(this.id) })]).then(([detail]) => {
+        Promise.all([api.getEntity({ id: this.id })]).then(([detail]) => {
           console.log('detail', detail)
           this.detail = detail.data.list
         })
       },
+      async getRecord() {
+        const [err, res] = await to(api.getDynamicsList({ distId: this.id }))
+        if (err) return
+        if (res.data.list) {
+          let obj = res.data.list
+          const keys = Object.keys(obj).reverse()
+          let records = {}
+          for (const item of keys) {
+            records[item] = obj[item]
+          }
+          this.dynamicsList = records
+        }
+      },
 
       setSelectRows(val) {
         this.selectRows = val
       },
+      back() {
+        this.$router.go(-1)
+      },
     },
   }
 </script>

+ 54 - 5
src/views/base/distributor/index.vue

@@ -28,13 +28,13 @@
         <vab-query-form>
           <vab-query-form-top-panel>
             <el-form :inline="true" :model="queryForm" @submit.native.prevent>
-              <el-form-item>
+              <!-- <el-form-item>
                 <el-input
                   v-model.trim="queryForm.distCode"
                   clearable
                   placeholder="经销商编码"
                   @keyup.enter.native="queryData" />
-              </el-form-item>
+              </el-form-item> -->
               <el-form-item>
                 <el-input
                   v-model.trim="queryForm.distName"
@@ -90,6 +90,18 @@
               <el-button v-if="item.prop === 'distName'" style="font-size: 14px" type="text" @click="handleDetail(row)">
                 {{ row.distName }}
               </el-button>
+              <span v-else-if="item.prop === 'allProductAmount'">
+                {{ formatPrice(row.allProductAmount) }}
+              </span>
+              <span v-else-if="item.prop === 'saledAmount'">
+                {{ formatPrice(row.saledAmount) }}
+              </span>
+              <span v-else-if="item.prop === 'unpaidAmount'">
+                {{ formatPrice(row.unpaidAmount) }}
+              </span>
+              <span v-else-if="item.prop === 'invoicedAmount'">
+                {{ formatPrice(row.invoicedAmount) }}
+              </span>
               <span v-else>{{ row[item.prop] }}</span>
             </template>
           </el-table-column>
@@ -140,6 +152,7 @@
         total: 0,
         selectRows: '',
         queryForm: {
+          distType: '10', // 10 经销商 20 代理商
           pageNum: 1,
           pageSize: 10,
           userName: '',
@@ -158,6 +171,42 @@
             prop: 'provinceDesc',
             sortable: false,
           },
+          {
+            label: 'ABC项目总数量',
+            width: '100px',
+            prop: 'projectNum',
+            sortable: false,
+          },
+          {
+            label: 'ABC项目出货总金额',
+            width: '100px',
+            prop: 'allProductAmount',
+            sortable: false,
+          },
+          {
+            label: '成交项目数量',
+            width: '100px',
+            prop: 'saledProjectNum',
+            sortable: false,
+          },
+          {
+            label: '成交总金额',
+            width: '100px',
+            prop: 'saledAmount',
+            sortable: false,
+          },
+          {
+            label: '未回款总金额',
+            width: '100px',
+            prop: 'unpaidAmount',
+            sortable: false,
+          },
+          {
+            label: '开票总金额',
+            width: '100px',
+            prop: 'invoicedAmount',
+            sortable: false,
+          },
           {
             label: '归属销售',
             width: '100px',
@@ -173,11 +222,11 @@
             disableCheck: true,
           },
           {
-            label: '负责人',
+            label: '创建时间',
             width: '100px',
-            prop: 'distBoss',
+            prop: 'createdTime',
             sortable: false,
-            disableCheck: true,
+            disableCheck: false,
           },
         ],
 

+ 3 - 0
src/views/contract/components/DetailsInfo.vue

@@ -69,6 +69,9 @@
       <el-descriptions-item content-class-name="my-content" label="合同类型" label-class-name="my-label">
         {{ contractOptions[details.contractType] }}
       </el-descriptions-item>
+      <el-descriptions-item content-class-name="my-content" label="经销商/代理商" label-class-name="my-label">
+        {{ details.distributorName }}
+      </el-descriptions-item>
       <el-descriptions-item content-class-name="my-content" label="创建人" label-class-name="my-label">
         {{ details.createdName }}
       </el-descriptions-item>

+ 8 - 3
src/views/contract/components/Edit.vue

@@ -95,10 +95,10 @@
       </el-row>
       <el-row :gutter="20">
         <el-col :span="12">
-          <el-form-item label="经销商" prop="distributorName">
+          <el-form-item label="经销商/代理商" prop="distributorName">
             <el-input
               v-model="editForm.distributorName"
-              placeholder="请选择经销商"
+              placeholder="请选择经销商/代理商"
               readonly
               suffix-icon="el-icon-search"
               @focus="openDistributor" />
@@ -409,7 +409,7 @@
         }
         // 现在还没有代理商
         if (this.editForm.signatoryType == '30') {
-          this.editForm.signatoryUnit = ''
+          this.editForm.signatoryUnit = this.editForm.distributorName
         }
       },
       // 关闭选择项目获取项目信息
@@ -426,6 +426,11 @@
         this.editForm.inchargeId = business.saleId
         this.editForm.inchargeName = business.saleName
         this.businessUserQueryParams = { busId: business.id, custId: business.custId }
+        this.editForm.signatoryType = business.salesModel
+        if (this.editForm.signatoryType == '20' || this.editForm.signatoryType == '30') {
+          this.editForm.distributorName = business.distributorName
+          this.editForm.distributorId = business.distributorId
+        }
         this.signatoryTypeChange()
         // 获取产品信息
         this.getProjectInfo(business.id)