作者 cuiyuan

苏杭

... ... @@ -168,6 +168,7 @@ App({
//全局变量
globalData: {
userInfo: null,
cid: null
cid: null,
class_id: null
}
})
\ No newline at end of file
... ...
{
"pages": [
"pages/homeindex/homeindex",
"pages/index/index",
"pages/homeindex/homeindex",
... ...
// pages/homeindex/homeindex.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
banner: [],
shop_class: [],
middle:'',
shop:[]
middle: '',
shop: [],
num: 1,
showModal: false,
class_id: '',
detailCon: {},
id: '',
},
look_category(e) {
console.log(e)
app.globalData.cid = e.currentTarget.dataset.index
app.globalData.class_id = e.currentTarget.dataset.class_id
console.log(app.globalData.cid)
wx.switchTab({
url: '/pages/kind/kind'
url: '/pages/kind/kind'
})
this.get_info()
},
// 跳转页面
btn_name() {
... ... @@ -30,19 +38,116 @@ Page({
'XX-Device-Type': 'wxapp',
'XX-Token': wx.getStorageSync('token')
}
app.post(url, {}, header).then((res) => {
let params = {
class_id: that.data.class_id
}
console.log(params)
app.post(url, params, header).then((res) => {
console.log(res)
that.setData({
banner: res.data.banner,
shop_class: res.data.shop_class,
middle: res.data.middle,
shop:res.data.shop
shop: res.data.shop,
now_time: res.data.now_time
})
that.countDown()
}).catch((errMsg) => {})
},
goConfirm: function(e) {
this.setData({
showModal: true,
index: e.currentTarget.dataset.index
})
},
m_close: function() {
this.setData({
showModal: false,
})
},
// 点击加减
bindMinus: function() {
var num = this.data.num;
if (num > 1) {
num--;
}
this.setData({
num: num,
});
},
// 点击加
bindPlus: function() {
var num = this.data.num;
num++;
this.setData({
num: num,
});
},
shoptail(e) {
let id = e.currentTarget.dataset.shop_id;
wx.navigateTo({
url: '/pages/kind/detail_1/detail_1?id=' + id,
})
},
// 去团购
goFirm_order1(e) {
this.setData({
})
wx.navigateTo({
url: '/pages/kind/firm_order1/firm_order1?id=' + e.currentTarget.dataset.id + "&&num=" + this.data.num,
})
},
timeFormat(param) { //小于10的格式化函数
return param < 10 ? '0' + param : param;
},
//团购倒计时
countDown() {
let that = this
let objs = Object.assign([], that.data.shop)
let now_time = parseInt(new Date().getTime())
// console.log(now_time)
for (let obj of objs) {
let end_time = obj.end_time*1000
// console.log(end_time)
let open_time = obj.open_time*1000
if (now_time < open_time) {
// console.log(333)
//活动未开始
} else if (now_time > end_time) {
// console.log(222)
//活动结束
} else {
// console.log(1111)
let time = (end_time - now_time) / 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 = that.timeFormat(day),
obj.hou = that.timeFormat(hou),
obj.min = that.timeFormat(min),
obj.sec = that.timeFormat(sec)
// console.log(obj.day, obj.hou, obj.min, obj.sec)
}
}
that.setData({
shop: objs
})
// console.log(that.data.shop)
setTimeout(that.countDown, 1000);
},
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -62,7 +167,15 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function() {
let that = this
if (app.globalData.cid != null) {
that.setData({
currentTab: app.globalData.cid
})
console.log(this.data.aa)
}
that.get_info()
that.countDown()
},
/**
... ...
... ... @@ -22,7 +22,7 @@
<view class='commodity'>
<!-- <navigator url=''>
</navigator> -->
<view class='jujia' wx:for='{{shop_class}}' wx:key="index" bindtap='look_category' data-index='{{index}}'>
<view class='jujia' wx:for='{{shop_class}}' wx:key="index" data-class_id="{{item.class_id}}" bindtap='look_category' data-index='{{index}}'>
<image src='{{item.img}}'></image>
<text>{{item.class_name}}</text>
</view>
... ... @@ -50,12 +50,12 @@
</view>
<view class='container'>
<view class='mid'>
<view class='ware_box' wx:for='{{shop}}' wx:key="index">
<view class='ware_box' bindtap="shoptail" wx:for='{{shop}}' data-shop_id='{{item.shop_id}}' wx:key="index">
<view class='ware_top'>
<view class='ware_1'>
<image src='{{item.thumb}}'></image>
<view class='ware_1_time'>
据结束2时22分
据结束{{item.day}}天{{item.hou}}时{{item.min}}分{{item.sec}}秒
</view>
</view>
<view class='ware_text'>
... ... @@ -64,21 +64,21 @@
<text class='ware_2Txt2'>{{item.origin}}</text>
</view>
<view class='ware_3'>
<progress percent="42" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" />
<progress percent="{{item.percent}}" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" />
</view>
<view class='ware_4'>
<text>现有{{item.numb}}份,目标{{item.group}}份</text>
</view>
<view class='ware_5'>
<view>
<text class='ware5_t1'>{{item.money_sale}}</text>
<text class='ware5_t1'>¥{{item.money_sale}}/</text>
<text class='ware5_t2'>{{item.shop_type}}</text>
</view>
<view class='ware5_box'>
<view class='ware5_t3'>{{item.text_table}}</view>
<view class='ware5_t4'>{{item.text_content}}</view>
</view>
<view class='ware_6'>
<view class='ware_6' data-index="{{index}}" catchtap='goConfirm'>
<view>立即参团</view>
</view>
</view>
... ... @@ -90,4 +90,35 @@
</view>
</view>
</view>
</view>
<!-- 弹窗 -->
<view class="mask" catchtouchmove="preventTouchMove" wx:if="{{showModal}}"></view>
<!-- 弹出层 -->
<view class="modalDlg" wx:if="{{showModal}}">
<view class='modalDlg_p'>
<view class='m_top'>
<view class='m_topImg'>
<image src='{{shop[index].thumb}}'></image>
</view>
<view class='m_topTxt'>
<view class='m_topTxt1'>
<view class='m_topName'>{{shop[index].name}}</view>
<image bindtap='m_close' src='../../img/cha.png'></image>
</view>
<view class='m_topTxt2'>
<view class='m_topPrice'>¥{{shop[index].money_sale}}</view>
<view class='m_topHelf'>{{shop[index].shop_type}}</view>
</view>
</view>
</view>
<view class='m_number'>
<view class='m_numTxt'>购买数量</view>
<view class='minus_push'>
<view class='minus' bindtap="bindMinus">-</view>
<view class='num' bindchange="bindManual">{{num}}</view>
<view class='push' bindtap="bindPlus">+</view>
</view>
</view>
<button class='m_btn' bindtap='goFirm_order1' data-id="{{shop[index].shop_id}}">确认</button>
</view>
</view>
\ No newline at end of file
... ...
/* pages/homeindex/homeindex.wxss */
.search{
.search {
padding: 16rpx 32rpx;
height: 64rpx;
background: #6EAC3D;
background: #6eac3d;
display: flex;
justify-content: center;
align-content: space-between;
}
.search_inp{
.search_inp {
box-sizing: border-box;
width: 608rpx;
height: 64rpx;
border-radius: 32rpx;
display:flex;
display: flex;
align-items: center;
padding-left: 76rpx;
padding-right: 32rpx;
background:#fff;
background: #fff;
border: 0;
outline: none;
font-size: 26rpx;
position: relative;
color: #666;
}
.search_inp input{
.search_inp input {
width: 100%;
}
.search_inp image{
.search_inp image {
position: absolute;
left: 32rpx;
top: 17rpx;
width: 32rpx;
height: 32rpx;
}
.search_txt{
.search_txt {
height: 64rpx;
font-size: 30rpx;
color: #fff;
line-height: 64rpx;
padding-left: 16rpx;
}
.banner{
.banner {
width: 688rpx;
height: 336rpx;
margin: 0 auto;
... ... @@ -47,86 +54,101 @@
position: relative;
border-radius: 8rpx;
}
.swiper{
.swiper {
height: 100%;
position: absolute;
z-index: 99;
}
.swiper-item{
.swiper-item {
width: 688rpx;
margin: 0 auto;
height: 336rpx;
border-radius: 8rpx;
}
.swiper-item image{
.swiper-item image {
height: auto;
}
.banner_Mask{
width:656rpx;
.banner_Mask {
width: 656rpx;
height: 336rpx;
background:rgba(181,222,150,1);
box-shadow:0rpx 6rpx 40rpx rgba(93,255,0,0.44);
opacity:0.3;
background: rgba(181, 222, 150, 1);
box-shadow: 0rpx 6rpx 40rpx rgba(93, 255, 0, 0.44);
opacity: 0.3;
position: absolute;
bottom: 16rpx;
z-index: -1;
left: 16rpx;
border-radius: 8rpx;
}
.commodity{
.commodity {
width: 688rpx;
/* margin: 0 auto; */
padding: 64rpx 32rpx;
display: flex;
justify-content:space-around;
justify-content: space-around;
align-items: center;
font-size: 24rpx;
color: #333333;
border-bottom: 8px solid rgba(249,250,252,1);
color: #333;
border-bottom: 8px solid rgba(249, 250, 252, 1);
}
.commodity view{
.commodity view {
}
.introduce_list {
display: flex;
justify-content: space-around;
align-items: center;
padding: 36rpx 32rpx 48rpx 32rpx;
}
.introduce_list .introduce_item{
.introduce_list .introduce_item {
display: flex;
justify-content: space-between;
align-items: center;
}
.introduce_list .introduce_item:first-child image{
.introduce_list .introduce_item:first-child image {
width: 32rpx;
height: 36rpx;
}
.introduce_list .introduce_item:nth-child(2) image{
.introduce_list .introduce_item:nth-child(2) image {
width: 36rpx;
height: 31rpx;
}
.introduce_list .introduce_item:nth-child(3) image{
.introduce_list .introduce_item:nth-child(3) image {
width: 32rpx;
height: 29rpx;
}
.introduce_list .introduce_item text{
.introduce_list .introduce_item text {
font-size: 28rpx;
display: flex;
align-items: center;
margin-left: 16rpx;
}
.introduce image{
.introduce image {
width: 668rpx;
height: 208rpx;
display: block;
margin: 0 auto;
}
.commodity .jujia image,.commodity .fenlei image{
.commodity .jujia image, .commodity .fenlei image {
width: 112rpx;
height: 112rpx;
margin: 0 auto;
}
.commodity text{
.commodity text {
display: flex;
margin-top: 14rpx;
text-align: center;
... ... @@ -134,219 +156,430 @@
align-items: center;
}
.container{
.container {
width: 750rpx;
display: flex;
align-items: center;
flex-flow: column;
}
.mid{
.mid {
margin-top: 16rpx;
display: flex;
flex-flow: column;
}
.ware_box{
width:688rpx;
height:400rpx;
margin:32rpx auto;
background:#F9FAFC;
}
.ware_top{
overflow: hidden;
display: flex;
padding:32rpx 18rpx 0;
}
.ware_1{
width:312rpx;
height:208rpx;
position: relative;
}
.ware_1 image{
width:100%;
height:100%;
}
.ware_1_time{
position: absolute;
bottom:0;
width:208rpx;
height:48rpx;
color: white;
text-align: center;
line-height:48rpx;
font-size:24rpx;
background:#FAC8C8;
font-family:PingFang SC;
}
.ware_text{
margin-left:14rpx;
width:100%;
}
.ware_2{
.ware_box {
width: 688rpx;
height: 400rpx;
margin: 32rpx auto;
background: #f9fafc;
}
.ware_top {
overflow: hidden;
display: flex;
padding: 32rpx 18rpx 0;
}
.ware_1 {
width: 312rpx;
height: 208rpx;
position: relative;
}
.ware_1 image {
width: 100%;
height: 100%;
}
.ware_1_time {
position: absolute;
bottom: 0;
width: 208rpx;
height: 48rpx;
color: white;
text-align: center;
line-height: 48rpx;
font-size: 17rpx;
background: #fac8c8;
font-family: PingFang SC;
}
.ware_text {
margin-left: 14rpx;
width: 100%;
}
.ware_2 {
display: flex;
justify-content: space-between;
align-content: center;
}
.ware_2Txt1{
font-size:32rpx;
font-family:PingFang SC;
font-weight:600;
line-height:44rpx;
color:rgba(51,51,51,1);
}
.ware_2Txt2{
font-size:22rpx;
/* margin-left:98rpx; */
font-family:PingFang SC;
font-weight:400;
line-height:32rpx;
color:rgba(204,204,204,1);
}
.ware_3 progress{
width:370rpx;
color:#B5DE96;
margin-top:24rpx;
}
.ware_4 text,.ware5_t2{
font-size:18rpx;
font-family:PingFang SC;
font-weight:400;
line-height:32rpx;
color:rgba(204,204,204,1);
}
.ware_5{
display: flex;
display: -webkit-flex;
justify-content: space-between;
}
.ware5_t1{
font-size:30rpx;
font-family:DIN 1451 Std Mittelschrift;
font-weight:400;
color:rgba(255,0,0,1);
}
.ware5_t3{
font-size:22rpx;
font-family:PingFang SC;
font-weight:400;
line-height:30rpx;
color:rgba(51,51,51,1);
}
.ware5_t4{
font-size:18rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(153,153,153,1);
}
.ware_6{
width:144rpx;
height:48rpx;
background:rgba(249,150,20,1);
box-shadow:0px 2rpx 12rpx rgba(255,145,0,0.16);
border-radius:24rpx;
}
.ware_6 view{
font-size:26rpx;
font-family:PingFang SC;
font-weight:400;
text-align: center;
line-height:48rpx;
color:rgba(255,255,255,1);
}
.ware_bot{
width:670rpx;
height:80rpx;
margin: auto;
display: flex;
line-height:80rpx;
margin-top:32rpx;
background-color:#F1F7F1;
}
.ware_bot_tit{
font-size:30rpx;
font-weight:bold;
margin-left:32rpx;
color:rgba(110,172,61,1);
}
.ware_bot_tit:after{
content:"";
margin:0 38rpx;
border-right:1px solid #B5DE96;
}
.ware_bot_txt{
font-size:24rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(153,153,153,1);
.ware_2Txt1 {
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 600;
line-height: 44rpx;
color: rgba(51, 51, 51, 1);
}
.ware_2Txt2 {
font-size: 22rpx;
/* margin-left:98rpx; */
font-family: PingFang SC;
font-weight: 400;
line-height: 32rpx;
color: rgba(204, 204, 204, 1);
}
.ware_3 progress {
width: 370rpx;
color: #b5de96;
margin-top: 24rpx;
}
.ware_4 text {
font-size: 22rpx;
font-family: PingFang SC;
font-weight: 400;
line-height: 32rpx;
color: rgba(204, 204, 204, 1);
}
.ware5_t2 {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 70rpx;
display: inline-block;
font-size: 22rpx;
font-family: PingFang SC;
font-weight: 400;
line-height: 19rpx;
margin-left: 4rpx;
color: rgba(204, 204, 204, 1);
}
.ware_5 {
display: flex;
display: -webkit-flex;
justify-content: space-between;
}
.ware5_t1 {
width: 110rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 26rpx;
font-family: DIN 1451 Std Mittelschrift;
font-weight: 400;
color: rgba(255, 0, 0, 1);
}
.ware5_t3 {
width: 104rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 20rpx;
font-family: PingFang SC;
font-weight: 400;
line-height: 30rpx;
color: rgba(51, 51, 51, 1);
}
.ware5_t4 {
font-size: 18rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(153, 153, 153, 1);
}
.ware_6 {
width: 144rpx;
height: 48rpx;
background: rgba(249, 150, 20, 1);
box-shadow: 0px 2rpx 12rpx rgba(255, 145, 0, 0.16);
border-radius: 24rpx;
}
.ware_6 view {
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 400;
text-align: center;
line-height: 48rpx;
color: rgba(255, 255, 255, 1);
}
.ware_bot {
width: 670rpx;
height: 80rpx;
margin: auto;
display: flex;
line-height: 80rpx;
margin-top: 32rpx;
background-color: #f1f7f1;
}
.ware_bot_tit {
font-size: 30rpx;
font-weight: bold;
margin-left: 32rpx;
color: rgba(110, 172, 61, 1);
}
.ware_bot_tit:after {
content: "";
margin: 0 38rpx;
border-right: 1px solid #b5de96;
}
.ware_bot_txt {
font-size: 24rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(153, 153, 153, 1);
}
/* 规格 */
.spec{
width:100%;
padding:0 32rpx;
line-height:80rpx;
display: flex;
height:80rpx;
margin-top:8rpx;
background:white;
}
.spec_txt{
font-size:32rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(51,51,51,1);
}
.spec_txt2{
font-size:24rpx;
font-family:PingFang SC;
font-weight:400;
margin-left:108rpx;
color:rgba(153,153,153,1);
.spec {
width: 100%;
padding: 0 32rpx;
line-height: 80rpx;
display: flex;
height: 80rpx;
margin-top: 8rpx;
background: white;
}
.spec_txt {
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(51, 51, 51, 1);
}
.spec_txt2 {
font-size: 24rpx;
font-family: PingFang SC;
font-weight: 400;
margin-left: 108rpx;
color: rgba(153, 153, 153, 1);
}
/* 商品详情 */
.ware_detail{
width:100%;
margin-top:8rpx;
margin-bottom:96rpx;
padding-bottom:66rpx;
background: white;
}
.ware_detail_tit{
width:688rpx;
margin: auto;
display: flex;
padding:44rpx 0rpx 42rpx;
justify-content:space-around;
border-bottom:2rpx solid #F5F5F5;
}
.ware_detail .ware_active{
color:#6EAC3D;
font-weight:600;
}
.ware_active:after{
content: "";
width:16rpx;
height: 6rpx;
margin: auto;
display: block;
margin-top:6rpx;
border-radius:8rpx;
background:rgba(110,172,61,1);
}
.ware_detail_tit view{
font-size:28rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(153,153,153,1);
}
.ware_detailC{
width:688rpx;
margin:26rpx auto 0;
}
.ware_detailImg{
width:688rpx;
height:470rpx;
}
.ware_detailImg image{
width:100%;
height:100%;
}
\ No newline at end of file
.ware_detail {
width: 100%;
margin-top: 8rpx;
margin-bottom: 96rpx;
padding-bottom: 66rpx;
background: white;
}
.ware_detail_tit {
width: 688rpx;
margin: auto;
display: flex;
padding: 44rpx 0rpx 42rpx;
justify-content: space-around;
border-bottom: 2rpx solid #f5f5f5;
}
.ware_detail .ware_active {
color: #6eac3d;
font-weight: 600;
}
.ware_active:after {
content: "";
width: 16rpx;
height: 6rpx;
margin: auto;
display: block;
margin-top: 6rpx;
border-radius: 8rpx;
background: rgba(110, 172, 61, 1);
}
.ware_detail_tit view {
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(153, 153, 153, 1);
}
.ware_detailC {
width: 688rpx;
margin: 26rpx auto 0;
}
.ware_detailImg {
width: 688rpx;
height: 470rpx;
}
.ware_detailImg image {
width: 100%;
height: 100%;
}
/* 遮罩层 */
.mask {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background: #000;
z-index: 9000;
opacity: 0.64;
}
/* 弹出层 */
.modalDlg {
width: 100%;
height: 454rpx;
bottom: 0;
position: fixed;
z-index: 9999;
background-color: #fff;
}
.modalDlg_p {
padding: 0 30rpx;
}
.m_top {
display: flex;
}
.m_topTxt1 {
display: flex;
align-self: center;
justify-content: space-between;
margin-top: 30rpx;
}
.m_topTxt {
width: 100%;
margin-left: 16rpx;
}
.m_topImg {
margin-top: -48rpx;
display: flex;
}
.m_topImg image {
width: 208rpx;
height: 208rpx;
}
.m_topTxt1 image {
width: 32rpx;
height: 32rpx;
}
.m_topName {
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 600;
color: rgba(51, 51, 51, 1);
}
.m_topTxt2 {
display: flex;
margin-top: 16rpx;
align-items: center;
}
.m_topPrice {
width: 120rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 28rpx;
font-family: DIN 1451 Std Mittelschrift;
font-weight: 400;
color: #f00;
}
.m_topHelf {
width: 280rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 22rpx;
font-family: PingFang SC;
font-weight: 400;
margin-left: 16rpx;
color: rgba(204, 204, 204, 1);
}
.m_number {
display: flex;
align-items: center;
margin-top: 18rpx;
}
.minus_push {
display: flex;
margin-left: auto;
align-items: center;
}
.m_numTxt {
font-size: 24rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(153, 153, 153, 1);
}
.minus, .push {
width: 48rpx;
height: 48rpx;
font-size: 40rpx;
text-align: center;
line-height: 48rpx;
border: 2px solid rgba(110, 172, 61, 1);
border-radius: 50%;
}
.minus {
color: #6eac3d;
}
.num {
margin: 0 26rpx;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(110, 172, 61, 1);
}
.push {
color: white;
background: rgba(110, 172, 61, 1);
}
.m_btn {
width: 688rpx;
height: 80rpx;
border: 0;
margin-top: 62rpx;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 600;
color: rgba(255, 255, 255, 1);
background: linear-gradient(170deg, rgba(181, 222, 150, 1) 0%, rgba(169, 209, 33, 1) 100%);
box-shadow: 0rpx 6rpx 40rpx rgba(162, 255, 0, 0.15);
border-radius: 48rpx;
}
... ...
... ... @@ -9,7 +9,10 @@ Page({
recommend: [],
history: [],
keyword: '',
page:''
page: '',
type: true,
dis:true
},
/**
... ... @@ -40,14 +43,30 @@ Page({
recommend: res.data.recommend,
history: res.data.history
})
that.countDown()
}).catch((errMsg) => {
})
},
exchange(e){
let keyword=this.data.keyword
console.log(e)
this.setData({
keyword: e._relatedInfo.anchorTargetText
})
},
info(event) {
let that = this
if (that.data.keyword == '') {
wx.showToast({
title: '商品名称不能为空',
icon: 'none',
duration: 1000
})
return false
}
// 接口地址
let url = app.interface.shopPage
let header = {
... ... @@ -57,38 +76,157 @@ Page({
let keyword = this.data.keyword
app.post(url, {
page: 1,
keyword: keyword
},header).then((res) => {
that.setData({
shop: res.data.shop
shop: res.data.shop,
type:false,
dis: false,
keyword: ''
})
that.get_info()
}).catch((errMsg) => {
})
},
cansle(){
console.log(111)
this.setData({
type:true,
dis: true
})
},
display() {
this.setData({
dis: false
})
},
clear(){
let that =this
let url = app.interface.historyDelete
let header = {
'XX-Device-Type': 'wxapp',
'XX-Token': wx.getStorageSync('token')
}
app.post(url, {}, header).then((res) => {
console.log(history)
that.setData({
history: []
})
console.log(111)
}).catch((errMsg) => {
wx.showModal({
title: '提示',
content: '确认删除全部历史记录',
success(res) {
if (res.confirm) {
console.log('用户点击确定')
let url = app.interface.historyDelete
let header = {
'XX-Device-Type': 'wxapp',
'XX-Token': wx.getStorageSync('token')
}
app.post(url, {}, header).then((res) => {
that.setData({
history: []
})
console.log(111)
}).catch((errMsg) => {
})
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
timeFormat(param) { //小于10的格式化函数
return param < 10 ? '0' + param : param;
},
//团购倒计时
countDown() {
let that = this
let objs = Object.assign([], that.data.shop)
let now_time = parseInt(new Date().getTime())
// console.log(now_time)
for (let obj of objs) {
let end_time = obj.end_time*1000
// console.log(end_time)
let open_time = obj.open_time*1000
if (now_time < open_time) {
// console.log(333)
//活动未开始
} else if (now_time > end_time) {
// console.log(222)
//活动结束
} else {
// console.log(1111)
let time = (end_time - now_time) / 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 = that.timeFormat(day),
obj.hou = that.timeFormat(hou),
obj.min = that.timeFormat(min),
obj.sec = that.timeFormat(sec)
// console.log(obj.day, obj.hou, obj.min, obj.sec)
}
}
that.setData({
shop: objs
})
// console.log(that.data.shop)
setTimeout(that.countDown, 1000);
},
timeFormat(param) { //小于10的格式化函数
return param < 10 ? '0' + param : param;
},
//团购倒计时
countDown() {
let that = this
let objs = Object.assign([], that.data.shop)
let now_time = parseInt(new Date().getTime())
// console.log(now_time)
for (let obj of objs) {
let end_time = obj.end_time * 1000
// console.log(end_time)
let open_time = obj.open_time * 1000
if (now_time < open_time) {
// console.log(333)
//活动未开始
} else if (now_time > end_time) {
// console.log(222)
//活动结束
} else {
// console.log(1111)
let time = (end_time - now_time) / 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 = that.timeFormat(day),
obj.hou = that.timeFormat(hou),
obj.min = that.timeFormat(min),
obj.sec = that.timeFormat(sec)
// console.log(obj.day, obj.hou, obj.min, obj.sec)
}
}
that.setData({
shop: objs
})
// console.log(that.data.shop)
setTimeout(that.countDown, 1000);
},
add(){
},
... ... @@ -103,7 +241,8 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function() {
that.countDown()
},
/**
... ...
... ... @@ -2,41 +2,44 @@
<!-- <text>pages/homeindex/search/search.wxml</text> -->
<view class='search'>
<view class='search_inp'>
<input type='text' placeholder='请输入商品名称' maxlength='12' bindinput='bindKeyInput' value='{{keyword}}'></input>
<input type='text' placeholder='请输入商品名称' maxlength='12' bindinput='bindKeyInput' value='{{keyword}}' ></input>
<image src='../../../img/search.png'></image>
</view>
<view class='search_txt' bindtap='info'>
<view class='search_txt' bindtap='info' wx:if='{{type}}'>
搜索
</view>
<view class='search_txt' bindtap='cansle' wx:else>
取消
</view>
</view>
<view class='Popular'>
<view class='Popular' wx:if='{{dis}}'>
<view class='Popular_title'>
<text>热门搜索</text>
<image src='../../../img/zuire@3x.png'></image>
</view>
<view class='Popular_list' >
<view class='Popular_item' wx:for='{{recommend}}' wx:key>
<view class='Popular_item' bindtap='exchange' data-word='{{recommend[index]}}' wx:for='{{recommend}}' wx:key>
{{recommend[index]}}
</view>
</view>
<view class='History'>
<view class='History' wx:if='{{history.length > 0}}'>
<view class='History_title'>历史搜索
<image src='../../../img/del.png' bindtap='clear'></image>
</view>
<view class='History_list'>
<view class='History_item' wx:for='{{history}}' wx:key>{{history[index]}}</view>
<view class='History_item' bindtap='exchange' wx:for='{{history}}' wx:key>{{history[index]}}</view>
</view>
</view>
</view>
<view class='container'>
<view class='container' bindtap='display' wx:else>
<view class='mid'>
<view class='ware_box' wx:for='{{shop}}' wx:key="index">
<view class='ware_top'>
<view class='ware_1'>
<image src='{{item.thumb}}'></image>
<view class='ware_1_time'>
据结束2时22分
据结束{{item.day}}天{{item.hou}}时{{item.min}}分{{item.sec}}秒
</view>
</view>
<view class='ware_text'>
... ... @@ -45,7 +48,7 @@
<text class='ware_2Txt2'>{{item.origin}}</text>
</view>
<view class='ware_3'>
<progress percent="42" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" />
<progress percent="{{item.percent}}" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" />
</view>
<view class='ware_4'>
<text>现有{{item.numb}}份,目标{{item.group}}份</text>
... ... @@ -72,7 +75,7 @@
</view>
</view>
<view wx:if="{{shop.length == 0}}">暂无更多结果</view>
<view class='empty' wx:if="{{shop.length == 0}}">暂无更多结果</view>
</view>
\ No newline at end of file
... ...
... ... @@ -136,7 +136,7 @@
color: white;
text-align: center;
line-height:48rpx;
font-size:24rpx;
font-size:18rpx;
background:#FAC8C8;
font-family:PingFang SC;
}
... ... @@ -312,4 +312,10 @@
.ware_detailImg image{
width:100%;
height:100%;
}
.empty{
font-size: 32rpx;
margin-top: 120px;
text-align: center;
color: #ccc;
}
\ No newline at end of file
... ...
... ... @@ -4,108 +4,112 @@ const app = getApp()
Page({
data: {
session_key:'',
openid:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getLoginFun();
},
// 获取session_key
getLoginFun() {
let that = this;
getOpenId() {
let that = this
wx.login({
success: function (s) {
console.log(s);
wx.setStorageSync("token", 123123);
let url = 'wxapp/public/getSessionKey';
if (s.code) {
var code = s.code;
var param = {
code: s.code
}
app.post(url, param).then((res) => {
console.log(res);
that.setData({
openid: res.data.openid,
session_key: res.data.session_key
})
// res.data = {}
}).catch((errMsg) => {
console.log(errMsg);
})
success: (res) => {
let url = 'wxapp/public/getSessionKey'
let param = {
code: res.code,
}
app.post(url, param).then((res) => {
that.setData({
openid: res.data.openid,
session_key: res.data.session_key
})
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo'] === true) {
wx.getUserInfo({
success: reg => {
that.setData({
encrypted_data: reg.encryptedData,
iv: reg.iv
})
that.login()
}
})
}
}
})
}).catch((errMsg) => {
})
}
});
},
// 获取用户信息
// 获取用户权限信息
getUserInfo(e) {
console.log(e);
let that = this;
if (e.detail.errMsg == "getUserInfo:ok") {
that.setData({
encrypted_data: e.detail.encryptedData,
iv: e.detail.iv
})
that.login()
}
},
// 登录
login() {
let that = this;
let url = "wxapp/public/login";
let data = {
openid: this.data.openid,
session_key: this.data.session_key,
encrypted_data: e.detail.encryptedData,
iv: e.detail.iv,
openid: that.data.openid,
session_key: that.data.session_key,
encrypted_data: that.data.encrypted_data,
iv: that.data.iv,
}
app.post(url, data).then((res) => {
console.log(res);
wx.setStorageSync("token", res.data.token);
wx.switchTab({
url: '../homeindex/homeindex',
wx.showLoading({
title: '正在进入',
})
let t = setInterval(function() {
clearInterval(t)
wx.switchTab({
url: '../homeindex/homeindex',
})
wx.hideLoading()
}, 1500)
}).catch((err) => {
console.log(err);
})
// }).catch((errMsg) => { })
},
// start(e) {
// 111
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.getOpenId();
},
// let that = this;
// console.log(e)
// // app.globalData.userInfo = e.detail.userInfo
// wx.login({
// success: (res) => {
// console.log(res)
// let url = '/api/portal/common/getToken';
// let params = {
// code: res.code,
// user_nickname: e.detail.userInfo.nickName,
// avatar: e.detail.userInfo.avatarUrl
// // user_nickname: e.detail.userInfo.nickName,
// // avatar: e.detail.userInfo.avatarUrl //分享进入的需要此参数
// }
// app.post(url, params).then((res) => {
// console.log('999', res)
// wx.setStorageSync('token', res.token);
// wx.navigateTo({
// url: "/pages/mainindex/mainindex",
// })
// // wx.switchTab({
// // url: '../mainindex/mainindex',
// // })
// }).catch((errMsg) => {
// // console.log(errMsg)
// })
// }
// });
// },
})
})
\ No newline at end of file
... ...
... ... @@ -29,7 +29,6 @@ Page({
this.assessFun()
},
goFirm_order1(e) {
wx.navigateTo({
url: '../firm_order1/firm_order1?id=' + e.currentTarget.dataset.id + "&&num=" + this.data.num,
})
... ...
... ... @@ -15,7 +15,7 @@
<text class='ware_2Txt2'>产地:{{detailCon.origin}}</text>
</view>
<view class='ware_3'>
<progress percent="42" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" />
<progress percent="{{item.percent}}" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" />
</view>
<view class='ware_4'>
<text>已拼{{detailCon.numb}}份,目标{{detailCon.group}}份</text>
... ...
... ... @@ -17,7 +17,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
get_info() {
let that = this
... ... @@ -54,13 +54,56 @@ Page({
shoptail(e){
console.log(e)
let id=e.currentTarget.dataset.shop_id;
let id= e.currentTarget.dataset.shop_id;
console.log(id)
wx.navigateTo({
url: 'detail_1/detail_1?id='+id,
url: 'detail_1/detail_1?id=' + id,
})
},
timeFormat(param) { //小于10的格式化函数
return param < 10 ? '0' + param : param;
},
//团购倒计时
countDown() {
let that = this
let objs = Object.assign([], that.data.shop)
let now_time = parseInt(new Date().getTime())
// console.log(now_time)
for (let obj of objs) {
let end_time = obj.end_time * 1000
// console.log(end_time)
let open_time = obj.open_time * 1000
if (now_time < open_time) {
// console.log(333)
//活动未开始
} else if (now_time > end_time) {
// console.log(222)
//活动结束
} else {
// console.log(1111)
let time = (end_time - now_time) / 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 = that.timeFormat(day),
obj.hou = that.timeFormat(hou),
obj.min = that.timeFormat(min),
obj.sec = that.timeFormat(sec)
// console.log(obj.day, obj.hou, obj.min, obj.sec)
}
}
that.setData({
shop: objs
})
// console.log(that.data.shop)
setTimeout(that.countDown, 1000);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
... ... @@ -76,12 +119,11 @@ Page({
if (app.globalData.cid != null){
that.setData({
currentTab: app.globalData.cid,
aa: 123
class_id: app.globalData.class_id
})
console.log(this.data.aa)
}
that.get_info()
that.countDown()
},
/**
... ...
<!--pages/kind/kind.wxml-->
<!-- <text>pages/kind/kind.wxml</text> -->
<view class='container'>
<view class="nav mainindex_nav top">
<view wx:for="{{shop_class}}" data-idx="{{index}}" class="nav_item {{currentTab==index ? 'active' : ''}}" wx:key="unique" bindtap="navbarTap" data-class_id="{{item.class_id}}">{{item.class_name}}
</view>
</view>
<view class='mid'>
<view class='ware_box' wx:for='{{shop}}' wx:key="index" data-shop_id="{{item.shop_id}}" bindtap="shoptail">
<view class="nav mainindex_nav top">
<view wx:for="{{shop_class}}" data-idx="{{index}}" class="nav_item {{currentTab==index ? 'active' : ''}}" wx:key="unique" bindtap="navbarTap" data-class_id="{{item.class_id}}">{{item.class_name}}
</view>
</view>
<view class='mid'>
<view class='ware_box' wx:for='{{shop}}' wx:key="index" data-shop_id="{{item.shop_id}}" bindtap="shoptail">
<view class='ware_top'>
<view class='ware_1' data-categoryid="{{item.shop_id}}">
<image src='{{item.thumb}}'></image>
<view class='ware_1_time'>
据结束2时22分
据结束{{item.day}}天{{item.hou}}时{{item.min}}分{{item.sec}}秒
</view>
</view>
<view class='ware_text'>
... ... @@ -20,14 +20,14 @@
<text class='ware_2Txt2'>{{item.origin}}</text>
</view>
<view class='ware_3'>
<progress percent="42" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" />
<progress percent="{{item.percent}}" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" />
</view>
<view class='ware_4'>
<text>现有{{item.numb}}份,目标{{item.group}}份</text>
</view>
<view class='ware_5'>
<view>
<text class='ware5_t1'>{{item.money_sale}}</text>
<text class='ware5_t1'>¥{{item.money_sale}}/</text>
<text class='ware5_t2'>{{item.shop_type}}</text>
</view>
<view class='ware5_box'>
... ... @@ -45,6 +45,7 @@
<view class='ware_bot_txt'>{{item.recommend}}</view>
</view>
</view>
</view>
<view class='empty' wx:if="{{shop.length == 0}}">暂无更多结果</view>
</view>
\ No newline at end of file
... ...
... ... @@ -78,7 +78,7 @@
color: white;
text-align: center;
line-height:48rpx;
font-size:24rpx;
font-size:18rpx;
background:#FAC8C8;
font-family:PingFang SC;
}
... ... @@ -118,16 +118,33 @@
line-height:32rpx;
color:rgba(204,204,204,1);
}
.ware5_t2 {
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
width:70rpx;
display: inline-block;
font-size: 22rpx;
font-family: PingFang SC;
font-weight: 400;
line-height: 19rpx;
margin-left:4rpx;
color: rgba(204, 204, 204, 1);
}
.ware_5{
display: flex;
display: -webkit-flex;
justify-content: space-between;
}
.ware5_t1{
font-size:30rpx;
font-family:DIN 1451 Std Mittelschrift;
font-weight:400;
color:rgba(255,0,0,1);
.ware5_t1 {
width:110rpx;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
font-size:26rpx;
font-family: DIN 1451 Std Mittelschrift;
font-weight: 400;
color: rgba(255, 0, 0, 1);
}
.ware5_t3{
font-size:22rpx;
... ... @@ -149,13 +166,13 @@
box-shadow:0px 2rpx 12rpx rgba(255,145,0,0.16);
border-radius:24rpx;
}
.ware_6 view{
font-size:26rpx;
font-family:PingFang SC;
font-weight:400;
text-align: center;
line-height:48rpx;
color:rgba(255,255,255,1);
.ware_6 view {
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 400;
text-align: center;
line-height: 48rpx;
color: rgba(255, 255, 255, 1);
}
.ware_bot{
width:670rpx;
... ... @@ -254,4 +271,10 @@
.ware_detailImg image{
width:100%;
height:100%;
}
.empty{
font-size: 32rpx;
margin-top: 120px;
text-align: center;
color: #ccc;
}
\ No newline at end of file
... ...
... ... @@ -35,6 +35,7 @@ Page({
status: 0,
toCancel: false
},
/**
* 生命周期函数--监听页面加载
*/
... ...
... ... @@ -12,9 +12,9 @@
"autoAudits": false
},
"compileType": "miniprogram",
"libVersion": "2.6.1",
"appid": "wx1f51f42105b63343",
"projectname": "shop-suh",
"libVersion": "2.6.2",
"appid": "wxd577c8d542ca150e",
"projectname": "teamshop",
"debugOptions": {
"hidedInDevtools": []
},
... ...