Page({ data: function data() { return { getStorageID: '', getUserID: '', wareCard: [], page: 0, pageSize: 10, isEmpty: true, loadingType: 0, //定义加载方式 0---contentdown 1---contentrefresh 2---contentnomore contentText: { contentdown: '加载更多', contentrefresh: '加载中...', contentnomore: '已加载全部' } }; }, onLoad: function onLoad(options) { this.getStorageID = options.stoid; this.getUserID = options.userid; }, onShow: function onShow() { this.page = 1; this.pageSize = 10; this.loadingType = 0; this.getList(); }, methods: { MyGift: function MyGift() { /*销毁跳转*/ uni.reLaunch({ url: '/pages/mygiftpack/mygiftpack?stoid=' + this.getStorageID + '&userid=' + this.getUserID }); }, GetGiftPackList: function GetGiftPackList(getId, ojb) { //不销毁调整 uni.navigateTo({ url: '/pages/mygiftpack/giftpackList?isBuy=1&stoid=' + this.getStorageID + '&userid=' + this.getUserID + '&id=' + getId }); }, GetBuyPrice: function GetBuyPrice(getID, item) { var that = this; uni.showModal({ title: '', content: '是否确定购买该礼包', success: function success(res) { if (res.confirm) { getApp().request.promisepost('/api/weshop/marketing/buy/receive/gift/record/insert', { data: { "actId": '', //活动Id "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 "buyType": '2', //1=积分兑换 2=余额购买 "lbId": getID, //礼包Id "storeId": that.getStorageID, //商家Id "userId": that.getUserID, //用户ID "buyFrom": '1' }, success: function success(res) { if (res.data.code == 0) { window.location.href = that.$GetInfo.HtmlHttp + '/Mobile/Payment/getPay.html?stoid=' + that.getStorageID + '&order_sn=' + res.data.data.orderSn + '&recharge_type=6'; } else { console.log(res.data.msg); uni.showToast({ icon: 'none', title: res.data.msg }); } } }); } else if (res.cancel) { console.log('用户点击取消'); } } }); }, GetBuyIntegral: function GetBuyIntegral(getID, item) { var that = this; uni.showModal({ title: '', content: '是否确定兑换该礼包', success: function success(res) { if (res.confirm) { getApp().request.promisepost('/api/weshop/marketing/buy/receive/gift/record/insert', { data: { "actId": '', //活动Id "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 "buyType": '1', //1=积分兑换 2=余额购买 "lbId": getID, //礼包Id "storeId": that.getStorageID, //商家Id "userId": that.getUserID //用户ID }, success: function success(res) { console.log(res.data); if (res.data.code == 0) { console.log(res.data.msg); uni.showToast({ icon: 'none', title: '兑换成功!' }); } else { console.log(res.data.msg); uni.showToast({ icon: 'none', title: res.data.msg }); } } }); } else if (res.cancel) { console.log('用户点击取消'); } } }); }, getList: function getList() { var _this = this; //上拉加载 var that = this; if (that.loadingType != 0) { return false; } that.loadingType = 1; getApp().request.promiseGet('/api/weshop/marketing/giftbag/page', { data: { "storeId": this.getStorageID, //商家ID "userId": this.getUserID, //用户ID "page": this.page, "pageSize": this.pageSize }, success: function success(res) { if (res.data.code == 0) { if (res.data.data.total > 0) { _this.isEmpty = false; } else { _this.isEmpty = true; } if (res.data.data.pageData.length == 0) { _this.loadingType = 2; } else { console.log(_this.wareCard.length); console.log(res.data.data.pageData.length); if (_this.wareCard.length < res.data.data.pageData.length) { for (var i = 0; i < res.data.data.pageData.length; i++) { _this.wareCard.push(res.data.data.pageData[i]); } } _this.loadingType = 0; console.log(_this.wareCard); } } } }); } } });