yuminge-app/yun-min-program-plugin-master/packageE/appointment/client/verification/verification.js

174 lines
3.7 KiB
JavaScript

// packageE/appointment/client/verification/verification.js
var app = getApp();
let clicktag = 0;
Page({
/**
* 页面的初始数据
*/
data: {
isReady: false,
service_id: 0,
url: "",
json: {},
sureUrl: "",
info: {},
appointmentLang: {},
options: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (options.tag) this.data.tag = options.tag;
if (options.service_id) this.data.service_id = options.service_id;
let scene = decodeURIComponent(options.scene);
if (scene) {
var info_arr = [];
info_arr = scene.split('&');
for (let i = 0; i < info_arr.length; i++) {
let chil_arr = [];
chil_arr = info_arr[i].split('=');
if (chil_arr[0] == 'service_id') {
this.data.service_id = chil_arr[1];
}
if (chil_arr[0] == 'tag') {
this.data.tag = chil_arr[1];
}
}
}
this.setData({
appointmentLang: wx.getStorageSync('yz_basic_info').lang.appointment,
});
this.data.isReady = false;
if (this.data.tag === "pro") {
this.data.url = "plugin.appointment.frontend.appointment-order.close-service-info";
this.data.sureUrl = "plugin.appointment.frontend.appointment-order.close-service";
this.data.json = {
order_id: this.data.service_id
};
} else {
this.data.url = "plugin.appointment.frontend.appointment-service.close-service-info";
this.data.sureUrl = "plugin.appointment.frontend.appointment-service.close-service";
this.data.json = {
service_id: this.data.service_id
};
}
this.getData();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
getData() {
let urlStr = app.getNetAddresss(this.data.url);
app._getNetWork({
url: urlStr,
data: this.data.json,
success: (resdata) => {
let res = resdata.data;
if (res.result !== 1) return this.tips(res.msg);
this.setData({
isReady: true,
info: res.data
});
}
});
},
Sure() {
if (clicktag !== 0) return;
clicktag = 1;
let urlStr = app.getNetAddresss(this.data.sureUrl);
app._postNetWork({
url: urlStr,
data: this.data.json,
success: (resdata) => {
let res = resdata.data;
if (res.result !== 1) return this.tips(res.msg);
clicktag = 0;
wx.showModal({
title: '提示',
content: res.msg,
showCancel: false,
success: (res) => {
if (res.confirm) {
if (this.data.tag === "pro") {
wx.navigateTo({
url: '/packageE/appointment/client/project/project',
});
} else {
wx.navigateTo({
url: '/packageE/appointment/appointment_index',
});
}
console.log('用户点击确定');
}
}
});
}
});
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
tips(msg) {
wx.showToast({
title: msg,
icon: 'none',
duration: 2000
});
return false;
}
});