yuminge-app/yun-min-program-plugin-master/packageI/brand_resources/cardVoucherInfo/cardVoucherInfo.js

104 lines
1.8 KiB
JavaScript

// packageI/brand_resources/cardVoucherInfo/cardVoucherInfo.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
copy_text: "",
cards: [],
info: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getdata(options.id);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
getdata(order_id) {
let urlStr = app.getNetAddresss('plugin.yz-supply-camilo-resources.frontend.index.index.getCamiloResources');
app._postNetWork({
url: urlStr,
data:{order_id},
success: (resdata) => {
let res = resdata.data;
if(res.result != 1){
return app.tips(res.msg);
}
let copy_text= "";
if (res.data.card.length > 0) {
// 不要格式化
res.data.card.map((item) => {
copy_text += `卡号:${item.card_number}卡密:${item.card_secret}`;
});
}
this.setData({
cards:res.data.card,
info:res.data,
copy_text
});
}
});
},
setClipboardData(evt){
let text = evt.currentTarget.dataset.text;
wx.setClipboardData({
data: text,
});
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
});