Browse Source

#I1VA6O 修改分销列表中搜索框的x按钮无效的问题

zyh
Gaoxs 4 years ago
parent
commit
32685e9884
  1. 322
      pages/user/promotion/PromoterList/index.vue

322
pages/user/promotion/PromoterList/index.vue

@ -13,22 +13,14 @@
</view> </view>
</view> </view>
<view class="nav acea-row row-around"> <view class="nav acea-row row-around">
<view <view class="item" :class="screen.grade == 0 ? 'on' : ''" @click="checkGrade(0)">一级({{ first||'0' }})</view>
class="item" <view class="item" :class="screen.grade == 1 ? 'on' : ''" @click="checkGrade(1)">二级({{ second||'0' }})</view>
:class="screen.grade == 0 ? 'on' : ''"
@click="checkGrade(0)"
>一级({{ first||'0' }})</view>
<view
class="item"
:class="screen.grade == 1 ? 'on' : ''"
@click="checkGrade(1)"
>二级({{ second||'0' }})</view>
</view> </view>
<view class="search acea-row row-between-wrapper"> <view class="search acea-row row-between-wrapper">
<form @submit.prevent="submitForm"> <form @submit.prevent="submitForm">
<view class="input"> <view class="input">
<input placeholder="点击搜索会员名称" v-model="screen.keyword" /> <input placeholder="点击搜索会员名称" v-model="screen.keyword" />
<text class="iconfont icon-guanbi"></text> <text class="iconfont icon-guanbi" @click="screen.keyword=''"></text>
</view> </view>
</form> </form>
<view class="iconfont icon-sousuo2"></view> <view class="iconfont icon-sousuo2"></view>
@ -56,11 +48,8 @@
</view> </view>
</view> </view>
<view :class="fixedState === true ? 'sortList' : ''"> <view :class="fixedState === true ? 'sortList' : ''">
<view <view class="item acea-row row-between-wrapper" v-for="(val, spreadListIndex) in spreadList"
class="item acea-row row-between-wrapper" :key="spreadListIndex">
v-for="(val, spreadListIndex) in spreadList"
:key="spreadListIndex"
>
<view class="picTxt acea-row row-between-wrapper"> <view class="picTxt acea-row row-between-wrapper">
<view class="pictrue"> <view class="pictrue">
<image :src="val.avatar" /> <image :src="val.avatar" />
@ -84,166 +73,167 @@
</view> </view>
</template> </template>
<script> <script>
import { getSpreadUser } from "@/api/user"; import {
import Loading from "@/components/Loading"; getSpreadUser
export default { } from "@/api/user";
name: "PromoterList", import Loading from "@/components/Loading";
components: { export default {
Loading name: "PromoterList",
}, components: {
props: {}, Loading
data: function() { },
return { props: {},
fixedState: false, data: function () {
screen: { return {
page: 1, fixedState: false,
limit: 15, screen: {
grade: 0, page: 1,
keyword: "", limit: 15,
sort: "" grade: 0,
}, keyword: "",
childCount: 2, sort: ""
numberCount: 2, },
orderCount: 2, childCount: 2,
loaded: false, numberCount: 2,
loading: false, orderCount: 2,
spreadList: [], loaded: false,
loadTitle: "", loading: false,
first: "", spreadList: [],
second: "" loadTitle: "",
}; first: "",
}, second: ""
mounted: function() { };
this.getSpreadUsers();
},
onReachBottom() {
!this.loading && this.getSpreadUsers();
},
watch: {
"screen.sort": function() {
this.screen.page = 0;
this.loaded = false;
this.loading = false;
this.spreadList = [];
this.getSpreadUsers();
}
},
methods: {
handleScroll: function() {
// var scrollTop =
// document.documentElement.scrollTop || document.body.scrollTop;
// var offsetTop = document.querySelector(".header").clientHeight;
// if (scrollTop >= offsetTop) {
// this.fixedState = true;
// } else {
// this.fixedState = false;
// }
}, },
submitForm: function() { mounted: function () {
this.screen.page = 0;
this.loaded = false;
this.loading = false;
this.spreadList = [];
this.getSpreadUsers(); this.getSpreadUsers();
}, },
getSpreadUsers: function() { onReachBottom() {
let that = this, !this.loading && this.getSpreadUsers();
screen = that.screen;
if (that.loaded || that.loading) return;
that.loading = true;
getSpreadUser(screen).then(
res => {
that.loading = false;
that.spreadList.push.apply(that.spreadList, res.data.list);
that.loaded = res.data.list.length < that.screen.limit; //
that.loadTitle = that.loaded ? "人家是有底线的" : "上拉加载更多";
that.screen.page = that.screen.page + 1;
that.first = res.data.total;
that.second = res.data.totalLevel;
},
err => {
uni.showToast({
title:
err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
},
300
);
}, },
checkGrade: function(val) { watch: {
if (val == this.screen.grade) return; "screen.sort": function () {
else { this.screen.page = 0;
this.screen.page = 1;
this.screen.grade = val;
this.loading = false;
this.loaded = false; this.loaded = false;
this.loading = false;
this.spreadList = []; this.spreadList = [];
this.getSpreadUsers(); this.getSpreadUsers();
} }
}, },
sort: function(types) { methods: {
let that = this; handleScroll: function () {
switch (types) { // var scrollTop =
case "childCount": // document.documentElement.scrollTop || document.body.scrollTop;
if (that.childCount == 2) { // var offsetTop = document.querySelector(".header").clientHeight;
that.childCount = 1; // if (scrollTop >= offsetTop) {
that.orderCount = 2; // this.fixedState = true;
that.numberCount = 2; // } else {
that.screen.sort = "childCount DESC"; // this.fixedState = false;
} else if (that.childCount == 1) { // }
that.childCount = 3; },
that.orderCount = 2; submitForm: function () {
that.numberCount = 2; this.screen.page = 0;
that.screen.sort = "childCount ASC"; this.loaded = false;
} else if (that.childCount == 3) { this.loading = false;
that.childCount = 2; this.spreadList = [];
that.orderCount = 2; this.getSpreadUsers();
that.numberCount = 2; },
that.screen.sort = ""; getSpreadUsers: function () {
} let that = this,
break; screen = that.screen;
case "numberCount": if (that.loaded || that.loading) return;
if (that.numberCount == 2) { that.loading = true;
that.numberCount = 1; getSpreadUser(screen).then(
that.orderCount = 2; res => {
that.childCount = 2; that.loading = false;
that.screen.sort = "numberCount DESC"; that.spreadList.push.apply(that.spreadList, res.data.list);
} else if (that.numberCount == 1) { that.loaded = res.data.list.length < that.screen.limit; //
that.numberCount = 3; that.loadTitle = that.loaded ? "人家是有底线的" : "上拉加载更多";
that.orderCount = 2; that.screen.page = that.screen.page + 1;
that.childCount = 2; that.first = res.data.total;
that.screen.sort = "numberCount ASC"; that.second = res.data.totalLevel;
} else if (that.numberCount == 3) { },
that.numberCount = 2; err => {
that.orderCount = 2; uni.showToast({
that.childCount = 2; title: err.msg || err.response.data.msg || err.response.data.message,
that.screen.sort = ""; icon: "none",
} duration: 2000
break; });
case "orderCount": },
if (that.orderCount == 2) { 300
that.orderCount = 1; );
that.numberCount = 2; },
that.childCount = 2; checkGrade: function (val) {
that.screen.sort = "orderCount DESC"; if (val == this.screen.grade) return;
} else if (that.orderCount == 1) { else {
that.orderCount = 3; this.screen.page = 1;
that.numberCount = 2; this.screen.grade = val;
that.childCount = 2; this.loading = false;
that.screen.sort = "orderCount ASC"; this.loaded = false;
} else if (that.orderCount == 3) { this.spreadList = [];
that.orderCount = 2; this.getSpreadUsers();
that.numberCount = 2; }
that.childCount = 2; },
sort: function (types) {
let that = this;
switch (types) {
case "childCount":
if (that.childCount == 2) {
that.childCount = 1;
that.orderCount = 2;
that.numberCount = 2;
that.screen.sort = "childCount DESC";
} else if (that.childCount == 1) {
that.childCount = 3;
that.orderCount = 2;
that.numberCount = 2;
that.screen.sort = "childCount ASC";
} else if (that.childCount == 3) {
that.childCount = 2;
that.orderCount = 2;
that.numberCount = 2;
that.screen.sort = "";
}
break;
case "numberCount":
if (that.numberCount == 2) {
that.numberCount = 1;
that.orderCount = 2;
that.childCount = 2;
that.screen.sort = "numberCount DESC";
} else if (that.numberCount == 1) {
that.numberCount = 3;
that.orderCount = 2;
that.childCount = 2;
that.screen.sort = "numberCount ASC";
} else if (that.numberCount == 3) {
that.numberCount = 2;
that.orderCount = 2;
that.childCount = 2;
that.screen.sort = "";
}
break;
case "orderCount":
if (that.orderCount == 2) {
that.orderCount = 1;
that.numberCount = 2;
that.childCount = 2;
that.screen.sort = "orderCount DESC";
} else if (that.orderCount == 1) {
that.orderCount = 3;
that.numberCount = 2;
that.childCount = 2;
that.screen.sort = "orderCount ASC";
} else if (that.orderCount == 3) {
that.orderCount = 2;
that.numberCount = 2;
that.childCount = 2;
that.screen.sort = "";
}
break;
default:
that.screen.sort = ""; that.screen.sort = "";
} }
break;
default:
that.screen.sort = "";
} }
} }
} };
};
</script> </script>

Loading…
Cancel
Save