You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
2.2 KiB
99 lines
2.2 KiB
import {
|
|
pointSverification
|
|
} from '../../../../api/pointManagement.js'
|
|
let util = require('../../../../utils/util.js')
|
|
Page({
|
|
data: {
|
|
peopleNum: 0,
|
|
faceImg: '', //用户头像
|
|
points: 0, //用户积分
|
|
realName: '', //用户真实姓名
|
|
userId: "", //用户ID
|
|
operationType: 0,
|
|
remark: "",
|
|
isFlag: true, //按钮防点击
|
|
},
|
|
onLoad: function (options) {
|
|
this.setData({
|
|
faceImg: options.faceImg, //用户头像
|
|
points: options.points, //用户积分
|
|
realName: options.realName, //用户真实姓名
|
|
userId: options.userId, //用户ID
|
|
})
|
|
},
|
|
onChange(e) {
|
|
this.setData({
|
|
peopleNum: e.detail.value,
|
|
})
|
|
},
|
|
pointSverification() {
|
|
if (!this.data.isFlag) return
|
|
|
|
if (this.data.peopleNum == 0) {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: '操作积分值必须大于0',
|
|
duration: 1000,
|
|
})
|
|
return
|
|
}
|
|
if (this.data.peopleNum > parseInt(this.data.points)) {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: '用户积分不足',
|
|
duration: 2000,
|
|
})
|
|
return
|
|
}
|
|
if (this.data.remark == '') {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: '请输入核销说明',
|
|
duration: 1000,
|
|
})
|
|
return
|
|
}
|
|
this.setData({
|
|
isFlag: false
|
|
})
|
|
/**
|
|
* @param userId 用户ID
|
|
* @param operationType 积分操作类型 0-减积分,1-加积分
|
|
* @param points 操作积分值
|
|
*/
|
|
let para = {
|
|
userId: this.data.userId,
|
|
operationType: this.data.operationType,
|
|
points: this.data.peopleNum,
|
|
remark: this.data.remark
|
|
}
|
|
pointSverification(para).then((res) => {
|
|
wx.showModal({
|
|
title: '',
|
|
content: '操作成功',
|
|
showCancel: false,
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
this.setData({
|
|
isFlag: true
|
|
})
|
|
wx.navigateBack({
|
|
delta: 1
|
|
})
|
|
}
|
|
}
|
|
})
|
|
|
|
}).catch((err) => {
|
|
this.setData({
|
|
isFlag: true
|
|
})
|
|
})
|
|
},
|
|
// 双向绑定 内容输入框
|
|
bindTextareaInput(e) {
|
|
this.setData({
|
|
remark: e.detail.value.trim()
|
|
})
|
|
},
|
|
})
|