From 312af5a3680eff901ffdda70b3bc635a7b50656a Mon Sep 17 00:00:00 2001 From: iceling Date: Thu, 26 Dec 2019 18:12:22 +0800 Subject: [PATCH] 我的礼包数据调整展示 --- pages/giftpack/buygiftpack/giftpackbuy.js | 312 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------ pages/giftpack/buygiftpack/giftpackbuy.json | 3 ++- pages/giftpack/buygiftpack/giftpackbuy.wxml | 27 +++++++++++++++------------ pages/giftpack/buygiftpack/giftpackbuy.wxss | 336 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------ pages/giftpack/giftpacklist/giftpacklist.js | 377 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- pages/giftpack/giftpacklist/giftpacklist.json | 5 ++++- pages/giftpack/giftpacklist/giftpacklist.wxml | 57 ++++++++++++++++++++++++++++++--------------------------- pages/giftpack/mygiftpack/mygiftpack.js | 240 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------- pages/giftpack/mygiftpack/mygiftpack.json | 6 +++++- pages/giftpack/mygiftpack/mygiftpack.wxml | 200 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------ 10 files changed, 842 insertions(+), 721 deletions(-) diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index 9a43bc9..40e65b3 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -1,170 +1,182 @@ +var e = getApp(), + a = e.globalData.setting, + os = a, + t = e.request, + d = e.globalData; 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: '已加载全部' - } - }; - - + data: { + url: a.url, //接口网址 + iurl: a.imghost, //图片前缀网址 + 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; + onLoad: function(options) { + var th = this; + th.setData({ + getStorageID: a.stoid, + getUserID: 5682130 + }) }, - onShow: function onShow() { - this.page = 1; - this.pageSize = 10; - this.loadingType = 0; - this.getList(); + onShow: function() { + var th = this; + th.setData({ + pages: 1, + pageSize: 10, + loadingType: 0 + }) + th.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('用户点击取消'); + GetBuyPrice: function(e) { + var that = this.data; + var th = this; + var lbId = e.currentTarget.dataset.lbId;//活动id + var my_confirm = th.selectComponent("#my_confirm"); //组件的id + my_confirm.open( + "是否确定购买该礼包", + "取消", + "确定", + function() { + my_confirm.open_cancel(0); + }, + function() { + var json = { + "actId": '', //活动Id + "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 + "buyType": '2', //1=积分兑换 2=余额购买 + "lbId": lbId, //礼包Id + "storeId": that.getStorageID, //商家Id + "userId": that.getUserID, //用户ID + "buyFrom": 2 + }; + var data = JSON.stringify(json); + var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; + wx.request({ + url: url, + data: data, + method: 'post', + header: { + 'content-type': 'application/json' + }, // 设置请求的 header + success: function (res) { + if (res.data.code == 0) { + window.location.href = th.data.url + '/Mobile/Payment/getPay.html?stoid=' + that.getStorageID + '&order_sn=' + res.data.data.orderSn + '&recharge_type=6'; + } else { + getApp().my_warnning(res.data.msg, 0, th); + } } - } - }); + }) + } - }, - 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('用户点击取消'); + }, + GetBuyIntegral: function(e) { + var that = this.data; + var th = this; + var lbId = e.currentTarget.dataset.lbId;//活动id + var my_confirm = th.selectComponent("#my_confirm"); //组件的id + my_confirm.open( + "是否确定兑换该礼包", + "取消", + "确定", + function() { + my_confirm.open_cancel(0); + }, + function() { + getApp().request.post('/api/weshop/marketing/buy/receive/gift/record/insert', { + data: { + "actId": '', //活动Id + "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 + "buyType": '1', //1=积分兑换 2=余额购买 + "lbId": 26, //礼包Id + "storeId": that.getStorageID, //商家Id + "userId": that.getUserID //用户ID + }, + success: function success(res) { + if (res.data.code == 0) { + getApp().my_warnning("兑换成功!", 1, th); + } else { + getApp().my_warnning(res.data.msg, 0, th); + } } - } - }); + }) + }) - }, - 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); + }, + getList: function(e) { + var _this = this; //上拉加载 + var that = this.data; + if (that.loadingType != 0) { + return false; + } + // that.loadingType = 1; + _this.setData({ + loadingType: 1 + }) + getApp().request.get('/api/weshop/marketing/my/giftbag/page', { + data: { + "storeId": that.getStorageID, //商家ID + "userId": that.getUserID, //用户ID + "page": that.pages, + "pageSize": that.pageSize + }, + success: function success(res) { + if (res.data.code == 0) { + if (res.data.data.total > 0) { + _this.setData({ + isEmpty: false + }) + } else { + _this.setData({ + isEmpty: true + }) + } + if (res.data.data.pageData.length == 0) { + _this.setData({ + loadingType: 2 + }) + } else { + var wareCard = that.wareCard; + if (wareCard.length < res.data.data.total) { + for (var i = 0; i < res.data.data.pageData.length; i++) { + wareCard.push(res.data.data.pageData[i]); + } } + _this.setData({ + wareCard: wareCard + }) + _this.setData({ + loadingType: 0 + }) + } + } else { + getApp().my_warnning(res.data.msg, 0, th); } - }); + } + }) - } + }, + //界面跳转 + goto: function(e) { + var th = this; + var url = e.currentTarget.dataset.url; + getApp().goto(url); } -}); \ No newline at end of file +}) \ No newline at end of file diff --git a/pages/giftpack/buygiftpack/giftpackbuy.json b/pages/giftpack/buygiftpack/giftpackbuy.json index 778da93..d1faf2e 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.json +++ b/pages/giftpack/buygiftpack/giftpackbuy.json @@ -2,6 +2,7 @@ "navigationBarTitleText": "礼包列表", "navigationStyle": "custom", "usingComponents": { - "u-li-load-more": "/components/uLi-load-more/uLi-load-more" + "warn": "/components/long_warn/long_warn", + "my_confirm": "/components/my_confirm/my_confirm" } } \ No newline at end of file diff --git a/pages/giftpack/buygiftpack/giftpackbuy.wxml b/pages/giftpack/buygiftpack/giftpackbuy.wxml index 6ed2300..bc7d106 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.wxml +++ b/pages/giftpack/buygiftpack/giftpackbuy.wxml @@ -1,6 +1,6 @@ - + @@ -8,14 +8,14 @@ - 我的礼包 + 我的礼包 - - - + + + @@ -45,22 +45,22 @@ {{"已售:"+items.giftQty+"件"}} - - + + - - + + - + - + 当前暂无礼包 @@ -73,4 +73,7 @@ ———— 到底了 ———— - \ No newline at end of file + + + + \ No newline at end of file diff --git a/pages/giftpack/buygiftpack/giftpackbuy.wxss b/pages/giftpack/buygiftpack/giftpackbuy.wxss index b052787..0ae857b 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.wxss +++ b/pages/giftpack/buygiftpack/giftpackbuy.wxss @@ -1,207 +1,231 @@ - /*引用样式路径*/ @charset "UTF-8"; + /* Author XGQ * 2019-11-12 */ + page { - background-color: #fb7454; + background-color: #fb7454; } + .top_img { - -webkit-align-content: center; - align-content: center; + -webkit-align-content: center; + align-content: center; } + .top_img image { - width: 100%; - height: 660rpx; + width: 100%; + height: 660rpx; } + .top_title { - display: -webkit-box; - display: -webkit-flex; - display: flex; - background-color: #FFFFFF; - height: 85rpx; - border-radius: 10rpx 10rpx 0rpx 0rpx; - margin: 0rpx 20rpx 0rpx 20rpx; - -webkit-align-content: center; - align-content: center; + display: -webkit-box; + display: -webkit-flex; + display: flex; + background-color: #fff; + height: 85rpx; + border-radius: 10rpx 10rpx 0rpx 0rpx; + margin: 0rpx 20rpx 0rpx 20rpx; + -webkit-align-content: center; + align-content: center; } + .top_title_box { - width: 49%; - -webkit-align-content: center; - align-content: center; - text-align: center; - padding: 15rpx; + width: 49%; + -webkit-align-content: center; + align-content: center; + text-align: center; + padding: 15rpx; } + .top_title_box_S { - width: 1%; - -webkit-align-content: center; - align-content: center; - text-align: center; - margin: 20rpx 0rpx 20rpx 0rpx; - border-left: #000000 solid 3rpx; + width: 1%; + -webkit-align-content: center; + align-content: center; + text-align: center; + margin: 20rpx 0rpx 20rpx 0rpx; + border-left: #000 solid 3rpx; } + .top_title_redtext { - font-size: 30rpx; - color: #d61b30; + font-size: 30rpx; + color: #d61b30; } + .top_title_blacktext { - font-size: 30rpx; - color: #000000; + font-size: 30rpx; + color: #000; } + .content_box { - background-color: #FFFFFF; - height: 375rpx; - margin: 10rpx 20rpx 0rpx 20rpx; - border-radius: 10rpx; + background-color: #fff; + margin: 10rpx 20rpx 0rpx 20rpx; + border-radius: 10rpx; } + .content_box_ware { - border-bottom: #f5f5f5 solid 2rpx; - display: -webkit-box; - display: -webkit-flex; - display: flex; + border-bottom: #f5f5f5 solid 2rpx; + display: -webkit-box; + display: -webkit-flex; + display: flex; } + .content_box_img { - margin: 20rpx 20rpx 20rpx 25rpx; - width: 35%; - display: -webkit-box; - display: -webkit-flex; - display: flex; - font-size: 8rpx; - position: relative; + margin: 20rpx 20rpx 20rpx 25rpx; + width: 35%; + display: -webkit-box; + display: -webkit-flex; + display: flex; + font-size: 8rpx; + position: relative; } + .content_box_img image { - width: 100%; - height: 230rpx; + width: 100%; + height: 230rpx; } + .content_box_title { - width: 65%; - margin: 25rpx 25rpx 10rpx 0rpx; - position: relative; + width: 65%; + margin: 25rpx 25rpx 10rpx 0rpx; + position: relative; } + .content_ware_title { - font-size: 30rpx; - word-break: break-all; - /*属性规定自动换行的处理方法。normal(使用浏览器默认的换行规则。),break-all(允许在单词内换行。),keep-all(只能在半角空格或连字符处换行。)*/ - text-overflow: ellipsis; - display: -webkit-box; - /** 对象作为伸缩盒子模型显示 **/ - -webkit-box-orient: vertical; - /** 设置或检索伸缩盒对象的子元素的排列方式 **/ - -webkit-line-clamp: 2; - /** 显示的行数 **/ - overflow: hidden; - /** 隐藏超出的内容 **/ + font-size: 30rpx; + word-break: break-all; + /*属性规定自动换行的处理方法。normal(使用浏览器默认的换行规则。),break-all(允许在单词内换行。),keep-all(只能在半角空格或连字符处换行。)*/ + text-overflow: ellipsis; + display: -webkit-box; + /** 对象作为伸缩盒子模型显示 **/ + -webkit-box-orient: vertical; + /** 设置或检索伸缩盒对象的子元素的排列方式 **/ + -webkit-line-clamp: 2; + /** 显示的行数 **/ + overflow: hidden; + /** 隐藏超出的内容 **/ } + .content_ware_type { - font-size: 28rpx; - color: #c61a34; - margin-top: 10rpx; - position: absolute; - left: 0; - bottom: 100rpx; + font-size: 28rpx; + color: #c61a34; + margin-top: 10rpx; + position: absolute; + left: 0; + bottom: 100rpx; } + .content_ware_price { - font-size: 20rpx; - color: #b9b5b5; - margin-top: 2rpx; - text-decoration: line-through; - position: absolute; - left: 0; - bottom: 70rpx; + font-size: 20rpx; + color: #b9b5b5; + margin-top: 2rpx; + text-decoration: line-through; + position: absolute; + left: 0; + bottom: 70rpx; } + .content_ware_time { - font-size: 25rpx; - color: #000000; - margin-top: 20rpx; - position: absolute; - left: 0; - bottom: 25rpx; + font-size: 25rpx; + color: #000; + margin-top: 20rpx; + position: absolute; + left: 0; + bottom: 25rpx; +} +.box_button_buy{ + display: flex; + align-items: center; } .content_box_button { - display: -webkit-box; - display: -webkit-flex; - display: flex; - -webkit-box-pack: end; - -webkit-justify-content: flex-end; - justify-content: flex-end; - position: relative; -} -.box_button_remark{ - margin: 15rpx 0rpx 0rpx 30rpx; - width: 50%; - position: absolute; - left: 5rpx; - bottom: 15rpx; -} -.box_button_remark text{ - font-size: 28rpx; - color: #B9B5B5; + display: flex; + height: 110rpx; + justify-content: space-between; + align-items: center; + padding-left: 20rpx; + padding-right: 25rpx; + line-height: 110rpx; } -.box_button_buy{ - text-align: right; - margin: 22rpx 25rpx 0rpx 0rpx; + +.box_button_remark { + margin-left: 5rpx; } -.box_button_buy button{ - display: inline-block; - width: 160rpx; - height: 50rpx; - font-size: 20rpx; - background: #d41c34; - color: #FFFFFF; - line-height: 50rpx; + +.box_button_remark text { + font-size: 28rpx; + color: #b9b5b5; } -.box_button_dui{ + +.box_button_buy button { + display: inline-block; + width: 160rpx; + height: 50rpx; + font-size: 20rpx; + background: #d41c34; + color: #fff; + line-height: 50rpx; +} + +.box_button_dui { text-align: right; margin: 22rpx 25rpx 0rpx 0rpx; } -.box_button_dui button{ - display: inline-block; - width: 160rpx; - height: 50rpx; - font-size: 20rpx; - background: #FFFFFF; - color: #000000; - line-height: 50rpx; + +.box_button_dui button { + display: inline-block; + width: 160rpx; + height: 50rpx; + font-size: 20rpx; + background: #fff; + color: #000; + line-height: 50rpx; } + .foot_box { - -webkit-align-content: center; - align-content: center; - text-align: center; - margin-top: 15rpx; - margin-bottom: 50rpx; + -webkit-align-content: center; + align-content: center; + text-align: center; + margin-top: 15rpx; + margin-bottom: 50rpx; } + .foot_box text { - font-size: 25rpx; - color: #FFFFFF; -} -.foot_empty{ - background-color: #FFFFFF; - height: 375rpx; - margin: 10rpx 20rpx 0rpx 20rpx; - border-radius: 10rpx; - text-align: center; - padding: 150rpx 0rpx 300rpx 0rpx; - -webkit-box-pack: center; - -webkit-justify-content: center; - justify-content: center; -} -.foot_empty image{ - width: 400rpx; - height: 273rpx; -} -.foot_empty text{ - font-size: 30rpx; - color: #999999; -} -.foot_empty_button{ - background: #ff6363; - margin: 60rpx 230rpx 0rpx 230rpx; - padding: 10rpx; - border-radius: 70rpx; - line-height: 40rpx; -} -.foot_empty_button text{ - font-size: 28rpx; - color: #FFFFFF; + font-size: 25rpx; + color: #fff; +} + +.foot_empty { + background-color: #fff; + height: 375rpx; + margin: 10rpx 20rpx 0rpx 20rpx; + border-radius: 10rpx; + text-align: center; + padding: 150rpx 0rpx 300rpx 0rpx; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; +} + +.foot_empty image { + width: 400rpx; + height: 273rpx; +} + +.foot_empty text { + font-size: 30rpx; + color: #999; +} + +.foot_empty_button { + background: #ff6363; + margin: 60rpx 230rpx 0rpx 230rpx; + padding: 10rpx; + border-radius: 70rpx; + line-height: 40rpx; +} + +.foot_empty_button text { + font-size: 28rpx; + color: #fff; } diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js index 6acb0cb..fbb2069 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.js +++ b/pages/giftpack/giftpacklist/giftpacklist.js @@ -1,210 +1,229 @@ -var t = require("../../utils/common.js"); var os = getApp().globalData.setting; +var e = getApp(), + a = e.globalData.setting, + os = a, + t = e.request, + d = e.globalData; Page({ - data: function data() { - return { - isBuy: 0, - getGiftID: '', - giftImage: '', - giftTitle: '', - giftDate: '', - giftPrice: '', - giftIntegral: '', - giftPosPrice: '', - giftQty: '', - giftRemark: '', - giftType: '', - actTitle: '', - getUrl: '', - wareCard: [] - }; - + data: { + url: a.url, //接口网址 + iurl: a.imghost, //图片前缀网址 + isBuy: 0, + getGiftID: '', //礼包id + giftImage: '', + giftTitle: '', + giftDate: '', + giftPrice: '', + giftIntegral: '', + giftPosPrice: '', + giftQty: '', + giftRemark: '', + giftType: '', + actTitle: '', + getUrl: '', + wareCard: [], + orderSn: "", //订单编号 }, - onLoad: function onLoad(options) { - this.isBuy = options.isBuy; - this.getStorageID = options.stoid; - this.getUserID = options.userid; - this.getGiftID = options.id; - - console.log(this.isBuy + '||' + this.getStorageID + '||' + this.getUserID + '||' + this.getGiftID); + onLoad: function(options) { + var th = this; + th.setData({ + isBuy: options.isBuy, + getStorageID: a.stoid, + getUserID: d.user_id, + getGiftID: options.lbId, + orderSn: options.orderSn + }) }, - onShow: function onShow() { - if (this.isBuy == 0) { - this.GetMyGiftList(); + onShow: function() { + var th = this; + if (th.data.isBuy == 0) { + th.GetMyGiftList(); } else { - this.GetBuyGiftList(); + th.GetBuyGiftList(); } - this.giftRemark = this.giftRemark.replace(/

- + - {{this.giftTitle}} + {{giftTitle}} - {{"兑换截至时间:"+this.giftDate}} + {{"兑换截至时间:"+giftDate}} - - {{"¥"+this.giftPrice}} + + {{"¥"+giftPrice}} - + / - - {{this.giftIntegral+"积分"}} + + {{giftIntegral+"积分"}} - - {{this.actTitle}} + + {{actTitle}} - {{"原价:"+this.giftPosPrice+"元"}} + {{"原价:"+giftPosPrice+"元"}} - {{"已售:"+this.giftQty+"件"}} + {{"已售:"+giftQty+"件"}} @@ -40,19 +40,19 @@ - + - + - + - + - + @@ -67,13 +67,13 @@ - + - + - + 已自动到账 @@ -88,39 +88,42 @@ 活动说明 - + - + 立即购买 - + 立即兑换 - + 立即购买 - + 立即兑换 - + 立即使用 - \ No newline at end of file + + + + \ No newline at end of file diff --git a/pages/giftpack/mygiftpack/mygiftpack.js b/pages/giftpack/mygiftpack/mygiftpack.js index 8a0be10..f2d85fa 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.js +++ b/pages/giftpack/mygiftpack/mygiftpack.js @@ -1,111 +1,155 @@ -var t = require("../../../utils/common.js"); var os = getApp().globalData.setting; +var e = getApp(), + a = e.globalData.setting, + os = a, + t = e.request, + d = e.globalData; Page({ - data: function data() { - return { - getDate: new Date().getTime(), - getStorageID: '', - getUserID: '', - wareCard: [], - pages: 0, - pageSize: 10, - isEmpty: true, - loadingType: 0, //定义加载方式 0---contentdown 1---contentrefresh 2---contentnomore - contentText: { - contentdown: '加载更多', - contentrefresh: '加载中...', - contentnomore: '已加载全部' - } - }; + data: { + iurl: a.imghost, //图片前缀网址 + getDate: new Date().getTime(), + getStorageID: '', + getUserID: '', + wareCard: [], + pages: 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; + onLoad: function(options) { + // this.getStorageID = options.stoid; + // this.getUserID = options.userid; + var th = this; + th.setData({ + getStorageID: a.stoid, + getUserID: 5682130 + }) }, - onShow: function onShow() { - this.pages = 1; - this.pageSize = 10; - this.loadingType = 0; - this.getList(); + onShow: function() { + // this.pages = 1; + // this.pageSize = 10; + // this.loadingType = 0; + // this.getList(); + var th = this; + th.setData({ + pages: 1, + pageSize: 10, + loadingType: 0 + }) + th.getList(); }, - methods: { - BuyGift: function BuyGift() { - /*销毁跳转*/ - uni.reLaunch({ - url: 'pages/giftpack/buygiftpack/giftpackbuy?stoid=' + this.getStorageID + '&userid=' + this.getUserID - }); + // methods: { + // BuyGift: function BuyGift() { + // /*销毁跳转*/ + // uni.reLaunch({ + // url: 'pages/giftpack/buygiftpack/giftpackbuy?stoid=' + this.getStorageID + '&userid=' + this.getUserID + // }); - }, - GetGiftPackList: function GetGiftPackList(getId, ojb) { - //不销毁调整 - uni.navigateTo({ - url: 'pages/giftpack/giftpacklist/giftpacklist?isBuy=0&stoid=' + this.getStorageID + '&userid=' + this.getUserID + '&id=' + - getId - }); + // }, + // GetGiftPackList: function(getId, ojb) { + // //不销毁调整 + // uni.navigateTo({ + // url: 'pages/giftpack/giftpacklist/giftpacklist?isBuy=0&stoid=' + this.getStorageID + '&userid=' + this.getUserID + '&id=' + + // getId + // }); - }, - getList: function getList() { - var _this = this; //上拉加载 - var that = this; - if (that.loadingType != 0) { - return false; - } - that.loadingType = 1; - getApp().request.get('/api/weshop/marketing/my/giftbag/page',{ - data: { - "storeId": this.getStorageID, //商家ID - "userId": this.getUserID, //用户ID - "page": this.pages, - "pageSize": this.pageSize - }, - success: function success(res) { - if (res.data.code == 0) { - console.log(res.data.data); - 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]); - } + // }, + getList: function() { + var _this = this; //上拉加载 + var that = this.data; + if (that.loadingType != 0) { + return false; + } + // that.loadingType = 1; + _this.setData({ + loadingType: 1 + }) + getApp().request.get('/api/weshop/marketing/my/giftbag/page', { + data: { + // "storeId": this.getStorageID, //商家ID + // "userId": this.getUserID, //用户ID + // "page": this.pages, + // "pageSize": this.pageSize + "storeId": that.getStorageID, //商家ID + "userId": that.getUserID, //用户ID + "page": that.pages, + "pageSize": that.pageSize + }, + success: function success(res) { + if (res.data.code == 0) { + console.log(res.data.data); + if (res.data.data.total > 0) { + // _this.isEmpty = false; + _this.setData({ + isEmpty: false + }) + } else { + // _this.isEmpty = true; + _this.setData({ + isEmpty: true + }) + } + if (res.data.data.pageData.length == 0) { + // _this.loadingType = 2; + _this.setData({ + loadingType: 2 + }) + } else { + // console.log(_this.wareCard.length); + // console.log(res.data.data.pageData.length); + var wareCard = that.wareCard; + // if (_this.wareCard.length < res.data.data.pageData.length) { + if (wareCard.length < res.data.data.total) { + for (var i = 0; i < res.data.data.pageData.length; i++) { + wareCard.push(res.data.data.pageData[i]); } - - _this.loadingType = 0; - console.log(_this.wareCard); } - } else { - console.log(res.data.msg); + _this.setData({ + wareCard: wareCard + }) + + // _this.loadingType = 0; + _this.setData({ + loadingType: 0 + }) + console.log(_this.wareCard); } + } else { + console.log(res.data.msg); } - }); + } + }); - }, - TimeToDate: function TimeToDate(num) {//时间戳数据处理 是按秒来转换 - var date = new Date(num * 1000); - //时间戳为10位需*1000,时间戳为13位的话不需乘1000 - var y = date.getFullYear(); - var MM = date.getMonth() + 1; - MM = MM < 10 ? '0' + MM : MM; //月补0 - var d = date.getDate(); - d = d < 10 ? '0' + d : d; //天补0 - var h = date.getHours(); - h = h < 10 ? '0' + h : h; //小时补0 - var m = date.getMinutes(); - m = m < 10 ? '0' + m : m; //分钟补0 - var s = date.getSeconds(); - s = s < 10 ? '0' + s : s; //秒补0 - return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s; - }, - DateToTime: function DateToTime(TimeNum) {//时间转换成时间戳 - var Time = new Date(TimeNum); - return Time.getTime() / 1000; - } + }, + TimeToDate: function(num) { //时间戳数据处理 是按秒来转换 + var date = new Date(num * 1000); + //时间戳为10位需*1000,时间戳为13位的话不需乘1000 + var y = date.getFullYear(); + var MM = date.getMonth() + 1; + MM = MM < 10 ? '0' + MM : MM; //月补0 + var d = date.getDate(); + d = d < 10 ? '0' + d : d; //天补0 + var h = date.getHours(); + h = h < 10 ? '0' + h : h; //小时补0 + var m = date.getMinutes(); + m = m < 10 ? '0' + m : m; //分钟补0 + var s = date.getSeconds(); + s = s < 10 ? '0' + s : s; //秒补0 + return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s; + }, + DateToTime: function DateToTime(TimeNum) { //时间转换成时间戳 + var Time = new Date(TimeNum); + return Time.getTime() / 1000; + }, + goto: function(e) { + var th = this; + var url = e.currentTarget.dataset.url; + getApp().goto(url); } -}); + +}); \ No newline at end of file diff --git a/pages/giftpack/mygiftpack/mygiftpack.json b/pages/giftpack/mygiftpack/mygiftpack.json index 29437ed..1f07b7f 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.json +++ b/pages/giftpack/mygiftpack/mygiftpack.json @@ -1,4 +1,8 @@ { "navigationBarTitleText": "我的礼包", - "enablePullDownRefresh": false + "enablePullDownRefresh": false, + "usingComponents": { + "warn": "/components/long_warn/long_warn", + "my_confirm": "/components/my_confirm/my_confirm" + } } \ No newline at end of file diff --git a/pages/giftpack/mygiftpack/mygiftpack.wxml b/pages/giftpack/mygiftpack/mygiftpack.wxml index 7c517f4..92f2f04 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.wxml +++ b/pages/giftpack/mygiftpack/mygiftpack.wxml @@ -1,101 +1,109 @@ - - + + + + + + + 礼包列表 - - - 礼包列表 - - - - 我的礼包 - + + + 我的礼包 - - - - - - - - - - 新人有礼 - - - 评价有礼 - - - 节日营销 - - - 生日营销 - - - 助力礼包 - - - - - - - {{item.$orig.giftTitle}} - - - - {{"¥"+item.$orig.payMoney}} - - - {{item.$orig.payIntegral+"积分"}} - - - {{item.$orig.actTitle}} - - - {{item.$orig.actTitle}} - - - {{item.$orig.actTitle}} - - - {{item.$orig.actTitle}} - - - {{item.$orig.actTitle}} - - - - {{"原价:¥"+item.$orig.giftPosPrice}} - - - - {{"兑换截至日期:"+item.$orig.endTime}} - - - {{"距兑换开始时间: "+item.$orig.starTime}} - - - - - - - - - - - - - - - - 当前暂无礼包 - - - 去获取 - + + + + + + + + + + + + + + 新人有礼 + + + 评价有礼 + + + 节日营销 + + + 生日营销 + + + 助力礼包 + - - - ———— 到底了 ———— + - \ No newline at end of file + + + {{item.giftTitle}} + + + + {{"¥"+item.payMoney}} + + + {{item.payIntegral+"积分"}} + + + {{item.actTitle}} + + + {{item.actTitle}} + + + {{item.actTitle}} + + + {{item.actTitle}} + + + {{item.actTitle}} + + + + {{"原价:¥"+item.giftPosPrice}} + + + + + {{"兑换截至日期:"+getDate}} + + + {{"距兑换开始时间: "+item.starTime}} + + + + + + + + + + + + + + + + 当前暂无礼包 + + + 去获取 + + + + + ———— 到底了 ———— + + + + + \ No newline at end of file -- libgit2 0.21.4