作者 李洪娟

团购小程序

正在显示 100 个修改的文件 包含 2052 行增加0 行删除

要显示太多修改。

为保证性能只显示 100 of 100+ 个文件。

//app.js
App({
onLaunch: function () {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
//自动更新版本
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
})
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(function () {
// 新的版本下载失败
wx.showModal({
title: '更新提示',
content: '新版本下载失败',
showCancel: false
})
})
},
post: function (url, data, headerParams, showLoad) {
wx.showNavigationBarLoading()
var promise = new Promise((resolve, reject) => {
//init
let that = this;
let postData = data;
let baseUrl = 'http://grouppay.w.bronet.cn/api/';
//网络请求
let header = {
'content-type': 'application/x-www-form-urlencoded'
}
header = Object.assign(header, headerParams)
//网络请求
wx.request({
url: baseUrl + url,
data: postData,
method: 'POST',
header: header,
success: function (res) { //返回取得的数据
if (res.data.code == '20000') {
resolve(res.data);
} else if (res.data.code == '201') {
resolve(res.data);
}
// else if (res.data.code == '10001') {
// wx.showToast({
// title: res.data.msg,
// icon: 'none',
// duration: 1000,
// success: function (res) {
// let t = setInterval(function () {
// clearInterval(t)
// wx.navigateTo({
// url: '/pages/index/index',
// })
// }, 1000)
// }
// })
// }
else {
wx.showModal({
title: '提示',
content: res.data.msg,
showCancel: false
})
reject(res.data)
}
setTimeout(function () {
// if (show||show==undefined){
// wx.hideLoading()
// }
wx.hideNavigationBarLoading()
}, 600)
},
fail: function (e) {
reject('网络出错');
// wx.hideLoading()
wx.hideNavigationBarLoading()
}
})
});
return promise;
},
pay(res, successData) {
wx.requestPayment({
"timeStamp": res.pay.timeStamp,
"nonceStr": res.pay.nonceStr,
"package": res.pay.package,
"signType": "MD5",
"paySign": res.pay.paySign,
"success": function (res) {
wx.showToast({
title: '支付完成',
icon: "success",
duration: 1500,
success: function (data) {
successData(data)
}
})
},
"fail": function (res) {
wx.showToast({
title: '取消支付成功!',
icon: "icon",
duration: 1500,
})
}
})
},
nowDate() {
let date = new Date();
let month = date.getMonth() + 1;
let day = date.getDate();
return date.getFullYear() + '-' + (month > 9 ? month : ('0' + month)) + '-' + (day > 9 ? day : ('0' + day));
},
minDate() {
let date = new Date();
date.setDate(date.getDate() - 287);
let m = date.getMonth() + 1;
return date.getFullYear() + '-' + m + '-' + date.getDate();
},
timeFormate(timestamp, timeType) {
var timeStamp = timestamp.length == 13 ? timestamp : timestamp * 1000
var date = new Date(timeStamp); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
var Y = date.getFullYear() + '-';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = date.getDate() + ' ';
var h = date.getHours() + ':';
var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes());
var s = date.getSeconds();
if (timeType == 'YYMMDD') {
return Y + M + D;
} else {
return h + m;
}
},
//接口管理
interface: {
historyDelete:'/home/index/historyDelete',//删除
shopClass:'/home/index/shopClass',//分类
shopPage:'/home/index/shopPage',//分页
history:'/home/index/history',//检索
index: '/home/index/index', //首页
login: '/wxapp/public/login', //小程序登录注册
getSessionKey: '/wxapp/public/getSessionKey', //获取sessionKey和openid
},
//全局变量
globalData: {
userInfo: null,
cid: null
}
})
\ No newline at end of file
... ...
{
"pages": [
"pages/homeindex/homeindex",
"pages/index/index",
"pages/kind/kind",
"pages/homeindex/result/result",
"pages/homeindex/search/search",
"pages/mine/mine",
"pages/kind/detail_1/detail_1",
"pages/kind/firm_order2/firm_order2",
"pages/kind/firm_order1/firm_order1",
"pages/kind/success/success",
"pages/mine/contactUs/contactUs",
"pages/mine/eOrder/eOrder",
"pages/mine/myOrder/myOrder",
"pages/mine/addr_2/addr_2",
"pages/mine/addr_1/addr_1",
"pages/logs/logs",
"pages/mine/collect/collect"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "团购商城",
"navigationBarTextStyle": "black"
},
"tabBar": {
"selectedColor": "#6EAC3D",
"list": [
{
"pagePath": "pages/homeindex/homeindex",
"text": "首页",
"selectedColor": "#6EAC3D",
"iconPath": "img/01_nav@2x.png",
"selectedIconPath": "img/01_nav_fill@2x.png"
},
{
"pagePath": "pages/kind/kind",
"text": "分类",
"selectedColor": "#6EAC3D",
"iconPath": "img/02_nav@2x.png",
"selectedIconPath": "img/02_nav_fill@2x.png"
},
{
"pagePath": "pages/mine/mine",
"text": "我的",
"selectedColor": "#6EAC3D",
"iconPath": "img/03_nav@2x.png",
"selectedIconPath": "img/03_nav_fill@2x.png"
}
]
}
}
\ No newline at end of file
... ...
/**app.wxss**/
/* .container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
} */
... ...

534 字节

631 字节

562 字节

// pages/homeindex/homeindex.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
banner: [],
shop_class: [],
middle:'',
shop:[]
},
look_category(e) {
app.globalData.cid = e.currentTarget.dataset.index
wx.switchTab({
url: '/pages/kind/kind'
})
},
// 跳转页面
btn_name() {
wx.navigateTo({
url: '/pages/homeindex/search/search',
})
},
get_info() {
let that = this
let url = app.interface.index;
let header = {
'XX-Device-Type': 'wxapp',
'XX-Token': wx.getStorageSync('token')
}
app.post(url, {}, 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
})
}).catch((errMsg) => {})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
let that = this
that.get_info()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "首页",
"navigationBarBackgroundColor": "#6EAC3D",
"navigationBarTextStyle": "white"
}
\ No newline at end of file
... ...
<!--pages/homeindex/homeindex.wxml-->
<!-- <text>pages/homeindex/homeindex.wxml</text> -->
<view class='search'>
<view class='search_inp' bindtap="btn_name">
<!-- <input type='text' bindtap="btn_name" placeholder='请输入商品名称'></input> -->
请输入商品名称
<image src='../../img/search.png'></image>
</view>
<view class='search_txt' bindtap="btn_name">
搜索
</view>
</view>
<view class='banner'>
<swiper indicator-dots="true" indicator-active-color="#fff" style="width:100%;height:100%;">
<swiper-item wx:for='{{banner}}' wx:key="index">
<image style="width: 688rpx;" mode='widthFix' src='{{item.img}}' />
</swiper-item>
</swiper>
<view class='banner_Mask'></view>
</view>
<view class='commodity'>
<!-- <navigator url=''>
</navigator> -->
<view class='jujia' wx:for='{{shop_class}}' wx:key="index" bindtap='look_category' data-index='{{index}}'>
<image src='{{item.img}}'></image>
<text>{{item.class_name}}</text>
</view>
<view class='fenlei' bindtap='look_category'>
<image src='../../img/fenlei@3x.png'></image>
<text>全部分类</text>
</view>
</view>
<view class='introduce'>
<view class='introduce_list'>
<view class='introduce_item'>
<image src='../../img/anquan@3x.png'></image>
<text>安心检测</text>
</view>
<view class='introduce_item'>
<image src='../../img/youxuan@3x.png'></image>
<text>优选源头</text>
</view>
<view class='introduce_item'>
<image src='../../img/baozhang@3x.png'></image>
<text>赔付保障</text>
</view>
</view>
<image src='{{middle}}'></image>
</view>
<view class='container'>
<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分
</view>
</view>
<view class='ware_text'>
<view class='ware_2'>
<text class='ware_2Txt1'>{{item.name}}</text>
<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" />
</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_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>立即参团</view>
</view>
</view>
</view>
</view>
<view class='ware_bot'>
<view class='ware_bot_tit'>经典推荐</view>
<view class='ware_bot_txt'>{{item.recommend}}</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
... ...
/* pages/homeindex/homeindex.wxss */
.search{
padding: 16rpx 32rpx;
height: 64rpx;
background: #6EAC3D;
display: flex;
justify-content: center;
align-content: space-between;
}
.search_inp{
box-sizing: border-box;
width: 608rpx;
height: 64rpx;
border-radius: 32rpx;
display:flex;
align-items: center;
padding-left: 76rpx;
padding-right: 32rpx;
background:#fff;
border: 0;
outline: none;
font-size: 26rpx;
position: relative;
}
.search_inp input{
width: 100%;
}
.search_inp image{
position: absolute;
left: 32rpx;
top: 17rpx;
width: 32rpx;
height: 32rpx;
}
.search_txt{
height: 64rpx;
font-size: 30rpx;
color: #fff;
line-height: 64rpx;
padding-left: 16rpx;
}
.banner{
width: 688rpx;
height: 336rpx;
margin: 0 auto;
margin-top: 48rpx;
position: relative;
border-radius: 8rpx;
}
.swiper{
height: 100%;
position: absolute;
z-index: 99;
}
.swiper-item{
width: 688rpx;
margin: 0 auto;
height: 336rpx;
border-radius: 8rpx;
}
.swiper-item image{
height: auto;
}
.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;
position: absolute;
bottom: 16rpx;
z-index: -1;
left: 16rpx;
border-radius: 8rpx;
}
.commodity{
width: 688rpx;
/* margin: 0 auto; */
padding: 64rpx 32rpx;
display: flex;
justify-content:space-around;
align-items: center;
font-size: 24rpx;
color: #333333;
border-bottom: 8px solid rgba(249,250,252,1);
}
.commodity view{
}
.introduce_list {
display: flex;
justify-content: space-around;
align-items: center;
padding: 36rpx 32rpx 48rpx 32rpx;
}
.introduce_list .introduce_item{
display: flex;
justify-content: space-between;
align-items: center;
}
.introduce_list .introduce_item:first-child image{
width: 32rpx;
height: 36rpx;
}
.introduce_list .introduce_item:nth-child(2) image{
width: 36rpx;
height: 31rpx;
}
.introduce_list .introduce_item:nth-child(3) image{
width: 32rpx;
height: 29rpx;
}
.introduce_list .introduce_item text{
font-size: 28rpx;
display: flex;
align-items: center;
margin-left: 16rpx;
}
.introduce image{
width: 668rpx;
height: 208rpx;
display: block;
margin: 0 auto;
}
.commodity .jujia image,.commodity .fenlei image{
width: 112rpx;
height: 112rpx;
margin: 0 auto;
}
.commodity text{
display: flex;
margin-top: 14rpx;
text-align: center;
justify-content: center;
align-items: center;
}
.container{
width: 750rpx;
display: flex;
align-items: center;
flex-flow: column;
}
.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{
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);
}
/* 规格 */
.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
... ...
// pages/homeindex/result/result.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#6EAC3D",
"navigationBarTextStyle": "white"
}
\ No newline at end of file
... ...
<!--pages/homeindex/result/result.wxml-->
<!-- <text>pages/homeindex/result/result.wxml</text> -->
<view class='search'>
<view class='search_inp'>
<input type='text' placeholder='请输入商品名称'></input>
<image src='../../../img/search.png'></image>
</view>
<view class='search_txt'>
取消
</view>
</view>
<view class='container'>
<view class='mid'>
<view class='mid_item'>
<!-- 顶部 -->
<view class='mid_item_top'>
<!-- 左边 -->
<view class='mid_item_top_left'>
<view class='top_left_pic'>
<image src='../../../img/goods_1.png'></image>
</view>
<view class='top_left_text'>
距结束23时59分距结束23时59分
</view>
</view>
<!-- 右边 -->
<view class='mid_item_top_right'>
<!-- 右上 -->
<view class='right_top'>
<view class='right_top_lef'>
纯进口有机菜花
</view>
<view class='right_top_rig'>
产地:智利
</view>
</view>
<!-- 右中1 -->
<view class='right_mid'>
<view class='right_mid_lef'>
<view class='right_mid_lef_color'></view>
</view>
<view class='right_mid_rig'>
42%
</view>
</view>
<!-- 右中2 -->
<view class='right_text'>
已拼300份,目标500份
</view>
<!-- 右下 -->
<view class='right_bottom'>
<!-- 右下左 -->
<view class='right_bottom_lef'>
<span class='RBM'>¥</span>
<span class='number'>52/</span>
<span class='text'>1磅1份1磅1份</span>
</view>
<!-- 右下中 -->
<view class='right_bottom_mid'>
<view class='right_bottom_mid_t'>
40mm-50m
</view>
<view class='right_bottom_mid_b'>
番茄果径番茄果径番茄果径
</view>
</view>
<!-- 右下右 -->
<view class='right_bottom_rig'>
立即参团
</view>
</view>
</view>
</view>
<view class='mid_item_bottom'>
<view class='mid_item_bottom_left'>
经典推荐
</view>
<!-- 竖线 -->
<view class='mid_line'></view>
<!-- 底部文本 -->
<view class='mid_item_bottom_bot'>
智利进口,绿色健康,硕大饱满
</view>
</view>
</view>
<view class='mid_item'>
<!-- 顶部 -->
<view class='mid_item_top'>
<!-- 左边 -->
<view class='mid_item_top_left'>
<view class='top_left_pic'>
<image src='../../../img/goods_1.png'></image>
</view>
<view class='top_left_text'>
距结束23时59分距结束23时59分
</view>
</view>
<!-- 右边 -->
<view class='mid_item_top_right'>
<!-- 右上 -->
<view class='right_top'>
<view class='right_top_lef'>
纯进口有机菜花
</view>
<view class='right_top_rig'>
产地:智利
</view>
</view>
<!-- 右中1 -->
<view class='right_mid'>
<view class='right_mid_lef'>
<view class='right_mid_lef_color'></view>
</view>
<view class='right_mid_rig'>
42%
</view>
</view>
<!-- 右中2 -->
<view class='right_text'>
已拼300份,目标500份
</view>
<!-- 右下 -->
<view class='right_bottom'>
<!-- 右下左 -->
<view class='right_bottom_lef'>
<span class='RBM'>¥</span>
<span class='number'>52/</span>
<span class='text'>1磅1份1磅1份</span>
</view>
<!-- 右下中 -->
<view class='right_bottom_mid'>
<view class='right_bottom_mid_t'>
40mm-50m
</view>
<view class='right_bottom_mid_b'>
番茄果径番茄果径番茄果径
</view>
</view>
<!-- 右下右 -->
<view class='right_bottom_rig'>
立即参团
</view>
</view>
</view>
</view>
<view class='mid_item_bottom'>
<view class='mid_item_bottom_left'>
经典推荐
</view>
<!-- 竖线 -->
<view class='mid_line'></view>
<!-- 底部文本 -->
<view class='mid_item_bottom_bot'>
智利进口,绿色健康,硕大饱满
</view>
</view>
</view>
<view class='mid_item'>
<!-- 顶部 -->
<view class='mid_item_top'>
<!-- 左边 -->
<view class='mid_item_top_left'>
<view class='top_left_pic'>
<image src='../../../img/goods_1.png'></image>
</view>
<view class='text_color'>
距结束2时22分距结束2时22分
</view>
</view>
<!-- 右边 -->
<view class='mid_item_top_right'>
<!-- 右上 -->
<view class='right_top'>
<view class='right_top_lef'>
纯进口有机菜花
</view>
<view class='right_top_rig'>
产地:罗利
</view>
</view>
<!-- 右中1 -->
<view class='right_mid'>
<view class='right_mid_lef'>
<view class='right_mid_lef_color'></view>
</view>
<view class='right_mid_rig'>
42%
</view>
</view>
<!-- 右中2 -->
<view class='right_text'>
已拼300份,目标500份
</view>
<!-- 右下 -->
<view class='right_bottom'>
<!-- 右下左 -->
<view class='right_bottom_lef'>
<span class='RBM'>¥</span>
<span class='number'>52/</span>
<span class='text'>1磅1份1磅1份</span>
</view>
<!-- 右下中 -->
<view class='right_bottom_mid'>
<view class='right_bottom_mid_t'>
40mm-50m
</view>
<view class='right_bottom_mid_b'>
番茄果径 番茄果径番茄果径
</view>
</view>
<!-- 右下右 -->
<view class='right_bottom_rig'>
立即参团
</view>
</view>
</view>
</view>
<view class='mid_item_bottom'>
<view class='mid_item_bottom_left'>
经典推荐
</view>
<!-- 竖线 -->
<view class='mid_line'></view>
<!-- 底部文本 -->
<view class='mid_item_bottom_bot'>
智利进口,绿色健康,硕大饱满
</view>
</view>
</view>
</view>
</view>
... ...
/* pages/homeindex/result/result.wxss */
.search{
padding: 16rpx 32rpx;
height: 64rpx;
background: #6EAC3D;
display: flex;
justify-content: center;
align-content: space-between;
}
.search_inp{
box-sizing: border-box;
width: 608rpx;
height: 64rpx;
border-radius: 32rpx;
display:flex;
align-items: center;
padding-left: 76rpx;
padding-right: 32rpx;
background:#fff;
border: 0;
outline: none;
font-size: 26rpx;
position: relative;
}
.search_inp input{
width: 100%;
}
.search_inp image{
position: absolute;
left: 32rpx;
width: 32rpx;
height: 32rpx;
}
.search_txt{
height: 64rpx;
font-size: 30rpx;
color: #fff;
line-height: 64rpx;
padding-left: 16rpx;
}
.container{
width: 750rpx;
display: flex;
align-items: center;
flex-flow: column;
}
.mid{
margin-top: 16rpx;
display: flex;
flex-flow: column;
}
.mid_item{
margin-top: 16rpx;
width:688rpx;
/* height:400rpx; */
background:rgba(249,250,252,1);
opacity:1;
border-radius:8rpx;
display: flex;
align-items: center;
flex-flow: column;
box-sizing: border-box;
padding: 52rpx 16rpx 48rpx;
}
.mid_item_top{
display: flex;
width: 100%;
}
.mid_item_top_left{
width:208rpx;
height:208rpx;
/* background:rgba(250,250,250,1); */
opacity:1;
display: flex;
flex-flow: column;
}
.top_left_pic{
width: 208rpx;
height: 160rpx;
display: flex;
}
.top_left_pic image{
width: 100%;
height: 100%;
}
.top_left_text{
width: 202rpx;
height:48rpx;
background:rgba(251,4,4,1);
opacity:0.2;
text-align: center;
font-size:24rpx;
font-family:PingFang SC;
font-weight:400;
line-height:48rpx;
color:rgba(255,255,255,1);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.mid_item_top_right{
width: 100%;
margin-left: 14rpx;
}
.right_top{
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 20rpx;
}
.right_top_lef{
width: 270rpx;
font-size:32rpx;
font-family:PingFang SC;
font-weight:600;
color:rgba(51,51,51,1);
opacity:1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.right_top_rig{
font-size:22rpx;
font-family:PingFang SC;
font-weight:400;
line-height:32rpx;
color:rgba(204,204,204,1);
opacity:1;
}
.right_mid{
margin-top: 16rpx;
display: flex;
align-items: center;
}
.right_mid_lef{
width:288rpx;
height:16rpx;
background:rgba(236,236,236,1);
opacity:1;
border-radius:8rpx;
}
.right_mid_lef_color{
width:206rpx;
height:16rpx;
background:rgba(181,222,150,1);
opacity:1;
border-radius:8rpx;
}
.right_mid_rig{
margin-left: 16rpx;
font-size:24rpx;
font-family:PingFang SC;
font-weight:400;
line-height:34rpx;
color:rgba(181,222,150,1);
opacity:1;
}
.right_text{
margin-top: 14rpx;
font-size:22rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(204,204,204,1);
opacity:1;
}
.right_bottom{
display: flex;
align-items: center;
justify-content: space-between;
}
.RBM{
font-size: 22rpx;
color: #ff0000;
}
.number{
font-size: 30rpx;
color: #ff0000;
}
.text{
font-size:22rpx;
font-family:PingFang SC;
font-weight:400;
line-height:32rpx;
color:rgba(204,204,204,1);
opacity:1;
}
.right_bottom_mid{
width: 122rpx;
}
.right_bottom_mid_t{
font-size:22rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(51,51,51,1);
opacity:1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.right_bottom_mid_b{
font-size:18rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(153,153,153,1);
opacity:1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.right_bottom_rig{
width:144rpx;
height:48rpx;
line-height: 48rpx;
background:rgba(249,150,20,1);
box-shadow:0rpx 2rpx 12rpx rgba(255,145,0,0.16);
opacity:1;
border-radius:24rpx;
text-align: center;
font-size:26rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(255,255,255,1);
}
.mid_item_bottom{
margin-top: 32rpx;
width:640rpx;
height:80rpx;
background:rgba(181,222,150,0.1);
border-radius:16rpx;
display: flex;
align-items: center;
box-sizing: border-box;
padding: 0 32rpx;
}
.mid_item_bottom_left{
font-size:30rpx;
font-family:汉真广标;
font-weight:400;
color:rgba(110,172,61,1);
opacity:1;
}
.mid_line{
margin: 0 36rpx;
width:2rpx;
height:60rpx;
background:rgba(181,222,150,1);
opacity:1;
border-radius:4rpx;
}
.mid_item_bottom_bot{
font-size:24rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(153,153,153,1);
opacity:1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.text_color{
width:202rpx;
height:48rpx;
line-height: 48rpx;
text-align: center;
background:rgba(204,204,204,0.7);
font-size:24rpx;
font-family:PingFang SC;
font-weight:400;
color:rgba(255,255,255,1);
opacity:1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.right_bottom_lef{
width: 140rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
\ No newline at end of file
... ...
// pages/homeindex/search/search.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
recommend: [],
history: [],
keyword: '',
page:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
let that = this
that.get_info()
},
bindKeyInput:function(e){
console.log(e.detail.value)
this.setData({
keyword: e.detail.value
})
},
get_info() {
let that = this
// 接口地址
let url = app.interface.history
let header = {
'XX-Device-Type': 'wxapp',
'XX-Token': wx.getStorageSync('token')
}
app.post(url, {}, header).then((res) => {
console.log(res)
that.setData({
recommend: res.data.recommend,
history: res.data.history
})
}).catch((errMsg) => {
})
},
info(event) {
let that = this
// 接口地址
let url = app.interface.shopPage
let header = {
'XX-Device-Type': 'wxapp',
'XX-Token': wx.getStorageSync('token')
}
let keyword = this.data.keyword
app.post(url, {
page: 1,
keyword: keyword
},header).then((res) => {
that.setData({
shop: res.data.shop
})
}).catch((errMsg) => {
})
},
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) => {
})
},
add(){
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#6EAC3D",
"navigationBarTextStyle": "white"
}
\ No newline at end of file
... ...
<!--pages/homeindex/search/search.wxml-->
<!-- <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>
<image src='../../../img/search.png'></image>
</view>
<view class='search_txt' bindtap='info'>
搜索
</view>
</view>
<view class='Popular'>
<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>
{{recommend[index]}}
</view>
</view>
<view class='History'>
<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>
</view>
</view>
<view class='container'>
<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分
</view>
</view>
<view class='ware_text'>
<view class='ware_2'>
<text class='ware_2Txt1'>{{item.name}}</text>
<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" />
</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_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>立即参团</view>
</view>
</view>
</view>
</view>
<view class='ware_bot'>
<view class='ware_bot_tit'>经典推荐</view>
<view class='ware_bot_txt'>{{item.recommend}}</view>
</view>
</view>
</view>
<view wx:if="{{shop.length == 0}}">暂无更多结果</view>
</view>
\ No newline at end of file
... ...
/* pages/homeindex/search/search.wxss */
.search{
padding: 16rpx 32rpx;
height: 64rpx;
background: #6EAC3D;
display: flex;
justify-content: center;
align-content: space-between;
}
.search_inp{
box-sizing: border-box;
width: 608rpx;
height: 64rpx;
border-radius: 32rpx;
display:flex;
align-items: center;
padding-left: 76rpx;
padding-right: 32rpx;
background:#fff;
border: 0;
outline: none;
font-size: 26rpx;
position: relative;
}
.search_inp input{
width: 100%;
}
.search_inp image{
position: absolute;
left: 32rpx;
width: 32rpx;
height: 32rpx;
}
.search_txt{
height: 64rpx;
font-size: 30rpx;
color: #fff;
line-height: 64rpx;
padding-left: 16rpx;
}
.Popular{
padding: 32rpx;
padding-bottom: 0rpx;
}
.Popular_title{
display: flex;
align-items: center;
font-size: 26rpx;
color: #333;
font-weight: 400;
}
.Popular_title text{
margin-right: 12rpx;
}
.Popular image{
width: 28rpx;
height: 32rpx;
}
.Popular_list{
display: flex;
justify-content: flex-start;
flex-wrap: wrap;
align-items: center;
margin-top: 28rpx;
padding-bottom: 16rpx;
border-bottom: 1rpx solid #F5F5F5;
}
.Popular_item,.History_item{
padding: 8rpx 26rpx;
border-radius: 24rpx;
background:rgba(247,247,247,1);
font-size: 26rpx;
margin-bottom: 16rpx;
margin-right: 16rpx;
}
.History{
margin-top: 30rpx;
}
.History_title{
font-size: 26rpx;
display: flex;
justify-content: space-between;
align-items: center;
color: #333;
font-weight: 400;
padding-bottom: 28rpx;
}
.History_title img{
width: 32rpx;
height: 32rpx;
}
.History_list{
display: flex;
justify-content: flex-start;
flex-wrap: wrap;
align-items: center;
}
.container{
width: 750rpx;
display: flex;
align-items: center;
flex-flow: column;
}
.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{
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);
}
/* 规格 */
.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
... ...
//index.js
//获取应用实例
const app = getApp()
Page({
data: {
session_key:'',
openid:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getLoginFun();
},
// 获取session_key
getLoginFun() {
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);
})
}
}
});
},
// 获取用户信息
getUserInfo(e) {
console.log(e);
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,
}
app.post(url, data).then((res) => {
console.log(res);
wx.setStorageSync("token", res.data.token);
wx.switchTab({
url: '../homeindex/homeindex',
})
}).catch((err) => {
console.log(err);
})
},
// start(e) {
// 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)
// })
// }
// });
// },
})
... ...
{
"usingComponents": {}
}
\ No newline at end of file
... ...