diff --git a/pages/home/cloudCard2.vue b/pages/home/cloudCard2.vue index 0c56f06..a7b0ebf 100644 --- a/pages/home/cloudCard2.vue +++ b/pages/home/cloudCard2.vue @@ -11,87 +11,91 @@ + + - + - + - + + + {{item.name}} + - - - {{item.name}} - - - + - + - + - + - + - {{item.brandName}} + {{item.brandName}} + - - + - + - + - + - + - {{item.name}} + {{item.name}} - {{item.remark}} + {{item.remark}} - - + {{item.jprice}}元/{{item.specificationUnit}} - {{item.weight}}{{item.specificationUnit}}/{{item.unitName}} - + - - ¥{{item.mefenPrice}} + ¥{{item.mefenPrice}} - + - + - {{item.goodsNumber}} - + {{item.goodsNumber}} + + + @@ -104,66 +108,68 @@ - - - + - - + + - + - {{page.count}} - - - - - 温馨提示:已定制了 - - {{page.weight}}斤 - - ,100-200斤有配送费,200斤以上免运费。 + + + 温馨提示:已订 + + {{page.weight}}斤 + + + + ,100起订,200斤以上免配送费 + - - + - + - - - - - ¥{{page.price}} - 配送费:¥{{page.reduce}} + + + + ¥{{page.price}} + 配送费:¥{{page.reduce}} + - - 结算 + @click="settlement()">结算 + + + + - { - console.log("------------", resp); - _this.data = resp - _this.searchInfo.sid = _this.data[0].sid - _this.selectIndex = 0 - _this.getgoods() - _this.getAllPriceOrWeight() - _this.scrollLeftTop = _this.scrollLeftTop == 0 ? -1 : 0 - _this.scrollRightTop = _this.scrollRightTop == 0 ? -1 : 0 - }).catch(e => {}) + + if (this.baseDataSuccess) { + this.getgoods() + } else { + let _this = this + _this.$api.getGoodsTypeAndBrand(_this.brandType).then((resp) => { + _this.data = resp + console.log("======", resp); + _this.baseDataSuccess = true + _this.getgoods() + }).catch(e => { + _this.$nextTick(() => { + _this.$refs.pageView.setLoadState(1) + }) + }) + } + }, getAllPriceOrWeight() { let _this = this var params = { customerSid: getApp().globalData.sid, - affiliation: this.brandType, + affiliation: this.data.brandVos[this.selectIndex2].id, } _this.$api.getGoodsWeight(params).then((resp) => { @@ -314,17 +327,31 @@ _this.initPrice = resp.totalPrice _this.initWeight = resp.totalWeight - }).catch(e => {}) + _this.$nextTick(() => { + _this.$refs.pageView.setLoadState(2) + }) + + }).catch(e => { + _this.$nextTick(() => { + _this.$refs.pageView.setLoadState(1) + }) + }) }, getgoods() { let _this = this _this.searchInfo.customerSid = getApp().globalData.sid - _this.searchInfo.affiliation = this.brandType + _this.searchInfo.brandId = this.data.brandVos[this.selectIndex2].id + _this.searchInfo.categoryId = this.data.typeVos[this.selectIndex].id _this.$api.getGoodsByType(_this.searchInfo).then((resp) => { _this.goods = resp - }).catch(e => {}) + _this.getAllPriceOrWeight() + }).catch(e => { + _this.$nextTick(() => { + _this.$refs.pageView.setLoadState(1) + }) + }) }, itemShow(item) { item.showCart = true @@ -370,8 +397,7 @@ console.log('用户点击确定') item.goodsNumber = 0 item.subtotal = 0 - that.getallPrice() - that.getweight() + that.upDateShoppCart(item) } else if (res.cancel) { @@ -385,8 +411,7 @@ } item.subtotal = Number(item.goodsNumber) * Number(item.mefenPrice) - that.getallPrice() - that.getweight() + that.upDateShoppCart(item) } }, @@ -395,8 +420,6 @@ item.goodsNumber = Number(item.goodsNumber) + 1 item.subtotal = Number(item.goodsNumber) * Number(item.mefenPrice) - this.getallPrice() - this.getweight() this.upDateShoppCart(item) }, @@ -453,7 +476,7 @@ goodsSid: item.goodsSid, goodsName: item.name, goodsNumber: item.goodsNumber, - affiliation: this.brandType, + affiliation: this.data.brandVos[this.selectIndex2].id, price: item.mefenPrice, weight: item.weight, customerSid: getApp().globalData.sid @@ -461,8 +484,10 @@ let _this = this _this.$api.addShoppingCart(good).then((resp) => { - - }).catch(e => {}) + _this.getgoods() + }).catch(e => { + _this.getgoods() + }) },