store/mycomponent/yz_pay_buttons/yz_pay_buttons.js

70 lines
1.4 KiB
JavaScript

// mycomponent/yz_pay_buttons/yz_pay_buttons.js
Component({
/**
* 组件的属性列表
*/
properties: {
money: {
type: null
},
buttons: {
type: null
},
balance: {
type: null
}
},
/**
* 组件的初始数据
*/
data: {
confirmPayText: '确定',
radio: '',
submitArr: ''
},
observers: {
'buttons': function (_data) {
let language = wx.getStorageSync("langIndex");
this.setData({
language: language.en,
});
this.setData({
radio: _data[0] ? (_data[0].value ? _data[0].value : '') : '',
submitArr: _data[0] ? (_data[0] ? _data[0] : '') : ''
});
if (_data && _data.constructor === Array && _data.length > 0) {
_data.map(item => {
if (item.value == 54) {
this.setData({
confirmPayText: item.name || '确定'
});
}
});
}
}
},
/**
* 组件的方法列表
*/
methods: {
onChange(e) {
let _data = this.data.buttons;
for (let key in _data) {
if (e.detail == _data[key].value) {
this.setData({
radio: _data[key].value,
submitArr: _data[key]
});
}
}
// console.log(this.data.radio,this.data.submitArr)
},
confirm(e) {
this.triggerEvent('isPushHome', {
'radio': this.data.radio,
'submitArr': this.data.submitArr
});
}
}
});