xiaohaizhao 2 месяцев назад
Родитель
Сommit
a172deeed9

+ 69 - 12
CRM/customer/detail.js

@@ -1,22 +1,79 @@
+const _Http = getApp().globalData.http;
+
 Page({
   data: {
-    customerInfo: {}
+    detail: {},
+    loading: true,
+    tabsList: [{
+        label: '跟进记录',
+        icon: "icon-tabchanpin",
+        model: '#FollowRecord'
+      },
+      {
+        icon: "icon-tabchanpin",
+        label: '订单',
+        model: '#Order'
+      },
+      {
+        icon: "icon-tabchanpin",
+        label: '工单',
+        model: '#WorkOrder'
+      },
+      {
+        icon: "icon-tabchanpin",
+        label: '保修卡',
+        model: '#WarrantyCard'
+      }
+    ],
+    tabsActive: 0,
+    sa_customersid: ''
   },
   onLoad(options) {
-    const id = options.id;
-    this.getCustomerDetail(id);
+    this.setData({
+      sa_customersid: options.id
+    });
+    this.getCustomerDetail();
   },
   getCustomerDetail(id) {
-    // 模拟获取客户详情数据
-    const mockData = {
-      id: id,
-      name: `客户${id}`,
-      phone: `1380013800${id}`,
-      address: `地址${id}`,
-      email: `customer${id}@example.com`
-    };
     this.setData({
-      customerInfo: mockData
+      loading: true
+    });
+    _Http.basic({
+      "id": 2026030916272601,
+      "content": {
+        "sa_customersid": this.data.sa_customersid
+      }
+    }).then(res => {
+      console.log("客户详情数据", res);
+      if (res.code == 1 && res.data) {
+        this.setData({
+          detail: res.data[0],
+          loading: false
+        });
+      } else {
+        this.setData({
+          loading: false
+        });
+        wx.showToast({
+          title: '获取客户详情失败',
+          icon: 'none'
+        });
+      }
+    }).catch(err => {
+      console.error("获取客户详情失败", err);
+      this.setData({
+        loading: false
+      });
+      wx.showToast({
+        title: '获取客户详情失败',
+        icon: 'none'
+      });
+    });
+  },
+  /* tab切换 */
+  tabsChange(e) {
+    this.setData({
+      tabsActive: e.detail
     });
   }
 });

+ 7 - 1
CRM/customer/detail.json

@@ -1,4 +1,10 @@
 {
-  "usingComponents": {},
+  "usingComponents": {
+    "Yl_FunTabs": "/components/Yl_FunTabs/index",
+    "FollowRecord": "./modules/followRecord/index",
+    "Order": "./modules/order/index",
+    "WorkOrder": "./modules/workOrder/index",
+    "WarrantyCard": "./modules/warrantyCard/index"
+  },
   "navigationBarTitleText": "客户详情"
 }

+ 71 - 0
CRM/customer/detail.scss

@@ -0,0 +1,71 @@
+.text-red {
+  color: #FF4D4F;
+}
+
+.intr {
+  position: relative;
+  width: 100vw;
+  box-sizing: border-box;
+  background-color: #fff;
+  padding: 20rpx;
+
+  .top {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    margin-bottom: 20rpx;
+
+    .name {
+      font-size: 32rpx;
+      font-weight: bold;
+      color: #333;
+    }
+
+    .statu {
+      font-size: 24rpx;
+      padding: 4rpx 16rpx;
+      border-radius: 8rpx;
+      background-color: #f0f0f0;
+    }
+  }
+
+  .content {
+    width: 100%;
+
+    .row {
+      display: flex;
+      margin-top: 16rpx;
+
+      .exp {
+        flex: 1;
+        font-size: 26rpx;
+        color: #666;
+        line-height: 34rpx;
+
+        &.full-width {
+          flex: none;
+          width: 100%;
+        }
+      }
+    }
+  }
+}
+
+/* 各tab组件的样式 */
+.follow-record,
+.order,
+.work-order,
+.warranty-card {
+  padding: 20rpx;
+
+  .placeholder {
+    text-align: center;
+    color: #999;
+    padding: 100rpx 0;
+  }
+}
+
+/* 底部间距 */
+.bottom-space {
+  height: 130rpx;
+}

+ 71 - 16
CRM/customer/detail.wxml

@@ -1,18 +1,73 @@
-<view class="container">
-  <view class="info-item">
-    <view class="label">客户名称</view>
-    <view class="value">{{customerInfo.name}}</view>
+<view class="intr">
+  <view class="top">
+    <view class="name">{{detail.name || '--'}}</view>
+    <view class="statu" style="background-color: {{set.color(detail.status)}}; color: #fff;">
+      {{detail.status || '--'}}
+    </view>
   </view>
-  <view class="info-item">
-    <view class="label">联系电话</view>
-    <view class="value">{{customerInfo.phone}}</view>
+  <view class="content">
+    <view class="row">
+      <view class="exp">所属门店:{{detail.storename || '--'}}</view>
+      <view class="exp">性别:{{detail.sex || '--'}}</view>
+    </view>
+    <view class="row">
+      <view class="exp">手机:{{detail.phonenumber || '--'}}</view>
+      <view class="exp">客户来源:{{detail.source || '--'}}</view>
+    </view>
+    <view class="row">
+      <view class="exp">外部订单号:{{detail.ext_no || '--'}}</view>
+      <view class="exp">是否电商:<text class="{{detail.isonline_join == 1 ? 'text-red' : ''}}">{{detail.isonline_join == 1 ? '是' : '否'}}</text></view>
+    </view>
+    <view class="row">
+      <view class="exp full-width">业务员:{{detail.saler || '--'}}</view>
+    </view>
+    <view class="row">
+      <view class="exp full-width">省市县:{{(detail.province || '--') + '-' + (detail.city || '--') + '-' + (detail.county || '--')}}</view>
+    </view>
+    <view class="row">
+      <view class="exp full-width">地址:{{detail.address || '--'}}</view>
+    </view>
+    <view class="row">
+      <view class="exp full-width">小区及门牌号:{{detail.community || '--'}}</view>
+    </view>
+    <view class="row">
+      <view class="exp full-width">创建时间:{{detail.createdate || '--'}}</view>
+    </view>
+    <view class="row">
+      <view class="exp full-width">备注:{{detail.remarks || '--'}}</view>
+    </view>
   </view>
-  <view class="info-item">
-    <view class="label">地址</view>
-    <view class="value">{{customerInfo.address}}</view>
-  </view>
-  <view class="info-item">
-    <view class="label">邮箱</view>
-    <view class="value">{{customerInfo.email}}</view>
-  </view>
-</view>
+</view>
+
+<view style="height: 20rpx;" />
+<Yl_FunTabs list='{{tabsList}}' active='{{tabsActive}}' bind:onChenge="tabsChange">
+  <FollowRecord slot='跟进记录' id='FollowRecord' />
+  <Order slot='订单' id='Order' />
+  <WorkOrder slot='工单' id='WorkOrder' />
+  <WarrantyCard slot='保修卡' id='WarrantyCard' />
+</Yl_FunTabs>
+
+<view style="height: 130rpx;" />
+
+<wxs module="set">
+  module.exports = {
+    color: function (statu) {
+      var color = '#999999';
+      switch (statu) {
+        case "意向客户":
+        case "意向":
+          color = '#FA8C16';
+          break;
+        case "正式客户":
+        case "正式":
+          color = '#52C41A';
+          break;
+        case "无效客户":
+        case "无效":
+          color = '#FF4D4F';
+          break;
+      };
+      return color;
+    }
+  }
+</wxs>

+ 58 - 15
CRM/customer/index.js

@@ -1,25 +1,68 @@
+const _Http = getApp().globalData.http;
+
 Page({
   data: {
-    customerList: []
+    list: [],
+    content: {
+      nocache: true,
+      pageNumber: 1,
+      pageSize: 20,
+      pageTotal: 1,
+      where: {
+        condition: "",
+        tablefilter: {
+          status: null,
+          name: null,
+          siteid: null,
+          storename: null,
+          sex: null
+        }
+      },
+      tableid: 2096
+    }
   },
   onLoad() {
-    this.getCustomerList();
+    this.getList();
   },
-  getCustomerList() {
-    // 模拟获取客户列表数据
-    const mockData = [
-      { id: 1, name: '客户1', phone: '13800138001' },
-      { id: 2, name: '客户2', phone: '13800138002' },
-      { id: 3, name: '客户3', phone: '13800138003' }
-    ];
-    this.setData({
-      customerList: mockData
+  /* 获取客户列表 */
+  getList(init = false) {
+    if (init.detail != undefined) init = init.detail;
+    if (init) {
+      this.setData({
+        'content.pageNumber': 1
+      });
+    }
+    if (this.data.content.pageNumber > this.data.content.pageTotal) return;
+    this.setListHeight();
+    
+    _Http.basic({
+      "id": 2026030916100201,
+      content: this.data.content
+    }).then(res => {
+      console.log("客户列表数据", res);
+      this.selectComponent('#ListBox').RefreshToComplete();
+      this.setData({
+        'content.pageNumber': res.pageNumber + 1,
+        'content.pageTotal': res.pageTotal,
+        list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
+        total: res.total
+      });
+    }).catch(err => {
+      console.error("获取客户列表失败", err);
+      this.selectComponent('#ListBox').RefreshToComplete();
     });
   },
-  goToDetail(e) {
-    const id = e.currentTarget.dataset.id;
-    wx.navigateTo({
-      url: `./detail?id=${id}`
+  /* 设置页面高度 */
+  setListHeight() {
+    this.selectComponent("#ListBox").setHeight(".header", this);
+  },
+  /* 搜索 */
+  onSearch({
+    detail
+  }) {
+    this.setData({
+      'content.where.condition': detail
     });
+    this.getList(true);
   }
 });

+ 5 - 1
CRM/customer/index.json

@@ -1,4 +1,8 @@
 {
-  "usingComponents": {},
+  "usingComponents": {
+    "van-search": "@vant/weapp/search/index",
+    "Yl_ListBox": "/components/Yl_ListBox/index",
+    "Yl_Empty": "/components/Yl_Empty/index"
+  },
   "navigationBarTitleText": "客户列表"
 }

+ 72 - 0
CRM/customer/index.scss

@@ -0,0 +1,72 @@
+.container {
+  background-color: #f5f5f5;
+  min-height: 100vh;
+}
+
+.text-red {
+  color: #FF4D4F;
+}
+
+.header {
+  width: 100%;
+}
+
+.item {
+  display: flex;
+  flex-direction: column;
+  padding: 24rpx;
+  background-color: #fff;
+  margin-bottom: 20rpx;
+  border-radius: 12rpx;
+
+  .top {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    margin-bottom: 16rpx;
+
+    .name {
+      font-size: 34rpx;
+      font-weight: 600;
+      color: #1a1a1a;
+      flex: 1;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      white-space: nowrap;
+      margin-right: 16rpx;
+    }
+
+    .statu {
+      font-size: 22rpx;
+      padding: 6rpx 16rpx;
+      border-radius: 6rpx;
+      font-weight: 500;
+      flex-shrink: 0;
+    }
+  }
+
+  .content {
+    width: 100%;
+
+    .row {
+      display: flex;
+      margin-top: 12rpx;
+      
+      &:first-child {
+        margin-top: 0;
+      }
+    }
+
+    .exp {
+      flex: 1;
+      font-size: 26rpx;
+      color: #666;
+      line-height: 1.5;
+
+      &.full-width {
+        flex: none;
+        width: 100%;
+      }
+    }
+  }
+}

+ 101 - 8
CRM/customer/index.wxml

@@ -1,9 +1,102 @@
 <view class="container">
-  <view class="customer-item" wx:for="{{customerList}}" wx:key="id" bindtap="goToDetail" data-id="{{item.id}}">
-    <view class="customer-info">
-      <view class="customer-name">{{item.name}}</view>
-      <view class="customer-phone">{{item.phone}}</view>
-    </view>
-    <view class="arrow">></view>
-  </view>
-</view>
+  <van-search use-action-slot placeholder='请输入搜索关键词' shape='round' bind:search="onSearch" bind:clear="onSearch" />
+  <view class="header" style="height: 20rpx;"></view>
+  <Yl_ListBox id='ListBox' bind:getlist='getList'>
+    <navigator url="/CRM/customer/detail?id={{item.sa_customersid}}" class="item" wx:for="{{list}}" wx:key="sa_customersid">
+      <view class="top">
+        <view class="name">{{item.name || '--'}}</view>
+        <view class="statu" style="background-color: {{set.color(item.status)}}; color: #fff;">
+          {{item.status || '--'}}
+        </view>
+      </view>
+      <view class="content">
+        <view class="row">
+          <view class="exp">
+            所属站点:{{item.siteid || '--'}}
+          </view>
+          <view class="exp">
+            创建站点:{{item.enterprisename || '--'}}
+          </view>
+        </view>
+        <view class="row">
+          <view class="exp">
+            所属门店:{{item.storename || '--'}}
+          </view>
+          <view class="exp">
+            性别:{{item.sex || '--'}}
+          </view>
+        </view>
+        <view class="row">
+          <view class="exp">
+            手机:{{item.phonenumber || '--'}}
+          </view>
+          <view class="exp">
+            客户来源:{{item.source || '--'}}
+          </view>
+        </view>
+        <view class="row">
+          <view class="exp">
+            外部订单号:{{item.ext_no || '--'}}
+          </view>
+          <view class="exp">
+            是否电商:<text class="{{item.isonline_join == 1 ? 'text-red' : ''}}">{{item.isonline_join == 1 ? '是' : '否'}}</text>
+          </view>
+        </view>
+        <view class="row">
+          <view class="exp full-width">
+            业务员:{{item.saler || '--'}}
+          </view>
+        </view>
+        <view class="row">
+          <view class="exp full-width">
+            省市县:{{(item.province || '--') + '-' + (item.city || '--') + '-' + (item.county || '--')}}
+          </view>
+        </view>
+        <view class="row">
+          <view class="exp full-width">
+            地址:{{item.address || '--'}}
+          </view>
+        </view>
+        <view class="row">
+          <view class="exp full-width">
+            小区及门牌号:{{item.community || '--'}}
+          </view>
+        </view>
+        <view class="row">
+          <view class="exp full-width">
+            创建时间:{{item.createdate || '--'}}
+          </view>
+        </view>
+        <view class="row">
+          <view class="exp full-width">
+            备注:{{item.remarks || '--'}}
+          </view>
+        </view>
+      </view>
+    </navigator>
+    <Yl_Empty wx:if="{{list.length==0}}" />
+    <view style="height:150rpx;" />
+  </Yl_ListBox>
+</view>
+<wxs module="set">
+  module.exports = {
+    color: function (statu) {
+      var color = '#999999';
+      switch (statu) {
+        case "意向客户":
+        case "意向":
+          color = '#FA8C16';
+          break;
+        case "正式客户":
+        case "正式":
+          color = '#52C41A';
+          break;
+        case "无效客户":
+        case "无效":
+          color = '#FF4D4F';
+          break;
+      };
+      return color;
+    }
+  }
+</wxs>

+ 0 - 34
CRM/customer/index.wxss

@@ -1,34 +0,0 @@
-.container {
-  padding: 10rpx;
-}
-
-.customer-item {
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-  padding: 20rpx;
-  background-color: #fff;
-  margin-bottom: 10rpx;
-  border-radius: 8rpx;
-  box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
-}
-
-.customer-info {
-  flex: 1;
-}
-
-.customer-name {
-  font-size: 32rpx;
-  font-weight: bold;
-  margin-bottom: 8rpx;
-}
-
-.customer-phone {
-  font-size: 28rpx;
-  color: #666;
-}
-
-.arrow {
-  font-size: 32rpx;
-  color: #999;
-}

+ 8 - 0
CRM/customer/modules/followRecord/index.js

@@ -0,0 +1,8 @@
+Component({
+  data: {
+    // 跟进记录数据
+  },
+  methods: {
+    // 跟进记录相关方法
+  }
+});

+ 4 - 0
CRM/customer/modules/followRecord/index.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 9 - 0
CRM/customer/modules/followRecord/index.scss

@@ -0,0 +1,9 @@
+.follow-record {
+  padding: 20rpx;
+  
+  .placeholder {
+    text-align: center;
+    color: #999;
+    padding: 100rpx 0;
+  }
+}

+ 3 - 0
CRM/customer/modules/followRecord/index.wxml

@@ -0,0 +1,3 @@
+<view class="follow-record">
+  <view class="placeholder">跟进记录内容</view>
+</view>

+ 8 - 0
CRM/customer/modules/order/index.js

@@ -0,0 +1,8 @@
+Component({
+  data: {
+    // 订单数据
+  },
+  methods: {
+    // 订单相关方法
+  }
+});

+ 4 - 0
CRM/customer/modules/order/index.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 9 - 0
CRM/customer/modules/order/index.scss

@@ -0,0 +1,9 @@
+.order {
+  padding: 20rpx;
+  
+  .placeholder {
+    text-align: center;
+    color: #999;
+    padding: 100rpx 0;
+  }
+}

+ 3 - 0
CRM/customer/modules/order/index.wxml

@@ -0,0 +1,3 @@
+<view class="order">
+  <view class="placeholder">订单内容</view>
+</view>

+ 8 - 0
CRM/customer/modules/warrantyCard/index.js

@@ -0,0 +1,8 @@
+Component({
+  data: {
+    // 保修卡数据
+  },
+  methods: {
+    // 保修卡相关方法
+  }
+});

+ 4 - 0
CRM/customer/modules/warrantyCard/index.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 9 - 0
CRM/customer/modules/warrantyCard/index.scss

@@ -0,0 +1,9 @@
+.warranty-card {
+  padding: 20rpx;
+  
+  .placeholder {
+    text-align: center;
+    color: #999;
+    padding: 100rpx 0;
+  }
+}

+ 3 - 0
CRM/customer/modules/warrantyCard/index.wxml

@@ -0,0 +1,3 @@
+<view class="warranty-card">
+  <view class="placeholder">保修卡内容</view>
+</view>

+ 8 - 0
CRM/customer/modules/workOrder/index.js

@@ -0,0 +1,8 @@
+Component({
+  data: {
+    // 工单数据
+  },
+  methods: {
+    // 工单相关方法
+  }
+});

+ 4 - 0
CRM/customer/modules/workOrder/index.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 9 - 0
CRM/customer/modules/workOrder/index.scss

@@ -0,0 +1,9 @@
+.work-order {
+  padding: 20rpx;
+  
+  .placeholder {
+    text-align: center;
+    color: #999;
+    padding: 100rpx 0;
+  }
+}

+ 3 - 0
CRM/customer/modules/workOrder/index.wxml

@@ -0,0 +1,3 @@
+<view class="work-order">
+  <view class="placeholder">工单内容</view>
+</view>

+ 0 - 0
CRM/customer/detail.wxss → CRM/lead/detail.scss


+ 0 - 26
CRM/lead/detail.wxss

@@ -1,26 +0,0 @@
-.container {
-  padding: 20rpx;
-  background-color: #f5f5f5;
-  min-height: 100vh;
-}
-
-.info-item {
-  display: flex;
-  align-items: center;
-  padding: 20rpx;
-  background-color: #fff;
-  margin-bottom: 10rpx;
-  border-radius: 8rpx;
-}
-
-.label {
-  width: 160rpx;
-  font-size: 28rpx;
-  color: #666;
-}
-
-.value {
-  flex: 1;
-  font-size: 28rpx;
-  color: #333;
-}

+ 0 - 0
CRM/lead/index.wxss → CRM/lead/index.scss


+ 0 - 0
CRM/order/detail.wxss → CRM/order/detail.scss


+ 0 - 0
CRM/order/index.wxss → CRM/order/index.scss


+ 0 - 0
CRM/warehouse/detail.wxss → CRM/warehouse/detail.scss


+ 0 - 0
CRM/warehouse/index.wxss → CRM/warehouse/index.scss


+ 16 - 2
project.private.config.json

@@ -24,12 +24,26 @@
   "condition": {
     "miniprogram": {
       "list": [
+        {
+          "name": "客户详情",
+          "pathName": "CRM/customer/detail",
+          "query": "id=-12170327",
+          "scene": null,
+          "launchMode": "default"
+        },
+        {
+          "name": "客户列表",
+          "pathName": "CRM/customer/index",
+          "query": "",
+          "launchMode": "default",
+          "scene": null
+        },
         {
           "name": "packageA/orderForm/detail",
           "pathName": "packageA/orderForm/detail",
           "query": "id=2122471",
-          "scene": null,
-          "launchMode": "default"
+          "launchMode": "default",
+          "scene": null
         },
         {
           "name": "packageA/orderForm/detail",