diff --git a/packageA/address/index.vue b/packageA/address/index.vue index 497b60b..b6512a4 100644 --- a/packageA/address/index.vue +++ b/packageA/address/index.vue @@ -60,8 +60,13 @@ console.log(options) if (options && options.fromPage) { this.fromPage = options.fromPage - } - this.getAddresslist(); + } + + this.getAddresslist(); + // if (this.siteList == 0) { + // this.$u.toast("请先添加地址") + // return + // } }, methods: { //数组对象排序 @@ -173,7 +178,11 @@ } }); }, - getAddresslist() { + getAddresslist() { + // if (this.siteList.length == 0) { + // this.$u.toast("请先添加地址") + // return + // } this.$u.post('/api/v1/users/address/list', { UserID: uni.getStorageSync("userInfo").id }).then(res => { @@ -183,7 +192,7 @@ return } this.siteList = res.data.data - console.log(this.siteList) + console.log('ll',this.siteList) if (this.siteList.length == 0) { this.isNull = true } else { diff --git a/packageA/goodsCart/index.vue b/packageA/goodsCart/index.vue index 949bd10..3434758 100644 --- a/packageA/goodsCart/index.vue +++ b/packageA/goodsCart/index.vue @@ -29,7 +29,7 @@ - + @@ -97,6 +97,9 @@ }, onShow() { this.getCartGoods() + console.log('商品数量',this.cartGoods.length); + var num = this.cartGoods.length + uni.setStorageSync('num',num) }, methods: { //判断图片 @@ -144,7 +147,8 @@ for (let i = 0; i < this.cartGoods.length; i++) { this.cartGoods[i].shopChecked = false for (let j = 0; j < this.cartGoods[i].children.length; j++) { - this.cartGoods[i].children[j].goodsChecked = false + this.cartGoods[i].children[j].goodsChecked = false; + this.cartGoods[i].children[j].img = this.judgeCover(this.cartGoods[i].children[j].mainPhotoUrl); } } } diff --git a/pages/cart/cart.vue b/pages/cart/cart.vue index d6d30ef..b5998e1 100644 --- a/pages/cart/cart.vue +++ b/pages/cart/cart.vue @@ -36,10 +36,15 @@ - - + --> + + @@ -57,9 +62,9 @@ style="text-decoration: line-through;font-size: 20rpx;margin-left: 5rpx;color: #898989;">¥{{goods.originalPrice}} - - + @@ -126,7 +131,7 @@ this.getGoodsList() }, methods: { - //判断图片 + // 判断图片 judgeCover(val) { if (!val) { return @@ -181,13 +186,13 @@ this.cartGoods[i].shopChecked = false for (let j = 0; j < this.cartGoods[i].children.length; j++) { this.cartGoods[i].children[j].goodsChecked = false; - + this.cartGoods[i].children[j].img = this.judgeCover(this.cartGoods[i].children[j].mainPhotoUrl); } } } this.getSelectedGoods() this.$forceUpdate() - console.log(this.cartGoods) + console.log('列表',this.cartGoods.length) }); }, // 勾选店铺 @@ -277,6 +282,7 @@ this.totalCommission = totalCommission.toFixed(2) // console.log(selectGoodsIds) }, + delGoods() { if (this.selectGoodsIds.length == 0) { this.$u.toast("至少选择一件商品"); diff --git a/pages/classify/classify.vue b/pages/classify/classify.vue index e1761c2..d21b9da 100644 --- a/pages/classify/classify.vue +++ b/pages/classify/classify.vue @@ -54,29 +54,29 @@ JDCateList: null, parentId: null, keyword: "", - topPic: "", - pageId:0 + topPic: "", + pageId: 0 } }, onLoad(options) { - console.log(options) - this.pageId=options.id + console.log(options) + this.pageId = options.id // if (options.index==0) { // this.current = 3 - // }else if(options.index==1){ - // this.current=10 - // }else if(options.index==2){ - // this.current=index-2 - // }else{ - // this.current=options.index + // }else if(options.index==1){ + // this.current=10 + // }else if(options.index==2){ + // this.current=index-2 + // }else{ + // this.current=options.index // } if (options.channel && options.channel == 'jingdong') { this.getJDCateList() } else { this.getCateList() - } - - + } + + }, methods: { // 获取京东一二级分类 @@ -87,11 +87,11 @@ return } this.JDCateList = res.data.data - this.cateList = res.data.data - this.cateList.forEach((item,index)=>{ - if(item.id==this.pageId){ - this.current=index - } + this.cateList = res.data.data + this.cateList.forEach((item, index) => { + if (item.id == this.pageId) { + this.current = index + } }) this.subCateList = res.data.data[0].sub }) @@ -104,11 +104,11 @@ this.$u.toast(res.data.msg); return } - this.cateList = res.data.data - this.cateList.forEach((item,index)=>{ - if(item.id==this.pageId){ - this.current=index - } + this.cateList = res.data.data + this.cateList.forEach((item, index) => { + if (item.id == this.pageId) { + this.current = index + } }) this.parentId = this.cateList[this.current].id this.topPic = this.cateList[this.current].logoUrl @@ -135,21 +135,34 @@ toSearch(id) { // 传了id则是点击分类进入搜索页,没有传则是搜索关键字进入搜索页 // cannel为“jingdong” 京东优选 - let url = null if (id) { - url = "/pages/search/search?cate_id=" + id +(this.JDCateList?'&channel=jingdong':'') uni.navigateTo({ - url + url: "/pages/search/search?cate_id=" + id }) } else { - url: "/pages/search/search?keyword=" + this.keyword +(this.JDCateList?'&channel=jingdong':'') - uni.navigateTo({ - url, + uni.navigateTo({ + url: "/pages/search/search?keyword=" + this.keyword, success: () => { this.keyword = "" } }) } + // let url = url + // if (id) { + // url = "/pages/search/search?cate_id=" + id +(this.JDCateList?'&channel=jingdong':'') + // uni.navigateTo({ + // url + // }) + // } else { + // url: "/pages/search/search?keyword=" + this.keyword +(this.JDCateList?'&channel=jingdong':'') + // uni.navigateTo({ + // url, + // success: () => { + // this.keyword = "" + // } + // }) + // console.log("跳转搜索") + // } }, // 点击左边的栏目切换 async swichMenu(index, id) { diff --git a/pages/confirmOrder/confirmOrder.vue b/pages/confirmOrder/confirmOrder.vue index 00c481b..31026d9 100644 --- a/pages/confirmOrder/confirmOrder.vue +++ b/pages/confirmOrder/confirmOrder.vue @@ -255,7 +255,7 @@ // } // }) let orderId = res.data.data.id - this.$u.post('/api/v1/pay/wxpay/order/create', { + this.$u.post('/api/v1/pay/wxminipay/order/create', { userId: uni.getStorageSync("userInfo").id, orderId // wxType:"recook-weapp" diff --git a/pages/goodsDetail/goodsDetail.vue b/pages/goodsDetail/goodsDetail.vue index 60b1a86..3d0c7ca 100644 --- a/pages/goodsDetail/goodsDetail.vue +++ b/pages/goodsDetail/goodsDetail.vue @@ -321,7 +321,7 @@ - - - {{salesVolumeInc}} + + {{shoppingTrolleyCount}} 购物车 @@ -670,14 +671,17 @@ mobile: "", address: "", detail: "", - }, - badgeCount:0 + }, + shoppingTrolleyCount: 0, } }, components: { dynamics }, onLoad(options) { + // var num = uni.getStorageSync('num'); + // console.log('数量',num) + console.log('goodsDetail页面参数:', options); var pages = getCurrentPages(); // 上一页面栈 @@ -735,7 +739,7 @@ }, mounted() { // this.getRegions() - console.log(uni.getStorageSync("userInfo").id) + // console.log(uni.getStorageSync("userInfo").id) }, methods: { //判断图片 @@ -1012,6 +1016,7 @@ return } this.goodsDetail = res.data.data + this.shoppingTrolleyCount = res.data.data.shoppingTrolleyCount // 商样图片 根据type判断放在什么位置 if (res.data.data.notice.type === 1) { this.brandFirstImg = res.data.data.notice.img @@ -1103,9 +1108,7 @@ this.pictures = res.data.data.list }); - }, - - setBadge(cartArray){}, + }, //添加购物车 判断是否登录 addcart() { if (uni.getStorageSync("auth").token) { @@ -1128,6 +1131,7 @@ uni.showToast({ title: "已加入购物车" }) + this.shoppingTrolleyCount += this.buyNum this.specModel(false) }) } else { @@ -1152,15 +1156,39 @@ }, //创建预购单 判断是否登录 createOrder() { - console.log(this.sku_id) - console.log(this.checkedSku) - if (!this.sku_id) { - this.$u.toast("请选择商品规格") - return - } else if (this.jcookStockState != 1) { - this.$u.toast("当前无货") + console.log('qq',this.sku_id) + console.log('aa',this.checkedSku) + // console.log('qq',this.sku_id) + // console.log('aa',this.checkedSku) + console.log('aaddd',this.addressList.length) + + // if (this.addressList.length === 0 ) { + if (this.sku_id != '' && !this.selectedAddress) { + // this.$u.toast('未选择地址'); + uni.navigateTo({ + url: '/packageA/address/index?fromPage=goodsDetail' + }) return - } + } + // else{ + if (!this.sku_id) { + this.$u.toast("请选择商品规格") + return + } + // else if(this.sku_id != '' && !this.selectedAddress){ + // uni.navigateTo({ + // url: '/packageA/address/index?fromPage=goodsDetail' + // }) + // return + + // } + else if (this.jcookStockState != 1) { + this.$u.toast("当前无货") + return + } + + // } + let sendData = { UserID: uni.getStorageSync("userInfo").id, SkuID: this.sku_id, @@ -1378,23 +1406,25 @@ } -