184 lines
4.0 KiB
JavaScript
184 lines
4.0 KiB
JavaScript
// packageH/o2o/storeConsumeUse/storeConsumeUse.js
|
|
const app = getApp();
|
|
var isclick = true;
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
status: false
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (option) {
|
|
if (option.scene) {
|
|
let scene = decodeURIComponent(option.scene);
|
|
console.log(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('=');
|
|
console.log('59', chil_arr);
|
|
if (chil_arr[0] == 'store_id') {
|
|
this.setData({
|
|
store_id: chil_arr[1]
|
|
});
|
|
} else if (chil_arr[0] == 'hold_id') {
|
|
this.setData({
|
|
hold_id: chil_arr[1]
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.getstore();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
},
|
|
getstore() {
|
|
wx.showLoading({
|
|
title: '核销中',
|
|
});
|
|
let that = this;
|
|
let urlStr = app.getNetAddresss('plugin.store-card.Frontend.Modules.Verifier.Controllers.audit.page');
|
|
app._postNetWork({
|
|
url: urlStr,
|
|
data: {
|
|
hold_id: that.data.hold_id,
|
|
store_id: that.data.store_id,
|
|
},
|
|
success: (resdata) => {
|
|
let res = resdata.data;
|
|
wx.hideLoading({
|
|
success: (res) => {},
|
|
});
|
|
if (res.result == 1) {
|
|
that.setData({
|
|
cardUse: res.data
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: res.msg,
|
|
duration: 1000,
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
fail: function (res) {
|
|
console.log(res.msg);
|
|
}
|
|
});
|
|
},
|
|
getdata() {
|
|
console.log(isclick);
|
|
var that = this;
|
|
if (isclick == true) {
|
|
console.log(isclick);
|
|
wx.showModal({
|
|
title: '是否进行核销',
|
|
confirmText: '确认核销',
|
|
showCancel:true,
|
|
cancelTextL:'取消',
|
|
success: function (res) {
|
|
console.log(res);
|
|
if (res.confirm) {
|
|
isclick = false;
|
|
wx.showLoading({
|
|
title: '核销中',
|
|
});
|
|
let urlStr = app.getNetAddresss('plugin.store-card.Frontend.Modules.Verifier.Controllers.audit.index');
|
|
app._postNetWork({
|
|
url: urlStr,
|
|
data: {
|
|
hold_id: that.data.hold_id,
|
|
store_id: that.data.store_id,
|
|
},
|
|
success: (resdata) => {
|
|
let res = resdata.data;
|
|
wx.hideLoading({
|
|
success: (res) => {},
|
|
});
|
|
if (res.result == 1) {
|
|
that.setData({
|
|
status: true
|
|
});
|
|
wx.showToast({
|
|
title: '核销成功',
|
|
icon: 'none',
|
|
duration: 1000
|
|
});
|
|
} else {
|
|
isclick = true;
|
|
wx.showToast({
|
|
title: res.msg,
|
|
duration: 1000,
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
fail: function (res) {
|
|
console.log(res.msg);
|
|
}
|
|
});
|
|
}
|
|
},
|
|
fail: function (e) {
|
|
console.log(e);
|
|
}
|
|
});
|
|
}
|
|
|
|
},
|
|
}); |