yuminge-app/yun-min-program-plugin-master/packageA/mycomponent/goodsComponent/plugin/fixedPrice/fixedPrice.js

54 lines
1.3 KiB
JavaScript

// packageA/mycomponent/goodsComponent/plugin/fixedPrice.js
Component({
/**
* 组件的属性列表
*/
properties: {
goods_plugin: {
type:null
}
},
/**
* 组件的初始数据
*/
data: {
hasActivity:false
},
observers:{
'goods_plugin':function(plugin){
if(plugin){
this.init(plugin);
}
}
},
/**
* 组件的方法列表
*/
methods: {
init(data){
if (data.hasOwnProperty("pack_fixed_price") == true && data.pack_fixed_price != {}) {
console.log(data.pack_fixed_price.pack_price, '一口价');
this.setData({
pack_price: data.pack_fixed_price.pack_price ? data.pack_fixed_price.pack_price : '',
goods_count: data.pack_fixed_price.goods_count ? data.pack_fixed_price.goods_count : '',
fixId: data.pack_fixed_price.id ? data.pack_fixed_price.id : '',
hasActivity: true,
});
}
if (data.hasOwnProperty("pack_fixed_price") == true && data.pack_fixed_price.length != undefined) {
//商品未参加一口价
this.setData({
hasActivity: false,
});
}
},
// 一口价
toFixedPrice() {
wx.navigateTo({
url: "/packageE/others/fixedPrice/fixedPrice?id=" + this.data.fixId,
});
},
}
});