From ff91440436e20b788715d1e503495c36b4e72bac Mon Sep 17 00:00:00 2001 From: zhouzhongping Date: Fri, 16 Jul 2021 16:37:55 +0800 Subject: [PATCH] 1.1.46 --- app.js | 26 ++-- components/countdown/index.js | 130 ++++++++++++++++++++ components/countdown/index.json | 3 + components/countdown/index.wxml | 15 +++ components/countdown/index.wxss | 33 +++++ components/diy/bargainGoods/index.js | 2 - components/diy/goods/goods.js | 2 - components/diy/search/search.js | 2 - components/diy/service/service.js | 2 - components/diy/sharingGoods/sharingGoods.js | 2 - components/diy/sharpGoods/index.js | 37 ++---- components/diy/sharpGoods/index.json | 5 +- components/diy/sharpGoods/index.wxml | 24 +--- components/diy/shop/index.js | 2 - components/diy/special/index.js | 4 - components/shortcut/shortcut.js | 4 - pages/address/create.js | 2 - pages/address/detail.js | 2 - pages/article/index.js | 17 +-- pages/bargain/goods/index.js | 62 +++------- pages/bargain/goods/index.json | 3 +- pages/bargain/goods/index.wxml | 40 +++--- pages/bargain/index/index.js | 37 ++---- pages/bargain/index/index.json | 3 +- pages/bargain/index/index.wxml | 25 +--- pages/bargain/task/index.js | 44 ++----- pages/bargain/task/index.json | 3 +- pages/bargain/task/index.wxml | 6 +- pages/dealer/index/index.js | 2 - pages/flow/checkout.js | 4 - pages/goods/index.js | 12 +- pages/login/login.js | 27 +++- pages/login/login.wxml | 5 +- pages/order/detail.js | 2 - pages/order/index.js | 3 - pages/order/refund/apply/apply.js | 6 - pages/order/refund/detail/detail.js | 4 - pages/sharing/active/index.js | 60 +-------- pages/sharing/active/index.json | 3 +- pages/sharing/active/index.wxml | 25 ++-- pages/sharing/active/index.wxss | 20 ++- pages/sharing/checkout/index.js | 4 - pages/sharing/goods/index.js | 88 +------------ pages/sharing/goods/index.json | 3 +- pages/sharing/goods/index.wxml | 39 ++++-- pages/sharing/goods/index.wxss | 16 ++- pages/sharing/index/index.js | 3 - pages/sharing/order/detail/detail.js | 2 - pages/sharing/order/index.js | 7 -- pages/sharing/order/refund/apply/apply.js | 6 - pages/sharing/order/refund/detail/detail.js | 4 - pages/sharp/goods/index.js | 56 +++------ pages/sharp/goods/index.json | 3 +- pages/sharp/goods/index.wxml | 5 +- pages/sharp/index/index.js | 39 +++--- pages/sharp/index/index.json | 5 +- pages/sharp/index/index.wxml | 22 +--- pages/sharp/index/index.wxss | 18 +-- pages/user/index.js | 8 -- pages/user/recharge/index.js | 2 - pages/user/wallet/index.js | 6 - utils/common.wxss | 23 ++-- version.json | 2 +- 63 files changed, 460 insertions(+), 611 deletions(-) create mode 100644 components/countdown/index.js create mode 100644 components/countdown/index.json create mode 100644 components/countdown/index.wxml create mode 100644 components/countdown/index.wxss diff --git a/app.js b/app.js index a49e07f..e74b13c 100644 --- a/app.js +++ b/app.js @@ -408,11 +408,8 @@ App({ /** * 授权登录 */ - getUserInfo(e, callback) { + getUserInfo(userInfo, callback) { let App = this; - if (e.detail.errMsg !== 'getUserInfo:ok') { - return false; - } wx.showLoading({ title: "正在登录", mask: true @@ -423,10 +420,7 @@ App({ // 发送用户信息 App._post_form('user/login', { code: res.code, - user_info: e.detail.rawData, - encrypted_data: e.detail.encryptedData, - iv: e.detail.iv, - signature: e.detail.signature, + user_info: JSON.stringify(userInfo), referee_id: wx.getStorageSync('referee_id') }, result => { // 记录token user_id @@ -454,11 +448,17 @@ App({ */ setCartTabBadge() { const number = wx.getStorageSync('cartTotalNum') - if (number <= 0) return - wx.setTabBarBadge({ - index: 2, - text: `${number}` - }) + if (number > 0) { + wx.setTabBarBadge({ + index: 2, + text: `${number}` + }) + } else { + wx.removeTabBarBadge({ + index: 2 + }) + } + return } }); \ No newline at end of file diff --git a/components/countdown/index.js b/components/countdown/index.js new file mode 100644 index 0000000..7061fa3 --- /dev/null +++ b/components/countdown/index.js @@ -0,0 +1,130 @@ +import util from '../../utils/util' + +Component({ + properties: { + // useSlot: Boolean, + // 截止的时间 + date: String, + // 分隔符, colon为英文冒号,zh为中文 + separator: { + type: String, + value: 'zh' + }, + // 组件样式, text为纯文本,custom为带背景色 + style: { + type: String, + value: 'text' + }, + }, + + data: { + // 倒计时数据 + dynamic: { + day: '00', + hou: '00', + min: '00', + sec: '00' + }, + // 分隔符文案 + separatorText: { + day: '天', + hou: '时', + min: '分', + sec: '秒' + } + }, + + attached() { + // 分隔符文案 + this.separatorText() + // 开始倒计时 + this.onTime() + }, + + detached() { + + }, + + + methods: { + + // 分隔符文案 + separatorText() { + const separatorText = this.data.separatorText + if (this.data.separator === 'colon') { + separatorText.day = ':' + separatorText.hou = ':' + separatorText.min = ':' + separatorText.sec = '' + } + this.setData({ + separatorText + }) + }, + + // 开始倒计时 + onTime(deep = 0) { + const app = this + const dynamic = {} + + // 获取当前时间,同时得到活动结束时间数组 + const newTime = new Date().getTime() + // 对结束时间进行处理渲染到页面 + const endTime = new Date(util.format_date(app.data.date)).getTime(); + + // 如果活动未结束,对时间进行处理 + if ((endTime - newTime) <= 0) { + return false + } + + const diffTime = (endTime - newTime) / 1000; + // 获取时、分、秒 + const day = parseInt(diffTime / 86400), + hou = parseInt(diffTime % 86400 / 3600), + min = parseInt(diffTime % 86400 % 3600 / 60), + sec = parseInt(diffTime % 86400 % 3600 % 60); + dynamic.day = app.timeFormat(day) + dynamic.hou = app.timeFormat(hou) + dynamic.min = app.timeFormat(min) + dynamic.sec = app.timeFormat(sec) + + // 渲染,然后每隔一秒执行一次倒计时函数 + app.setData({ + dynamic + }) + // 判断倒计时是否结束 + const isEnd = app.isEnd() + // 结束后执行回调函数 + if (isEnd) { + deep > 0 && app.triggerEvent('finish') + } + // 重复执行 + if (!isEnd) { + setTimeout(() => { + app.onTime(++deep) + }, 1000) + } + }, + + // 判断倒计时是否结束 + isEnd() { + const { + dynamic + } = this.data + if (dynamic.day == '00' && dynamic.hou == '00' && dynamic.min == '00' && dynamic.sec == '00') { + return true + } + return false + }, + + /** + * 小于10的格式化函数 + */ + timeFormat(value) { + return value < 10 ? '0' + value : value + } + + + + } +}) \ No newline at end of file diff --git a/components/countdown/index.json b/components/countdown/index.json new file mode 100644 index 0000000..32640e0 --- /dev/null +++ b/components/countdown/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/components/countdown/index.wxml b/components/countdown/index.wxml new file mode 100644 index 0000000..67c36e3 --- /dev/null +++ b/components/countdown/index.wxml @@ -0,0 +1,15 @@ + + + + + {{ dynamic.day }} + {{ separatorText.day }} + + {{ dynamic.hou }} + {{ separatorText.hou }} + {{ dynamic.min }} + {{ separatorText.min }} + {{ dynamic.sec }} + {{ separatorText.sec }} + + \ No newline at end of file diff --git a/components/countdown/index.wxss b/components/countdown/index.wxss new file mode 100644 index 0000000..bbf9d38 --- /dev/null +++ b/components/countdown/index.wxss @@ -0,0 +1,33 @@ +.item { + display: inline-block; + width: 22px; + margin-right: 5px; + color: #fff; + font-size: 12px; + text-align: center; + background-color: #1989fa; + border-radius: 2px; +} + +.separator { + padding: 0 2rpx; +} + +/* 冒号分隔符 */ +.text-style.separator-colon .separator { + padding: 0 5rpx; +} + + +/* 带背景的样式 */ +.custom-style .dynamic-value { + background: #252525; + color: #fff; + padding: 0 8rpx; + line-height: 40rpx; + border-radius: 8rpx; +} + +.custom-style .separator { + padding: 0 7rpx; +} \ No newline at end of file diff --git a/components/diy/bargainGoods/index.js b/components/diy/bargainGoods/index.js index f177b7d..fbe9ca1 100644 --- a/components/diy/bargainGoods/index.js +++ b/components/diy/bargainGoods/index.js @@ -27,8 +27,6 @@ Component({ * 跳转商品详情页 */ _onTargetGoods(e) { - // 记录formid - App.saveFormId(e.detail.formId); wx.navigateTo({ url: `/pages/bargain/goods/index?active_id=${e.detail.target.dataset.id}`, }); diff --git a/components/diy/goods/goods.js b/components/diy/goods/goods.js index b50c938..f7a3ace 100644 --- a/components/diy/goods/goods.js +++ b/components/diy/goods/goods.js @@ -27,8 +27,6 @@ Component({ * 跳转商品详情页 */ _onTargetGoods(e) { - // 记录formid - App.saveFormId(e.detail.formId); wx.navigateTo({ url: '/pages/goods/index?goods_id=' + e.detail.target.dataset.id, }); diff --git a/components/diy/search/search.js b/components/diy/search/search.js index a2090f4..40188cf 100644 --- a/components/diy/search/search.js +++ b/components/diy/search/search.js @@ -24,8 +24,6 @@ Component({ * 跳转到搜索页面 */ onTargetSearch(e) { - // 记录formid - App.saveFormId(e.detail.formId); App.navigationTo('pages/search/index'); }, } diff --git a/components/diy/service/service.js b/components/diy/service/service.js index 3f53776..c154856 100644 --- a/components/diy/service/service.js +++ b/components/diy/service/service.js @@ -26,8 +26,6 @@ Component({ * 点击拨打电话 */ _onServiceEvent(e) { - // 记录formid - App.saveFormId(e.detail.formId); // 拨打电话 wx.makePhoneCall({ phoneNumber: this.data.params.phone_num diff --git a/components/diy/sharingGoods/sharingGoods.js b/components/diy/sharingGoods/sharingGoods.js index 2890743..20fdc2f 100644 --- a/components/diy/sharingGoods/sharingGoods.js +++ b/components/diy/sharingGoods/sharingGoods.js @@ -27,8 +27,6 @@ Component({ * 跳转商品详情页 */ _onTargetGoods(e) { - // 记录formid - App.saveFormId(e.detail.formId); wx.navigateTo({ url: '/pages/sharing/goods/index?goods_id=' + e.detail.target.dataset.id, }); diff --git a/components/diy/sharpGoods/index.js b/components/diy/sharpGoods/index.js index b2b2f2e..d1c0d5e 100644 --- a/components/diy/sharpGoods/index.js +++ b/components/diy/sharpGoods/index.js @@ -1,14 +1,8 @@ -const App = getApp(); - -// 工具类 import util from '../../../utils/util.js'; - -// 倒计时插件 -import CountDown from '../../../utils/countdown.js'; - -// 枚举类:秒杀活动商品状态 import ActiveStatusEnum from '../../../utils/enum/sharp/GoodsStatus.js'; +const App = getApp() + Component({ options: { @@ -31,7 +25,7 @@ Component({ */ data: { ActiveStatusEnum, // 秒杀活动商品状态 - countDownList: [], // 倒计时 + countDownTime: false, // 倒计时日期 }, /** @@ -45,7 +39,7 @@ Component({ attached() { let _this = this; _this._initCountDownData(); - }, + } }, @@ -57,13 +51,10 @@ Component({ */ methods: { - /** * 跳转商品详情页 */ _onTargetGoods(e) { - // 记录formid - App.saveFormId(e.detail.formId); // 生成query参数 let _this = this, query = util.urlEncode({ @@ -80,8 +71,6 @@ Component({ * 更多秒杀 */ _onTargetSharpIndex(e) { - // 记录formid - App.saveFormId(e.detail.formId); // 跳转到秒杀会场首页 wx.navigateTo({ url: `/pages/sharp/index/index`, @@ -91,19 +80,15 @@ Component({ /** * 初始化倒计时组件 */ - _initCountDownData(data) { - let _this = this, - active = _this.data.data.active; + _initCountDownData() { + const app = this + const active = app.data.data.active if (!active) return false; // 记录倒计时的时间 - _this.setData({ - [`countDownList[0]`]: { - date: active.count_down_time, - } - }); - // 执行倒计时 - CountDown.onSetTimeList(_this, 'countDownList'); - }, + app.setData({ + countDownTime: active.count_down_time + }) + } } }) \ No newline at end of file diff --git a/components/diy/sharpGoods/index.json b/components/diy/sharpGoods/index.json index 32640e0..6027f3b 100644 --- a/components/diy/sharpGoods/index.json +++ b/components/diy/sharpGoods/index.json @@ -1,3 +1,6 @@ { - "component": true + "component": true, + "usingComponents": { + "countdown": "/components/countdown/index" + } } \ No newline at end of file diff --git a/components/diy/sharpGoods/index.wxml b/components/diy/sharpGoods/index.wxml index c8e279b..8c00ac0 100644 --- a/components/diy/sharpGoods/index.wxml +++ b/components/diy/sharpGoods/index.wxml @@ -11,23 +11,7 @@ - - - {{ countDownList[0].dynamic.hou }} - - - : - - - {{ countDownList[0].dynamic.min }} - - - : - - - {{ countDownList[0].dynamic.sec }} - - + @@ -63,8 +47,10 @@ - ¥{{ dataItem.goods_sku.seckill_price }} - ¥{{ dataItem.goods_sku.original_price }} + ¥{{ dataItem.goods_sku.seckill_price }} + ¥{{ dataItem.goods_sku.original_price }} diff --git a/components/diy/shop/index.js b/components/diy/shop/index.js index b11242b..eb4af2d 100644 --- a/components/diy/shop/index.js +++ b/components/diy/shop/index.js @@ -26,8 +26,6 @@ Component({ * 跳转门店详情页 */ _onTargetDetail(e) { - // 记录formid - App.saveFormId(e.detail.formId); wx.navigateTo({ url: '/pages/shop/detail/index?shop_id=' + e.detail.target.dataset.id, }); diff --git a/components/diy/special/index.js b/components/diy/special/index.js index e5c552e..2997007 100644 --- a/components/diy/special/index.js +++ b/components/diy/special/index.js @@ -27,8 +27,6 @@ Component({ * 跳转文章首页 */ _onTargetIndex(e) { - // 记录formid - App.saveFormId(e.detail.formId); wx.navigateTo({ url: '/pages/article/index' }); @@ -38,8 +36,6 @@ Component({ * 跳转文章详情页 */ _onTargetDetail(e) { - // 记录formid - App.saveFormId(e.detail.formId); wx.navigateTo({ url: '/pages/article/detail/index?article_id=' + e.detail.target.dataset.id }); diff --git a/components/shortcut/shortcut.js b/components/shortcut/shortcut.js index e0387d9..8b8a6ae 100644 --- a/components/shortcut/shortcut.js +++ b/components/shortcut/shortcut.js @@ -40,8 +40,6 @@ Component({ * 导航菜单切换事件 */ _onToggleShow(e) { - // 记录formid - App.saveFormId(e.detail.formId); this.setData({ isShow: !this.data.isShow, transparent: false @@ -53,8 +51,6 @@ Component({ */ _onTargetPage(e) { let urls = App.getTabBarLinks(); - // 记录formid - App.saveFormId(e.detail.formId); wx.switchTab({ url: '/' + urls[e.detail.target.dataset.index] }); diff --git a/pages/address/create.js b/pages/address/create.js index 4c2026d..ee8e247 100644 --- a/pages/address/create.js +++ b/pages/address/create.js @@ -32,8 +32,6 @@ Page({ values = e.detail.value values.region = this.data.region; - // 记录formId - App.saveFormId(e.detail.formId); // 表单验证 if (!_this.validation(values)) { diff --git a/pages/address/detail.js b/pages/address/detail.js index 74f4abc..3eab0a9 100644 --- a/pages/address/detail.js +++ b/pages/address/detail.js @@ -42,8 +42,6 @@ Page({ values = e.detail.value values.region = this.data.region; - // 记录formId - App.saveFormId(e.detail.formId); // 表单验证 if (!_this.validation(values)) { diff --git a/pages/article/index.js b/pages/article/index.js index 5f3f521..c63ea8c 100644 --- a/pages/article/index.js +++ b/pages/article/index.js @@ -22,8 +22,14 @@ Page({ /** * 生命周期函数--监听页面加载 */ - onLoad: function(options) { + onLoad: function (options) { let _this = this; + // 设置默认的分类 + if (options.category_id) { + _this.setData({ + category_id: options.category_id + }) + } // 设置文章列表高度 _this.setListHeight(); // Api:获取文章首页 @@ -36,7 +42,7 @@ Page({ getIndexData() { let _this = this; // 获取文章首页 - App._get('article/index', {}, function(result) { + App._get('article/index', {}, function (result) { _this.setData({ categoryList: result.data.categoryList }); @@ -48,7 +54,7 @@ Page({ /** * Api:切换导航栏 */ - onSwitchTab: function(e) { + onSwitchTab: function (e) { let _this = this; // 第一步:切换当前的分类id _this.setData({ @@ -70,7 +76,7 @@ Page({ App._get('article/lists', { page: page || 1, category_id: _this.data.category_id - }, function(result) { + }, function (result) { let resList = result.data.list, dataList = _this.data.articleList; if (isPage == true) { @@ -119,9 +125,6 @@ Page({ rpx = systemInfo.windowWidth / 750, // 计算rpx tapHeight = Math.floor(rpx * 98), // tap高度 scrollHeight = systemInfo.windowHeight - tapHeight; // swiper高度 - console.log( - systemInfo.windowHeight - ); this.setData({ scrollHeight }); diff --git a/pages/bargain/goods/index.js b/pages/bargain/goods/index.js index 87e7c1a..2a6e0d4 100644 --- a/pages/bargain/goods/index.js +++ b/pages/bargain/goods/index.js @@ -1,19 +1,8 @@ -const App = getApp(); - -// 富文本插件 import wxParse from '../../../wxParse/wxParse.js'; - -// 工具类 -import util from '../../../utils/util.js'; - -// 倒计时插件 -import CountDown from '../../../utils/countdown.js'; - -// 对话框插件 import Dialog from '../../../components/dialog/dialog'; -// 记录规格的数组 -let goodsSpecArr = []; +const App = getApp() +let goodsSpecArr = [] Page({ @@ -60,9 +49,7 @@ Page({ // 返回顶部 showTopWidget: false, - // 倒计时 - actEndTimeList: [], - + countDownTime: false, // 倒计时日期 active: {}, // 砍价活动详情 goods: {}, // 商品详情 @@ -102,13 +89,10 @@ Page({ active_id: _this.data.active_id }, (result) => { // 初始化详情数据 - let data = _this._initData(result.data); - _this.setData(data); - - // 执行倒计时 - if (!data.active.is_end) { - CountDown.onSetTimeList(_this, 'actEndTimeList'); - } + const data = result.data + _this._initData(data) + // 初始化倒计时组件 + _this._initCountDownData(data) }); }, @@ -139,12 +123,22 @@ Page({ data.goodsMultiSpec = _this._initManySpecData(goodsDetail.goods_multi_spec); } // 记录活动到期时间 - data.actEndTimeList = [{ + data.countDownObj = [{ date: data.active.end_time }]; + _this.setData(data) + data.countDownObj.date = data.active.end_time return data; }, + // 初始化倒计时组件 + _initCountDownData(data) { + const app = this + app.setData({ + countDownTime: data.active.end_time + }) + }, + /** * 初始化商品多规格 */ @@ -169,8 +163,6 @@ Page({ attrIdx = e.currentTarget.dataset.attrIdx, itemIdx = e.currentTarget.dataset.itemIdx, goodsMultiSpec = _this.data.goodsMultiSpec; - // 记录formid - App.saveFormId(e.detail.formId); for (let i in goodsMultiSpec.spec_attr) { for (let j in goodsMultiSpec.spec_attr[i].spec_items) { if (attrIdx == i) { @@ -285,8 +277,6 @@ Page({ */ onClickShare(e) { let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); _this.setData({ 'share.show': true }); @@ -348,8 +338,6 @@ Page({ */ onSavePoster(e) { let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); wx.showLoading({ title: '加载中', }); @@ -395,12 +383,8 @@ Page({ /** * 确认购买弹窗 */ - onToggleTrade(e) { + onToggleTrade() { let _this = this; - if (typeof e === 'object') { - // 记录formId - e.detail.hasOwnProperty('formId') && App.saveFormId(e.detail.formId); - } _this.setData({ showBottomPopup: !_this.data.showBottomPopup }); @@ -410,8 +394,6 @@ Page({ * 显示砍价规则 */ onToggleRules(e) { - // 记录formId - App.saveFormId(e.detail.formId); // 显示砍价规则 let _this = this; Dialog({ @@ -432,8 +414,6 @@ Page({ */ onSubmit(e) { let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); // 判断是否已参与当前的砍价活动,如果已参与的话跳转到砍价任务 if (_this.data.is_partake) { wx.navigateTo({ @@ -455,8 +435,6 @@ Page({ */ onSubmit2(e) { let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); // 关闭选择器 _this.onToggleTrade(); // 确认发起砍价 @@ -502,8 +480,6 @@ Page({ * 跳转到首页 */ onTargetHome(e) { - // 记录formid - App.saveFormId(e.detail.formId); wx.switchTab({ url: '../../index/index', }) diff --git a/pages/bargain/goods/index.json b/pages/bargain/goods/index.json index 2020588..165a17f 100644 --- a/pages/bargain/goods/index.json +++ b/pages/bargain/goods/index.json @@ -4,6 +4,7 @@ "zan-actionsheet": "/components/actionsheet/index", "zan-dialog": "/components/dialog/index", "zan-popup": "/components/popup/index", - "shortcut": "/components/shortcut/shortcut" + "shortcut": "/components/shortcut/shortcut", + "countdown": "/components/countdown/index" } } \ No newline at end of file diff --git a/pages/bargain/goods/index.wxml b/pages/bargain/goods/index.wxml index 3ab0dd5..132c14a 100644 --- a/pages/bargain/goods/index.wxml +++ b/pages/bargain/goods/index.wxml @@ -8,7 +8,8 @@ - -
+ @@ -236,7 +237,9 @@ - + @@ -245,7 +248,7 @@ - + @@ -293,9 +296,12 @@ - + {{ attr.group_name }} - + {{ item.spec_value }} @@ -308,11 +314,11 @@ 购买数量 - + -
+
@@ -322,7 +328,7 @@ -
+ diff --git a/pages/bargain/index/index.js b/pages/bargain/index/index.js index f6ccfff..533bff1 100644 --- a/pages/bargain/index/index.js +++ b/pages/bargain/index/index.js @@ -1,10 +1,6 @@ -const App = getApp(); +import util from '../../../utils/util.js' -// 工具类 -import util from '../../../utils/util.js'; - -// 倒计时插件 -import CountDown from '../../../utils/countdown.js'; +const App = getApp() Page({ @@ -137,21 +133,14 @@ Page({ * 初始化倒计时组件 */ _initCountDownData(data) { - let _this = this; - // 记录活动到期时间 - let countDownList = _this.data.countDownList; - data.myList.data.forEach((item) => { - countDownList.push({ - date: item.end_time, - }); - }); - _this.setData({ - countDownList, - }); - // 执行倒计时 - if (countDownList.length > 0) { - CountDown.onSetTimeList(_this, 'countDownList'); - } + // let _this = this; + // // 记录活动到期时间 + // let countDownList = _this.data.countDownList; + // data.myList.data.forEach((item) => { + // countDownList.push({ + // date: item.end_time + // }) + // }) }, /** @@ -169,8 +158,6 @@ Page({ */ onToggleTab(e) { let _this = this; - // 保存formid - App.saveFormId(e.detail.formId); // 设置当前tabbar索引,并重置数据 _this.setData({ currentTab: e.currentTarget.dataset.index, @@ -188,8 +175,6 @@ Page({ * 跳转到砍价商品详情 */ onTargetActive(e) { - // 保存formid - App.saveFormId(e.detail.formId); wx.navigateTo({ url: `../goods/index?active_id=${e.detail.target.dataset.id}`, }) @@ -199,8 +184,6 @@ Page({ * 跳转到砍价任务详情 */ onTargetTask(e) { - // 保存formid - App.saveFormId(e.detail.formId); wx.navigateTo({ url: `../task/index?task_id=${e.detail.target.dataset.id}`, }) diff --git a/pages/bargain/index/index.json b/pages/bargain/index/index.json index 932f88e..bad12a1 100644 --- a/pages/bargain/index/index.json +++ b/pages/bargain/index/index.json @@ -1,6 +1,7 @@ { "navigationBarTitleText": "砍价专区", "usingComponents": { - "diy-banner": "/components/diy/banner/banner" + "diy-banner": "/components/diy/banner/banner", + "countdown": "/components/countdown/index" } } \ No newline at end of file diff --git a/pages/bargain/index/index.wxml b/pages/bargain/index/index.wxml index 250d42b..26ebd2a 100644 --- a/pages/bargain/index/index.wxml +++ b/pages/bargain/index/index.wxml @@ -1,7 +1,8 @@ - + @@ -104,26 +105,8 @@ - - 剩余 - - - - {{ countDownList[index].dynamic.hou }} - - - : - - - {{ countDownList[index].dynamic.min }} - - - : - - - {{ countDownList[index].dynamic.sec }} - - + 剩余 + {{ item.is_buy ? '砍价成功' : '已结束' }} diff --git a/pages/bargain/task/index.js b/pages/bargain/task/index.js index 7b91650..d64c7a8 100644 --- a/pages/bargain/task/index.js +++ b/pages/bargain/task/index.js @@ -1,22 +1,15 @@ -const App = getApp(); - -// 工具类 import util from '../../../utils/util.js'; - -// 倒计时插件 -import CountDown from '../../../utils/countdown.js'; - -// 对话框插件 import Dialog from '../../../components/dialog/dialog'; +const App = getApp() + Page({ /** * 页面的初始数据 */ data: { - // 砍价任务倒计时 - taskEndTime: [], + countDownTime: false, // 倒计时日期 task: {}, // 砍价任务详情 active: {}, // 活动详情 @@ -71,18 +64,15 @@ Page({ * 初始化页面数据 */ _initData(data) { - let _this = this; + const app = this; // 初始化:显示操作按钮 - _this._initShowBtn(data); + app._initShowBtn(data) + // 记录页面数据 + app.setData(data) // 记录活动到期时间 - data.taskEndTime = [{ - date: data.task.end_time - }]; - _this.setData(data); - // 执行倒计时 - if (!data.task.is_end) { - CountDown.onSetTimeList(_this, 'taskEndTime'); - } + app.setData({ + countDownTime: data.active.end_time + }) }, /** @@ -110,8 +100,6 @@ Page({ * 跳转到首页 */ onTargetHome(e) { - // 记录formid - App.saveFormId(e.detail.formId); wx.switchTab({ url: '../../index/index', }) @@ -121,8 +109,6 @@ Page({ * 显示砍价规则 */ onToggleRules(e) { - // 记录formId - App.saveFormId(e.detail.formId); // 显示砍价规则 let _this = this; Dialog({ @@ -143,8 +129,6 @@ Page({ */ onTargetGoods(e) { let _this = this; - // 记录formid - App.saveFormId(e.detail.formId); wx.navigateTo({ url: `../goods/index?active_id=${_this.data.task.active_id}`, }) @@ -154,8 +138,6 @@ Page({ * 跳转到砍价首页 */ onTargetBargain(e) { - // 记录formid - App.saveFormId(e.detail.formId); wx.navigateTo({ url: '../index/index', }) @@ -166,8 +148,6 @@ Page({ */ onHelpCut(e) { let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); // 按钮禁用时不允许操作(防重复提交) if (_this.data.disabled == true) { return false; @@ -180,7 +160,7 @@ Page({ App._post_form('bargain.task/help_cut', { task_id: _this.data.task_id }, result => { - App.showSuccess(result.msg, function() { + App.showSuccess(result.msg, function () { wx.navigateBack(); }); // 获取砍价任务详情 @@ -200,8 +180,6 @@ Page({ let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); // 跳转到结算台 let option = util.urlEncode({ diff --git a/pages/bargain/task/index.json b/pages/bargain/task/index.json index 31d933a..12b24d4 100644 --- a/pages/bargain/task/index.json +++ b/pages/bargain/task/index.json @@ -1,6 +1,7 @@ { "navigationBarTitleText": "砍价任务", "usingComponents": { - "zan-dialog": "/components/dialog/index" + "zan-dialog": "/components/dialog/index", + "countdown": "/components/countdown/index" } } \ No newline at end of file diff --git a/pages/bargain/task/index.wxml b/pages/bargain/task/index.wxml index 88b7091..0c762a6 100644 --- a/pages/bargain/task/index.wxml +++ b/pages/bargain/task/index.wxml @@ -135,8 +135,10 @@ - - 活动还剩 {{ item.dynamic.hou }} : {{ item.dynamic.min }} : {{ item.dynamic.sec }} 结束,快来砍价吧~ + + 活动还剩 + + 结束,快来砍价吧~ diff --git a/pages/dealer/index/index.js b/pages/dealer/index/index.js index a240d11..c022505 100644 --- a/pages/dealer/index/index.js +++ b/pages/dealer/index/index.js @@ -57,8 +57,6 @@ Page({ * 立即加入分销商 */ triggerApply(e) { - // 记录formId - App.saveFormId(e.detail.formId); wx.navigateTo({ url: '../apply/apply', }) diff --git a/pages/flow/checkout.js b/pages/flow/checkout.js index 3df380d..903d736 100644 --- a/pages/flow/checkout.js +++ b/pages/flow/checkout.js @@ -480,8 +480,6 @@ Page({ */ onSelectPayType(e) { let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); // 设置当前支付方式 _this.setData({ curPayType: e.currentTarget.dataset.value @@ -536,8 +534,6 @@ Page({ */ onShowPoints(e) { let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); // 显示dialog let setting = _this.data.setting; Dialog({ diff --git a/pages/goods/index.js b/pages/goods/index.js index 819e249..0ee604c 100644 --- a/pages/goods/index.js +++ b/pages/goods/index.js @@ -210,7 +210,6 @@ Page({ */ onIncGoodsNumber(e) { let _this = this; - App.saveFormId(e.detail.formId); _this.setData({ goods_num: ++_this.data.goods_num }) @@ -221,7 +220,6 @@ Page({ */ onDecGoodsNumber(e) { let _this = this; - App.saveFormId(e.detail.formId); if (_this.data.goods_num > 1) { _this.setData({ goods_num: --_this.data.goods_num @@ -353,8 +351,6 @@ Page({ */ onClickShare(e) { let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); _this.setData({ 'share.show': true }); @@ -416,8 +412,6 @@ Page({ */ onSavePoster(e) { let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); wx.showLoading({ title: '加载中', }); @@ -463,12 +457,8 @@ Page({ /** * 确认购买弹窗 */ - onToggleTrade(e) { + onToggleTrade() { let _this = this; - if (typeof e === 'object') { - // 记录formId - e.detail.hasOwnProperty('formId') && App.saveFormId(e.detail.formId); - } _this.setData({ showBottomPopup: !_this.data.showBottomPopup }); diff --git a/pages/login/login.js b/pages/login/login.js index 05abe99..d0443a5 100644 --- a/pages/login/login.js +++ b/pages/login/login.js @@ -20,7 +20,7 @@ Page({ }, /** - * 授权登录 + * 授权登录(旧版弃用) */ getUserInfo(e) { let _this = this; @@ -30,6 +30,31 @@ Page({ }); }, + /** + * 授权登录(新版) + */ + getUserProfile() { + console.log('getUserProfile') + const app = this + wx.canIUse('getUserProfile') && wx.getUserProfile({ + lang: 'zh_CN', + desc: '获取用户相关信息', + success({ + userInfo + }) { + console.log('用户同意了授权') + console.log('userInfo:', userInfo) + App.getUserInfo(userInfo, () => { + // 跳转回原页面 + app.onNavigateBack(1) + }); + }, + fail() { + console.log('用户拒绝了授权') + } + }) + }, + /** * 暂不登录 */ diff --git a/pages/login/login.wxml b/pages/login/login.wxml index 7b11d18..69d3ca0 100644 --- a/pages/login/login.wxml +++ b/pages/login/login.wxml @@ -7,7 +7,10 @@ 申请获取以下权限 获得你的公开信息(昵称、头像等) - + - + 还差 {{ detail.surplus_people }} 个名额, - - - {{item.hou}} : - {{item.min}} : - {{item.sec}} - + + 后结束 @@ -84,7 +81,8 @@ 更多拼团 - + @@ -139,18 +137,21 @@ - + {{attr.group_name}} - + -
+ diff --git a/pages/sharing/active/index.wxss b/pages/sharing/active/index.wxss index 984b52a..0c92817 100644 --- a/pages/sharing/active/index.wxss +++ b/pages/sharing/active/index.wxss @@ -183,20 +183,18 @@ view { /* 倒计时 */ +.main_tiem { + margin-bottom: 40rpx; + font-size: 32rpx; + text-align: center; + display: flex; + justify-content: center; +} + .main_tiem .main_timer_color { color: #fc8434; } -.main_tiem view { - display: inline-block; -} - -.main_tiem view text { - display: inline-block; - padding: 10rpx 5rpx; - background: #e5e5e5; -} - .main button { display: block; margin-top: 40rpx; @@ -507,4 +505,4 @@ view { text-align: center; font-size: 28rpx; color: #444; -} +} \ No newline at end of file diff --git a/pages/sharing/checkout/index.js b/pages/sharing/checkout/index.js index c770493..1c0b025 100644 --- a/pages/sharing/checkout/index.js +++ b/pages/sharing/checkout/index.js @@ -393,8 +393,6 @@ Page({ */ onSelectPayType(e) { let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); // 设置当前支付方式 _this.setData({ curPayType: e.currentTarget.dataset.value @@ -449,8 +447,6 @@ Page({ */ onShowPoints(e) { let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); // 显示dialog let setting = _this.data.setting; Dialog({ diff --git a/pages/sharing/goods/index.js b/pages/sharing/goods/index.js index 916cdc2..7b53dbe 100644 --- a/pages/sharing/goods/index.js +++ b/pages/sharing/goods/index.js @@ -1,11 +1,10 @@ -const App = getApp(); const Sharing = require('../../../utils/extend/sharing.js'); const wxParse = require("../../../wxParse/wxParse.js"); const Dialog = require('../../../components/dialog/dialog'); - -// 工具类 const util = require('../../../utils/util.js'); +const App = getApp() + // 记录规格的数组 let goodsSpecArr = []; @@ -37,9 +36,6 @@ Page({ cart_total_num: 0, // 购物车商品总数量 goodsMultiSpec: {}, // 多规格信息 - countDownList: [], // 时间记录 - actEndTimeList: [], - // 分享按钮组件 share: { show: false, @@ -96,8 +92,6 @@ Page({ // 初始化商品详情数据 let data = _this._initGoodsDetailData(result.data); _this.setData(data); - // 执行倒计时函数 - _this.countDown(); }); }, @@ -128,13 +122,6 @@ Page({ if (goodsDetail.spec_type == 20) { data.goodsMultiSpec = _this.initManySpecData(goodsDetail.goods_multi_spec); } - // 记录倒计时时间 - data['actEndTimeList'] = []; - if (data.activeList.length > 0) { - data.activeList.forEach(item => { - data['actEndTimeList'].push(item.end_time.text); - }); - } return data; }, @@ -163,8 +150,6 @@ Page({ itemIdx = e.currentTarget.dataset.itemIdx, goodsMultiSpec = _this.data.goodsMultiSpec; - // 记录formid - App.saveFormId(e.detail.formId); for (let i in goodsMultiSpec.spec_attr) { for (let j in goodsMultiSpec.spec_attr[i].spec_items) { @@ -226,7 +211,6 @@ Page({ */ onScrollTop(e) { let _this = this; - App.saveFormId(e.detail.formId); _this.setData({ scrollTop: 0 }); @@ -247,7 +231,6 @@ Page({ */ onIncGoodsNumber(e) { let _this = this; - App.saveFormId(e.detail.formId); _this.setData({ goods_num: ++_this.data.goods_num }) @@ -258,7 +241,6 @@ Page({ */ onDecGoodsNumber(e) { let _this = this; - App.saveFormId(e.detail.formId); if (_this.data.goods_num > 1) { _this.setData({ goods_num: --_this.data.goods_num @@ -355,7 +337,6 @@ Page({ */ onTargetToComment(e) { let _this = this; - App.saveFormId(e.detail.formId); wx.navigateTo({ url: './comment/comment?goods_id=' + _this.data.goods_id }) @@ -366,8 +347,6 @@ Page({ */ onClickShare(e) { let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); _this.setData({ 'share.show': true }); @@ -429,8 +408,6 @@ Page({ */ onSavePoster(e) { let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); wx.showLoading({ title: '加载中', }); @@ -476,12 +453,8 @@ Page({ /** * 确认购买弹窗 */ - onToggleTrade(e) { + onToggleTrade() { let _this = this; - if (typeof e === 'object') { - // 记录formId - e.detail.hasOwnProperty('formId') && App.saveFormId(e.detail.formId); - } _this.setData({ showBottomPopup: !_this.data.showBottomPopup }); @@ -491,8 +464,6 @@ Page({ * 显示拼团规则 */ onToggleRules(e) { - // 记录formId - App.saveFormId(e.detail.formId); // 显示拼团规则 let _this = this; Dialog({ @@ -511,7 +482,6 @@ Page({ * 返回主页 */ onNavigationHome(e) { - App.saveFormId(e.detail.formId); wx.switchTab({ url: '../../index/index', }) @@ -521,7 +491,6 @@ Page({ * 立即下单 */ onTriggerOrder(e) { - console.log(App.saveFormId(e.detail.formId)) let _this = this; // 设置当前购买类型 _this.setData({ @@ -530,57 +499,6 @@ Page({ _this.onToggleTrade(); }); }, - /** - * 小于10的格式化函数 - */ - timeFormat(param) { - return param < 10 ? '0' + param : param; - }, - - /** - * 倒计时函数 - */ - countDown() { - // 获取当前时间,同时得到活动结束时间数组 - let newTime = new Date().getTime(); - let endTimeList = this.data.actEndTimeList; - let countDownArr = []; - - // 对结束时间进行处理渲染到页面 - endTimeList.forEach(o => { - let endTime = new Date(util.format_date(o)).getTime(); - let obj = null; - // 如果活动未结束,对时间进行处理 - if (endTime - newTime > 0) { - let time = (endTime - newTime) / 1000; - // 获取天、时、分、秒 - let day = parseInt(time / (60 * 60 * 24)); - let hou = parseInt(time % (60 * 60 * 24) / 3600); - let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); - let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); - obj = { - day: day, - hou: this.timeFormat(hou), - min: this.timeFormat(min), - sec: this.timeFormat(sec) - } - } else { - //活动已结束,全部设置为'00' - obj = { - day: '00', - hou: '00', - min: '00', - sec: '00' - } - } - countDownArr.push(obj); - }) - // 渲染,然后每隔一秒执行一次倒计时函数 - this.setData({ - countDownList: countDownArr - }); - setTimeout(this.countDown, 1000); - }, /** * 跳转到拼单页面 diff --git a/pages/sharing/goods/index.json b/pages/sharing/goods/index.json index 2382908..b2f129b 100644 --- a/pages/sharing/goods/index.json +++ b/pages/sharing/goods/index.json @@ -4,6 +4,7 @@ "zan-actionsheet": "/components/actionsheet/index", "zan-popup": "/components/popup/index", "zan-dialog": "/components/dialog/index", - "shortcut": "/components/shortcut/shortcut" + "shortcut": "/components/shortcut/shortcut", + "countdown": "/components/countdown/index" } } \ No newline at end of file diff --git a/pages/sharing/goods/index.wxml b/pages/sharing/goods/index.wxml index 31f57a5..4c2b740 100644 --- a/pages/sharing/goods/index.wxml +++ b/pages/sharing/goods/index.wxml @@ -1,8 +1,10 @@ - + - - + - {{ item.user.nickName }}的团 + {{ item.user.nickName }} - 还差{{ item.people - item.actual_people }}人成团 + + 还差 + {{ item.people - item.actual_people }} + 人成团 + - 剩余{{ countDownList[index].day }}天{{ countDownList[index].hou }}:{{ countDownList[index].min }}:{{ countDownList[index].sec }} + + 剩余 + + + @@ -216,7 +228,9 @@ - + @@ -281,9 +295,12 @@ - + {{ attr.group_name }} - + {{ item.spec_value }} @@ -327,7 +344,9 @@ - + diff --git a/pages/sharing/goods/index.wxss b/pages/sharing/goods/index.wxss index a8452be..0298033 100644 --- a/pages/sharing/goods/index.wxss +++ b/pages/sharing/goods/index.wxss @@ -62,13 +62,13 @@ height: 100%; } -.footer-fixed .fixed-buttons .order-bt { +.footer-fixed .fixed-buttons .order-bt { width: auto; line-height: unset; height: 100%; } -.footer-fixed .fixed-buttons .order-number { +.footer-fixed .fixed-buttons .order-number { height: 100%; } @@ -578,9 +578,15 @@ } .corwd_time_number { - display: block; + display: flex; + align-items: center; + justify-content: center; margin-top: 15rpx; - font-size: 23rpx; + font-size: 22rpx; +} + +.corwd_time_number .prefix { + margin-right: 6rpx; } .corwd_time button { @@ -597,4 +603,4 @@ .corwd_time button:after { content: none; border: none; -} +} \ No newline at end of file diff --git a/pages/sharing/index/index.js b/pages/sharing/index/index.js index 0c75215..80ccdc7 100644 --- a/pages/sharing/index/index.js +++ b/pages/sharing/index/index.js @@ -118,9 +118,6 @@ Page({ rpx = systemInfo.windowWidth / 750, // 计算rpx tapHeight = Math.floor(rpx * 98), // tap高度 scrollHeight = systemInfo.windowHeight - tapHeight; // swiper高度 - console.log( - systemInfo.windowHeight - ); this.setData({ scrollHeight }); diff --git a/pages/sharing/order/detail/detail.js b/pages/sharing/order/detail/detail.js index 8be30c9..1ee8cf8 100644 --- a/pages/sharing/order/detail/detail.js +++ b/pages/sharing/order/detail/detail.js @@ -129,8 +129,6 @@ Page({ */ onSelectPayType(e) { let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); // 隐藏支付方式弹窗 _this.onTogglePayPopup(); if (!_this.data.showPayPopup) { diff --git a/pages/sharing/order/index.js b/pages/sharing/order/index.js index ffd75c9..243e88b 100644 --- a/pages/sharing/order/index.js +++ b/pages/sharing/order/index.js @@ -151,8 +151,6 @@ Page({ */ onSelectPayType(e) { let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); // 隐藏支付方式弹窗 _this.onTogglePayPopup(); if (!_this.data.showPayPopup) { @@ -227,15 +225,12 @@ Page({ wx.navigateTo({ url: './comment/comment?order_id=' + order_id, }) - console.log(order_id); }, /** * 跳转订单详情页 */ navigateToDetail(e) { - // 记录formId - App.saveFormId(e.detail.formId); let order_id = e.detail.target.dataset.id; wx.navigateTo({ url: './detail/detail?order_id=' + order_id @@ -246,8 +241,6 @@ Page({ * 跳转到拼团详情 */ navigateToSharingActive(e) { - // 记录formId - App.saveFormId(e.detail.formId); let active_id = e.detail.target.dataset.id; wx.navigateTo({ url: '../active/index?active_id=' + active_id diff --git a/pages/sharing/order/refund/apply/apply.js b/pages/sharing/order/refund/apply/apply.js index cd62dfd..e185e8e 100644 --- a/pages/sharing/order/refund/apply/apply.js +++ b/pages/sharing/order/refund/apply/apply.js @@ -48,8 +48,6 @@ Page({ * 切换标签 */ onSwitchService: function(e) { - // 记录formId - App.saveFormId(e.detail.formId); this.setData({ serviceType: e.detail.target.dataset.type }); @@ -59,8 +57,6 @@ Page({ * 跳转商品详情 */ onGoodsDetail: function(e) { - // 记录formId - App.saveFormId(e.detail.formId); wx.navigateTo({ url: '../../../goods/index?goods_id=' + e.detail.target.dataset.id }); @@ -73,8 +69,6 @@ Page({ let _this = this, index = e.currentTarget.dataset.index, imageList = _this.data.imageList; - // 记录formId - App.saveFormId(e.detail.formId); // 选择图片 wx.chooseImage({ count: 6 - imageList.length, diff --git a/pages/sharing/order/refund/detail/detail.js b/pages/sharing/order/refund/detail/detail.js index 1240d2c..3fb6806 100644 --- a/pages/sharing/order/refund/detail/detail.js +++ b/pages/sharing/order/refund/detail/detail.js @@ -45,8 +45,6 @@ Page({ * 跳转商品详情 */ onGoodsDetail: function (e) { - // 记录formId - App.saveFormId(e.detail.formId); wx.navigateTo({ url: '../../../goods/index?goods_id=' + e.detail.target.dataset.id }); @@ -82,8 +80,6 @@ Page({ let _this = this, values = e.detail.value; - // 记录formId - App.saveFormId(e.detail.formId); // 判断是否重复提交 if (_this.disable === true) { diff --git a/pages/sharp/goods/index.js b/pages/sharp/goods/index.js index 447b0c3..5300e3e 100644 --- a/pages/sharp/goods/index.js +++ b/pages/sharp/goods/index.js @@ -1,17 +1,9 @@ -const App = getApp(); - -// 富文本插件 import wxParse from '../../../wxParse/wxParse.js'; - -// 工具类 import util from '../../../utils/util.js'; - -// 倒计时插件 -import CountDown from '../../../utils/countdown.js'; - -// 枚举类:秒杀活动商品状态 import ActiveStatusEnum from '../../../utils/enum/sharp/GoodsStatus.js'; +const App = getApp(); + // 记录规格的数组 let goodsSpecArr = []; @@ -61,15 +53,11 @@ Page({ // 返回顶部 showTopWidget: false, - // 倒计时 - countDownObj: { - date: '', - dynamic: {} - }, - active: {}, // 秒杀活动详情 goods: {}, // 商品详情 + countDownTime: false // 倒计时 + }, /** @@ -151,14 +139,7 @@ Page({ const countDownTime = data.active.active_status == ActiveStatusEnum.STATE_SOON.value ? data.active.start_time : data.active.end_time app.setData({ - 'countDownObj.date': countDownTime - }) - // 执行倒计时 - CountDown.start(0, app, 'countDownObj', () => { - // 倒计时结束刷新页面 - setTimeout(() => { - app.onRefreshPage() - }, 800) + countDownTime }) }, @@ -178,6 +159,15 @@ Page({ return data; }, + // 倒计时结束刷新页面 + onCountDownEnd() { + const app = this + console.log('onCountDownEnd') + setTimeout(() => { + app.onRefreshPage() + }, 200) + }, + /** * 点击切换不同规格 */ @@ -186,8 +176,6 @@ Page({ attrIdx = e.currentTarget.dataset.attrIdx, itemIdx = e.currentTarget.dataset.itemIdx, goodsMultiSpec = _this.data.goodsMultiSpec; - // 记录formid - App.saveFormId(e.detail.formId); for (let i in goodsMultiSpec.spec_attr) { for (let j in goodsMultiSpec.spec_attr[i].spec_items) { if (attrIdx == i) { @@ -302,8 +290,6 @@ Page({ */ onClickShare(e) { let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); _this.setData({ 'share.show': true }); @@ -366,8 +352,6 @@ Page({ */ onSavePoster(e) { let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); wx.showLoading({ title: '加载中', }); @@ -415,7 +399,6 @@ Page({ */ onIncGoodsNumber(e) { let _this = this; - App.saveFormId(e.detail.formId); _this.setData({ goods_num: ++_this.data.goods_num }) @@ -426,7 +409,6 @@ Page({ */ onDecGoodsNumber(e) { let _this = this; - App.saveFormId(e.detail.formId); if (_this.data.goods_num > 1) { _this.setData({ goods_num: --_this.data.goods_num @@ -451,12 +433,8 @@ Page({ /** * 确认购买弹窗 */ - onToggleTrade(e) { + onToggleTrade() { let _this = this; - if (typeof e === 'object') { - // 记录formId - e.detail.hasOwnProperty('formId') && App.saveFormId(e.detail.formId); - } _this.setData({ showBottomPopup: !_this.data.showBottomPopup }); @@ -467,8 +445,6 @@ Page({ */ onCheckout(e) { let _this = this; - // 记录formId - App.saveFormId(e.detail.formId); // 表单验证 if (!_this._onVerify()) { return false; @@ -514,8 +490,6 @@ Page({ * 跳转到首页 */ onTargetHome(e) { - // 记录formid - App.saveFormId(e.detail.formId); wx.switchTab({ url: '../../index/index', }) diff --git a/pages/sharp/goods/index.json b/pages/sharp/goods/index.json index 18b13cb..1e5fbe3 100644 --- a/pages/sharp/goods/index.json +++ b/pages/sharp/goods/index.json @@ -3,6 +3,7 @@ "usingComponents": { "zan-actionsheet": "/components/actionsheet/index", "zan-popup": "/components/popup/index", - "shortcut": "/components/shortcut/shortcut" + "shortcut": "/components/shortcut/shortcut", + "countdown": "/components/countdown/index" } } \ No newline at end of file diff --git a/pages/sharp/goods/index.wxml b/pages/sharp/goods/index.wxml index 5efce9a..f182e27 100644 --- a/pages/sharp/goods/index.wxml +++ b/pages/sharp/goods/index.wxml @@ -62,10 +62,11 @@ + class="info-item info-item_status info-item_countdown dis-flex flex-y-center"> 距离秒杀{{ active.active_status == ActiveStatusEnum.STATE_SOON.value ? '开始' : '结束' }} - 还剩{{ countDownObj.dynamic.hou }}时{{ countDownObj.dynamic.min }}分{{ countDownObj.dynamic.sec }}秒 + 还剩 + diff --git a/pages/sharp/index/index.js b/pages/sharp/index/index.js index fc77c52..3352239 100644 --- a/pages/sharp/index/index.js +++ b/pages/sharp/index/index.js @@ -1,14 +1,8 @@ -const App = getApp(); - -// 工具类 import util from '../../../utils/util.js'; - -// 倒计时插件 -import CountDown from '../../../utils/countdown.js'; - -// 枚举类:秒杀会场活动状态 import StateEnum from '../../../utils/enum/sharp/ActiveStatus.js'; +const App = getApp() + Page({ /** @@ -25,11 +19,7 @@ Page({ StateEnum, // 枚举类:秒杀会场活动状态 - // 倒计时 - countDownObj: { - date: '', - dynamic: {} - }, + countDownTime: false, // 倒计时日期 // 秒杀活动场次 tabbar: [], @@ -99,24 +89,25 @@ Page({ /** * 初始化倒计时组件 - * mix: 怎么才能每次执行这里的时候不重复触发定时器 */ - _initCountDownData(countId = 0) { + _initCountDownData() { const app = this, curTabbar = app.data.tabbar[app.data.curTabIndex]; // 记录倒计时的时间 app.setData({ - 'countDownObj.date': curTabbar.count_down_time - }) - // 执行倒计时 - CountDown.start(countId, app, 'countDownObj', () => { - // 倒计时结束刷新页面 - setTimeout(() => { - app.onRefreshPage() - }, 800) + countDownTime: curTabbar.count_down_time }) }, + // 倒计时结束刷新页面 + onCountDownEnd() { + console.log('onCountDownEnd') + const app = this + setTimeout(() => { + app.onRefreshPage() + }, 200) + }, + /** * 切换tabbar */ @@ -134,7 +125,7 @@ Page({ // 获取列表数据 _this.getGoodsList(); // 初始化倒计时组件 - _this._initCountDownData(curTabIndex); + _this._initCountDownData(); }, /** diff --git a/pages/sharp/index/index.json b/pages/sharp/index/index.json index b1ebaa0..3916183 100644 --- a/pages/sharp/index/index.json +++ b/pages/sharp/index/index.json @@ -1,4 +1,7 @@ { "navigationBarTitleText": "整点秒杀", - "enablePullDownRefresh": true + "enablePullDownRefresh": true, + "usingComponents": { + "countdown": "/components/countdown/index" + } } \ No newline at end of file diff --git a/pages/sharp/index/index.wxml b/pages/sharp/index/index.wxml index 070e825..1360e41 100644 --- a/pages/sharp/index/index.wxml +++ b/pages/sharp/index/index.wxml @@ -29,26 +29,8 @@ - - {{ tabbar[curTabIndex].status == StateEnum.ACTIVE_STATE_BEGIN.value ? '距结束' : '距开始' }} - - - - {{ countDownObj.dynamic.hou }} - - - : - - - {{ countDownObj.dynamic.min }} - - - : - - - {{ countDownObj.dynamic.sec }} - - + {{ tabbar[curTabIndex].status == StateEnum.ACTIVE_STATE_BEGIN.value ? '距结束' : '距开始' }} + diff --git a/pages/sharp/index/index.wxss b/pages/sharp/index/index.wxss index 1f08f47..cec36e6 100644 --- a/pages/sharp/index/index.wxss +++ b/pages/sharp/index/index.wxss @@ -77,7 +77,7 @@ page, .container { .sharp-active .active-status { font-size: 32rpx; color: #fd4a5f; - margin-bottom: 15rpx; + margin-bottom: 20rpx; } .sharp-active .active-status .active-status--icon { @@ -95,22 +95,6 @@ page, .container { height: 40rpx; } -.active--count-down .clock-text { - margin-right: 10rpx; -} - -.active--count-down .clock-time { - background: #252525; - color: #fff; - padding: 0 8rpx; - line-height: 40rpx; - border-radius: 8rpx; -} - -.active--count-down .clock-symbol { - padding: 0 8rpx; -} - /* 商品列表 */ .bargain-hall { diff --git a/pages/user/index.js b/pages/user/index.js index 4bfa4f9..c2ddd3f 100644 --- a/pages/user/index.js +++ b/pages/user/index.js @@ -50,8 +50,6 @@ Page({ if (!_this.onCheckLogin()) { return false; } - // 记录formid - App.saveFormId(e.detail.formId); let urls = { all: '/pages/order/index?type=all', payment: '/pages/order/index?type=payment', @@ -72,8 +70,6 @@ Page({ if (!_this.onCheckLogin()) { return false; } - // 记录formId - App.saveFormId(e.detail.formId); wx.navigateTo({ url: '/' + e.currentTarget.dataset.url }) @@ -87,8 +83,6 @@ Page({ if (!_this.onCheckLogin()) { return false; } - // 记录formId - App.saveFormId(e.detail.formId); wx.navigateTo({ url: './wallet/index' }) @@ -102,8 +96,6 @@ Page({ if (!_this.onCheckLogin()) { return false; } - // 记录formId - App.saveFormId(e.detail.formId); wx.navigateTo({ url: '../points/log/index' }); diff --git a/pages/user/recharge/index.js b/pages/user/recharge/index.js index 4a91cf0..6b54743 100644 --- a/pages/user/recharge/index.js +++ b/pages/user/recharge/index.js @@ -73,8 +73,6 @@ Page({ onSubmit(e) { let _this = this; - // 记录formid - App.saveFormId(e.detail.formId); // 按钮禁用 _this.setData({ diff --git a/pages/user/wallet/index.js b/pages/user/wallet/index.js index 1a33d83..4c152b5 100644 --- a/pages/user/wallet/index.js +++ b/pages/user/wallet/index.js @@ -39,8 +39,6 @@ Page({ * 跳转充值页面 */ onTargetRecharge(e) { - // 记录formId - App.saveFormId(e.detail.formId); wx.navigateTo({ url: '../recharge/index' }) @@ -50,8 +48,6 @@ Page({ * 跳转充值记录页面 */ onTargetRechargeOrder(e) { - // 记录formId - App.saveFormId(e.detail.formId); wx.navigateTo({ url: '../recharge/order/index' }) @@ -61,8 +57,6 @@ Page({ * 跳转账单详情页面 */ onTargetBalanceLog(e) { - // 记录formId - App.saveFormId(e.detail.formId); wx.navigateTo({ url: '../wallet/balance/log' }) diff --git a/utils/common.wxss b/utils/common.wxss index 2ee3d37..0341fc5 100644 --- a/utils/common.wxss +++ b/utils/common.wxss @@ -1,15 +1,16 @@ /* iconfont */ @import "/utils/iconfont.wxss"; -.container, input { +.container, +input { font-family: PingFang-Medium, - PingFangSC-Regular, - Heiti, - Heiti SC, - DroidSans, - DroidSansFallback, - "Microsoft YaHei", - sans-serif; + PingFangSC-Regular, + Heiti, + Heiti SC, + DroidSans, + DroidSansFallback, + "Microsoft YaHei", + sans-serif; -webkit-font-smoothing: antialiased; } @@ -279,6 +280,10 @@ margin-left: 20rpx; } +.m-r-10 { + margin-right: 10rpx; +} + .p-bottom { padding-bottom: 112rpx; } @@ -362,4 +367,4 @@ button:after { content: none; border: none; -} +} \ No newline at end of file diff --git a/version.json b/version.json index 167fdc0..9bf077f 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "1.1.45" + "version": "1.1.46" }