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

247
pages/home/cloudCard2.vue

@ -11,87 +11,91 @@
</view>
<loading-state ref="pageView" @request="request">
<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;">
<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;">
<view class="center">
<view class="center">
<view style="width: 22%;display: flex;flex-direction: column;overflow-y: auto;padding-top: 10px;">
<view style="width: 22%;display: flex;flex-direction: column;overflow-y: auto;padding-top: 10px;">
<view style="width: 100%;display: flex;flex-direction: column; ">
<view v-for="(item,index) in data.typeVos" @click="labelClick(index,item)"
style="display: flex;flex-direction: column;justify-content: center;">
<text class="label" :class="{'label2':selectIndex==index}">{{item.name}}</text>
</view>
<view style="width: 100%;display: flex;flex-direction: column; ">
<view v-for="(item,index) in data.typeVos" @click="labelClick(index,item)"
style="display: flex;flex-direction: column;justify-content: center;">
<text class="label" :class="{'label2':selectIndex==index}">{{item.name}}</text>
</view>
</view>
</view>
<view style="width: 78%;background-color: #fff;overflow-y: auto;">
<view style="width: 78%;background-color: #fff;overflow-y: auto;">
<view style="z-index: 1;background: #FFFFFF;position: sticky;top: 0;padding: 10px;">
<view style="z-index: 1;background: #FFFFFF;position: sticky;top: 0;padding: 10px;">
<view style="display: flex;flex-direction: row;overflow-x: auto;">
<view style="display: flex;flex-direction: row;overflow-x: auto;">
<view v-for="(item,index2) in data.brandVos"
style="display: flex;flex-direction: column; justify-content: center;align-items: center;margin-right: 10px;"
@click.stop="brandClick(index2)">
<view v-for="(item,index2) in data.brandVos"
style="display: flex;flex-direction: column; justify-content: center;align-items: center;margin-right: 10px;"
@click.stop="brandClick(index2)">
<image src="https://supervise.yxtsoft.com/lpk/image/family_icon.png" mode="aspectFill"
:class="selectIndex2 == index2?'top_img1':'top_img2'"
style="width: 60px;height:60px;border-radius: 50%;padding:5px;"></image>
<image src="https://supervise.yxtsoft.com/lpk/image/family_icon.png"
mode="aspectFill" :class="selectIndex2 == index2?'top_img1':'top_img2'"
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>
<view style="width: 100%; display: flex;flex-direction: column;overflow-y: auto;">
<view style="width: 100%; display: flex;flex-direction: column;overflow-y: auto;">
<view v-for="(item,index) in goods" @click="itemClick(item.goodsSid)"
style="display: flex;flex-direction: column;justify-content: center;width: 95%; margin-top: 15px; margin-left: 3%;">
<view v-for="(item,index) in goods" @click="itemClick(item.goodsSid)"
style="display: flex;flex-direction: column;justify-content: center;width: 95%; margin-top: 15px; margin-left: 3%;">
<view style="display: flex;flex-direction: row;align-items: center;width: 100%; ">
<view style="display: flex;flex-direction: row;align-items: center;width: 100%; ">
<image :src="item.iconUrl" style="width: 90px;height: 90px; border-radius: 10px; "
mode="aspectFill"></image>
<image :src="item.iconUrl" style="width: 90px;height: 90px; border-radius: 10px; "
mode="aspectFill"></image>
<view
style="display: flex;flex-direction: column;flex: 1; padding-bottom: 15px; margin-left: 10px;"
:style="{'border-bottom':(index == goods.length-1 ? 'none' : '1px #EFEFEF solid')}">
<view
style="display: flex;flex-direction: column;flex: 1; padding-bottom: 15px; margin-left: 10px;"
:style="{'border-bottom':(index == goods.length-1 ? 'none' : '1px #EFEFEF solid')}">
<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
style="display: flex;flex-direction: row;align-items: center;margin-top: 8px;">
<text style="border: 1px #EE752F solid; border-radius: 5px; padding: 0px 8px;
<view
style="display: flex;flex-direction: row;align-items: center;margin-top: 8px;">
<text style="border: 1px #EE752F solid; border-radius: 5px; padding: 0px 8px;
font-size: 10px;color: #EE752F;">{{item.jprice}}/{{item.specificationUnit}}</text>
<text
style="border: 1px #EE752F solid; border-radius: 5px; padding: 0px 8px;
<text
style="border: 1px #EE752F solid; border-radius: 5px; padding: 0px 8px;
font-size: 10px;color: #EE752F; margin-left: 10px; margin-right: 10px; ">{{item.weight}}{{item.specificationUnit}}/{{item.unitName}}</text>
</view>
</view>
<view style="display: flex;flex-direction: row;align-items: center;justify-content: space-between; margin-top: 15px;
<view style="display: flex;flex-direction: row;align-items: center;justify-content: space-between; margin-top: 15px;
margin-right: 15px;">
<text style="font-size: 14px;color: #FF5006;">{{item.mefenPrice}}</text>
<text style="font-size: 14px;color: #FF5006;">{{item.mefenPrice}}</text>
<view style="display: flex;flex-direction: row;align-items: center;">
<view style="display: flex;flex-direction: row;align-items: center;">
<image src="../../static/jian_icon.png" mode="aspectFill"
style="width: 20px;height: 20px;" @click.stop="jian(item)"></image>
<image src="../../static/jian_icon.png" mode="aspectFill"
style="width: 20px;height: 20px;" @click.stop="jian(item)"></image>
<text
style="font-size: 14px;margin-left: 8px;margin-right: 8px;">{{item.goodsNumber}}</text>
<image src="../../static/jia_icon.png" mode="aspectFill"
style="width: 20px;height: 20px;" @click.stop="jia(item)"></image>
<text
style="font-size: 14px;margin-left: 8px;margin-right: 8px;">{{item.goodsNumber}}</text>
<image src="../../static/jia_icon.png" mode="aspectFill"
style="width: 20px;height: 20px;" @click.stop="jia(item)"></image>
</view>
</view>
</view>
</view>
@ -104,66 +108,68 @@
</view>
</view>
<view class="bottom">
<view class="bottom">
<view style="display: flex;flex-direction: row;align-items: center; padding-left: 30px;">
<view style="width: 35px;height: 35px;position: relative; visibility: hidden; ">
<view style="display: flex;flex-direction: row;align-items: center; padding-left: 30px;">
<view style="width: 35px;height: 35px;position: relative; visibility: hidden; ">
<image style="width: 25px;height: 25px;margin-left: 5px; margin-top: 5px; "
src="../../static/basket_icon.png" mode="aspectFill"></image>
<image style="width: 25px;height: 25px;margin-left: 5px; margin-top: 5px; "
src="../../static/basket_icon.png" mode="aspectFill"></image>
<view style="border-radius: 50%;text-align: center;background: #f00;color: #fff;font-size: 8px;
<view style="border-radius: 50%;text-align: center;background: #f00;color: #fff;font-size: 8px;
position: absolute;
top: 2px;
right: 0px;
padding: 2px 5px;
width: auto;">{{page.count}}</view>
</view>
<view id="bomView"
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>
<view style="color: #FF5006;font-size: 15px;height: 15px;line-height: 15px;font-weight: bold;">
{{page.weight}}
</view>
<view style="color: #888;font-size: 10px;height: 10px;line-height: 10px;margin-top: 5px;">
100-200斤有配送费200斤以上免运费</view>
<view id="bomView"
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>
<view
style="color: #FF5006;font-size: 15px;height: 15px;line-height: 15px;font-weight: bold;">
{{page.weight}}
</view>
<view style="color: #888;font-size: 10px;height: 10px;line-height: 10px;margin-top: 5px;">
100起订200斤以上免配送费</view>
</view>
</view>
</view>
<view
style="display: flex;flex-direction: row; justify-content: center;align-items: center;padding-bottom: 10px;margin-top: 5px;padding: 0px 10px;">
<view
style="display: flex;flex-direction: row; justify-content: center;align-items: center;padding-bottom: 10px;margin-top: 5px;padding: 0px 10px;">
<button open-type="share">分享新人有礼</button>
<button open-type="share">分享新人有礼</button>
<view style="border: 1px #FF5006 solid;margin-left: 5px;margin-right: 5px;padding: 0px 10px;height: 42px;flex: 1;
<view style="border: 1px #FF5006 solid;margin-left: 5px;margin-right: 5px;padding: 0px 10px;height: 42px;flex: 1;
display: flex;flex-direction: row;align-items: center;box-sizing: border-box;" @click="gotoCart()">
<image src="../../static/shoppCart_icon.png" mode="aspectFill"
style="height: 20px;width: 20px;flex-shrink: 0;">
</image>
<view style="display: flex;flex-direction: column;flex: 1;">
<text
style="font-size: 15px;color: #FF5006;margin-left: 10px;height: 20px;line-height: 20px;margin-top: 5px;font-weight: bold;">{{page.price}}</text>
<text
style="font-size: 10px;color: #666;margin-left: 10px; height: 10px;line-height: 10px;margin-bottom: 5px;">配送费{{page.reduce}}</text>
<image src="../../static/shoppCart_icon.png" mode="aspectFill"
style="height: 20px;width: 20px;flex-shrink: 0;">
</image>
<view style="display: flex;flex-direction: column;flex: 1;">
<text
style="font-size: 15px;color: #FF5006;margin-left: 10px;height: 20px;line-height: 20px;margin-top: 5px;font-weight: bold;">{{page.price}}</text>
<text
style="font-size: 10px;color: #666;margin-left: 10px; height: 10px;line-height: 10px;margin-bottom: 5px;">配送费{{page.reduce}}</text>
</view>
</view>
</view>
<text style="background: #FF9900; color: #fff;font-size: 13px; padding: 0px 15px;height: 40px;line-height: 40px;
<text style="background: #FF9900; color: #fff;font-size: 13px; padding: 0px 15px;height: 40px;line-height: 40px;
border: 1px #FF5006 solid; border-top-right-radius: 25px; border-bottom-right-radius: 25px;flex-shrink: 0;"
@click="settlement()">结算</text>
@click="settlement()">结算</text>
</view>
</view>
</view>
</loading-state>
</view>
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="base" title="订购协议" :showConfirm="true"
@ -228,6 +234,7 @@
initReduce: "0",
initWeight: "0",
shareSid: "",
baseDataSuccess: false
}
},
onShow() {
@ -237,8 +244,10 @@
})
}
this.getAllPriceOrWeight()
this.getgoods()
//
if (this.changeLoading) {
this.getgoods()
}
},
onLoad(options) {
@ -279,30 +288,34 @@
},
brandClick(val) {
this.selectIndex2 = val
this.request()
this.getgoods()
},
request() {
let _this = this
_this.$api.getGoodsTypeAndBrand(_this.brandType).then((resp) => {
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()
})
},

Loading…
Cancel
Save