wong1988 1 year ago
parent
commit
e6c1c58dc5
  1. 91
      pages/home/cloudCard2.vue

91
pages/home/cloudCard2.vue

@ -11,7 +11,7 @@
</view> </view>
<loading-state ref="pageView" @request="request">
<view <view
style="background: #fff; height: calc(100vh - 45px - 50vw);width: 100%; border-radius: 15px;display: flex;flex-direction: column; box-sizing: border-box;margin-top: -15px;box-sizing: border-box;"> style="background: #fff; height: calc(100vh - 45px - 50vw);width: 100%; border-radius: 15px;display: flex;flex-direction: column; box-sizing: border-box;margin-top: -15px;box-sizing: border-box;">
@ -39,11 +39,12 @@
style="display: flex;flex-direction: column; justify-content: center;align-items: center;margin-right: 10px;" style="display: flex;flex-direction: column; justify-content: center;align-items: center;margin-right: 10px;"
@click.stop="brandClick(index2)"> @click.stop="brandClick(index2)">
<image src="https://supervise.yxtsoft.com/lpk/image/family_icon.png" mode="aspectFill" <image src="https://supervise.yxtsoft.com/lpk/image/family_icon.png"
:class="selectIndex2 == index2?'top_img1':'top_img2'" mode="aspectFill" :class="selectIndex2 == index2?'top_img1':'top_img2'"
style="width: 60px;height:60px;border-radius: 50%;padding:5px;"></image> style="width: 60px;height:60px;border-radius: 50%;padding:5px;"></image>
<text :class="selectIndex2 == index2?'top_text1':'top_text2'">{{item.brandName}}</text> <text
:class="selectIndex2 == index2?'top_text1':'top_text2'">{{item.brandName}}</text>
</view> </view>
</view> </view>
@ -65,7 +66,8 @@
<text style="font-size: 13px;color: #000;">{{item.name}}</text> <text style="font-size: 13px;color: #000;">{{item.name}}</text>
<text style="font-size: 10px;color: #999;margin-top: 5px;">{{item.remark}}</text> <text
style="font-size: 10px;color: #999;margin-top: 5px;">{{item.remark}}</text>
<view <view
style="display: flex;flex-direction: row;align-items: center;margin-top: 8px;"> style="display: flex;flex-direction: row;align-items: center;margin-top: 8px;">
@ -126,13 +128,14 @@
<view id="bomView" <view id="bomView"
style="display: flex;flex-direction: row;align-items: center; margin-left: 15px;"> style="display: flex;flex-direction: row;align-items: center; margin-left: 15px;">
<view style="color: #888;font-size: 10px;height: 10px;line-height: 10px;margin-top: 5px;"> <view style="color: #888;font-size: 10px;height: 10px;line-height: 10px;margin-top: 5px;">
温馨提示已定制了</view> 温馨提示已订</view>
<view style="color: #FF5006;font-size: 15px;height: 15px;line-height: 15px;font-weight: bold;"> <view
style="color: #FF5006;font-size: 15px;height: 15px;line-height: 15px;font-weight: bold;">
{{page.weight}} {{page.weight}}
</view> </view>
<view style="color: #888;font-size: 10px;height: 10px;line-height: 10px;margin-top: 5px;"> <view style="color: #888;font-size: 10px;height: 10px;line-height: 10px;margin-top: 5px;">
100-200斤有配送费200斤以上免运费</view> 100起订200斤以上免配送费</view>
</view> </view>
</view> </view>
@ -162,9 +165,12 @@
</view> </view>
</view> </view>
</loading-state>
<uni-popup ref="inputDialog" type="dialog"> <uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="base" title="订购协议" :showConfirm="true" <uni-popup-dialog ref="inputClose" mode="base" title="订购协议" :showConfirm="true"
:beforeClose="dialogBeforeClose" @confirm="dialogInputConfirm" :content="dialogContent" :beforeClose="dialogBeforeClose" @confirm="dialogInputConfirm" :content="dialogContent"
@ -228,6 +234,7 @@
initReduce: "0", initReduce: "0",
initWeight: "0", initWeight: "0",
shareSid: "", shareSid: "",
baseDataSuccess: false
} }
}, },
onShow() { onShow() {
@ -237,8 +244,10 @@
}) })
} }
this.getAllPriceOrWeight() //
if (this.changeLoading) {
this.getgoods() this.getgoods()
}
}, },
onLoad(options) { onLoad(options) {
@ -279,30 +288,34 @@
}, },
brandClick(val) { brandClick(val) {
this.selectIndex2 = val this.selectIndex2 = val
this.request() this.getgoods()
}, },
request() { request() {
if (this.baseDataSuccess) {
this.getgoods()
} else {
let _this = this let _this = this
_this.$api.getGoodsTypeAndBrand(_this.brandType).then((resp) => { _this.$api.getGoodsTypeAndBrand(_this.brandType).then((resp) => {
console.log("------------", resp);
_this.data = resp _this.data = resp
_this.searchInfo.sid = _this.data[0].sid console.log("======", resp);
_this.selectIndex = 0 _this.baseDataSuccess = true
_this.getgoods() _this.getgoods()
_this.getAllPriceOrWeight() }).catch(e => {
_this.scrollLeftTop = _this.scrollLeftTop == 0 ? -1 : 0 _this.$nextTick(() => {
_this.scrollRightTop = _this.scrollRightTop == 0 ? -1 : 0 _this.$refs.pageView.setLoadState(1)
}).catch(e => {}) })
})
}
}, },
getAllPriceOrWeight() { getAllPriceOrWeight() {
let _this = this let _this = this
var params = { var params = {
customerSid: getApp().globalData.sid, customerSid: getApp().globalData.sid,
affiliation: this.brandType, affiliation: this.data.brandVos[this.selectIndex2].id,
} }
_this.$api.getGoodsWeight(params).then((resp) => { _this.$api.getGoodsWeight(params).then((resp) => {
@ -314,17 +327,31 @@
_this.initPrice = resp.totalPrice _this.initPrice = resp.totalPrice
_this.initWeight = resp.totalWeight _this.initWeight = resp.totalWeight
}).catch(e => {}) _this.$nextTick(() => {
_this.$refs.pageView.setLoadState(2)
})
}).catch(e => {
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(1)
})
})
}, },
getgoods() { getgoods() {
let _this = this let _this = this
_this.searchInfo.customerSid = getApp().globalData.sid _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.$api.getGoodsByType(_this.searchInfo).then((resp) => {
_this.goods = resp _this.goods = resp
}).catch(e => {}) _this.getAllPriceOrWeight()
}).catch(e => {
_this.$nextTick(() => {
_this.$refs.pageView.setLoadState(1)
})
})
}, },
itemShow(item) { itemShow(item) {
item.showCart = true item.showCart = true
@ -370,8 +397,7 @@
console.log('用户点击确定') console.log('用户点击确定')
item.goodsNumber = 0 item.goodsNumber = 0
item.subtotal = 0 item.subtotal = 0
that.getallPrice()
that.getweight()
that.upDateShoppCart(item) that.upDateShoppCart(item)
} else if (res.cancel) { } else if (res.cancel) {
@ -385,8 +411,7 @@
} }
item.subtotal = Number(item.goodsNumber) * Number(item.mefenPrice) item.subtotal = Number(item.goodsNumber) * Number(item.mefenPrice)
that.getallPrice()
that.getweight()
that.upDateShoppCart(item) that.upDateShoppCart(item)
} }
}, },
@ -395,8 +420,6 @@
item.goodsNumber = Number(item.goodsNumber) + 1 item.goodsNumber = Number(item.goodsNumber) + 1
item.subtotal = Number(item.goodsNumber) * Number(item.mefenPrice) item.subtotal = Number(item.goodsNumber) * Number(item.mefenPrice)
this.getallPrice()
this.getweight()
this.upDateShoppCart(item) this.upDateShoppCart(item)
}, },
@ -453,7 +476,7 @@
goodsSid: item.goodsSid, goodsSid: item.goodsSid,
goodsName: item.name, goodsName: item.name,
goodsNumber: item.goodsNumber, goodsNumber: item.goodsNumber,
affiliation: this.brandType, affiliation: this.data.brandVos[this.selectIndex2].id,
price: item.mefenPrice, price: item.mefenPrice,
weight: item.weight, weight: item.weight,
customerSid: getApp().globalData.sid customerSid: getApp().globalData.sid
@ -461,8 +484,10 @@
let _this = this let _this = this
_this.$api.addShoppingCart(good).then((resp) => { _this.$api.addShoppingCart(good).then((resp) => {
_this.getgoods()
}).catch(e => {}) }).catch(e => {
_this.getgoods()
})
}, },

Loading…
Cancel
Save