Browse Source

接口联调2,加loading

cxmo 1 year ago
parent
commit
f8c30bd315

+ 18 - 0
src/api/modules/overseasCustom.js

@@ -54,6 +54,24 @@ export const overseasCustomInterence = {
      */
     setCustomTryStatus:(params)=>{
         return http.post('/overseas_custom/custom/overseas_label_set',params)
+    },
+    /**
+     * 设置客户隐藏/取消隐藏
+     * @param {Object} params 
+     * @param {Number} params.CompanyId
+     * @returns 
+     */
+    setCustomHide:(params)=>{
+        return http.post('/overseas_custom/custom/hide',params)
+    },
+    /**
+     * 设置客户状态为正式/重置
+     * @param {Object} params
+     * @param {Number} params.CompanyId
+     * @returns 
+     */
+    setCustomStatus:(params)=>{
+        return http.post('/overseas_custom/custom/status_set',params)
     }
 
 }

+ 26 - 10
src/views/custom_manage/overseasList/components/roadShowsDialog.vue

@@ -5,11 +5,11 @@
         :close-on-click-modal="false"
         :modal-append-to-body="false"
         @close="$emit('close')"
-        width="692px"
+        width="842px"
         v-dialogDrag
         center
     >
-        <div class="table-wrap">
+        <div class="table-wrap" v-loading="tableLoading">
             <p>累计路演次数:{{dataList.length}}</p>
             <el-table :data="dataList" border @sort-change="clickNumSortChange" v-loading="showLoading" element-loading-text="加载中">
                 <el-table-column  v-for="column in columns" :key="column.key" :label="column.label" align="center" :prop="column.key">
@@ -23,6 +23,7 @@
 </template>
 
 <script>
+import { customInterence } from "@/api/api.js";
 export default {
     props:{
         isRoadDetailShow:{
@@ -38,21 +39,22 @@ export default {
         return {
             columns:[{
                 label:"路演日期",
-                key:'date'
+                key:'RoadShowTime'
             },{
                 label:"路演形式",
-                key:'way'
+                key:'RoadshowType'
             },{
                 label:"路演平台/路演城市",
-                key:'plantform'
+                key:'RoadshowPlatform'
             },{
                 label:"研究员",
-                key:'researcher'
+                key:'Researchers'
             },{
                 label:"对接销售",
-                key:'saler'
+                key:'SysUserRealName'
             }],
-            dataList:[]
+            dataList:[],
+            tableLoading:false,
         };
     },
     watch:{
@@ -64,12 +66,26 @@ export default {
     },
     methods: {
         getTableData(){
-
+            //只管中文的
+            if(this.customData.Source===2){
+                this.tableLoading = true
+                customInterence.roadShowList({
+                    CompanyId:this.customData.CompanyId
+                }).then(res=>{
+                    this.tableLoading = false
+                    if(res.Ret!==200) return 
+                    this.dataList = res.Data||[]
+                })
+            }
         }
     },
 };
 </script>
 
 <style scoped lang="scss">
-
+.table-wrap{
+    .el-table{
+        margin:20px 0 30px 0;
+    }
+}
 </style>

+ 12 - 3
src/views/custom_manage/overseasList/components/selectSaleDialog.vue

@@ -9,7 +9,7 @@
         v-dialogDrag
         center
     >
-        <div class="dialog-content-wrap">
+        <div class="dialog-content-wrap" v-loading="dialogLoading">
             <el-cascader v-model="sales" 
                 ref="saleCascader"
                 placeholder="请选择销售"
@@ -60,7 +60,8 @@ export default {
             sales:[],
             selectList:[],
             saleCascaderKey:0,
-            AllSalesArr:[]
+            AllSalesArr:[],
+            dialogLoading:false,
         };
     },
     watch:{
@@ -74,14 +75,22 @@ export default {
         //获取销售列表
         //由于中英文客户的销售列表不一致,获取系统全部人员列表作为销售列表
         getSalesList(){
+            this.dialogLoading = true
             dataAuthInterface.userSearch().then(res=>{
-                if(res.Ret!==200) return 
+                if(res.Ret!==200) {
+                    this.dialogLoading = false
+                    this.AllSalesArr = []
+                    this.sales=[]
+                    this.selectList=[]
+                    return 
+                }
                 this.AllSalesArr = res.Data||[]
                 //有选择的指标,回显
                 if(this.selectedSalesArr.length){
                     this.sales = this.selectedSalesArr.map(i=>(i.SellerId))
                     this.$nextTick(()=>{
                         this.changeSelect()
+                        this.dialogLoading = false
                     })
                 }
             })

+ 46 - 19
src/views/custom_manage/overseasList/components/totalClicksDialog.vue

@@ -5,13 +5,15 @@
         :close-on-click-modal="false"
         :modal-append-to-body="false"
         @close="$emit('close')"
-        width="692px"
+        width="842px"
         v-dialogDrag
         center
     >
-        <div class="table-wrap">
+        <div class="table-wrap" v-loading="tableLoading">
             <el-table :data="dataList" border @sort-change="clickNumSortChange" v-loading="showLoading" element-loading-text="加载中">
-                <el-table-column  v-for="column in columns" :key="column.key" :label="column.label" align="center" :prop="column.key">
+                <el-table-column  v-for="column in columns" :key="column.key" 
+                    :label="column.label" align="center" :prop="column.key"
+                    :sortable="column.sortable?'custom':false">
                     <template slot-scope="{row}">
                     {{row[column.key]}}
                     </template>
@@ -20,16 +22,17 @@
             <el-pagination 
                 layout="total,prev,pager,next,jumper" 
                 background 
-                :current-page="tableParams.page"
+                :current-page="tableParams.CurrentIndex"
                 @current-change="handlePageChange"
-                :page-size="tableParams.pageSize"
+                :page-size="tableParams.PageSize"
                 :total="total"
-                style="text-align: right;margin-top:20px"/>
+                style="text-align: right;margin-top:20px;margin-bottom:20px;"/>
         </div>
     </el-dialog>
 </template>
 
 <script>
+import { customInterence } from '@/api/api.js'
 export default {
     props:{
         customData:{
@@ -45,10 +48,10 @@ export default {
         isTotalClickShow(newVal){
             if(newVal){
                 this.tableParams = {
-                    page:1,
-                    pageSize:5,
-                    sortParams:'',
-                    sortType:'',
+                    CurrentIndex:1,
+                    PageSize:5,
+                    SortParam:'',
+                    SortType:'',
                 }
                 this.getTableData()
             }
@@ -62,32 +65,56 @@ export default {
                 key:"UserName"
             },{
                 label:"手机号/邮箱",
-                key:"mobile"
+                key:"Email"
             },{
                 label:"点击次数",
-                key:"ViewTotal"
+                key:"ViewTotal",
+                sortable:true
             },{
                 label:"最近点击时间",
-                key:"LastViewTime"
+                key:"LastViewTime",
+                sortable:true
             }],
             tableParams:{
-                page:1,
-                pageSize:5,
-                sortParams:'',
-                sortType:'',
+                CurrentIndex:1,
+                PageSize:5,
+                SortParam:'',
+                SortType:'',
             },
             total:0,
+            tableLoading:false,
         };
     },
     methods: {
         getTableData(){
-            //customData.customId
-            //获取到数据后,判断有无手机号,无手机号才显示邮箱
+            //目前只有英文的
+            if(this.customData.Source===1){
+                this.tableLoading = true
+                customInterence.customEnHitNumber({
+                    ...this.tableParams,
+                    CompanyId:this.customData.CompanyId - 10000000,
+                    EmailId:this.customData.CompanyId - 10000000,
+                }).then(res=>{
+                    this.tableLoading = false
+                    if(res.Ret!==200) return 
+                    this.dataList = res.Data.List || []
+                    this.total = res.Data.Paging.Totals
+                })
+            }
         },
         handlePageChange(page){
             this.tableParams.page = page
             this.getTableData()
         },
+        clickNumSortChange({prop,order}){
+            const map = {
+                'ViewTotal':1,
+                'LastViewTime':2
+            }
+            this.tableParams.SortParam = order?map[prop]:''
+            this.tableParams.SortType = order=="ascending"?2:order=="descending"?1:0
+            this.handlePageChange(1)
+        }
     },
 };
 </script>

+ 61 - 9
src/views/custom_manage/overseasList/overseasCustomList.vue

@@ -28,7 +28,7 @@
                 />
             </div>
         </div>
-        <div class="data-box">
+        <div class="data-box" v-loading="tableLoading">
             <div class="data-select-box">
                 <div class="table-select-box">
                     <ul class="status-box">
@@ -53,10 +53,27 @@
                 <div class="data-select" v-if="isDataSelectBtnShow&&this.tableData.length">
                     <el-button type="text" @click="isSelectSaleShow=true"><i class="el-icon-plus"  style="font-weight: bold;margin-right: 5px;"/>选择销售</el-button>
                 </div>
+                <!--非管理员 筛选-->
                 <div class="data-select" v-if="!isDataSelectBtnShow" style="flex:1;">
                     <div class="select-box" style="display: flex;justify-content: flex-end;gap: 30px;">
-                        <el-select placeholder="请选择销售" style="max-width: 240px;"></el-select>
-                        <el-input  prefix-icon="el-icon-search" placeholder="客户名称/社会信用码/手机号码/邮箱" style="max-width:317px;"></el-input>
+                        <el-select placeholder="请选择销售" v-if="pageSelect===1"
+                            v-model="tableParams.SellerId" 
+                            @change="handlePageChange(1)"
+                            multiple collapse-tags clearable>
+                            <el-option
+                                v-for="item in salesArr"
+                                :key="item.SellerId"
+                                :label="item.RealName"
+                                :value="item.SellerId"
+                            />
+                        </el-select>
+                        <el-input 
+                            prefix-icon="el-icon-search" 
+                            placeholder="客户名称/社会信用码/手机号码/邮箱" 
+                            style="width:317px;" clearable
+                            v-model="tableParams.Keywords"
+                            @input="handlePageChange(1)"
+                        />
                     </div>
                 </div>
             </div>
@@ -98,14 +115,19 @@
                             </div>
                             <span v-else-if="item.key==='ViewTotal'" :class="{'editor':row[item.key]>0}" @click="handleDialogShow('click',row)">{{row[item.key]}}</span>
                             <span v-else-if="item.key==='RoadShowTotal'" :class="{'editor':row[item.key]>0}" @click="handleDialogShow('road',row)">{{row[item.key]}}</span>
+                            <span v-else-if="['LastViewTime','CreateTime'].includes(item.key)">{{row[item.key].slice(0,10)}}</span>
                             <span v-else>{{row[item.key]}}</span>
                         </template>
                     </el-table-column>
                     <!-- 管理员展示操作列 -->
                     <el-table-column label="操作" align="center" v-if="isDataSelectBtnShow">
                         <template slot-scope="{row}">
-                            <el-button type="text">{{pageSelect===1?'隐藏':'取消隐藏'}}</el-button>
-                            <el-button type="text" v-if="pageSelect===1">转正式</el-button>
+                            <el-button type="text" v-if="pageSelect===1&&row.IsHide===0" @click="handleSetCustomHide(row)">隐藏</el-button>
+                            <el-button type="text" v-if="pageSelect===2&&row.IsHide===1" @click="handleSetCustomHide(row)">取消隐藏</el-button>
+                            <!--英文客户且状态为试用-->
+                            <el-button type="text" v-if="pageSelect===1&&row.Source===1&&row.CompanyStatus==='试用'" @click="handleSetCustomStatus(row,'change')">转正式</el-button>
+                            <!--英文客户且OverseasStatus为正式-->
+                            <el-button type="text" v-if="pageSelect===1&&row.Source===1&&row.OverseasStatus==='正式'" @click="handleSetCustomStatus(row,'reset')">重置</el-button>
                         </template>
                     </el-table-column>
                     <template slot="empty">
@@ -215,7 +237,10 @@ export default {
             isSelectSaleShow: false, //选择销售弹窗
             isTotalClickShow:false, //累计点击量弹窗
             isRoadDetailShow:false, //路演详情弹窗
-            customData:{},
+            customData:{},//选择的客户信息
+
+            tableLoading:false,
+
         };
     },
     computed: {
@@ -260,7 +285,9 @@ export default {
                 this.isSelectSaleShow = false
             })
         },
+        //客户列表
         getTableData() {
+            this.tableLoading = true
             const {Keywords,SortField,SortDesc,SellerId,CompanyStatus,tryStatusSelect} = this.tableParams
             overseasCustomInterence.getCustomList({
                 PageSize: this.pageSize,
@@ -269,9 +296,9 @@ export default {
                 SellerId:(Array.isArray(SellerId)?SellerId.join(','):'')+'',
                 OverseasLabel:tryStatusSelect,
                 CustomType:this.pageSelect,
-                SortField:'ViewTotal',
-                SortDesc:1,
+                SortField,SortDesc,
             }).then(res=>{
+                this.tableLoading = false
                 if(res.Ret!==200) return 
                 if(!res.Data) return 
                 //客户状态
@@ -308,7 +335,13 @@ export default {
             this.tableParams.tryStatusSelect = item.OverseasLabel
             this.handlePageChange(1);
         },
-        handleSortChange() { },
+        //列表排序
+        handleSortChange({prop,order}) {
+            this.tableParams.SortDesc = order==='ascending'?2:1
+            this.tableParams.SortField = order?prop:'ViewTotal'
+            this.handlePageChange(1)
+         },
+        //切换页码
         handlePageChange(page) {
             this.currentPage = page;
             this.getTableData();
@@ -327,6 +360,7 @@ export default {
             const href = this.$router.resolve({path,query}).href
             window.open(href,"_blank")
         },
+        //设置客户的试用状态
         handleChangeTryStatus(data) {
             const { OverseasLabel, CompanyId } = data;
             overseasCustomInterence.setCustomTryStatus({
@@ -337,14 +371,32 @@ export default {
                 this.getTableData()
             })
         },
+        //打开累计点击量/路演数量弹窗
         handleDialogShow(type,data){
             this.customData = data
             if(type==='click'){
+                if(!data.ViewTotal>0) return
                 this.isTotalClickShow = true
             }else{
+                if(!data.RoadShowTotal>0) return
                 this.isRoadDetailShow = true
             }
         },
+        //设置客户隐藏/取消隐藏
+        handleSetCustomHide({CompanyId}){
+            overseasCustomInterence.setCustomHide({CompanyId}).then(res=>{
+                if(res.Ret!==200) return 
+                this.$message.success(`设置${this.pageSelect===1?'隐藏':'取消隐藏'}成功`)
+                this.handlePageChange(1)
+            })
+        },
+        handleSetCustomStatus({CompanyId},type){
+            overseasCustomInterence.setCustomStatus({CompanyId}).then(res=>{
+                if(res.Ret!==200) return 
+                this.$message.success(`${type==='reset'?'重置':'转正式'}成功`)
+                this.handlePageChange(1)
+            })
+        },
     },
     mounted() {
         this.getSavedSales()