Commit 4b41a47c by 高淑倩

modify: 进度

parent 7917b769
......@@ -82,10 +82,33 @@ wxService.page({
wxService.post(`/sale/touchpoints/pointConsumptionCount/getPointConsumptionCount?activityId=${activityId}&memberId=${memberId}`).then(res => {
if (res) {
const { result, data } = res.data
// percent
let newPercent = 0
let hasNum = data.surplusExchangeCount
let totalPoints = data.totalPoints
let goal = this.data.goal
if(hasNum) {
if(parseInt( totalPoints % goal) == 0 ) {
newPercent = goal
}else {
if(totalPoints) {
newPercent = totalPoints % goal
} else {
newPercent = 0
}
}
} else {
if(totalPoints) {
newPercent = totalPoints % goal
} else {
newPercent = 0
}
}
if (result == 0) {
this.setData({
countObj: data,
currentPercent: (100 / this.data.goal) * data.surplusPoints,
currentPercent: 100 / (this.data.goal / newPercent),
surplusExchangeCount: data.surplusExchangeCount
}, () => {
wx.hideLoading()
......
......@@ -3,12 +3,18 @@
<status-img imgHeight="{{imgHeight}}" img="{{detailImage}}" />
<view class="detail-info border_box">
<view class="info-top weui-flex df-j--bt">
<!--可领取次数 存在 3/3 不存在 0/3 -->
<view class="info-num">
进度:
<text class="point_color" wx:if="{{countObj.surplusExchangeCount}}"> {{countObj.totalPoints ? tools.parse(countObj.totalPoints / goal) : 0}}</text>
<text class="point_color" wx:else> {{countObj.totalPoints ? countObj.totalPoints % goal : 0}}</text>
<!--<text class="point_color"> {{countObj.totalPoints ? countObj.totalPoints % goal : 0}}</text>-->
进度:
<!--可领取次数_surplusExchangeCount 存在 3/3 不存在 0/3 -->
<span wx:if="{{countObj.surplusExchangeCount}}">
<!-- 被整除 是 显示目标集点 否 显示余数-->
<text class="point_color" wx:if="{{tools.parse(countObj.totalPoints % goal) == 0}}"> {{goal}}</text>
<text class="point_color" wx:else> {{countObj.totalPoints ? tools.parse(countObj.totalPoints % goal) : 0}}</text>
<!-- <text class="point_color" wx:if="{{tools.parse(countObj.totalPoints / goal) == countObj.totalPoints}}"> {{goal}}</text>
<text class="point_color" wx:else> {{countObj.totalPoints ? tools.parse(countObj.totalPoints % goal) : 0}}</text>-->
</span>
<text class="point_color" wx:else> {{countObj.totalPoints ? tools.parse(countObj.totalPoints % goal) : 0}}</text>
/ {{goal}}
</view>
<view class="info-ready-num">
......@@ -19,7 +25,7 @@
<view class="info-progress border_box">
<x-progress-point
active-color='#3EEB9A, #04C25C'
percent='{{currentPercent}}'
percent='{{currentPercent != null ? currentPercent : 0}}'
stroke-width='20'
radius='20'
/>
......
var parse = function(str) {
function parse (str) {
return parseInt(str);
};
module.exports.parse = parse;
\ No newline at end of file
function isNaN(str) {
return isNaN(str);
};
function isFinite(str) {
return isFinite(str)
}
module.exports = {
parse: parse,
isNaN: isNaN,
isFinite: isFinite
}
\ No newline at end of file
<!--pages/pointList/pointList.wxml-->
<wxs src="./tools.wxs" module="tools" />
<view class="point-list border_box">
<block wx:for="{{pointList}}" wx:key="item">
<view class="point border_box" data-id="{{item.id}}" bindtap="handleDetail">
<status-img img="{{item.listImage}}" />
<view class="progress weui-flex df-j--bt">
<view class="rate">进度:
<!--<text class="point_color">{{item.surplusPoints}}</text> -->
<!--<text class="point_color">{{item.totalPoints ? item.totalPoints % item.goal : 0}}</text>-->
<text class="point_color" wx:if="{{item.surplusExchangeCount}}"> {{item.totalPoints ? tools.parse(item.totalPoints / item.goal) : 0}}</text>
<text class="point_color" wx:else> {{item.totalPoints ? item.totalPoints % item.goal : 0}}</text>
<span wx:if="{{item.surplusExchangeCount}}">
<text class="point_color" wx:if="{{tools.parse(item.totalPoints % item.goal) == 0}}"> {{item.goal}}</text>
<text class="point_color" wx:else> {{item.totalPoints && item.goal ? tools.parse(item.totalPoints % item.goal) : 0}}</text>
</span>
<text class="point_color" wx:else> {{item.totalPoints && item.goal ? item.totalPoints % item.goal : 0}}</text>
/ {{item.goal}}
</view>
<view class="time-out">距离结束时间:
......
......@@ -2,4 +2,6 @@ var parse = function(str) {
return parseInt(str);
};
module.exports.parse = parse;
\ No newline at end of file
module.exports = {
parse: parse
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment