This commit is contained in:
周中平 2021-07-16 16:37:55 +08:00
parent 53ddca24ab
commit ff91440436
63 changed files with 460 additions and 611 deletions

26
app.js
View File

@ -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
}
});

View File

@ -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
}
}
})

View File

@ -0,0 +1,3 @@
{
"component": true
}

View File

@ -0,0 +1,15 @@
<view wx:if="{{ date }}" class="count-down">
<!-- <slot wx:if="{{ useSlot }}" /> -->
<view class="{{ style }}-style separator-{{ separator }}">
<block wx:if="{{ dynamic.day != '00' }}">
<text class="dynamic-value">{{ dynamic.day }}</text>
<text class="separator">{{ separatorText.day }}</text>
</block>
<text class="dynamic-value">{{ dynamic.hou }}</text>
<text class="separator">{{ separatorText.hou }}</text>
<text class="dynamic-value">{{ dynamic.min }}</text>
<text class="separator">{{ separatorText.min }}</text>
<text class="dynamic-value">{{ dynamic.sec }}</text>
<text class="separator">{{ separatorText.sec }}</text>
</view>
</view>

View File

@ -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;
}

View File

@ -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}`,
});

View File

@ -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,
});

View File

@ -24,8 +24,6 @@ Component({
* 跳转到搜索页面
*/
onTargetSearch(e) {
// 记录formid
App.saveFormId(e.detail.formId);
App.navigationTo('pages/search/index');
},
}

View File

@ -26,8 +26,6 @@ Component({
* 点击拨打电话
*/
_onServiceEvent(e) {
// 记录formid
App.saveFormId(e.detail.formId);
// 拨打电话
wx.makePhoneCall({
phoneNumber: this.data.params.phone_num

View File

@ -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,
});

View File

@ -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
})
}
}
})

View File

@ -1,3 +1,6 @@
{
"component": true
"component": true,
"usingComponents": {
"countdown": "/components/countdown/index"
}
}

View File

@ -11,23 +11,7 @@
</view>
<!-- 倒计时 -->
<view wx:if="{{ data.active.status == ActiveStatusEnum.STATE_BEGIN.value }}" class="active-count-down">
<view class="clock dis-flex">
<view class="clock-time">
<text>{{ countDownList[0].dynamic.hou }}</text>
</view>
<view class="clock-symbol">
<text>:</text>
</view>
<view class="clock-time">
<text>{{ countDownList[0].dynamic.min }}</text>
</view>
<view class="clock-symbol">
<text>:</text>
</view>
<view class="clock-time">
<text>{{ countDownList[0].dynamic.sec }}</text>
</view>
</view>
<countdown wx:if="{{ countDownTime }}" date="{{ countDownTime }}" style="custom" />
</view>
</view>
<view class="sharp-top--right">
@ -63,8 +47,10 @@
</view>
<!-- 商品价格 -->
<view class="detail-price onelist-hidden">
<text wx:if="{{ itemStyle.show.seckillPrice }}" class="goods-price f-30 col-m">¥{{ dataItem.goods_sku.seckill_price }}</text>
<text wx:if="{{ itemStyle.show.originalPrice && dataItem.goods_sku.original_price > 0 }}" class="line-price col-9 f-24">¥{{ dataItem.goods_sku.original_price }}</text>
<text wx:if="{{ itemStyle.show.seckillPrice }}"
class="goods-price f-30 col-m">¥{{ dataItem.goods_sku.seckill_price }}</text>
<text wx:if="{{ itemStyle.show.originalPrice && dataItem.goods_sku.original_price > 0 }}"
class="line-price col-9 f-24">¥{{ dataItem.goods_sku.original_price }}</text>
</view>
</view>
</block>

View File

@ -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,
});

View File

@ -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
});

View File

@ -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]
});

View File

@ -32,8 +32,6 @@ Page({
values = e.detail.value
values.region = this.data.region;
// 记录formId
App.saveFormId(e.detail.formId);
// 表单验证
if (!_this.validation(values)) {

View File

@ -42,8 +42,6 @@ Page({
values = e.detail.value
values.region = this.data.region;
// 记录formId
App.saveFormId(e.detail.formId);
// 表单验证
if (!_this.validation(values)) {

View File

@ -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
});

View File

@ -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',
})

View File

@ -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"
}
}

View File

@ -8,7 +8,8 @@
<!-- 商品图片 -->
<view class="goods-swiper">
<swiper autoplay="{{ autoplay }}" bindchange="setCurrent" class="banner-box swiper-box" duration="{{duration}}" indicator-dots="{{indicatorDots}}" interval="{{interval}}" circular="{{true}}">
<swiper autoplay="{{ autoplay }}" bindchange="setCurrent" class="banner-box swiper-box" duration="{{duration}}"
indicator-dots="{{indicatorDots}}" interval="{{interval}}" circular="{{true}}">
<swiper-item wx:for="{{ goods.image }}" wx:key="this" catchtap="onPreviewImages" data-index="{{ index }}">
<image class="slide-image" mode="aspectFill" src="{{ item.file_path }}"></image>
</swiper-item>
@ -47,7 +48,7 @@
</view>
<view class="goods-share__line"></view>
<view class="goods-share">
<form bindsubmit="onClickShare" report-submit="true">
<form bindsubmit="onClickShare">
<button formType="submit" class="share-btn dis-flex flex-dir-column">
<text class="share__icon iconfont icon-fenxiang"></text>
<text class="f-24">分享</text>
@ -60,11 +61,11 @@
<text>{{ goods.selling_point }}</text>
</view>
<!-- 活动倒计时 -->
<view wx:if="{{ !active.is_end }}" class="info-item info-item_status info-item_countdown">
<view wx:if="{{ !active.is_end }}" class="info-item info-item_status info-item_countdown dis-flex flex-y-center">
<text class="countdown-icon iconfont icon-naozhong"></text>
<block wx:for="{{ actEndTimeList }}" wx:key="this">
<text>距离活动结束 还剩{{ item.dynamic.hou }}时{{ item.dynamic.min }}分{{ item.dynamic.sec }}秒</text>
</block>
<text>距离活动结束</text>
<text class="m-r-10">还剩</text>
<countdown wx:if="{{ countDownTime }}" date="{{ countDownTime }}" />
</view>
<!-- 活动已结束 -->
<view wx:if="{{ active.is_end }}" class="info-item info-item_status info-item_end">
@ -75,7 +76,7 @@
<!-- 选择商品规格 -->
<!-- <view class="goods-choice m-top20 b-f">
<form wx:if="{{ goods.spec_type == 20 }}" bindsubmit="onToggleTrade" report-submit>
<form wx:if="{{ goods.spec_type == 20 }}" bindsubmit="onToggleTrade">
<button class="btn-normal" formType="submit">
<view class="sku-selector dis-flex flex-y-center">
<view class="flex-box f-28">
@ -92,7 +93,7 @@
<!-- 砍价玩法 -->
<view class="bargain-rules top-nav-bar m-top20 b-f">
<form bindsubmit="onToggleRules" report-submit="true">
<form bindsubmit="onToggleRules">
<button formType="submit" class="btn-normal">
<view class="item-title dis-flex">
@ -198,7 +199,7 @@
<view class="footer-container dis-flex">
<!-- 导航图标 -->
<view class="foo-item-fast dis-flex flex-x-center flex-y-center">
<form bindsubmit="onTargetHome" report-submit>
<form bindsubmit="onTargetHome">
<button class="btn-normal" formType="submit">
<view class="fast-item fast-item_home">
<view class="fast-icon">
@ -223,7 +224,7 @@
</view>
<!-- 操作按钮 -->
<view class="foo-item-trigger flex-box">
<form bindsubmit="onSubmit" report-submit>
<form bindsubmit="onSubmit">
<button wx:if="{{ active.is_start && !active.is_end }}" class="opt-btn btn-main btn-normal" formType="submit">
<text>{{ is_partake ? '继续砍价' : '立即砍价' }}</text>
</button>
@ -236,7 +237,9 @@
</view>
<!-- 分享按钮 -->
<zan-actionsheet show="{{ share.show }}" actions="{{ share.actions }}" cancel-text="{{ share.cancelText }}" cancel-with-mask="{{ share.cancelWithMask }}" bind:cancel="onCloseShare" bind:actionclick="onClickShareItem" mask-class="tiny" />
<zan-actionsheet show="{{ share.show }}" actions="{{ share.actions }}" cancel-text="{{ share.cancelText }}"
cancel-with-mask="{{ share.cancelWithMask }}" bind:cancel="onCloseShare" bind:actionclick="onClickShareItem"
mask-class="tiny" />
<!-- 商品海报 弹出层 -->
<zan-popup show="{{ share.showPopup }}" bindclose="onTogglePopup">
@ -245,7 +248,7 @@
<view class="pop-close dis-flex flex-x-center flex-y-center" catchtap="onTogglePopup">
<text class="iconfont icon-shanchu f-30 col-9"></text>
</view>
<form bindsubmit="onSavePoster" report-submit="true">
<form bindsubmit="onSavePoster">
<view class="poster__image">
<image mode="widthFix" src="{{ qrcode }}"></image>
</view>
@ -293,9 +296,12 @@
<view class="goods-attr">
<!-- 滚动容器 -->
<scroll-view class="goods-attr--scroll" scroll-y="{{ true }}">
<view class="group-item" wx:for="{{ goodsMultiSpec.spec_attr }}" wx:for-item="attr" wx:for-index="attr_idx" wx:key="this">
<view class="group-item" wx:for="{{ goodsMultiSpec.spec_attr }}" wx:for-item="attr" wx:for-index="attr_idx"
wx:key="this">
<view class="tips-text" data-id="{{ attr.group_id }}">{{ attr.group_name }}</view>
<view class="spec-item {{ item.checked ? 'cur' : '' }}" wx:for="{{ attr.spec_items }}" wx:for-index="item_idx" wx:key="this" data-attr-idx="{{ attr_idx }}" data-item-idx="{{ item_idx }}" catchtap="onSwitchSpec">
<view class="spec-item {{ item.checked ? 'cur' : '' }}" wx:for="{{ attr.spec_items }}"
wx:for-index="item_idx" wx:key="this" data-attr-idx="{{ attr_idx }}" data-item-idx="{{ item_idx }}"
catchtap="onSwitchSpec">
{{ item.spec_value }}
</view>
</view>
@ -308,11 +314,11 @@
<text>购买数量</text>
</view>
<view class="select-number">
<form bindsubmit="onDecGoodsNumber" report-submit="true">
<form bindsubmit="onDecGoodsNumber">
<button formType="submit" class="default {{ goods_num > 1 ? '' : 'disabled' }}" type="default">-</button>
</form>
<input bindinput="onInputGoodsNum" type="number" value="{{ goods_num }}"></input>
<form bindsubmit="onIncGoodsNumber" report-submit="true">
<form bindsubmit="onIncGoodsNumber">
<button formType="submit" class="default" type="default">+</button>
</form>
</view>
@ -322,7 +328,7 @@
<!-- 底部操作栏 -->
<view class="footer-fixed f-30">
<view wx:if="{{ stock_num > 0 }}" class="flex-box">
<form bindsubmit="onSubmit2" report-submit>
<form bindsubmit="onSubmit2">
<button class="opt-btn btn-main btn-normal" formType="submit">
<text>确定</text>
</button>

View File

@ -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}`,
})

View File

@ -1,6 +1,7 @@
{
"navigationBarTitleText": "砍价专区",
"usingComponents": {
"diy-banner": "/components/diy/banner/banner"
"diy-banner": "/components/diy/banner/banner",
"countdown": "/components/countdown/index"
}
}

View File

@ -1,7 +1,8 @@
<view class="container">
<!-- 内容区域 -->
<scroll-view class="container--scroll-view" bindscrolltolower="onScrollToLower" scroll-y="{{ true }}" bindscroll="onScrollEvent" style="height: {{ scrollHeight }}px;">
<scroll-view class="container--scroll-view" bindscrolltolower="onScrollToLower" scroll-y="{{ true }}"
bindscroll="onScrollEvent" style="height: {{ scrollHeight }}px;">
<!-- 砍价会场 -->
<block wx:if="{{ currentTab == 0 }}">
@ -104,26 +105,8 @@
<view class="task-status dis-flex flex-y-center">
<!-- 倒计时 -->
<view wx:if="{{ item.status }}" class="count-down dis-flex flex-y-center">
<view class="clock-text">
<text>剩余</text>
</view>
<view class="clock dis-flex">
<view class="clock-time">
<text>{{ countDownList[index].dynamic.hou }}</text>
</view>
<view class="clock-symbol">
<text>:</text>
</view>
<view class="clock-time">
<text>{{ countDownList[index].dynamic.min }}</text>
</view>
<view class="clock-symbol">
<text>:</text>
</view>
<view class="clock-time">
<text>{{ countDownList[index].dynamic.sec }}</text>
</view>
</view>
<text class="m-r-10">剩余</text>
<countdown date="{{ item.end_time }}" separator="colon" style="custom" />
</view>
<view wx:if="{{ !item.status }}" class="task-status__text">
<text class="col-m">{{ item.is_buy ? '砍价成功' : '已结束' }}</text>

View File

@ -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({

View File

@ -1,6 +1,7 @@
{
"navigationBarTitleText": "砍价任务",
"usingComponents": {
"zan-dialog": "/components/dialog/index"
"zan-dialog": "/components/dialog/index",
"countdown": "/components/countdown/index"
}
}

View File

@ -135,8 +135,10 @@
</view>
<!-- 到期时间 -->
<view class="bargain-p" wx:if="{{ task.status }}">
<view class="bargain-people" wx:for="{{ taskEndTime }}" wx:key="this">
<text>活动还剩 {{ item.dynamic.hou }} : {{ item.dynamic.min }} : {{ item.dynamic.sec }} 结束,快来砍价吧~</text>
<view class="bargain-people dis-flex flex-x-center flex-y-center">
<text>活动还剩</text>
<countdown wx:if="{{ countDownTime }}" date="{{ countDownTime }}" />
<text>结束,快来砍价吧~</text>
</view>
</view>
</view>

View File

@ -57,8 +57,6 @@ Page({
* 立即加入分销商
*/
triggerApply(e) {
// 记录formId
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: '../apply/apply',
})

View File

@ -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({

View File

@ -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
});

View File

@ -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('用户拒绝了授权')
}
})
},
/**
* 暂不登录
*/

View File

@ -7,7 +7,10 @@
<view class="auth-title">申请获取以下权限</view>
<view class="auth-subtitle">获得你的公开信息(昵称、头像等)</view>
<view class="login-btn">
<button class="btn-normal" openType="getUserInfo" lang="zh_CN" bindgetuserinfo="getUserInfo">授权登录</button>
<!-- 旧版微信登录(弃用) -->
<!-- <button class="btn-normal" openType="getUserInfo" lang="zh_CN" bindgetuserinfo="getUserInfo">授权登录</button> -->
<!-- 新版微信登录 -->
<button class="btn-normal" catchtap="getUserProfile">授权登录</button>
</view>
<view class="no-login-btn">
<button class="btn-normal" catchtap="onNotLogin">暂不登录</button>

View File

@ -130,8 +130,6 @@ Page({
*/
onSelectPayType(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
// 隐藏支付方式弹窗
_this.onTogglePayPopup();
if (!_this.data.showPayPopup) {

View File

@ -150,8 +150,6 @@ Page({
*/
onSelectPayType(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
// 隐藏支付方式弹窗
_this.onTogglePayPopup();
if (!_this.data.showPayPopup) {
@ -223,7 +221,6 @@ Page({
wx.navigateTo({
url: './comment/comment?order_id=' + order_id,
})
console.log(order_id);
},
/**

View File

@ -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,

View File

@ -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) {

View File

@ -1,10 +1,9 @@
const App = getApp();
const Sharing = require('../../../utils/extend/sharing.js');
const Dialog = require('../../../components/dialog/dialog');
// 工具类
const util = require('../../../utils/util.js');
const App = getApp()
// 记录规格的数组
let goodsSpecArr = [];
@ -24,8 +23,6 @@ Page({
goods_sku_id: 0, // 规格id
goodsMultiSpec: {}, // 多规格信息
countDownList: [],
actEndTimeList: []
},
/**
@ -95,8 +92,6 @@ Page({
console.log(data['is_join']);
// 当前用户是否为创建者
data['is_creator'] = !!(data.detail.creator_id == App.getUserId())
// 拼团结束时间
data['actEndTimeList'] = [data.detail.end_time.text];
// 商品价格/划线价/库存
data.goods_sku_id = goodsDetail.goods_sku.spec_sku_id;
@ -116,8 +111,6 @@ Page({
}
// 赋值页面数据
_this.setData(data);
// 执行倒计时函数
_this.onCountDown();
},
/**
@ -145,8 +138,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) {
@ -225,51 +216,6 @@ Page({
return param < 10 ? '0' + param : param;
},
/**
* 倒计时函数
*/
onCountDown() {
// 获取当前时间,同时得到活动结束时间数组
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.onCountDown, 1000);
},
/**
* 查看拼团规则
*/
@ -311,7 +257,6 @@ Page({
*/
onIncGoodsNumber(e) {
let _this = this;
App.saveFormId(e.detail.formId);
_this.setData({
goods_num: ++_this.data.goods_num
})
@ -322,7 +267,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

View File

@ -3,6 +3,7 @@
"usingComponents": {
"zan-dialog": "/components/dialog/index",
"zan-popup": "/components/popup/index",
"shortcut": "/components/shortcut/shortcut"
"shortcut": "/components/shortcut/shortcut",
"countdown": "/components/countdown/index"
}
}

View File

@ -44,22 +44,19 @@
</view>
</view>
<!-- 虚位以待 -->
<view wx:for="{{ detail.surplus_people }}" wx:key="this" class="user-item user-item__wait dis-flex flex-x-center flex-y-center">
<view wx:for="{{ detail.surplus_people }}" wx:key="this"
class="user-item user-item__wait dis-flex flex-x-center flex-y-center">
<text class="iconfont icon-wenhao"></text>
</view>
</view>
<!-- 拼单状态:拼团中 -->
<view wx:if="{{ detail.status.value == 10 }}" class="main_status main_tiem">
<view wx:if="{{ detail.status.value == 10 }}" class="main_tiem">
<text>还差 </text>
<text class="main_timer_color">{{ detail.surplus_people }}</text>
<text> 个名额,</text>
<view class="tui-countdown-content" wx:for="{{countDownList}}" wx:key="countDownList">
<!-- <text class="tui-conutdown-box">{{item.day}}</text>: -->
<text class="tui-conutdown-box">{{item.hou}}</text> :
<text class="tui-conutdown-box">{{item.min}}</text> :
<text class="tui-conutdown-box tui-countdown-bg">{{item.sec}}</text>
</view>
<!-- 倒计时 -->
<countdown date="{{ detail.end_time.text }}" separator="colon" style="text" />
<text> 后结束</text>
</view>
@ -84,7 +81,8 @@
<text class="f-30">更多拼团</text>
<text class="icon-arrow"></text>
</view>
<view wx:for="{{ goodsList.data }}" wx:key="key" class="content_main dis-flex" catchtap="onTargetGoods" data-id="{{ item.goods_id }}">
<view wx:for="{{ goodsList.data }}" wx:key="key" class="content_main dis-flex" catchtap="onTargetGoods"
data-id="{{ item.goods_id }}">
<view class="goods-image">
<image src="{{ item.goods_image }}"></image>
</view>
@ -139,18 +137,21 @@
</view>
<!-- 规格列表 -->
<view class="goods-list-box" scroll-y="true">
<view class="cf tmall-types" wx:for="{{ goodsMultiSpec.spec_attr }}" wx:for-item="attr" wx:for-index="attr_idx" wx:key="key">
<view class="cf tmall-types" wx:for="{{ goodsMultiSpec.spec_attr }}" wx:for-item="attr" wx:for-index="attr_idx"
wx:key="key">
<view class="tipstxt" data-id="{{attr.group_id}}">{{attr.group_name}}</view>
<view class="cf cartypelist" wx:for="{{attr.spec_items}}" wx:for-index="item_idx" wx:key="ikey">
<view wx:if="{{item.checked}}">
<form bindsubmit="onSwitchSpec" report-submit="true" data-attr-idx="{{attr_idx}}" data-item-idx="{{item_idx}}">
<form bindsubmit="onSwitchSpec" report-submit="true" data-attr-idx="{{attr_idx}}"
data-item-idx="{{item_idx}}">
<button formType="submit" class="btn-normal">
<view class="cartypeitem cur">{{item.spec_value}}</view>
</button>
</form>
</view>
<view wx:else>
<form bindsubmit="onSwitchSpec" report-submit="true" data-attr-idx="{{attr_idx}}" data-item-idx="{{item_idx}}">
<form bindsubmit="onSwitchSpec" report-submit="true" data-attr-idx="{{attr_idx}}"
data-item-idx="{{item_idx}}">
<button formType="submit" class="btn-normal">
<view class="cartypeitem">{{item.spec_value}}</view>
</button>

View File

@ -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;

View File

@ -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({

View File

@ -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);
},
/**
* 跳转到拼单页面

View File

@ -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"
}
}

View File

@ -1,8 +1,10 @@
<import src="../../../wxParse/wxParse.wxml"></import>
<scroll-view bindscroll="scroll" scroll-top="{{scrollTop}}" scroll-y="true" style="position:absolute; top:0; left:0; right:0; bottom:0;">
<scroll-view bindscroll="scroll" scroll-top="{{scrollTop}}" scroll-y="true"
style="position:absolute; top:0; left:0; right:0; bottom:0;">
<view class="container" wx:if="{{detail.goods_id}}">
<view class="swiper">
<swiper autoplay="{{autoplay}}" bindchange="setCurrent" class="banner-box swiper-box" duration="{{duration}}" indicator-dots="{{indicatorDots}}" interval="{{interval}}" circular="{{true}}">
<swiper autoplay="{{autoplay}}" bindchange="setCurrent" class="banner-box swiper-box" duration="{{duration}}"
indicator-dots="{{indicatorDots}}" interval="{{interval}}" circular="{{true}}">
<swiper-item wx:for="{{detail.image}}" wx:key="this" catchtap="onPreviewImages" data-index="{{ index }}">
<image class="slide-image" mode="aspectFill" src="{{item.file_path}}"></image>
</swiper-item>
@ -121,21 +123,31 @@
<!-- <text class="col-9">更多团购 <text class="iconfont icon-xiangyoujiantou"></text> </text> -->
</view>
<!-- 进行中的团购-内容部分 -->
<view class="corwd" wx:for="{{ activeList }}" wx:key="this" catchtap="onTargetActive" data-id="{{ item.active_id }}">
<view class="corwd" wx:for="{{ activeList }}" wx:key="this" catchtap="onTargetActive"
data-id="{{ item.active_id }}">
<view class="corwd_people">
<!-- 进行中的团购-头像 -->
<view class="">
<image src="{{ item.user.avatarUrl }}" class="corwd_people_images"></image>
</view>
<!-- 进行中的团购-名称 -->
<text class="onelist-hidden">{{ item.user.nickName }}的团</text>
<text class="onelist-hidden">{{ item.user.nickName }}</text>
</view>
<view class="corwd_time">
<view class="corwd_time_text">
<!-- 进行中的团购-开团人数 -->
<text class="corwd_time_title onelist-hidden">还差<text>{{ item.people - item.actual_people }}</text>人成团</text>
<view class="corwd_time_title onelist-hidden">
<text>还差</text>
<text>{{ item.people - item.actual_people }}</text>
<text>人成团</text>
</view>
<!-- 进行中的团购-倒计时 -->
<text class="corwd_time_number col-9 onelist-hidden">剩余{{ countDownList[index].day }}天{{ countDownList[index].hou }}:{{ countDownList[index].min }}:{{ countDownList[index].sec }}</text>
<view class="corwd_time_number col-9 onelist-hidden">
<text class="prefix">剩余</text>
<countdown date="{{ item.end_time.text }}" separator="colon" style="text" />
</view>
<!-- <text
class="corwd_time_number col-9 onelist-hidden">剩余{{ countDownList[index].day }}天{{ countDownList[index].hou }}:{{ countDownList[index].min }}:{{ countDownList[index].sec }}</text> -->
</view>
<!-- 进行中的团购-按钮 -->
<button>去参团</button>
@ -216,7 +228,9 @@
</form>
<!-- 在线客服 -->
<view class="goods-fixed-icon dis-flex flex-x-center flex-y-center">
<button open-type="contact" sessionFrom="weapp" size="27" style="opacity: 0;position:absolute;top:0px;left:0px;display:block;width:100%;height:100%;" type="default-light"></button>
<button open-type="contact" sessionFrom="weapp" size="27"
style="opacity: 0;position:absolute;top:0px;left:0px;display:block;width:100%;height:100%;"
type="default-light"></button>
<text class="iconfont icon-kefu"></text>
</view>
<!-- 购买按钮 -->
@ -281,9 +295,12 @@
<view class="goods-attr">
<!-- 滚动容器 -->
<scroll-view class="goods-attr--scroll" scroll-y="{{ true }}">
<view class="group-item" wx:for="{{ goodsMultiSpec.spec_attr }}" wx:for-item="attr" wx:for-index="attr_idx" wx:key="this">
<view class="group-item" wx:for="{{ goodsMultiSpec.spec_attr }}" wx:for-item="attr" wx:for-index="attr_idx"
wx:key="this">
<view class="tips-text" data-id="{{ attr.group_id }}">{{ attr.group_name }}</view>
<view class="spec-item {{ item.checked ? 'cur' : '' }}" wx:for="{{ attr.spec_items }}" wx:for-index="item_idx" wx:key="this" data-attr-idx="{{ attr_idx }}" data-item-idx="{{ item_idx }}" catchtap="onSwitchSpec">
<view class="spec-item {{ item.checked ? 'cur' : '' }}" wx:for="{{ attr.spec_items }}"
wx:for-index="item_idx" wx:key="this" data-attr-idx="{{ attr_idx }}" data-item-idx="{{ item_idx }}"
catchtap="onSwitchSpec">
{{ item.spec_value }}
</view>
</view>
@ -327,7 +344,9 @@
</view>
<!-- 分享按钮 -->
<zan-actionsheet show="{{ share.show }}" actions="{{ share.actions }}" cancel-text="{{ share.cancelText }}" cancel-with-mask="{{ share.cancelWithMask }}" bind:cancel="onCloseShare" bind:actionclick="onClickShareItem" mask-class="tiny" />
<zan-actionsheet show="{{ share.show }}" actions="{{ share.actions }}" cancel-text="{{ share.cancelText }}"
cancel-with-mask="{{ share.cancelWithMask }}" bind:cancel="onCloseShare" bind:actionclick="onClickShareItem"
mask-class="tiny" />
<!-- 商品海报 弹出层 -->
<zan-popup show="{{ share.showPopup }}" bindclose="onTogglePopup">

View File

@ -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 {

View File

@ -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
});

View File

@ -129,8 +129,6 @@ Page({
*/
onSelectPayType(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
// 隐藏支付方式弹窗
_this.onTogglePayPopup();
if (!_this.data.showPayPopup) {

View File

@ -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

View File

@ -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,

View File

@ -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) {

View File

@ -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',
})

View File

@ -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"
}
}

View File

@ -62,10 +62,11 @@
</view>
<!-- 活动倒计时 -->
<view wx:if="{{ active.active_status != ActiveStatusEnum.STATE_END.value }}"
class="info-item info-item_status info-item_countdown">
class="info-item info-item_status info-item_countdown dis-flex flex-y-center">
<text class="countdown-icon iconfont icon-naozhong"></text>
<text>距离秒杀{{ active.active_status == ActiveStatusEnum.STATE_SOON.value ? '开始' : '结束' }}</text>
<text>还剩{{ countDownObj.dynamic.hou }}时{{ countDownObj.dynamic.min }}分{{ countDownObj.dynamic.sec }}秒</text>
<text class="m-r-10">还剩</text>
<countdown wx:if="{{ countDownTime }}" date="{{ countDownTime }}" bind:finish="onCountDownEnd" />
</view>
<!-- 活动已结束 -->
<view wx:else class="info-item info-item_status info-item_end">

View File

@ -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();
},
/**

View File

@ -1,4 +1,7 @@
{
"navigationBarTitleText": "整点秒杀",
"enablePullDownRefresh": true
"enablePullDownRefresh": true,
"usingComponents": {
"countdown": "/components/countdown/index"
}
}

View File

@ -29,26 +29,8 @@
</view>
<!-- 倒计时 -->
<view class="active--count-down dis-flex flex-y-center">
<view class="clock-text">
<text>{{ tabbar[curTabIndex].status == StateEnum.ACTIVE_STATE_BEGIN.value ? '距结束' : '距开始' }}</text>
</view>
<view class="clock dis-flex">
<view class="clock-time">
<text>{{ countDownObj.dynamic.hou }}</text>
</view>
<view class="clock-symbol">
<text>:</text>
</view>
<view class="clock-time">
<text>{{ countDownObj.dynamic.min }}</text>
</view>
<view class="clock-symbol">
<text>:</text>
</view>
<view class="clock-time">
<text>{{ countDownObj.dynamic.sec }}</text>
</view>
</view>
<text class="m-r-10">{{ tabbar[curTabIndex].status == StateEnum.ACTIVE_STATE_BEGIN.value ? '距结束' : '距开始' }}</text>
<countdown wx:if="{{ countDownTime }}" date="{{ countDownTime }}" style="custom" bind:finish="onCountDownEnd" />
</view>
</view>
<!-- 内容区域 -->

View File

@ -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 {

View File

@ -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'
});

View File

@ -73,8 +73,6 @@ Page({
onSubmit(e) {
let _this = this;
// 记录formid
App.saveFormId(e.detail.formId);
// 按钮禁用
_this.setData({

View File

@ -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'
})

View File

@ -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;
}

View File

@ -1,3 +1,3 @@
{
"version": "1.1.45"
"version": "1.1.46"
}