Compare commits

..

No commits in common. "5b78b2b4e2e78099f9f499a4ad0680ffffdcf879" and "95200f872e47449415c95c4cc59694db2f74ba7a" have entirely different histories.

103 changed files with 1271 additions and 2630 deletions

116
README.md
View File

@ -10,122 +10,6 @@
## 更新日志
### 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
```

106
app.js
View File

@ -60,16 +60,8 @@ App({
* 记录推荐人id
*/
saveRefereeId(refereeId) {
let App = this;
refereeId = parseInt(refereeId);
if (refereeId <= 0 || refereeId == App.getUserId()) {
return false;
}
if (wx.getStorageSync('referee_id')) {
return false;
}
if (!wx.getStorageSync('referee_id'))
wx.setStorageSync('referee_id', refereeId);
return true;
},
/**
@ -83,26 +75,8 @@ App({
* 当小程序启动或从后台进入前台显示会触发 onShow
*/
onShow(options) {
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) {
}
// 获取小程序基础信息
// this.getWxappBase();
},
/**
@ -139,7 +113,7 @@ App({
mask: true,
duration: 1500,
success() {
callback && (setTimeout(() => {
callback && (setTimeout(function() {
callback();
}, 1500));
}
@ -155,7 +129,7 @@ App({
content: msg,
showCancel: false,
success(res) {
// callback && (setTimeout(() => {
// callback && (setTimeout(function() {
// callback();
// }, 1500));
callback && callback();
@ -177,7 +151,7 @@ App({
// check_login = true;
// 构造get请求
let request = () => {
let request = function() {
data.token = wx.getStorageSync('token');
wx.request({
url: _this.api_root + url,
@ -196,7 +170,7 @@ App({
wx.hideNavigationBarLoading();
_this.doLogin(2);
} else if (res.data.code === 0) {
_this.showError(res.data.msg, () => {
_this.showError(res.data.msg, function() {
fail && fail(res);
});
return false;
@ -205,7 +179,7 @@ App({
}
},
fail(res) {
_this.showError(res.errMsg, () => {
_this.showError(res.errMsg, function() {
fail && fail(res);
});
},
@ -251,7 +225,7 @@ App({
_this.doLogin(1);
return false;
} else if (res.data.code === 0) {
_this.showError(res.data.msg, () => {
_this.showError(res.data.msg, function() {
fail && fail(res);
});
return false;
@ -260,7 +234,7 @@ App({
},
fail(res) {
// console.log(res);
_this.showError(res.errMsg, () => {
_this.showError(res.errMsg, function() {
fail && fail(res);
});
},
@ -288,11 +262,11 @@ App({
return false;
}
const updateManager = wx.getUpdateManager();
updateManager.onCheckForUpdate(res => {
updateManager.onCheckForUpdate(function(res) {
// 请求完新版本信息的回调
// console.log(res.hasUpdate)
});
updateManager.onUpdateReady(() => {
updateManager.onUpdateReady(function() {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,即将重启应用',
@ -305,7 +279,7 @@ App({
}
});
});
updateManager.onUpdateFailed(() => {
updateManager.onUpdateFailed(function() {
// 新的版本下载失败
wx.showModal({
title: '更新提示',
@ -346,18 +320,16 @@ App({
/**
* 记录formId
* (因微信模板消息已下线所以formId取消不再收集)
*/
saveFormId(formId) {
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);
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);
},
/**
@ -408,8 +380,11 @@ App({
/**
* 授权登录
*/
getUserInfo(userInfo, callback) {
getUserInfo(e, callback) {
let App = this;
if (e.detail.errMsg !== 'getUserInfo:ok') {
return false;
}
wx.showLoading({
title: "正在登录",
mask: true
@ -420,7 +395,10 @@ App({
// 发送用户信息
App._post_form('user/login', {
code: res.code,
user_info: JSON.stringify(userInfo),
user_info: e.detail.rawData,
encrypted_data: e.detail.encryptedData,
iv: e.detail.iv,
signature: e.detail.signature,
referee_id: wx.getStorageSync('referee_id')
}, result => {
// 记录token user_id
@ -435,30 +413,4 @@ 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,8 +57,7 @@
"pages/bargain/goods/index",
"pages/points/log/index",
"pages/sharp/index/index",
"pages/sharp/goods/index",
"pages/live/index"
"pages/sharp/goods/index"
],
"window": {
"navigationBarBackgroundColor": "#ffffff",

View File

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

View File

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

View File

@ -1,130 +0,0 @@
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

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

View File

@ -1,15 +0,0 @@
<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

@ -1,33 +0,0 @@
.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="this">
<block wx:for="{{ buttons }}" wx:key="{{ item.text }}-{{ item.type }}">
<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,6 +27,8 @@ 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,6 +27,8 @@ 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,6 +24,8 @@ Component({
* 跳转到搜索页面
*/
onTargetSearch(e) {
// 记录formid
App.saveFormId(e.detail.formId);
App.navigationTo('pages/search/index');
},
}

View File

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

View File

@ -27,6 +27,8 @@ 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,7 +1,13 @@
import util from '../../../utils/util.js';
import ActiveStatusEnum from '../../../utils/enum/sharp/GoodsStatus.js';
const App = getApp();
const App = getApp()
// 工具类
import util from '../../../utils/util.js';
// 倒计时插件
import CountDown from '../../../utils/countdown.js';
// 枚举类:秒杀活动商品状态
import ActiveStatusEnum from '../../../utils/enum/sharp/GoodsStatus.js';
Component({
@ -25,7 +31,7 @@ Component({
*/
data: {
ActiveStatusEnum, // 秒杀活动商品状态
countDownTime: false, // 倒计时日期
countDownList: [], // 倒计时
},
/**
@ -39,7 +45,7 @@ Component({
attached() {
let _this = this;
_this._initCountDownData();
}
},
},
@ -51,10 +57,13 @@ Component({
*/
methods: {
/**
* 跳转商品详情页
*/
_onTargetGoods(e) {
// 记录formid
App.saveFormId(e.detail.formId);
// 生成query参数
let _this = this,
query = util.urlEncode({
@ -71,6 +80,8 @@ Component({
* 更多秒杀
*/
_onTargetSharpIndex(e) {
// 记录formid
App.saveFormId(e.detail.formId);
// 跳转到秒杀会场首页
wx.navigateTo({
url: `/pages/sharp/index/index`,
@ -80,15 +91,19 @@ Component({
/**
* 初始化倒计时组件
*/
_initCountDownData() {
const app = this
const active = app.data.data.active
_initCountDownData(data) {
let _this = this,
active = _this.data.data.active;
if (!active) return false;
// 记录倒计时的时间
app.setData({
countDownTime: active.count_down_time
})
_this.setData({
[`countDownList[0]`]: {
date: active.count_down_time,
}
});
// 执行倒计时
CountDown.onSetTimeList(_this, 'countDownList');
},
}
})

View File

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

View File

@ -11,7 +11,23 @@
</view>
<!-- 倒计时 -->
<view wx:if="{{ data.active.status == ActiveStatusEnum.STATE_BEGIN.value }}" class="active-count-down">
<countdown wx:if="{{ countDownTime }}" date="{{ countDownTime }}" style="custom" />
<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>
</view>
</view>
<view class="sharp-top--right">
@ -47,10 +63,8 @@
</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,6 +26,8 @@ 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,6 +27,8 @@ Component({
* 跳转文章首页
*/
_onTargetIndex(e) {
// 记录formid
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: '/pages/article/index'
});
@ -36,6 +38,8 @@ 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: {
addGlobalClass: true,
multipleSlots: true // 在组件定义时的选项中启用多slot支持
},
/**
@ -40,6 +40,8 @@ Component({
* 导航菜单切换事件
*/
_onToggleShow(e) {
// 记录formid
App.saveFormId(e.detail.formId);
this.setData({
isShow: !this.data.isShow,
transparent: false
@ -51,6 +53,8 @@ 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 .iconfont {
.nav-item text {
font-size: 40rpx;
}

View File

@ -1,36 +0,0 @@
'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

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

View File

@ -1,30 +0,0 @@
<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

@ -1,58 +0,0 @@
.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
}

View File

@ -1,134 +0,0 @@
'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,6 +32,8 @@ Page({
values = e.detail.value
values.region = this.data.region;
// 记录formId
App.saveFormId(e.detail.formId);
// 表单验证
if (!_this.validation(values)) {

View File

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

View File

@ -47,7 +47,7 @@ Page({
*/
onShareAppMessage() {
// 构建页面参数
const params = App.getShareUrlParams({
let params = App.getShareUrlParams({
'article_id': this.data.detail.article_id
});
return {
@ -56,20 +56,4 @@ 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

@ -24,12 +24,6 @@ Page({
*/
onLoad: function(options) {
let _this = this;
// 设置默认的分类
if (options.category_id) {
_this.setData({
category_id: options.category_id
})
}
// 设置文章列表高度
_this.setListHeight();
// Api获取文章首页
@ -102,6 +96,16 @@ Page({
});
},
/**
* 分享当前页面
*/
onShareAppMessage() {
return {
title: '文章首页',
path: "/pages/article/index?" + App.getShareUrlParams()
};
},
/**
* 下拉到底加载数据
*/
@ -125,31 +129,11 @@ 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,8 +1,19 @@
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';
const App = getApp()
let goodsSpecArr = []
// 记录规格的数组
let goodsSpecArr = [];
Page({
@ -49,7 +60,9 @@ Page({
// 返回顶部
showTopWidget: false,
countDownTime: false, // 倒计时日期
// 倒计时
actEndTimeList: [],
active: {}, // 砍价活动详情
goods: {}, // 商品详情
@ -89,10 +102,13 @@ Page({
active_id: _this.data.active_id
}, (result) => {
// 初始化详情数据
const data = result.data
_this._initData(data)
// 初始化倒计时组件
_this._initCountDownData(data)
let data = _this._initData(result.data);
_this.setData(data);
// 执行倒计时
if (!data.active.is_end) {
CountDown.onSetTimeList(_this, 'actEndTimeList');
}
});
},
@ -123,22 +139,12 @@ Page({
data.goodsMultiSpec = _this._initManySpecData(goodsDetail.goods_multi_spec);
}
// 记录活动到期时间
data.countDownObj = [{
data.actEndTimeList = [{
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
})
},
/**
* 初始化商品多规格
*/
@ -163,6 +169,8 @@ 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) {
@ -277,6 +285,8 @@ Page({
*/
onClickShare(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
_this.setData({
'share.show': true
});
@ -338,6 +348,8 @@ Page({
*/
onSavePoster(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
wx.showLoading({
title: '加载中',
});
@ -383,8 +395,12 @@ Page({
/**
* 确认购买弹窗
*/
onToggleTrade() {
onToggleTrade(e) {
let _this = this;
if (typeof e === 'object') {
// 记录formId
e.detail.hasOwnProperty('formId') && App.saveFormId(e.detail.formId);
}
_this.setData({
showBottomPopup: !_this.data.showBottomPopup
});
@ -394,6 +410,8 @@ Page({
* 显示砍价规则
*/
onToggleRules(e) {
// 记录formId
App.saveFormId(e.detail.formId);
// 显示砍价规则
let _this = this;
Dialog({
@ -414,6 +432,8 @@ Page({
*/
onSubmit(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
// 判断是否已参与当前的砍价活动,如果已参与的话跳转到砍价任务
if (_this.data.is_partake) {
wx.navigateTo({
@ -435,6 +455,8 @@ Page({
*/
onSubmit2(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
// 关闭选择器
_this.onToggleTrade();
// 确认发起砍价
@ -480,35 +502,20 @@ Page({
* 跳转到首页
*/
onTargetHome(e) {
// 记录formid
App.saveFormId(e.detail.formId);
wx.switchTab({
url: '../../index/index',
})
},
/**
* 分享当前页面
* 用户点击右上角分享
*/
onShareAppMessage() {
const _this = this;
let _this = this;
// 构建页面参数
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({
let params = App.getShareUrlParams({
active_id: _this.data.active.active_id
});
return {

View File

@ -4,7 +4,6 @@
"zan-actionsheet": "/components/actionsheet/index",
"zan-dialog": "/components/dialog/index",
"zan-popup": "/components/popup/index",
"shortcut": "/components/shortcut/shortcut",
"countdown": "/components/countdown/index"
"shortcut": "/components/shortcut/shortcut"
}
}

View File

@ -8,8 +8,7 @@
<!-- 商品图片 -->
<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>
@ -48,7 +47,7 @@
</view>
<view class="goods-share__line"></view>
<view class="goods-share">
<form bindsubmit="onClickShare">
<form bindsubmit="onClickShare" report-submit="true">
<button formType="submit" class="share-btn dis-flex flex-dir-column">
<text class="share__icon iconfont icon-fenxiang"></text>
<text class="f-24">分享</text>
@ -61,11 +60,11 @@
<text>{{ goods.selling_point }}</text>
</view>
<!-- 活动倒计时 -->
<view wx:if="{{ !active.is_end }}" class="info-item info-item_status info-item_countdown dis-flex flex-y-center">
<view wx:if="{{ !active.is_end }}" class="info-item info-item_status info-item_countdown">
<text class="countdown-icon iconfont icon-naozhong"></text>
<text>距离活动结束</text>
<text class="m-r-10">还剩</text>
<countdown wx:if="{{ countDownTime }}" date="{{ countDownTime }}" />
<block wx:for="{{ actEndTimeList }}" wx:key="this">
<text>距离活动结束 还剩{{ item.dynamic.hou }}时{{ item.dynamic.min }}分{{ item.dynamic.sec }}秒</text>
</block>
</view>
<!-- 活动已结束 -->
<view wx:if="{{ active.is_end }}" class="info-item info-item_status info-item_end">
@ -76,7 +75,7 @@
<!-- 选择商品规格 -->
<!-- <view class="goods-choice m-top20 b-f">
<form wx:if="{{ goods.spec_type == 20 }}" bindsubmit="onToggleTrade">
<form wx:if="{{ goods.spec_type == 20 }}" bindsubmit="onToggleTrade" report-submit>
<button class="btn-normal" formType="submit">
<view class="sku-selector dis-flex flex-y-center">
<view class="flex-box f-28">
@ -93,7 +92,7 @@
<!-- 砍价玩法 -->
<view class="bargain-rules top-nav-bar m-top20 b-f">
<form bindsubmit="onToggleRules">
<form bindsubmit="onToggleRules" report-submit="true">
<button formType="submit" class="btn-normal">
<view class="item-title dis-flex">
@ -199,7 +198,7 @@
<view class="footer-container dis-flex">
<!-- 导航图标 -->
<view class="foo-item-fast dis-flex flex-x-center flex-y-center">
<form bindsubmit="onTargetHome">
<form bindsubmit="onTargetHome" report-submit>
<button class="btn-normal" formType="submit">
<view class="fast-item fast-item_home">
<view class="fast-icon">
@ -224,7 +223,7 @@
</view>
<!-- 操作按钮 -->
<view class="foo-item-trigger flex-box">
<form bindsubmit="onSubmit">
<form bindsubmit="onSubmit" report-submit>
<button wx:if="{{ active.is_start && !active.is_end }}" class="opt-btn btn-main btn-normal" formType="submit">
<text>{{ is_partake ? '继续砍价' : '立即砍价' }}</text>
</button>
@ -237,9 +236,7 @@
</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">
@ -248,7 +245,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">
<form bindsubmit="onSavePoster" report-submit="true">
<view class="poster__image">
<image mode="widthFix" src="{{ qrcode }}"></image>
</view>
@ -296,12 +293,9 @@
<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>
@ -314,11 +308,11 @@
<text>购买数量</text>
</view>
<view class="select-number">
<form bindsubmit="onDecGoodsNumber">
<form bindsubmit="onDecGoodsNumber" report-submit="true">
<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">
<form bindsubmit="onIncGoodsNumber" report-submit="true">
<button formType="submit" class="default" type="default">+</button>
</form>
</view>
@ -328,7 +322,7 @@
<!-- 底部操作栏 -->
<view class="footer-fixed f-30">
<view wx:if="{{ stock_num > 0 }}" class="flex-box">
<form bindsubmit="onSubmit2">
<form bindsubmit="onSubmit2" report-submit>
<button class="opt-btn btn-main btn-normal" formType="submit">
<text>确定</text>
</button>

View File

@ -1,6 +1,10 @@
import util from '../../../utils/util.js'
const App = getApp();
const App = getApp()
// 工具类
import util from '../../../utils/util.js';
// 倒计时插件
import CountDown from '../../../utils/countdown.js';
Page({
@ -133,14 +137,21 @@ Page({
* 初始化倒计时组件
*/
_initCountDownData(data) {
// let _this = this;
// // 记录活动到期时间
// let countDownList = _this.data.countDownList;
// data.myList.data.forEach((item) => {
// countDownList.push({
// date: item.end_time
// })
// })
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');
}
},
/**
@ -158,6 +169,8 @@ Page({
*/
onToggleTab(e) {
let _this = this;
// 保存formid
App.saveFormId(e.detail.formId);
// 设置当前tabbar索引并重置数据
_this.setData({
currentTab: e.currentTarget.dataset.index,
@ -175,6 +188,8 @@ Page({
* 跳转到砍价商品详情
*/
onTargetActive(e) {
// 保存formid
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: `../goods/index?active_id=${e.detail.target.dataset.id}`,
})
@ -184,6 +199,8 @@ Page({
* 跳转到砍价任务详情
*/
onTargetTask(e) {
// 保存formid
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: `../task/index?task_id=${e.detail.target.dataset.id}`,
})
@ -218,27 +235,12 @@ Page({
},
/**
* 分享当前页面
* 用户点击右上角分享
*/
onShareAppMessage() {
const _this = this;
let _this = this;
// 构建页面参数
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();
let params = App.getShareUrlParams();
return {
title: '砍价专区',
path: `/pages/bargain/index/index?${params}`

View File

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

View File

@ -1,8 +1,7 @@
<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 }}">
@ -105,8 +104,26 @@
<view class="task-status dis-flex flex-y-center">
<!-- 倒计时 -->
<view wx:if="{{ item.status }}" class="count-down dis-flex flex-y-center">
<text class="m-r-10">剩余</text>
<countdown date="{{ item.end_time }}" separator="colon" style="custom" />
<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>
</view>
<view wx:if="{{ !item.status }}" class="task-status__text">
<text class="col-m">{{ item.is_buy ? '砍价成功' : '已结束' }}</text>

View File

@ -1,7 +1,13 @@
import util from '../../../utils/util.js';
import Dialog from '../../../components/dialog/dialog';
const App = getApp();
const App = getApp()
// 工具类
import util from '../../../utils/util.js';
// 倒计时插件
import CountDown from '../../../utils/countdown.js';
// 对话框插件
import Dialog from '../../../components/dialog/dialog';
Page({
@ -9,7 +15,8 @@ Page({
* 页面的初始数据
*/
data: {
countDownTime: false, // 倒计时日期
// 砍价任务倒计时
taskEndTime: [],
task: {}, // 砍价任务详情
active: {}, // 活动详情
@ -64,15 +71,18 @@ Page({
* 初始化页面数据
*/
_initData(data) {
const app = this;
let _this = this;
// 初始化:显示操作按钮
app._initShowBtn(data)
// 记录页面数据
app.setData(data)
_this._initShowBtn(data);
// 记录活动到期时间
app.setData({
countDownTime: data.active.end_time
})
data.taskEndTime = [{
date: data.task.end_time
}];
_this.setData(data);
// 执行倒计时
if (!data.task.is_end) {
CountDown.onSetTimeList(_this, 'taskEndTime');
}
},
/**
@ -100,6 +110,8 @@ Page({
* 跳转到首页
*/
onTargetHome(e) {
// 记录formid
App.saveFormId(e.detail.formId);
wx.switchTab({
url: '../../index/index',
})
@ -109,6 +121,8 @@ Page({
* 显示砍价规则
*/
onToggleRules(e) {
// 记录formId
App.saveFormId(e.detail.formId);
// 显示砍价规则
let _this = this;
Dialog({
@ -129,6 +143,8 @@ Page({
*/
onTargetGoods(e) {
let _this = this;
// 记录formid
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: `../goods/index?active_id=${_this.data.task.active_id}`,
})
@ -138,6 +154,8 @@ Page({
* 跳转到砍价首页
*/
onTargetBargain(e) {
// 记录formid
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: '../index/index',
})
@ -148,6 +166,8 @@ Page({
*/
onHelpCut(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
// 按钮禁用时不允许操作(防重复提交)
if (_this.data.disabled == true) {
return false;
@ -180,6 +200,8 @@ Page({
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
// 跳转到结算台
let option = util.urlEncode({
@ -194,29 +216,12 @@ Page({
},
/**
* 分享当前页面
* 用户点击右上角分享
*/
onShareAppMessage() {
const _this = this;
let _this = this;
// 构建页面参数
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({
let params = App.getShareUrlParams({
task_id: _this.data.task_id
});
return {

View File

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

View File

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

View File

@ -32,14 +32,6 @@ Page({
_this.getCategoryList();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 更新购物车角标
App.setCartTabBadge()
},
/**
* 设置分类列表高度
*/
@ -86,24 +78,11 @@ Page({
* 设置分享内容
*/
onShareAppMessage() {
const _this = this;
let _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,6 +137,17 @@ Page({
this.getGoodsList(true, ++this.data.page);
},
/**
* 设置分享内容
*/
onShareAppMessage() {
// 构建分享参数
return {
title: "全部分类",
path: "/pages/category/index?" + App.getShareUrlParams()
};
},
/**
* 商品搜索
*/
@ -154,28 +165,4 @@ 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: 72rpx;
height: 76rpx;
line-height: 1.3;
}

View File

@ -52,6 +52,21 @@ Page({
})
},
/**
* 分享当前页面
*/
onShareAppMessage: function() {
let _this = this;
// 构建页面参数
let params = App.getShareUrlParams({
'page_id': _this.data.page_id
});
return {
title: _this.data.page.params.share_title,
path: "/pages/custom/index?" + params
};
},
/**
* 下拉刷新
*/
@ -60,38 +75,6 @@ Page({
this.getPageData(function() {
wx.stopPullDownRefresh();
});
},
/**
* 分享当前页面
*/
onShareAppMessage: 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
};
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
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,48 +9,31 @@ Page({
data: {
is_read: false,
disabled: false,
submsgSetting: {}, // 订阅消息配置
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let _this = this;
// 获取订阅消息配置
_this.getSubmsgSetting();
onLoad: function(options) {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let _this = this;
onShow: function() {
// 获取分销商申请状态
_this.getApplyState();
},
/**
* 获取订阅消息配置
*/
getSubmsgSetting() {
let _this = this;
App._get('wxapp.submsg/setting', {}, (result) => {
_this.setData({
submsgSetting: result.data.setting
});
});
this.getApplyState();
},
/**
* 获取分销商申请状态
*/
getApplyState() {
getApplyState: function() {
let _this = this;
App._get('user.dealer/apply', {
referee_id: _this.getRefereeid()
}, (result) => {
}, function(result) {
let data = result.data;
// 当前是否已经为分销商
if (data.is_dealer) {
@ -70,7 +53,7 @@ Page({
/**
* 显示申请协议
*/
toggleApplyLicense() {
toggleApplyLicense: function() {
Dialog({
title: '申请协议',
message: this.data.license,
@ -89,9 +72,8 @@ Page({
/**
* 已阅读
*/
toggleSetRead() {
let _this = this;
_this.setData({
toggleSetRead: function() {
this.setData({
is_read: !this.data.is_read
});
},
@ -99,10 +81,13 @@ Page({
/**
* 提交申请
*/
onFormSubmit(e) {
formSubmit: function(e) {
let _this = this,
values = e.detail.value;
// 记录formId
App.saveFormId(e.detail.formId);
// 验证姓名
if (!values.name || values.name.length < 1) {
App.showError('请填写姓名');
@ -127,10 +112,10 @@ Page({
});
// 数据提交
App._post_form('user.dealer.apply/submit', values, () => {
App._post_form('user.dealer.apply/submit', values, function() {
// 获取分销商申请状态
_this.getApplyState();
}, null, () => {
}, null, function() {
// 解除按钮禁用
_this.setData({
disabled: false
@ -141,33 +126,19 @@ Page({
/**
* 去商城逛逛
*/
navigationToIndex(e) {
navigationToIndex: function(e) {
// 记录formId
App.saveFormId(e.detail.formId);
// 跳转到首页
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() {
getRefereeid: function() {
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="onFormSubmit" report-submit="true">
<form bindsubmit="formSubmit" report-submit="true">
<view class="form-field dis-flex flex-y-center">
<view class="field-label">邀请人</view>
<view class="field-input">
@ -61,10 +61,6 @@
<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,13 +94,3 @@ 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,6 +57,8 @@ Page({
* 立即加入分销商
*/
triggerApply(e) {
// 记录formId
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: '../apply/apply',
})

View File

@ -10,46 +10,29 @@ Page({
words: {},
payment: 20,
submsgSetting: {}, // 订阅消息配置
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let _this = this;
// 获取订阅消息配置
_this.getSubmsgSetting();
onLoad: function(options) {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let _this = this;
onShow: function() {
// 获取分销商提现信息
_this.getDealerWithdraw();
},
/**
* 获取订阅消息配置
*/
getSubmsgSetting() {
let _this = this;
App._get('wxapp.submsg/setting', {}, (result) => {
_this.setData({
submsgSetting: result.data.setting
});
});
this.getDealerWithdraw();
},
/**
* 获取分销商提现信息
*/
getDealerWithdraw() {
getDealerWithdraw: function() {
let _this = this;
App._get('user.dealer/withdraw', {}, (result) => {
App._get('user.dealer/withdraw', {}, function(result) {
let data = result.data;
data.isData = true;
// 设置当前页面标题
@ -65,11 +48,14 @@ Page({
/**
* 提交申请
*/
onFormSubmit(e) {
formSubmit: function(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);
@ -86,74 +72,30 @@ Page({
});
// 提现方式
values['pay_type'] = _this.data.payment;
// 数据提交
const onCallback = () => {
App._post_form('user.dealer.withdraw/submit', {
data: JSON.stringify(values)
}, (result) => {
}, function(result) {
// 提交成功
App.showError(result.msg, () => {
// console.log(result);
App.showError(result.msg, function() {
wx.navigateTo({
url: '../list/list',
})
});
}, null, () => {
}, null, function() {
// 解除按钮禁用
_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(e) {
let _this = this;
_this.setData({
toggleChecked: function(e) {
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="onFormSubmit" report-submit="true">
<form bindsubmit="formSubmit" 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,11 +1,20 @@
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();
// 工具类
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';
const App = getApp()
Page({
/**
@ -57,8 +66,6 @@ Page({
has_error: false,
error_msg: '',
notRefresh: false, // 不允许刷新
},
/**
@ -79,7 +86,7 @@ Page({
onShow() {
let _this = this;
// 获取当前订单信息
!_this.data.notRefresh && _this.getOrderData();
_this.getOrderData();
},
/**
@ -178,9 +185,10 @@ Page({
*/
onSwichDelivery(e) {
// 设置当前配送方式
let _this = this;
let _this = this,
curDelivery = e.currentTarget.dataset.current;
_this.setData({
curDelivery: e.currentTarget.dataset.current
curDelivery
});
// 重新获取订单信息
_this.getOrderData();
@ -190,14 +198,8 @@ 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')
});
},
@ -207,11 +209,6 @@ Page({
onSelectExtractPoint() {
let _this = this,
selectedId = _this.data.selectedShopId;
// 允许刷新
_this.setData({
notRefresh: false
});
// 跳转到选择自提点
wx.navigateTo({
url: '../_select/extract_point/index?selected_id=' + selectedId
});
@ -242,9 +239,45 @@ 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 = '';
@ -287,7 +320,7 @@ Page({
});
}
// 创建订单-秒杀商品
// 创建订单-砍价活动
if (options.order_type === 'sharp') {
url = 'sharp.order/checkout';
postData = Object.assign(postData, {
@ -298,85 +331,17 @@ Page({
});
}
// 提交到后端
const onCommitCallback = () => {
// 显示loading
wx.showLoading({
title: '正在处理...'
});
// 订单提交
App._post_form(url, postData, result => {
_this._onSubmitCallback(result);
callback(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();
});
}
},
/**
* 表单验证
*/
@ -438,27 +403,15 @@ Page({
* 选择优惠券
*/
onSelectCoupon(e) {
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
}
let _this = this;
// 记录选中的优惠券id
app.setData({
selectCouponId: couponItem.user_coupon_id
_this.setData({
selectCouponId: e.currentTarget.dataset.id
});
// 重新获取订单信息
app.getOrderData();
_this.getOrderData();
// 隐藏优惠券弹层
app.onTogglePopupCoupon();
_this.onTogglePopupCoupon();
},
/**
@ -480,6 +433,8 @@ Page({
*/
onSelectPayType(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
// 设置当前支付方式
_this.setData({
curPayType: e.currentTarget.dataset.value
@ -534,6 +489,8 @@ Page({
*/
onShowPoints(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
// 显示dialog
let setting = _this.data.setting;
Dialog({

View File

@ -3,7 +3,6 @@
"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,9 +2,7 @@
<!-- 顶部选项卡 -->
<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>
@ -22,8 +20,7 @@
<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>
@ -51,8 +48,7 @@
<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>
@ -139,7 +135,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>
@ -245,8 +241,7 @@
<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.is_apply ? item.color.text : 'gray' }}" catchtap="onSelectCoupon"
data-index="{{ index }}" data-id="{{ item.user_coupon_id }}">
<view class="item-wrapper color__{{ item.color.text }}" 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 }}">
@ -288,8 +283,6 @@
<!-- 积分说明弹框 -->
<zan-dialog id="zan-base-dialog"></zan-dialog>
<!-- Toast组件 -->
<zan-toast id="zan-toast"></zan-toast>
</view>

View File

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

View File

@ -210,6 +210,7 @@ Page({
*/
onIncGoodsNumber(e) {
let _this = this;
App.saveFormId(e.detail.formId);
_this.setData({
goods_num: ++_this.data.goods_num
})
@ -220,6 +221,7 @@ 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
@ -283,8 +285,6 @@ Page({
}, (result) => {
App.showSuccess(result.msg);
_this.setData(result.data);
// 记录购物车商品数量
App.setCartTotalNum(result.data.cart_total_num)
});
}
},
@ -346,11 +346,28 @@ 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
});
@ -412,6 +429,8 @@ Page({
*/
onSavePoster(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
wx.showLoading({
title: '加载中',
});
@ -457,43 +476,15 @@ Page({
/**
* 确认购买弹窗
*/
onToggleTrade() {
onToggleTrade(e) {
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(options) {
onLoad: function(options) {
// 当前页面参数
this.setData({
options
@ -22,22 +22,14 @@ Page({
this.getPageData();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 更新购物车角标
App.setCartTabBadge()
},
/**
* 加载页面数据
*/
getPageData(callback) {
getPageData: function(callback) {
let _this = this;
App._get('page/index', {
page_id: _this.data.options.page_id || 0
}, result => {
}, function(result) {
// 设置顶部导航栏栏
_this.setPageBar(result.data.page);
_this.setData(result.data);
@ -49,7 +41,7 @@ Page({
/**
* 设置顶部导航栏
*/
setPageBar(page) {
setPageBar: function(page) {
// 设置页面标题
wx.setNavigationBarTitle({
title: page.params.title
@ -61,38 +53,44 @@ Page({
})
},
/**
* 分享当前页面
*/
onShareAppMessage() {
let _this = this;
return {
title: _this.data.page.params.share_title,
path: "/pages/index/index?" + App.getShareUrlParams()
};
},
/**
* 下拉刷新
*/
onPullDownRefresh() {
onPullDownRefresh: function() {
// 获取首页数据
this.getPageData(function() {
wx.stopPullDownRefresh();
});
},
/**
* 分享当前页面
*/
onShareAppMessage() {
const _this = this;
return {
title: _this.data.page.params.share_title,
path: "/pages/index/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.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
// });
// },
});

View File

@ -1,230 +0,0 @@
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()
};
},
})

View File

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

View File

@ -1,50 +0,0 @@
<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>

View File

@ -1,92 +0,0 @@
.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,31 +30,6 @@ 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,10 +7,7 @@
<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" catchtap="getUserProfile">授权登录</button>
<button class="btn-normal" openType="getUserInfo" lang="zh_CN" bindgetuserinfo="getUserInfo">授权登录</button>
</view>
<view class="no-login-btn">
<button class="btn-normal" catchtap="onNotLogin">暂不登录</button>

View File

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

View File

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

View File

@ -48,6 +48,8 @@ Page({
* 切换标签
*/
onSwitchService: function(e) {
// 记录formId
App.saveFormId(e.detail.formId);
this.setData({
serviceType: e.detail.target.dataset.type
});
@ -57,6 +59,8 @@ Page({
* 跳转商品详情
*/
onGoodsDetail: function(e) {
// 记录formId
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: '../../../goods/index?goods_id=' + e.detail.target.dataset.id
});
@ -69,6 +73,8 @@ 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,6 +45,8 @@ Page({
* 跳转商品详情
*/
onGoodsDetail: function (e) {
// 记录formId
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: '../../../goods/index?goods_id=' + e.detail.target.dataset.id
});
@ -80,6 +82,8 @@ Page({
let _this = this,
values = e.detail.value;
// 记录formId
App.saveFormId(e.detail.formId);
// 判断是否重复提交
if (_this.disable === true) {

View File

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

View File

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

View File

@ -1,8 +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()
// 工具类
const util = require('../../../utils/util.js');
// 记录规格的数组
let goodsSpecArr = [];
@ -23,6 +24,8 @@ Page({
goods_sku_id: 0, // 规格id
goodsMultiSpec: {}, // 多规格信息
countDownList: [],
actEndTimeList: []
},
/**
@ -37,36 +40,6 @@ 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();
},
});
},
/**
* 获取拼团详情
*/
@ -92,6 +65,8 @@ 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;
@ -111,6 +86,8 @@ Page({
}
// 赋值页面数据
_this.setData(data);
// 执行倒计时函数
_this.onCountDown();
},
/**
@ -138,6 +115,8 @@ 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) {
@ -216,6 +195,51 @@ 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);
},
/**
* 查看拼团规则
*/
@ -257,6 +281,7 @@ Page({
*/
onIncGoodsNumber(e) {
let _this = this;
App.saveFormId(e.detail.formId);
_this.setData({
goods_num: ++_this.data.goods_num
})
@ -267,6 +292,7 @@ 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
@ -289,7 +315,7 @@ Page({
},
/**
* 立即参团
* 加入购物车and立即购买
*/
onCheckout(e) {
let _this = this;
@ -297,8 +323,7 @@ Page({
if (!_this._onVerify()) {
return false;
}
// 立即参团
const onCommitCallback = () => {
// 立即购买
wx.navigateTo({
url: '../checkout/index?' + util.urlEncode({
order_type: 20,
@ -308,9 +333,6 @@ Page({
goods_sku_id: _this.data.goods_sku_id,
})
});
};
// 请求用户订阅消息
_this._onRequestSubscribeMessage(onCommitCallback);
},
/**
@ -339,11 +361,26 @@ Page({
onPreviewSkuImage(e) {
let _this = this;
wx.previewImage({
current: _this.data.skuCoverImage,
urls: [_this.data.skuCoverImage]
current: _this.data.image_path,
urls: [_this.data.image_path]
})
},
/**
* 分享当前页面
*/
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
};
},
/**
* 确认购买弹窗
*/
@ -370,36 +407,4 @@ 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,7 +3,6 @@
"usingComponents": {
"zan-dialog": "/components/dialog/index",
"zan-popup": "/components/popup/index",
"shortcut": "/components/shortcut/shortcut",
"countdown": "/components/countdown/index"
"shortcut": "/components/shortcut/shortcut"
}
}

View File

@ -44,26 +44,29 @@
</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_tiem">
<view wx:if="{{ detail.status.value == 10 }}" class="main_status main_tiem">
<text>还差 </text>
<text class="main_timer_color">{{ detail.surplus_people }}</text>
<text> 个名额,</text>
<!-- 倒计时 -->
<countdown date="{{ detail.end_time.text }}" separator="colon" style="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>
<text> 后结束</text>
</view>
<!-- 操作按钮 -->
<block wx:if="{{ detail.status.value == 10 }}">
<button wx:if="{{ !is_join }}" catchtap="onTriggerOrder">立即参团</button>
<button wx:else open-type="share" catchtap="onShare">立即分享</button>
<button wx:else open-type="share">立即分享</button>
</block>
<button wx:else catchtap="onTargetGoods">去开团</button>
</view>
@ -81,8 +84,7 @@
<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>
@ -137,21 +139,18 @@
</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,18 +183,20 @@ view {
/* 倒计时 */
.main_tiem {
margin-bottom: 40rpx;
font-size: 32rpx;
text-align: center;
display: flex;
justify-content: center;
}
.main_tiem .main_timer_color {
color: #fc8434;
}
.main_tiem view {
display: inline-block;
}
.main_tiem view text {
display: inline-block;
padding: 10rpx 5rpx;
background: #e5e5e5;
}
.main button {
display: block;
margin-top: 40rpx;

View File

@ -63,8 +63,6 @@ Page({
has_error: false,
error_msg: '',
notRefresh: false, // 不允许刷新
},
/**
@ -82,7 +80,7 @@ Page({
onShow() {
let _this = this;
// 获取当前订单信息
!_this.data.notRefresh && _this.getOrderData();
_this.getOrderData();
},
/**
@ -108,7 +106,7 @@ Page({
// 当前选择的配送方式
data.curDelivery = resData.delivery;
// 如果只有一种配送方式则不显示选项卡
data.isShowTab = resData.setting.delivery.length > 1;
data.isShowTab = resData.deliverySetting.length > 1;
// 上门自提联系信息
if (_this.data.linkman === '') {
data.linkman = resData.last_extract.linkman;
@ -156,14 +154,8 @@ 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')
});
},
@ -173,11 +165,6 @@ Page({
onSelectExtractPoint() {
let _this = this,
selectedId = _this.data.selectedShopId;
// 允许刷新
_this.setData({
notRefresh: false
});
// 跳转到选择自提点
wx.navigateTo({
url: '../../_select/extract_point/index?selected_id=' + selectedId
});
@ -208,72 +195,8 @@ Page({
return false;
}
// 按钮禁用, 防止二次提交
_this.data.disabled = true;
// 提交到后端
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);
},
/**
* 请求用户订阅消息
*/
_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;
// 订单创建成功后回调--微信支付
let callback = result => {
if (result.code === -10) {
App.showError(result.msg, () => {
_this.redirectToOrderIndex();
@ -300,6 +223,45 @@ Page({
_this.redirectToOrderIndex();
});
}
};
// 按钮禁用, 防止二次提交
_this.data.disabled = true;
// 显示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 => {
// success
console.log('success');
callback(result);
}, result => {
// fail
console.log('fail');
}, () => {
// complete
console.log('complete');
wx.hideLoading();
// 解除按钮禁用
_this.data.disabled = false;
});
},
/**
@ -393,6 +355,8 @@ Page({
*/
onSelectPayType(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
// 设置当前支付方式
_this.setData({
curPayType: e.currentTarget.dataset.value
@ -447,6 +411,8 @@ Page({
*/
onShowPoints(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
// 显示dialog
let setting = _this.data.setting;
Dialog({

View File

@ -1,9 +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()
// 工具类
const util = require('../../../utils/util.js');
// 记录规格的数组
let goodsSpecArr = [];
@ -36,6 +37,9 @@ Page({
cart_total_num: 0, // 购物车商品总数量
goodsMultiSpec: {}, // 多规格信息
countDownList: [], // 时间记录
actEndTimeList: [],
// 分享按钮组件
share: {
show: false,
@ -92,6 +96,8 @@ Page({
// 初始化商品详情数据
let data = _this._initGoodsDetailData(result.data);
_this.setData(data);
// 执行倒计时函数
_this.countDown();
});
},
@ -122,6 +128,13 @@ 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;
},
@ -150,6 +163,8 @@ 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) {
@ -211,6 +226,7 @@ Page({
*/
onScrollTop(e) {
let _this = this;
App.saveFormId(e.detail.formId);
_this.setData({
scrollTop: 0
});
@ -231,6 +247,7 @@ Page({
*/
onIncGoodsNumber(e) {
let _this = this;
App.saveFormId(e.detail.formId);
_this.setData({
goods_num: ++_this.data.goods_num
})
@ -241,6 +258,7 @@ 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
@ -327,8 +345,8 @@ Page({
onPreviewSkuImage(e) {
let _this = this;
wx.previewImage({
current: _this.data.skuCoverImage,
urls: [_this.data.skuCoverImage]
current: _this.data.image_path,
urls: [_this.data.image_path]
})
},
@ -337,16 +355,34 @@ 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
});
@ -408,6 +444,8 @@ Page({
*/
onSavePoster(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
wx.showLoading({
title: '加载中',
});
@ -453,8 +491,12 @@ Page({
/**
* 确认购买弹窗
*/
onToggleTrade() {
onToggleTrade(e) {
let _this = this;
if (typeof e === 'object') {
// 记录formId
e.detail.hasOwnProperty('formId') && App.saveFormId(e.detail.formId);
}
_this.setData({
showBottomPopup: !_this.data.showBottomPopup
});
@ -464,6 +506,8 @@ Page({
* 显示拼团规则
*/
onToggleRules(e) {
// 记录formId
App.saveFormId(e.detail.formId);
// 显示拼团规则
let _this = this;
Dialog({
@ -482,6 +526,7 @@ Page({
* 返回主页
*/
onNavigationHome(e) {
App.saveFormId(e.detail.formId);
wx.switchTab({
url: '../../index/index',
})
@ -491,6 +536,7 @@ Page({
* 立即下单
*/
onTriggerOrder(e) {
console.log(App.saveFormId(e.detail.formId))
let _this = this;
// 设置当前购买类型
_this.setData({
@ -499,6 +545,57 @@ 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);
},
/**
* 跳转到拼单页面
@ -508,37 +605,4 @@ 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,7 +4,6 @@
"zan-actionsheet": "/components/actionsheet/index",
"zan-popup": "/components/popup/index",
"zan-dialog": "/components/dialog/index",
"shortcut": "/components/shortcut/shortcut",
"countdown": "/components/countdown/index"
"shortcut": "/components/shortcut/shortcut"
}
}

View File

@ -1,10 +1,8 @@
<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>
@ -123,31 +121,21 @@
<!-- <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">
<!-- 进行中的团购-开团人数 -->
<view class="corwd_time_title onelist-hidden">
<text>还差</text>
<text>{{ item.people - item.actual_people }}</text>
<text>人成团</text>
</view>
<text class="corwd_time_title onelist-hidden">还差<text>{{ item.people - item.actual_people }}</text>人成团</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> -->
<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>
@ -228,9 +216,7 @@
</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>
<!-- 购买按钮 -->
@ -295,12 +281,9 @@
<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>
@ -344,9 +327,7 @@
</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

@ -578,15 +578,9 @@
}
.corwd_time_number {
display: flex;
align-items: center;
justify-content: center;
display: block;
margin-top: 15rpx;
font-size: 22rpx;
}
.corwd_time_number .prefix {
margin-right: 6rpx;
font-size: 23rpx;
}
.corwd_time button {

View File

@ -22,7 +22,7 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
onLoad: function(options) {
let _this = this;
// Api获取拼团首页
_this.setListHeight();
@ -35,7 +35,7 @@ Page({
getIndexData() {
let _this = this;
// 获取拼团首页
App._get('sharing.index/index', {}, result => {
App._get('sharing.index/index', {}, function(result) {
_this.setData({
categoryList: result.data.categoryList
});
@ -47,7 +47,7 @@ Page({
/**
* Api切换导航栏
*/
onSwitchTab(e) {
onSwitchTab: function(e) {
let _this = this;
// 第一步切换当前的分类id
_this.setData({
@ -69,7 +69,8 @@ Page({
App._get('sharing.goods/lists', {
page: page || 1,
category_id: _this.data.category_id
}, result => {
}, function(result) {
console.log(result)
let resList = result.data.list,
dataList = _this.data.goodsList;
if (isPage == true) {
@ -95,10 +96,20 @@ Page({
});
},
/**
* 分享当前页面
*/
onShareAppMessage: function() {
return {
title: '拼团首页',
path: "/pages/sharing/index/index?" + App.getShareUrlParams()
};
},
/**
* 下拉到底加载数据
*/
bindDownLoad() {
bindDownLoad: function() {
// 已经是最后一页
if (this.data.page >= this.data.goodsList.last_page) {
this.setData({
@ -113,36 +124,16 @@ Page({
/**
* 设置商品列表高度
*/
setListHeight() {
setListHeight: function() {
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,6 +129,8 @@ Page({
*/
onSelectPayType(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
// 隐藏支付方式弹窗
_this.onTogglePayPopup();
if (!_this.data.showPayPopup) {
@ -173,7 +175,7 @@ Page({
_this.getOrderDetail(orderId);
},
fail() {
App.showError(result.msg.error);
App.showError(result.msg.success);
},
});
}

View File

@ -151,6 +151,8 @@ Page({
*/
onSelectPayType(e) {
let _this = this;
// 记录formId
App.saveFormId(e.detail.formId);
// 隐藏支付方式弹窗
_this.onTogglePayPopup();
if (!_this.data.showPayPopup) {
@ -225,12 +227,15 @@ 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
@ -241,6 +246,8 @@ 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,6 +48,8 @@ Page({
* 切换标签
*/
onSwitchService: function(e) {
// 记录formId
App.saveFormId(e.detail.formId);
this.setData({
serviceType: e.detail.target.dataset.type
});
@ -57,6 +59,8 @@ Page({
* 跳转商品详情
*/
onGoodsDetail: function(e) {
// 记录formId
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: '../../../goods/index?goods_id=' + e.detail.target.dataset.id
});
@ -69,6 +73,8 @@ 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,6 +45,8 @@ Page({
* 跳转商品详情
*/
onGoodsDetail: function (e) {
// 记录formId
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: '../../../goods/index?goods_id=' + e.detail.target.dataset.id
});
@ -80,6 +82,8 @@ Page({
let _this = this,
values = e.detail.value;
// 记录formId
App.saveFormId(e.detail.formId);
// 判断是否重复提交
if (_this.disable === true) {

View File

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

View File

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

View File

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

View File

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

View File

@ -8,8 +8,7 @@
<!-- 商品图片 -->
<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>
@ -48,7 +47,7 @@
</view>
<view class="goods-share__line"></view>
<view class="goods-share">
<form bindsubmit="onClickShare">
<form bindsubmit="onClickShare" report-submit="true">
<button formType="submit" class="share-btn dis-flex flex-dir-column">
<text class="share__icon iconfont icon-fenxiang"></text>
<text class="f-24">分享</text>
@ -61,12 +60,11 @@
<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 dis-flex flex-y-center">
<view wx:if="{{ active.active_status != ActiveStatusEnum.STATE_END.value }}" class="info-item info-item_status info-item_countdown">
<text class="countdown-icon iconfont icon-naozhong"></text>
<text>距离秒杀{{ active.active_status == ActiveStatusEnum.STATE_SOON.value ? '开始' : '结束' }}</text>
<text class="m-r-10">还剩</text>
<countdown wx:if="{{ countDownTime }}" date="{{ countDownTime }}" bind:finish="onCountDownEnd" />
<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>
</view>
<!-- 活动已结束 -->
<view wx:else class="info-item info-item_status info-item_end">
@ -164,8 +162,7 @@
<!-- 操作按钮 -->
<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">
@ -177,9 +174,7 @@
</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">
@ -188,7 +183,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">
<form bindsubmit="onSavePoster" report-submit="true">
<view class="poster__image">
<image mode="widthFix" src="{{ qrcode }}"></image>
</view>
@ -237,12 +232,9 @@
<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>
@ -254,11 +246,11 @@
<text>购买数量</text>
</view>
<view class="select-number">
<form bindsubmit="onDecGoodsNumber">
<form bindsubmit="onDecGoodsNumber" report-submit="true">
<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">
<form bindsubmit="onIncGoodsNumber" report-submit="true">
<button formType="submit" class="default" type="default">+</button>
</form>
</view>

View File

@ -1,7 +1,13 @@
import util from '../../../utils/util.js';
import StateEnum from '../../../utils/enum/sharp/ActiveStatus.js';
const App = getApp();
const App = getApp()
// 工具类
import util from '../../../utils/util.js';
// 倒计时插件
import CountDown from '../../../utils/countdown.js';
// 枚举类:秒杀会场活动状态
import StateEnum from '../../../utils/enum/sharp/ActiveStatus.js';
Page({
@ -19,7 +25,8 @@ Page({
StateEnum, // 枚举类:秒杀会场活动状态
countDownTime: false, // 倒计时日期
// 倒计时
countDownList: [],
// 秒杀活动场次
tabbar: [],
@ -33,79 +40,46 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const _this = this;
_this.onRefreshPage()
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// const _this = this;
// if (_this.data.curTabIndex == 0) {
// // 刷新页面
// _this.onRefreshPage()
// }
},
/**
* 刷新页面数据
*/
onRefreshPage() {
const _this = this
return new Promise((resolve, reject) => {
let _this = this;
if (_this.data.curTabIndex == 0) {
// 获取列表数据
_this.getApiData().then(() => {
resolve()
})
})
_this.getApiData();
}
},
/**
* 下拉刷新
*/
onPullDownRefresh() {
// 获取首页数据
this.onRefreshPage().then(() => {
wx.stopPullDownRefresh()
})
},
/**
* 获取页面数据
* 获取列表数据
*/
getApiData() {
const app = this;
return new Promise((resolve, reject) => {
let _this = this;
App._get('sharp.index/index', {}, (result) => {
const data = result.data
app.setData(data);
_this.setData(result.data);
// 初始化倒计时组件
app._initCountDownData();
resolve(data)
_this._initCountDownData();
});
})
},
/**
* 初始化倒计时组件
*/
_initCountDownData() {
const app = this,
curTabbar = app.data.tabbar[app.data.curTabIndex];
_initCountDownData(data) {
let _this = this,
curTabbar = _this.data.tabbar[_this.data.curTabIndex];
// 记录倒计时的时间
app.setData({
countDownTime: curTabbar.count_down_time
})
},
// 倒计时结束刷新页面
onCountDownEnd() {
console.log('onCountDownEnd')
const app = this
setTimeout(() => {
app.onRefreshPage()
}, 200)
_this.setData({
[`countDownList[0]`]: {
date: curTabbar.count_down_time,
}
});
// 执行倒计时
CountDown.onSetTimeList(_this, 'countDownList');
},
/**
@ -113,10 +87,11 @@ Page({
*/
onToggleTab(e) {
let _this = this;
// 保存formid
App.saveFormId(e.detail.formId);
// 设置当前tabbar索引并重置数据
const curTabIndex = e.currentTarget.dataset.index
_this.setData({
curTabIndex,
curTabIndex: e.detail.target.dataset.index,
goodsList: [],
page: 1,
isLoading: true,
@ -129,11 +104,13 @@ 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,
@ -169,7 +146,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
@ -191,27 +168,12 @@ Page({
},
/**
* 分享当前页面
* 用户点击右上角分享
*/
onShareAppMessage() {
const _this = this;
let _this = this;
// 构建页面参数
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();
let params = App.getShareUrlParams();
return {
title: '整点秒杀',
path: `/pages/sharp/index/index?${params}`

View File

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

View File

@ -2,10 +2,10 @@
<!-- 商品分类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">
<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">
<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>
@ -14,7 +14,9 @@
<view class="item-status">{{ item.status_text }}</view>
</block>
</view>
</button>
</view>
</form>
<view class="sharp-tabs--empty"></view>
</scroll-view>
</view>
@ -23,21 +25,38 @@
<!-- 活动状态 -->
<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">
<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 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>
</view>
</view>
<!-- 内容区域 -->
<view class="bargain-hall">
<!-- 商品列表 -->
<view class="goods-item" wx:for="{{ goodsList.data }}" wx:key="this">
<form bindsubmit="onTargetActive">
<form bindsubmit="onTargetActive" report-submit="true">
<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: 20rpx;
margin-bottom: 15rpx;
}
.sharp-active .active-status .active-status--icon {
@ -95,6 +95,22 @@ 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 {
@ -123,7 +139,7 @@ page, .container {
.goods-item .goods-info .goods-name {
font-size: 28rpx;
min-height: 72rpx;
min-height: 76rpx;
margin-bottom: 20rpx;
}

View File

@ -34,6 +34,21 @@ 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
};
},
/**
* 拨打电话
*/
@ -59,36 +74,4 @@ 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,8 +28,6 @@ Page({
});
// 获取当前用户信息
_this.getUserDetail();
// 更新购物车角标
App.setCartTabBadge()
},
/**
@ -50,6 +48,8 @@ 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,6 +70,8 @@ Page({
if (!_this.onCheckLogin()) {
return false;
}
// 记录formId
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: '/' + e.currentTarget.dataset.url
})
@ -83,6 +85,8 @@ Page({
if (!_this.onCheckLogin()) {
return false;
}
// 记录formId
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: './wallet/index'
})
@ -96,6 +100,8 @@ Page({
if (!_this.onCheckLogin()) {
return false;
}
// 记录formId
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: '../points/log/index'
});

View File

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

View File

@ -39,6 +39,8 @@ Page({
* 跳转充值页面
*/
onTargetRecharge(e) {
// 记录formId
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: '../recharge/index'
})
@ -48,6 +50,8 @@ Page({
* 跳转充值记录页面
*/
onTargetRechargeOrder(e) {
// 记录formId
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: '../recharge/order/index'
})
@ -57,6 +61,8 @@ Page({
* 跳转账单详情页面
*/
onTargetBalanceLog(e) {
// 记录formId
App.saveFormId(e.detail.formId);
wx.navigateTo({
url: '../wallet/balance/log'
})

View File

@ -1,8 +1,7 @@
/* iconfont */
@import "/utils/iconfont.wxss";
.container,
input {
.container, input {
font-family: PingFang-Medium,
PingFangSC-Regular,
Heiti,
@ -280,10 +279,6 @@ input {
margin-left: 20rpx;
}
.m-r-10 {
margin-right: 10rpx;
}
.p-bottom {
padding-bottom: 112rpx;
}

View File

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