diff --git a/app.json b/app.json index bc78830..88fa9c1 100644 --- a/app.json +++ b/app.json @@ -31,7 +31,6 @@ "pages/cart-affirm-order/cart-affirm-order", "pages/integral-order/integral-order", "pages/refund-after/refund-after", - "pages/demo1/demo1", "pages/my-discount-card/my-discount-card" ], "window": { diff --git a/pages/add-address/add-address.js b/pages/add-address/add-address.js index eb12325..2c6453f 100644 --- a/pages/add-address/add-address.js +++ b/pages/add-address/add-address.js @@ -1,5 +1,6 @@ // pages/add-address/add-address.js -let method = require("../../utils/reuqest.js") +let method = require("../../utils/reuqest.js"); +const util = require("../../utils/util.js"); const chooseLocation = requirePlugin('chooseLocation'); Page({ data: { @@ -9,14 +10,10 @@ Page({ checked: 0, show: false, selectBox: true, - // region: ['请选择', '请选择', '请选择'], - // province: '选择省/', - // city: '市/', - // county: '区', location: '', latitude: "", longitude: "", - latitudes: "", //传值给后台 + latitudes: "", //传值 longitudes: "", flag: true }, @@ -82,8 +79,8 @@ Page({ //地区 map() { let that = this; - const key = 'C4QBZ-UYQLI-S45G2-5ETMC-LQYWE-L6FJU'; - const referer = '春晓世纪华联超市'; + const key = 'C4QBZ-UYQLI-S45G2-5ETMC-LQYWE-L6FJU'; + const referer = '春晓世纪华联超市'; const category = '房产小区,其它'; wx.getLocation({ type: 'gcj02', @@ -162,15 +159,13 @@ Page({ title: '保存成功', icon: 'none' }) - console.log('22') - wx.navigateTo({ - url: '/pages/select-address/select-address', + wx.redirectTo({ + url: '/pages/select-address/select-address?edit=1', }) - console.log('33') } else { wx.showToast({ - title: data.msg, - icon: 'none' + title: '地址超出配送费范围请重新选择', + icon:'none' }) } }) @@ -193,7 +188,7 @@ Page({ onShow: function () { let that = this; const location = chooseLocation.getLocation(); - console.log(location,'location') + console.log(location, 'location') const address = location.address const latitude = location.latitude const longitude = location.longitude diff --git a/pages/add-address/add-address.wxml b/pages/add-address/add-address.wxml index 57ed483..7a14244 100644 --- a/pages/add-address/add-address.wxml +++ b/pages/add-address/add-address.wxml @@ -1,21 +1,9 @@ <!--pages/add-address/add-address.wxml--> <view class="container"> <van-cell-group class="addContent"> - <van-field value="{{ username }}" required clearable label="姓名" icon="question-o" placeholder="请输入姓名" + <van-field value="{{ username }}" clearable label="姓名" icon="question-o" placeholder="请输入姓名" bind:click-icon="onClickIcon" bindinput="inputName" /> <van-field value="{{ phone }}" label="电话" placeholder="请输入电话" bindinput="inputDel" bindblur="blurPhone" /> - <!-- 地址 --> - <!-- <van-cell title="展示弹出层" is-link bindtap="showPopup"> --> - <!-- <view class="popups"> - <view>地区</view> - <view class="addBox"> - <picker mode="region" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}"> - <view class="picker"> - {{region[0]}},{{region[1]}},{{region[2]}} - </view> - </picker> - </view> - </view> --> <view class="location" catchtap="map"> <text style="width:200rpx">收货地址</text> <text class="locationItem">{{location}}</text> diff --git a/pages/affirm-order/affirm-order.js b/pages/affirm-order/affirm-order.js index 5aef31c..c812afb 100644 --- a/pages/affirm-order/affirm-order.js +++ b/pages/affirm-order/affirm-order.js @@ -1,5 +1,6 @@ // pages/affirm-order/affirm-order.js -let method = require("../../utils/reuqest.js") +let method = require("../../utils/reuqest.js"); +const util = require("../../utils/util.js"); Page({ data: { userData: "", @@ -34,7 +35,7 @@ Page({ count: '', stockNum: '', resposeData: '', - discountText:'', + discountText: '', payment: '' }, //选择时间 @@ -109,6 +110,10 @@ Page({ this.setData({ userData: data.data[index], }) + } else { + setTimeout(() => { + util.getUser() + }, 2000) } }) }, @@ -155,9 +160,13 @@ Page({ this.setData({ goodsData: goodsData }) + } else { + setTimeout(() => { + util.getUser() + }, 2000) } }) - + }, //点击减少 dec() { @@ -220,7 +229,6 @@ Page({ //商品-生成订单 creatOrder() { if (this.data.userData == undefined) { - wx.showToast({ title: '请选择收货地址', icon: 'none' @@ -247,6 +255,9 @@ Page({ title: data.msg, icon: 'none' }) + setTimeout(() => { + util.getUser() + }, 2000) } }) wx.removeStorageSync('type') //清除优惠券 @@ -285,6 +296,10 @@ Page({ }, 'complete': function (res) {} }) + }else{ + setTimeout(() => { + util.getUser() + }, 2000) } }) }, @@ -311,18 +326,14 @@ Page({ url: '/pages/classify/classify', }) }, 1000) - - } else { wx.showToast({ title: data.msg, icon: 'none' }) setTimeout(() => { - wx.redirectTo({ - url: '/pages/classify/classify', - }) - }, 1000) + util.getUser() + }, 2000) } }) } diff --git a/pages/all-order/all-order.js b/pages/all-order/all-order.js index 4262c2e..2ea6f7a 100644 --- a/pages/all-order/all-order.js +++ b/pages/all-order/all-order.js @@ -1,5 +1,6 @@ // pages/all-order/all-order.js -let method = require("../../utils/reuqest.js") +let method = require("../../utils/reuqest.js"); +const util = require("../../utils/util.js"); Page({ data: { pageNum: 1, @@ -165,6 +166,10 @@ Page({ this.setData({ tabList: list }) + } else { + setTimeout(() => { + util.getUser() + }, 2000) } }) }, @@ -181,6 +186,10 @@ Page({ this.setData({ tabList: list }) + } else { + setTimeout(() => { + util.getUser() + }, 2000) } }) }, @@ -197,7 +206,11 @@ Page({ this.setData({ tabList: list }) - } + } else [ + setTimeout(() => { + util.getUser() + }, 2000) + ] }) }, //待评价 @@ -213,6 +226,10 @@ Page({ this.setData({ tabList: list }) + } else { + setTimeout(() => { + util.getUser() + }, 2000) } }) }, @@ -229,6 +246,10 @@ Page({ this.setData({ tabList: list }) + } else { + setTimeout(() => { + util.getUser() + }, 2000) } }) }, @@ -273,9 +294,17 @@ Page({ tabList: tabList }) method.getRequest("/order/cancelOrder/" + orderId, data => { - if (data.statusCode == 0) {} + if (data.statusCode == 0) { + + }else{ + setTimeout(() => { + util.getUser() + }, 2000) + } }) - } else if (res.cancel) {} + } else if (res.cancel) { + + } } }) diff --git a/pages/apply-after-sale/apply-after-sale.js b/pages/apply-after-sale/apply-after-sale.js index 96ac01a..3e962f5 100644 --- a/pages/apply-after-sale/apply-after-sale.js +++ b/pages/apply-after-sale/apply-after-sale.js @@ -1,5 +1,6 @@ // pages/apply-after-sale/apply-after-sale.js -let method = require("../../utils/reuqest.js") +let method = require("../../utils/reuqest.js"); +const util = require("../../utils/util.js"); Page({ data: { id: '', //订单号 @@ -27,6 +28,10 @@ Page({ id: data.data.id, postList: data.data }) + }else{ + setTimeout(() => { + util.getUser() + }, 2000) } }) }, @@ -53,6 +58,10 @@ Page({ this.setData({ columns:data.data }) + }else{ + setTimeout(() => { + util.getUser() + }, 2000) } }) // this.setData({ @@ -135,6 +144,10 @@ Page({ wx.redirectTo({ url: '/pages/all-order/all-order', }) + }else{ + setTimeout(() => { + util.getUser() + }, 2000) } }) }, diff --git a/pages/card-detail/card-detail.js b/pages/card-detail/card-detail.js index 3b985b9..e5823f2 100644 --- a/pages/card-detail/card-detail.js +++ b/pages/card-detail/card-detail.js @@ -1,5 +1,6 @@ // pages/card-detail/card-detail.js -let method = require("../../utils/reuqest.js") +let method = require("../../utils/reuqest.js"); +const util = require("../../utils/util.js"); Page({ data: { postData: { @@ -30,6 +31,10 @@ Page({ this.setData({ postData: data.data }) + }else{ + setTimeout(() => { + util.getUser() + }, 2000) } }) }, @@ -45,6 +50,10 @@ Page({ this.setData({ list:data.data }) + }else{ + setTimeout(() => { + util.getUser() + }, 2000) } }) }, diff --git a/pages/cart-affirm-order/cart-affirm-order.js b/pages/cart-affirm-order/cart-affirm-order.js index 3af972d..0ed5f8a 100644 --- a/pages/cart-affirm-order/cart-affirm-order.js +++ b/pages/cart-affirm-order/cart-affirm-order.js @@ -1,5 +1,6 @@ // pages/affirm-order/affirm-order.js -let method = require("../../utils/reuqest.js") +let method = require("../../utils/reuqest.js"); +const util = require("../../utils/util.js"); Page({ data: { userData: { @@ -34,7 +35,6 @@ Page({ //商品 getList() { let pitchList = wx.getStorageSync('pitchList') - //let payment = this.data.goodsList.payment; method.getRequest("/order/buyNow/" + pitchList, data => { this.setData({ goodsList: data.data, @@ -45,12 +45,12 @@ Page({ discountText: wx.getStorageSync('cardAmount'), //选择使用优惠券金额 }) } - let payment = Number(this.data.goodsList.payment) - Number(this.data.discountText) - let goodsList =this.data.goodsList; - goodsList.payment = payment; - this.setData({ - goodsList: goodsList - }) + let payment = Number(this.data.goodsList.payment) - Number(this.data.discountText) + let goodsList = this.data.goodsList; + goodsList.payment = payment; + this.setData({ + goodsList: goodsList + }) }) }, //地址信息 @@ -232,19 +232,21 @@ Page({ deliveryTime: this.data.date, note: this.data.leavaWord, } - console.log(this.data.cartsId, 'cartid') - console.log(this.data.addressId, 'addid') method.postRequest("/order/buyNow", postData, data => { if (data.statusCode == 0) { this.setData({ cartIds: data.data.id }) - this.buys(); + // this.buys() + this.payment(); } else { wx.showToast({ title: data.msg, icon: 'none' }) + // setTimeout(() => { + // util.getUser() + // }, 2000) } }) }, 500) @@ -252,11 +254,11 @@ Page({ }, //购物车-立即购买 buys() { - console.log(this.data.cartIds, 'card') method.getRequest("/order/buyNow/" + this.data.cartIds, data => { if (data.statusCode == 0) { this.payment(); - wx.setStorageSync('cardAmount', "") + wx.setStorageSync('cardAmount', "") + }else{ } }) }, @@ -277,8 +279,15 @@ Page({ wx.showToast({ title: '支付成功', }) + wx.switchTab({ + url: '/pages/shopping-cart/shopping-cart', + }) + }, + 'fail': function (res) { + wx.switchTab({ + url: '/pages/shopping-cart/shopping-cart', + }) }, - 'fail': function (res) {}, 'complete': function (res) {} }) } @@ -286,8 +295,7 @@ Page({ }, onLoad: function (options) { this.getList(); - - if (cardId) { + if (this.data.cardId) { this.setData({ couponId: cardId, id: options.id, @@ -326,16 +334,15 @@ Page({ that.setData({ cartsId: cartsId, cartList: goodsCarts, - couponId:cardId, + couponId: cardId, // date: date, type: type }) that.getTotalPrice(); that.getAddress(); that.getDayTime(); //获取当天时间 - that.buy(); + // that.buy(); that.getList(); // - console.log(this.data.userData, '66') // wx.removeStorageSync('pitchCart') // wx.removeStorageSync('pitchList') wx.removeStorageSync('cardId') diff --git a/pages/classify/classify.js b/pages/classify/classify.js index 163f9e7..54889ab 100644 --- a/pages/classify/classify.js +++ b/pages/classify/classify.js @@ -1,5 +1,6 @@ // pages/classify/classify.js -let method = require("../../utils/reuqest.js") +let method = require("../../utils/reuqest.js"); +const util = require("../../utils/util.js"); Page({ data: { idx: 0, //商品规格索引 @@ -130,6 +131,10 @@ Page({ goodsData: data.data, stockNum: data.data.list[0].goodsStock }) + }else{ + setTimeout(() => { + util.getUser() + }, 2000) } }) }, @@ -224,6 +229,10 @@ Page({ url: '/pages/integral-order/integral-order', }) } + }else{ + setTimeout(() => { + util.getUser() + }, 2000) } }) diff --git a/pages/classify/classify.wxss b/pages/classify/classify.wxss index e113ff7..8cc2e38 100644 --- a/pages/classify/classify.wxss +++ b/pages/classify/classify.wxss @@ -360,6 +360,7 @@ margin-bottom: 10rpx; display: flex; width: auto; + align-items: center; } .specItem1 { diff --git a/pages/demo1/demo1.js b/pages/demo1/demo1.js deleted file mode 100644 index 8e6ec1c..0000000 --- a/pages/demo1/demo1.js +++ /dev/null @@ -1,66 +0,0 @@ -// pages/demo1/demo1.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 diff --git a/pages/demo1/demo1.json b/pages/demo1/demo1.json deleted file mode 100644 index 8835af0..0000000 --- a/pages/demo1/demo1.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "usingComponents": {} -} \ No newline at end of file diff --git a/pages/demo1/demo1.wxml b/pages/demo1/demo1.wxml deleted file mode 100644 index e7311ce..0000000 --- a/pages/demo1/demo1.wxml +++ /dev/null @@ -1,2 +0,0 @@ -<!--pages/demo1/demo1.wxml--> -<text>pages/demo1/demo1.wxml</text> diff --git a/pages/demo1/demo1.wxss b/pages/demo1/demo1.wxss deleted file mode 100644 index 157fd8f..0000000 --- a/pages/demo1/demo1.wxss +++ /dev/null @@ -1 +0,0 @@ -/* pages/demo1/demo1.wxss */ \ No newline at end of file diff --git a/pages/discount-card/discount-card.js b/pages/discount-card/discount-card.js index e7df199..9eabaf6 100644 --- a/pages/discount-card/discount-card.js +++ b/pages/discount-card/discount-card.js @@ -40,6 +40,10 @@ Page({ }) }) + }else{ + setTimeout(() => { + util.getUser() + }, 2000) } }) }, diff --git a/pages/edit-address/edit-address.js b/pages/edit-address/edit-address.js index 204b420..d7aee41 100644 --- a/pages/edit-address/edit-address.js +++ b/pages/edit-address/edit-address.js @@ -1,5 +1,6 @@ // pages/add-address/add-address.js let method = require("../../utils/reuqest.js"); +const util = require("../../utils/util.js"); const chooseLocation = requirePlugin('chooseLocation'); Page({ data: { diff --git a/pages/evaluate/evaluate.js b/pages/evaluate/evaluate.js index cf53424..07a2df5 100644 --- a/pages/evaluate/evaluate.js +++ b/pages/evaluate/evaluate.js @@ -1,5 +1,6 @@ // pages/evaluate/evaluate.js -let method = require("../../utils/reuqest.js") +let method = require("../../utils/reuqest.js"); +const util = require("../../utils/util.js"); Page({ data: { imags: [], diff --git a/pages/home/home.js b/pages/home/home.js index 2319ae8..8c2842c 100644 --- a/pages/home/home.js +++ b/pages/home/home.js @@ -5,7 +5,7 @@ let discountCart = []; //弹窗优惠券id let discountListId = []; //优惠券列表ID Page({ data: { - show: '', + show: false, discountList: '', //优惠券列表 value: '', swiperArray: [], //轮播图 @@ -101,7 +101,7 @@ Page({ t: {} } method.postRequest('/goods/limitedTimeOffer', postData, data => { - console.log(data,'data') + console.log(data, 'data') if (data.statusCode == 0) { this.setData({ discountArray: data.data @@ -138,11 +138,6 @@ Page({ time: date }) } - - - // var str2 = toString(date / 1000 / 3600); - // var ary = str2.split("\\.") - // // console.log(str2.split("\\."),'ary') // var str = ary[1] } }) @@ -177,16 +172,12 @@ Page({ }, dayCountDown() { var nowTime = this.getCurrentDate(2) - console.log(nowTime, '现在时间') var nowTimes = Date.parse(nowTime) this.setData({ nowTimes: nowTimes }) - console.log(nowTimes, '现在时间戳') var endTimes = new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1; //每天24:00时间戳 - console.log(endTimes, '12点时间戳') var jieguo = Number(endTimes) - Number(nowTimes) - console.log(jieguo, '时间戳差') this.setData({ times: jieguo }) @@ -225,6 +216,10 @@ Page({ icon: 'none', duration: 1000 }) + setTimeout(() => { + util.getUser() + }, 1000) + } }) } @@ -288,11 +283,8 @@ Page({ method.getRequest("/myUser/get", data => { if (data.statusCode == 0) { if (data.data) { - console.log("true") this.showPopup() - } else { - console.log("false") - } + } else {} } }) }, @@ -300,10 +292,8 @@ Page({ this.setData({ show: true }); - console.log("show") }, onClose() { - console.log('关闭') this.setData({ show: false }); @@ -456,7 +446,7 @@ Page({ */ onShow: function () { this.dayCountDown(); - this.getName(); //九月主推 + this.getName(); //九月主推 }, /** diff --git a/pages/home/home.wxss b/pages/home/home.wxss index d7511c9..0c25b7b 100644 --- a/pages/home/home.wxss +++ b/pages/home/home.wxss @@ -204,6 +204,7 @@ .countPic image { width: 100%; + border-radius: 16rpx; height: 100%; } @@ -212,6 +213,7 @@ height: 46rpx; font-size: 28rpx; margin-top: 4rpx; + overflow: hidden; } .countPrice { @@ -468,7 +470,7 @@ } .collectIcon { - font-size: 22rpx; + font-size: 24rpx; color: #ff4742; display: flex; align-items: center; diff --git a/pages/integral-order/integral-order.js b/pages/integral-order/integral-order.js index 64f30f0..9b205b9 100644 --- a/pages/integral-order/integral-order.js +++ b/pages/integral-order/integral-order.js @@ -1,5 +1,6 @@ // pages/affirm-order/affirm-order.js -let method = require("../../utils/reuqest.js") +let method = require("../../utils/reuqest.js"); +const util = require("../../utils/util.js"); Page({ data: { userData: { diff --git a/pages/my-member/my-member.js b/pages/my-member/my-member.js index e332d71..06a4f24 100644 --- a/pages/my-member/my-member.js +++ b/pages/my-member/my-member.js @@ -1,5 +1,6 @@ // pages/my-member/my-member.js let method = require("../../utils/reuqest.js") +const util = require("../../utils/util.js") Page({ data: { postData: { @@ -28,13 +29,14 @@ Page({ if (data.statusCode == 0) { wx.showToast({ title: '领取成功', - icon:"none" + icon: "none" }) + this.getMemberInfo() this.setData({ noVip: false, vip: true }) - } + } else {} }) }, //会员信息 @@ -48,7 +50,7 @@ Page({ }) }, //会员卡详情 - cardDetail(){ + cardDetail() { wx.navigateTo({ url: '/pages/card-detail/card-detail', }) @@ -57,7 +59,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - this.getMemberInfo() + this.getMemberInfo() }, /** diff --git a/pages/product-detail/product-detail.js b/pages/product-detail/product-detail.js index 9cc7c24..5eba00c 100644 --- a/pages/product-detail/product-detail.js +++ b/pages/product-detail/product-detail.js @@ -1,5 +1,6 @@ // pages/product-detail/product-detail.js -let method = require("../../utils/reuqest.js") +let method = require("../../utils/reuqest.js"); +const util = require("../../utils/util.js"); Page({ data: { id: '', @@ -34,7 +35,7 @@ Page({ richText: '', couponVos: [], //优惠券列表 userData: '', //地址信息 - ceshi: [],//商品规格 + ceshi: [], //商品规格 idx: 0, //商品规格 }, @@ -54,7 +55,7 @@ Page({ endTime = Date.parse(data.data.endDate); date = (Number(endTime) - Number(startTime)); this.setData({ - time: date + time: date }) var str2 = toString(date / 1000 / 3600); var ary = str2.split("\\.") @@ -120,9 +121,15 @@ Page({ }, //进入购物车 goCart() { - wx.switchTab({ - url: '/pages/shopping-cart/shopping-cart', - }) + if(wx.getStorageSync('Authorization')==" "){ + setTimeout(()=>{ + util.getUser(); + },2000) + }else{ + wx.switchTab({ + url: '/pages/shopping-cart/shopping-cart', + }) + } }, // 收藏 collection() { @@ -142,20 +149,35 @@ Page({ method.getRequest("/myUser/myCollection/" + this.data.id, data => { if (data.statusCode == 0) { + } else { + wx.showToast({ + title: '请先登录', + icon:'none' + }) + setTimeout(() => { + util.getUser() + }, 2000) } }) }, //联系客服 linkKefu() { - wx.makePhoneCall({ - phoneNumber: '111111111000', - success() { - console.log('拨打电话成功') - }, - fail() { - console.log('拨打电话失败') - } - }) + + if (getStorageSync.Authorization == "") { + setTimeout(() => { + util.getUser() + }, 2000) + } else { + wx.makePhoneCall({ + phoneNumber: '111111111000', + success() { + console.log('拨打电话成功') + }, + fail() { + console.log('拨打电话失败') + } + }) + } }, //选择规格 selectSku() { @@ -205,6 +227,9 @@ Page({ duration: 1000 }) } else { + setTimeout(() => { + util.getUser() + }, 2000) wx.showToast({ title: data.msg, icon: 'none', @@ -264,6 +289,9 @@ Page({ url: '/pages/affirm-order/affirm-order', }) } else { + setTimeout(() => { + util.getUser() + }, 2000) wx.showToast({ title: '积分不足', icon: 'none', @@ -314,6 +342,9 @@ Page({ 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) wx.showToast({ title: data.msg, icon: 'none', diff --git a/pages/product-detail/product-detail.wxml b/pages/product-detail/product-detail.wxml index 05758e9..e99ae7d 100644 --- a/pages/product-detail/product-detail.wxml +++ b/pages/product-detail/product-detail.wxml @@ -64,8 +64,9 @@ </view> </view> </view> + <view class="noData" wx:if="{{infoList.length==0}}">暂时没有相关商品的更多评价~</view> <view class="evaluateBox" wx:for="{{infoList}}" wx:if="{{infolist!==0}}"> - <view class="evaluateInfo"> + <view class="evaluateInfo" > <view class="userImg" style="display:inline-block"> <image src="{{item.wxHeadImg}}"> </image> </view> @@ -125,9 +126,10 @@ </view> <!-- 选择规格弹框 --> <view class="mask" catchtap="closeMaskSku" wx:if='{{showMaskSku}}'> - <view class="diceng" > - <view class="skuBox"> - <view wx:for="{{goodsData.list}}" class="{{idx==index?'skuItem1':'skuItem'}}" bindtap="check" data-index="{{index}}" data-id="{{item.goodsSkuId}}">{{item.goodsSkuName}}</view> + <view class="diceng"> + <view class="skuBox"> + <view wx:for="{{goodsData.list}}" class="{{idx==index?'skuItem1':'skuItem'}}" bindtap="check" + data-index="{{index}}" data-id="{{item.goodsSkuId}}">{{item.goodsSkuName}}</view> </view> </view> </view> diff --git a/pages/product-detail/product-detail.wxss b/pages/product-detail/product-detail.wxss index c94e7e5..bd95625 100644 --- a/pages/product-detail/product-detail.wxss +++ b/pages/product-detail/product-detail.wxss @@ -120,9 +120,11 @@ padding-left: 32rpx; box-sizing: border-box; } -.countDownTxt{ + +.countDownTxt { margin-right: 30rpx; } + .countTime { display: inline-block; /* background-color: #9b74fb; */ @@ -136,7 +138,7 @@ color: #fff; font-size: 24rpx; text-align: center; - background: rgba(95,0,0,0.8); + background: rgba(95, 0, 0, 0.8); border-radius: 8rpx; margin-right: 6rpx; margin-left: 6rpx; @@ -186,7 +188,7 @@ /* 评价 */ .evaluateContent { width: 750rpx; - height: 236rpx; + max-height: 236rpx; box-sizing: border-box; background-color: #ffffff; margin: 0 auto; @@ -198,6 +200,15 @@ -webkit-box-orient: vertical; } +.noData { + height: 58rpx; + color: #999999; + font-size: 26rpx; + display: flex; + align-items: center; + justify-content: center; +} + .evaluateContents { width: 750rpx; height: auto; @@ -470,7 +481,7 @@ button { } /* 规格弹框 */ -.skuBox{ +.skuBox { width: 100%; padding: 10rpx; display: flex; @@ -481,7 +492,8 @@ button { margin-top: 30rpx; margin-bottom: 50rpx; } -.skuItem{ + +.skuItem { font-size: 30rpx; color: #323233; height: 57rpx; @@ -494,11 +506,12 @@ button { align-items: center; margin-right: 20rpx; } -.skuItem1{ + +.skuItem1 { font-size: 30rpx; height: 57rpx; width: auto; - background-color:#868585; + background-color: #868585; padding: 0 20rpx; border-radius: 16rpx; margin-bottom: 10rpx; @@ -506,6 +519,7 @@ button { align-items: center; margin-right: 20rpx; } + /* 购物车弹框 */ .mask { position: fixed; diff --git a/pages/select-address/select-address.js b/pages/select-address/select-address.js index 562d7db..aa743de 100644 --- a/pages/select-address/select-address.js +++ b/pages/select-address/select-address.js @@ -4,19 +4,10 @@ Page({ data: { default: true, defaultType: '', - list: [{ - name: '王先生', - tell: '12345678910', - address: '天津市 西青区科技园小区', - defaultType: '1' - }], + list: [], exceedRange: true, - exceedArray: [{ - name: '王先生', - tell: '12345678910', - address: '天津市 西青区科技园小区西青区科技园小区', - defaultType: '1' - }], + exceedArray: [], + edit:'' //判断是否是新增地址页面跳转 }, //获取地址列表 @@ -34,9 +25,12 @@ Page({ let id = e.currentTarget.dataset.id; let addIndex=e.currentTarget.dataset.index; wx.setStorageSync('addIndex', addIndex) - wx.navigateBack({ - delta: 1, - }) + if(!this.data.edit){ + wx.navigateBack({ + delta: 1, + }) + } + }, // 默认地址 defaultEvent(e) { @@ -50,7 +44,6 @@ Page({ }, //编辑地址 editEvent(e) { - console.log(e) let list = this.data.list; let id = e.currentTarget.dataset.id; let idx = e.currentTarget.dataset.index; @@ -109,6 +102,9 @@ Page({ }) }, onLoad: function (options) { + this.setData({ + edit:options.edit + }) this.getAddressList(); }, diff --git a/pages/select-address/select-address.wxss b/pages/select-address/select-address.wxss index 0801d06..1ea7e6c 100644 --- a/pages/select-address/select-address.wxss +++ b/pages/select-address/select-address.wxss @@ -1,9 +1,12 @@ /* pages/select-address/select-address.wxss */ +page{ + background-color: #f1f2f4; +} .container { width: 750rpx; - background-color: #f1f2f4; + border-top: 1rpx solid #f2f2f2; - padding-bottom: 200rpx; + padding-bottom:120rpx; } .addressBox { diff --git a/pages/shopping-cart/shopping-cart.js b/pages/shopping-cart/shopping-cart.js index 9803abb..b521ecb 100644 --- a/pages/shopping-cart/shopping-cart.js +++ b/pages/shopping-cart/shopping-cart.js @@ -4,6 +4,7 @@ Page({ data: { checkType: 1, userData: {}, + addHint: false, //判断有没有地址 startTime: '', //日历选择获取当天日期 date: '', cartList: [], @@ -24,27 +25,14 @@ Page({ name: "hello" } }, - //地址信息 - // getAddress() { - // method.getRequest("/address", data => { - // if (data.statusCode == 0) { - // data.data.forEach((item, index) => { - // if (item.delFlag == 1) { - // this.setData({ - // userData: item, - // }) - // } - // }) - // } - // }) - // }, getAddress() { let index = wx.getStorageSync('addIndex') method.getRequest("/address", data => { if (data.statusCode == 0) { this.setData({ userData: data.data[index], + addHint: true }) } }) @@ -236,7 +224,6 @@ Page({ }) return false } else { - wx.navigateTo({ url: '/pages/cart-affirm-order/cart-affirm-order', }) @@ -247,6 +234,17 @@ Page({ this.data.pitchCart.push(carts[i]) } } + 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 + }) + }) wx.setStorageSync('date', this.data.date) console.log(this.data.date, 'datess') wx.removeStorageSync('time') @@ -284,15 +282,8 @@ Page({ }) this.setData({ hasList: true, - carts: [{ - id: 1, - title: '新鲜芹菜 半斤', - desc: '商品描述商品描述', - image: '/images/demo/s5.png', - num: 4, - price: 0.01, - selected: false - }] + carts: [], + checkNum : 0 }); this.getTotalPrice(); this.getAddress() //获取默认地址 diff --git a/pages/shopping-cart/shopping-cart.wxml b/pages/shopping-cart/shopping-cart.wxml index 4d1fbee..66c7943 100644 --- a/pages/shopping-cart/shopping-cart.wxml +++ b/pages/shopping-cart/shopping-cart.wxml @@ -2,12 +2,18 @@ <view class="container"> <!-- 地址 --> <view class="userInfo" bindtap="goAddress"> - <view class="userName">{{userData.name}}</view> - <view class="userTell">{{userData.phone}}</view> - <view class="default" wx:if="{{userData.delFlag==1}}">默认</view> - <view class="userAddress">{{userData.area}}{{userData.address}}</view> - <view class="arrow"> - <image src="/images/04-01/arrow.png"></image> + <view class="addHint" wx:if="{{addHint==false}}"> + <view class="addItem1">暂未获取到收获地址</view> + <view class="addItem2"> 请选择收货地址</view> + </view> + <view wx:if="{{addHint==true}}"> + <view class="userName">{{userData.name}}</view> + <view class="userTell">{{userData.phone}}</view> + <view class="default" wx:if="{{userData.delFlag==1}}">默认</view> + <view class="userAddress">{{userData.area}}{{userData.address}}</view> + <view class="arrow"> + <image src="/images/04-01/arrow.png"></image> + </view> </view> </view> <!-- 配送时间 --> @@ -15,10 +21,8 @@ <view class="calendar "> <image src="/images/04-01/rili.png"></image> </view> - <!-- <view class="timeTitle">配送时间:</view> - <view class="selectTime">{{}}</view> --> <view class="section"> - <picker mode="date" value="{{date}}" bindchange="bindDateChange" start="{{startTime}}"> + <picker mode="date" value="{{date}}" bindchange="bindDateChange" start="{{startTime}}"> <view class="picker"> 配送时间: {{date}} </view> @@ -30,7 +34,8 @@ <view class="main"> <view wx:if="{{hasList}}"> <view class="cart-box"> - <view class="cart-list" wx:for="{{carts}}" wx:key="{{index}}" data-goodsid="{{item.goodsId}}" bindtap="goDetail"> + <view class="cart-list" wx:for="{{carts}}" wx:key="{{index}}" data-goodsid="{{item.goodsId}}" + bindtap="goDetail"> <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,7 +57,7 @@ </view> </view> - <view class="cart-footer"> + <!-- <view class="cart-footer"> <icon wx:if="{{selectAllStatus}}" type="success_circle" color="#fff" class="total-select" bindtap="selectAll" /> <icon wx:else type="circle" color="#fff" class="total-select" bindtap="selectAll" /> <view class="order-icon"> @@ -62,7 +67,7 @@ </view> <text>全选</text> <text class="cart-toatl-price">¥{{totalPrice}}</text> - </view> + </view> --> </view> <view wx:if="{{carts.length==0}}"> <view class="cart-no-data">一件商品都没有呢</view> diff --git a/pages/shopping-cart/shopping-cart.wxss b/pages/shopping-cart/shopping-cart.wxss index 4ad60dd..60ccf31 100644 --- a/pages/shopping-cart/shopping-cart.wxss +++ b/pages/shopping-cart/shopping-cart.wxss @@ -1,13 +1,37 @@ /* pages/shopping-cart/shopping-cart.wxss */ -page{ +page { background-color: #f1f2f4; } + .container { background-color: #f1f2f4; width: 100%; padding-top: 6rpx; + padding-bottom: 120rpx; +} + +.addHint { + height: 128rpx; + align-items: center; + padding-top: 26rpx; +} + +.addItem1 { + font-size: 28rpx; + font-weight: 400; + text-align: left; + color: #323233; + display:block; +} +.addItem2{ + font-size: 32rpx; + font-weight: 600; + text-align: left; + color: #323233; + margin-top: 20rpx; } + /* 用户信息 */ .userInfo { width: 686rpx; @@ -102,10 +126,12 @@ page{ width: 32rpx; margin-right: 12rpx; } -.picker{ + +.picker { width: 610rpx; height: 50rpx; } + .calendar image { width: 32rpx; height: 32rpx; @@ -255,7 +281,7 @@ page{ margin-top: 24rpx; background-color: #ffffff; border-radius: 16rpx; - padding-bottom: 120rpx; + /* padding-bottom: 120rpx; */ } .cart-list { @@ -289,10 +315,10 @@ page{ } .cart-list .cart-pro-desc { - width: 332rpx; - height: 63rpx; - -webkit-line-clamp: 2; - overflow: hidden; + width: 332rpx; + height: 63rpx; + -webkit-line-clamp: 2; + overflow: hidden; font-size: 24rpx; font-weight: 400; text-align: left; @@ -306,6 +332,7 @@ page{ height: 48rpx; line-height: 48rpx; margin-top: 40rpx; + color: #FF4444; } .cart-list .cart-count-box { @@ -392,20 +419,21 @@ page{ text-align: center; font-size: 28rpx; } + .cart-no-data-btn { - color: #999; - text-align: center; - background-color: #ff893f; - width: 260rpx; - margin: 0 auto; - height: 54rpx; - display: flex; - align-items: center; - justify-content: center; - border-radius: 16rpx; - color: #ffffff; - font-weight: 500; - font-size: 28rpx; + color: #999; + text-align: center; + background-color: #ff893f; + width: 260rpx; + margin: 0 auto; + height: 54rpx; + display: flex; + align-items: center; + justify-content: center; + border-radius: 16rpx; + color: #ffffff; + font-weight: 500; + font-size: 28rpx; } /* 立即购买 */ @@ -467,6 +495,7 @@ page{ color: #ff4444; font-size: 34rpx; font-weight: 600; + margin-left: 6rpx; } .buyText { diff --git a/pages/user/user.wxml b/pages/user/user.wxml index 69fbee1..e2fa62e 100644 --- a/pages/user/user.wxml +++ b/pages/user/user.wxml @@ -15,9 +15,9 @@ 描述 </view> </view> - <view class="arrow"> + <!-- <view class="arrow"> <image src="/images/05-01/arrow.png"></image> - </view> + </view> --> </view> <view class="container"> <!-- 全部订单 --> diff --git a/utils/reuqest.js b/utils/reuqest.js index c5f80e6..d42292c 100644 --- a/utils/reuqest.js +++ b/utils/reuqest.js @@ -16,7 +16,6 @@ function postRequest(url, postData, doSuccess) { }) wx.request({ - //项目的真正接口,通过字符串拼接方式实现 url: host + url, header: { 'Authorization': wx.getStorageSync('Authorization') || '' @@ -27,22 +26,12 @@ function postRequest(url, postData, doSuccess) { setTimeout(()=>{ wx.hideLoading() },800) - if(res.data.msg.indexOf('过期')>-1||res.data.msg.indexOf('请登录')>-1||wx.getStorageSync('Authorization')==""){ + if(res.data.msg.indexOf('过期')>-1||res.data.msg.indexOf('请登录')>-1){ loginFail++; - // wx.showToast({ - // title: res.data.msg, - // icon:'none' - // }) - // setTimeout(()=>{ - // wx.navigateTo({ - // url: '/pages/index/index', - // }) - // },1000) - console.log(loginFail) if(loginFail<2){ setTimeout(()=>{ wx.redirectTo({ - url: '/pages/home/home', + url: '/pages/index/index', }) },1200) } @@ -91,7 +80,7 @@ function getRequest(url, doSuccess) { }) setTimeout(()=>{ wx.redirectTo({ - url: '/pages/home/home', + url: '/pages/index/index', }) },1200) } @@ -121,8 +110,8 @@ function deleteRequest(url, doSuccess) { icon:'none' }) setTimeout(()=>{ - wx.switchTab({ - url: '/pages/home/home', + wx.redirectTo({ + url: '/pages/index/index', }) },1200) } diff --git a/utils/util.js b/utils/util.js index b53d8bd..b0ec16e 100644 --- a/utils/util.js +++ b/utils/util.js @@ -33,15 +33,9 @@ function onReachListData(page, pagenum, data, doFunction) { } //获取登录信息 function getUser(msg) { - if (res.data.msg.indexOf('请登录') > -1) { - wx.showToast({ - title: '请登录', - icon: 'none' - }) - } - wx.navigateTo({ - url: '/pages/index/index', - }) + wx.navigateTo({ + url: '/pages/index/index', +}) } module.exports = { formatTime: formatTime,