1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- var app = getApp();
- var that;
- var animation;
- Page({
- data: {
- defaultVal: '',
- process: {
- recorder_id: app.globalData.userData.id,
- recorder: app.globalData.userData.name,
- remark: '',
- point: 0,
- img_url: app.globalData.userData.img_url,
- time: app.globalData.allDate
- },
- items: [],
- id: '',
- isArrindex: true,//正还是负
- isJf: false,
- },
- onLoad(e) {
- that = this;
- dd.setNavigationBar({ title: "任务过程" });
- if (e.id) {
- this.setData({
- isJf: JSON.parse(e.isJf),
- id: e.id,
- items: JSON.parse(e.item),
- process: {
- recorder_id: app.globalData.userData.id,
- recorder: app.globalData.userData.name,
- remark: '',
- point: 0,
- img_url: app.globalData.userData.img_url,
- time: app.globalData.allDate
- },
- })
- }
- },
- //备注输入
- bindTextAreaBlur: function (e) {
- this.setData({
- [`process.remark`]: e.detail.value,
- });
- },
- bindKeyInput(e) {
- this.setData({
- [`process.point`]: e.detail.value,
- });
- },
- formSubmit() {
- var page1 = getCurrentPages()[getCurrentPages().length - 2]//上一个页面的数据
- if (!this.data.process.remark) {
- app.globalData.showToast("请输入记录过程");
- return;
- }
-
- if (this.data.isJf) {
- if (this.data.process.point == 0 || !this.data.process.point) {
- app.globalData.showToast("请输入记分");
- return;
- }
- }
- var data = {
- work_id: this.data.id,
- process: []
- }
- var items = this.data.items;
- var process = this.data.process;
- this.data.isArrindex === false ? process.point = process.point * -1 : process.point = process.point * 1
- items.unshift(process)
- data.process = JSON.stringify(items);
- this.setData({ disabled: true })
- app.$post("api/integral/work", data).then((res) => {
- page1.getDetail(this.data.id, function () {
- app.globalData.showToast(res.data.msg);
- setTimeout(() => {
- dd.navigateBack({ delta: 1 })
- }, 1000);
- })
- }).catch(e => {
- this.setData({ disabled: false })
- }).finally(e => {
- this.setData({ disabled: false })
- })
- },
- //选择奖还是扣(细则)
- bindPickerChange() {
- this.setData({
- isArrindex: !this.data.isArrindex,
- });
- },
- });
|