yuminge-app/yun-min-program-plugin-master/mycomponent/groupListPopup/groupListPopup.js

137 lines
3.5 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// packageB/mycomponent/groupListPopup/groupListPopup.js
const app = getApp();
Component({
/**
* 组件的属性列表
*/
properties: {
item: {
type: Array
},
info: {
type: Object
},
storeId: null
},
observers: {},
/**
* 组件的初始数据
*/
data: {
show: false,
teamInfo: [],
uid: '',
shareModel: {
title: '',
path: '',
imageUrl: '',
fromButton: ''
}
},
lifetimes: {
// 生命周期函数可以为函数或一个在methods段中定义的方法名
attached() {
try {
let uid = wx.getStorageSync('yz_uid');
this.setData({
uid
});
} catch (error) {
console.log(error);
}
},
moved() {},
detached() {},
},
/**
* 组件的方法列表
*/
methods: {
tapOverlay() {
this.setData({
show: false
});
},
getAllTeam(e) {
let id = this.data.info.id;
let urlStr = app.getNetAddresss("plugin.fight-groups.frontend.controllers.fight-groups-goods.all-team");
app._getNetWork({
url: urlStr,
data: {
id: id
},
success: (resdata) => {
var res = resdata.data;
if (res.result == 1) {
this.setData({
isLoadMore: true,
total_page: res.data.last_page,
teamInfo: res.data.data,
show: true
});
if (!this.data.total_page) {
this.setData({
total_page: 0,
});
}
} else {
wx.showToast({
icon: "none",
title: res.msg,
duration: 1500,
});
}
},
});
},
// 加入该团按钮
clickAdd(e) {
// let _id = e.target.dataset.id || e.currentTarget.dataset.id;
let status = e.target.dataset.item || e.currentTarget.dataset.item;
let _team_id = e.target.dataset.id || e.currentTarget.dataset.id;
if (status == "1") {
return;
} else {
let that = this;
let goods = [];
goods.push(that.data.goodsId);
let urlStr = app.getNetAddresss("from.div-from.isDisplay");
urlStr += "&goods_ids=" + JSON.stringify(goods);
app._getNetWork({
showToastIn: false,
url: urlStr,
success: function (resdata) {
var res = resdata.data;
if (res.result == 1) {
if (res.data.status && !res.data.member_status) {
wx.showModal({
title: "提示",
content: "购买此商品,请补充您的个人信息",
success(res) {
if (res.confirm) {
//保税真实信息添加
wx.navigateTo({
url: "/packageB/member/address/myinfo/myinfo?tag=group" + "&activityId=" + that.data.activityId,
});
}
},
});
} else {
wx.navigateTo({
url: "/packageB/member/group/GroupDetail/GroupDetail?id=" + _team_id + "&store_id=" + that.properties.storeId,
});
}
} else {
wx.showToast({
icon: "none",
title: res.msg,
duration: 1500,
});
}
},
fail: function (res) {},
});
}
},
}
});