提交 50a85aa6 作者: wk

积分兑换记录

父级 f71c6784
...@@ -72,6 +72,16 @@ ...@@ -72,6 +72,16 @@
color: #FF4D4F; color: #FF4D4F;
} }
.image-add {
width: 40rpx;
height: 40rpx;
}
.line-grey {
height: 2rpx;
background-color: #F5F5F5;
}
.uni-blue-button { .uni-blue-button {
height: 96rpx; height: 96rpx;
display: flex; display: flex;
......
const $date = {
timeDiff(time, isBefore) {
var dateTime = new Date();
var end = new Date(time);
var dateDiff = 0
if (isBefore) {
dateDiff = dateTime.getTime() - end.getTime(); //时间差的毫秒数
} else {
dateDiff = end.getTime() - dateTime.getTime(); //时间差的毫秒数
}
if (dateDiff > 0) {
return this.formatDuring(dateDiff)
} else {
return "0秒"
}
},
formatDuring(mss) {
let days = Math.floor(mss / (1000 * 60 * 60 * 24));
let hours = Math.floor((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
let minutes = Math.floor((mss % (1000 * 60 * 60)) / (1000 * 60));
let seconds = Math.round((mss % (1000 * 60)) / 1000);
if (days > 0) {
return days + "天" + hours + "小时" + minutes + "分钟" + seconds + "秒";
} else if (hours > 0) {
return hours + "小时" + minutes + "分钟" + seconds + "秒";
} else if (minutes > 0) {
return minutes + "分钟" + seconds + "秒";
} else if (seconds > 0) {
return seconds + "秒";
}
},
}
export default $date
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<view class="tabbar-item" v-for="(item,index) in tabList" :class="[item.centerItem ? 'center-item' : '']" <view class="tabbar-item" v-for="(item,index) in tabList" :class="[item.centerItem ? 'center-item' : '']"
@click="changeItem(item)" :key="index"> @click="changeItem(item)" :key="index">
<view class="item-top" :style="{padding: item.id == 2?0:'10rpx'}"> <view class="item-top" :style="{padding: item.id == 2?0:'10rpx'}">
<image :src="tabId==item.id?item.selectIcon:item.icon" mode=""></image> <image :src="tabId==item.id?item.selectIcon:item.icon"></image>
</view> </view>
<view class="item-bottom" :class="[tabId==item.id ? 'item-active' : '']"> <view class="item-bottom" :class="[tabId==item.id ? 'item-active' : '']">
<text>{{item.text}}</text> <text>{{item.text}}</text>
...@@ -173,8 +173,8 @@ ...@@ -173,8 +173,8 @@
.tabbar-container .center-item .item-top { .tabbar-container .center-item .item-top {
flex-shrink: 0; flex-shrink: 0;
width: 130rpx; width: 150rpx;
height: 130rpx; height: 150rpx;
position: absolute; position: absolute;
top: -50rpx; top: -50rpx;
/* left: calc(50% - 70rpx); */ /* left: calc(50% - 70rpx); */
......
...@@ -9,6 +9,8 @@ import $config from './common/config.js' ...@@ -9,6 +9,8 @@ import $config from './common/config.js'
import $mta from "api/mta.js" import $mta from "api/mta.js"
import $http from './api/request.js' import $http from './api/request.js'
import $imageUtils from './common/imageUtils.js' import $imageUtils from './common/imageUtils.js'
import $date from "./common/dateUtils.js"
Vue.prototype.$date = $date
Vue.prototype.$http = $http Vue.prototype.$http = $http
Vue.prototype.$mta = $mta Vue.prototype.$mta = $mta
Vue.prototype.$toast = $toast Vue.prototype.$toast = $toast
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view> <view>
<view class="search-form-parent"> <view class="search-form-parent">
<view class="search-form"> <view class="search-form">
<image src="../../static/search-icon.png" style="width: 40rpx;height: 40rpx;"></image> <image src="../../../../static/search-icon.png" style="width: 40rpx;height: 40rpx;"></image>
<input placeholder="搜索人员" placeholder-class="search-placeholder" class="search-input" v-model="key" <input placeholder="搜索人员" placeholder-class="search-placeholder" class="search-input" v-model="key"
@input="search" /> @input="search" />
</view> </view>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</view> </view>
<view class="user-item" v-else>{{user.user_name}}({{user.job_name||""}})</view> <view class="user-item" v-else>{{user.user_name}}({{user.job_name||""}})</view>
<image <image
:src="selectIds.indexOf(user.user_id)!=-1?'../../static/cb-big-sel.png':'../../static/cb-big.png'" :src="selectIds.indexOf(user.user_id)!=-1?'../../../../static/cb-big-sel.png':'../../../../static/cb-big.png'"
style="width: 48rpx;height: 48rpx;"></image> style="width: 48rpx;height: 48rpx;"></image>
</view> </view>
</view> </view>
......
...@@ -83,7 +83,8 @@ ...@@ -83,7 +83,8 @@
showed: 1, showed: 1,
app_endpoint: 2, app_endpoint: 2,
is_publish: 1, is_publish: 1,
app_sort: 1 app_sort: 1,
publish_target: "ydt"
}, },
orgName: "", orgName: "",
mostUsed: {}, mostUsed: {},
...@@ -116,6 +117,8 @@ ...@@ -116,6 +117,8 @@
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
getOrgTree() { getOrgTree() {
...@@ -130,6 +133,8 @@ ...@@ -130,6 +133,8 @@
this.trees = result.data.list[0].children_list this.trees = result.data.list[0].children_list
this.orgName = uni.getStorageSync("org_name") || result.data.list[0].name this.orgName = uni.getStorageSync("org_name") || result.data.list[0].name
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
toChangeOrg() { toChangeOrg() {
...@@ -177,6 +182,8 @@ ...@@ -177,6 +182,8 @@
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
toAlone(model, info) { toAlone(model, info) {
...@@ -223,6 +230,8 @@ ...@@ -223,6 +230,8 @@
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
getNeedDo() { getNeedDo() {
...@@ -235,6 +244,8 @@ ...@@ -235,6 +244,8 @@
} }
}).then((result) => { }).then((result) => {
this.needDoCount = result.data.total_count this.needDoCount = result.data.total_count
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
getAppGroup() { getAppGroup() {
...@@ -266,6 +277,8 @@ ...@@ -266,6 +277,8 @@
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
getAppList: function() { getAppList: function() {
...@@ -297,6 +310,8 @@ ...@@ -297,6 +310,8 @@
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
sortGroup: function(arr) { sortGroup: function(arr) {
......
...@@ -12,15 +12,15 @@ ...@@ -12,15 +12,15 @@
<view class="process-centent"> <view class="process-centent">
<view style="display: flex;flex-direction: row;align-items: center;" v-if="isShow"> <view style="display: flex;flex-direction: row;align-items: center;" v-if="isShow">
<view class="text-black-normal" style="flex: 1;">请选择执行人</view> <view class="text-black-normal" style="flex: 1;">请选择执行人</view>
<image src="../../static/add-ic.png" style="width: 40rpx;height: 40rpx;" @click="toSelectExecutor"> <image src="../../../static/add-ic.png" style="width: 40rpx;height: 40rpx;" @click="toSelectExecutor">
</image> </image>
</view> </view>
<view style="display: flex;flex-direction: row;flex-wrap: wrap;margin-top: 20rpx;"> <view style="display: flex;flex-direction: row;flex-wrap: wrap;margin-top: 20rpx;">
<view v-for="(item,index) in executors" :key="index" :index="index" @click="clickItem(index)"> <view v-for="(item,index) in executors" :key="index" :index="index" @click="clickItem(index)">
<view class="label-item"> <view class="label-item">
<text>{{item.user_name}}</text> <text>{{item.user_name}}</text>
<image src="../../static/close-btn.png" style="width: 40rpx;height: 40rpx;margin-left: 20rpx;" <image src="../../../static/close-btn.png"
@click="deleteExe(index)"></image> style="width: 40rpx;height: 40rpx;margin-left: 20rpx;" @click="deleteExe(index)"></image>
</view> </view>
</view> </view>
</view> </view>
...@@ -29,15 +29,16 @@ ...@@ -29,15 +29,16 @@
<view class="process-notice-centent"> <view class="process-notice-centent">
<view style="display: flex;flex-direction: row;align-items: center;"> <view style="display: flex;flex-direction: row;align-items: center;">
<view class="text-black-normal" style="flex: 1;">请选择通知人</view> <view class="text-black-normal" style="flex: 1;">请选择通知人</view>
<image src="../../static/add-ic.png" style="width: 40rpx;height: 40rpx;" @click="toSelectNotifier"> <image src="../../../static/add-ic.png" style="width: 40rpx;height: 40rpx;"
@click="toSelectNotifier">
</image> </image>
</view> </view>
<view style="display: flex;flex-direction: row;flex-wrap: wrap;margin-top: 20rpx;"> <view style="display: flex;flex-direction: row;flex-wrap: wrap;margin-top: 20rpx;">
<view v-for="(item,index) in notifiers" :key="index" :index="index" @click="clickItem(index)"> <view v-for="(item,index) in notifiers" :key="index" :index="index" @click="clickItem(index)">
<view class="label-item"> <view class="label-item">
<text>{{item.user_name}}</text> <text>{{item.user_name}}</text>
<image src="../../static/close-btn.png" style="width: 40rpx;height: 40rpx;margin-left: 20rpx;" <image src="../../../static/close-btn.png"
@click="deleteNot(index)"></image> style="width: 40rpx;height: 40rpx;margin-left: 20rpx;" @click="deleteNot(index)"></image>
</view> </view>
</view> </view>
</view> </view>
......
...@@ -13,9 +13,7 @@ ...@@ -13,9 +13,7 @@
<view class="app-list"> <view class="app-list">
<view class="menu-item" v-for="(item,index) in selList" :key="index"> <view class="menu-item" v-for="(item,index) in selList" :key="index">
<view class="logo-content"> <view class="logo-content">
<image <image :src="item.ydt_logo" class="logo"></image>
:src="item.ydt_logo"
class="logo"></image>
<image src="../../../static/delete-ic.png" class="del" @click="toDel(index)"></image> <image src="../../../static/delete-ic.png" class="del" @click="toDel(index)"></image>
</view> </view>
<view class="text">{{nameLengthDeal(item.app_name)}}</view> <view class="text">{{nameLengthDeal(item.app_name)}}</view>
...@@ -70,7 +68,8 @@ ...@@ -70,7 +68,8 @@
showed: 1, showed: 1,
app_endpoint: 2, app_endpoint: 2,
is_publish: 1, is_publish: 1,
app_sort: 1 app_sort: 1,
publish_target: "ydt"
}, },
} }
}, },
......
...@@ -79,7 +79,16 @@ ...@@ -79,7 +79,16 @@
<image src="../../static/right-arrow.png" @click="toLinkScore"></image> <image src="../../static/right-arrow.png" @click="toLinkScore"></image>
</view> </view>
<view class="score-count">剩余:{{scoreDetail.integral||0}}积分</view> <view class="score-count">剩余:{{scoreDetail.integral||0}}积分</view>
<view class="record-content" v-if="changeRecords.length>0">
<!-- <image src="../../static/notice.png" style="width: 20rpx;height: 20rpx;"></image> -->
<swiper circular="true" :autoplay="true" class="swiper" :vertical="true">
<swiper-item v-for="(item,index) in changeRecords" :key="index" class="item">
<view class="record">
{{dealTimeDiff(item.created_at)}}{{item.ex_worker_name}}兑换了{{item.goods_name}}
</view>
</swiper-item>
</swiper>
</view>
<view class="list-content"> <view class="list-content">
<view class="left-content"> <view class="left-content">
<view class="item-content" v-for="(item,index) in leftList()" :key="index"> <view class="item-content" v-for="(item,index) in leftList()" :key="index">
...@@ -145,7 +154,8 @@ ...@@ -145,7 +154,8 @@
role: "VISITOR", role: "VISITOR",
nowTime: "", nowTime: "",
project: {}, project: {},
project_id: "" project_id: "",
changeRecords: []
} }
}, },
onLoad() { onLoad() {
...@@ -243,6 +253,7 @@ ...@@ -243,6 +253,7 @@
if (this.role == 'WORKER') { if (this.role == 'WORKER') {
this.getGoodsList() this.getGoodsList()
this.getMyScore() this.getMyScore()
this.getChangeRecord()
} }
}) })
}, },
...@@ -287,9 +298,21 @@ ...@@ -287,9 +298,21 @@
}) })
}, },
exchange(item) { exchange(item) {
if (item.goods_integral > this.scoreDetail.integral) {
uni.showModal({
title: '提示',
content: `积分不足,无法兑换`,
showCancel: false,
confirmText: "知道了",
confirmColor: "#3B73FE",
success: (res) => {}
})
return
}
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: `使用${item.goods_integral}积分兑换${item.goods_name}`, content: `使用${item.goods_integral}积分兑换${item.goods_name}`,
confirmColor: "#3B73FE",
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
this.exchangeGood(item) this.exchangeGood(item)
...@@ -306,11 +329,11 @@ ...@@ -306,11 +329,11 @@
}, },
// 兑换商品 // 兑换商品
exchangeGood(item) { exchangeGood(item) {
ScoreApi.exchangeGood({ Api.exchangeGood({
data: { data: {
goods_id: item.goods_id, goods_id: item.goods_id,
worker_id: this.userInfo.worker.worker_id, worker_id: this.userInfo.worker.workerId,
project_id: this.project.project_id, project_id: this.project_id,
order_num: 1 order_num: 1
} }
}).then(res => { }).then(res => {
...@@ -319,7 +342,10 @@ ...@@ -319,7 +342,10 @@
title: '兑换成功' title: '兑换成功'
}) })
this.getMyScore() this.getMyScore()
this.getChangeRecord()
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
getBanners() { getBanners() {
...@@ -336,6 +362,8 @@ ...@@ -336,6 +362,8 @@
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
getNews() { getNews() {
...@@ -352,6 +380,8 @@ ...@@ -352,6 +380,8 @@
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
//获取常用应用 //获取常用应用
...@@ -362,6 +392,8 @@ ...@@ -362,6 +392,8 @@
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
getRecentlyApp() { getRecentlyApp() {
...@@ -371,6 +403,8 @@ ...@@ -371,6 +403,8 @@
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
toLinkScore() { toLinkScore() {
...@@ -389,15 +423,41 @@ ...@@ -389,15 +423,41 @@
data: { data: {
project_id: this.userInfo.worker.projectId, project_id: this.userInfo.worker.projectId,
worker_id: this.userInfo.worker.workerId, worker_id: this.userInfo.worker.workerId,
time: date.getFullYear() + "-" + date.getMonth() + 1 + "-" + date.getDate() time: date.getFullYear() + "-" + date.getMonth() + 1 + "-" + date.getDate(),
} }
}).then(res => { }).then(res => {
console.log("用户积分", res); console.log("用户积分", res);
if (res.code === 0) { if (res.code === 0) {
this.scoreDetail = res.data this.scoreDetail = res.data
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
getChangeRecord() {
Api.getExchangeList({
data: {
project_id: this.project_id,
type: 1,
is_page: 1,
page: 1,
page_size: 10,
order: "desc"
}
}).then((result) => {
console.log("兑换记录", result);
if (result.code == 0) {
this.changeRecords = result.data.list
} else {
this.$toast.showToast(result.msg)
}
}, (err) => {
this.$toast.showToast(err.msg)
})
},
dealTimeDiff(startTime) {
return this.$date.timeDiff(startTime, true)
},
select(index) { select(index) {
if (index == 0) { if (index == 0) {
this.isCommonSel = true this.isCommonSel = true
...@@ -425,6 +485,8 @@ ...@@ -425,6 +485,8 @@
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
isCompShow(comNo) { isCompShow(comNo) {
...@@ -452,6 +514,7 @@ ...@@ -452,6 +514,7 @@
this.project_id = this.userInfo.worker.projectId this.project_id = this.userInfo.worker.projectId
this.getGoodsList() this.getGoodsList()
this.getMyScore() this.getMyScore()
this.getChangeRecord()
uni.setStorageSync("org_no", this.userInfo.user.org_no) uni.setStorageSync("org_no", this.userInfo.user.org_no)
uni.setStorageSync("org_name", this.userInfo.currentProject.projectName) uni.setStorageSync("org_name", this.userInfo.currentProject.projectName)
this.city = this.userInfo.currentProject.city this.city = this.userInfo.currentProject.city
...@@ -465,6 +528,8 @@ ...@@ -465,6 +528,8 @@
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
toLogin: function() { toLogin: function() {
...@@ -555,6 +620,8 @@ ...@@ -555,6 +620,8 @@
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
// 用户授权 // 用户授权
...@@ -621,6 +688,8 @@ ...@@ -621,6 +688,8 @@
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
toAlone(model, info) { toAlone(model, info) {
...@@ -1106,6 +1175,33 @@ ...@@ -1106,6 +1175,33 @@
} }
} }
} }
.record-content {
display: flex;
flex-direction: row;
.swiper {
height: 32px;
flex: 1;
.item {
display: flex;
flex-direction: row;
align-items: center;
.record {
font-family: "MicrosoftYaHeiUI";
font-weight: 400;
flex: 1;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 24rpx;
color: #FFAA44;
}
}
}
}
} }
} }
</style> </style>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</view> </view>
<image :src="newDetail.articleImg" class="image"></image> <image :src="newDetail.articleImg" class="image"></image>
<view class="text-content"> <view class="text-content">
<rich-text :nodes="newDetail.content"></rich-text> <rich-text :nodes="newDetail.content" style="font-size: 28rpx;color: #333;"></rich-text>
</view> </view>
</view> </view>
<view class="other-content"> <view class="other-content">
......
...@@ -101,6 +101,8 @@ ...@@ -101,6 +101,8 @@
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
departChange(e) { departChange(e) {
...@@ -151,6 +153,8 @@ ...@@ -151,6 +153,8 @@
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
getPost() { getPost() {
...@@ -167,6 +171,8 @@ ...@@ -167,6 +171,8 @@
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
} }
} }
......
...@@ -77,10 +77,13 @@ ...@@ -77,10 +77,13 @@
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
toNext() { toNext() {
if (this.code == "") { if (this.code == "") {
this.$toast.showToast("请输入邀请码")
return return
} }
uni.navigateTo({ uni.navigateTo({
...@@ -141,6 +144,8 @@ ...@@ -141,6 +144,8 @@
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
} }
} }
......
...@@ -92,7 +92,9 @@ ...@@ -92,7 +92,9 @@
if (code == 0) { //已绑定直接登录 if (code == 0) { //已绑定直接登录
this.directLogin() this.directLogin()
} else if (code == 33199) { //未绑定 去绑定 } else if (code == 33199) { //未绑定 去绑定
this.showMadel() uni.navigateTo({
url: "/pages/login/wxLogin/wxLogin"
})
} else { //其他错误 } else { //其他错误
uni.showToast({ uni.showToast({
title: res.data.msg, title: res.data.msg,
......
...@@ -68,6 +68,8 @@ ...@@ -68,6 +68,8 @@
} else { } else {
this.$toast.showToast(result.msg) this.$toast.showToast(result.msg)
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
authLogin() { authLogin() {
...@@ -148,6 +150,8 @@ ...@@ -148,6 +150,8 @@
icon: 'none' icon: 'none'
}) })
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
showMadel: function() { showMadel: function() {
...@@ -191,6 +195,8 @@ ...@@ -191,6 +195,8 @@
url: "/pages/index/index" url: "/pages/index/index"
}) })
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
directLogin: function() { directLogin: function() {
...@@ -218,6 +224,8 @@ ...@@ -218,6 +224,8 @@
icon: 'none' icon: 'none'
}) })
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
login() { login() {
...@@ -244,6 +252,8 @@ ...@@ -244,6 +252,8 @@
let result = res.data let result = res.data
console.log(result); console.log(result);
_this.unique_token = result.unique_token _this.unique_token = result.unique_token
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
}); });
......
...@@ -30,9 +30,7 @@ ...@@ -30,9 +30,7 @@
</template> </template>
<script> <script>
// import { import Api from "../../../api/api.js"
// ScoreApi
// } from '../../services/Score/index.js'
export default { export default {
data() { data() {
return { return {
...@@ -49,15 +47,15 @@ ...@@ -49,15 +47,15 @@
} }
}, },
onShow() { //监听页面显示 onShow() { //监听页面显示
this.userInfo = uni.getStorageSync('userInfo') this.userInfo = getApp().globalData.userInfo
this.project = uni.getStorageSync('userProject') || {} this.project_id = this.userInfo.currentProject.projectId
let date = new Date() let date = new Date()
let year = date.getFullYear() let year = date.getFullYear()
let month = date.getMonth() + 1 let month = date.getMonth() + 1
let day = date.getDate() let day = date.getDate()
this.requestParam.time = year + '-' + month + '-' + day this.requestParam.time = year + '-' + month + '-' + day
this.requestParam.worker_id = this.userInfo.worker_id this.requestParam.worker_id = this.userInfo.worker.workerId || ''
this.requestParam.project_id = this.project.project_id this.requestParam.project_id = this.project_id || ''
this.getScoreDetail() //暂时先注释掉02.16 this.getScoreDetail() //暂时先注释掉02.16
// for(var i=0;i<100;i++){//历史明细假数据 // for(var i=0;i<100;i++){//历史明细假数据
// this.scoreDetail.listData.push({id:i+1,time:'2022-02-16',item_name:'csy'+(i+1),integral:i+1}) // this.scoreDetail.listData.push({id:i+1,time:'2022-02-16',item_name:'csy'+(i+1),integral:i+1})
...@@ -72,7 +70,7 @@ ...@@ -72,7 +70,7 @@
}, },
// 获取积分数据 // 获取积分数据
getScoreDetail() { getScoreDetail() {
ScoreApi.getUserScore({ Api.getUserScore({
data: this.requestParam data: this.requestParam
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
...@@ -124,7 +122,8 @@ ...@@ -124,7 +122,8 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
height: 104rpx; padding: 30rpx;
border-radius: 30rpx;
position: relative; position: relative;
border-bottom: 1px solid rgba($color: #999, $alpha: 0.5); border-bottom: 1px solid rgba($color: #999, $alpha: 0.5);
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<view class="info-content" :style="{top:statusBarHeight+45+'px'}"> <view class="info-content" :style="{top:statusBarHeight+45+'px'}">
<image src="../../static/mine-bg.png" class="image"></image> <image src="../../static/mine-bg.png" class="image"></image>
<view class="company">{{currentJob.org_name||""}}</view> <view class="company">{{currentJob.org_name||""}}</view>
<view class="name">{{userInfo.user.user_name}} {{currentJob.job_name}}</view> <view class="name">{{userInfo.user.user_name||""}} {{currentJob.job_name||""}}</view>
<view class="project">{{currentJob.dept_name}}</view> <view class="project">{{currentJob.dept_name||""}}</view>
<image src="../../static/avatar-def.png" class="avatar"></image> <image src="../../static/avatar-def.png" class="avatar"></image>
</view> </view>
</view> </view>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<view class="score-content" :style="{top:statusBarHeight+53+'px'}"> <view class="score-content" :style="{top:statusBarHeight+53+'px'}">
<image src="../../../static/ic-coin.png" class="image"></image> <image src="../../../static/ic-coin.png" class="image"></image>
<view class="score-count-content"> <view class="score-count-content">
<view class="count">{{score}}</view> <view class="count">{{scoreDetail.integral||0}}</view>
<view class="unit">积分</view> <view class="unit">积分</view>
</view> </view>
<view class="history-content" @click="toHistory"> <view class="history-content" @click="toHistory">
...@@ -25,25 +25,23 @@ ...@@ -25,25 +25,23 @@
<view class="list-content"> <view class="list-content">
<view class="left-content"> <view class="left-content">
<view class="item-content" v-for="(item,index) in leftList()" :key="index"> <view class="item-content" v-for="(item,index) in leftList()" :key="index">
<image class="image" <image class="image" :src="item.goods_img">
src="https://img.alicdn.com/imgextra/i1/27493396/O1CN013NYTVu1axPeymS1yi_!!0-saturn_solar.jpg_468x468q75.jpg_.webp">
</image> </image>
<view class="count">500积分可兑换</view> <view class="count">{{item.goods_integral}}积分可兑换</view>
<view class="name-content"> <view class="name-content">
<view class="name">XXX牌雨伞XXX牌雨伞XXX牌雨伞XXX牌雨伞</view> <view class="name">{{item.goods_name}}</view>
<image src="../../../static/exchange.png" class="image"></image> <image src="../../../static/exchange.png" class="image" @click="exchange(item)"></image>
</view> </view>
</view> </view>
</view> </view>
<view class="right-content"> <view class="right-content">
<view class="item-content" v-for="(item,index) in rightList()" :key="index"> <view class="item-content" v-for="(item,index) in rightList()" :key="index">
<image class="image" <image class="image" :src="item.goods_img">
src="https://bkimg.cdn.bcebos.com/pic/8718367adab44aedf44fb8c1b11c8701a18bfb96?x-bce-process=image/watermark,image_d2F0ZXIvYmFpa2U4MA==,g_7,xp_5,yp_5">
</image> </image>
<view class="count">500积分可兑换</view> <view class="count">{{item.goods_integral}}积分可兑换</view>
<view class="name-content"> <view class="name-content">
<view class="name">XXX牌雨伞XXX牌雨伞XXX牌雨伞XXX牌雨伞</view> <view class="name">{{item.goods_name}}</view>
<image src="../../../static/exchange.png" class="image"></image> <image src="../../../static/exchange.png" class="image" @click="exchange(item)"></image>
</view> </view>
</view> </view>
</view> </view>
...@@ -76,15 +74,15 @@ ...@@ -76,15 +74,15 @@
onLoad(option) { onLoad(option) {
const info = uni.getSystemInfoSync() const info = uni.getSystemInfoSync()
this.statusBarHeight = info.statusBarHeight this.statusBarHeight = info.statusBarHeight
this.userInfo = uni.getStorageSync('userInfo') this.userInfo = getApp().globalData.userInfo
this.project = uni.getStorageSync('userProject') || {} this.project_id = this.userInfo.currentProject.projectId
let date = new Date() let date = new Date()
let year = date.getFullYear() let year = date.getFullYear()
let month = date.getMonth() + 1 let month = date.getMonth() + 1
let day = date.getDate() let day = date.getDate()
this.requestParam.time = year + '-' + month + '-' + day this.requestParam.time = year + '-' + month + '-' + day
this.requestParam.worker_id = this.userInfo.worker_id || '' this.requestParam.worker_id = this.userInfo.worker.workerId || ''
this.requestParam.project_id = this.project.project_id || '' this.requestParam.project_id = this.project_id || ''
this.getGoodsList() this.getGoodsList()
this.getScoreDetail() this.getScoreDetail()
}, },
...@@ -92,22 +90,20 @@ ...@@ -92,22 +90,20 @@
getScoreDetail() { getScoreDetail() {
var date = new Date() var date = new Date()
Api.getUserScore({ Api.getUserScore({
data: { data: this.requestParam
project_id: getApp().globalData.userInfo.worker.projectId,
worker_id: getApp().globalData.userInfo.worker.workerId,
time: date.getFullYear() + "-" + date.getMonth() + 1 + "-" + date.getDate()
}
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.scoreDetail = res.data this.scoreDetail = res.data
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
getGoodsList() { getGoodsList() {
Api.getGoodsList({ Api.getGoodsList({
data: { data: {
is_page: 0, is_page: 0,
project_id: getApp().globalData.userInfo.worker.projectId project_id: this.project_id
} }
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
...@@ -125,6 +121,8 @@ ...@@ -125,6 +121,8 @@
} }
}) })
} }
}, (err) => {
this.$toast.showToast(err.msg)
}) })
}, },
toHistory() { toHistory() {
...@@ -150,6 +148,51 @@ ...@@ -150,6 +148,51 @@
} }
return list return list
}, },
exchange(item) {
if (item.goods_integral > this.scoreDetail.integral) {
uni.showModal({
title: '提示',
content: `积分不足,无法兑换`,
showCancel: false,
confirmText: "知道了",
confirmColor: "#3B73FE",
success: (res) => {}
})
return
}
uni.showModal({
title: '提示',
content: `使用${item.goods_integral}积分兑换${item.goods_name}`,
confirmColor: "#3B73FE",
success: (res) => {
if (res.confirm) {
this.exchangeGood(item)
} else if (res.cancel) {
}
}
})
},
// 兑换商品
exchangeGood(item) {
Api.exchangeGood({
data: {
goods_id: item.goods_id,
worker_id: this.userInfo.worker.workerId,
project_id: this.project_id,
order_num: 1
}
}).then(res => {
if (res.code === 0) {
uni.showToast({
title: '兑换成功'
})
this.getScoreDetail()
}
}, (err) => {
this.$toast.showToast(err.msg)
})
},
} }
} }
</script> </script>
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
</view> </view>
<view class="model-view" :style="showModal?'':'display:none;'"> <view class="model-view" :style="showModal?'':'display:none;'">
<view class="model-out-box"> <view class="model-out-box">
<view class="text-black-normal">{{curTitle}}</view> <view class="text-black-normal" v-if="false">{{curTitle}}</view>
<view class="model-content"> <view class="model-content">
<canvas canvas-id="qrcode" style="margin: 40rpx;"></canvas> <canvas canvas-id="qrcode" style="margin: 40rpx;"></canvas>
</view> </view>
......

343 Bytes | W: | H:

1.1 KB | W: | H:

static/add-ic.png
static/add-ic.png
static/add-ic.png
static/add-ic.png
  • 2-up
  • Swipe
  • Onion skin
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
Please register or to comment