|
@@ -1,4 +1,7 @@
|
|
|
// pages/components/shareDialog/shareDialog.js
|
|
|
+const getReq = require('../../../config').getReq;
|
|
|
+let app = getApp();
|
|
|
+
|
|
|
Component({
|
|
|
/**
|
|
|
* 组件的属性列表
|
|
@@ -7,6 +10,20 @@ Component({
|
|
|
showDialog:{
|
|
|
type:Boolean,
|
|
|
value:false
|
|
|
+ },
|
|
|
+ goods_id: {
|
|
|
+ type: Number,
|
|
|
+ observer() {
|
|
|
+ console.log('observer goods_id = ', this.properties.goods_id)
|
|
|
+ let goods_id = this.properties.goods_id
|
|
|
+ if(goods_id > 0) {
|
|
|
+ this.requestData(goods_id);
|
|
|
+ this.setData({shareModel: app.cardShareInfo()})
|
|
|
+ }
|
|
|
+ else {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -14,15 +31,90 @@ Component({
|
|
|
* 组件的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
+ current_goodsid:0,
|
|
|
+ fGoodsRequesting: false,
|
|
|
+ tip:'',
|
|
|
+ invitess:[],
|
|
|
+ policy:[],
|
|
|
+ tip_title:'',
|
|
|
+ tip_num:0,
|
|
|
+ shareModel:{}
|
|
|
+ },
|
|
|
|
|
|
+ pageLifetimes: {
|
|
|
+ // 组件所在页面的生命周期函数
|
|
|
+ show: function () {
|
|
|
+ console.log('pageLifetimes goods_id = ', this.properties.goods_id)
|
|
|
+ },
|
|
|
+ hide: function () {
|
|
|
+ console.log('pageLifetimes goods_id = ', this.properties.goods_id)
|
|
|
+ },
|
|
|
+ resize: function () { },
|
|
|
+ },
|
|
|
+
|
|
|
+ lifetimes: {
|
|
|
+ attached: function () {
|
|
|
+ console.log('lifetimes attached')
|
|
|
+
|
|
|
+ wx.getSetting({
|
|
|
+ withSubscriptions: true,
|
|
|
+ success(res) {
|
|
|
+ var itemSettings = res.subscriptionsSetting.itemSettings
|
|
|
+ console.log('setting:', itemSettings)
|
|
|
+ if (itemSettings) {
|
|
|
+ if (itemSettings['模版id'] === 'accept') {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ detached: function () {
|
|
|
+ },
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 组件的方法列表
|
|
|
*/
|
|
|
methods: {
|
|
|
- onCloseDialog(){
|
|
|
- this.triggerEvent('closeDialog',{})
|
|
|
+ onCloseDialog() {
|
|
|
+ wx.requestSubscribeMessage({
|
|
|
+ tmplIds: ['zBNktaey9EM2DcBzUNsjnAan2NvYpj_nKZDY__f9pGA'],
|
|
|
+ success(res) {
|
|
|
+ console.log(res)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log('onCloseDialog');
|
|
|
+ this.triggerEvent('closeDialog', {})
|
|
|
+ },
|
|
|
+ onShareInfo(){
|
|
|
+ console.log('onShareInfo');
|
|
|
+ this.triggerEvent('onShareInfo', {})
|
|
|
+ },
|
|
|
+ requestData(goods_id)
|
|
|
+ {
|
|
|
+ console.log('requestData goods_id=',goods_id)
|
|
|
+ if (this.fGoodsRequesting) return;
|
|
|
+
|
|
|
+ this.fGoodsRequesting = true
|
|
|
+ getReq(app, {
|
|
|
+ act: 'member_invitee',
|
|
|
+ op: 'goods_share',
|
|
|
+ goods_id: goods_id,
|
|
|
+ }, (res) => {
|
|
|
+ console.log('res:', res)
|
|
|
+ if (res.code == 200) {
|
|
|
+ if (res.datas) {
|
|
|
+ let invitess = res.datas.invitess
|
|
|
+ let policy = res.datas.policy
|
|
|
+ let tip_title = res.datas.tip_title
|
|
|
+ let tip_num = res.datas.tip_num
|
|
|
+ this.setData({ tip_title,tip_num,invitess, policy })
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.fGoodsRequesting = false
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
})
|