作者 倪静楠

地址

@@ -2,10 +2,6 @@ @@ -2,10 +2,6 @@
2 "pages": [ 2 "pages": [
3 "pages/home/home", 3 "pages/home/home",
4 "pages/index/index", 4 "pages/index/index",
5 -  
6 -  
7 -  
8 -  
9 "pages/logs/logs", 5 "pages/logs/logs",
10 "pages/classify/classify", 6 "pages/classify/classify",
11 "pages/shopping-cart/shopping-cart", 7 "pages/shopping-cart/shopping-cart",

2.1 KB | 宽: | 高:

6.7 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖
@@ -174,7 +174,6 @@ Page({ @@ -174,7 +174,6 @@ Page({
174 } 174 }
175 }, 175 },
176 onLoad: function (options) { 176 onLoad: function (options) {
177 - this.map();  
178 }, 177 },
179 178
180 /** 179 /**
@@ -21,60 +21,9 @@ Page({ @@ -21,60 +21,9 @@ Page({
21 latitude: '', //维度 21 latitude: '', //维度
22 longitude: '', //经度 22 longitude: '', //经度
23 }, 23 },
24 - //获取定位  
25 - getSetting(){  
26 - wx.getSetting({  
27 - success: (res) => {  
28 - console.log(JSON.stringify(res))  
29 - if (res.authSetting['scope.userLocation'] != undefined && res.authSetting['scope.userLocation'] != true) {  
30 - wx.showModal({  
31 - title: '请求授权当前位置',  
32 - content: '需要获取您的地理位置,请确认授权',  
33 - success: function (res) {  
34 - if (res.cancel) {  
35 - wx.showToast({  
36 - title: '拒绝授权',  
37 - icon: 'none',  
38 - duration: 1000  
39 - })  
40 - } else if (res.confirm) {  
41 - wx.openSetting({  
42 - success: function (dataAu) {  
43 - if (dataAu.authSetting["scope.userLocation"] == true) {  
44 - wx.showToast({  
45 - title: '授权成功',  
46 - icon: 'success',  
47 - duration: 1000  
48 - })  
49 - //再次授权,调用wx.getLocation的API  
50 - this.getLocations()  
51 24
52 - } else {  
53 - wx.showToast({  
54 - title: '授权失败',  
55 - icon: 'none',  
56 - duration: 1000  
57 - })  
58 - }  
59 - }  
60 - })  
61 - }  
62 - }  
63 - })  
64 - } else if (res.authSetting['scope.userLocation'] == undefined) {  
65 - //调用wx.getLocation的API  
66 - this.getLocations()  
67 -  
68 - } else {  
69 - //调用wx.getLocation的API  
70 - this.getLocations()  
71 - }  
72 - }  
73 - })  
74 -},  
75 - getLocations() { 25 + getLocation() {
76 let that = this; 26 let that = this;
77 - console.log("getLocations")  
78 wx.getLocation({ 27 wx.getLocation({
79 type: 'gcj02', 28 type: 'gcj02',
80 success(res) { 29 success(res) {
@@ -139,7 +88,6 @@ Page({ @@ -139,7 +88,6 @@ Page({
139 }, 88 },
140 //第一次数据请求 89 //第一次数据请求
141 onData() { 90 onData() {
142 - console.log(this.data.lableArray, '分类')  
143 let postData = { 91 let postData = {
144 categoryId: this.data.lableArray[0].categoryId, 92 categoryId: this.data.lableArray[0].categoryId,
145 page: 1, 93 page: 1,
@@ -173,7 +121,6 @@ Page({ @@ -173,7 +121,6 @@ Page({
173 this.setData({ 121 this.setData({
174 showMask: true 122 showMask: true
175 }) 123 })
176 - console.log(id, 'id')  
177 method.getRequest("/goods/" + id, data => { 124 method.getRequest("/goods/" + id, data => {
178 if (data.statusCode == 0) { 125 if (data.statusCode == 0) {
179 this.setData({ 126 this.setData({
@@ -232,7 +179,6 @@ Page({ @@ -232,7 +179,6 @@ Page({
232 }) 179 })
233 }, 180 },
234 addNum(e) { 181 addNum(e) {
235 - console.log(e, 'e')  
236 let that = this 182 let that = this
237 let count = that.data.count 183 let count = that.data.count
238 let stock = that.data.stockNum 184 let stock = that.data.stockNum
@@ -289,7 +235,6 @@ Page({ @@ -289,7 +235,6 @@ Page({
289 //商品详情 235 //商品详情
290 goGoodsDetail(e) { 236 goGoodsDetail(e) {
291 let goodsId = e.currentTarget.dataset.id; 237 let goodsId = e.currentTarget.dataset.id;
292 - console.log(goodsId);  
293 wx.setStorageSync('goodsId', goodsId) 238 wx.setStorageSync('goodsId', goodsId)
294 wx.navigateTo({ 239 wx.navigateTo({
295 url: '/pages/product-detail/product-detail', 240 url: '/pages/product-detail/product-detail',
@@ -301,7 +246,7 @@ Page({ @@ -301,7 +246,7 @@ Page({
301 */ 246 */
302 onLoad: function (options) { 247 onLoad: function (options) {
303 // this.dataRequest(); 248 // this.dataRequest();
304 - 249 +
305 wx.removeStorageSync('categoryId') 250 wx.removeStorageSync('categoryId')
306 wx.removeStorageSync('index') 251 wx.removeStorageSync('index')
307 this.catalog(); 252 this.catalog();
@@ -324,9 +269,24 @@ Page({ @@ -324,9 +269,24 @@ Page({
324 this.setData({ 269 this.setData({
325 activeKey: index 270 activeKey: index
326 }); 271 });
327 - console.log(this.data.activeKey, 'key')  
328 // this.location() 272 // this.location()
329 - this.getSetting(); 273 + //this.getLocation();
  274 + let that = this;
  275 + wx.getLocation({
  276 + type: 'gcj02',
  277 + success(res) {
  278 + that.setData({
  279 + latitude: res.latitude,
  280 + longitude: res.longitude
  281 + })
  282 + that.location();
  283 + const speed = res.speed
  284 + const accuracy = res.accuracy
  285 + },
  286 + fail(errInfo) {
  287 + console.info(errInfo)
  288 + }
  289 + })
330 }, 290 },
331 291
332 /** 292 /**
@@ -47,7 +47,9 @@ @@ -47,7 +47,9 @@
47 <image src="/images/03-02/tianjia.png"></image> 47 <image src="/images/03-02/tianjia.png"></image>
48 </view> 48 </view>
49 <view class="exchange" wx:if="{{item.type==1}}" catchtap="exchange" data-integral="{{item.goodsPrice}}" 49 <view class="exchange" wx:if="{{item.type==1}}" catchtap="exchange" data-integral="{{item.goodsPrice}}"
50 - data-defaultSku="{{item.defaultSku}}">兑换</view> 50 + data-defaultSku="{{item.defaultSku}}">
  51 + <image src="/images/03-02/duihuan.png"></image>
  52 + </view>
51 </view> 53 </view>
52 </view> 54 </view>
53 </view> 55 </view>
@@ -74,7 +76,8 @@ @@ -74,7 +76,8 @@
74 </view> 76 </view>
75 </view> 77 </view>
76 <view class="spec"> 78 <view class="spec">
77 - <view class="{{idx==index?'specItem1':'specItem'}}" wx:for="{{goodsData.list}}" bindtap="check" data-index="{{index}}" data-id="{{item.goodsSkuId}}">{{item.goodsSkuName}}</view> 79 + <view class="{{idx==index?'specItem1':'specItem'}}" wx:for="{{goodsData.list}}" bindtap="check"
  80 + data-index="{{index}}" data-id="{{item.goodsSkuId}}">{{item.goodsSkuName}}</view>
78 </view> 81 </view>
79 <view class="pay_count"> 82 <view class="pay_count">
80 <view>购买数量</view> 83 <view>购买数量</view>
@@ -198,7 +198,7 @@ @@ -198,7 +198,7 @@
198 } 198 }
199 199
200 .num .jNum { 200 .num .jNum {
201 - font-size: 30rpx; 201 + font-size: 28rpx;
202 font-weight: 400; 202 font-weight: 400;
203 text-align: left; 203 text-align: left;
204 color: #ff4444; 204 color: #ff4444;
@@ -226,18 +226,18 @@ @@ -226,18 +226,18 @@
226 } 226 }
227 227
228 .exchange { 228 .exchange {
229 - width: 54rpx;  
230 - height: 38rpx;  
231 - background-color: antiquewhite;  
232 - background-color: #FF4444;  
233 - font-size: 24rpx;  
234 - color: #ffffff;  
235 - border-radius: 11rpx;  
236 - display: flex;  
237 - border-radius: 11rpx;  
238 - justify-content: center; 229 + height: 38rpx;
  230 + font-size: 24rpx;
  231 + color: #ffffff;
  232 + border-radius: 11rpx;
  233 + display: flex;
  234 + border-radius: 11rpx;
  235 + justify-content: center;
  236 +}
  237 +.exchange image{
  238 + width:40rpx;
  239 + height: 40rpx;
239 } 240 }
240 -  
241 /* 购物车弹框 */ 241 /* 购物车弹框 */
242 .mask { 242 .mask {
243 position: fixed; 243 position: fixed;
@@ -4,7 +4,7 @@ const util = require("../../utils/util.js"); @@ -4,7 +4,7 @@ const util = require("../../utils/util.js");
4 const chooseLocation = requirePlugin('chooseLocation'); 4 const chooseLocation = requirePlugin('chooseLocation');
5 Page({ 5 Page({
6 data: { 6 data: {
7 - id: '', //订单id 7 + id: '', //地址id
8 username: '', 8 username: '',
9 phone: '', 9 phone: '',
10 value: '', 10 value: '',
@@ -185,6 +185,38 @@ Page({ @@ -185,6 +185,38 @@ Page({
185 }) 185 })
186 } 186 }
187 }, 187 },
  188 + //删除
  189 + delEvent(e) {
  190 + let id = this.data.id;
  191 + let obj = {};
  192 + wx.showModal({
  193 + title: '提示',
  194 + content: '确定删除该地址吗?',
  195 + success(res) {
  196 + if (res.confirm) {
  197 + method.postRequest("/address/delete/" + id, obj, data => {
  198 + if (data.statusCode == 0) {
  199 + wx.showToast({
  200 + title: '删除成功',
  201 + icon:'none'
  202 + })
  203 + setTimeout(() => {
  204 + wx.redirectTo({
  205 + url: '/pages/select-address/select-address',
  206 + })
  207 + },1000)
  208 + }else{
  209 + wx.showToast({
  210 + title: data.msg,
  211 + icon:'none'
  212 + })
  213 + }
  214 + })
  215 + } else if (res.cancel) {
  216 + }
  217 + }
  218 + })
  219 + },
188 onLoad: function (options) { 220 onLoad: function (options) {
189 console.log(options, 'options') 221 console.log(options, 'options')
190 this.setData({ 222 this.setData({
@@ -195,11 +227,11 @@ Page({ @@ -195,11 +227,11 @@ Page({
195 location: options.area, 227 location: options.area,
196 locations: options.locations, 228 locations: options.locations,
197 latitudes: options.locations.split(",")[0], //传值给后台 229 latitudes: options.locations.split(",")[0], //传值给后台
198 - longitudes:options.locations.split(",")[1], 230 + longitudes: options.locations.split(",")[1],
199 id: options.id 231 id: options.id
200 }) 232 })
201 - console.log(this.data.latitudes,'11')  
202 - console.log(this.data.longitudes,'222') 233 + console.log(this.data.latitudes, '11')
  234 + console.log(this.data.longitudes, '222')
203 // } 235 // }
204 236
205 }, 237 },
@@ -38,5 +38,5 @@ @@ -38,5 +38,5 @@
38 </view> 38 </view>
39 <!-- 保存删除 --> 39 <!-- 保存删除 -->
40 <view class="save" bindtap="save">保存</view> 40 <view class="save" bindtap="save">保存</view>
41 - <view class="del">删除</view> 41 + <view class="del" bindtap="delEvent" >删除</view>
42 </view> 42 </view>
@@ -25,14 +25,6 @@ Page({ @@ -25,14 +25,6 @@ Page({
25 } 25 }
26 }) 26 })
27 }, 27 },
28 - //textarea监听  
29 - // textAreaInput: function (e) {  
30 - // let len = e.detail.value.length;  
31 - // this.setData({  
32 - // length: len,  
33 - // word: e.detail.value  
34 - // })  
35 - // },  
36 textAreaInput(e) { 28 textAreaInput(e) {
37 let value = e.detail.value 29 let value = e.detail.value
38 let len = parseInt(value.length); 30 let len = parseInt(value.length);
@@ -53,48 +45,56 @@ Page({ @@ -53,48 +45,56 @@ Page({
53 let that = this; 45 let that = this;
54 var type = e.currentTarget.dataset.type; 46 var type = e.currentTarget.dataset.type;
55 // let num = type == 1 ? (4 - that.data.ppath.length) : (4 - that.data.cpath.length); 47 // let num = type == 1 ? (4 - that.data.ppath.length) : (4 - that.data.cpath.length);
56 - wx.chooseImage({  
57 - // count: num,  
58 - sizeType: ['compressed'],  
59 - sourceType: ['album', 'camera'],  
60 - success(res) {  
61 - wx.showLoading({  
62 - title: '上传中...',  
63 - mask: true  
64 - })  
65 - var uploaderList = res.tempFilePaths;  
66 - // ary.push(uploaderList[0])  
67 - if (ary.length <= 3) {  
68 - // that.setData({  
69 - // imgs: ary  
70 - // })  
71 - }else{  
72 - wx.showToast({  
73 - title: '最多只能上传3张图片',  
74 - icon:'none'  
75 - })  
76 - }  
77 -  
78 - console.log(uploaderList, 'liost')  
79 - if (type == 1) {  
80 - that.setData({  
81 - imags: that.data.puploaderList.concat(res.tempFilePaths), 48 + if(that.data.imgs.length<3){
  49 + wx.chooseImage({
  50 + // count: num,
  51 + sizeType: ['compressed'],
  52 + sourceType: ['album', 'camera'],
  53 + success(res) {
  54 + wx.showLoading({
  55 + title: '上传中...',
  56 + mask: true
82 }) 57 })
83 - // that.setData({  
84 - // puploaderNum: that.data.puploaderList.length  
85 - // }) 58 + var uploaderList = res.tempFilePaths;
  59 + // ary.push(uploaderList[0])
  60 + // if (ary.length <= 3) {
  61 + // // that.setData({
  62 + // // imgs: ary
  63 + // // })
86 // } else { 64 // } else {
87 - // that.setData({  
88 - // cuploaderList: that.data.cuploaderList.concat(res.tempFilePaths),  
89 - // })  
90 - // that.setData({  
91 - // cuploaderNum: that.data.cuploaderList.length 65 + // wx.showToast({
  66 + // title: '最多只能上传3张图片',
  67 + // icon: 'none'
92 // }) 68 // })
  69 + // }
  70 +
  71 + console.log(uploaderList, 'liost')
  72 + if (type == 1) {
  73 + that.setData({
  74 + imags: that.data.puploaderList.concat(res.tempFilePaths),
  75 + })
  76 + // that.setData({
  77 + // puploaderNum: that.data.puploaderList.length
  78 + // })
  79 + // } else {
  80 + // that.setData({
  81 + // cuploaderList: that.data.cuploaderList.concat(res.tempFilePaths),
  82 + // })
  83 + // that.setData({
  84 + // cuploaderNum: that.data.cuploaderList.length
  85 + // })
  86 + }
  87 + that.uploadDIY(uploaderList, 0, 0, 0, uploaderList.length, type);
93 } 88 }
94 - that.uploadDIY(uploaderList, 0, 0, 0, uploaderList.length, type);  
95 - }  
96 -  
97 - }) 89 +
  90 + })
  91 + }else{
  92 + wx.showToast({
  93 + title: '最多只能上传三张图片',
  94 + icon:'none'
  95 + })
  96 + }
  97 +
98 }, 98 },
99 99
100 uploadDIY(filePaths, successUp, failUp, i, length, type) { 100 uploadDIY(filePaths, successUp, failUp, i, length, type) {
@@ -111,11 +111,14 @@ Page({ @@ -111,11 +111,14 @@ Page({
111 successUp++; 111 successUp++;
112 console.log('上传图片成功:', JSON.parse(res.data)); 112 console.log('上传图片成功:', JSON.parse(res.data));
113 var data = JSON.parse(res.data); 113 var data = JSON.parse(res.data);
114 - let url = JSON.parse(res.data).data  
115 - ary.push(url);  
116 - that.setData({  
117 - imgs:ary  
118 - }) 114 + let url = JSON.parse(res.data).data
  115 + if (that.data.imgs.length < 3) {
  116 + ary.push(url);
  117 + that.setData({
  118 + imgs: ary
  119 + })
  120 + }
  121 +
119 if (type == 1) { 122 if (type == 1) {
120 that.data.ppath[i] = url; 123 that.data.ppath[i] = url;
121 that.setData({ 124 that.setData({
@@ -149,6 +152,8 @@ Page({ @@ -149,6 +152,8 @@ Page({
149 } 152 }
150 }, 153 },
151 }) 154 })
  155 +
  156 +
152 }, 157 },
153 158
154 //删除图片 159 //删除图片
@@ -188,11 +193,11 @@ Page({ @@ -188,11 +193,11 @@ Page({
188 title: '发布成功', 193 title: '发布成功',
189 }), 194 }),
190 this.setData({ 195 this.setData({
191 - imgs:[]  
192 - })  
193 - wx.redirectTo({  
194 - url: '/pages/all-order/all-order', 196 + imgs: []
195 }) 197 })
  198 + wx.redirectTo({
  199 + url: '/pages/all-order/all-order',
  200 + })
196 } 201 }
197 }) 202 })
198 }, 203 },
@@ -9,8 +9,8 @@ Page({ @@ -9,8 +9,8 @@ Page({
9 discountList: '', //优惠券列表 9 discountList: '', //优惠券列表
10 value: '', 10 value: '',
11 swiperArray: [], //轮播图 11 swiperArray: [], //轮播图
12 - classifyArray: [], //每日特价  
13 - limitCount: '限时优惠', 12 + classifyArray: [], //分类
  13 + limitCount: '限时优惠', //限时优惠
14 limitCountShow: true, 14 limitCountShow: true,
15 moreCount: '更多优惠', 15 moreCount: '更多优惠',
16 time: '', //限时优惠倒计时 16 time: '', //限时优惠倒计时
@@ -18,8 +18,9 @@ Page({ @@ -18,8 +18,9 @@ Page({
18 nowTimes: '', //获取当前时间戳 18 nowTimes: '', //获取当前时间戳
19 endTimes: "", 19 endTimes: "",
20 countDownShow: true, 20 countDownShow: true,
21 - discountArray: [], 21 + discountArray: [], //每日特价
22 dayPrice: '每日特价', 22 dayPrice: '每日特价',
  23 + dayPriceShow: true,
23 morePrice: '更多特价', 24 morePrice: '更多特价',
24 dayPicArray: [], 25 dayPicArray: [],
25 nameData: '', //九月主推 26 nameData: '', //九月主推
@@ -138,7 +139,6 @@ Page({ @@ -138,7 +139,6 @@ Page({
138 time: date 139 time: date
139 }) 140 })
140 } 141 }
141 - // var str = ary[1]  
142 } 142 }
143 }) 143 })
144 }, 144 },
@@ -243,6 +243,11 @@ Page({ @@ -243,6 +243,11 @@ Page({
243 this.setData({ 243 this.setData({
244 dayPicArray: data.data 244 dayPicArray: data.data
245 }) 245 })
  246 + if (data.data.length == 0) {
  247 + this.setData({
  248 + dayPriceShow:false
  249 + })
  250 + }
246 } 251 }
247 }) 252 })
248 }, 253 },
@@ -419,19 +424,18 @@ Page({ @@ -419,19 +424,18 @@ Page({
419 */ 424 */
420 onLoad: function (options) { 425 onLoad: function (options) {
421 let that = this; 426 let that = this;
422 - that.getCard(),  
423 - that.swiper(),  
424 - that.classify(),  
425 - that.discount(),  
426 - that.daySpecial(),  
427 - that.septemberMain(),  
428 - that.discountCart(),  
429 - that.daySelect(),  
430 -  
431 - that.dataRequest(),  
432 - that.countDown(),  
433 - that.oneDataRequest(),  
434 - that.discountList() 427 + that.getCard();
  428 + that.swiper();
  429 + that.classify();
  430 + that.discount();
  431 + that.daySpecial();
  432 + that.septemberMain();
  433 + that.discountCart();
  434 + that.daySelect();
  435 + that.dataRequest();
  436 + that.countDown();
  437 + that.oneDataRequest();
  438 + that.discountList()
435 }, 439 },
436 440
437 /** 441 /**
@@ -68,7 +68,7 @@ @@ -68,7 +68,7 @@
68 </view> 68 </view>
69 <!-- 每日特价 --> 69 <!-- 每日特价 -->
70 <view class="dayPriceContent"> 70 <view class="dayPriceContent">
71 - <view class="dayPrice"> 71 + <view class="dayPrice" wx:if="{{dayPriceShow}}">
72 <view class="dayPriceTitle"> 72 <view class="dayPriceTitle">
73 <view class="dayPriceText">{{dayPrice}}</view> 73 <view class="dayPriceText">{{dayPrice}}</view>
74 <view class="dayPriceTime"> 74 <view class="dayPriceTime">
@@ -186,7 +186,9 @@ @@ -186,7 +186,9 @@
186 width: 100%; 186 width: 100%;
187 white-space: nowrap; 187 white-space: nowrap;
188 display: flex; 188 display: flex;
  189 + margin-top: 24rpx;
189 } 190 }
  191 +
190 .wrapper1 { 192 .wrapper1 {
191 width: 100%; 193 width: 100%;
192 white-space: nowrap; 194 white-space: nowrap;
@@ -254,7 +256,6 @@ @@ -254,7 +256,6 @@
254 /* 每日特价 */ 256 /* 每日特价 */
255 .dayPriceContent { 257 .dayPriceContent {
256 width: 686rpx; 258 width: 686rpx;
257 - height: 542rpx;  
258 background-color: rgb(241, 240, 150); 259 background-color: rgb(241, 240, 150);
259 background-color: #ffffff; 260 background-color: #ffffff;
260 margin-top: 32rpx; 261 margin-top: 32rpx;
@@ -265,11 +266,11 @@ @@ -265,11 +266,11 @@
265 .dayPrice { 266 .dayPrice {
266 width: 100%; 267 width: 100%;
267 position: relative; 268 position: relative;
  269 + margin-bottom: 50rpx;
268 } 270 }
269 271
270 .mainly { 272 .mainly {
271 width: 100%; 273 width: 100%;
272 - margin-top: 50rpx;  
273 } 274 }
274 275
275 .dayPriceText { 276 .dayPriceText {
@@ -305,7 +306,7 @@ @@ -305,7 +306,7 @@
305 } 306 }
306 307
307 .dayPricePic { 308 .dayPricePic {
308 - width:25%; 309 + width: 25%;
309 height: 148rpx; 310 height: 148rpx;
310 padding: 8rpx 6rpx 8rpx 6rpx; 311 padding: 8rpx 6rpx 8rpx 6rpx;
311 box-sizing: border-box; 312 box-sizing: border-box;
@@ -377,8 +378,13 @@ @@ -377,8 +378,13 @@
377 color: #323233; 378 color: #323233;
378 padding-left: 8rpx; 379 padding-left: 8rpx;
379 box-sizing: border-box; 380 box-sizing: border-box;
  381 + width: 296rpx;
  382 + overflow: hidden;
  383 + text-overflow: ellipsis;
  384 + white-space: nowrap;
380 } 385 }
381 386
  387 +
382 .pickDesc { 388 .pickDesc {
383 font-size: 24rpx; 389 font-size: 24rpx;
384 font-weight: 400; 390 font-weight: 400;
@@ -391,6 +397,8 @@ @@ -391,6 +397,8 @@
391 word-break: break-all; 397 word-break: break-all;
392 overflow: hidden; 398 overflow: hidden;
393 width: 296rpx; 399 width: 296rpx;
  400 + text-overflow: ellipsis;
  401 + white-space: nowrap;
394 height: 40rpx; 402 height: 40rpx;
395 } 403 }
396 404
@@ -17,7 +17,7 @@ Page({ @@ -17,7 +17,7 @@ Page({
17 selectNum: '30', 17 selectNum: '30',
18 pingjiaNum: 0, 18 pingjiaNum: 0,
19 infoList: [], //评价 19 infoList: [], //评价
20 - image:'', //评价图片 20 + image: '', //评价图片
21 flags: true, 21 flags: true,
22 deacArray: [{ 22 deacArray: [{
23 img: '/images/1.jpg' 23 img: '/images/1.jpg'
@@ -30,7 +30,7 @@ Page({ @@ -30,7 +30,7 @@ Page({
30 showMask: false, 30 showMask: false,
31 showMaskTwo: false, 31 showMaskTwo: false,
32 showMaskSku: false, 32 showMaskSku: false,
33 - count: 1, 33 + count: "",
34 payCount: 1, 34 payCount: 1,
35 stockNum: '', 35 stockNum: '',
36 richText: '', 36 richText: '',
@@ -227,15 +227,17 @@ Page({ @@ -227,15 +227,17 @@ Page({
227 icon: 'success', 227 icon: 'success',
228 duration: 1000 228 duration: 1000
229 }) 229 })
230 - } else {  
231 - setTimeout(() => {  
232 - util.getUser()  
233 - }, 2000) 230 + } else if (wx.getStorageSync('Authorization')) {
  231 +
234 wx.showToast({ 232 wx.showToast({
235 title: data.msg, 233 title: data.msg,
236 icon: 'none', 234 icon: 'none',
237 duration: 1000 235 duration: 1000
238 }) 236 })
  237 + } else {
  238 + setTimeout(() => {
  239 + util.getUser()
  240 + }, 2000)
239 } 241 }
240 }) 242 })
241 }, 243 },
@@ -342,15 +344,16 @@ Page({ @@ -342,15 +344,16 @@ Page({
342 wx.navigateTo({ 344 wx.navigateTo({
343 url: '/pages/affirm-order/affirm-order?id=' + that.data.id + '&count=' + that.data.payCount + '&stockNum=' + that.data.stockNum + "&skuId=" + this.data.skuId, 345 url: '/pages/affirm-order/affirm-order?id=' + that.data.id + '&count=' + that.data.payCount + '&stockNum=' + that.data.stockNum + "&skuId=" + this.data.skuId,
344 }) 346 })
345 - } else {  
346 - setTimeout(() => {  
347 - util.getUser()  
348 - }, 2000) 347 + } else if (wx.getStorageSync('Authorization')) {
349 wx.showToast({ 348 wx.showToast({
350 title: data.msg, 349 title: data.msg,
351 icon: 'none', 350 icon: 'none',
352 duration: 1000 351 duration: 1000
353 }) 352 })
  353 + } else {
  354 + setTimeout(() => {
  355 + util.getUser()
  356 + }, 2000)
354 } 357 }
355 }) 358 })
356 }, 359 },
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 <swiper class="swiper" indicator-dots="true" autoplay="true" interval="5000" duration="1000"> 7 <swiper class="swiper" indicator-dots="true" autoplay="true" interval="5000" duration="1000">
8 <block wx:for="{{swiperArray}}" wx:for-index="idx"> 8 <block wx:for="{{swiperArray}}" wx:for-index="idx">
9 <swiper-item> 9 <swiper-item>
10 - <image src="{{item}}" class="slideImage"></image> 10 + <image src="{{item}}" class="slideImage" ></image>
11 </swiper-item> 11 </swiper-item>
12 </block> 12 </block>
13 </swiper> 13 </swiper>
@@ -22,7 +22,6 @@ @@ -22,7 +22,6 @@
22 .swiper { 22 .swiper {
23 height: 750rpx; 23 height: 750rpx;
24 width: 100%; 24 width: 100%;
25 - background-color: aquamarine;  
26 } 25 }
27 26
28 .swiper image { 27 .swiper image {
@@ -74,7 +74,6 @@ Page({ @@ -74,7 +74,6 @@ Page({
74 list.forEach((item, index) => { 74 list.forEach((item, index) => {
75 if (index == idx) { 75 if (index == idx) {
76 let obj = { 76 let obj = {
77 -  
78 } 77 }
79 method.postRequest("/address/delete/" + id, obj, data => { 78 method.postRequest("/address/delete/" + id, obj, data => {
80 if (data.statusCode == 0) { 79 if (data.statusCode == 0) {
@@ -121,7 +120,7 @@ Page({ @@ -121,7 +120,7 @@ Page({
121 * 生命周期函数--监听页面显示 120 * 生命周期函数--监听页面显示
122 */ 121 */
123 onShow: function () { 122 onShow: function () {
124 - 123 + this.getAddressList();
125 }, 124 },
126 125
127 /** 126 /**
@@ -20,6 +20,7 @@ Page({ @@ -20,6 +20,7 @@ Page({
20 pitchCart: [], //选中商品 20 pitchCart: [], //选中商品
21 pitchList: [], //选中商品id 21 pitchList: [], //选中商品id
22 hasList: false, // 列表是否有数据 22 hasList: false, // 列表是否有数据
  23 + cartnoData: false, //购物车是否为空
23 totalPrice: 0, // 总价,初始为0 24 totalPrice: 0, // 总价,初始为0
24 selectAllStatus: true, // 全选状态,默认全选 25 selectAllStatus: true, // 全选状态,默认全选
25 obj: { 26 obj: {
@@ -28,14 +29,15 @@ Page({ @@ -28,14 +29,15 @@ Page({
28 }, 29 },
29 //地址信息 30 //地址信息
30 getAddress() { 31 getAddress() {
31 - if(wx.getStorageSync('addIndex')){  
32 - wx.setStorageSync('addIndex', 0)  
33 - } 32 + // if (wx.getStorageSync('addIndex')) {
  33 + // wx.removeStorageSync('addIndex')
  34 + // }
34 let index = wx.getStorageSync('addIndex') 35 let index = wx.getStorageSync('addIndex')
35 method.getRequest("/address", data => { 36 method.getRequest("/address", data => {
36 if (data.statusCode == 0) { 37 if (data.statusCode == 0) {
  38 + let list = data.data.reverse();
37 this.setData({ 39 this.setData({
38 - userData: data.data[index], 40 + userData: list[index],
39 addHint: true 41 addHint: true
40 }) 42 })
41 } 43 }
@@ -45,26 +47,26 @@ Page({ @@ -45,26 +47,26 @@ Page({
45 wx.navigateTo({ 47 wx.navigateTo({
46 url: '/pages/select-address/select-address', 48 url: '/pages/select-address/select-address',
47 }) 49 })
48 - wx.setStorageSync("shopCartAdd",'true') 50 + wx.setStorageSync("shopCartAdd", 'true')
49 }, 51 },
50 //没有登录 52 //没有登录
51 goAddress1() { 53 goAddress1() {
52 - if(wx.getStorageSync('Authorization')){ 54 + if (wx.getStorageSync('Authorization')) {
53 wx.navigateTo({ 55 wx.navigateTo({
54 url: '/pages/select-address/select-address', 56 url: '/pages/select-address/select-address',
55 }) 57 })
56 - wx.setStorageSync("shopCartAdd",'true')  
57 - }else{ 58 + wx.setStorageSync("shopCartAdd", 'true')
  59 + } else {
58 wx.showToast({ 60 wx.showToast({
59 title: '请先登录!', 61 title: '请先登录!',
60 - icon:'none' 62 + icon: 'none'
61 }) 63 })
62 - setTimeout(()=>{ 64 + setTimeout(() => {
63 util.getUser(); 65 util.getUser();
64 - },2000)  
65 - 66 + }, 2000)
  67 +
66 } 68 }
67 - 69 +
68 }, 70 },
69 //配送时间 71 //配送时间
70 bindDateChange: function (e) { 72 bindDateChange: function (e) {
@@ -79,7 +81,6 @@ Page({ @@ -79,7 +81,6 @@ Page({
79 var month = myDate.getMonth(); 81 var month = myDate.getMonth();
80 var day = myDate.getDate(); 82 var day = myDate.getDate();
81 var dayNow = year + '-' + (month + 1) + "-" + day; 83 var dayNow = year + '-' + (month + 1) + "-" + day;
82 - console.log(dayNow, 'daynow')  
83 this.setData({ 84 this.setData({
84 startTime: dayNow 85 startTime: dayNow
85 }) 86 })
@@ -108,32 +109,42 @@ Page({ @@ -108,32 +109,42 @@ Page({
108 this.getTotalNum(); 109 this.getTotalNum();
109 }, 110 },
110 111
111 - // 删除当前商品  
112 - deleteList(e) {  
113 - const index = e.currentTarget.dataset.index;  
114 - const cartIds = e.currentTarget.dataset.cartid;  
115 - let carts = this.data.carts;  
116 - carts.splice(index, 1);  
117 - this.setData({  
118 - carts: carts  
119 - });  
120 - method.deleteRequest("/cart/" + cartIds, data => {  
121 - if (data.statusCode == 0) {  
122 - wx.showToast({  
123 - title: '删除成功',  
124 - icon: 'none'  
125 - }) 112 + //删除
  113 + delGoods(e) {
  114 + let that = this;
  115 + wx.showModal({
  116 + title: '提示',
  117 + content: '确定删除该商品吗',
  118 + success(res) {
  119 + if (res.confirm) {
  120 + const index = e.currentTarget.dataset.index;
  121 + const cartIds = e.currentTarget.dataset.cartid;
  122 + let carts = that.data.carts;
  123 + carts.splice(index, 1);
  124 + that.setData({
  125 + carts: carts
  126 + });
  127 + method.deleteRequest("/cart/" + cartIds, data => {
  128 + if (data.statusCode == 0) {
  129 + wx.showToast({
  130 + title: '删除成功',
  131 + icon: 'none'
  132 + })
  133 + }
  134 + })
  135 + if (!carts.length) {
  136 + this.setData({
  137 + hasList: false
  138 + });
  139 + } else {
  140 + this.getTotalPrice();
  141 + }
  142 + } else if (res.cancel) {
  143 + console.log('用户点击取消')
  144 + }
126 } 145 }
127 }) 146 })
128 - if (!carts.length) {  
129 - this.setData({  
130 - hasList: false  
131 - });  
132 - } else {  
133 - this.getTotalPrice();  
134 - }  
135 }, 147 },
136 -  
137 // 全选 148 // 全选
138 selectAll(e) { 149 selectAll(e) {
139 let selectAllStatus = this.data.selectAllStatus; 150 let selectAllStatus = this.data.selectAllStatus;
@@ -260,14 +271,14 @@ Page({ @@ -260,14 +271,14 @@ Page({
260 } 271 }
261 let list = this.data.carts; 272 let list = this.data.carts;
262 list.forEach((item, index) => { 273 list.forEach((item, index) => {
263 - if(item.selected==true){  
264 - console.log(item,"item")  
265 - list.splice(index,1)  
266 - console.log(list,'list')  
267 - }  
268 - this.setData({  
269 - carts:list  
270 - }) 274 + if (item.selected == true) {
  275 + console.log(item, "item")
  276 + list.splice(index, 1)
  277 + console.log(list, 'list')
  278 + }
  279 + this.setData({
  280 + carts: list
  281 + })
271 }) 282 })
272 wx.setStorageSync('date', this.data.date) 283 wx.setStorageSync('date', this.data.date)
273 console.log(this.data.date, 'datess') 284 console.log(this.data.date, 'datess')
@@ -307,7 +318,7 @@ Page({ @@ -307,7 +318,7 @@ Page({
307 this.setData({ 318 this.setData({
308 hasList: true, 319 hasList: true,
309 carts: [], 320 carts: [],
310 - checkNum : 0 321 + checkNum: 0
311 }); 322 });
312 this.getTotalPrice(); 323 this.getTotalPrice();
313 this.getAddress() //获取默认地址 324 this.getAddress() //获取默认地址
@@ -316,6 +327,15 @@ Page({ @@ -316,6 +327,15 @@ Page({
316 pitchCart: [], 327 pitchCart: [],
317 pitchList: [] 328 pitchList: []
318 }) 329 })
  330 +
  331 + setTimeout(() => { //判断购物车是否有商品
  332 + if (this.data.carts.length == 0) {
  333 + this.setData({
  334 + cartnoData: true
  335 + })
  336 + }
  337 + }, 500)
  338 +
319 }, 339 },
320 340
321 /** 341 /**
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 <view wx:if="{{hasList}}"> 35 <view wx:if="{{hasList}}">
36 <view class="cart-box"> 36 <view class="cart-box">
37 <view class="cart-list" wx:for="{{carts}}" wx:key="{{index}}" data-goodsid="{{item.goodsId}}" 37 <view class="cart-list" wx:for="{{carts}}" wx:key="{{index}}" data-goodsid="{{item.goodsId}}"
38 - bindtap="goDetail"> 38 + bindtap="goDetail" bindlongpress="delGoods" data-index="{{index}}" data-cartId="{{item.cartId}}">
39 <icon wx:if="{{item.selected}}" type="success" color="#FF4903" data-index="{{index}}" class="cart-pro-select" 39 <icon wx:if="{{item.selected}}" type="success" color="#FF4903" data-index="{{index}}" class="cart-pro-select"
40 catchtap="selectList" /> 40 catchtap="selectList" />
41 <icon wx:else type="circle" class="cart-pro-select" data-index="{{index}}" catchtap="selectList" /> 41 <icon wx:else type="circle" class="cart-pro-select" data-index="{{index}}" catchtap="selectList" />
@@ -52,8 +52,7 @@ @@ -52,8 +52,7 @@
52 <text class="cart-count-add" catchtap="addCount" data-index="{{index}}" 52 <text class="cart-count-add" catchtap="addCount" data-index="{{index}}"
53 data-goodSkuId="{{item.goodsSkuId}}">+</text> 53 data-goodSkuId="{{item.goodsSkuId}}">+</text>
54 </view> 54 </view>
55 - <text class="cart-del" catchtap="deleteList" data-index="{{index}}" data-cartId="{{item.cartId}}"  
56 - data-goodSkuId="{{item.goodsSkuId}}">×</text> 55 +
57 </view> 56 </view>
58 </view> 57 </view>
59 58
@@ -69,7 +68,7 @@ @@ -69,7 +68,7 @@
69 <text class="cart-toatl-price">¥{{totalPrice}}</text> 68 <text class="cart-toatl-price">¥{{totalPrice}}</text>
70 </view> --> 69 </view> -->
71 </view> 70 </view>
72 - <view wx:if="{{carts.length==0}}"> 71 + <view wx:if="{{cartnoData}}">
73 <view class="cart-no-data">一件商品都没有呢</view> 72 <view class="cart-no-data">一件商品都没有呢</view>
74 <view class="cart-no-data-btn" bindtap="goHome">去逛逛</view> 73 <view class="cart-no-data-btn" bindtap="goHome">去逛逛</view>
75 </view> 74 </view>
@@ -104,8 +104,8 @@ page { @@ -104,8 +104,8 @@ page {
104 } 104 }
105 105
106 .arrow image { 106 .arrow image {
107 - width: 32rpx;  
108 - height: 32rpx; 107 + width: 16rpx;
  108 + height: 28rpx;
109 } 109 }
110 110
111 /* 配送时间 */ 111 /* 配送时间 */
@@ -130,11 +130,13 @@ page { @@ -130,11 +130,13 @@ page {
130 .picker { 130 .picker {
131 width: 610rpx; 131 width: 610rpx;
132 height: 50rpx; 132 height: 50rpx;
  133 + font-size: 28rpx;
  134 + color: #323233;
133 } 135 }
134 136
135 .calendar image { 137 .calendar image {
136 - width: 32rpx;  
137 - height: 32rpx; 138 + width: 36rpx;
  139 + height: 36rpx;
138 } 140 }
139 141
140 .timeTitle, 142 .timeTitle,
@@ -309,20 +311,27 @@ page { @@ -309,20 +311,27 @@ page {
309 311
310 .cart-list .cart-pro-name { 312 .cart-list .cart-pro-name {
311 display: inline-block; 313 display: inline-block;
312 - width: 332rpx; 314 + width: 350rpx;
313 line-height: 40rpx; 315 line-height: 40rpx;
  316 + font-size: 28rpx;
  317 + color: #333333;
  318 + font-weight: 600;
314 overflow: hidden; 319 overflow: hidden;
  320 + text-overflow: ellipsis;
  321 + white-space: nowrap;
315 } 322 }
316 323
317 .cart-list .cart-pro-desc { 324 .cart-list .cart-pro-desc {
318 - width: 332rpx;  
319 - height: 63rpx; 325 + width: 350rpx;
  326 + height: 78rpx;
320 -webkit-line-clamp: 2; 327 -webkit-line-clamp: 2;
321 overflow: hidden; 328 overflow: hidden;
322 font-size: 24rpx; 329 font-size: 24rpx;
323 font-weight: 400; 330 font-weight: 400;
324 text-align: left; 331 text-align: left;
325 color: #999999; 332 color: #999999;
  333 + display: -webkit-box;
  334 + -webkit-box-orient: vertical;
326 display: block; 335 display: block;
327 } 336 }
328 337
@@ -331,7 +340,7 @@ page { @@ -331,7 +340,7 @@ page {
331 float: left; 340 float: left;
332 height: 48rpx; 341 height: 48rpx;
333 line-height: 48rpx; 342 line-height: 48rpx;
334 - margin-top: 40rpx; 343 + margin-top: 24rpx;
335 color: #FF4444; 344 color: #FF4444;
336 } 345 }
337 346
@@ -359,6 +368,7 @@ page { @@ -359,6 +368,7 @@ page {
359 .cart-count-num { 368 .cart-count-num {
360 width: 86rpx; 369 width: 86rpx;
361 background-color: #eeeeee; 370 background-color: #eeeeee;
  371 + font-size: 24rpx;
362 } 372 }
363 373
364 .cart-del { 374 .cart-del {
@@ -5,13 +5,13 @@ Page({ @@ -5,13 +5,13 @@ Page({
5 userData: '', 5 userData: '',
6 vip: '', 6 vip: '',
7 orderList: [{ 7 orderList: [{
8 - url: '/images/05-01/moban@2x.png', 8 + url: '/images/05-01/moban.png',
9 text: '待付款' 9 text: '待付款'
10 }, { 10 }, {
11 - url: '/images/05-01/daifahuo-2@2x.png', 11 + url: '/images/05-01/daipeisong.png',
12 text: '待发货' 12 text: '待发货'
13 }, { 13 }, {
14 - url: '/images/05-01/peisong2@2x.png', 14 + url: '/images/05-01/peisong.png',
15 text: '待收货' 15 text: '待收货'
16 }, { 16 }, {
17 url: '/images/05-01/daipingjia.png', 17 url: '/images/05-01/daipingjia.png',