Bladeren bron

客户管理模块完成

fanghuisheng 1 jaar geleden
bovenliggende
commit
206a31b742
4 gewijzigde bestanden met toevoegingen van 309 en 1 verwijderingen
  1. 10 0
      src/api/common/customManage.js
  2. 7 0
      src/pages.json
  3. 252 0
      src/pages/common/customManage/index.vue
  4. 40 1
      src/plugins/common.plugins.js

+ 10 - 0
src/api/common/customManage.js

@@ -0,0 +1,10 @@
+import { request } from "@/utils/request";
+
+//消息列表-查询
+export function crmCustomInfo(param) {
+    return request({
+        url: "/service-iot/crmCustomInfo/page",
+        method: "POST",
+        data: param,
+    });
+}

+ 7 - 0
src/pages.json

@@ -126,6 +126,13 @@
             "enablePullDownRefresh": false
           }
         },
+        {
+          "path": "customManage/index",
+          "style": {
+            "navigationBarTitleText": "客户管理",
+            "enablePullDownRefresh": false
+          }
+        },
         {
           "path": "success/index",
           "style": {

+ 252 - 0
src/pages/common/customManage/index.vue

@@ -0,0 +1,252 @@
+<template>
+  <oa-scroll
+    class="scroll-height"
+    :pageSize="pageSize"
+    :total="total"
+    :refresherLoad="true"
+    :refresherEnabled="true"
+    :refresherDefaultStyle="'none'"
+    :refresherThreshold="44"
+    :refresherBackground="'#f5f6f7'"
+    @load="load"
+    @refresh="refresh"
+  >
+    <template #default>
+      <view class="customManage-container" :data-theme="'theme-' + proxy.$settingStore.themeColor.name">
+        <view class="flex bg-white padding-10" style="position: relative">
+          <u--input
+            v-model="projectName"
+            placeholder="搜索"
+            prefixIcon="search"
+            prefixIconStyle="font-size: 22px;color: #909399"
+            customStyle="height:30px;background-color:#f5f6fa;"
+            @confirm="selectListApi()"
+            clearable
+          ></u--input>
+          <view class="margin-l-10" style="margin-top: auto; margin-bottom: auto" @click="dropdownShow = !dropdownShow">筛选</view>
+        </view>
+
+        <view class="dropdown" :class="dropdownShow ? 'show' : 'none'">
+          <view class="padding-10">
+            <u-radio-group v-model="radioValue" placement="column" iconPlacement="right" @change="radioChange">
+              <u-radio v-for="ra in radioList" :key="ra" :activeColor="proxy.$settingStore.themeColor.color" :label="ra.label" :name="ra.value"></u-radio>
+            </u-radio-group>
+          </view>
+        </view>
+        <view class="dropdown" :class="dropdownShow ? 'mask' : 'none'" @click="dropdownShow = !dropdownShow"> </view>
+
+        <view class="container-area menu-list margin-lr-0" v-for="data in dataList" :key="data">
+          <view class="list-cell" style="color: #666666; line-height: 30px">
+            <view class="menu-item-box" style="font-size: 16px; font-weight: 600">
+              <view> {{ data.projectName }} </view>
+            </view>
+            <view class="menu-item-box" style="font-size: 13px">
+              <view style="width: 50%"> 项目编号:{{ data.projectId }} </view>
+              <view style="width: 50%"> 到期时间:{{ data.expireTime ? data.expireTime.split("T")[0] : "" }} </view>
+            </view>
+            <view class="menu-item-box" style="font-size: 13px">
+              <view style="width: 50%"> 客户负责人:{{ data.customPerson }} </view>
+              <view style="width: 50%"> 维保费:¥{{ data.maintainAmount }} </view>
+            </view>
+            <view class="menu-item-box" style="font-size: 13px">
+              <view style="width: 50%; display: flex">
+                客户电话:{{ data.phone }}
+                <view class="iconfont ucicon-a-copy menu-icon" style="font-size: 14px; color: #909399; margin-left: 5px" @click="copy(data.phone)"> </view>
+              </view>
+              <view style="width: 50%"> 状态:{{ data.maintainStatus == 1 ? "使用中" : "已到期" }} </view>
+            </view>
+            <view class="menu-item-box" style="font-size: 13px">
+              <view> 客户地址:{{ data.customAddress }} </view>
+            </view>
+          </view>
+        </view>
+      </view>
+    </template>
+  </oa-scroll>
+</template>
+
+<script setup>
+import { onLoad, onShow, onReady, onHide, onLaunch, onNavigationBarButtonTap, onPageScroll } from "@dcloudio/uni-app";
+import { ref, reactive, computed, getCurrentInstance, toRefs, inject } from "vue";
+import { publicStores, useStores } from "@/store/modules/index";
+
+import { crmCustomInfo } from "@/api/common/customManage.js";
+
+const { proxy } = getCurrentInstance();
+
+const dataList = ref([]);
+const pageSize = ref(20);
+const current = ref(1);
+const total = ref(0);
+
+const data = reactive({
+  radioList: [
+    {
+      label: "全部",
+      value: "",
+    },
+    {
+      label: "7天",
+      value: 7,
+    },
+    {
+      label: "30天",
+      value: 30,
+    },
+    {
+      label: "90天",
+      value: 90,
+    },
+  ],
+  radioValue: "",
+  startTime: "",
+  endTime: "",
+  projectName: "",
+  dropdownShow: false,
+});
+
+const { radioList, radioValue, startTime, endTime, projectName, dropdownShow } = toRefs(data);
+
+/**
+ * @初始化
+ */
+function init() {
+  selectListApi();
+}
+
+/**
+ * @列表查询
+ * @api接口调用
+ */
+function selectListApi() {
+  crmCustomInfo({
+    projectName: projectName.value,
+    current: current.value,
+    size: pageSize.value,
+    endTime: endTime.value,
+    startTime: startTime.value,
+  }).then((requset) => {
+    if (requset.status === "SUCCESS") {
+      dataList.value = requset.data.rows;
+      total.value = requset.data.total;
+    }
+  });
+}
+
+/**
+ * @复制粘贴板
+ */
+function copy(value) {
+  // 触发方法
+  proxy.$common.uniCopy({
+    content: value,
+    success: (res) => {
+      uni.showToast({
+        title: res,
+        icon: "none",
+      });
+    },
+    error: (e) => {
+      uni.showToast({
+        title: e,
+        icon: "none",
+        duration: 3000,
+      });
+    },
+  });
+}
+
+/**
+ * @单选change事件
+ */
+function radioChange(e) {
+  radioValue.value = e;
+  if (e) {
+    let getDays = proxy.$common.getDays(e);
+    startTime.value = getDays.startTime;
+    endTime.value = getDays.endTime;
+  }
+  selectListApi();
+}
+
+/**
+ * @scrollView加载数据
+ */
+function load() {
+  pageSize.value += 10;
+  selectListApi();
+}
+
+/**
+ * @scrollView刷新数据
+ */
+function refresh() {
+  radioValue.value = "";
+  startTime.value = "";
+  endTime.value = "";
+  pageSize.value = 20;
+  total.value = 0;
+  selectListApi();
+}
+
+onLoad((options) => {
+  init();
+});
+
+onReady(() => {});
+
+onShow(() => {
+  //调用系统主题颜色
+  proxy.$settingStore.systemThemeColor([1]);
+});
+
+// 自定义导航事件
+onNavigationBarButtonTap((e) => {
+  if (e.float == "right") {
+  }
+});
+</script>
+
+<style lang="scss" scoped>
+:deep(.uni-page-head__title) {
+  opacity: 1 !important;
+}
+
+.customManage-container {
+  .container-area {
+  }
+
+  .dropdown {
+    position: absolute;
+    width: 100%;
+    background-color: #fff;
+    max-height: 0;
+    overflow: hidden;
+    z-index: 90;
+
+    &.show {
+      animation: dropdown 3s ease forwards;
+    }
+
+    &.mask {
+      position: fixed;
+      top: 0;
+      left: 0;
+      right: 0;
+      bottom: 0;
+      background-color: transparent;
+      max-height: 100%;
+      z-index: 50;
+    }
+  }
+
+  @keyframes dropdown {
+    from {
+      max-height: 0;
+    }
+    to {
+      max-height: 100%;
+    }
+  }
+}
+</style>

+ 40 - 1
src/plugins/common.plugins.js

@@ -96,5 +96,44 @@ export default {
       var newTime = time.split(" ")[0]
       return newTime
     }
-  }
+  },
+
+  /**
+   * @指定获取当前时间前几天的日期
+   */
+  getDays(value) {
+    let oneDay = 24 * 60 * 60 * 1000;
+    let endTime = new Date(Date.now());
+    endTime = this.formatterDate(endTime, "yyyy-MM-dd");
+    let startTime = new Date(Date.now() - value * oneDay);
+    startTime = this.formatterDate(startTime, "yyyy-MM-dd");
+    const days = {
+      startTime,
+      endTime,
+    };
+    return days;
+  },
+
+  /**
+   * @处理公共日期格式
+   */
+  formatterDate(date, fmt) {
+    let nowDate = {
+      yyyy: date.getFullYear(), // 年
+      MM: date.getMonth() + 1, // 月份
+      dd: date.getDate(), //日
+      hh: date.getHours(),
+      mm: date.getMinutes(),
+      ss: date.getSeconds(),
+    };
+    if (/(y+)/.test(fmt)) {
+      fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
+    }
+    for (var k in nowDate) {
+      if (new RegExp("(" + k + ")").test(fmt)) {
+        fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? nowDate[k] : ("00" + nowDate[k]).substr(("" + nowDate[k]).length));
+      }
+    }
+    return fmt;
+  },
 };