diff --git a/App.vue b/App.vue index 0ce7f61..7a31b6d 100644 --- a/App.vue +++ b/App.vue @@ -5,6 +5,9 @@ onShow: function() { // this.$store.commit('initConfig') this.$store.commit('getPosition') + if(uni.getStorageSync('token')){ + this.$store.commit('getUserInfo') + } }, onHide: function() { } diff --git a/common.scss b/common.scss new file mode 100644 index 0000000..5fd3072 --- /dev/null +++ b/common.scss @@ -0,0 +1,40 @@ + +// 文字益处处理 +.text-ellipsis{ + overflow:hidden; //超出的文本隐藏 + text-overflow:ellipsis; //溢出用省略号显示 + white-space:nowrap; //溢出不换行 +} +.text-ellipsis-2{ + overflow: hidden; + text-overflow: ellipsis; + display:-webkit-box; //作为弹性伸缩盒子模型显示。 + -webkit-box-orient:vertical; //设置伸缩盒子的子元素排列方式--从上到下垂直排列 + -webkit-line-clamp:2; //显示的行 +} +.text-ellipsis-3{ + overflow: hidden; + text-overflow: ellipsis; + display:-webkit-box; //作为弹性伸缩盒子模型显示。 + -webkit-box-orient:vertical; //设置伸缩盒子的子元素排列方式--从上到下垂直排列 + -webkit-line-clamp:3; //显示的行 +} + + +.share{ + padding: 0; + margin: 0; + background-color: #fff; + display: flex !important; + flex-direction: column !important; + justify-content: center !important; + align-items: center !important; + font-size: 26rpx; +} +.share::after{ + border: none; + padding: 0; + margin: 0; + width: 0; + height: 0; +} \ No newline at end of file diff --git a/pages/index/cart.vue b/pages/index/cart.vue index 6eff5f9..d90c5ba 100644 --- a/pages/index/cart.vue +++ b/pages/index/cart.vue @@ -3,14 +3,15 @@ - + - @@ -32,7 +33,7 @@ ¥ - {{ item.price }} + {{ item.depositPrice }} @@ -41,6 +42,13 @@ + + @@ -102,7 +110,9 @@ pageNo: 1, pageSize: 10, }, - list: [], + list: { + records : [], + }, addressTotal: 0, address: { name: '请选择联系人', @@ -135,7 +145,7 @@ let price = 0 this.list.records.forEach(n => { if (this.checkboxValue.includes(n.id)) { - price += n.price * n.num + price += n.depositPrice * n.num } }) return price @@ -192,6 +202,13 @@ }) return } + + if (this.addressTotal == 0) { + return uni.navigateTo({ + url: '/pages_order/mine/address?type=back' + }) + } + // 打开地址弹框 this.$refs.addressPopup.open('bottom') }, @@ -211,7 +228,7 @@ let data = [] let records = this.list.records for (var i = 0; i < records.length; i++) { - if (this.checkboxValue.includes(records[i].goodsId)) { + if (this.checkboxValue.includes(records[i].id)) { data.push({ id: records[i].goodsId, //商品id skuId: records[i].skuId, //规格id @@ -229,6 +246,17 @@ let form = { id: res.result.id } + + // 不管有没有支付,都要清除购物车数据 + self.$api('cartDel', { + id: deleteCartIds + }, res => { + if (res.code == 200) { + self.getData() + } + }) + + this.$api('orderPay', form, res => { if (res.code == 200) { uni.requestPayment({ @@ -241,15 +269,6 @@ success: function(res) { console.log('支付成功', res); - // 清除购物车数据 - self.$api('cartDel', { - id: deleteCartIds - }, res => { - if (res.code == 200) { - self.getData() - } - }) - uni.redirectTo({ url: '/pages/index/order' }) diff --git a/pages/index/category.vue b/pages/index/category.vue index 03891a0..2f130c9 100644 --- a/pages/index/category.vue +++ b/pages/index/category.vue @@ -102,6 +102,17 @@