shish 4 anni fa
parent
commit
70a8c3d85e
2 ha cambiato i file con 75 aggiunte e 22 eliminazioni
  1. 69 21
      ghsApp/src/admin/statistics/cgStat.vue
  2. 6 1
      ghsApp/src/api/statistics/index.js

+ 69 - 21
ghsApp/src/admin/statistics/cgStat.vue

@@ -1,5 +1,12 @@
 <template>
 	<view class="ex-page">
+
+		<view class="input-wrap_box">
+		<view>
+			<AppSearchModule placeholder="输入字母搜索" @input="searchFn"/>
+		</view>
+		</view>
+
 		<view class="top-bar">
 			<DorpdownSelect class="bar"
 				:menuObj="menuTimeObj"
@@ -13,25 +20,28 @@
 				top="0"
 				@selectSussess="selectShopSussess" />
 		</view>
-		<scroll-view scroll-y scroll-with-animation class="main-view">
+
+		<view class="main-view">
 			<view class="space-view ex-table">
 				<block>
 					<t-table :headerBackgroundColor="'#F0F2F6'">
 
-						<t-tr header><t-th>供应商</t-th><t-th>采购金额(元)</t-th><t-th>操作</t-th></t-tr>
-						<t-tr><t-td><view>盛丰</view></t-td><t-td><view>286500.00</view></t-td><t-td><view></view></t-td></t-tr>
-						<t-tr><t-td><view>茗星花卉</view></t-td><t-td><view>170129.00</view></t-td><t-td><view></view></t-td></t-tr>
-						<t-tr><t-td><view>珍情花卉</view></t-td><t-td><view>367111.00</view></t-td><t-td><view></view></t-td></t-tr>
-						<t-tr><t-td><view>花伍鲜花</view></t-td><t-td><view>551906.00</view></t-td><t-td><view></view></t-td></t-tr>
-						<t-tr><t-td><view>花醉美</view></t-td><t-td><view>74403.00</view></t-td><t-td><view></view></t-td></t-tr>
-						<t-tr><t-td><view>美旗鲜花</view></t-td><t-td><view>64403.00</view></t-td><t-td><view></view></t-td></t-tr>
-						<t-tr><t-td><view>花醉美</view></t-td><t-td><view>94403.00</view></t-td><t-td><view></view></t-td></t-tr>
+						<t-tr header><t-th>供应商</t-th><t-th>数量</t-th><t-th>金额</t-th><t-th>操作</t-th></t-tr>
+
+						<view v-for="(item, index) in profile" :key="index">
+							<t-tr>
+								<t-td><view>{{item.ghsName}}</view></t-td>
+								<t-td><view>{{parseFloat(item.num)}}</view></t-td>
+								<t-td><view>{{parseFloat(item.amount)}}</view></t-td>
+								<t-td></t-td>
+							</t-tr>
+						</view>
 
 					</t-table>
 				</block>
 			</view>
-		</scroll-view>
-		<!--		时间段选择-->
+		</view>
+
 		<rangeDatePick
 			:show="isShow"
 			start="2000-01-01"
@@ -40,6 +50,7 @@
 			@change="timeChange"
 			@cancel="timeCancel"
 			themeColor="#4C83D6" fields="day"></rangeDatePick>
+
 	</view>
 </template>
 <script>
@@ -47,13 +58,14 @@ const Month = (new Date().getMonth()+1)<10?'0'+(new Date().getMonth()+1):new Dat
 const time = `${new Date().getFullYear()}-${Month}-${new Date().getDate()}`;
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import SelectList from "@/components/plugin/selectList";
-import { getStatProfit } from "@/api/statistics/index";
+import { getStatCgGhsProfile } from "@/api/statistics/index";
 import { list,selectShop } from "@/mixins";
 import DorpdownSelect from "@/components/module/shopSelect";
 import rangeDatePick from '@/components/pyh-rdtpicker/pyh-rdtpicker.vue';
+import AppSearchModule from "@/components/module/app-search";
 import {mapActions, mapGetters} from "vuex";
 export default {
-	components: { SelectList, AppWrapperEmpty,DorpdownSelect,rangeDatePick },
+	components: { SelectList, AppWrapperEmpty,DorpdownSelect,rangeDatePick,AppSearchModule },
 	mixins: [list,selectShop],
 	computed: {		...mapGetters(["getDictionariesInfo","getLoginInfo"])	},
 	data() {
@@ -125,12 +137,14 @@ export default {
 				endTime: "",
 				shopId: "",
 			},
-			profit:[],
+			profile:[],
+			storageData:[],
+			searchContent:'',
 		};
 	},
 	onPullDownRefresh() {
 		this.resetList();
-		this._list().then(res => {
+		this.getList().then(res => {
 			uni.stopPullDownRefresh();
 		});
 	},
@@ -147,6 +161,26 @@ export default {
 	},
 	methods: {
 		...mapActions(['setUserShopAll']),
+		searchFn(e){
+			this.searchContent = e;
+			this.filterStat()
+		},
+		filterStat(){
+			let that = this
+			if(this.searchContent.length > 0){
+				that.profile = [];
+				that.storageData.forEach(obj => {
+					let hasName = obj.name && obj.name.indexOf(this.searchContent) >= 0;
+					let elePy = (obj.py && obj.py.toLocaleUpperCase()) || "";
+					let hasPy = elePy.indexOf(this.searchContent.toLocaleUpperCase()) >= 0;
+					if (hasName || hasPy) {
+						that.profile.push(obj)
+					}
+				})
+			}else{
+				that.profile = that.storageData
+			}
+		},
 		// 选择分店
 		selectShopSussess(val){
 			this.params.shopId = val.selectItem.id;
@@ -174,14 +208,23 @@ export default {
 			this.init();
 		},
 		//选择自定义时间取消
-		timeCancel(e){this.isShow = false;},
+		timeCancel(e){
+			this.isShow = false
+		},
 		async init() {
-			this._list();
+			this.getList();
 		},
-		_list() {
+		getList() {
 			let that = this
-			getStatProfit(this.params).then(res => {
-				that.profit = res.data
+			uni.showLoading()
+			getStatCgGhsProfile(this.params).then(res => {
+				if (!this.$util.isEmpty(res.data.list)) {
+					uni.hideLoading()
+					that.storageData = res.data.list
+					that.filterStat()
+				}else{
+					that.storageData=[]
+				}
 			});
 		}
 	}
@@ -189,15 +232,16 @@ export default {
 </script>
 <style lang="scss" scoped>
 .ex-page {
+	padding-top:20rpx;
 	height: 100%;
 	display: flex;
 	flex-direction: column;
 	.top-bar {
 		position: absolute;
 		left: 0;
+		top:110rpx;
 		display: flex;
 		width: 100%;
-		// box-shadow: 0 5upx 5upx 5upx rgba($color: #000000, $alpha: 0.2);
 		z-index: 20;
 		.bar{
 			width: 50%;
@@ -214,6 +258,10 @@ export default {
 		background-color: #f9fbfc;
 		.space-view {
 			background-color: #fff;
+			.change-level{
+				font-size:22rpx;
+				padding:10rpx 15rpx;
+			}
 		}
 		.ex-info {
 			padding: 30upx;

+ 6 - 1
ghsApp/src/api/statistics/index.js

@@ -32,4 +32,9 @@ export const getStatKdProfile = data => {
 //客户下单排行
 export const getStatKhCgProfile = data => {
 	return https.get('/stat-kh-cg/profile', data)
-}
+}
+
+//客户下单排行
+export const getStatCgGhsProfile = data => {
+	return https.get('/stat-cg-ghs/profile', data)
+}