Explorar o código

区域经销商统计

xiaohaizhao hai 1 ano
pai
achega
e604295d7c

+ 83 - 0
pages/index/performance/modules/rankingList/index.js

@@ -0,0 +1,83 @@
+let _Http = getApp().globalData.http,
+  content = {
+    pageNumber: 1,
+    pageTotal: 1,
+    pageSize: 10,
+    "where": {
+      "condition": "",
+      "status": ""
+    }
+  },
+  currency = require("../../../../../utils/currency"),
+  CNY = value => currency(value, {
+    symbol: "",
+    precision: 2
+  }).format(),
+  obj = {};
+import {
+  formatTime
+} from "../../../../../utils/getTime"
+Component({
+  lifetimes: {
+    attached: function () {
+      this.getList(true)
+      let date = formatTime().split(" ")[0].split("/");
+      obj = {
+        year: date[0],
+        month: date[1],
+        day: date[2],
+        quarter: Math.ceil(date[1] / 3)
+      };
+      console.log(obj)
+    },
+  },
+  data: {
+    list: []
+  },
+  methods: {
+    getList(init = false) {
+      if (init) {
+        content.pageNumber = 1;
+        content.pageTotal = 1;
+      }
+      if (content.pageNumber > content.pageTotal) return;
+      _Http.basic({
+        "id": 20231103100503,
+        "version": 1,
+        content
+      }).then(res => {
+        console.log("获取经销商排名", res)
+        if (res.msg != '成功') return;
+        let list = res.data.map(v => {
+          //l基本 h挑战 a实际 pl基础目标实际完成率 ph挑战目标实际完成率
+          let ar = [{
+            fulfill: CNY(v.m1a + v.m2a + v.m3a),
+            target: CNY(v.m3l + v.m3l + v.m3l),
+          }, {
+            fulfill: CNY(v.m4a + v.m5a + v.m6a),
+            target: CNY(v.m4l + v.m5l + v.m6l),
+          }, {
+            fulfill: CNY(v.m7a + v.m8a + v.m9a),
+            target: CNY(v.m7l + v.m8l + v.m9l),
+          }, {
+            fulfill: CNY(v.m10a + v.m11a + v.m12a),
+            target: CNY(v.m10l + v.m11l + v.m12l),
+          }];
+          v.quarter = ar[obj.quarter - 1];
+          v.thisMonth = {
+            fulfill: CNY(v[`m${obj.month}a`]),
+            target: CNY(v[`m${obj.month}a`])
+          }
+          v.sumamount_currentmonth = CNY(v.sumamount_currentmonth)
+          v.sumamount_year = CNY(v.sumamount_year)
+          return v
+        })
+        this.setData({
+          list: res.pageNumber == 1 ? list : this.data.list.concat(list)
+        });
+        content.pageNumber = res.pageNumber + 1;
+        content.pageTotal = res.pageTotal;
+      })
+    }
+  }
+})

+ 4 - 0
pages/index/performance/modules/rankingList/index.json

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

+ 79 - 0
pages/index/performance/modules/rankingList/index.scss

@@ -0,0 +1,79 @@
+.table {
+	width: 100vw;
+	background-color: #ffffff;
+	box-sizing: border-box;
+	margin-top: 30rpx;
+
+	.label {
+		display: flex;
+		align-items: center;
+		height: 80rpx;
+		padding: 0 20rpx;
+		font-weight: bold;
+		font-size: 26rpx;
+		color: #666;
+
+		.text {
+			display: inline-block;
+			width: 14rpx;
+			height: 26rpx;
+			background: #31A7FF;
+			margin-right: 14rpx;
+		}
+	}
+
+	.scroll {
+		width: 100vw;
+
+		.row,
+		.row-label {
+			display: flex;
+			align-items: center;
+			font-weight: bold;
+			padding-left: 30rpx;
+			width: 100%;
+			background-color: #F2F2F2;
+
+			.line-1 {
+				height: 70rpx;
+				line-height: 70rpx;
+				background-color: #F2F2F2;
+				width: 240rpx;
+				flex-shrink: 0;
+			}
+
+			//排行的样式
+			.line-1:first-child {
+				width: 100rpx !important;
+				position: relative;
+
+				.tag {
+					position: absolute;
+					top: 10rpx;
+					width: 50rpx;
+					height: 50rpx;
+					text-align: center;
+					color: #fff;
+					font-weight: bold;
+					line-height: 50rpx;
+					border-radius: 6rpx;
+				}
+			}
+		}
+
+		.row:nth-child(odd) {
+			background-color: #fff;
+
+			view {
+				background-color: #fff;
+			}
+		}
+
+		.row-label {
+			font-weight: normal;
+		}
+
+	}
+
+
+}

+ 74 - 0
pages/index/performance/modules/rankingList/index.wxml

@@ -0,0 +1,74 @@
+<view class="table" hidden="{{!list.length}}">
+	<view class="label">
+		<text class="text" />
+		区域经销商统计
+	</view>
+
+	<scroll-view class="scroll" scroll-x>
+		<view class="row-label">
+			<view class="line-1">
+				排名
+			</view>
+			<view class="line-1">
+				经销商
+			</view>
+			<view class="line-1">
+				月回款额
+			</view>
+			<view class="line-1">
+				年回款额
+			</view>
+			<view class="line-1">
+				当月目标
+			</view>
+			<view class="line-1">
+				当月达成
+			</view>
+			<view class="line-1">
+				季度目标
+			</view>
+			<view class="line-1">
+				季度达成
+			</view>
+		</view>
+		<view>
+			<view class="row" wx:for="{{list}}">
+				<view class="line-1">
+					<!-- 排名 -->
+					<view class="tag" style="background-color: {{item.rowindex>3?'#4480FF':'#FF9300'}};">
+						{{item.rowindex}}
+					</view>
+				</view>
+				<view class="line-1">
+					<!-- 经销商 -->
+					{{item.agentnum}}
+				</view>
+				<view class="line-1">
+					<!-- 月回款 -->
+					{{item.sumamount_currentmonth}}
+				</view>
+				<view class="line-1">
+					<!-- 年度回款 -->
+					{{item.sumamount_year}}
+				</view>
+				<view class="line-1">
+					<!-- 当月目标 -->
+					{{item.thisMonth.target}}
+				</view>
+				<view class="line-1">
+					<!-- 当月达成 -->
+					{{item.thisMonth.quarter}}
+				</view>
+				<view class="line-1">
+					<!-- 季度目标 -->
+					{{item.quarter.target}}
+				</view>
+				<view class="line-1">
+					<!-- 季度达成 -->
+					{{item.quarter.quarter}}
+				</view>
+			</view>
+		</view>
+	</scroll-view>
+
+</view>