Compare commits

...

10 Commits

Author SHA1 Message Date
5b78b2b4e2 doc: update README 2021-07-16 16:39:50 +08:00
ff91440436 1.1.46 2021-07-16 16:37:55 +08:00
53ddca24ab 1.1.45 2021-07-16 16:36:54 +08:00
b53018c8c9 doc: update README 2020-08-28 10:52:04 +08:00
bc4a8a2052 1.1.44 2020-08-28 10:50:12 +08:00
1eb6284ca3 1.1.43 2020-08-28 10:49:50 +08:00
054ace2994 1.1.42 2020-08-28 10:49:15 +08:00
25542e0535 1.1.41 2020-04-25 23:04:41 +08:00
5289d0af43 1.1.40 2020-04-25 23:02:46 +08:00
8842afab2a 1.1.39 2020-04-25 23:01:04 +08:00
103 changed files with 2614 additions and 1255 deletions

116
README.md
View File

@ -10,6 +10,122 @@
## 更新日志
### v1.1.46
```
优化:兼容新版微信小程序授权登录
优化:微信支付下单时记录日志
优化:后台修改会员等级时默认选中
优化:获取海报图出错时抛错
优化:小程序端资讯列表页支持指定分类
修复:订单结算时计算优惠券精度问题
修复:后台新增优惠券报错
修复:删除购物车后更新角标数量
修复:小程序端倒计时组件报错
注:本次更新须重新发布小程序
```
### v1.1.45
```
新增:优惠券支持指定商品
新增:小程序端底部购物车数量(角标)
优化微信退款API记录日志
优化:整点秒杀页面倒计时结束刷新
修复:后台满额包邮地区总数错误
修复:后台分销商确认打款时报错
注:本次更新须重新发布小程序
```
### v1.1.44
```
新增:小程序转发到朋友圈(灰度安卓用户)
优化:微信打款时验证冻结资金是否合法
优化mysql报错时记录Error SQL
修复:后台权限缺少文件列表和回收站
修复:地区表中部分地区不存在
修复:获取直播房间列表接口报错
修复:后台订单详情页报错
修复:小程序端富文本视频高度不生效
注:本次更新须重新发布小程序
```
### v1.1.43
```
优化mysql5.7环境数据排序问题
优化:秒杀商品不允许付款减库存
优化小票打印机API记录日志
优化:调整拼团拼单失效时间
修复:后台订单导出未下载问题
修复后台添加角色cdn资源加载超时
修复:后台分销提现列表打款方式
修复:拼团订单手动退款权限问题
修复:验证会员等级权重是否存在
修复:超管后台判断商家用户名重复
注:本次更新须重新发布小程序
```
### v1.1.42
```
新增:分享小程序直播间绑定分销关系
修复小程序端ID selectors报错问题
修复:后台直播间管理置顶报错
修复取消确认弹框后未关闭loading
修复:直播间列表为空时同步失败
修复:收货地址过长发送订阅消息失败
修复:后台审核拼团订单退货报错
修复:小程序端未配置订阅消息提交表单
修复:小程序端秒杀商品分享时无标题
注:本次更新须重新发布小程序
```
### v1.1.41
```
新增:微信小程序订阅消息
修复多开小程序直播间同步ID问题
修复库存1下单后提示商品库存不足
修复拼团商品预览sku图片报错
优化:超管后台删除商家用户
注:本次更新须重新发布小程序
```
### v1.1.40
```
新增:微信小程序直播功能
优化:商品评价过滤无效内容
注:本次更新须重新发布小程序
```
### v1.1.39
```
优化:后台菜单超出显示滚动条
优化取消收集formid
优化:后台门店管理添加筛选条件
优化:回退余额时判断用户是否存在
优化:小程序端授权登录流程
优化超管后台新增商城ID错误
修复:优惠券和积分叠加计算错误
修复:后台选择门店未显示全部
修复:数据统计权限问题报错
修复:订单支付成功短信提醒
修复:砍价商品列表价格排序报错
修复:小程序端订单页未支付提示
注:本次更新须重新发布小程序
```
### v1.1.38
```

108
app.js
View File

@ -60,8 +60,16 @@ App({
* 记录推荐人id
*/
saveRefereeId(refereeId) {
if (!wx.getStorageSync('referee_id'))
wx.setStorageSync('referee_id', refereeId);
let App = this;
refereeId = parseInt(refereeId);
if (refereeId <= 0 || refereeId == App.getUserId()) {
return false;
}
if (wx.getStorageSync('referee_id')) {
return false;
}
wx.setStorageSync('referee_id', refereeId);
return true;
},
/**
@ -75,8 +83,26 @@ App({
* 当小程序启动或从后台进入前台显示会触发 onShow
*/
onShow(options) {
// 获取小程序基础信息
// this.getWxappBase();
let App = this;
try {
const livePlayer = requirePlugin('live-player-plugin');
if (options.scene == 1007 || options.scene == 1008 || options.scene == 1044) {
livePlayer.getShareParams()
.then(res => {
// 直播页面的自定义参数
let customParams = res.custom_params;
console.log('get custom params', customParams);
// 记录推荐人ID
if (customParams.hasOwnProperty('referee_id')) {
App.saveRefereeId(customParams['referee_id']);
}
}).catch(err => {
console.log('get share params', err)
});
}
} catch (error) {
}
},
/**
@ -113,7 +139,7 @@ App({
mask: true,
duration: 1500,
success() {
callback && (setTimeout(function() {
callback && (setTimeout(() => {
callback();
}, 1500));
}
@ -129,7 +155,7 @@ App({
content: msg,
showCancel: false,
success(res) {
// callback && (setTimeout(function() {
// callback && (setTimeout(() => {
// callback();
// }, 1500));
callback && callback();
@ -151,7 +177,7 @@ App({
// check_login = true;
// 构造get请求
let request = function() {
let request = () => {
data.token = wx.getStorageSync('token');
wx.request({
url: _this.api_root + url,
@ -170,7 +196,7 @@ App({
wx.hideNavigationBarLoading();
_this.doLogin(2);
} else if (res.data.code === 0) {
_this.showError(res.data.msg, function() {
_this.showError(res.data.msg, () => {
fail && fail(res);
});
return false;
@ -179,7 +205,7 @@ App({
}
},
fail(res) {
_this.showError(res.errMsg, function() {
_this.showError(res.errMsg, () => {
fail && fail(res);
});
},
@ -225,7 +251,7 @@ App({
_this.doLogin(1);
return false;
} else if (res.data.code === 0) {
_this.showError(res.data.msg, function() {
_this.showError(res.data.msg, () => {
fail && fail(res);
});
return false;
@ -234,7 +260,7 @@ App({
},
fail(res) {
// console.log(res);
_this.showError(res.errMsg, function() {
_this.showError(res.errMsg, () => {
fail && fail(res);
});
},
@ -262,11 +288,11 @@ App({
return false;
}
const updateManager = wx.getUpdateManager();
updateManager.onCheckForUpdate(function(res) {
updateManager.onCheckForUpdate(res => {
// 请求完新版本信息的回调
// console.log(res.hasUpdate)
});
updateManager.onUpdateReady(function() {
updateManager.onUpdateReady(() => {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,即将重启应用',
@ -279,7 +305,7 @@ App({
}
});
});
updateManager.onUpdateFailed(function() {
updateManager.onUpdateFailed(() => {
// 新的版本下载失败
wx.showModal({
title: '更新提示',
@ -320,16 +346,18 @@ App({
/**
* 记录formId
* (因微信模板消息已下线所以formId取消不再收集)
*/
saveFormId(formId) {
let _this = this;
console.log('saveFormId');
if (formId === 'the formId is a mock one') {
return false;
}
_this._post_form('wxapp.formId/save', {
formId: formId
}, null, null, null, false);
return true;
// let _this = this;
// console.log('saveFormId');
// if (formId === 'the formId is a mock one') {
// return false;
// }
// _this._post_form('wxapp.formId/save', {
// formId: formId
// }, null, null, null, false);
},
/**
@ -380,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
@ -395,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
@ -413,4 +435,30 @@ App({
});
},
/**
* 记录购物车商品总数量
* @param {*} value
*/
setCartTotalNum(value) {
wx.setStorageSync('cartTotalNum', Number(value))
},
/**
* 设置购物车tabbar的角标
*/
setCartTabBadge() {
const number = wx.getStorageSync('cartTotalNum')
if (number > 0) {
wx.setTabBarBadge({
index: 2,
text: `${number}`
})
} else {
wx.removeTabBarBadge({
index: 2
})
}
return
}
});

View File

@ -57,7 +57,8 @@
"pages/bargain/goods/index",
"pages/points/log/index",
"pages/sharp/index/index",
"pages/sharp/goods/index"
"pages/sharp/goods/index",
"pages/live/index"
],
"window": {
"navigationBarBackgroundColor": "#ffffff",

View File

@ -24,7 +24,7 @@ page {
.no-more {
text-align: center;
color: #737373;
padding: 10px 0;
padding: 20rpx 0;
}
.yoshop-notcont {

View File

@ -7,7 +7,7 @@
<!-- 选项按钮 -->
<zan-btn
wx:for="{{ actions }}"
wx:key="{{ index }}-{{ item.name }}"
wx:key="this"
bind:btnclick="handleBtnClick"
data-index="{{ index }}"
open-type="{{ item.openType }}"

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

@ -7,7 +7,7 @@
</scroll-view>
</view>
<view class="zan-dialog__footer {{ buttonsShowVertical ? 'zan-dialog__footer--vertical' : 'zan-dialog__footer--horizon' }}">
<block wx:for="{{ buttons }}" wx:key="{{ item.text }}-{{ item.type }}">
<block wx:for="{{ buttons }}" wx:key="this">
<zan-button class="zan-dialog__button" custom-class="{{ index === 0 ? 'zan-dialog__button-inside--first' : 'zan-dialog__button-inside' }}" data-type="{{ item.type }}" data-open-type="{{ item.openType }}" open-type="{{ item.openType }}" bind:btnclick="handleButtonClick"
bind:getuserinfo="handleUserInfoResponse" bind:getphonenumber="handlePhoneResponse" bind:opensetting="handleOpenSettingResponse">
<view style="color: {{ item.color || '#333' }}">{{ item.text }}</view>

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

@ -2,7 +2,7 @@ const App = getApp();
Component({
options: {
multipleSlots: true // 在组件定义时的选项中启用多slot支持
addGlobalClass: true,
},
/**
@ -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

@ -1,4 +1,4 @@
@import "/utils/common.wxss";
/* @import "/utils/common.wxss"; */
/* 快捷导航 */
@ -29,7 +29,7 @@
opacity: 0;
}
.nav-item text {
.nav-item .iconfont {
font-size: 40rpx;
}

36
components/toast/index.js Normal file
View File

@ -0,0 +1,36 @@
'use strict';
var DEFAULT_DATA = {
show: false,
message: '',
icon: '',
image: '',
mask: false
};
var SUPPORT_TYPE = ['loading', 'success', 'fail'];
Component({
data: Object.assign({}, DEFAULT_DATA),
methods: {
show: function show(options) {
var toastOptions = Object.assign({}, options);
var icon = options.icon || '';
var image = options.image || '';
if (SUPPORT_TYPE.indexOf(options.type) > -1) {
icon = options.type;
image = '';
}
this.setData(Object.assign({}, toastOptions, {
icon: icon,
image: image
}));
},
clear: function clear() {
this.setData(Object.assign({}, DEFAULT_DATA));
}
}
});

View File

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

View File

@ -0,0 +1,30 @@
<view
class="zan-toast {{ !message ? 'zan-toast--notitle' : '' }}"
wx:if="{{ show }}"
bindtap="clearZanToast"
>
<!-- icon 展示 -->
<block
wx:if="{{ icon || image }}"
>
<view
wx:if="{{ image }}"
class="zan-toast__icon zan-toast__icon-image"
style="background-image: url({{ image }});"
></view>
<view
wx:elif="{{ icon === 'loading' }}"
class="zan-toast__icon zan-toast__icon-loading"
>
<view class="zan-loading"></view>
</view>
<zan-icon
wx:else
type="{{ icon }}"
class="zan-toast__icon"
></zan-icon>
</block>
<!-- 文案展示 -->
<view wx:if="{{ message }}">{{ message }}</view>
</view>

View File

@ -0,0 +1,58 @@
.zan-toast {
position: fixed;
top: 35%;
left: 50%;
-webkit-transform: translate3d(-50%, -50%, 0);
transform: translate3d(-50%, -50%, 0);
background: rgba(0, 0, 0, .7);
color: #fff;
font-size: 14px;
line-height: 1.5em;
margin: 0 auto;
box-sizing: border-box;
padding: 10px 30rpx;
text-align: center;
border-radius: 4px;
z-index: 100
}
.zan-toast--notitle {
padding: 18px
}
.zan-toast__icon {
display: block;
width: 40px;
height: 40px;
line-height: 40px;
margin: 0 auto;
padding: 12px 15px;
font-size: 38px;
text-align: center
}
.zan-toast__icon-loading {
line-height: 0
}
.zan-loading {
width: 20px;
height: 20px;
display: inline-block;
vertical-align: middle;
-webkit-animation: weuiLoading 1s steps(12, end) infinite;
animation: weuiLoading 1s steps(12, end) infinite;
background: transparent url(data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iciIgd2lkdGg9JzEyMHB4JyBoZWlnaHQ9JzEyMHB4JyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj4KICAgIDxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiBmaWxsPSJub25lIiBjbGFzcz0iYmsiPjwvcmVjdD4KICAgIDxyZWN0IHg9JzQ2LjUnIHk9JzQwJyB3aWR0aD0nNycgaGVpZ2h0PScyMCcgcng9JzUnIHJ5PSc1JyBmaWxsPScjRTlFOUU5JwogICAgICAgICAgdHJhbnNmb3JtPSdyb3RhdGUoMCA1MCA1MCkgdHJhbnNsYXRlKDAgLTMwKSc+CiAgICA8L3JlY3Q+CiAgICA8cmVjdCB4PSc0Ni41JyB5PSc0MCcgd2lkdGg9JzcnIGhlaWdodD0nMjAnIHJ4PSc1JyByeT0nNScgZmlsbD0nIzk4OTY5NycKICAgICAgICAgIHRyYW5zZm9ybT0ncm90YXRlKDMwIDUwIDUwKSB0cmFuc2xhdGUoMCAtMzApJz4KICAgICAgICAgICAgICAgICByZXBlYXRDb3VudD0naW5kZWZpbml0ZScvPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyM5Qjk5OUEnCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSg2MCA1MCA1MCkgdHJhbnNsYXRlKDAgLTMwKSc+CiAgICAgICAgICAgICAgICAgcmVwZWF0Q291bnQ9J2luZGVmaW5pdGUnLz4KICAgIDwvcmVjdD4KICAgIDxyZWN0IHg9JzQ2LjUnIHk9JzQwJyB3aWR0aD0nNycgaGVpZ2h0PScyMCcgcng9JzUnIHJ5PSc1JyBmaWxsPScjQTNBMUEyJwogICAgICAgICAgdHJhbnNmb3JtPSdyb3RhdGUoOTAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNBQkE5QUEnCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgxMjAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNCMkIyQjInCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgxNTAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNCQUI4QjknCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgxODAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNDMkMwQzEnCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgyMTAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNDQkNCQ0InCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgyNDAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNEMkQyRDInCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgyNzAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNEQURBREEnCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgzMDAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNFMkUyRTInCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgzMzAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0Pgo8L3N2Zz4=) no-repeat;
background-size: 100%
}
.zan-toast__icon-loading .zan-loading {
width: 40px;
height: 40px
}
.zan-toast__icon-image {
background-size: 40px;
background-position: center;
background-repeat: no-repeat
}

134
components/toast/toast.js Normal file
View File

@ -0,0 +1,134 @@
'use strict';
var TOAST_CONFIG_KEY = 'zanui.__zanToastPageConfig';
var DEFAULT_SHOW_TOAST_TIME = 3000;
var timeoutData = {
timeoutId: 0,
toastCtx: null
};
var globalToastUserConfig = {};
// 获取页面上下文
function getPageCtx(pageCtx) {
var ctx = pageCtx;
if (!ctx) {
var pages = getCurrentPages();
ctx = pages[pages.length - 1];
}
return ctx;
}
// 获取当前页面的 toast 配置数据
function getPageToastConfig(pageCtx) {
var zanuiData = pageCtx.data.zanui || {};
return zanuiData.__zanToastPageConfig || {};
}
// Toast 显示函数
function Toast(optionsOrMsg, pageCtx) {
// 参数格式化处理
// 如果是文字,默认为 message
var options = optionsOrMsg || {};
if (typeof optionsOrMsg === 'string') {
options = { message: optionsOrMsg };
}
var ctx = getPageCtx(pageCtx);
var pageToastUserSetting = getPageToastConfig(ctx);
var parsedOptions = Object.assign({}, globalToastUserConfig, pageToastUserSetting, options);
var toastCtx = ctx.selectComponent(parsedOptions.selector);
if (!toastCtx) {
console.error('无法找到对应的toast组件请于页面中注册并在 wxml 中声明 toast 自定义组件');
return;
}
if (timeoutData.timeoutId) {
Toast.clear();
}
toastCtx.show(Object.assign({}, parsedOptions, {
show: true
}));
var timeoutId = 0;
// toast 计时如果小于0就不会去关闭。
// 如果不传,就取默认值
var timeoutOption = parsedOptions.timeout || DEFAULT_SHOW_TOAST_TIME;
if (timeoutOption >= 0) {
timeoutId = setTimeout(function () {
toastCtx.clear();
}, timeoutOption);
}
timeoutData = {
timeoutId: timeoutId,
toastCtx: toastCtx
};
}
// 设置 toast 基础属性
Toast.setDefaultOptions = function () {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'page';
var parsedDefaultOptions = {
selector: options.selector || '',
type: options.type || '',
icon: options.icon || '',
image: options.image || '',
timeout: options.timeout || DEFAULT_SHOW_TOAST_TIME
};
if (type === 'global') {
globalToastUserConfig = Object.assign({}, parsedDefaultOptions);
} else if (type === 'page') {
var _ctx$setData;
var ctx = getPageCtx();
ctx.setData((_ctx$setData = {}, _ctx$setData['' + TOAST_CONFIG_KEY] = parsedDefaultOptions, _ctx$setData));
}
};
// 重置 toast 基础属性
Toast.resetDefaultOptions = function () {
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'page';
if (type === 'global') {
globalToastUserConfig = {};
} else {
var _ctx$setData2;
var ctx = getPageCtx();
ctx.setData((_ctx$setData2 = {}, _ctx$setData2['' + TOAST_CONFIG_KEY] = {}, _ctx$setData2));
}
};
// 清理所有 toast
Toast.clear = function () {
clearTimeout(timeoutData.timeoutId);
try {
timeoutData.toastCtx && timeoutData.toastCtx.clear();
} catch (e) {}
timeoutData = {
timeoutId: 0,
toastCtx: null
};
};
// 显示 loading
Toast.loading = function () {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
Toast(Object.assign({}, options, {
type: 'loading'
}));
};
module.exports = Toast;

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

@ -30,7 +30,7 @@ Page({
let _this = this;
App._get('article/detail', {
article_id
}, function(result) {
}, function (result) {
let detail = result.data.detail;
// 富文本转码
if (detail.article_content.length > 0) {
@ -47,7 +47,7 @@ Page({
*/
onShareAppMessage() {
// 构建页面参数
let params = App.getShareUrlParams({
const params = App.getShareUrlParams({
'article_id': this.data.detail.article_id
});
return {
@ -56,4 +56,20 @@ Page({
};
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
// 构建页面参数
const params = App.getShareUrlParams({
'article_id': this.data.detail.article_id
});
return {
// title: this.data.detail.article_title,
path: "/pages/article/detail/index?" + params
};
}
})

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) {
@ -96,16 +102,6 @@ Page({
});
},
/**
* 分享当前页面
*/
onShareAppMessage() {
return {
title: '文章首页',
path: "/pages/article/index?" + App.getShareUrlParams()
};
},
/**
* 下拉到底加载数据
*/
@ -129,11 +125,31 @@ Page({
rpx = systemInfo.windowWidth / 750, // 计算rpx
tapHeight = Math.floor(rpx * 98), // tap高度
scrollHeight = systemInfo.windowHeight - tapHeight; // swiper高度
console.log(
systemInfo.windowHeight
);
this.setData({
scrollHeight
});
},
/**
* 分享当前页面
*/
onShareAppMessage() {
return {
title: '文章首页',
path: "/pages/article/index?" + App.getShareUrlParams()
};
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
return {
title: '文章首页',
path: "/pages/article/index?" + App.getShareUrlParams()
};
},
})

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,20 +480,35 @@ Page({
* 跳转到首页
*/
onTargetHome(e) {
// 记录formid
App.saveFormId(e.detail.formId);
wx.switchTab({
url: '../../index/index',
})
},
/**
* 用户点击右上角分享
* 分享当前页面
*/
onShareAppMessage() {
let _this = this;
const _this = this;
// 构建页面参数
let params = App.getShareUrlParams({
const params = App.getShareUrlParams({
active_id: _this.data.active.active_id
});
return {
title: _this.data.detail.goods_name,
path: `/pages/bargain/goods/index?${params}`
};
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
const _this = this;
// 构建页面参数
const params = App.getShareUrlParams({
active_id: _this.data.active.active_id
});
return {

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}`,
})
@ -235,12 +218,27 @@ Page({
},
/**
* 用户点击右上角分享
* 分享当前页面
*/
onShareAppMessage() {
let _this = this;
const _this = this;
// 构建页面参数
let params = App.getShareUrlParams();
const params = App.getShareUrlParams();
return {
title: '砍价专区',
path: `/pages/bargain/index/index?${params}`
};
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
const _this = this;
// 构建页面参数
const params = App.getShareUrlParams();
return {
title: '砍价专区',
path: `/pages/bargain/index/index?${params}`

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({
@ -216,12 +194,29 @@ Page({
},
/**
* 用户点击右上角分享
* 分享当前页面
*/
onShareAppMessage() {
let _this = this;
const _this = this;
// 构建页面参数
let params = App.getShareUrlParams({
const params = App.getShareUrlParams({
task_id: _this.data.task_id
});
return {
title: _this.data.active.share_title,
path: `/pages/bargain/task/index?${params}`
};
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
const _this = this;
// 构建页面参数
const params = App.getShareUrlParams({
task_id: _this.data.task_id
});
return {

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

@ -32,6 +32,14 @@ Page({
_this.getCategoryList();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 更新购物车角标
App.setCartTabBadge()
},
/**
* 设置分类列表高度
*/
@ -78,11 +86,24 @@ Page({
* 设置分享内容
*/
onShareAppMessage() {
let _this = this;
const _this = this;
return {
title: _this.data.templet.share_title,
path: '/pages/category/index?' + App.getShareUrlParams()
};
}
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
const _this = this;
return {
title: _this.data.templet.share_title,
path: '/pages/category/index?' + App.getShareUrlParams()
};
},
});

View File

@ -137,17 +137,6 @@ Page({
this.getGoodsList(true, ++this.data.page);
},
/**
* 设置分享内容
*/
onShareAppMessage() {
// 构建分享参数
return {
title: "全部分类",
path: "/pages/category/index?" + App.getShareUrlParams()
};
},
/**
* 商品搜索
*/
@ -165,4 +154,28 @@ Page({
})
},
/**
* 设置分享内容
*/
onShareAppMessage() {
// 构建分享参数
return {
title: "全部分类",
path: "/pages/category/index?" + App.getShareUrlParams()
};
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
// 构建分享参数
return {
title: "全部分类",
path: "/pages/category/index?" + App.getShareUrlParams()
};
},
});

View File

@ -1,21 +1,21 @@
.store_nav_cont {
padding: 20rpx 0;
font-size: 25rpx;
}
.store_nav_cont #list-true {
color: #ff495e;
font-size: 28rpx;
}
.store_nav_cont #list-0 {
color: #333;
font-size: 28rpx;
}
.store_nav_cont .price__arrow {
padding-left: 20rpx;
font-size: 18rpx;
color: #777;
line-height: 1;
}
.store_nav_cont #list-true .price__arrow text.active {
@ -109,7 +109,7 @@
}
.category-list .right .cont .title {
height: 76rpx;
height: 72rpx;
line-height: 1.3;
}

View File

@ -52,13 +52,23 @@ Page({
})
},
/**
* 下拉刷新
*/
onPullDownRefresh: function() {
// 获取首页数据
this.getPageData(function() {
wx.stopPullDownRefresh();
});
},
/**
* 分享当前页面
*/
onShareAppMessage: function() {
let _this = this;
const _this = this;
// 构建页面参数
let params = App.getShareUrlParams({
const params = App.getShareUrlParams({
'page_id': _this.data.page_id
});
return {
@ -68,13 +78,20 @@ Page({
},
/**
* 下拉刷新
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onPullDownRefresh: function() {
// 获取首页数据
this.getPageData(function() {
wx.stopPullDownRefresh();
onShareTimeline: function() {
const _this = this;
// 构建页面参数
const params = App.getShareUrlParams({
'page_id': _this.data.page_id
});
}
return {
title: _this.data.page.params.share_title,
path: "/pages/custom/index?" + params
};
},
});

View File

@ -9,31 +9,48 @@ Page({
data: {
is_read: false,
disabled: false,
submsgSetting: {}, // 订阅消息配置
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
onLoad(options) {
let _this = this;
// 获取订阅消息配置
_this.getSubmsgSetting();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
onShow() {
let _this = this;
// 获取分销商申请状态
this.getApplyState();
_this.getApplyState();
},
/**
* 获取订阅消息配置
*/
getSubmsgSetting() {
let _this = this;
App._get('wxapp.submsg/setting', {}, (result) => {
_this.setData({
submsgSetting: result.data.setting
});
});
},
/**
* 获取分销商申请状态
*/
getApplyState: function() {
getApplyState() {
let _this = this;
App._get('user.dealer/apply', {
referee_id: _this.getRefereeid()
}, function(result) {
}, (result) => {
let data = result.data;
// 当前是否已经为分销商
if (data.is_dealer) {
@ -53,7 +70,7 @@ Page({
/**
* 显示申请协议
*/
toggleApplyLicense: function() {
toggleApplyLicense() {
Dialog({
title: '申请协议',
message: this.data.license,
@ -72,8 +89,9 @@ Page({
/**
* 已阅读
*/
toggleSetRead: function() {
this.setData({
toggleSetRead() {
let _this = this;
_this.setData({
is_read: !this.data.is_read
});
},
@ -81,13 +99,10 @@ Page({
/**
* 提交申请
*/
formSubmit: function(e) {
onFormSubmit(e) {
let _this = this,
values = e.detail.value;
// 记录formId
App.saveFormId(e.detail.formId);
// 验证姓名
if (!values.name || values.name.length < 1) {
App.showError('请填写姓名');
@ -112,10 +127,10 @@ Page({
});
// 数据提交
App._post_form('user.dealer.apply/submit', values, function() {
App._post_form('user.dealer.apply/submit', values, () => {
// 获取分销商申请状态
_this.getApplyState();
}, null, function() {
}, null, () => {
// 解除按钮禁用
_this.setData({
disabled: false
@ -126,19 +141,33 @@ Page({
/**
* 去商城逛逛
*/
navigationToIndex: function(e) {
// 记录formId
App.saveFormId(e.detail.formId);
navigationToIndex(e) {
// 跳转到首页
wx.switchTab({
url: '/pages/index/index',
})
},
/**
* 订阅消息通知
*/
onSubMsg() {
let _this = this;
let tmplItem = _this.data.submsgSetting.dealer.apply.template_id;
if (tmplItem.length > 0) {
wx.requestSubscribeMessage({
tmplIds: [tmplItem],
success(res) {},
fail(res) {},
complete(res) {},
});
}
},
/**
* 获取推荐人id
*/
getRefereeid: function() {
getRefereeid() {
return wx.getStorageSync('referee_id');
},

View File

@ -11,7 +11,7 @@
<view class="widget-form b-f m-top20 dis-flex flex-dir-column">
<view class="form-title f-30">{{ words.apply.words.title.value }}</view>
<view class="form-box dis-flex flex-dir-column">
<form bindsubmit="formSubmit" report-submit="true">
<form bindsubmit="onFormSubmit" report-submit="true">
<view class="form-field dis-flex flex-y-center">
<view class="field-label">邀请人</view>
<view class="field-input">
@ -61,6 +61,10 @@
<button formType="submit">{{ words.apply.words.goto_mall.value }}</button>
</form>
</view>
<!-- 订阅消息通知 -->
<view class="boot__submsg" catchtap="onSubMsg">
<text class="iconfont icon-iconxx"></text>
<text class="f-29">点击订阅消息通知</text>
</view>
</view>
</view>

View File

@ -94,3 +94,13 @@ page {
.dealer-boot .boot__submit {
margin-top: 60rpx;
}
.boot__submsg {
margin-top: 30rpx;
font-size: 28rpx;
color: #786cff;
line-height: 1.5;
}
.boot__submsg .iconfont {
margin-right: 6rpx;
}

View File

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

View File

@ -10,29 +10,46 @@ Page({
words: {},
payment: 20,
submsgSetting: {}, // 订阅消息配置
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
onLoad(options) {
let _this = this;
// 获取订阅消息配置
_this.getSubmsgSetting();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
onShow() {
let _this = this;
// 获取分销商提现信息
this.getDealerWithdraw();
_this.getDealerWithdraw();
},
/**
* 获取订阅消息配置
*/
getSubmsgSetting() {
let _this = this;
App._get('wxapp.submsg/setting', {}, (result) => {
_this.setData({
submsgSetting: result.data.setting
});
});
},
/**
* 获取分销商提现信息
*/
getDealerWithdraw: function() {
getDealerWithdraw() {
let _this = this;
App._get('user.dealer/withdraw', {}, function(result) {
App._get('user.dealer/withdraw', {}, (result) => {
let data = result.data;
data.isData = true;
// 设置当前页面标题
@ -48,14 +65,11 @@ Page({
/**
* 提交申请
*/
formSubmit: function(e) {
onFormSubmit(e) {
let _this = this,
values = e.detail.value,
words = _this.data.words.withdraw_apply.words;
// 记录formId
App.saveFormId(e.detail.formId);
// 验证可提现佣金
if (_this.data.dealer.money <= 0) {
App.showError('当前没有' + words.capital.value);
@ -72,30 +86,74 @@ Page({
});
// 提现方式
values['pay_type'] = _this.data.payment;
// 数据提交
App._post_form('user.dealer.withdraw/submit', {
data: JSON.stringify(values)
}, function(result) {
// 提交成功
// console.log(result);
App.showError(result.msg, function() {
wx.navigateTo({
url: '../list/list',
})
});
}, null, function() {
// 解除按钮禁用
_this.setData({
disabled: false
const onCallback = () => {
App._post_form('user.dealer.withdraw/submit', {
data: JSON.stringify(values)
}, (result) => {
// 提交成功
App.showError(result.msg, () => {
wx.navigateTo({
url: '../list/list',
})
});
}, null, () => {
// 解除按钮禁用
_this.setData({
disabled: false
});
});
};
// 确认是否提交
wx.showModal({
// title: '友情提示',
content: '确定提交提现申请吗?请确认填写无误',
showCancel: true,
success(res) {
if (res.confirm) {
// 请求用户订阅消息
_this._onRequestSubscribeMessage(onCallback);
} else if (res.cancel) {
// 解除按钮禁用
_this.setData({
disabled: false
});
}
}
});
},
/**
* 订阅消息 => [提现通知]
*/
_onRequestSubscribeMessage(callback) {
let _this = this,
tmplIds = [],
dealerSubmsg = _this.data.submsgSetting.dealer;
dealerSubmsg.withdraw_01.template_id != '' && tmplIds.push(dealerSubmsg.withdraw_01.template_id);
dealerSubmsg.withdraw_02.template_id != '' && tmplIds.push(dealerSubmsg.withdraw_02.template_id);
if (tmplIds.length == 0) {
callback && callback();
return;
}
wx.requestSubscribeMessage({
tmplIds,
success(res) {},
fail(res) {},
complete(res) {
callback && callback();
},
});
},
/**
* 切换提现方式
*/
toggleChecked: function(e) {
this.setData({
toggleChecked(e) {
let _this = this;
_this.setData({
payment: e.currentTarget.dataset.payment
});
},

View File

@ -6,7 +6,7 @@
</view>
<view class="widget-body b-f dis-flex flex-dir-column flex-y-center">
<form bindsubmit="formSubmit" report-submit="true">
<form bindsubmit="onFormSubmit" report-submit="true">
<!-- 提现佣金 -->
<view class="widget widget__capital m-top20 b-f dis-flex flex-dir-column">
<view class="capital__item dis-flex flex-x-between flex-y-center">

View File

@ -1,20 +1,11 @@
const App = getApp();
// 工具类
import Util from '../../utils/util.js';
// 验证类
import Verify from '../../utils/verify.js';
// 枚举类:发货方式
import DeliveryTypeEnum from '../../utils/enum/DeliveryType.js';
// 枚举类:支付方式
import PayTypeEnum from '../../utils/enum/order/PayType';
// 对话框插件
import Dialog from '../../components/dialog/dialog';
import Toast from '../../components/toast/toast';
const App = getApp()
Page({
/**
@ -66,6 +57,8 @@ Page({
has_error: false,
error_msg: '',
notRefresh: false, // 不允许刷新
},
/**
@ -86,7 +79,7 @@ Page({
onShow() {
let _this = this;
// 获取当前订单信息
_this.getOrderData();
!_this.data.notRefresh && _this.getOrderData();
},
/**
@ -185,10 +178,9 @@ Page({
*/
onSwichDelivery(e) {
// 设置当前配送方式
let _this = this,
curDelivery = e.currentTarget.dataset.current;
let _this = this;
_this.setData({
curDelivery
curDelivery: e.currentTarget.dataset.current
});
// 重新获取订单信息
_this.getOrderData();
@ -198,8 +190,14 @@ Page({
* 快递配送选择收货地址
*/
onSelectAddress() {
let _this = this;
// 允许刷新
_this.setData({
notRefresh: false
});
// 跳转到选择自提点
wx.navigateTo({
url: '../address/' + (this.data.exist_address ? 'index?from=flow' : 'create')
url: '../address/' + (_this.data.exist_address ? 'index?from=flow' : 'create')
});
},
@ -209,6 +207,11 @@ Page({
onSelectExtractPoint() {
let _this = this,
selectedId = _this.data.selectedShopId;
// 允许刷新
_this.setData({
notRefresh: false
});
// 跳转到选择自提点
wx.navigateTo({
url: '../_select/extract_point/index?selected_id=' + selectedId
});
@ -239,45 +242,9 @@ Page({
return false;
}
// 订单创建成功后回调--微信支付
let callback = result => {
if (result.code === -10) {
App.showError(result.msg, () => {
_this.redirectToOrderIndex();
});
return false;
}
// 发起微信支付
if (result.data.pay_type == PayTypeEnum.WECHAT.value) {
App.wxPayment({
payment: result.data.payment,
success: res => {
_this.redirectToOrderIndex();
},
fail: res => {
App.showError(result.msg.error, () => {
_this.redirectToOrderIndex();
});
},
});
}
// 余额支付
if (result.data.pay_type == PayTypeEnum.BALANCE.value) {
App.showSuccess(result.msg.success, () => {
_this.redirectToOrderIndex();
});
}
};
// 按钮禁用, 防止二次提交
_this.data.disabled = true;
// 显示loading
wx.showLoading({
title: '正在处理...'
});
let url = '';
@ -320,7 +287,7 @@ Page({
});
}
// 创建订单-砍价活动
// 创建订单-秒杀商品
if (options.order_type === 'sharp') {
url = 'sharp.order/checkout';
postData = Object.assign(postData, {
@ -331,17 +298,85 @@ Page({
});
}
// 订单提交
App._post_form(url, postData, result => {
callback(result);
}, result => {}, () => {
wx.hideLoading();
// 解除按钮禁用
_this.data.disabled = false;
});
// 提交到后端
const onCommitCallback = () => {
// 显示loading
wx.showLoading({
title: '正在处理...'
});
// 订单提交
App._post_form(url, postData, result => {
_this._onSubmitCallback(result);
}, result => {}, () => {
wx.hideLoading();
// 解除按钮禁用
_this.data.disabled = false;
});
// 不允许刷新
_this.setData({
notRefresh: true
});
};
// 请求用户订阅消息
_this._onRequestSubscribeMessage(onCommitCallback);
},
/**
* 请求用户订阅消息
*/
_onRequestSubscribeMessage(onCommitCallback) {
let _this = this,
tmplIds = _this.data.setting.order_submsg;
if (tmplIds.length == 0) {
onCommitCallback();
return;
}
wx.requestSubscribeMessage({
tmplIds,
success(res) {},
fail(res) {},
complete(res) {
onCommitCallback();
},
});
},
/**
* 订单提交成功后回调
*/
_onSubmitCallback(result) {
let _this = this;
// 订单创建成功后回调--微信支付
if (result.code === -10) {
App.showError(result.msg, () => {
_this.redirectToOrderIndex();
});
return false;
}
// 发起微信支付
if (result.data.pay_type == PayTypeEnum.WECHAT.value) {
App.wxPayment({
payment: result.data.payment,
success: res => {
_this.redirectToOrderIndex();
},
fail: res => {
App.showError(result.msg.error, () => {
_this.redirectToOrderIndex();
});
},
});
}
// 余额支付
if (result.data.pay_type == PayTypeEnum.BALANCE.value) {
App.showSuccess(result.msg.success, () => {
_this.redirectToOrderIndex();
});
}
},
/**
* 表单验证
*/
@ -403,15 +438,27 @@ Page({
* 选择优惠券
*/
onSelectCoupon(e) {
let _this = this;
const app = this;
// 当前选择的优惠券
const index = e.currentTarget.dataset.index
const couponItem = app.data.coupon_list[index]
// 判断是否在适用范围
if (!couponItem['is_apply']) {
Toast({
selector: '#zan-toast',
message: couponItem.not_apply_info,
timeout: 1800
});
return
}
// 记录选中的优惠券id
_this.setData({
selectCouponId: e.currentTarget.dataset.id
app.setData({
selectCouponId: couponItem.user_coupon_id
});
// 重新获取订单信息
_this.getOrderData();
app.getOrderData();
// 隐藏优惠券弹层
_this.onTogglePopupCoupon();
app.onTogglePopupCoupon();
},
/**
@ -433,8 +480,6 @@ Page({
*/
onSelectPayType(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
// 设置当前支付方式
_this.setData({
curPayType: e.currentTarget.dataset.value
@ -489,8 +534,6 @@ Page({
*/
onShowPoints(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
// 显示dialog
let setting = _this.data.setting;
Dialog({

View File

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

View File

@ -2,7 +2,9 @@
<!-- 顶部选项卡 -->
<view wx:if="{{ isShowTab }}" class="swiper-tab dis-flex flex-y-center flex-x-around">
<view wx:for="{{ DeliveryTypeEnum }}" wx:key="this" class="swiper-tab-item {{ curDelivery == item.value ? 'on' : '' }}" data-current="{{ item.value }}" catchtap="onSwichDelivery">
<view wx:for="{{ DeliveryTypeEnum }}" wx:key="this"
class="swiper-tab-item {{ curDelivery == item.value ? 'on' : '' }}" data-current="{{ item.value }}"
catchtap="onSwichDelivery">
{{ item.name }}
</view>
</view>
@ -20,7 +22,8 @@
<text class="detail-content__title-phone f-28">{{ address.phone }}</text>
</view>
<view class="detail-content__describe">
<text class="col-7">{{address.region.province}} {{address.region.city}} {{address.region.region}} {{address.detail}}</text>
<text class="col-7">{{address.region.province}} {{address.region.city}} {{address.region.region}}
{{address.detail}}</text>
</view>
</block>
<block wx:else>
@ -48,7 +51,8 @@
<text class="f-30">{{ extract_shop.shop_name }}</text>
</view>
<view class="detail-content__describe">
<text class="col-7">{{extract_shop.region.province}} {{extract_shop.region.city}} {{extract_shop.region.region}} {{extract_shop.address}}</text>
<text class="col-7">{{extract_shop.region.province}} {{extract_shop.region.city}}
{{extract_shop.region.region}} {{extract_shop.address}}</text>
</view>
</block>
<block wx:else>
@ -135,7 +139,7 @@
<view catchtap="onTogglePopupCoupon">
<block wx:if="{{ coupon_list.length > 0 }}">
<text class="col-m" wx:if="{{ coupon_id > 0 }}">-¥{{ coupon_money }}</text>
<text class="col-m" wx:else>有{{ coupon_list.length }}张优惠券可用</text>
<text class="col-m" wx:else>有{{ coupon_list.length }}张优惠券</text>
<text class="iconfont icon-xiangyoujiantou user-orderJtou"></text>
</block>
<text wx:else class="">无优惠券可用</text>
@ -241,7 +245,8 @@
<view class="coupon-list">
<scroll-view scroll-y="{{ true }}" style="height: 565rpx;">
<view class="coupon-item" wx:for="{{ coupon_list }}" wx:key="this">
<view class="item-wrapper color__{{ item.color.text }}" catchtap="onSelectCoupon" data-index="{{ index }}" data-id="{{ item.user_coupon_id }}">
<view class="item-wrapper color__{{ item.is_apply ? item.color.text : 'gray' }}" catchtap="onSelectCoupon"
data-index="{{ index }}" data-id="{{ item.user_coupon_id }}">
<view class="coupon-type">{{ item.coupon_type.text }}</view>
<view class="tip dis-flex flex-dir-column flex-x-center">
<view wx:if="{{ item.coupon_type.value == 10 }}">
@ -283,6 +288,8 @@
<!-- 积分说明弹框 -->
<zan-dialog id="zan-base-dialog"></zan-dialog>
<!-- Toast组件 -->
<zan-toast id="zan-toast"></zan-toast>
</view>

View File

@ -167,6 +167,15 @@
background: linear-gradient(-141deg, #f7d059, #fdb054);
}
.popup__coupon .coupon-list .coupon-item .item-wrapper.color__gray {
background: linear-gradient(-113deg, #bdbdbd, #a2a1a2);
}
.popup__coupon .coupon-list .coupon-item .item-wrapper.color__gray .coupon-type {
background: #9e9e9e;
}
.popup__coupon .coupon-list .coupon-item .item-wrapper .tip {
position: relative;
flex: 0 0 32%;

View File

@ -55,7 +55,12 @@ Page({
getCartList() {
let _this = this;
App._get('cart/lists', {}, result => {
_this._initGoodsChecked(result.data);
const data = result.data
// 更新购物车数量及角标
App.setCartTotalNum(data.order_total_num)
App.setCartTabBadge()
// 初始化商品选中状态
_this._initGoodsChecked(data)
});
},

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
@ -285,6 +283,8 @@ Page({
}, (result) => {
App.showSuccess(result.msg);
_this.setData(result.data);
// 记录购物车商品数量
App.setCartTotalNum(result.data.cart_total_num)
});
}
},
@ -346,28 +346,11 @@ Page({
})
},
/**
* 分享当前页面
*/
onShareAppMessage() {
let _this = this;
// 构建页面参数
let params = App.getShareUrlParams({
'goods_id': _this.data.goods_id
});
return {
title: _this.data.detail.goods_name,
path: "/pages/goods/index?" + params
};
},
/**
* 显示分享选项
*/
onClickShare(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
_this.setData({
'share.show': true
});
@ -429,8 +412,6 @@ Page({
*/
onSavePoster(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
wx.showLoading({
title: '加载中',
});
@ -476,15 +457,43 @@ 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
});
},
/**
* 分享当前页面
*/
onShareAppMessage() {
const _this = this;
// 构建页面参数
const params = App.getShareUrlParams({
'goods_id': _this.data.goods_id
});
return {
title: _this.data.detail.goods_name,
path: "/pages/goods/index?" + params
};
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
const _this = this;
// 构建页面参数
const params = App.getShareUrlParams({
'goods_id': _this.data.goods_id
});
return {
title: _this.data.detail.goods_name,
path: "/pages/goods/index?" + params
};
},
})

View File

@ -13,7 +13,7 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
onLoad(options) {
// 当前页面参数
this.setData({
options
@ -22,14 +22,22 @@ Page({
this.getPageData();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 更新购物车角标
App.setCartTabBadge()
},
/**
* 加载页面数据
*/
getPageData: function(callback) {
getPageData(callback) {
let _this = this;
App._get('page/index', {
page_id: _this.data.options.page_id || 0
}, function(result) {
}, result => {
// 设置顶部导航栏栏
_this.setPageBar(result.data.page);
_this.setData(result.data);
@ -41,7 +49,7 @@ Page({
/**
* 设置顶部导航栏
*/
setPageBar: function(page) {
setPageBar(page) {
// 设置页面标题
wx.setNavigationBarTitle({
title: page.params.title
@ -53,11 +61,21 @@ Page({
})
},
/**
* 下拉刷新
*/
onPullDownRefresh() {
// 获取首页数据
this.getPageData(function () {
wx.stopPullDownRefresh();
});
},
/**
* 分享当前页面
*/
onShareAppMessage() {
let _this = this;
const _this = this;
return {
title: _this.data.page.params.share_title,
path: "/pages/index/index?" + App.getShareUrlParams()
@ -65,32 +83,16 @@ Page({
},
/**
* 下拉刷新
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onPullDownRefresh: function() {
// 获取首页数据
this.getPageData(function() {
wx.stopPullDownRefresh();
});
onShareTimeline() {
const _this = this;
return {
title: _this.data.page.params.share_title,
path: "/pages/index/index?" + App.getShareUrlParams()
};
}
// /**
// * 返回顶部
// */
// goTop: function(t) {
// this.setData({
// scrollTop: 0
// });
// },
// scroll: function(t) {
// this.setData({
// indexSearch: t.detail.scrollTop
// }), t.detail.scrollTop > 300 ? this.setData({
// floorstatus: !0
// }) : this.setData({
// floorstatus: !1
// });
// },
});

230
pages/live/index.js Normal file
View File

@ -0,0 +1,230 @@
const App = getApp();
// 工具类
import Util from '../../utils/util.js';
// 直播状态
const LiveStatus = {
101: {
'name': '直播中',
'value': 101,
},
102: {
'name': '未开始',
'value': 102,
},
103: {
'name': '已结束',
'value': 103,
},
104: {
'name': '禁播',
'value': 104,
},
105: {
'name': '暂停中',
'value': 105,
},
106: {
'name': '异常',
'value': 106,
},
107: {
'name': '已过期',
'value': 107,
},
};
Page({
/**
* 页面的初始数据
*/
data: {
scrollHeight: 0,
list: [], // 列表数据
page: 1, // 当前页码
isLoading: true, // 是否正在加载中
isLastPage: false, // 当前是最后一页
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let _this = this;
// 设置列表容器高度
_this.setListHeight();
// 获取直播间列表
_this.getLiveRoomList();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 获取直播间列表
*/
getLiveRoomList(isPage, page) {
let _this = this;
App._get('live.room/lists', {
page: page || 1
}, result => {
let resList = result.data.list,
dataList = _this.data.list;
if (isPage == true) {
_this.setData({
'list.data': dataList.data.concat(resList.data),
isLoading: false,
});
} else {
_this.setData({
list: resList,
isLoading: false,
isLastPage: false,
});
}
// 刷新直播间状态 (体验不佳, 暂不使用)
// _this.setLiveStatusText(resList);
});
},
/**
* 刷新直播间状态
* mix: 因livePlayer.getLiveStatus接口需要间隔1分钟频率轮询, 用户二次进入时体验不佳, 暂不调用
*/
setLiveStatusText(list) {
// 引用直播组件
const livePlayer = requirePlugin('live-player-plugin');
let _this = this;
let startIndex = _this.data.list.data.length - list.data.length;
list.data.forEach((itm, idx) => {
let index = startIndex + idx;
let item = _this.data.list.data[index];
let dataKey = 'list.data[' + index + ']';
// 首次获取立马返回直播状态往后间隔1分钟或更慢的频率去轮询获取直播状态
livePlayer.getLiveStatus({
room_id: item['room_id']
})
.then(res => {
// 101: 直播中, 102: 未开始, 103: 已结束, 104: 禁播, 105: 暂停中, 106: 异常107已过期
let liveStatus = res.liveStatus,
liveStatusText1 = LiveStatus[liveStatus]['name'],
liveStatusText2 = liveStatusText1;
if (liveStatus == 101) {
liveStatusText1 = '正在直播中';
} else if (liveStatus == 102) {
liveStatusText1 = _this.semanticStartTime(item.start_time) + ' 开播';
}
_this.setData({
[dataKey + '.live_status']: liveStatus,
[dataKey + '.live_status_text_1']: liveStatusText1,
[dataKey + '.live_status_text_2']: liveStatusText2,
// test
// [dataKey + '.test']: `test: ${item['room_id']}`,
});
console.log(`getLiveStatus: ${item['room_id']}`);
})
.catch(err => {
console.log(`getLiveStatus: ${item['room_id']}`);
});
});
return list;
},
/**
* 语义化开播时间
*/
semanticStartTime(startTime) {
// 转换为 YYYYMMDD 格式
let startTimeObj = new Date(Util.format_date(startTime));
let $startDate = Util.dateFormat("YYYYmmdd", startTimeObj);
// 获取今天的 YYYY-MM-DD 格式
let $todyDate = Util.dateFormat("YYYYmmdd", new Date());
// 获取明天的 YYYY-MM-DD 格式
var tomorrowTimeObj = new Date();
tomorrowTimeObj.setTime(tomorrowTimeObj.getTime() + 24 * 60 * 60 * 1000);
let $tomorrowDate = Util.dateFormat("YYYYmmdd", tomorrowTimeObj);
// 使用IF当作字符串判断是否相等
if ($startDate == $todyDate) {
return Util.dateFormat('今天HH:MM', startTimeObj);
} else if ($startDate == $tomorrowDate) {
return Util.dateFormat('明天HH:MM', startTimeObj);
}
// 常规日期格式
return Util.dateFormat('mm/dd HH:MM', startTimeObj);
},
/**
* 下拉到底加载数据
*/
onPageDown() {
let _this = this;
// 已经是最后一页
if (_this.data.page >= _this.data.list.last_page) {
_this.setData({
isLastPage: true
});
return false;
}
// 加载下一页列表
_this.getLiveRoomList(true, ++_this.data.page);
},
/**
* 设置列表容器高度
*/
setListHeight() {
let _this = this,
systemInfo = wx.getSystemInfoSync();
_this.setData({
scrollHeight: systemInfo.windowHeight * 0.98
});
},
/**
* 进入直播间
*/
onTargetLiveRoomIndex(e) {
let roomId = e.currentTarget.dataset.id;
let customParams = {
path: 'pages/index/index',
referee_id: App.getUserId(), // 分销推荐人
};
wx.navigateTo({
url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${roomId}&custom_params=${encodeURIComponent(JSON.stringify(customParams))}`
});
},
/**
* 分享当前页面
*/
onShareAppMessage() {
return {
title: '直播列表',
path: "/pages/live/index?" + App.getShareUrlParams()
};
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
return {
title: '直播列表',
path: "/pages/live/index?" + App.getShareUrlParams()
};
},
})

3
pages/live/index.json Normal file
View File

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "直播列表"
}

50
pages/live/index.wxml Normal file
View File

@ -0,0 +1,50 @@
<view class="container">
<view class="live-room-list">
<scroll-view bindscrolltolower="onPageDown" scroll-y="{{ true }}" style="height: {{ scrollHeight }}px">
<view wx:for="{{ list.data }}" wx:key="this" catchtap="onTargetLiveRoomIndex" data-id="{{ item.room_id }}" class="live-room-item live-status__{{ item.live_status }}">
<!-- 直播状态 -->
<view class="room-head dis-flex flex-y-center">
<!-- 直播中 -->
<text wx:if="{{ item.live_status == 101 }}" class="live-status_icon iconfont icon-zhibozhong"></text>
<!-- 未开播 -->
<text wx:if="{{ item.live_status == 102 }}" class="live-status_icon iconfont icon-shijian-s"></text>
<!-- 已结束 -->
<text wx:if="{{ item.live_status >= 103 }}" class="live-status_icon iconfont icon-shipin"></text>
<!-- 状态说明 -->
<text class="live-status_text">{{ item.live_status_text_1 }}</text>
</view>
<!-- 房间名称 -->
<view class="room-name onelist-hidden">
<text>{{ item.room_name }}</text>
</view>
<!-- 房间封面 -->
<view class="room-cover">
<image src="{{ item.share_img }}" mode="aspectFill"></image>
</view>
<!-- 主播信息 -->
<view class="room-anchor dis-flex">
<view class="lay-left flex-box dis-flex flex-y-center">
<!-- 主播头像 -->
<!-- mix: 微信api未提供主播头像, 此处显示封面图 -->
<view class="anchor-avatar">
<image src="{{ item.share_img }}" mode="aspectFill"></image>
</view>
<!-- 主播昵称 -->
<view class="anchor-name">
<text>{{ item.anchor_name }}</text>
</view>
</view>
<view class="lay-right">
<text class="live-status_text2">{{ item.live_status_text_2 }}</text>
</view>
</view>
</view>
<view wx:if="{{ isLastPage }}" class="no-more f-28">亲, 没有更多了</view>
</scroll-view>
</view>
<!-- 没有记录 -->
<view class="yoshop-notcont" wx:if="{{ !list.data.length && !isLoading }}">
<text class="iconfont icon-wushuju"></text>
<text class="cont">亲,暂无直播间哦</text>
</view>
</view>

92
pages/live/index.wxss Normal file
View File

@ -0,0 +1,92 @@
.live-room-item {
width: 710rpx;
margin: 0 auto 20rpx auto;
padding: 25rpx 24rpx;
background: #fff;
border-radius: 5rpx;
box-sizing: border-box;
box-shadow: 0 2rpx 4rpx 0 rgba(0, 0, 0, 0.05);
}
.live-room-item:first-child {
margin-top: 20rpx;
}
.room-head {
color: #b6b6b6;
line-height: 40rpx;
}
.room-head .live-status_icon {
margin-right: 15rpx;
font-size: 34rpx;
}
.room-head .live-status_text {
font-size: 26rpx;
}
/* 直播中 */
.live-status__101 .room-head {
color: #db384b;
}
.live-status__102 .room-head {
color: #db384b;
}
/* 房间名称 */
.room-name {
margin-top: 10rpx;
font-size: 28rpx;
}
/* 房间封面图 */
.room-cover {
margin-top: 15rpx;
}
.room-cover image {
display: block;
width: 100%;
height: 371rpx;
}
/* 主播信息 */
.room-anchor {
margin-top: 20rpx;
}
.room-anchor .anchor-avatar {
margin-right: 12rpx;
}
.room-anchor .anchor-avatar image {
display: block;
width: 45rpx;
height: 45rpx;
border-radius: 50%;
}
.anchor-name {
font-size: 26rpx;
}
.live-status_text2 {
color: #b6b6b6;
font-size: 26rpx;
}
/* 直播中 */
.live-status__101 .live-status_text2 {
color: #db384b;
}
.live-status__102 .live-status_text2 {
color: #db384b;
}

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) {
@ -176,7 +174,7 @@ Page({
_this.getOrderDetail(orderId);
},
fail() {
App.showError(result.msg.success);
App.showError(result.msg.error);
},
});
}

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

@ -7,46 +7,66 @@ Page({
*/
data: {
applyStatus: [],
isLoading: true,
dataType: -1,
page: 1,
no_more: false,
submsgSetting: {}, // 订阅消息配置
list: [], // 列表数据
page: 1, // 当前页码
isLoading: true, // 是否正在加载中
isLastPage: false, // 当前是最后一页
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
onLoad(options) {
let _this = this;
// 设置swiper的高度
this.setSwiperHeight();
_this.setSwiperHeight();
// 获取订阅消息配置
_this.getSubmsgSetting();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
onShow() {
let _this = this;
// 获取退款/售后单列表
this.getRefundList();
_this.getRefundList();
},
/**
* 获取退款/售后单列表
*/
getRefundList: function(isNextPage, page) {
getRefundList(isNextPage, page) {
let _this = this;
App._get('user.refund/lists', {
state: _this.data.dataType,
page: page || 1,
}, function(result) {
}, (result) => {
// 创建页面数据
_this.setData(_this.createData(result.data, isNextPage));
});
},
/**
* 获取订阅消息配置
*/
getSubmsgSetting() {
let _this = this;
App._get('wxapp.submsg/setting', {}, (result) => {
_this.setData({
submsgSetting: result.data.setting
});
});
},
/**
* 创建页面数据
*/
createData: function(data, isNextPage) {
createData(data, isNextPage) {
data['isLoading'] = false;
// 列表数据
let dataList = this.data.list;
@ -67,7 +87,7 @@ Page({
/**
* 设置swiper的高度
*/
setSwiperHeight: function() {
setSwiperHeight() {
// 获取系统信息(拿到屏幕宽度)
let systemInfo = wx.getSystemInfoSync(),
rpx = systemInfo.windowWidth / 750, // 计算rpx
@ -81,7 +101,7 @@ Page({
/**
* 点击tab切换
*/
swichNav: function(e) {
swichNav(e) {
let _this = this,
current = e.target.dataset.current;
if (_this.data.dataType == current) {
@ -91,9 +111,9 @@ Page({
dataType: current,
list: {},
page: 1,
no_more: false,
isLastPage: false,
isLoading: true,
}, function() {
}, () => {
// 获取退款/售后单列表
_this.getRefundList();
});
@ -102,24 +122,52 @@ Page({
/**
* 下拉到底加载数据
*/
triggerDownLoad: function() {
onPageDown() {
let _this = this;
// 已经是最后一页
if (this.data.page >= this.data.list.last_page) {
this.setData({
no_more: true
if (_this.data.page >= _this.data.list.last_page) {
_this.setData({
isLastPage: true
});
return false;
}
// 获取退款/售后单列表
this.getRefundList(true, ++this.data.page);
_this.getRefundList(true, ++_this.data.page);
},
/**
* 跳转售后详情页
*/
triggerDetail: function(e) {
wx.navigateTo({
url: './detail/detail?order_refund_id=' + e.currentTarget.dataset.id
onTargetDetail(e) {
let _this = this;
// 跳转售后详情页
const onCallback = () => {
wx.navigateTo({
url: `./detail/detail?order_refund_id=${e.currentTarget.dataset.id}`
});
};
// 请求用户订阅消息
_this._onRequestSubscribeMessage(onCallback);
},
/**
* 订阅消息 => [售后状态通知]
*/
_onRequestSubscribeMessage(callback) {
let _this = this;
let tmplItem = _this.data.submsgSetting.order.refund.template_id;
if (tmplItem.length == 0) {
callback && callback();
return;
}
wx.requestSubscribeMessage({
tmplIds: [tmplItem],
success(res) {},
fail(res) {},
complete(res) {
callback && callback();
},
});
},

View File

@ -6,7 +6,7 @@
</block>
</view>
<!-- 退款/售后单 -->
<scroll-view scroll-y="{{ true }}" bindscrolltolower="triggerDownLoad" style="height: {{swiperHeight}}px;">
<scroll-view scroll-y="{{ true }}" bindscrolltolower="onPageDown" style="height: {{swiperHeight}}px;">
<view class="widget-list" wx:if="{{ list.data.length }}">
<view class="widget-detail" wx:for="{{ list.data }}" wx:key="this" catchtap="triggerDetail" data-id="{{ item.order_refund_id }}">
<view class="row-block dis-flex flex-y-center">
@ -42,11 +42,11 @@
</view>
</view>
<view class="detail-operate row-block dis-flex flex-x-end flex-y-center">
<view class="detail-btn btn-detail" catchtap="triggerDetail" data-id="{{ item.order_refund_id }}">查看详情</view>
<view class="detail-btn btn-detail" catchtap="onTargetDetail" data-id="{{ item.order_refund_id }}">查看详情</view>
</view>
</view>
<!-- 没有更多 -->
<view wx:if="{{ list.data.length && !isLoading && no_more }}" class="no-more f-30">亲, 没有更多了</view>
<view wx:if="{{ list.data.length && !isLoading && isLastPage }}" class="no-more f-30">亲, 没有更多了</view>
</view>
<!-- 没有记录 -->
<view class="yoshop-notcont" wx:if="{{ !list.data.length && !isLoading }}">

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: []
},
/**
@ -40,6 +37,36 @@ Page({
_this.getSetting();
},
/**
* 点击立即分享,请求订阅消息
*/
onShare() {
let _this = this;
_this._onRequestSubscribeMessage();
},
/**
* 订阅消息 => [拼团进度通知]
*/
_onRequestSubscribeMessage(callback) {
let _this = this;
let tmplItem = _this.data.setting.order_submsg.active_status;
if (tmplItem.length == 0) {
callback && callback();
return;
}
wx.requestSubscribeMessage({
tmplIds: [tmplItem],
success(res) {},
fail(res) {},
complete(res) {
callback && callback();
},
});
},
/**
* 获取拼团详情
*/
@ -65,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;
@ -86,8 +111,6 @@ Page({
}
// 赋值页面数据
_this.setData(data);
// 执行倒计时函数
_this.onCountDown();
},
/**
@ -115,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) {
@ -195,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);
},
/**
* 查看拼团规则
*/
@ -281,7 +257,6 @@ Page({
*/
onIncGoodsNumber(e) {
let _this = this;
App.saveFormId(e.detail.formId);
_this.setData({
goods_num: ++_this.data.goods_num
})
@ -292,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
@ -315,7 +289,7 @@ Page({
},
/**
* 加入购物车and立即购买
* 立即参团
*/
onCheckout(e) {
let _this = this;
@ -323,16 +297,20 @@ Page({
if (!_this._onVerify()) {
return false;
}
// 立即购买
wx.navigateTo({
url: '../checkout/index?' + util.urlEncode({
order_type: 20,
active_id: _this.data.detail.active_id,
goods_id: _this.data.goods.goods_id,
goods_num: _this.data.goods_num,
goods_sku_id: _this.data.goods_sku_id,
})
});
// 立即参团
const onCommitCallback = () => {
wx.navigateTo({
url: '../checkout/index?' + util.urlEncode({
order_type: 20,
active_id: _this.data.detail.active_id,
goods_id: _this.data.goods.goods_id,
goods_num: _this.data.goods_num,
goods_sku_id: _this.data.goods_sku_id,
})
});
};
// 请求用户订阅消息
_this._onRequestSubscribeMessage(onCommitCallback);
},
/**
@ -361,26 +339,11 @@ Page({
onPreviewSkuImage(e) {
let _this = this;
wx.previewImage({
current: _this.data.image_path,
urls: [_this.data.image_path]
current: _this.data.skuCoverImage,
urls: [_this.data.skuCoverImage]
})
},
/**
* 分享当前页面
*/
onShareAppMessage() {
let _this = this;
// 构建页面参数
let params = App.getShareUrlParams({
'active_id': _this.data.detail.active_id
});
return {
title: _this.data.goods.goods_name,
path: "/pages/sharing/active/index?" + params
};
},
/**
* 确认购买弹窗
*/
@ -407,4 +370,36 @@ Page({
})
},
/**
* 分享当前页面
*/
onShareAppMessage() {
const _this = this;
// 构建页面参数
const params = App.getShareUrlParams({
'active_id': _this.data.detail.active_id
});
return {
title: _this.data.goods.goods_name,
path: "/pages/sharing/active/index?" + params
};
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
const _this = this;
// 构建页面参数
const params = App.getShareUrlParams({
'active_id': _this.data.detail.active_id
});
return {
title: _this.data.goods.goods_name,
path: "/pages/sharing/active/index?" + params
};
},
})

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,29 +44,26 @@
</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>
<!-- 操作按钮 -->
<block wx:if="{{ detail.status.value == 10 }}">
<button wx:if="{{ !is_join }}" catchtap="onTriggerOrder">立即参团</button>
<button wx:else open-type="share">立即分享</button>
<button wx:else open-type="share" catchtap="onShare">立即分享</button>
</block>
<button wx:else catchtap="onTargetGoods">去开团</button>
</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;
@ -507,4 +505,4 @@ view {
text-align: center;
font-size: 28rpx;
color: #444;
}
}

View File

@ -63,6 +63,8 @@ Page({
has_error: false,
error_msg: '',
notRefresh: false, // 不允许刷新
},
/**
@ -80,7 +82,7 @@ Page({
onShow() {
let _this = this;
// 获取当前订单信息
_this.getOrderData();
!_this.data.notRefresh && _this.getOrderData();
},
/**
@ -106,7 +108,7 @@ Page({
// 当前选择的配送方式
data.curDelivery = resData.delivery;
// 如果只有一种配送方式则不显示选项卡
data.isShowTab = resData.deliverySetting.length > 1;
data.isShowTab = resData.setting.delivery.length > 1;
// 上门自提联系信息
if (_this.data.linkman === '') {
data.linkman = resData.last_extract.linkman;
@ -154,8 +156,14 @@ Page({
* 快递配送选择收货地址
*/
onSelectAddress() {
let _this = this;
// 允许刷新
_this.setData({
notRefresh: false
});
// 跳转到选择自提点
wx.navigateTo({
url: '../../address/' + (this.data.exist_address ? 'index?from=flow' : 'create')
url: '../../address/' + (_this.data.exist_address ? 'index?from=flow' : 'create')
});
},
@ -165,6 +173,11 @@ Page({
onSelectExtractPoint() {
let _this = this,
selectedId = _this.data.selectedShopId;
// 允许刷新
_this.setData({
notRefresh: false
});
// 跳转到选择自提点
wx.navigateTo({
url: '../../_select/extract_point/index?selected_id=' + selectedId
});
@ -195,75 +208,100 @@ Page({
return false;
}
// 订单创建成功后回调--微信支付
let callback = result => {
if (result.code === -10) {
App.showError(result.msg, () => {
_this.redirectToOrderIndex();
});
return false;
}
// 发起微信支付
if (result.data.pay_type == PayTypeEnum.WECHAT.value) {
App.wxPayment({
payment: result.data.payment,
success: res => {
_this.redirectToOrderIndex();
},
fail: res => {
App.showError(result.msg.error, () => {
_this.redirectToOrderIndex();
});
},
});
}
// 余额支付
if (result.data.pay_type == PayTypeEnum.BALANCE.value) {
App.showSuccess(result.msg.success, () => {
_this.redirectToOrderIndex();
});
}
};
// 按钮禁用, 防止二次提交
_this.data.disabled = true;
// 显示loading
wx.showLoading({
title: '正在处理...'
});
// 提交到后端
const onCommitCallback = () => {
// 显示loading
wx.showLoading({
title: '正在处理...'
});
// 创建订单-立即购买
App._post_form('sharing.order/checkout', {
order_type: options.order_type || 10,
goods_id: options.goods_id,
goods_num: options.goods_num,
goods_sku_id: options.goods_sku_id,
delivery: _this.data.curDelivery || 0,
pay_type: _this.data.curPayType,
shop_id: _this.data.selectedShopId || 0,
linkman: _this.data.linkman,
phone: _this.data.phone,
active_id: options.active_id || 0,
coupon_id: _this.data.selectCouponId || 0,
is_use_points: _this.data.isUsePoints ? 1 : 0,
remark: _this.data.remark || '',
}, result => {
_this._onSubmitCallback(result);
}, result => {}, () => {
wx.hideLoading();
// 解除按钮禁用
_this.data.disabled = false;
// 不允许刷新
_this.setData({
notRefresh: true
});
});
};
// 请求用户订阅消息
_this._onRequestSubscribeMessage(onCommitCallback);
},
// 创建订单-立即购买
App._post_form('sharing.order/checkout', {
order_type: options.order_type || 10,
goods_id: options.goods_id,
goods_num: options.goods_num,
goods_sku_id: options.goods_sku_id,
delivery: _this.data.curDelivery || 0,
pay_type: _this.data.curPayType,
shop_id: _this.data.selectedShopId || 0,
linkman: _this.data.linkman,
phone: _this.data.phone,
active_id: options.active_id || 0,
coupon_id: _this.data.selectCouponId || 0,
is_use_points: _this.data.isUsePoints ? 1 : 0,
remark: _this.data.remark || '',
}, result => {
// success
console.log('success');
callback(result);
}, result => {
// fail
console.log('fail');
}, () => {
// complete
console.log('complete');
wx.hideLoading();
// 解除按钮禁用
_this.data.disabled = false;
/**
* 请求用户订阅消息
*/
_onRequestSubscribeMessage(onCommitCallback) {
let _this = this,
tmplIds = _this.data.setting.order_submsg;
if (tmplIds.length == 0) {
onCommitCallback();
return;
}
wx.requestSubscribeMessage({
tmplIds,
success(res) {},
fail(res) {},
complete(res) {
onCommitCallback();
},
});
},
/**
* 订单提交成功后回调
*/
_onSubmitCallback(result) {
let _this = this;
// 订单创建成功后回调--微信支付
if (result.code === -10) {
App.showError(result.msg, () => {
_this.redirectToOrderIndex();
});
return false;
}
// 发起微信支付
if (result.data.pay_type == PayTypeEnum.WECHAT.value) {
App.wxPayment({
payment: result.data.payment,
success: res => {
_this.redirectToOrderIndex();
},
fail: res => {
App.showError(result.msg.error, () => {
_this.redirectToOrderIndex();
});
},
});
}
// 余额支付
if (result.data.pay_type == PayTypeEnum.BALANCE.value) {
App.showSuccess(result.msg.success, () => {
_this.redirectToOrderIndex();
});
}
},
/**
* 表单验证
*/
@ -355,8 +393,6 @@ Page({
*/
onSelectPayType(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
// 设置当前支付方式
_this.setData({
curPayType: e.currentTarget.dataset.value
@ -411,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
@ -345,8 +327,8 @@ Page({
onPreviewSkuImage(e) {
let _this = this;
wx.previewImage({
current: _this.data.image_path,
urls: [_this.data.image_path]
current: _this.data.skuCoverImage,
urls: [_this.data.skuCoverImage]
})
},
@ -355,34 +337,16 @@ Page({
*/
onTargetToComment(e) {
let _this = this;
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: './comment/comment?goods_id=' + _this.data.goods_id
})
},
/**
* 分享当前页面
*/
onShareAppMessage() {
let _this = this;
// 构建页面参数
let params = App.getShareUrlParams({
'goods_id': _this.data.goods_id
});
return {
title: _this.data.detail.goods_name,
path: "/pages/sharing/goods/index?" + params
};
},
/**
* 显示分享选项
*/
onClickShare(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
_this.setData({
'share.show': true
});
@ -444,8 +408,6 @@ Page({
*/
onSavePoster(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
wx.showLoading({
title: '加载中',
});
@ -491,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
});
@ -506,8 +464,6 @@ Page({
* 显示拼团规则
*/
onToggleRules(e) {
// 记录formId
App.saveFormId(e.detail.formId);
// 显示拼团规则
let _this = this;
Dialog({
@ -526,7 +482,6 @@ Page({
* 返回主页
*/
onNavigationHome(e) {
App.saveFormId(e.detail.formId);
wx.switchTab({
url: '../../index/index',
})
@ -536,7 +491,6 @@ Page({
* 立即下单
*/
onTriggerOrder(e) {
console.log(App.saveFormId(e.detail.formId))
let _this = this;
// 设置当前购买类型
_this.setData({
@ -545,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);
},
/**
* 跳转到拼单页面
@ -605,4 +508,37 @@ Page({
url: '../active/index?active_id=' + e.currentTarget.dataset.id,
})
},
/**
* 分享当前页面
*/
onShareAppMessage() {
const _this = this;
// 构建页面参数
const params = App.getShareUrlParams({
'goods_id': _this.data.goods_id
});
return {
title: _this.data.detail.goods_name,
path: "/pages/sharing/goods/index?" + params
};
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
const _this = this;
// 构建页面参数
const params = App.getShareUrlParams({
'goods_id': _this.data.goods_id
});
return {
title: _this.data.detail.goods_name,
path: "/pages/sharing/goods/index?" + params
};
},
})

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 {
@ -597,4 +603,4 @@
.corwd_time button:after {
content: none;
border: none;
}
}

View File

@ -22,7 +22,7 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
onLoad(options) {
let _this = this;
// Api获取拼团首页
_this.setListHeight();
@ -35,7 +35,7 @@ Page({
getIndexData() {
let _this = this;
// 获取拼团首页
App._get('sharing.index/index', {}, function(result) {
App._get('sharing.index/index', {}, result => {
_this.setData({
categoryList: result.data.categoryList
});
@ -47,7 +47,7 @@ Page({
/**
* Api切换导航栏
*/
onSwitchTab: function(e) {
onSwitchTab(e) {
let _this = this;
// 第一步切换当前的分类id
_this.setData({
@ -69,8 +69,7 @@ Page({
App._get('sharing.goods/lists', {
page: page || 1,
category_id: _this.data.category_id
}, function(result) {
console.log(result)
}, result => {
let resList = result.data.list,
dataList = _this.data.goodsList;
if (isPage == true) {
@ -96,20 +95,10 @@ Page({
});
},
/**
* 分享当前页面
*/
onShareAppMessage: function() {
return {
title: '拼团首页',
path: "/pages/sharing/index/index?" + App.getShareUrlParams()
};
},
/**
* 下拉到底加载数据
*/
bindDownLoad: function() {
bindDownLoad() {
// 已经是最后一页
if (this.data.page >= this.data.goodsList.last_page) {
this.setData({
@ -124,16 +113,36 @@ Page({
/**
* 设置商品列表高度
*/
setListHeight: function() {
setListHeight() {
let systemInfo = wx.getSystemInfoSync(),
rpx = systemInfo.windowWidth / 750, // 计算rpx
tapHeight = Math.floor(rpx * 98), // tap高度
scrollHeight = systemInfo.windowHeight - tapHeight; // swiper高度
console.log(
systemInfo.windowHeight
);
this.setData({
scrollHeight
});
},
/**
* 分享当前页面
*/
onShareAppMessage() {
return {
title: '拼团首页',
path: "/pages/sharing/index/index?" + App.getShareUrlParams()
};
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
return {
title: '拼团首页',
path: "/pages/sharing/index/index?" + App.getShareUrlParams()
};
},
})

View File

@ -129,8 +129,6 @@ Page({
*/
onSelectPayType(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
// 隐藏支付方式弹窗
_this.onTogglePayPopup();
if (!_this.data.showPayPopup) {
@ -175,7 +173,7 @@ Page({
_this.getOrderDetail(orderId);
},
fail() {
App.showError(result.msg.success);
App.showError(result.msg.error);
},
});
}

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

@ -7,46 +7,66 @@ Page({
*/
data: {
applyStatus: [],
isLoading: true,
dataType: -1,
page: 1,
no_more: false,
submsgSetting: {}, // 订阅消息配置
list: [], // 列表数据
page: 1, // 当前页码
isLoading: true, // 是否正在加载中
isLastPage: false, // 当前是最后一页
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
onLoad(options) {
let _this = this;
// 设置swiper的高度
this.setSwiperHeight();
_this.setSwiperHeight();
// 获取订阅消息配置
_this.getSubmsgSetting();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
onShow() {
let _this = this;
// 获取退款/售后单列表
this.getRefundList();
_this.getRefundList();
},
/**
* 获取退款/售后单列表
*/
getRefundList: function(isNextPage, page) {
getRefundList(isNextPage, page) {
let _this = this;
App._get('sharing.refund/lists', {
state: _this.data.dataType,
page: page || 1,
}, function(result) {
}, (result) => {
// 创建页面数据
_this.setData(_this.createData(result.data, isNextPage));
});
},
/**
* 获取订阅消息配置
*/
getSubmsgSetting() {
let _this = this;
App._get('wxapp.submsg/setting', {}, (result) => {
_this.setData({
submsgSetting: result.data.setting
});
});
},
/**
* 创建页面数据
*/
createData: function(data, isNextPage) {
createData(data, isNextPage) {
data['isLoading'] = false;
// 列表数据
let dataList = this.data.list;
@ -67,7 +87,7 @@ Page({
/**
* 设置swiper的高度
*/
setSwiperHeight: function() {
setSwiperHeight() {
// 获取系统信息(拿到屏幕宽度)
let systemInfo = wx.getSystemInfoSync(),
rpx = systemInfo.windowWidth / 750, // 计算rpx
@ -81,7 +101,7 @@ Page({
/**
* 点击tab切换
*/
swichNav: function(e) {
swichNav(e) {
let _this = this,
current = e.target.dataset.current;
if (_this.data.dataType == current) {
@ -91,9 +111,9 @@ Page({
dataType: current,
list: {},
page: 1,
no_more: false,
isLastPage: false,
isLoading: true,
}, function() {
}, () => {
// 获取退款/售后单列表
_this.getRefundList();
});
@ -102,24 +122,52 @@ Page({
/**
* 下拉到底加载数据
*/
triggerDownLoad: function() {
onPageDown() {
let _this = this;
// 已经是最后一页
if (this.data.page >= this.data.list.last_page) {
this.setData({
no_more: true
if (_this.data.page >= _this.data.list.last_page) {
_this.setData({
isLastPage: true
});
return false;
}
// 获取退款/售后单列表
this.getRefundList(true, ++this.data.page);
_this.getRefundList(true, ++_this.data.page);
},
/**
* 跳转售后详情页
*/
triggerDetail: function(e) {
wx.navigateTo({
url: './detail/detail?order_refund_id=' + e.currentTarget.dataset.id
onTargetDetail(e) {
let _this = this;
// 跳转售后详情页
const onCallback = () => {
wx.navigateTo({
url: `./detail/detail?order_refund_id=${e.currentTarget.dataset.id}`
});
};
// 请求用户订阅消息
_this._onRequestSubscribeMessage(onCallback);
},
/**
* 订阅消息 => [售后状态通知]
*/
_onRequestSubscribeMessage(callback) {
let _this = this;
let tmplItem = _this.data.submsgSetting.order.refund.template_id;
if (tmplItem.length == 0) {
callback && callback();
return;
}
wx.requestSubscribeMessage({
tmplIds: [tmplItem],
success(res) {},
fail(res) {},
complete(res) {
callback && callback();
},
});
},

View File

@ -6,7 +6,7 @@
</block>
</view>
<!-- 退款/售后单 -->
<scroll-view scroll-y="{{ true }}" bindscrolltolower="triggerDownLoad" style="height: {{swiperHeight}}px;">
<scroll-view scroll-y="{{ true }}" bindscrolltolower="onPageDown" style="height: {{swiperHeight}}px;">
<view class="widget-list" wx:if="{{ list.data.length }}">
<view class="widget-detail" wx:for="{{ list.data }}" wx:key="this" catchtap="triggerDetail" data-id="{{ item.order_refund_id }}">
<view class="row-block dis-flex flex-y-center">
@ -36,11 +36,11 @@
<text class="col-m">¥{{ item.order_goods.total_pay_price }}</text>
</view>
<view class="detail-operate row-block dis-flex flex-x-end flex-y-center">
<view class="detail-btn btn-detail" catchtap="triggerDetail" data-id="{{ item.order_refund_id }}">查看详情</view>
<view class="detail-btn btn-detail" catchtap="onTargetDetail" data-id="{{ item.order_refund_id }}">查看详情</view>
</view>
</view>
<!-- 没有更多 -->
<view wx:if="{{ list.data.length && !isLoading && no_more }}" class="no-more f-30">亲, 没有更多了</view>
<view wx:if="{{ list.data.length && !isLoading && isLastPage }}" class="no-more f-30">亲, 没有更多了</view>
</view>
<!-- 没有记录 -->
<view class="yoshop-notcont" wx:if="{{ !list.data.length && !isLoading }}">

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,19 +53,18 @@ Page({
// 返回顶部
showTopWidget: false,
// 倒计时
actEndTimeList: [],
active: {}, // 秒杀活动详情
goods: {}, // 商品详情
countDownTime: false // 倒计时
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let _this = this,
const _this = this,
scene = App.getSceneData(options);
// 秒杀商品id
_this.setData({
@ -81,14 +72,16 @@ Page({
sharp_goods_id: options.sharp_goods_id ? options.sharp_goods_id : scene.gid,
});
// 获取秒杀商品信息
_this.getActiveDetail();
_this.onRefreshPage();
},
/**
* 生命周期函数--监听页面显示
* 刷新页面数据
*/
onShow(options) {
onRefreshPage() {
// 获取秒杀商品信息
const _this = this
_this.getActiveDetail()
},
/**
@ -100,12 +93,12 @@ Page({
active_time_id: _this.data.active_time_id,
sharp_goods_id: _this.data.sharp_goods_id,
}, (result) => {
const data = result.data
// 初始化详情数据
let data = _this._initData(result.data);
_this.setData(data);
// 执行倒计时
CountDown.onSetTimeList(_this, 'actEndTimeList');
});
_this._initData(data);
// 初始化倒计时组件
_this._initCountDownData(data);
})
},
/**
@ -134,12 +127,20 @@ Page({
if (goodsDetail.spec_type == 20) {
data.goodsMultiSpec = _this._initManySpecData(goodsDetail.goods_multi_spec);
}
// 记录活动到期时间
data.actEndTimeList = [{
date: data.active.active_status == ActiveStatusEnum.STATE_SOON.value ?
data.active.start_time : data.active.end_time
}];
return data;
_this.setData(data)
},
/**
* 初始化倒计时组件
*/
_initCountDownData(data) {
const app = this
// 记录倒计时的时间
const countDownTime = data.active.active_status == ActiveStatusEnum.STATE_SOON.value ?
data.active.start_time : data.active.end_time
app.setData({
countDownTime
})
},
/**
@ -158,6 +159,15 @@ Page({
return data;
},
// 倒计时结束刷新页面
onCountDownEnd() {
const app = this
console.log('onCountDownEnd')
setTimeout(() => {
app.onRefreshPage()
}, 200)
},
/**
* 点击切换不同规格
*/
@ -166,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) {
@ -282,8 +290,6 @@ Page({
*/
onClickShare(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
_this.setData({
'share.show': true
});
@ -346,8 +352,6 @@ Page({
*/
onSavePoster(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
wx.showLoading({
title: '加载中',
});
@ -395,7 +399,6 @@ Page({
*/
onIncGoodsNumber(e) {
let _this = this;
App.saveFormId(e.detail.formId);
_this.setData({
goods_num: ++_this.data.goods_num
})
@ -406,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
@ -431,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
});
@ -447,8 +445,6 @@ Page({
*/
onCheckout(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
// 表单验证
if (!_this._onVerify()) {
return false;
@ -494,25 +490,41 @@ Page({
* 跳转到首页
*/
onTargetHome(e) {
// 记录formid
App.saveFormId(e.detail.formId);
wx.switchTab({
url: '../../index/index',
})
},
/**
* 用户点击右上角分享
* 分享当前页面
*/
onShareAppMessage() {
let _this = this;
const _this = this;
// 构建页面参数
let params = App.getShareUrlParams({
const params = App.getShareUrlParams({
active_time_id: _this.data.active_time_id,
sharp_goods_id: _this.data.sharp_goods_id,
});
return {
title: _this.data.detail.goods_name,
title: _this.data.goods.goods_name,
path: `/pages/sharp/goods/index?${params}`
};
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
const _this = this;
// 构建页面参数
const params = App.getShareUrlParams({
active_time_id: _this.data.active_time_id,
sharp_goods_id: _this.data.sharp_goods_id,
});
return {
title: _this.data.goods.goods_name,
path: `/pages/sharp/goods/index?${params}`
};
},

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

@ -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,12 @@
<text>{{ goods.selling_point }}</text>
</view>
<!-- 活动倒计时 -->
<view wx:if="{{ active.active_status != ActiveStatusEnum.STATE_END.value }}" class="info-item info-item_status info-item_countdown">
<view wx:if="{{ active.active_status != ActiveStatusEnum.STATE_END.value }}"
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>距离秒杀{{ active.active_status == ActiveStatusEnum.STATE_SOON.value ? '开始' : '结束' }} 还剩{{ item.dynamic.hou }}时{{ item.dynamic.min }}分{{ item.dynamic.sec }}秒</text>
</block>
<text>距离秒杀{{ active.active_status == ActiveStatusEnum.STATE_SOON.value ? '开始' : '结束' }}</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">
@ -162,7 +164,8 @@
<!-- 操作按钮 -->
<view class="foo-item-trigger flex-box">
<form bindsubmit="onToggleTrade" report-submit>
<button wx:if="{{ active.active_status == ActiveStatusEnum.STATE_BEGIN.value }}" class="opt-btn btn-main btn-normal" form-type="submit">
<button wx:if="{{ active.active_status == ActiveStatusEnum.STATE_BEGIN.value }}"
class="opt-btn btn-main btn-normal" form-type="submit">
<text>立即购买</text>
</button>
<button wx:else class="opt-btn btn-gray btn-normal">
@ -174,7 +177,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">
@ -183,7 +188,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>
@ -232,9 +237,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>
@ -246,11 +254,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>

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,8 +19,7 @@ Page({
StateEnum, // 枚举类:秒杀会场活动状态
// 倒计时
countDownList: [],
countDownTime: false, // 倒计时日期
// 秒杀活动场次
tabbar: [],
@ -40,46 +33,79 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const _this = this;
_this.onRefreshPage()
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let _this = this;
if (_this.data.curTabIndex == 0) {
// 获取列表数据
_this.getApiData();
}
// const _this = this;
// if (_this.data.curTabIndex == 0) {
// // 刷新页面
// _this.onRefreshPage()
// }
},
/**
* 获取列表数据
* 刷新页面数据
*/
onRefreshPage() {
const _this = this
return new Promise((resolve, reject) => {
// 获取列表数据
_this.getApiData().then(() => {
resolve()
})
})
},
/**
* 下拉刷新
*/
onPullDownRefresh() {
// 获取首页数据
this.onRefreshPage().then(() => {
wx.stopPullDownRefresh()
})
},
/**
* 获取页面数据
*/
getApiData() {
let _this = this;
App._get('sharp.index/index', {}, (result) => {
_this.setData(result.data);
// 初始化倒计时组件
_this._initCountDownData();
});
const app = this;
return new Promise((resolve, reject) => {
App._get('sharp.index/index', {}, (result) => {
const data = result.data
app.setData(data);
// 初始化倒计时组件
app._initCountDownData();
resolve(data)
});
})
},
/**
* 初始化倒计时组件
*/
_initCountDownData(data) {
let _this = this,
curTabbar = _this.data.tabbar[_this.data.curTabIndex];
_initCountDownData() {
const app = this,
curTabbar = app.data.tabbar[app.data.curTabIndex];
// 记录倒计时的时间
_this.setData({
[`countDownList[0]`]: {
date: curTabbar.count_down_time,
}
});
// 执行倒计时
CountDown.onSetTimeList(_this, 'countDownList');
app.setData({
countDownTime: curTabbar.count_down_time
})
},
// 倒计时结束刷新页面
onCountDownEnd() {
console.log('onCountDownEnd')
const app = this
setTimeout(() => {
app.onRefreshPage()
}, 200)
},
/**
@ -87,11 +113,10 @@ Page({
*/
onToggleTab(e) {
let _this = this;
// 保存formid
App.saveFormId(e.detail.formId);
// 设置当前tabbar索引并重置数据
const curTabIndex = e.currentTarget.dataset.index
_this.setData({
curTabIndex: e.detail.target.dataset.index,
curTabIndex,
goodsList: [],
page: 1,
isLoading: true,
@ -104,13 +129,11 @@ Page({
},
/**
* 跳转到砍价商品详情
* 跳转到秒杀商品详情
*/
onTargetActive(e) {
let _this = this,
curTabbar = _this.data.tabbar[_this.data.curTabIndex];
// 保存formid
App.saveFormId(e.detail.formId);
let query = util.urlEncode({
active_time_id: curTabbar.active_time_id,
sharp_goods_id: e.detail.target.dataset.id,
@ -146,7 +169,7 @@ Page({
*/
getGoodsList(isNextPage) {
let _this = this,
curTabbar = _this.data.tabbar[_this.data.curTabIndex];;
curTabbar = _this.data.tabbar[_this.data.curTabIndex];
App._get('sharp.goods/lists', {
page: _this.data.page || 1,
active_time_id: curTabbar.active_time_id
@ -168,12 +191,27 @@ Page({
},
/**
* 用户点击右上角分享
* 分享当前页面
*/
onShareAppMessage() {
let _this = this;
const _this = this;
// 构建页面参数
let params = App.getShareUrlParams();
const params = App.getShareUrlParams();
return {
title: '整点秒杀',
path: `/pages/sharp/index/index?${params}`
};
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
const _this = this;
// 构建页面参数
const params = App.getShareUrlParams();
return {
title: '整点秒杀',
path: `/pages/sharp/index/index?${params}`

View File

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

View File

@ -2,21 +2,19 @@
<!-- 商品分类tab -->
<view class="sharp-tabs">
<scroll-view scroll-x="{{ true }}" scroll-left="{{ true }}">
<form bindsubmit="onToggleTab" report-submit="true">
<view class="sharp-tabs--container dis-flex">
<button wx:for="{{ tabbar }}" wx:key="this" formType="submit" class="btn-normal" data-index="{{ index }}">
<view class="tabs-item {{ curTabIndex == index ? 'active' : '' }} dis-flex flex-dir-column flex-x-center flex-y-center">
<block wx:if="{{ item.status == StateEnum.ACTIVE_STATE_NOTICE.value }}">
<view class="item-title">{{ item.status_text }}</view>
</block>
<block wx:else>
<view class="item-time">{{ item.active_time }}</view>
<view class="item-status">{{ item.status_text }}</view>
</block>
</view>
</button>
<view class="sharp-tabs--container dis-flex">
<view wx:for="{{ tabbar }}" wx:key="this" data-index="{{ index }}"
class="tabs-item {{ curTabIndex == index ? 'active' : '' }} dis-flex flex-dir-column flex-x-center flex-y-center"
catchtap="onToggleTab">
<block wx:if="{{ item.status == StateEnum.ACTIVE_STATE_NOTICE.value }}">
<view class="item-title">{{ item.status_text }}</view>
</block>
<block wx:else>
<view class="item-time">{{ item.active_time }}</view>
<view class="item-status">{{ item.status_text }}</view>
</block>
</view>
</form>
</view>
<view class="sharp-tabs--empty"></view>
</scroll-view>
</view>
@ -25,38 +23,21 @@
<!-- 活动状态 -->
<view class="active-status">
<text class="active-status--icon iconfont icon-artboard"></text>
<text class="active-status--time" wx:if="{{ tabbar[curTabIndex].status != StateEnum.ACTIVE_STATE_NOTICE.value }}">{{ tabbar[curTabIndex].active_time }}</text>
<text class="active-status--time"
wx:if="{{ tabbar[curTabIndex].status != StateEnum.ACTIVE_STATE_NOTICE.value }}">{{ tabbar[curTabIndex].active_time }}</text>
<text class="active-status--text">{{ tabbar[curTabIndex].status_text2 }}</text>
</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>{{ 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>
<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 class="bargain-hall">
<!-- 商品列表 -->
<view class="goods-item" wx:for="{{ goodsList.data }}" wx:key="this">
<form bindsubmit="onTargetActive" report-submit="true">
<form bindsubmit="onTargetActive">
<button formType="submit" class="btn-normal" data-id="{{ item.sharp_goods_id }}">
<view class="goods-item--container dis-flex">
<!-- 商品图片 -->

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 {
@ -139,7 +123,7 @@ page, .container {
.goods-item .goods-info .goods-name {
font-size: 28rpx;
min-height: 76rpx;
min-height: 72rpx;
margin-bottom: 20rpx;
}

View File

@ -34,21 +34,6 @@ Page({
});
},
/**
* 分享当前页面
*/
onShareAppMessage() {
let _this = this;
// 构建页面参数
let params = App.getShareUrlParams({
'shop_id': _this.data.detail.shop_id
});
return {
title: _this.data.detail.article_title,
path: "/pages/shop/detail/index?" + params
};
},
/**
* 拨打电话
*/
@ -74,4 +59,36 @@ Page({
});
},
/**
* 分享当前页面
*/
onShareAppMessage() {
const _this = this;
// 构建页面参数
const params = App.getShareUrlParams({
'shop_id': _this.data.detail.shop_id
});
return {
title: _this.data.detail.article_title,
path: "/pages/shop/detail/index?" + params
};
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
const _this = this;
// 构建页面参数
const params = App.getShareUrlParams({
'shop_id': _this.data.detail.shop_id
});
return {
title: _this.data.detail.article_title,
path: "/pages/shop/detail/index?" + params
};
},
})

View File

@ -28,6 +28,8 @@ Page({
});
// 获取当前用户信息
_this.getUserDetail();
// 更新购物车角标
App.setCartTabBadge()
},
/**
@ -35,7 +37,7 @@ Page({
*/
getUserDetail() {
let _this = this;
App._get('user.index/detail', {}, function(result) {
App._get('user.index/detail', {}, function (result) {
_this.setData(result.data);
});
},
@ -48,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',
@ -70,8 +70,6 @@ Page({
if (!_this.onCheckLogin()) {
return false;
}
// 记录formId
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: '/' + e.currentTarget.dataset.url
})
@ -85,8 +83,6 @@ Page({
if (!_this.onCheckLogin()) {
return false;
}
// 记录formId
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: './wallet/index'
})
@ -100,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;
}
@ -362,4 +367,4 @@
button:after {
content: none;
border: none;
}
}

View File

@ -6,51 +6,71 @@ import util from './util.js';
*/
module.exports = {
onSetTimeList(page, dataIndex) {
let _this = this;
// 获取当前时间,同时得到活动结束时间数组
let newTime = new Date().getTime(),
newData = [];
// 对结束时间进行处理渲染到页面
page.data[dataIndex].forEach(item => {
let endTime = new Date(util.format_date(item.date)).getTime();
let dynamic = {
// day: '00',
hou: '00',
min: '00',
sec: '00'
};
// 如果活动未结束,对时间进行处理
if (endTime - newTime > 0) {
let diffTime = (endTime - newTime) / 1000;
// 计时器句柄
countIds: {},
// 获取时、分、秒
// day = parseInt(diffTime / 86400),
let hou = parseInt(diffTime / 3600),
min = parseInt(diffTime % 3600 / 60),
sec = parseInt(diffTime % 3600 % 60);
dynamic = {
hou: _this.timeFormat(hou),
min: _this.timeFormat(min),
sec: _this.timeFormat(sec)
}
}
newData.push({
date: item.date,
dynamic
});
})
start(countId, app, dataIndex, endCallBack) {
// console.log('start')
this.onSetTimeList(countId, app, dataIndex, endCallBack, 0)
},
onSetTimeList(countId, app, dataIndex, endCallBack, deep = 0) {
const _this = this;
// 获取倒计时数据对象
const countDownObj = app.data[dataIndex]
// 获取当前时间,同时得到活动结束时间数组
const newTime = new Date().getTime()
// 对结束时间进行处理渲染到页面
const endTime = new Date(util.format_date(countDownObj.date)).getTime();
// 初始化倒计时数据
countDownObj.dynamic = {
// day: '00',
hou: '00',
min: '00',
sec: '00'
};
// 如果活动未结束,对时间进行处理
if (endTime - newTime > 0) {
const diffTime = (endTime - newTime) / 1000;
// 获取时、分、秒
// day = parseInt(diffTime / 86400),
const hou = parseInt(diffTime / 3600),
min = parseInt(diffTime % 3600 / 60),
sec = parseInt(diffTime % 3600 % 60);
countDownObj.dynamic.hou = _this.timeFormat(hou)
countDownObj.dynamic.min = _this.timeFormat(min)
countDownObj.dynamic.sec = _this.timeFormat(sec)
}
// 渲染,然后每隔一秒执行一次倒计时函数
page.setData({
[`${dataIndex}`]: newData
});
app.setData({
[`${dataIndex}`]: countDownObj
})
// 判断倒计时是否结束
const isEnd = _this.isEnd(countDownObj);
// 结束后执行回调函数
isEnd && deep > 0 && endCallBack && endCallBack();
// 重复执行
setTimeout(() => {
this.onSetTimeList(page, dataIndex)
}, 1000);
_this.countIds[countId] && clearTimeout(_this.countIds[countId])
if (!isEnd) {
_this.countIds[countId] = setTimeout(() => {
_this.onSetTimeList(countId, app, dataIndex, endCallBack, ++deep)
}, 1000)
}
},
/**
* 判断倒计时是否结束
* @param {*} countDownObj
*/
isEnd(countDownObj) {
const {
dynamic
} = countDownObj
if (dynamic.hou == '00' && dynamic.min == '00' && dynamic.sec == '00') {
return true
}
return false
},
/**

View File

@ -1,4 +1,4 @@
let App = getApp();
const App = getApp();
/**
* 拼团扩展类

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More