作者 倪静楠

位置授权

{
"pages": [
"pages": [
"pages/home/home",
"pages/logs/logs",
"pages/classify/classify",
... ... @@ -31,7 +31,9 @@
"pages/timedmo/timedmo",
"pages/index/index",
"components/timepicker/timepicker",
"pages/idea-feedback/idea-feedback"
"pages/idea-feedback/idea-feedback",
"pages/demo1/demo1",
"pages/look-more/look-more"
],
"window": {
"backgroundTextStyle": "light",
... ...
... ... @@ -78,6 +78,15 @@ Page({
},
//地区
map() {
wx.getLocation({
type: 'wgs84',
success(res) {
const latitude = res.latitude
const longitude = res.longitude
const speed = res.speed
const accuracy = res.accuracy
}
})
let that = this;
const key = 'C4QBZ-UYQLI-S45G2-5ETMC-LQYWE-L6FJU';
const referer = '春晓世纪华联超市';
... ... @@ -173,8 +182,7 @@ Page({
})
}
},
onLoad: function (options) {
},
onLoad: function (options) {},
/**
* 生命周期函数--监听页面初次渲染完成
... ...
... ... @@ -18,15 +18,17 @@
<!-- 配送时间 -->
<view class="timeBox">
<view style="width:95%;display:flex">
<view class="calendar " bindtap='chooseTime'>
<!-- <image src="/images/04-01/rili.png"></image> -->
<view class="timeBox" >
<view style="width:95%;display:flex" bindtap='chooseTime'>
<view class="calendar " wx:if="{{storePickupTime==''}}">
请选择配送时间:
</view>
<view class="calendar1 " wx:if="{{storePickupTime!==''}}">
配送时间:
</view>
<view class="selectText">{{storePickupTime}}</view>
</view>
<view class="arrow">
<view class="arrow" bindtap='chooseTime'>
<image src="/images/04-01/arrow.png"></image>
</view>
<view class="section">
... ...
... ... @@ -70,7 +70,7 @@ page {
.userAddress {
width: 504rpx;
font-size: 28prx;
font-size: 28rpx;
font-weight: 400;
text-align: left;
color: #6c6c6d;
... ... @@ -106,6 +106,13 @@ page {
color: #323233;
width: 224rpx;
}
.calendar1 {
font-size: 28rpx;
font-weight: 400;
text-align: left;
color: #323233;
width: 142rpx;
}
.selectText{
font-size: 28rpx;
color: #323233;
... ...
... ... @@ -10,7 +10,7 @@ Page({
//评价列表
getList(goodsId) {
let postData = {
goodsId: goodsId,
goodsId: this.data.goodsId,
page: this.data.page,
size: 10
}
... ... @@ -28,7 +28,7 @@ Page({
*/
onLoad: function (options) {
this.setData({
goodsId:options.goodsId
goodsId:options.goodsid
})
this.getList(options.goodsid)
},
... ...
<!--pages/all-evaluate/all-evaluate.wxml-->
<view class="outerBox" wx:for="{{list}}">
<view class="userBox">
<view class="wxHead">
<view class="wxHead" wx:if="{{item.anonymous==0}}">
<image src="{{item.wxHeadImg}}"></image>
</view>
<view class="wxHead" wx:if="{{item.anonymous==1}}">
<image src="/images/nimingtouxiang.png"> </image>
</view>
<view class="wxName">{{item.wxName}}</view>
</view>
<view class="text">{{item.content}}</view>
<view class="picBox">
<view class="pic" wx:for="{{item.images}}">
<image src="{{item}}" ></image>
<image src="{{item}}"></image>
</view>
</view>
</view>
... ...
... ... @@ -24,12 +24,12 @@ page {
width: 72rpx;
height: 72rpx;
margin-right: 16rpx;
background-color: aqua;
}
.wxHead image {
width: 72rpx;
height: 72rpx;
border-radius: 50%;
}
.wxName {
... ...
... ... @@ -76,9 +76,9 @@ Page({
tabList: list
})
} else {
setTimeout(() => {
util.getUser()
}, 2000)
// setTimeout(() => {
// util.getUser()
// }, 2000)
}
})
},
... ... @@ -118,9 +118,9 @@ Page({
tabList: list
})
} else [
setTimeout(() => {
util.getUser()
}, 2000)
// setTimeout(() => {
// util.getUser()
// }, 2000)
]
})
},
... ... @@ -139,9 +139,9 @@ Page({
tabList: list
})
} else {
setTimeout(() => {
util.getUser()
}, 2000)
// setTimeout(() => {
// util.getUser()
// }, 2000)
}
})
},
... ... @@ -160,9 +160,9 @@ Page({
tabList: list
})
} else {
setTimeout(() => {
util.getUser()
}, 2000)
// setTimeout(() => {
// util.getUser()
// }, 2000)
}
})
},
... ... @@ -210,9 +210,9 @@ Page({
if (data.statusCode == 0) {
} else {
setTimeout(() => {
util.getUser()
}, 2000)
// setTimeout(() => {
// util.getUser()
// }, 2000)
}
})
} else if (res.cancel) {
... ...
... ... @@ -70,6 +70,7 @@ page{
.productPic image{
width: 180rpx;
height: 180rpx;
border-radius: 16rpx;
}
.productDetail {
... ...
... ... @@ -3,6 +3,7 @@ let method = require("../../utils/reuqest.js");
const util = require("../../utils/util.js");
Page({
data: {
Authorization: '', //判断用户是否登录
page: 1,
classifyId: "",
idx: 0, //商品规格索引
... ... @@ -41,24 +42,26 @@ Page({
})
},
//获取定位
getLocation() {
let that = this;
wx.getLocation({
type: 'gcj02',
success(res) {
that.setData({
latitude: res.latitude,
longitude: res.longitude
})
that.location();
const speed = res.speed
const accuracy = res.accuracy
}
})
},
// getLocation() {
// let that = this;
// wx.getLocation({
// type: 'gcj02',
// success(res) {
// that.setData({
// latitude: res.latitude,
// longitude: res.longitude
// })
// that.location();
// const speed = res.speed
// const accuracy = res.accuracy
// }
// })
// },
location() {
let that = this
console.log(that.data.latitude, '5555')
let str = that.data.latitude + ',' + that.data.longitude;
console.log(str, 'str')
method.getRequest("/goods/geocoder/v1/" + str, data => {
if (data.statusCode == 0) {
that.setData({
... ... @@ -156,22 +159,31 @@ Page({
})
},
addCart(e) {
let id = e.currentTarget.dataset.id
this.setData({
showMask: true
})
method.getRequest("/goods/" + id, data => {
if (data.statusCode == 0) {
this.setData({
goodsData: data.data,
stockNum: data.data.list[0].goodsStock
})
} else {
setTimeout(() => {
util.getUser()
}, 2000)
}
})
if (this.data.Authorization) {
let id = e.currentTarget.dataset.id
this.setData({
showMask: true
})
method.getRequest("/goods/" + id, data => {
if (data.statusCode == 0) {
this.setData({
goodsData: data.data,
stockNum: data.data.list[0].goodsStock
})
} else {
}
})
} else {
wx.showToast({
title: '请先登录!',
icon: 'none'
})
setTimeout(() => {
util.getUser()
}, 2000)
}
},
closeMask() {
this.setData({
... ... @@ -243,32 +255,38 @@ Page({
},
//兑换
exchange(e) {
let jifenNum = e.currentTarget.dataset.integral;
let defaultSku = e.currentTarget.dataset.defaultSku;
wx.setStorageSync('defaultSku', e.currentTarget.dataset.defaultsku)
//获取用户积分
method.getRequest("/myUser/queryUserInfo", data => {
if (data.statusCode == 0) {
this.setData({
integral: data.data.integral
})
if (jifenNum > this.data.integral) {
wx.showToast({
title: '您的积分目前不够兑换该商品',
icon: 'none'
})
return false
} else {
wx.navigateTo({
url: '/pages/integral-order/integral-order',
if (this.data.Authorization) {
let jifenNum = e.currentTarget.dataset.integral;
let defaultSku = e.currentTarget.dataset.defaultSku;
wx.setStorageSync('defaultSku', e.currentTarget.dataset.defaultsku)
//获取用户积分
method.getRequest("/myUser/queryUserInfo", data => {
if (data.statusCode == 0) {
this.setData({
integral: data.data.integral
})
}
} else {
setTimeout(() => {
util.getUser()
}, 2000)
}
})
if (jifenNum > this.data.integral) {
wx.showToast({
title: '您的积分目前不够兑换该商品',
icon: 'none'
})
return false
} else {
wx.navigateTo({
url: '/pages/integral-order/integral-order',
})
}
} else {}
})
} else {
wx.showToast({
title: '请先登录!',
icon: 'none'
})
setTimeout(() => {
util.getUser()
}, 2000)
}
},
//商品详情
... ... @@ -279,7 +297,26 @@ Page({
url: '/pages/product-detail/product-detail',
})
},
//再次申请获取位置信息
openConfirm: function () {
wx.showModal({
content: '检测到您没打开定位权限,有些功能无法使用,是否去设置打开?',
confirmText: "确认",
cancelText: "取消",
success: function (res) {
console.log(res);
//点击“确认”时打开设置页面
if (res.confirm) {
console.log('用户点击确认')
wx.openSetting({
success: (res) => {}
})
} else {
console.log('用户点击取消')
}
}
});
},
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -329,23 +366,65 @@ Page({
}
wx.removeStorageSync("classifyIndex")
let that = this;
wx.getLocation({
type: 'gcj02',
success(res) {
that.setData({
latitude: res.latitude,
longitude: res.longitude
//判断用户是否登录
if (this.data.Authorization) {
// wx.getLocation({
// type: 'gcj02',
// success(res) {
// that.setData({
// latitude: res.latitude,
// longitude: res.longitude
// })
// that.location();
// const speed = res.speed
// const accuracy = res.accuracy
// },
// fail(errInfo) {
// console.info(errInfo)
// }
// })
}
//判断用户是否登录
if (wx.getStorageSync('Authorization') === '') {
this.setData({
Authorization: false
})
} else {
this.setData({
Authorization: true
})
//位置
wx.getLocation({
type: 'wgs84',
success: function (res) {
that.setData({
longitude: res.longitude,
latitude: res.latitude
})
that.location()
}
})
//判断是否获得了用户地理位置授权
if (that.data.latitude == undefined) {
wx.getSetting({
success: (res) => {
if (!res.authSetting['scope.userLocation'])
that.openConfirm()
}
})
that.location();
const speed = res.speed
const accuracy = res.accuracy
},
fail(errInfo) {
console.info(errInfo)
}
})
}
if (that.data.latitude !== undefined) {
setTimeout(() => {
that.location()
}, 1000)
}
},
open() {
},
/**
* 生命周期函数--监听页面隐藏
*/
... ...
... ... @@ -2,7 +2,7 @@
<!-- 搜索框 -->
<view class="searchMain">
<view class="location">
<view style="display:inline-block;height: 20rpx;width: 20rpx;">
<view style="display:inline-block;height: 20rpx;width: 20rpx;" bindtap="open">
<image src="/images/location.png"></image>
</view>
<text>{{location}}</text>
... ... @@ -87,6 +87,7 @@
<view class="info">
<image src="{{goodsData.goodsBanners[0]}}"></image>
<view class="info_right">
<view class="info_name">{{goodsData.goodsName}}</view>
<view class="info_price">¥{{goodsData.list[idx].goodsPrice}}</view>
<view class="info_stock">库存:{{goodsData.list[idx].goodsStock}}件</view>
<view class="info_stock" wx:if='{{info.detai.spec_type=="20"}}'>请选择规格</view>
... ...
... ... @@ -252,6 +252,7 @@ page {
.productLeft image {
width: 180rpx;
height: 180rpx;
border-radius: 16rpx;
}
.productRight {
... ... @@ -380,14 +381,17 @@ page {
.info_right {
width: calc(100% - 212rpx);
padding-top: 46rpx;
padding-left: 36rpx;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: flex-end
}
.info_name{
margin-bottom: 48rpx;
font-size: 30rpx;
color: #323233;
}
.info_price {
font-size: 28rpx;
font-family: PingFang SC;
... ...
//index.js
//获取应用实例
Page({
data: { location: {}
},
onLoad: function () {
var that = this
wx.getLocation({
type: 'wgs84',
success: function (res) {
that.setData({
location: {
longitude: res.longitude,
latitude: res.latitude
}
})
}
})
//判断是否获得了用户地理位置授权
wx.getSetting({
success: (res) => {
if (!res.authSetting['scope.userLocation'])
that.openConfirm()
}
})
},
openConfirm: function () {
wx.showModal({
content: '检测到您没打开美团外卖的定位权限,是否去设置打开?',
confirmText: "确认",
cancelText: "取消",
success: function (res) {
console.log(res);
//点击“确认”时打开设置页面
if (res.confirm) {
console.log('用户点击确认')
wx.openSetting({
success: (res) => { }
})
} else {
console.log('用户点击取消')
}
}
});
},
})
\ No newline at end of file
... ...
{
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--pages/demo1/demo1.wxml-->
<view class="location">
</view>
\ No newline at end of file
... ...
/* pages/demo1/demo1.wxss */
\ No newline at end of file
... ...
... ... @@ -176,7 +176,7 @@ Page({
submit() {
console.log(this.data.orderId, 'orderid')
let postData = {
anonymous: this.data.checkType,
anonymous: this.data.checkType?'1':'0',
content: this.data.content,
orderId: this.data.orderId,
contentImages: this.data.imgs
... ...
... ... @@ -12,7 +12,7 @@ Page({
classifyArray: [], //分类
limitCount: '限时优惠', //限时优惠
limitCountShow: true,
moreCount: '更多优惠',
moreCount: '查看更多',
time: '', //限时优惠倒计时
timeData: {},
hour: "",
... ... @@ -25,7 +25,7 @@ Page({
discountArray: [], //每日特价
dayPrice: '每日特价',
dayPriceShow: true,
morePrice: '更多特价',
morePrice: '查看更多',
dayPicArray: [],
nameData: '', //九月主推
marilyArray: [{
... ... @@ -235,8 +235,8 @@ Page({
},
//更多优惠
moreCount() {
wx.switchTab({
url: '/pages/classify/classify',
wx.navigateTo({
url: '/pages/look-more/look-more?parameter='+'1',
})
},
//加入购物车
... ... @@ -304,8 +304,8 @@ Page({
},
//更多特价
morePrice() {
wx.switchTab({
url: '/pages/classify/classify',
wx.navigateTo({
url: '/pages/look-more/look-more?parameter='+'2',
})
},
//九月主推
... ... @@ -332,6 +332,11 @@ Page({
}
})
},
moreMainly(){
wx.navigateTo({
url: '/pages/look-more/look-more?parameter='+'3',
})
},
// 弹出优惠券领取
getCard() {
... ...
... ... @@ -12,20 +12,20 @@
</view>
</view> -->
<van-search value="{{ value }}" shape="round" background='linear-gradient(137deg,#5b8eff, #2e55ff 92%)'
placeholder="搜索" bind:focus="goSearch"/>
placeholder="搜索" bind:focus="goSearch" />
</view>
<!-- 轮播图 -->
<view style="margin-top:60rpx">
<swiper class="swiper" indicator-dots="true" autoplay="true" interval="5000" duration="1000">
<block wx:for="{{swiperArray}}" wx:for-index="idx">
<swiper-item bindtap="goBannnerDetail" data-url="{{item.url}}" data-index="{{index}}">
<image src="{{item.img}}" class="slideImage" ></image>
<image src="{{item.img}}" class="slideImage"></image>
</swiper-item>
</block>
</swiper>
</view>
<!-- 分类 -->
<view class="classify">
<view class="{{countDownShow?'classify':'classify1'}}">
<scroll-view class='wrapper1' scroll-x="true">
<view wx:for="{{classifyArray}}" class="classifyItem" bindtap="classifyEvent" data-id="{{item.categoryId}}"
data-index="{{index}}">
... ... @@ -37,11 +37,11 @@
</scroll-view>
</view>
<!-- 限时优惠 -->
<view class="dayDiscount" wx:if="{{limitCountShow}}">
<view class="dayDiscount" wx:if="{{limitCountShow}}" wx:if="{{countDownShow}}">
<view class="discountTitle">
<view class="limitCount">{{limitCount}}</view>
<!-- 倒计时 -->
<view class="countTime" wx:if="{{countDownShow}}">
<view class="countTime">
<view class="textss">{{hour}}</view>
<view class="maohao">:</view>
<view class="textss">{{minute}}</view>
... ... @@ -70,9 +70,9 @@
<!-- </view> -->
</view>
<!-- 每日特价 -->
<view class="borderTop"></view>
<view class="borderTop"></view>
<view class="dayPriceContent">
<view class="dayPrice">
<view class="dayPrice" wx:if="{{dayPicArray.length!==0}}">
<view class="dayPriceTitle">
<view class="dayPriceText">{{dayPrice}}</view>
<view class="dayPriceTime">
... ... @@ -96,9 +96,15 @@
</view>
</view>
<view class="mainly">
<view class="dayPriceTitle">
<view class="dayPriceText">{{nameData.name}}</view>
<view class="mainlyTitle">{{nameData.label}}</view>
<view class="dayPriceTitle" style="display: flex;justify-content: space-between;">
<view>
<view class="dayPriceText">{{nameData.name}}</view>
<view class="mainlyTitle">{{nameData.label}}</view>
</view>
<view style="position: relative;">
<view bindtap="moreMainly" class="moreMainly">查看更多</view>
<view class="arrow" bindtap="moreMainly"></view>
</view>
</view>
<view class="dayPricePicMain">
<scroll-view class='wrapper' scroll-x="true">
... ... @@ -122,7 +128,7 @@
<view class="pickDesc">{{item.goodsAttributes}}</view>
<view class="userInfo">
<view class="collectIcon">
<image src="{{item.collectIcon}}"></image>
<!-- <image src="{{item.collectIcon}}"></image> -->
<view style="display:inline-block">¥{{item.goodsPrice}}</view>
</view>
</view>
... ...
... ... @@ -19,9 +19,10 @@
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(137deg,#5b8eff, #2e55ff 92%);
background: linear-gradient(137deg, #5b8eff, #2e55ff 92%);
z-index: 66;
}
.pageTitle {
width: 100%;
height: 88rpx;
... ... @@ -35,12 +36,14 @@
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(137deg,#5b8eff, #2e55ff 92%);
background: linear-gradient(137deg, #5b8eff, #2e55ff 92%);
z-index: 66;
}
.van-tabs{
.van-tabs {
background: #f1f2f4;
}
.contenter {
/* margin-bottom: 100rpx; */
padding: 47rpx 32rpx 0 32rpx;
... ... @@ -338,12 +341,13 @@ page {
}
/* 每日特价 */
.borderTop{
width:92%;
.borderTop {
width: 92%;
height: 32rpx;
background-color: #f1f2f4;
border-radius: 10rpx;
}
.dayPriceContent {
width: 686rpx;
background-color: rgb(241, 240, 150);
... ... @@ -362,7 +366,11 @@ page {
.mainly {
width: 100%;
}
.moreMainly{
font-size: 28rpx;
color: rgb(167, 164, 164);
padding-right: 10rpx;
}
.dayPriceText {
width: 128rpx;
height: 44rpx;
... ... @@ -431,6 +439,7 @@ page {
.pickContent {
/* width: 343rpx; */
width: 100%;
display: flex;
justify-content: space-between;
margin-top: 24rpx;
... ... @@ -441,13 +450,14 @@ page {
}
.pickItem {
width: 336rpx;
padding: 0 4rpx 8rpx;
width: 49%;
/* padding: 0 4rpx 8rpx; */
box-sizing: border-box;
background-color: #ffffff;
margin-bottom: 16rpx;
break-inside: avoid;
border-radius: 16rpx;
padding-bottom: 8rpx;
}
.pickPic {
... ... @@ -466,9 +476,8 @@ page {
font-size: 28rpx;
font-weight: 500;
color: #323233;
padding-left: 8rpx;
padding: 0 24rpx;
box-sizing: border-box;
width: 296rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
... ... @@ -481,8 +490,7 @@ page {
text-align: left;
color: #7d7e80;
margin-top: 8rpx;
padding-left: 8rpx;
padding-right: 16rpx;
padding: 0 24rpx;
box-sizing: border-box;
word-break: break-all;
overflow: hidden;
... ... @@ -542,6 +550,11 @@ page {
height: 36rpx;
justify-content: space-between;
text-align: right;
padding: 0 24rpx;
box-sizing: border-box;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.userBox {
... ... @@ -574,17 +587,13 @@ page {
}
.collectIcon {
font-size: 24rpx;
font-size: 28rpx;
color: #ff4742;
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 15rpx;
}
.collectIcon>view {
margin-left: 8rpx;
}
/* 弹出层 */
.delIcon {
... ...
... ... @@ -2,7 +2,7 @@
<view class="container">
<!-- 地址 -->
<view class="address" bindtap="emit">
<view class="address_content_left" style="width:92%">
<view class="address_content_left" style="width:92%">
<view>
<view class="userName">{{userData.name}}</view>
<view class="userTell">{{userData.phone}}</view>
... ... @@ -18,22 +18,25 @@
</view>
</view>
<!-- 配送时间 -->
<view class="timeBox" >
<view class="timeBox">
<view style="width:95%;display:flex" bindtap='chooseTime'>
<view class="calendar " >
请选择配送时间:
<view class="calendar " wx:if="{{storePickupTime==''}}">
请选择配送时间:
</view>
<view class="calendar1 " wx:if="{{storePickupTime!==''}}">
配送时间:
</view>
<view class="selectText">{{storePickupTime}}</view>
</view>
<view class="selectText">{{storePickupTime}}</view>
</view>
<view class="arrow" bindtap='chooseTime'>
<image src="/images/04-01/arrow.png"></image>
</view>
<view class="section">
<van-popup show="{{ showTime }}" bind:close="onClose" position="bottom" >
<timepicker deliveryTime='{{deliveryTime}}' bind:selectTime="selectTime" id="aaa"></timepicker>
</van-popup>
</view>
</view>
<image src="/images/04-01/arrow.png"></image>
</view>
<view class="section">
<van-popup show="{{ showTime }}" bind:close="onClose" position="bottom">
<timepicker deliveryTime='{{deliveryTime}}' bind:selectTime="selectTime" id="aaa"></timepicker>
</van-popup>
</view>
</view>
<!-- 商品列表 -->
<view class="cartList">
<!-- <view class="cartListItem" wx:for="{{cartList}}"> -->
... ...
... ... @@ -19,6 +19,13 @@ page {
color: #323233;
width: 204rpx;
}
.calendar1 {
font-size: 28rpx;
font-weight: 400;
text-align: left;
color: #323233;
width: 142rpx;
}
.selectText {
font-size: 28rpx;
... ... @@ -95,7 +102,7 @@ page {
.userAddress {
width: 504rpx;
font-size: 28prx;
font-size: 28rpx;
font-weight: 400;
text-align: left;
color: #6c6c6d;
... ...
// pages/searchRequest/searchRequest.js
let method = require("../../utils/reuqest.js")
Page({
data: {
list: [],
keyword: '',
bottomHint: false, //触底提示
pageNum: 1,
parameter: '' //路径参数
},
getMoreSpecial() {
let postData = {
page: 1,
size: 10
}
method.postRequest("/goods/todaySpecial", postData, data => {
if (data.statusCode == 0) {
this.setData({
list: data.data
})
}
})
},
getMoreDiscount() {
let postData = {
page: this.data.pageNum,
size: 10
}
method.postRequest("/goods/limitedTimeOffer", postData, data => {
if (data.statusCode == 0) {
this.setData({
list: data.data
})
}
})
},
getMoreMainly() {
let postData = {
page: 1,
size: 10
}
method.postRequest("/goods/septemberMainPush", postData, data => {
if (data.statusCode == 0) {
this.setData({
list: data.data
})
}
})
},
//商品详情
goGoodsDetail(e) {
let id = e.currentTarget.dataset.id;
wx.navigateTo({
url: '/pages/product-detail/product-detail?id=' + id,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options, 'options')
this.setData({
parameter: options.parameter
});
if (Number(options.parameter) == 1) {
this.getMoreDiscount()
} else if (Number(options.parameter) == 2) {
this.getMoreSpecial()
} else {
this.getMoreMainly()
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onRefresh() {
this.setData({
pageNum: 1,
list: []
})
let parameter = this.data.parameter;
if (parameter==1) {
this.getMoreDiscount()
}else if(parameter==2){
this.getMoreSpecial()
}else{
this.getMoreMainly()
}
},
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.setData({
bottomHint: true
})
setTimeout(() => {
this.setData({
bottomHint: false
})
}, 2000)
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
"usingComponents": {
"van-search": "@vant/weapp/search/index"
},
"navigationBarTitleText": "查看更多",
"enablePullDownRefresh": true
}
... ...
<!--pages/searchRequest/searchRequest.wxml-->
<!-- 搜索 -->
<!-- <view class="search_center" catchtap="goSearch">
<van-search value="{{keyword}}" placeholder="请输入搜索关键词" use-action-slot shape="round" bind:change="onChange"
bind:search="onSearch">
<view slot="action" bind:tap="onClick">搜索</view>
</van-search>
</view> -->
<!-- 商品列表 -->
<view class="productList" wx:if="{{list.length==0}}">
没有找到您想要的商品~
</view>
<view class="listBox">
<view class="pickContainer">
<view class="pickContent">
<view class="pickItem" wx:for="{{list}}" data-id="{{item.goodsId}}" bindtap="goGoodsDetail">
<view class="pickPic">
<image src="{{item.goodsImg}}"></image>
</view>
<view class="pickTitle">{{item.goodsName}}</view>
<view class="pickDesc">{{item.goodsAttributes}}</view>
<view class="collectIcon">
<view style="height:10rpx;display:none"></view>
<view style="display:inline-block;font-size: 28rpx; padding: 10rpx 0;">¥{{item.goodsPrice}}</view>
</view>
</view>
</view>
</view>
</view>
<view class="bottomHint" wx:if="{{bottomHint}}">
我是有底线的~
</view>
\ No newline at end of file
... ...
/* pages/searchRequest/searchRequest.wxss */
/* 搜索 */
/* 搜索框 */
page{
background-color: #f1f2f4;
}
.search_center {
height: 90rpx;
width: 750rpx;
margin-bottom: 24rpx;
position: fixed;
top: 2rpx;
left: 0;
background-color: #f1f2f4;
}
.real_search_center {
margin: 0 auto;
margin-bottom: 24rpx;
width: 686rpx;
height: 64rpx;
background: rgba(255, 255, 255, 1);
border-radius: 186rpx;
position: relative;
}
.icon-sousuo {
font-size: 32rpx;
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 20rpx;
}
.real_search_center input {
width: 676rpx;
height: 100%;
margin: 0 auto;
border-radius: 46rpx;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
line-height: 64rpx;
color: rgba(189, 196, 206, 1);
padding: 0 60rpx;
box-sizing: border-box;
padding-left: 20rpx;
box-sizing: border-box;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
background: #ffffff;
}
.search_right {
width: 66rpx;
height: 64rpx;
border-radius: 20rpx;
text-align: center;
line-height: 64rpx;
color: #fff;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
display: flex;
align-items: center;
}
.search_right image {
width: 36rpx;
height: 36rpx;
}
.placeholder {
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
line-height: 64rpx;
color: rgba(189, 196, 206, 1);
}
.search_right {
width: 104rpx;
height: 48rpx;
border-radius: 20rpx;
text-align: center;
color: rgb(223, 219, 219);
font-size: 28rpx;
font-weight: 400;
display: inline-block;
position: absolute;
top: 3rpx;
right: 8rpx;
cursor: progress;
}
/* 商品列表 */
.productList{
width: 750rpx;
height:750rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 32rpx;
color: rgb(206, 208, 209);
}
.listBox{
display: flex;
padding: 0 26rpx;
box-sizing: border-box;
}
/* 每日精选*/
.pickContainer {
display: flex;
justify-content: space-between;
flex-direction: row;
}
.pickContent {
/* width: 343rpx; */
display: flex;
justify-content: space-between;
margin-top: 24rpx;
flex-wrap: wrap;
border-radius: 16rpx;
column-count: 2;
column-gap: 20rpx;
width: 700rpx;
}
.pickItem {
width: 336rpx;
box-sizing: border-box;
background-color: #ffffff;
margin-bottom: 16rpx;
break-inside: avoid;
border-radius: 16rpx;
padding-bottom: 8rpx;
}
.pickPic {
width: 100%;
height: 328rpx;
}
.pickPic image {
width: 100%;
height: 328rpx;
border-radius: 16rpx;
}
.pickTitle {
margin-top: 16rpx;
font-size: 28rpx;
font-weight: 500;
color: #323233;
padding-left: 8rpx;
box-sizing: border-box;
}
.pickDesc {
font-size: 24rpx;
font-weight: 400;
text-align: left;
color: #7d7e80;
margin-top: 8rpx;
padding-left: 8rpx;
padding-right: 16rpx;
box-sizing: border-box;
width: 310rpx;
overflow: hidden;
}
.pickCollect {
font-size: 24rpx;
font-weight: 400;
text-align: left;
color: #7d7e80;
margin-top: 8rpx;
padding-left: 8rpx;
padding-right: 16rpx;
box-sizing: border-box;
display: flex;
justify-content: space-between;
}
.collectIcon {
font-size: 24rpx;
color: #ff4742;
display: flex;
align-items: center;
justify-content: space-between;
}
.collectIcon>view {
margin-left: 8rpx;
}
.bottomHint {
background-color: #f1f2f4;
font-size: 24rpx;
color: gray;
display: flex;
justify-content: center;
padding-bottom:16rpx;
}
... ...
... ... @@ -3,6 +3,7 @@ let method = require("../../utils/reuqest.js");
const util = require("../../utils/util.js");
Page({
data: {
Authorization: '', //判断用户是否登录
id: '',
skuId: '',
goodsId: '',
... ... @@ -29,7 +30,7 @@ Page({
showMask: false,
showMaskTwo: false,
showMaskSku: false,
count: "",
count: 1,
payCount: 1,
stockNum: '',
richText: '',
... ... @@ -38,7 +39,7 @@ Page({
ceshi: [], //商品规格
idx: 0, //商品规格
jifenNum: '', //商品积分
integral:''
integral: ''
},
//倒计时
onChange1(e) {
... ... @@ -120,7 +121,7 @@ Page({
// richText:data.data.goodsDesc
richText: richText,
goodsId: data.data.goodsId,
jifenNum:data.data.goodsPrice,
jifenNum: data.data.goodsPrice,
})
this.evaluate()
console.log(this.data.goodsId, 'goodsid')
... ... @@ -156,9 +157,9 @@ Page({
//进入购物车
goCart() {
if (wx.getStorageSync('Authorization') == " ") {
setTimeout(() => {
util.getUser();
}, 2000)
// setTimeout(() => {
// util.getUser();
// }, 2000)
} else {
wx.switchTab({
url: '/pages/shopping-cart/shopping-cart',
... ... @@ -167,40 +168,41 @@ Page({
},
// 收藏
collection() {
if (this.data.goodsData.keep) {
let data = this.data.goodsData;
data.keep = false;
this.setData({
goodsData: data
if (this.data.Authorization) {
if (this.data.goodsData.keep) {
let data = this.data.goodsData;
data.keep = false;
this.setData({
goodsData: data
})
} else {
let data = this.data.goodsData;
data.keep = true;
this.setData({
goodsData: data
})
}
method.getRequest("/myUser/myCollection/" + this.data.goodsId, data => {
if (data.statusCode == 0) {} else {}
})
} else {
let data = this.data.goodsData;
data.keep = true;
this.setData({
goodsData: data
wx.showToast({
title: '请先登录',
icon: 'none'
})
setTimeout(() => {
util.getUser()
}, 2000)
}
method.getRequest("/myUser/myCollection/" + this.data.goodsId, data => {
if (data.statusCode == 0) {
} else {
wx.showToast({
title: '请先登录',
icon: 'none'
})
setTimeout(() => {
util.getUser()
}, 2000)
}
})
},
//联系客服
linkKefu() {
if (getStorageSync.Authorization == "") {
setTimeout(() => {
util.getUser()
}, 2000)
// setTimeout(() => {
// util.getUser()
// }, 2000)
} else {
wx.makePhoneCall({
phoneNumber: '111111111000',
... ... @@ -236,21 +238,43 @@ Page({
},
//在线客服
myKefu() {
wx.makePhoneCall({
phoneNumber: '111111111000',
success() {
console.log('拨打电话成功')
},
fail() {
console.log('拨打电话失败')
}
})
if (this.data.Authorization) {
wx.makePhoneCall({
phoneNumber: '111111111000',
success() {
console.log('拨打电话成功')
},
fail() {
console.log('拨打电话失败')
}
})
} else {
wx.showToast({
title: '请先登录!',
icon: 'none'
})
setTimeout(() => {
util.getUser()
}, 2000)
}
},
//加入购物车
addCart() {
this.setData({
showMask: true
})
if (this.data.Authorization) {
this.setData({
showMask: true
})
} else {
wx.showToast({
title: '请先登录!',
icon: 'none'
})
setTimeout(() => {
util.getUser()
}, 2000)
}
},
closeMask() {
this.setData({
... ... @@ -280,9 +304,9 @@ Page({
duration: 1000
})
} else {
setTimeout(() => {
util.getUser()
}, 2000)
// setTimeout(() => {
// util.getUser()
// }, 2000)
}
})
},
... ... @@ -365,28 +389,57 @@ Page({
},
//立即购买
immediatelyPay() {
method.getRequest("/myUser/queryUserInfo", data => {
if (data.statusCode == 0) {
this.setData({
integral: data.data.integral
})
if (this.data.jifenNum > this.data.integral) {
wx.showToast({
title: '您的积分目前不够兑换该商品',
icon: 'none'
})
return false
} else {
if (this.data.Authorization) {
method.getRequest("/myUser/queryUserInfo", data => {
if (data.statusCode == 0) {
this.setData({
showMaskTwo: true
})
}
} else {
setTimeout(() => {
util.getUser()
}, 2000)
}
})
})
} else {
wx.showToast({
title: '请先登录!',
icon: 'none'
})
setTimeout(() => {
util.getUser()
}, 2000)
}
},
//立即兑换
immediatelyPay1() {
if (this.data.Authorization) {
method.getRequest("/myUser/queryUserInfo", data => {
if (data.statusCode == 0) {
this.setData({
integral: data.data.integral
})
if (this.data.jifenNum > this.data.integral) {
wx.showToast({
title: '您的积分目前不够兑换该商品',
icon: 'none'
})
return false
} else {
this.setData({
showMaskTwo: true
})
}
} else {
}
})
} else {
wx.showToast({
title: '请先登录!',
icon: 'none'
})
setTimeout(() => {
util.getUser()
}, 2000)
}
},
closeMaskTwo() {
... ... @@ -417,9 +470,9 @@ Page({
duration: 1000
})
} else {
setTimeout(() => {
util.getUser()
}, 2000)
// setTimeout(() => {
// util.getUser()
// }, 2000)
}
})
},
... ... @@ -490,6 +543,16 @@ Page({
setTimeout(() => {
this.demoDown();
}, 200)
//判断用户是否登录
if (wx.getStorageSync('Authorization') === '') {
this.setData({
Authorization: false
})
} else {
this.setData({
Authorization: true
})
}
},
/**
... ...
... ... @@ -41,7 +41,8 @@
</view>
<!-- 请选择 -->
<view class="selectMain" bindtap="selectSku">
<view class="selectMain" bindtap="addCart">
<!-- <view class="selectMain" bindtap="selectSku"> -->
<view class="selectTitle">选择</view>
<view class="selectNum">
<view>{{}}</view>
... ... @@ -65,10 +66,13 @@
<view class="noData" wx:if="{{infoList.length==0}}">暂时没有相关商品的更多评价~</view>
<view class="evaluateBox" wx:for="{{infoList}}" wx:if="{{infolist!==0}}">
<view class="evaluateInfo">
<view class="userImg" style="display:inline-block">
<view class="userImg" style="display:inline-block" wx:if="{{item.anonymous==0}}">
<image src="{{item.wxHeadImg}}"> </image>
</view>
<view class="userName" style="display:inline-block">{{item.wxName}}</view>
<view class="userImg" style="display:inline-block" wx:if="{{item.anonymous==1}}">
<image src="/images/nimingtouxiang.png"> </image>
</view>
<view class="userName" style="display:inline-block" >{{item.wxName}}</view>
</view>
<view class="evaluateDetails">{{item.content}}</view>
<view class="evaluatePic" wx:if="{{item.images}}">
... ... @@ -124,7 +128,7 @@
<view class="Mask"></view>
</view>
<view class="bottom_right_two" wx:if="{{goodsData.type==1}}">
<view class="bottom_right_right_two" catchtap="immediatelyPay">立即兑换</view>
<view class="bottom_right_right_two" catchtap="immediatelyPay1">立即兑换</view>
</view>
</view>
<!-- 选择规格弹框 -->
... ... @@ -137,7 +141,7 @@
</view>
</view>
<!-- 加入购物车弹框 -->
<view class="mask" catchtap="closeMask" wx:if='{{showMask}}'>
<!-- <view class="mask" catchtap="closeMask" wx:if='{{showMask}}'>
<view class="diceng" catchtap="openMask">
<view class="info">
<image src="{{goodsData.goodsBanners[idx]}}"></image>
... ... @@ -155,6 +159,8 @@
catchtap="changeAttrNum">{{cell.spec_value}}</view>
</view>
</view>
<view>
</view>
<view class="pay_count">
<view>购买数量</view>
<view class="count_box">
... ... @@ -167,6 +173,40 @@
<view class="btn" wx:if='{{type==1}}' catchtap="jiagou">加入购物车</view>
<view class="btn" wx:if='{{type==2}}' catchtap="lijigoumai">立即购买</view>
</view>
</view> -->
<view class="mask" catchtap="closeMask" wx:if='{{showMask}}'>
<view class="diceng" catchtap="openMask">
<view class="info">
<image src="{{goodsData.goodsBanners[0]}}"></image>
<view class="info_right">
<view class="info_name">{{goodsData.goodsName}}</view>
<view class="info_price">¥{{goodsData.list[idx].goodsPrice}}</view>
<view class="info_stock">库存:{{goodsData.list[idx].goodsStock}}件</view>
<view class="info_stock" wx:if='{{info.detai.spec_type=="20"}}'>请选择规格</view>
</view>
</view>
<view class="attr" wx:if='{{info.detail.spec_type=="20"}}' wx:for='{{info.specData.spec_attr}}' wx:key='index'>
<view>{{item.group_name}}</view>
<view class="attr_main">
<view class="attr_item {{cell.flag?'activity':''}}" wx:for='{{item.spec_items}}' wx:for-item='cell'
wx:for-index='cellindex' wx:key='{{cellindex}}' data-index='{{index}}' data-cellindex='{{cellindex}}'
catchtap="changeAttrNum">{{cell.spec_value}}</view>
</view>
</view>
<view class="spec">
<view class="{{idx==index?'specItem1':'specItem'}}" wx:for="{{goodsData.list}}" bindtap="check"
data-index="{{index}}" data-id="{{item.goodsSkuId}}">{{item.goodsSkuName}}</view>
</view>
<view class="pay_count">
<view>购买数量</view>
<view class="count_box">
<view class="count_jian" catchtap="decNum">-</view>
<view class="real_count">{{count}}</view>
<view class="count_jian" catchtap="addNum">+</view>
</view>
</view>
<view class="confrimBtn" catchtap="confrimCart">确定</view>
</view>
</view>
<!-- 立即购买弹框 -->
<view class="mask" catchtap="closeMaskTwo" wx:if='{{showMaskTwo}}'>
... ... @@ -174,6 +214,7 @@
<view class="info">
<image src="{{goodsData.goodsBanners[0]}}"></image>
<view class="info_right">
<view class="info_name">{{goodsData.goodsName}}</view>
<view class="info_price">¥{{goodsData.list[idx].goodsPrice}}</view>
<view class="info_stock">库存:{{goodsData.list[idx].goodsStock}}件</view>
<view class="info_stock" wx:if='{{info.detai.spec_type=="20"}}'>请选择规格</view>
... ... @@ -187,6 +228,18 @@
catchtap="changeAttrNum">{{cell.spec_value}}</view>
</view>
</view>
<view class="attr" wx:if='{{info.detail.spec_type=="20"}}' wx:for='{{info.specData.spec_attr}}' wx:key='index'>
<view>{{item.group_name}}</view>
<view class="attr_main">
<view class="attr_item {{cell.flag?'activity':''}}" wx:for='{{item.spec_items}}' wx:for-item='cell'
wx:for-index='cellindex' wx:key='{{cellindex}}' data-index='{{index}}' data-cellindex='{{cellindex}}'
catchtap="changeAttrNum">{{cell.spec_value}}</view>
</view>
</view>
<view class="spec">
<view class="{{idx==index?'specItem1':'specItem'}}" wx:for="{{goodsData.list}}" bindtap="check"
data-index="{{index}}" data-id="{{item.goodsSkuId}}">{{item.goodsSkuName}}</view>
</view>
<view class="pay_count">
<view>购买数量</view>
<view class="count_box">
... ...
... ... @@ -212,7 +212,7 @@
/* 评价 */
.evaluateContent {
width: 750rpx;
max-height: 236rpx;
max-height: 252rpx;
box-sizing: border-box;
background-color: #ffffff;
margin: 0 auto;
... ... @@ -601,14 +601,17 @@ button {
.info_right {
width: calc(100% - 212rpx);
padding-top: 46rpx;
padding-left: 36rpx;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: flex-end
}
.info_name{
margin-bottom: 48rpx;
font-size: 30rpx;
color: #323233;
}
.info_price {
font-size: 28rpx;
font-family: PingFang SC;
... ... @@ -733,6 +736,217 @@ button {
margin-top: 20rpx;
}
/* 购物车弹框 */
.mask {
position: fixed;
top: 72rpx;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: 2
}
.diceng {
width: 100%;
position: absolute;
bottom: 40rpx;
left: 0;
border-radius: 10rpx 10rpx 0 0;
background: #fff;
padding: 30rpx 32rpx;
box-sizing: border-box;
max-height: 94%;
overflow-y: auto;
margin-bottom: 22rpx;
}
.info {
display: flex;
}
.info image {
width: 176rpx;
height: 176rpx;
display: block;
border: 1rpx solid #ff6d00;
border-radius: 8rpx;
}
.info_right {
width: calc(100% - 212rpx);
padding-left: 36rpx;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: flex-end
}
.info_price {
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
line-height: 40rpx;
color: rgba(255, 109, 0, 1);
}
.info_stock {
margin-top: 6rpx;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
line-height: 40rpx;
color: rgba(140, 145, 152, 1);
}
.attr {
margin-top: 46rpx;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 500;
line-height: 40rpx;
color: rgba(6, 18, 30, 1);
}
.attr_main {
margin-top: 10rpx;
display: flex;
flex-wrap: wrap;
}
.attr_item {
padding: 0 50rpx;
height: 60rpx;
box-sizing: border-box;
background: rgba(238, 238, 238, 1);
border-radius: 30rpx;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
line-height: 60rpx;
color: rgba(6, 18, 30, 1);
margin: 22rpx 22rpx 0 0;
border: 2rpx solid transparent;
}
.attr_item.activity {
background: rgba(253, 229, 211, 1);
border: 2rpx solid rgba(246, 105, 0, 1);
color: rgba(255, 109, 0, 1);
}
.spec {
width: 100%;
padding: 10rpx;
display: flex;
flex-wrap: wrap;
margin-right: 20rpx;
align-items: center;
justify-content: space-around;
border-top: 3rpx solid #f5f5f5;
margin-top: 20rpx;
}
.specItem {
font-size: 30rpx;
color: #323233;
height: 57rpx;
width: auto;
background-color: rgb(238, 239, 241);
padding: 0 20rpx;
border-radius: 16rpx;
margin-bottom: 10rpx;
display: flex;
width: auto;
align-items: center;
}
.specItem1 {
font-size: 30rpx;
color: #323233;
height: 57rpx;
width: auto;
background-color: rgb(197, 198, 199);
padding: 0 20rpx;
border-radius: 16rpx;
margin-bottom: 10rpx;
display: flex;
justify-content: center;
align-items: center;
width: auto;
}
.pay_count {
padding: 24rpx 0;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
border-top: 1rpx solid #eee;
border-bottom: 1rpx solid #eee;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 500;
color: rgba(6, 18, 30, 1);
margin-top: 0;
}
.count_box {
display: flex;
align-items: center;
}
.count_jian {
width: 56rpx;
height: 56rpx;
background: rgba(238, 238, 238, 1);
border-radius: 8rpx;
text-align: center;
line-height: 56rpx;
font-size: 38rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(6, 18, 30, 1);
display: flex;
align-items: center;
justify-content: center;
}
.real_count {
padding: 0 20rpx;
box-sizing: border-box;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 500;
line-height: 56rpx;
color: rgba(61, 68, 77, 1);
}
.btn {
height: 100rpx;
text-align: center;
line-height: 100rpx;
width: 100vw;
margin-left: -32rpx;
background: rgba(255, 109, 0, 1);
color: #fff;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
margin-top: 64rpx;
}
.confrimBtn {
height: 78rpx;
display: flex;
background-color: #f16304;
color: #ffffff;
align-items: center;
justify-content: center;
margin-top: 20rpx;
border-radius: 36rpx;
}
/* 商品明细 */
rich-text .rich-img {
width: 100%;
... ...
... ... @@ -13,7 +13,8 @@ Page({
title: '香蕉'
}],
title: '猜你喜欢',
list: []
list: [],
bottomHint:false //触底提示
},
//获取输入的关键字
onChange(e) {
... ... @@ -56,18 +57,18 @@ Page({
})
},
delSearch() {
let that=this;
let that = this;
wx.showModal({
title: '提示',
content: '确认删除所有历史记录吗?',
success (res) {
success(res) {
if (res.confirm) {
method.deleteRequest("/coupon/deleteHistory",data=>{
if(data.statusCode==0){
method.deleteRequest("/coupon/deleteHistory", data => {
if (data.statusCode == 0) {
that.setData({
labelArray:[]
labelArray: []
})
}
}
})
} else if (res.cancel) {
console.log('用户点击取消')
... ... @@ -154,7 +155,14 @@ Page({
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.setData({
bottomHint: true
})
setTimeout(() => {
this.setData({
bottomHint: false
})
})
},
/**
... ...
... ... @@ -11,7 +11,8 @@
</view>
</view>
<view class="search_right" catchtap="unsearch">取消</view> -->
<van-search value="{{keyWord}}" placeholder="请输入搜索关键词" shape="round" show-action bind:search="search" bind:cancel="onCancel" bind:change="onChange"/>
<van-search value="{{keyWord}}" placeholder="请输入搜索关键词" shape="round" show-action bind:search="search"
bind:cancel="onCancel" bind:change="onChange" />
</view>
<!-- 搜索历史 -->
... ... @@ -46,12 +47,15 @@
<view class="listTitle">{{item.goodsName}}</view>
<view class="collect">{{item.goodsAttributes}}</view>
<view class="discount">
<view class="discountTitle"></view>
<view class="discountPic">
¥{{item.goodsPrice}}
</view>
</view>
</view>
</view>
<view class="bottomHint" wx:if="{{bottomHint}}">
我是有底线的~
</view>
</view>
</view>
\ No newline at end of file
... ...
... ... @@ -3,11 +3,12 @@
padding-top: 24rpx;
background: linear-gradient(180deg, #ffffff, #ebedf0);
}
/* 搜索框 */
.search_center {
height: 68rpx;
margin-bottom: 24rpx;
width:750rpx;
width: 750rpx;
}
.real_search_center {
... ... @@ -24,7 +25,7 @@
margin-left: 32rpx;
}
.searchIcon{
.searchIcon {
width: 32rpx;
height: 32rpx;
margin-right: 12rpx;
... ... @@ -33,10 +34,12 @@
align-items: center;
margin-left: 16rpx;
}
.searchIcon image{
.searchIcon image {
width: 32rpx;
height: 32rpx;
}
.icon-sousuo {
font-size: 32rpx;
position: absolute;
... ... @@ -68,6 +71,7 @@
line-height: 64rpx;
color: rgba(189, 196, 206, 1);
}
.search_right {
width: 104rpx;
height: 64rpx;
... ... @@ -90,7 +94,7 @@
.searchHistory {
width: 750rpx;
height: 420rpx;
background: linear-gradient(180deg,#ffffff, #ebedf0);
background: linear-gradient(180deg, #ffffff, #ebedf0);
/* background-color: cadetblue; */
}
... ... @@ -194,27 +198,33 @@ background: linear-gradient(180deg,#ffffff, #ebedf0);
width: 335rpx;
background-color: #ffffff;
margin-bottom: 24rpx;
padding: 0 11rpx 8rpx 12rpx;
padding: 0 0 8rpx 0;
box-sizing: border-box;
border-radius: 16rpx;
}
.listPic {
width: 312rpx;
height: 328rpx;
}
.listSon image {
width: 312rpx;
width: 100%;
height: 328rpx;
border-radius: 16rpx;
}
.listTitle {
margin-bottom: 8rpx;
width: 100%;
font-size: 28rpx;
font-weight: 500;
color: #323233;
line-height: 40rpx;
padding: 0 24rpx;
box-sizing: border-box;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-top: 16rpx;
}
.collect {
... ... @@ -223,7 +233,12 @@ background: linear-gradient(180deg,#ffffff, #ebedf0);
font-weight: 400;
text-align: left;
color: #7d7e80;
line-height: 34rpx;
padding: 0 24rpx;
box-sizing: border-box;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.discount {
... ... @@ -232,6 +247,7 @@ background: linear-gradient(180deg,#ffffff, #ebedf0);
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 8rpx;
}
.discountTitle {
... ... @@ -249,12 +265,20 @@ background: linear-gradient(180deg,#ffffff, #ebedf0);
}
.discountPic {
height: 48rpx;
font-size: 28rpx;
color: #f8633e;
padding: 0 24rpx;
}
.discountPic image {
width: 48rpx;
height: 48rpx;
}
\ No newline at end of file
}
.bottomHint {
font-size: 24rpx;
color: gray;
display: flex;
justify-content: center;
background-color: #f1f2f4;
/* margin-bottom: 250rpx; */
}
... ...
... ... @@ -20,8 +20,8 @@
<view class="pickTitle">{{item.goodsName}}</view>
<view class="pickDesc">{{item.goodsAttributes}}</view>
<view class="collectIcon">
<view style="height:10rpx"></view>
<view style="display:inline-block">¥{{item.goodsPrice}}</view>
<view style="height:10rpx;display:none"></view>
<view style="display:inline-block; font-size: 28rpx;padding: 10rpx 0;">¥{{item.goodsPrice}}</view>
</view>
</view>
</view>
... ...
... ... @@ -126,7 +126,6 @@ page{
.pickItem {
width: 336rpx;
padding: 0 12rpx 8rpx;
box-sizing: border-box;
background-color: #ffffff;
margin-bottom: 16rpx;
... ... @@ -135,13 +134,14 @@ page{
}
.pickPic {
width: 312rpx;
width: 100%;
height: 328rpx;
}
.pickPic image {
width: 312rpx;
width: 100%;
height: 328rpx;
border-radius: 16rpx;
}
.pickTitle {
... ...
... ... @@ -3,6 +3,7 @@ let method = require("../../utils/reuqest.js")
const util = require("../../utils/util.js")
Page({
data: {
Authorization: false, //判断用户是否登录
showTime: false, //配送时间
storePickupTime: '',
checkType: 1,
... ... @@ -18,6 +19,7 @@ Page({
stockNum: '',
// 购物车
goodsId: '', //商品id
carts: [], // 购物车列表
pitchCart: [], //选中商品
pitchList: [], //选中商品id
... ... @@ -31,6 +33,12 @@ Page({
title: '产品推荐',
bottomHint: false, //上拉提示
},
//登录
login() {
wx.navigateTo({
url: '/pages/index/index',
})
},
// tabbar
toClassify() {
wx.reLaunch({
... ... @@ -64,7 +72,7 @@ Page({
// currPage: 1,
// pageSize: 10
// }
method.getRequest("/myUser/cartRecommend", data => {
method.getRequest("/myUser/cartRecommend", data => {
if (data.statusCode == 0) {
this.setData({
list: data.data
... ... @@ -74,11 +82,12 @@ Page({
},
goGoodsDetail(e) {
let id = e.currentTarget.dataset.id;
console.log(id, 'id')
this.setData({
goodsId: id
})
wx.navigateTo({
url: '/pages/product-detail/product-detail?goodsId=' + this.data.goodsId,
url: '/pages/product-detail/product-detail?id=' + this.data.goodsId,
})
},
//地址信息
... ... @@ -136,14 +145,11 @@ Page({
showTime: false
});
},
onReady() {
this.timepicker = this.selectComponent('#aaa')
},
chooseTime() {
this.setData({
showTime: true
})
// this.timepicker.getDliveryTime();
this.selectComponent('#timePicker').getDliveryTime()
},
onClickButton() {
this.setData({
... ... @@ -369,7 +375,13 @@ Page({
},
onLoad: function (options) {
this.getAddress();
this.youLike()
this.setData({
hasList: true,
//carts: [],
checkNum: 0
});
this.youLike();
},
/**
... ... @@ -383,15 +395,9 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getList();
this.setData({
hasList: true,
carts: [],
checkNum: 0
});
this.getTotalPrice();
this.getAddress() //获取默认地址
this.getDayTime() //获取当日期
this.getDayTime() //获取当日期
this.setData({ //每次购物车下单重新选择商品
pitchCart: [],
pitchList: []
... ... @@ -408,7 +414,17 @@ Page({
})
}
}, 300)
this.getList();
//判断用户是否登录
if (wx.getStorageSync('Authorization') === '') {
this.setData({
Authorization: false
})
} else {
this.setData({
Authorization: true
})
}
},
/**
... ...
<!--pages/shopping-cart/shopping-cart.wxml-->
<view class="container">
<view class="container" wx:if="{{Authorization}}">
<!-- 地址 -->
<view class="userInfo" bindtap="goAddress1">
<view>
<view wx:if="{{userData!==''}}">
<view style="display:flex;align-items: center;">
<view wx:if="{{userData!==''}}" style="width:95%">
<view class="userName">{{userData.name}}</view>
<view class="userTell">{{userData.phone}}</view>
<view class="default" wx:if="{{userData.delFlag==1}}">默认</view>
... ... @@ -19,16 +19,22 @@
</view>
<!-- 配送时间 -->
<view class="timeBox">
<view class="calendar " bindtap='chooseTime'>
<view style="display: flex;align-items: center;">
<image src="/images/04-01/rili.png"></image>
<view style="display:flex">
<view class="calendar " bindtap='chooseTime'>
<view style="display: flex;align-items: center;">
<image src="/images/04-01/rili.png"></image>
</view>
<view wx:if="{{storePickupTime==''}}"> 请选择配送时间</view>
<view wx:if="{{storePickupTime!==''}}"> 配送时间</view>
</view>
<view> 请选择配送时间</view>
{{storePickupTime}}
</view>
{{storePickupTime}}
<!-- <view class="arrow1" style="width:94%">
<image src="/images/04-01/arrow.png"></image>
</view> -->
<view class="section">
<van-popup show="{{ showTime }}" bind:close="onClose" position="bottom">
<timepicker deliveryTime='{{deliveryTime}}' bind:selectTime="selectTime" id="aaa"></timepicker>
<timepicker deliveryTime='{{deliveryTime}}' bind:selectTime="selectTime" id="timePicker"></timepicker>
</van-popup>
</view>
</view>
... ... @@ -60,7 +66,8 @@
</view>
<!-- <view wx:if="{{carts.length==0}}"> -->
<view wx:if="{{cartnoData}}">
<view wx:if="{{!hasList}}">
<!-- <view wx:if="{{cartnoData}}"> -->
<view class="cart-no-data">一件商品都没有呢</view>
<view class="cart-no-data-btn" bindtap="goHome">去逛逛</view>
</view>
... ... @@ -86,6 +93,7 @@
</view>
</view>
</view>
<view class="bottomHint" wx:if="{{bottomHint}}">
我是有底线的~
</view>
... ... @@ -108,6 +116,17 @@
</view>
</view>
</view>
<!-- 没登录 -->
<view wx:if="{{!Authorization}}" class="noToken">
<view class="logBox">
<text class="logText1" bindtap="login">登录</text>
<text class="logText2">后同步您购物车的商品</text>
</view>
<view class="noGoodPic">
<image src="/images/message@2x.png"></image>
购物车里空空如也~
</view>
</view>
<!-- tabbar -->
<!-- <view class="tabbarBox" >
<ul>
... ...
... ... @@ -6,6 +6,8 @@ page {
.container {
background-color: #f1f2f4;
width: 100%;
height: 100%;
overflow-x: hidden;
padding-top: 6rpx;
padding-bottom: 120rpx;
}
... ... @@ -15,16 +17,13 @@ page {
/* 用户信息 */
.noAdd{
width: 300rpx;
width: 95%;
font-size: 32rpx;
font-weight: 600;
color: #323233;
position: absolute;
top: 82rpx;
}
.userInfo {
width: 686rpx;
height: 200rpx;
background-color: #ffffff;
margin: 0 auto;
margin-top: 20rpx;
... ... @@ -80,16 +79,11 @@ page {
color: #323233;
line-height: 40rpx;
margin-top: 16rpx;
height: 84rpx;
overflow: hidden;
}
.arrow {
width: 32rpx;
height: 32rpx;
position: absolute;
top: 84rpx;
left: 626rpx;
width: 5%;
}
.arrow image {
... ... @@ -144,6 +138,16 @@ page {
.selectTime {
margin-left: 16rpx;
}
/* .arrow1 {
width: 5%;
display: flex;
align-items: center;
}
.arrow1 image {
width: 16rpx;
height: 27rpx;
} */
/* 购物车列表 */
.cartList {
... ... @@ -320,59 +324,52 @@ page {
width: 335rpx;
background-color: #ffffff;
margin-bottom: 24rpx;
padding: 0 11rpx 8rpx 12rpx;
box-sizing: border-box;
border-radius: 16rpx;
}
.listPic {
width: 312rpx;
width: 100%;
height: 328rpx;
}
.listSon image {
width: 312rpx;
height: 328rpx;
width: 100%;
border-radius: 16rpx;
height: 100%;
}
.listTitle {
margin-bottom: 8rpx;
width: 100%;
font-size: 28rpx;
font-weight: 500;
color: #323233;
line-height: 40rpx;
padding: 0 24rpx;
box-sizing: border-box;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-top: 16rpx;
}
.collect {
width: 100%;
font-size: 24rpx;
font-size: 28rpx;
font-weight: 400;
text-align: left;
color: #7d7e80;
line-height: 34rpx;
padding: 0 24rpx;
box-sizing: border-box;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-top: 8rpx;
}
.discount {
width: 100%;
height: 32rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.discountTitle {
width: 10rpx;
height: 38rpx;
/* border: 1rpx solid #ff4944; */
border-radius: 12rpx;
font-size: 22rpx;
font-weight: 400;
text-align: left;
color: #ff4340;
line-height: 48rpx;
letter-spacing: 1rpx;
text-align: center;
padding: 0 24rpx;
}
.discountPic {
... ... @@ -383,7 +380,6 @@ page {
.discountPic image {
width: 48rpx;
height: 48rpx;
}
/* 购物车 */
... ... @@ -681,4 +677,29 @@ li text{
.tabbarPic image{
width:48rpx;
height: 48rpx;
}
/* noToken */
.logBox{
padding: 14rpx;
background: antiquewhite;
font-size: 28rpx;
}
.logText1{
color: #f57878;
font-weight: 600;
border-bottom: 2rpx solid;
}
.logText2{
color: #474646;
}
.noGoodPic{
text-align: center;
margin-top: 200rpx;
font-size: 24rpx;
}
.noGoodPic image{
width: 200rpx;
height: 200rpx;
display: block;
margin: 0 auto;
}
\ No newline at end of file
... ...
// pages/user/user.js
let method = require("../../utils/reuqest.js")
const util = require("../../utils/util.js")
Page({
data: {
Authorization: '', //判断用户是否登录
phoneNumber: '',
userData: '',
vip: '',
... ... @@ -44,6 +46,12 @@ Page({
text: '意见反馈'
}]
},
//登录
login(){
wx.navigateTo({
url: '/pages/index/index',
})
},
// tabbar
toHome() {
wx.reLaunch({
... ... @@ -72,16 +80,38 @@ Page({
},
//全部订单
mainOrder() {
wx.navigateTo({
url: '/pages/all-order/all-order',
})
if (this.data.Authorization) {
wx.navigateTo({
url: '/pages/all-order/all-order',
})
} else {
wx.showToast({
title: '请先登录!',
icon: 'none'
})
setTimeout(() => {
util.getUser()
}, 2000)
}
},
//订单状态
orderEvent(e) {
let index = e.currentTarget.dataset.index;
wx.navigateTo({
url: '/pages/all-order/all-order?index=' + index,
})
if (this.data.Authorization) {
let index = e.currentTarget.dataset.index;
wx.navigateTo({
url: '/pages/all-order/all-order?index=' + index,
})
} else {
wx.showToast({
title: '请先登录!',
icon: 'none'
})
setTimeout(() => {
util.getUser()
}, 2000)
}
},
//我的服务
myServeEvent(e) {
... ... @@ -115,75 +145,164 @@ Page({
},
//我的会员
myMember() {
method.getRequest("/myUser/queryUserInfo", data => {
if (data.statusCode == 0) {
this.setData({
vip: data.data.vip
})
wx.setStorageSync('vip', this.data.vip)
}
})
wx.navigateTo({
url: '/pages/my-member/my-member',
})
if (this.data.Authorization) {
method.getRequest("/myUser/queryUserInfo", data => {
if (data.statusCode == 0) {
this.setData({
vip: data.data.vip
})
wx.setStorageSync('vip', this.data.vip)
}
})
wx.navigateTo({
url: '/pages/my-member/my-member',
})
} else {
wx.showToast({
title: '请先登录!',
icon: 'none'
})
setTimeout(() => {
util.getUser()
}, 2000)
}
},
//收货地址
myAddress() {
wx.navigateTo({
url: '/pages/select-address/select-address',
})
if (this.data.Authorization) {
wx.navigateTo({
url: '/pages/select-address/select-address',
})
} else {
wx.showToast({
title: '请先登录!',
icon: 'none'
})
setTimeout(() => {
util.getUser()
}, 2000)
}
},
//优惠券
mydiscountCard() {
wx.navigateTo({
url: '/pages/discount-card/discount-card',
})
if (this.data.Authorization) {
wx.navigateTo({
url: '/pages/discount-card/discount-card',
})
} else {
wx.showToast({
title: '请先登录!',
icon: 'none'
})
setTimeout(() => {
util.getUser()
}, 2000)
}
},
//退款售后
myRefund() {
wx.navigateTo({
url: '/pages/refund-after/refund-after',
})
if (this.data.Authorization) {
wx.navigateTo({
url: '/pages/refund-after/refund-after',
})
} else {
wx.showToast({
title: '请先登录!',
icon: 'none'
})
setTimeout(() => {
util.getUser()
}, 2000)
}
},
//在线客服
myKefu() {
method.getRequest("/information/queryCustomerPhone", data => {
if (data.statusCode == 0) {
this.setData({
phoneNumber: data.data
})
}
})
wx.makePhoneCall({
phoneNumber: this.data.phoneNumber,
success() {
console.log('拨打电话成功')
},
fail() {
wx.showToast({
title: this.data.msg,
icon: 'none'
})
}
})
if (this.data.Authorization) {
method.getRequest("/information/queryCustomerPhone", data => {
if (data.statusCode == 0) {
this.setData({
phoneNumber: data.data
})
}
})
wx.makePhoneCall({
phoneNumber: this.data.phoneNumber,
success() {
console.log('拨打电话成功')
},
fail() {
wx.showToast({
title: this.data.msg,
icon: 'none'
})
}
})
} else {
wx.showToast({
title: '请先登录!',
icon: 'none'
})
setTimeout(() => {
util.getUser()
}, 2000)
}
},
//我的收藏
myCollect() {
wx.navigateTo({
url: '/pages/my-collect/my-collect',
})
if (this.data.Authorization) {
wx.navigateTo({
url: '/pages/my-collect/my-collect',
})
} else {
wx.showToast({
title: '请先登录!',
icon: 'none'
})
setTimeout(() => {
util.getUser()
}, 2000)
}
},
//关于我们
relatedOur() {
wx.navigateTo({
url: '/pages/related-our/related',
})
if (this.data.Authorization) {
wx.navigateTo({
url: '/pages/related-our/related',
})
} else {
wx.showToast({
title: '请先登录!',
icon: 'none'
})
setTimeout(() => {
util.getUser()
}, 2000)
}
},
//意见反馈
ideaFeedback(){
wx.navigateTo({
url: '/pages/idea-feedback/idea-feedback',
})
ideaFeedback() {
if (this.data.Authorization) {
wx.navigateTo({
url: '/pages/idea-feedback/idea-feedback',
})
} else {
wx.showToast({
title: '请先登录!',
icon: 'none'
})
setTimeout(() => {
util.getUser()
}, 2000)
}
},
/**
* 生命周期函数--监听页面加载
... ... @@ -191,6 +310,16 @@ Page({
onLoad: function (options) {
let that = this;
that.getUserInfo()
//Authorization判断用户是否登录
if (wx.getStorageSync('Authorization') === '') {
this.setData({
Authorization: false
})
} else {
this.setData({
Authorization: true
})
}
},
/**
... ...
... ... @@ -4,15 +4,18 @@
</view>
<!-- 用户信息 -->
<view class="userInfo">
<view class="headPic">
<view class="headPic" wx:if="{{Authorization}}">
<image src="{{userData.wxHeadImg}}"></image>
</view>
<view class="userName">
<view class="name">
<view class="headPic" wx:if="{{!Authorization}}">
<image src="/images/nimingtouxiang.png"></image>
</view>
<view class="userName" >
<view class="name" wx:if="{{Authorization}}">
{{userData.wxName}}
</view>
<view class="decribe">
描述
<view class="name" wx:if="{{!Authorization}}" bindtap="login">
登录/注册
</view>
</view>
<!-- <view class="arrow">
... ...
... ... @@ -43,6 +43,8 @@
padding-left: 20rpx;
box-sizing: border-box;
padding-top: 10rpx;
display: flex;
align-items: center;
}
.userName .name {
... ... @@ -143,7 +145,7 @@
}
.text {
width: 72rpx;
width: auto;
height: 34rpx;
font-size: 24rpx;
font-weight: 400;
... ...
... ... @@ -283,6 +283,13 @@
"id": -1,
"name": "pages/demo/demo",
"pathName": "pages/demo/demo",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/demo1/demo1",
"pathName": "pages/demo1/demo1",
"scene": null
}
]
... ...
... ... @@ -16,10 +16,10 @@ const formatNumber = n => {
//获取时间
//获取d当前时间多少天后的日期和对应星期
function getDates(days, todate = new Date() ) { //todate默认参数是当前日期,可以传入对应时间
// function getDates(days, todate =getCurrentMonthFirst()) { //todate默认参数是当前日期,可以传入对应时间
function getDates(days, todate = new Date()) { //todate默认参数是当前日期,可以传入对应时间
// function getDates(days, todate =getCurrentMonthFirst()) { //todate默认参数是当前日期,可以传入对应时间
var dateArry = [];
for (var i = 0; i < days-3; i++) {
for (var i = 0; i < days - 3; i++) {
var dateObj = dateLater(todate, i);
console.log(dateObj)
dateArry.push(dateObj)
... ... @@ -66,9 +66,55 @@ function getUser(msg) {
url: '/pages/index/index',
})
}
//获取位置信息
function getLocation(that) {
wx.getLocation({
type: 'wgs84',
success: function (res) {
// 经纬度
var latitude = res.latitude
var longitude = res.longitude
var aK = that.data.aK
wx.request({
url: 'https://api.map.baidu.com/geocoder/v2/?ak=' + aK + '&location=' + latitude + ',' + longitude + '&output=json',
data: {},
header: {
'content-type': 'application/json'
},
success: function (res) {
var city = res.data.result.addressComponent.city;
that.setData({
currentCity: city
})
wx.request({
url: 'xxx' + city,
data: {},
header: {
'content-type': 'application/json'
},
success: function (res) {
that.setData({
county: res.data,
})
},
})
}
})
},
fail: function () {
wx.showToast({
title: '授权失败',
icon: 'success',
duration: 1000
})
}
})
}
module.exports = {
formatTime: formatTime,
onReachListData: onReachListData,
getUser: getUser,
getDates:getDates
getDates: getDates,
getLocation:getLocation
}
\ No newline at end of file
... ...