|
|
@@ -23,10 +23,10 @@
|
|
|
|
|
|
<scroll-view scroll-y scroll-with-animation class="main-view">
|
|
|
<view class="space-view ex-table">
|
|
|
- <block v-if="!$util.isEmpty(profit)">
|
|
|
+ <block v-if="!$util.isEmpty(profile)">
|
|
|
<t-table :headerBackgroundColor="'#F0F2F6'">
|
|
|
<t-tr header><t-th>花材</t-th><t-th>数量</t-th><t-th>金额</t-th></t-tr>
|
|
|
- <view v-for="(item, index) in profit" :key="index" @click="goDetail(item)">
|
|
|
+ <view v-for="(item, index) in profile" :key="index" @click="goDetail(item)">
|
|
|
<t-tr>
|
|
|
<t-td><view>{{item.name}}</view></t-td>
|
|
|
<t-td><view>{{parseFloat(item.num)}}</view></t-td>
|
|
|
@@ -123,7 +123,8 @@ export default {
|
|
|
endTime: "",
|
|
|
shopId: "",
|
|
|
},
|
|
|
- profit:[],
|
|
|
+ profile:[],
|
|
|
+ storageData:[],
|
|
|
searchContent:'',
|
|
|
};
|
|
|
},
|
|
|
@@ -148,7 +149,23 @@ export default {
|
|
|
...mapActions(['setUserShopAll']),
|
|
|
searchFn(e){
|
|
|
this.searchContent = e;
|
|
|
- this.init()
|
|
|
+ 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){
|
|
|
@@ -178,21 +195,10 @@ export default {
|
|
|
getStatItemProfit(this.params).then(res => {
|
|
|
uni.hideLoading()
|
|
|
if (!this.$util.isEmpty(res.data.list)) {
|
|
|
- if(this.searchContent.length > 0){
|
|
|
- that.profit = [];
|
|
|
- res.data.list.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.profit.push(obj)
|
|
|
- }
|
|
|
- })
|
|
|
- }else{
|
|
|
- that.profit = res.data.list
|
|
|
- }
|
|
|
+ that.storageData = res.data.list
|
|
|
+ that.filterStat()
|
|
|
}else{
|
|
|
- that.profit=[]
|
|
|
+ that.storageData=[]
|
|
|
}
|
|
|
});
|
|
|
}
|