作者 倪静楠

地址

... ... @@ -2,10 +2,6 @@
"pages": [
"pages/home/home",
"pages/index/index",
"pages/logs/logs",
"pages/classify/classify",
"pages/shopping-cart/shopping-cart",
... ...

2.1 KB | 宽: | 高:

6.7 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖
... ... @@ -174,7 +174,6 @@ Page({
}
},
onLoad: function (options) {
this.map();
},
/**
... ...
... ... @@ -21,60 +21,9 @@ Page({
latitude: '', //维度
longitude: '', //经度
},
//获取定位
getSetting(){
wx.getSetting({
success: (res) => {
console.log(JSON.stringify(res))
if (res.authSetting['scope.userLocation'] != undefined && res.authSetting['scope.userLocation'] != true) {
wx.showModal({
title: '请求授权当前位置',
content: '需要获取您的地理位置,请确认授权',
success: function (res) {
if (res.cancel) {
wx.showToast({
title: '拒绝授权',
icon: 'none',
duration: 1000
})
} else if (res.confirm) {
wx.openSetting({
success: function (dataAu) {
if (dataAu.authSetting["scope.userLocation"] == true) {
wx.showToast({
title: '授权成功',
icon: 'success',
duration: 1000
})
//再次授权,调用wx.getLocation的API
this.getLocations()
} else {
wx.showToast({
title: '授权失败',
icon: 'none',
duration: 1000
})
}
}
})
}
}
})
} else if (res.authSetting['scope.userLocation'] == undefined) {
//调用wx.getLocation的API
this.getLocations()
} else {
//调用wx.getLocation的API
this.getLocations()
}
}
})
},
getLocations() {
getLocation() {
let that = this;
console.log("getLocations")
wx.getLocation({
type: 'gcj02',
success(res) {
... ... @@ -139,7 +88,6 @@ Page({
},
//第一次数据请求
onData() {
console.log(this.data.lableArray, '分类')
let postData = {
categoryId: this.data.lableArray[0].categoryId,
page: 1,
... ... @@ -173,7 +121,6 @@ Page({
this.setData({
showMask: true
})
console.log(id, 'id')
method.getRequest("/goods/" + id, data => {
if (data.statusCode == 0) {
this.setData({
... ... @@ -232,7 +179,6 @@ Page({
})
},
addNum(e) {
console.log(e, 'e')
let that = this
let count = that.data.count
let stock = that.data.stockNum
... ... @@ -289,7 +235,6 @@ Page({
//商品详情
goGoodsDetail(e) {
let goodsId = e.currentTarget.dataset.id;
console.log(goodsId);
wx.setStorageSync('goodsId', goodsId)
wx.navigateTo({
url: '/pages/product-detail/product-detail',
... ... @@ -301,7 +246,7 @@ Page({
*/
onLoad: function (options) {
// this.dataRequest();
wx.removeStorageSync('categoryId')
wx.removeStorageSync('index')
this.catalog();
... ... @@ -324,9 +269,24 @@ Page({
this.setData({
activeKey: index
});
console.log(this.data.activeKey, 'key')
// this.location()
this.getSetting();
//this.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
},
fail(errInfo) {
console.info(errInfo)
}
})
},
/**
... ...
... ... @@ -47,7 +47,9 @@
<image src="/images/03-02/tianjia.png"></image>
</view>
<view class="exchange" wx:if="{{item.type==1}}" catchtap="exchange" data-integral="{{item.goodsPrice}}"
data-defaultSku="{{item.defaultSku}}">兑换</view>
data-defaultSku="{{item.defaultSku}}">
<image src="/images/03-02/duihuan.png"></image>
</view>
</view>
</view>
</view>
... ... @@ -74,7 +76,8 @@
</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 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>
... ...
... ... @@ -198,7 +198,7 @@
}
.num .jNum {
font-size: 30rpx;
font-size: 28rpx;
font-weight: 400;
text-align: left;
color: #ff4444;
... ... @@ -226,18 +226,18 @@
}
.exchange {
width: 54rpx;
height: 38rpx;
background-color: antiquewhite;
background-color: #FF4444;
font-size: 24rpx;
color: #ffffff;
border-radius: 11rpx;
display: flex;
border-radius: 11rpx;
justify-content: center;
height: 38rpx;
font-size: 24rpx;
color: #ffffff;
border-radius: 11rpx;
display: flex;
border-radius: 11rpx;
justify-content: center;
}
.exchange image{
width:40rpx;
height: 40rpx;
}
/* 购物车弹框 */
.mask {
position: fixed;
... ...
... ... @@ -4,7 +4,7 @@ const util = require("../../utils/util.js");
const chooseLocation = requirePlugin('chooseLocation');
Page({
data: {
id: '', //订单id
id: '', //地址id
username: '',
phone: '',
value: '',
... ... @@ -185,6 +185,38 @@ Page({
})
}
},
//删除
delEvent(e) {
let id = this.data.id;
let obj = {};
wx.showModal({
title: '提示',
content: '确定删除该地址吗?',
success(res) {
if (res.confirm) {
method.postRequest("/address/delete/" + id, obj, data => {
if (data.statusCode == 0) {
wx.showToast({
title: '删除成功',
icon:'none'
})
setTimeout(() => {
wx.redirectTo({
url: '/pages/select-address/select-address',
})
},1000)
}else{
wx.showToast({
title: data.msg,
icon:'none'
})
}
})
} else if (res.cancel) {
}
}
})
},
onLoad: function (options) {
console.log(options, 'options')
this.setData({
... ... @@ -195,11 +227,11 @@ Page({
location: options.area,
locations: options.locations,
latitudes: options.locations.split(",")[0], //传值给后台
longitudes:options.locations.split(",")[1],
longitudes: options.locations.split(",")[1],
id: options.id
})
console.log(this.data.latitudes,'11')
console.log(this.data.longitudes,'222')
console.log(this.data.latitudes, '11')
console.log(this.data.longitudes, '222')
// }
},
... ...
... ... @@ -38,5 +38,5 @@
</view>
<!-- 保存删除 -->
<view class="save" bindtap="save">保存</view>
<view class="del">删除</view>
<view class="del" bindtap="delEvent" >删除</view>
</view>
\ No newline at end of file
... ...
... ... @@ -25,14 +25,6 @@ Page({
}
})
},
//textarea监听
// textAreaInput: function (e) {
// let len = e.detail.value.length;
// this.setData({
// length: len,
// word: e.detail.value
// })
// },
textAreaInput(e) {
let value = e.detail.value
let len = parseInt(value.length);
... ... @@ -53,48 +45,56 @@ Page({
let that = this;
var type = e.currentTarget.dataset.type;
// let num = type == 1 ? (4 - that.data.ppath.length) : (4 - that.data.cpath.length);
wx.chooseImage({
// count: num,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success(res) {
wx.showLoading({
title: '上传中...',
mask: true
})
var uploaderList = res.tempFilePaths;
// ary.push(uploaderList[0])
if (ary.length <= 3) {
// that.setData({
// imgs: ary
// })
}else{
wx.showToast({
title: '最多只能上传3张图片',
icon:'none'
})
}
console.log(uploaderList, 'liost')
if (type == 1) {
that.setData({
imags: that.data.puploaderList.concat(res.tempFilePaths),
if(that.data.imgs.length<3){
wx.chooseImage({
// count: num,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success(res) {
wx.showLoading({
title: '上传中...',
mask: true
})
// that.setData({
// puploaderNum: that.data.puploaderList.length
// })
var uploaderList = res.tempFilePaths;
// ary.push(uploaderList[0])
// if (ary.length <= 3) {
// // that.setData({
// // imgs: ary
// // })
// } else {
// that.setData({
// cuploaderList: that.data.cuploaderList.concat(res.tempFilePaths),
// })
// that.setData({
// cuploaderNum: that.data.cuploaderList.length
// wx.showToast({
// title: '最多只能上传3张图片',
// icon: 'none'
// })
// }
console.log(uploaderList, 'liost')
if (type == 1) {
that.setData({
imags: that.data.puploaderList.concat(res.tempFilePaths),
})
// that.setData({
// puploaderNum: that.data.puploaderList.length
// })
// } else {
// that.setData({
// cuploaderList: that.data.cuploaderList.concat(res.tempFilePaths),
// })
// that.setData({
// cuploaderNum: that.data.cuploaderList.length
// })
}
that.uploadDIY(uploaderList, 0, 0, 0, uploaderList.length, type);
}
that.uploadDIY(uploaderList, 0, 0, 0, uploaderList.length, type);
}
})
})
}else{
wx.showToast({
title: '最多只能上传三张图片',
icon:'none'
})
}
},
uploadDIY(filePaths, successUp, failUp, i, length, type) {
... ... @@ -111,11 +111,14 @@ Page({
successUp++;
console.log('上传图片成功:', JSON.parse(res.data));
var data = JSON.parse(res.data);
let url = JSON.parse(res.data).data
ary.push(url);
that.setData({
imgs:ary
})
let url = JSON.parse(res.data).data
if (that.data.imgs.length < 3) {
ary.push(url);
that.setData({
imgs: ary
})
}
if (type == 1) {
that.data.ppath[i] = url;
that.setData({
... ... @@ -149,6 +152,8 @@ Page({
}
},
})
},
//删除图片
... ... @@ -188,11 +193,11 @@ Page({
title: '发布成功',
}),
this.setData({
imgs:[]
})
wx.redirectTo({
url: '/pages/all-order/all-order',
imgs: []
})
wx.redirectTo({
url: '/pages/all-order/all-order',
})
}
})
},
... ...
... ... @@ -9,8 +9,8 @@ Page({
discountList: '', //优惠券列表
value: '',
swiperArray: [], //轮播图
classifyArray: [], //每日特价
limitCount: '限时优惠',
classifyArray: [], //分类
limitCount: '限时优惠', //限时优惠
limitCountShow: true,
moreCount: '更多优惠',
time: '', //限时优惠倒计时
... ... @@ -18,8 +18,9 @@ Page({
nowTimes: '', //获取当前时间戳
endTimes: "",
countDownShow: true,
discountArray: [],
discountArray: [], //每日特价
dayPrice: '每日特价',
dayPriceShow: true,
morePrice: '更多特价',
dayPicArray: [],
nameData: '', //九月主推
... ... @@ -138,7 +139,6 @@ Page({
time: date
})
}
// var str = ary[1]
}
})
},
... ... @@ -243,6 +243,11 @@ Page({
this.setData({
dayPicArray: data.data
})
if (data.data.length == 0) {
this.setData({
dayPriceShow:false
})
}
}
})
},
... ... @@ -419,19 +424,18 @@ Page({
*/
onLoad: function (options) {
let that = this;
that.getCard(),
that.swiper(),
that.classify(),
that.discount(),
that.daySpecial(),
that.septemberMain(),
that.discountCart(),
that.daySelect(),
that.dataRequest(),
that.countDown(),
that.oneDataRequest(),
that.discountList()
that.getCard();
that.swiper();
that.classify();
that.discount();
that.daySpecial();
that.septemberMain();
that.discountCart();
that.daySelect();
that.dataRequest();
that.countDown();
that.oneDataRequest();
that.discountList()
},
/**
... ...
... ... @@ -68,7 +68,7 @@
</view>
<!-- 每日特价 -->
<view class="dayPriceContent">
<view class="dayPrice">
<view class="dayPrice" wx:if="{{dayPriceShow}}">
<view class="dayPriceTitle">
<view class="dayPriceText">{{dayPrice}}</view>
<view class="dayPriceTime">
... ...
... ... @@ -186,7 +186,9 @@
width: 100%;
white-space: nowrap;
display: flex;
margin-top: 24rpx;
}
.wrapper1 {
width: 100%;
white-space: nowrap;
... ... @@ -254,7 +256,6 @@
/* 每日特价 */
.dayPriceContent {
width: 686rpx;
height: 542rpx;
background-color: rgb(241, 240, 150);
background-color: #ffffff;
margin-top: 32rpx;
... ... @@ -265,11 +266,11 @@
.dayPrice {
width: 100%;
position: relative;
margin-bottom: 50rpx;
}
.mainly {
width: 100%;
margin-top: 50rpx;
}
.dayPriceText {
... ... @@ -305,7 +306,7 @@
}
.dayPricePic {
width:25%;
width: 25%;
height: 148rpx;
padding: 8rpx 6rpx 8rpx 6rpx;
box-sizing: border-box;
... ... @@ -377,8 +378,13 @@
color: #323233;
padding-left: 8rpx;
box-sizing: border-box;
width: 296rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.pickDesc {
font-size: 24rpx;
font-weight: 400;
... ... @@ -391,6 +397,8 @@
word-break: break-all;
overflow: hidden;
width: 296rpx;
text-overflow: ellipsis;
white-space: nowrap;
height: 40rpx;
}
... ...
... ... @@ -17,7 +17,7 @@ Page({
selectNum: '30',
pingjiaNum: 0,
infoList: [], //评价
image:'', //评价图片
image: '', //评价图片
flags: true,
deacArray: [{
img: '/images/1.jpg'
... ... @@ -30,7 +30,7 @@ Page({
showMask: false,
showMaskTwo: false,
showMaskSku: false,
count: 1,
count: "",
payCount: 1,
stockNum: '',
richText: '',
... ... @@ -227,15 +227,17 @@ Page({
icon: 'success',
duration: 1000
})
} else {
setTimeout(() => {
util.getUser()
}, 2000)
} else if (wx.getStorageSync('Authorization')) {
wx.showToast({
title: data.msg,
icon: 'none',
duration: 1000
})
} else {
setTimeout(() => {
util.getUser()
}, 2000)
}
})
},
... ... @@ -342,15 +344,16 @@ Page({
wx.navigateTo({
url: '/pages/affirm-order/affirm-order?id=' + that.data.id + '&count=' + that.data.payCount + '&stockNum=' + that.data.stockNum + "&skuId=" + this.data.skuId,
})
} else {
setTimeout(() => {
util.getUser()
}, 2000)
} else if (wx.getStorageSync('Authorization')) {
wx.showToast({
title: data.msg,
icon: 'none',
duration: 1000
})
} else {
setTimeout(() => {
util.getUser()
}, 2000)
}
})
},
... ...
... ... @@ -7,7 +7,7 @@
<swiper class="swiper" indicator-dots="true" autoplay="true" interval="5000" duration="1000">
<block wx:for="{{swiperArray}}" wx:for-index="idx">
<swiper-item>
<image src="{{item}}" class="slideImage"></image>
<image src="{{item}}" class="slideImage" ></image>
</swiper-item>
</block>
</swiper>
... ...
... ... @@ -22,7 +22,6 @@
.swiper {
height: 750rpx;
width: 100%;
background-color: aquamarine;
}
.swiper image {
... ...
... ... @@ -74,7 +74,6 @@ Page({
list.forEach((item, index) => {
if (index == idx) {
let obj = {
}
method.postRequest("/address/delete/" + id, obj, data => {
if (data.statusCode == 0) {
... ... @@ -121,7 +120,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getAddressList();
},
/**
... ...
... ... @@ -20,6 +20,7 @@ Page({
pitchCart: [], //选中商品
pitchList: [], //选中商品id
hasList: false, // 列表是否有数据
cartnoData: false, //购物车是否为空
totalPrice: 0, // 总价,初始为0
selectAllStatus: true, // 全选状态,默认全选
obj: {
... ... @@ -28,14 +29,15 @@ Page({
},
//地址信息
getAddress() {
if(wx.getStorageSync('addIndex')){
wx.setStorageSync('addIndex', 0)
}
// if (wx.getStorageSync('addIndex')) {
// wx.removeStorageSync('addIndex')
// }
let index = wx.getStorageSync('addIndex')
method.getRequest("/address", data => {
if (data.statusCode == 0) {
let list = data.data.reverse();
this.setData({
userData: data.data[index],
userData: list[index],
addHint: true
})
}
... ... @@ -45,26 +47,26 @@ Page({
wx.navigateTo({
url: '/pages/select-address/select-address',
})
wx.setStorageSync("shopCartAdd",'true')
wx.setStorageSync("shopCartAdd", 'true')
},
//没有登录
goAddress1() {
if(wx.getStorageSync('Authorization')){
if (wx.getStorageSync('Authorization')) {
wx.navigateTo({
url: '/pages/select-address/select-address',
})
wx.setStorageSync("shopCartAdd",'true')
}else{
wx.setStorageSync("shopCartAdd", 'true')
} else {
wx.showToast({
title: '请先登录!',
icon:'none'
icon: 'none'
})
setTimeout(()=>{
setTimeout(() => {
util.getUser();
},2000)
}, 2000)
}
},
//配送时间
bindDateChange: function (e) {
... ... @@ -79,7 +81,6 @@ Page({
var month = myDate.getMonth();
var day = myDate.getDate();
var dayNow = year + '-' + (month + 1) + "-" + day;
console.log(dayNow, 'daynow')
this.setData({
startTime: dayNow
})
... ... @@ -108,32 +109,42 @@ Page({
this.getTotalNum();
},
// 删除当前商品
deleteList(e) {
const index = e.currentTarget.dataset.index;
const cartIds = e.currentTarget.dataset.cartid;
let carts = this.data.carts;
carts.splice(index, 1);
this.setData({
carts: carts
});
method.deleteRequest("/cart/" + cartIds, data => {
if (data.statusCode == 0) {
wx.showToast({
title: '删除成功',
icon: 'none'
})
//删除
delGoods(e) {
let that = this;
wx.showModal({
title: '提示',
content: '确定删除该商品吗',
success(res) {
if (res.confirm) {
const index = e.currentTarget.dataset.index;
const cartIds = e.currentTarget.dataset.cartid;
let carts = that.data.carts;
carts.splice(index, 1);
that.setData({
carts: carts
});
method.deleteRequest("/cart/" + cartIds, data => {
if (data.statusCode == 0) {
wx.showToast({
title: '删除成功',
icon: 'none'
})
}
})
if (!carts.length) {
this.setData({
hasList: false
});
} else {
this.getTotalPrice();
}
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
if (!carts.length) {
this.setData({
hasList: false
});
} else {
this.getTotalPrice();
}
},
// 全选
selectAll(e) {
let selectAllStatus = this.data.selectAllStatus;
... ... @@ -260,14 +271,14 @@ Page({
}
let list = this.data.carts;
list.forEach((item, index) => {
if(item.selected==true){
console.log(item,"item")
list.splice(index,1)
console.log(list,'list')
}
this.setData({
carts:list
})
if (item.selected == true) {
console.log(item, "item")
list.splice(index, 1)
console.log(list, 'list')
}
this.setData({
carts: list
})
})
wx.setStorageSync('date', this.data.date)
console.log(this.data.date, 'datess')
... ... @@ -307,7 +318,7 @@ Page({
this.setData({
hasList: true,
carts: [],
checkNum : 0
checkNum: 0
});
this.getTotalPrice();
this.getAddress() //获取默认地址
... ... @@ -316,6 +327,15 @@ Page({
pitchCart: [],
pitchList: []
})
setTimeout(() => { //判断购物车是否有商品
if (this.data.carts.length == 0) {
this.setData({
cartnoData: true
})
}
}, 500)
},
/**
... ...
... ... @@ -35,7 +35,7 @@
<view wx:if="{{hasList}}">
<view class="cart-box">
<view class="cart-list" wx:for="{{carts}}" wx:key="{{index}}" data-goodsid="{{item.goodsId}}"
bindtap="goDetail">
bindtap="goDetail" bindlongpress="delGoods" data-index="{{index}}" data-cartId="{{item.cartId}}">
<icon wx:if="{{item.selected}}" type="success" color="#FF4903" data-index="{{index}}" class="cart-pro-select"
catchtap="selectList" />
<icon wx:else type="circle" class="cart-pro-select" data-index="{{index}}" catchtap="selectList" />
... ... @@ -52,8 +52,7 @@
<text class="cart-count-add" catchtap="addCount" data-index="{{index}}"
data-goodSkuId="{{item.goodsSkuId}}">+</text>
</view>
<text class="cart-del" catchtap="deleteList" data-index="{{index}}" data-cartId="{{item.cartId}}"
data-goodSkuId="{{item.goodsSkuId}}">×</text>
</view>
</view>
... ... @@ -69,7 +68,7 @@
<text class="cart-toatl-price">¥{{totalPrice}}</text>
</view> -->
</view>
<view wx:if="{{carts.length==0}}">
<view wx:if="{{cartnoData}}">
<view class="cart-no-data">一件商品都没有呢</view>
<view class="cart-no-data-btn" bindtap="goHome">去逛逛</view>
</view>
... ...
... ... @@ -104,8 +104,8 @@ page {
}
.arrow image {
width: 32rpx;
height: 32rpx;
width: 16rpx;
height: 28rpx;
}
/* 配送时间 */
... ... @@ -130,11 +130,13 @@ page {
.picker {
width: 610rpx;
height: 50rpx;
font-size: 28rpx;
color: #323233;
}
.calendar image {
width: 32rpx;
height: 32rpx;
width: 36rpx;
height: 36rpx;
}
.timeTitle,
... ... @@ -309,20 +311,27 @@ page {
.cart-list .cart-pro-name {
display: inline-block;
width: 332rpx;
width: 350rpx;
line-height: 40rpx;
font-size: 28rpx;
color: #333333;
font-weight: 600;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.cart-list .cart-pro-desc {
width: 332rpx;
height: 63rpx;
width: 350rpx;
height: 78rpx;
-webkit-line-clamp: 2;
overflow: hidden;
font-size: 24rpx;
font-weight: 400;
text-align: left;
color: #999999;
display: -webkit-box;
-webkit-box-orient: vertical;
display: block;
}
... ... @@ -331,7 +340,7 @@ page {
float: left;
height: 48rpx;
line-height: 48rpx;
margin-top: 40rpx;
margin-top: 24rpx;
color: #FF4444;
}
... ... @@ -359,6 +368,7 @@ page {
.cart-count-num {
width: 86rpx;
background-color: #eeeeee;
font-size: 24rpx;
}
.cart-del {
... ...
... ... @@ -5,13 +5,13 @@ Page({
userData: '',
vip: '',
orderList: [{
url: '/images/05-01/moban@2x.png',
url: '/images/05-01/moban.png',
text: '待付款'
}, {
url: '/images/05-01/daifahuo-2@2x.png',
url: '/images/05-01/daipeisong.png',
text: '待发货'
}, {
url: '/images/05-01/peisong2@2x.png',
url: '/images/05-01/peisong.png',
text: '待收货'
}, {
url: '/images/05-01/daipingjia.png',
... ...