·修改部分页面数据冗余

This commit is contained in:
lemon橪
2021-05-14 17:31:40 +08:00
parent 23804939eb
commit 7f4212755d
42 changed files with 1415 additions and 2987 deletions

View File

@@ -18,104 +18,56 @@
<text class="pcolor">{{ pointData.variablePoint || 0 }}</text>
</u-col>
</u-row>
<u-row class="portrait-box3">
<!-- #ifndef MP-WEIXIN -->
<u-col span="8">近30天记录</u-col>
<u-col textAlign="right" span="4" @click="goDetail" class="more">更多</u-col>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<view class="mp-weixin-more">
<view>近30天记录</view>
<view @click="goDetail">更多</view>
<div class="point-list">
<view class="point-item" v-for="(item, index) in pointList" :key="index">
<view>
<view>{{ item.content }}</view>
<view>{{ item.createTime}}</view>
</view>
<view><span>{{item.pointType == "1" ? '+' : '-'}}</span>{{ item.variablePoint }}</view>
</view>
<!-- #endif -->
</u-row>
<view class="dataList" v-for="(item, index) in list" :key="index">
<view>
<view>{{ item.content }}</view>
<view>{{ item.createTime}}</view>
</view>
<view><span>{{item.pointType == "1" ? '+' : '-'}}</span>{{ item.variablePoint }}</view>
</view>
<uni-load-more :status="count.loadStatus"></uni-load-more>
<u-popup v-model="show" mode="bottom" :closeable="true">
<view class="title">申请积分</view>
<u-form :model="form" ref="uForm">
<u-form-item label="选择店铺" label-width="140">
<u-input v-model="storeParams.storeName" type="select" @click="showstore" placeholder="请选择店铺" />
</u-form-item>
<u-form-item label="申请积分" label-width="140">
<u-input v-model="storeParams.point" type="number" placeholder="请输入积分数量" />
</u-form-item>
</u-form>
<button class="btn-mini" @click="submit" :disabled="avoidClick">提交申请</button>
</u-popup>
<uni-load-more :status="count.loadStatus"></uni-load-more>
</div>
</view>
</template>
<script>
import { getPoints, getPointsData } from "@/api/members.js";
import { getPointsData } from "@/api/members.js";
import { getMemberPointSum } from "@/api/members.js";
import { contractStep } from "@/api/safe.js";
import storage from "@/utils/storage.js";
export default {
onShow() {
this.userInfo = storage.getUserInfo();
},
data() {
return {
count: {
loadStatus: "more",
},
list: [],
userInfo: [],
pointList: [], //积分数据集合
params: {
pageNumber: 1,
pageSize: 10,
start_time: 0,
end_time: 0,
},
pointData: {},
show: false,
form: {},
showAction: false,
actionList: [],
storeParams: {
point: 0,
storeId: 0,
storeName: "请选择店铺",
},
avoidClick: false,
isCertificate: true,
pointData: {}, //累计获取 未输入 集合
};
},
onLoad() {
contractStep().then((res) => {
//是否实名认证
console.log(res);
this.isCertificate = res.data == 1 ? true : false;
});
getPoints().then((res) => {
this.count = res.data;
});
this.initpointDataData();
this.initPointData();
this.getList();
},
/**
* 触底加载
*/
onReachBottom() {
this.params.pageNumber++;
this.getList();
},
methods: {
/**
* 获取积分数据
*/
getList() {
let date = Date.parse(new Date()) / 1000;
let params = this.params;
params.start_time = date - 60 * 60 * 24 * 30; //30天前时间
params.end_time = date;
// console.log(params)
// return;
uni.showLoading({
title: "加载中",
});
@@ -125,55 +77,28 @@ export default {
let data = res.data.result.records;
if (data.length < 10) {
this.$set(this.count, "loadStatus", "noMore");
this.list.push(...data);
this.pointList.push(...data);
} else {
this.list.push(...data);
this.pointList.push(...data);
if (data.length < 10) this.$set(this.count, "loadStatus", "noMore");
}
}
});
},
initpointDataData() {
//累计获得累计使用
/**
* 获得累计使用
*/
initPointData() {
getMemberPointSum().then((res) => {
this.pointData = res.data.result;
});
},
goDetail() {
//积分明细
uni.navigateTo({
url: "/pages/point/pointDetail",
});
},
goIntro() {
//跳转详情
uni.navigateTo({
url: "/pages/pointTrade/pointIntro",
});
},
},
};
</script>
<style lang="scss" scoped>
.mp-weixin-more {
width: 96vw;
padding: 0 2vw;
display: flex;
align-items: center;
height: 100%;
justify-content: space-between;
}
.u-close--top-right {
top: 22rpx;
}
.i_time {
color: $u-tips-color;
}
.title {
height: 80rpx;
text-align: center;
@@ -182,40 +107,22 @@ export default {
font-weight: bold;
}
.btn-mini {
margin: 20rpx auto;
font-size: 24rpx;
border-radius: 6rpx;
}
.u-form-item {
padding: 10rpx 30rpx 10rpx 20rpx;
}
.dataList {
.point-item {
width: 100%;
height: 130rpx;
padding: 0 20rpx;
background: #ffffff;
font-size: $font-sm;
// line-height: 2em;
border-bottom: 1px solid $border-color-light;
display: flex;
justify-content: end;
align-items: center;
.colorRed {
color: #f04844;
}
> view:nth-child(1) {
flex: 1;
line-height: 40rpx;
view {
color: #666666;
}
:last-child {
color: #999;
}
@@ -233,35 +140,17 @@ export default {
border-radius: 0 0 20rpx 20rpx;
margin: 0 20rpx;
font-size: 26rpx;
/deep/ .u-col {
text-align: center !important;
}
/deep/ .u-col:first-child {
border-right: 1px solid $border-color-light;
}
.pcolor {
color: #4ebb9d;
}
}
.portrait-box3 {
// #ifdef MP-WEIXIN
display: flex;
// #endif
height: 110rpx;
background-color: #f1f1f1;
margin-top: 20rpx;
font-size: 28rpx;
.u-col {
padding: 0 20rpx;
}
}
.content {
background: #f9f9f9;
}
@@ -312,27 +201,11 @@ export default {
border-radius: 20rpx 0px 0px 20rpx;
}
}
.point-img {
height: 108rpx;
width: 108rpx;
margin-bottom: 30rpx;
}
.current {
font-size: 26rpx;
text {
vertical-align: middle;
}
> text:nth-child(2) {
color: #ffee80;
font-size: 40rpx;
margin-left: 20rpx;
}
}
.point {
font-size: 56rpx;
}

View File

@@ -1,135 +0,0 @@
<template>
<view class="point-detail">
<empty v-if="nomsg"></empty>
<view v-else class="box" v-for="(con,conIndex) in content" :key="con.conIndex">
<view class="time">
<view> <u-icon name="calendar"></u-icon>&nbsp; {{getMonth(con.months)}}</view>
<view>获得{{con.point}} 使用{{con.consumer_point}}</view>
</view>
<view class="dataList" v-for="(item,index) in con.history" :key="index">
<view>
<view>{{item.reason}}</view>
<view>{{item.time | unixToDate}}</view>
</view>
<view :class="{colorRed:item.consum_point_type==0}">{{item.consum_point_type==0?'-':'+'}}{{item.consum_point}}</view>
<view>{{item.point}}</view>
</view>
</view>
<uni-load-more :status="loadStatus"></uni-load-more>
</view>
</template>
<script>
import {getPointsDataDetail} from '@/api/members.js';
export default {
data() {
return {
params:{
pageNumber:1,
pageSize:10,
start_time:0,
end_time:0
},
content:[],
loadStatus:'more',
nomsg:false,
};
},
onLoad() {
this.getDetailList()
},
methods:{
getDetailList(){
uni.showLoading({
title:'加载中'
})
getPointsDataDetail(this.params).then(res=>{
uni.stopPullDownRefresh();
uni.hideLoading()
if (res.statusCode == 200) {
console.log(res)
let data = res.data;
if (data.length==0) {
if(this.content.length==0){
this.nomsg = true;
}else{
this.loadStatus = 'noMore';
}
}else if(data[data.length-1].history.length<10){
this.content.push(...res.data);
this.loadStatus = 'noMore';
}else{
this.content.push(...res.data);
}
}
})
},
getMonth(time){
console.log(time)
let str = time+'';
let arr = str.split('');
arr.splice(4,0,'-');
return arr.join('')
}
},
onReachBottom(){
if(this.loadStatus == 'more'){
this.params.pageNumber++;
this.getDetailList()
}
}
}
</script>
<style lang="scss" scoped>
.point-detail{
.box{
.time{
display: flex;
justify-content: space-between;
padding: 0 20rpx;
align-items: center;
height: 112rpx;
color: #999999;
font-size: $font-sm;
}
.dataList {
width: 100%;
height: 120rpx;
border-top: 1px solid #f2f2f2;
padding: 30rpx;
background: #ffffff;
font-size: $font-sm;
// line-height: 1.5em;
margin-bottom: 10rpx;
display: flex;
justify-content: end;
align-items: center;
.colorRed{
color: #f04844;
}
>view:nth-child(1){
flex: 1;
line-height: 1.5em;
:nth-child(1){
color: #666666;
}
:nth-child(2){
color: #999;
}
}
>view:nth-child(2){
width: 80rpx;
text-align: center;
}
>view:nth-child(3){
width: 100rpx;
text-align: center;
}
}
}
}
</style>