17 changed files with 1624 additions and 34 deletions
@ -0,0 +1,297 @@ |
|||
<template> |
|||
<view style="height: 100vh; width: 100%; background: #F2F2F2; |
|||
display: flex;flex-direction: column;overflow: scroll;"> |
|||
<loading-state ref="pageView" @request="request"> |
|||
|
|||
<!-- <scroll-view scroll-y="true" style="min-height: calc(100% - 15vw); width: 100%; margin-top: 10px;" |
|||
bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll"> --> |
|||
|
|||
<view style="width: 100%; display: flex;flex-direction: column;"> |
|||
<view v-for="(item,index) in data" @click="itemClick(item.goodsSid)" style="display: flex;flex-direction: column;justify-content: center; margin: 10px 10px 0px 10px; |
|||
padding: 10px; border-radius: 15px; background-color: #fff; "> |
|||
|
|||
<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> |
|||
|
|||
<view style="display: flex;flex-direction: column;flex: 1; |
|||
margin-left: 10px;"> |
|||
|
|||
<text style="font-size: 13px;color: #000;">{{item.goodsName}}</text> |
|||
|
|||
<text style="font-size: 10px;color: #999;margin-top: 5px;">{{item.remarks}}</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; |
|||
font-size: 10px;color: #EE752F;">{{item.jprice}}元/{{item.specificationUnit}}</text> |
|||
<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> |
|||
<!-- <text |
|||
style="background: #FF9900; color: #fff; font-size: 10px;padding: 0px 8px; border-radius: 5px;">¥{{item.mefenPrice}}</text> --> |
|||
</view> |
|||
|
|||
<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.price}}</text> |
|||
|
|||
<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> |
|||
|
|||
<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> |
|||
|
|||
</view> |
|||
<view style="height: 150px; background: #F2F2F2;"></view> |
|||
</view> |
|||
<!-- </scroll-view> --> |
|||
|
|||
<view style="height: 15vw; width: 100%; display: flex;flex-direction: column;position: fixed;bottom: 0;overflow:hidden; |
|||
justify-content: center;align-items: center; background: #fff;padding-top: 10px;"> |
|||
|
|||
<view style="display: flex;flex-direction: row;align-items: center;"> |
|||
<view style="color: #888;font-size: 10px;">温馨提示:已定制了</view> |
|||
<view style="color: #FF5006;font-size: 15px;">{{page.weight}}斤</view> |
|||
<view style="color: #888;font-size: 10px;">,满200斤可定制云菜窖</view> |
|||
</view> |
|||
|
|||
<view |
|||
style="display: flex;flex-direction: row; justify-content: center;align-items: center;padding-bottom: 10px;margin-top: 5px;"> |
|||
|
|||
|
|||
<view |
|||
style="border: 1px #FF5006 solid;margin-left: 5px;margin-right: 5px;padding: 5px 40px 5px 15px; |
|||
display: flex;flex-direction: row;align-items: center;border-top-left-radius: 25px; border-bottom-left-radius: 25px;" |
|||
@click="gotoCart()"> |
|||
<image src="../../static/shoppCart_icon.png" mode="aspectFill" |
|||
style="height: 20px;width: 25px;"> |
|||
</image> |
|||
<text style="font-size: 15px;color: #FF5006;margin-left: 10px; ">¥{{page.price}}</text> |
|||
<text style="font-size: 10px;color: #666;margin-left: 10px; ">共减:¥{{page.reduce}}</text> |
|||
</view> |
|||
<text style="background: #FF9900; color: #fff;font-size: 13px; padding: 8px 15px; |
|||
border: 1px #FF5006 solid; border-top-right-radius: 25px; border-bottom-right-radius: 25px;" |
|||
@click="settlement()">结算</text> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
</loading-state> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
page: { |
|||
affiliation: '', |
|||
weight: "0", |
|||
price: "0", |
|||
reduce: "0" |
|||
}, |
|||
data: [ |
|||
|
|||
] |
|||
} |
|||
}, |
|||
onLoad(options) { |
|||
this.page.affiliation = options.affiliation |
|||
console.log(" options", options); |
|||
this.request() |
|||
}, |
|||
methods: { |
|||
request() { |
|||
let _this = this |
|||
|
|||
var params = { |
|||
customerSid: getApp().globalData.sid, |
|||
affiliation: _this.page.affiliation |
|||
} |
|||
|
|||
_this.$api.shoppingCartList(params).then((resp) => { |
|||
console.log("resp", resp); |
|||
_this.data = resp |
|||
|
|||
_this.getallPrice() |
|||
_this.getweight() |
|||
|
|||
_this.$nextTick(() => { |
|||
_this.$refs.pageView.setLoadState(2) |
|||
}) |
|||
// 无数据 |
|||
if (_this.data.length == 0) { |
|||
_this.$nextTick(() => { |
|||
_this.$refs.pageView.setLoadState(100) |
|||
}) |
|||
} |
|||
|
|||
}).catch(e => { |
|||
// 错误 1 |
|||
_this.$nextTick(() => { |
|||
_this.$refs.pageView.setLoadState(1) |
|||
}) |
|||
}) |
|||
}, |
|||
itemClick(goodsSid) { |
|||
uni.navigateTo({ |
|||
url: '/pages/good/goodsDetail?sid=' + goodsSid |
|||
}) |
|||
}, |
|||
|
|||
jian(item) { |
|||
const that = this |
|||
console.log("item》》》》", item) |
|||
if (Number(item.goodsNumber) == 1) { |
|||
|
|||
wx.showModal({ |
|||
content: '确定不要了吗', |
|||
cancelText: "再想想", |
|||
confirmText: "删除", |
|||
confirmColor: "#FF9900", |
|||
success(res) { |
|||
if (res.confirm) { |
|||
console.log('用户点击确定') |
|||
item.goodsNumber = 0 |
|||
const index = that.data.findIndex((info) => info.goodsSid === item.goodsSid) |
|||
console.log("index》》》》", index) |
|||
that.data.splice(index, 1) |
|||
that.getallPrice() |
|||
that.getweight() |
|||
that.upDateShoppCart(item) |
|||
} else if (res.cancel) { |
|||
|
|||
} |
|||
} |
|||
}) |
|||
|
|||
} else { |
|||
if (Number(item.goodsNumber) > 0) { |
|||
item.goodsNumber = Number(item.goodsNumber) - 1 |
|||
} |
|||
|
|||
item.totalPrice = Number(item.goodsNumber) * Number(item.price) |
|||
that.getallPrice() |
|||
that.getweight() |
|||
that.upDateShoppCart(item) |
|||
} |
|||
|
|||
}, |
|||
jia(item) { |
|||
|
|||
item.goodsNumber = Number(item.goodsNumber) + 1 |
|||
item.totalPrice = Number(item.goodsNumber) * Number(item.price) |
|||
|
|||
this.getallPrice() |
|||
this.getweight() |
|||
this.upDateShoppCart(item) |
|||
|
|||
}, |
|||
|
|||
getallPrice() { |
|||
|
|||
let num = 0; |
|||
for (var i = 0; i < this.data.length; i++) { |
|||
num += Number(this.data[i].totalPrice); |
|||
} |
|||
|
|||
this.page.price = num |
|||
}, |
|||
|
|||
getweight() { |
|||
|
|||
let num = 0; |
|||
for (var i = 0; i < this.data.length; i++) { |
|||
num += Number(this.data[i].weight) * Number(this.data[i].goodsNumber); |
|||
|
|||
} |
|||
|
|||
this.page.weight = num |
|||
|
|||
}, |
|||
|
|||
upDateShoppCart(item) { |
|||
var good = { |
|||
goodsSid: item.goodsSid, |
|||
goodsName: item.goodsName, |
|||
goodsNumber: item.goodsNumber, |
|||
affiliation: this.page.affiliation, |
|||
price: item.price, |
|||
weight: item.weight, |
|||
customerSid: getApp().globalData.sid |
|||
} |
|||
|
|||
let _this = this |
|||
_this.$api.addShoppingCart(good).then((resp) => { |
|||
|
|||
}).catch(e => {}) |
|||
}, |
|||
|
|||
settlement() { |
|||
// 支付 |
|||
|
|||
if (this.page.weight < 200) { |
|||
this.shortToast('满200斤才可定制云菜窖哦,请继续选菜吧。') |
|||
return |
|||
} |
|||
|
|||
|
|||
let list = [] |
|||
|
|||
for (var i = 0; i < this.goods.length; i++) { |
|||
var item = this.data[i] |
|||
if (item.goodsNumber > 0) |
|||
list.push({ |
|||
goodsSid: item.goodsSid, |
|||
goodsName: item.name, |
|||
partNumber: item.goodsNumber, |
|||
numofPart: item.weight, |
|||
priceUnit: item.jprice, |
|||
pricePart: item.mefenPrice, |
|||
}) |
|||
} |
|||
// console.log("ddd", list); |
|||
|
|||
if (list.length == 0) { |
|||
this.shortToast('请添加商品') |
|||
return |
|||
} |
|||
|
|||
var params = { |
|||
customerSid: getApp().globalData.sid, |
|||
cardNumber: 1, |
|||
totalTee: this.page.price, |
|||
ordOrderDetailsVoList: list |
|||
} |
|||
// console.log("params", params); |
|||
|
|||
let _this = this |
|||
_this.$api.createOrder(params).then((resp) => { |
|||
|
|||
// console.log("resp", resp); |
|||
this.$pay(resp) |
|||
}).catch(e => {}) |
|||
|
|||
}, |
|||
|
|||
|
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
|
|||
</style> |
@ -0,0 +1,637 @@ |
|||
<template> |
|||
|
|||
<view |
|||
style="display: flex;flex-direction: column;height: 100vh;background: -webkit-linear-gradient(left,#FEA65F,#FB9440);"> |
|||
|
|||
<view class="top"> |
|||
<NavBar ref="nav" navTitle=" " :showIcon="false" :start-change-height="page.startHeight" |
|||
:end-change-height="page.endHeight"> |
|||
</NavBar> |
|||
|
|||
<view style="display: flex;flex-direction: row;align-items: center;justify-content: center;; |
|||
padding-left: 10vw;padding-right: 10vw; margin-top: 40vw;"> |
|||
|
|||
<view style="display: flex;flex-direction: column; flex: 1;justify-content: center;align-items: center;" |
|||
@click.stop="brandClick('0')"> |
|||
|
|||
<image src="https://supervise.yxtsoft.com/lpk/image/family_icon.png" mode="aspectFill" |
|||
:class="brandType=='0'?'top_img1':'top_img2'" |
|||
style="width: 60px;height:60px;border-radius: 50%;padding:5px;"></image> |
|||
|
|||
<text :class="brandType=='0'?'top_text1':'top_text2'">百姓菜窖</text> |
|||
|
|||
</view> |
|||
|
|||
<view style="display: flex;flex-direction: column;flex: 1;justify-content: center;align-items: center;" |
|||
@click.stop="brandClick('1')"> |
|||
|
|||
<image src="https://supervise.yxtsoft.com/lpk/image/love_icon.png" mode="aspectFill" |
|||
:class="brandType=='1'?'top_img1':'top_img2'" |
|||
style="width: 60px;height: 60px;border-radius: 50%;padding: 5px;"></image> |
|||
|
|||
<text :class="brandType=='1'?'top_text1':'top_text2'">精品菜窖</text> |
|||
|
|||
</view> |
|||
|
|||
<view style="display: flex;flex-direction: column;flex: 1;justify-content: center;align-items: center;" |
|||
@click.stop="brandClick('2')"> |
|||
|
|||
<image src="https://supervise.yxtsoft.com/lpk/image/enterprise_icon.png" mode="aspectFill" |
|||
:class="brandType=='2'?'top_img1':'top_img2'" |
|||
style="width: 60px;height: 60px;border-radius: 50%;padding: 5px;"></image> |
|||
|
|||
<text :class="brandType=='2'?'top_text1':'top_text2'">企业菜窖</text> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
|
|||
<view style="background: #fff;flex-flow: 1; height: calc(100vh - 65vw - 50px); |
|||
width: 100%; margin-top: -13vw; |
|||
border-radius: 25px;display: flex;flex-direction: column; box-sizing: border-box;"> |
|||
|
|||
<view style="display: flex;flex-direction: row;height: 25px; width: 100%; flex-shrink: 0;"> |
|||
|
|||
<view style="width: 20%;background: #F7F7F7;border-top-left-radius: 25px;"></view> |
|||
<view style="width: 80%;background: #fff; border-top-right-radius: 25px;"></view> |
|||
</view> |
|||
|
|||
<view style="display: flex;flex-direction: row;min-height: calc(100% - 115px); "> |
|||
<scroll-view scroll-y="true" style="height: 100%; width: 21%;border-bottom-left-radius: 25px;" |
|||
:scroll-top="scrollLeftTop" bindscrolltoupper="upper" bindscrolltolower="lower" |
|||
:show-scrollbar="false" :enhanced="true" bindscroll="scroll"> |
|||
|
|||
<view |
|||
style="width: 100%;; display: flex;flex-direction: column; background: #F7F7F7;border-bottom-left-radius: 25px;"> |
|||
<view v-for="(item,index) in data" @click="labelClick(index,item)" |
|||
style="display: flex;flex-direction: column;justify-content: center; margin-top: 15px; "> |
|||
<text class="label" :class="{ label2: selectIndex==index }">{{item.name}}</text> |
|||
</view> |
|||
|
|||
</view> |
|||
</scroll-view> |
|||
|
|||
<view |
|||
style="width: 80%;min-height: calc(100% - 115px); display: flex;flex-direction: column; margin-left: 10px; margin-right: 10px;"> |
|||
|
|||
<view style=" border: 1px #bbb solid; border-radius: 8px;display: flex;flex-direction: row;align-items: center; |
|||
padding-left: 10px; margin-left: 20px;margin-right: 20px;"> |
|||
<image src="../../static/search_icon.png" mode="aspectFill" style="width: 25px;height: 25px;"> |
|||
</image> |
|||
<input placeholder="请输入" |
|||
style="font-size: 25rpx;flex: 1;height: 35px;line-height: 35px;padding-left: 10px;padding-right: 10px;" |
|||
:value="searchInfo.name" @input="onKeyInput" /> |
|||
</view> |
|||
|
|||
<scroll-view scroll-y="true" style="min-height: calc(100% - 150px); width: 100%; margin-top: 10px;" |
|||
bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" :show-scrollbar="false" |
|||
:scroll-top="scrollRightTop" :enhanced="true"> |
|||
|
|||
<view style="width: 100%; display: flex;flex-direction: column;"> |
|||
<view v-for="(item,index) in goods" @click="itemClick(item.goodsSid)" |
|||
style="display: flex;flex-direction: column;justify-content: center;width: 100%; margin-top: 15px; "> |
|||
|
|||
<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> |
|||
|
|||
<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: 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; |
|||
font-size: 10px;color: #EE752F;">{{item.jprice}}元/{{item.specificationUnit}}</text> |
|||
<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> |
|||
<!-- <text |
|||
style="background: #FF9900; color: #fff; font-size: 10px;padding: 0px 8px; border-radius: 5px;">¥{{item.mefenPrice}}</text> --> |
|||
</view> |
|||
|
|||
<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> |
|||
<!-- |
|||
<image src="../../static/inCart.png" mode="aspectFill" |
|||
style="width: 25px;height: 25px;" @click.stop="itemShow(item)" |
|||
v-if="!item.showCart"></image> --> |
|||
|
|||
<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> |
|||
|
|||
<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="margin-left: 10px;color: #fff; font-size: 12px; border: 1px #EE752F solid; border-radius: 5px; padding: 0px 5px; background: #FF9900;" |
|||
@click.stop="itemShow2(item)">确定</text> --> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
</scroll-view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
<view style="display: flex;flex-direction: column;border-top: 1px solid #F8F8F8; border-bottom-left-radius: 25px;border-bottom-right-radius: 25px; |
|||
padding-top: 5px; flex-shrink: 0;"> |
|||
|
|||
<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> |
|||
|
|||
<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;">温馨提示:已定制了</view> |
|||
<view style="color: #FF5006;font-size: 15px;">{{page.weight}}斤</view> |
|||
<!-- <view style="color: #FF5006;font-size: 15px;" v-if="brandType=='1'">{{page.weight2}}斤</view> --> |
|||
<!-- <view style="color: #FF5006;font-size: 15px;" v-if="brandType=='2'">{{page.weight3}}斤</view> --> |
|||
<view style="color: #888;font-size: 10px;">,满200斤可定制云菜窖</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<view |
|||
style="display: flex;flex-direction: row; justify-content: center;align-items: center;padding-bottom: 10px;margin-top: 5px;"> |
|||
|
|||
<text style="background: #FF9900; color: #fff;font-size: 13px; padding: 8px 15px; |
|||
border: 1px #FF5006 solid; border-top-left-radius: 25px; border-bottom-left-radius: 25px;">分享新人有礼</text> |
|||
|
|||
<view style="border: 1px #FF5006 solid;margin-left: 5px;margin-right: 5px;padding: 5px 10px; |
|||
display: flex;flex-direction: row;align-items: center;" @click="gotoCart()"> |
|||
<image src="../../static/shoppCart_icon.png" mode="aspectFill" |
|||
style="height: 20px;width: 25px;"></image> |
|||
<text style="font-size: 15px;color: #FF5006;margin-left: 10px; ">¥{{page.price}}</text> |
|||
<text style="font-size: 10px;color: #666;margin-left: 10px; ">共减:¥{{page.reduce}}</text> |
|||
</view> |
|||
<!-- <view style="border: 1px #FF5006 solid;margin-left: 5px;margin-right: 5px;padding: 5px 10px; |
|||
display: flex;flex-direction: row;align-items: center;" v-if="brandType=='1'"> |
|||
<image src="../../static/shoppCart_icon.png" mode="aspectFill" |
|||
style="height: 20px;width: 25px;"></image> |
|||
<text style="font-size: 15px;color: #FF5006;margin-left: 10px; ">¥{{page.price2}}</text> |
|||
<text style="font-size: 10px;color: #666;margin-left: 10px; ">共减:¥{{page.reduce2}}</text> |
|||
</view> |
|||
<view style="border: 1px #FF5006 solid;margin-left: 5px;margin-right: 5px;padding: 5px 10px; |
|||
display: flex;flex-direction: row;align-items: center;" v-if="brandType=='2'"> |
|||
<image src="../../static/shoppCart_icon.png" mode="aspectFill" |
|||
style="height: 20px;width: 25px;"></image> |
|||
<text style="font-size: 15px;color: #FF5006;margin-left: 10px; ">¥{{page.price3}}</text> |
|||
<text style="font-size: 10px;color: #666;margin-left: 10px; ">共减:¥{{page.reduce3}}</text> |
|||
</view> --> |
|||
<text style="background: #FF9900; color: #fff;font-size: 13px; padding: 8px 15px; |
|||
border: 1px #FF5006 solid; border-top-right-radius: 25px; border-bottom-right-radius: 25px;" |
|||
@click="settlement()">结算</text> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
scrollHeight: "", |
|||
scrollLeftTop: "0", |
|||
scrollRightTop: "0", |
|||
searchInfo: { |
|||
sid: "0", |
|||
name: "", |
|||
affiliation: "", |
|||
customerSid: "" |
|||
}, |
|||
brandType: "0", |
|||
styleObject: { |
|||
// 'position': 'fixed', |
|||
// 'top':'80vw', |
|||
'margin-top': '62vw', |
|||
'border-top-left-radius': '25px', |
|||
'border-top-right-radius': '25px', |
|||
'border-bottom-left-radius': '25px', |
|||
'border-bottom-right-radius': '25px', |
|||
'background': '#fff', |
|||
'padding-top': '10px', |
|||
'margin-bottom': "60px" |
|||
|
|||
}, |
|||
page: { |
|||
price: '0', |
|||
reduce: "0", |
|||
weight: "0", |
|||
// price2: '0', |
|||
// reduce2: "0", |
|||
// weight2: "0", |
|||
// price3: '0', |
|||
// reduce3: "0", |
|||
// weight3: "0", |
|||
count: "0", |
|||
startHeight: 0, |
|||
endHeight: 0 |
|||
}, |
|||
data: [], |
|||
goods: [], |
|||
selectIndex: 0, |
|||
initPrice: '0', |
|||
initReduce: "0", |
|||
initWeight: "0", |
|||
|
|||
} |
|||
}, |
|||
onShow() { |
|||
if (typeof this.$mp.page.getTabBar === 'function' && this.$mp.page.getTabBar()) { |
|||
this.$mp.page.getTabBar().setData({ |
|||
selected: 0 |
|||
}) |
|||
|
|||
} |
|||
this.getAllPriceOrWeight() |
|||
this.getgoods() |
|||
}, |
|||
|
|||
onLoad() { |
|||
|
|||
let info = uni.getSystemInfoSync(); |
|||
|
|||
this.page.startHeight = info.windowWidth * 0.6 |
|||
this.page.endHeight = info.windowWidth * 0.8 |
|||
|
|||
this.request() |
|||
|
|||
// this.getallPrice() |
|||
// this.getweight() |
|||
// this.getcount() |
|||
|
|||
}, |
|||
methods: { |
|||
// searchBtn() { |
|||
// this.setData({ |
|||
// scrollLeftTop: 0, |
|||
// scrollRightTop:0 |
|||
// }) |
|||
// // this.scrollLeftTop =1 //可以在每次搜索的时候先初始一下 |
|||
// // this.scrollRightTop = 1 //然后每次加0.01 别问为啥要加0.01 反正直接给0就是没效果 无解 也可能是本人代码有误 但是亲测有效 |
|||
// }, |
|||
labelClick(index, item) { |
|||
this.selectIndex = index |
|||
|
|||
this.searchInfo.sid = item.sid |
|||
this.getgoods() |
|||
|
|||
}, |
|||
onKeyInput(event) { |
|||
this.searchInfo.name = event.target.value |
|||
this.getgoods() |
|||
}, |
|||
|
|||
brandClick(val) { |
|||
|
|||
this.brandType = val |
|||
this.request() |
|||
|
|||
}, |
|||
request() { |
|||
let _this = this |
|||
_this.$api.getAllGoodsType(_this.brandType).then((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 => {}) |
|||
}, |
|||
getAllPriceOrWeight() { |
|||
let _this = this |
|||
|
|||
var params = { |
|||
customerSid: getApp().globalData.sid, |
|||
affiliation: this.brandType, |
|||
} |
|||
|
|||
_this.$api.getGoodsWeight(params).then((resp) => { |
|||
console.log("getGoodsWeight", resp); |
|||
|
|||
_this.page.price = resp.totalPrice |
|||
_this.page.weight = resp.totalWeight |
|||
|
|||
_this.initPrice = resp.totalPrice |
|||
_this.initWeight = resp.totalWeight |
|||
|
|||
}).catch(e => {}) |
|||
}, |
|||
getgoods() { |
|||
let _this = this |
|||
|
|||
_this.searchInfo.customerSid = getApp().globalData.sid |
|||
_this.searchInfo.affiliation = this.brandType |
|||
|
|||
_this.$api.getGoodsByType(_this.searchInfo).then((resp) => { |
|||
_this.goods = resp |
|||
}).catch(e => {}) |
|||
}, |
|||
itemShow(item) { |
|||
item.showCart = true |
|||
console.log("item", item.showCart); |
|||
}, |
|||
itemShow2(item) { |
|||
|
|||
|
|||
if (item.goodsNumber == 0) { |
|||
this.shortToast('请添加商品。') |
|||
return |
|||
} |
|||
|
|||
var good = { |
|||
goodsSid: item.goodsSid, |
|||
goodsName: item.name, |
|||
goodsNumber: item.goodsNumber, |
|||
affiliation: this.brandType, |
|||
price: item.mefenPrice, |
|||
weight: item.weight, |
|||
customerSid: getApp().globalData.sid |
|||
} |
|||
console.log("itemShow2", good); |
|||
|
|||
let _this = this |
|||
_this.$api.addShoppingCart(good).then((resp) => { |
|||
item.showCart = false |
|||
console.log("item2", item.showCart); |
|||
}).catch(e => {}) |
|||
}, |
|||
jian(item) { |
|||
const that = this |
|||
console.log("item》》》》", item) |
|||
if (Number(item.goodsNumber) == 1) { |
|||
|
|||
wx.showModal({ |
|||
content: '确定不要了吗', |
|||
cancelText: "再想想", |
|||
confirmText: "删除", |
|||
confirmColor: "#FF9900", |
|||
success(res) { |
|||
if (res.confirm) { |
|||
console.log('用户点击确定') |
|||
item.goodsNumber = 0 |
|||
item.subtotal = 0 |
|||
that.getallPrice() |
|||
that.getweight() |
|||
that.upDateShoppCart(item) |
|||
} else if (res.cancel) { |
|||
|
|||
} |
|||
} |
|||
}) |
|||
|
|||
} else { |
|||
if (Number(item.goodsNumber) > 0) { |
|||
item.goodsNumber = Number(item.goodsNumber) - 1 |
|||
} |
|||
|
|||
item.subtotal = Number(item.goodsNumber) * Number(item.mefenPrice) |
|||
that.getallPrice() |
|||
that.getweight() |
|||
that.upDateShoppCart(item) |
|||
} |
|||
}, |
|||
jia(item) { |
|||
|
|||
item.goodsNumber = Number(item.goodsNumber) + 1 |
|||
item.subtotal = Number(item.goodsNumber) * Number(item.mefenPrice) |
|||
|
|||
this.getallPrice() |
|||
this.getweight() |
|||
this.upDateShoppCart(item) |
|||
}, |
|||
|
|||
getallPrice() { |
|||
|
|||
let num = 0; |
|||
for (var i = 0; i < this.goods.length; i++) { |
|||
num += Number(this.goods[i].subtotal); |
|||
} |
|||
|
|||
this.page.price = num |
|||
// if (this.brandType == '0') |
|||
// this.page.price1 = num |
|||
|
|||
// if (this.brandType == '1') |
|||
// this.page.price2 = num |
|||
|
|||
// if (this.brandType == '2') |
|||
// this.page.price3 = num |
|||
}, |
|||
|
|||
getweight() { |
|||
|
|||
let num = 0; |
|||
for (var i = 0; i < this.goods.length; i++) { |
|||
num += Number(this.goods[i].weight) * Number(this.goods[i].goodsNumber); |
|||
|
|||
} |
|||
|
|||
this.page.weight = num |
|||
|
|||
// if (this.brandType == '0') |
|||
// this.page.weight1 = num |
|||
|
|||
// if (this.brandType == '1') |
|||
// this.page.weight2 = num |
|||
|
|||
// if (this.brandType == '2') |
|||
// this.page.weight3 = num |
|||
}, |
|||
|
|||
// getcount() { |
|||
|
|||
// let num = 0; |
|||
// for (var i = 0; i < this.goods.length; i++) { |
|||
// num += Number(this.goods[i].goodsNumber); |
|||
// } |
|||
|
|||
// this.page.goodsNumber = num |
|||
// }, |
|||
|
|||
upDateShoppCart(item) { |
|||
var good = { |
|||
goodsSid: item.goodsSid, |
|||
goodsName: item.name, |
|||
goodsNumber: item.goodsNumber, |
|||
affiliation: this.brandType, |
|||
price: item.mefenPrice, |
|||
weight: item.weight, |
|||
customerSid: getApp().globalData.sid |
|||
} |
|||
|
|||
let _this = this |
|||
_this.$api.addShoppingCart(good).then((resp) => { |
|||
|
|||
}).catch(e => {}) |
|||
}, |
|||
|
|||
|
|||
detail(item) { |
|||
// 详情 |
|||
uni.navigateTo({ |
|||
url: '/pages/cloud/detail_cloudCard?sid=' + item.sid + "&name=" + item.name |
|||
}) |
|||
}, |
|||
settlement() { |
|||
// 支付 |
|||
|
|||
// if (this.page.weight < 200) { |
|||
// this.shortToast('满200斤才可定制云菜窖哦,请继续选菜吧。') |
|||
// return |
|||
// } |
|||
|
|||
|
|||
let list = [] |
|||
|
|||
for (var i = 0; i < this.goods.length; i++) { |
|||
var item = this.goods[i] |
|||
if (item.goodsNumber > 0) |
|||
list.push({ |
|||
goodsSid: item.goodsSid, |
|||
goodsName: item.name, |
|||
partNumber: item.goodsNumber, |
|||
numofPart: item.weight, |
|||
priceUnit: item.jprice, // 斤单价 |
|||
pricePart: item.mefenPrice, // 份单价 |
|||
}) |
|||
} |
|||
// console.log("ddd", list); |
|||
|
|||
if (list.length == 0) { |
|||
this.shortToast('请添加商品') |
|||
return |
|||
} |
|||
|
|||
var params = { |
|||
customerSid: getApp().globalData.sid, |
|||
cardNumber: 1, |
|||
totalTee: this.page.price, |
|||
ordOrderDetailsVoList: list |
|||
} |
|||
// console.log("params", params); |
|||
|
|||
let _this = this |
|||
_this.$api.createOrder(params).then((resp) => { |
|||
|
|||
// console.log("resp", resp); |
|||
this.$pay(resp) |
|||
}).catch(e => {}) |
|||
|
|||
}, |
|||
itemClick(goodsSid) { |
|||
uni.navigateTo({ |
|||
url: '/pages/good/goodsDetail?sid=' + goodsSid |
|||
}) |
|||
}, |
|||
gotoCart() { |
|||
uni.navigateTo({ |
|||
url: '/pages/good/shoppCart?affiliation=' + this.brandType |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
.top { |
|||
width: 100vw; |
|||
/* height: 126.66vw; */ |
|||
height: 75vw; |
|||
/* 加载背景图 */ |
|||
background-image: url(https://supervise.yxtsoft.com/lpk/image/clound_bj1.png); |
|||
/* background-image: url(../../static/clound_bj1.png); */ |
|||
/* 让背景图基于容器大小伸缩 */ |
|||
background-size: 100% 100%; |
|||
} |
|||
|
|||
.label { |
|||
background: #fff; |
|||
color: #FF9900; |
|||
font-size: 13px; |
|||
padding-top: 15px; |
|||
padding-bottom: 15px; |
|||
text-align: center; |
|||
} |
|||
|
|||
.label2 { |
|||
|
|||
background: #FF9900; |
|||
color: #fff; |
|||
font-size: 13px; |
|||
padding-top: 15px; |
|||
padding-bottom: 15px; |
|||
text-align: center; |
|||
} |
|||
|
|||
.top_img1 { |
|||
border: 1px #FF9900 solid; |
|||
} |
|||
|
|||
.top_img2 { |
|||
border: none |
|||
} |
|||
|
|||
.top_text1 { |
|||
border: 1px #FF9900 solid; |
|||
background: #FF5006; |
|||
color: #fff; |
|||
font-weight: 800; |
|||
font-family: sans-serif; |
|||
padding: 2px 5px; |
|||
border-radius: 5px; |
|||
margin-top: -25px; |
|||
} |
|||
|
|||
.top_text2 { |
|||
border: 1px #FF9900 solid; |
|||
background: #fff; |
|||
color: #F6894B; |
|||
font-weight: 800; |
|||
font-family: sans-serif; |
|||
padding: 2px 5px; |
|||
border-radius: 5px; |
|||
margin-top: -25px; |
|||
} |
|||
</style> |
@ -0,0 +1,584 @@ |
|||
<template> |
|||
|
|||
<view |
|||
style="display: flex;flex-direction: column;height: 100vh;background: -webkit-linear-gradient(left,#FEA65F,#FB9440);"> |
|||
|
|||
<view class="top"> |
|||
<NavBar ref="nav" navTitle=" " :showIcon="false" :start-change-height="page.startHeight" |
|||
:end-change-height="page.endHeight"> |
|||
</NavBar> |
|||
|
|||
</view> |
|||
|
|||
|
|||
<view style="background: #fff;flex-flow: 1; height: calc(100vh - 65vw - 50px); |
|||
width: 100%; margin-top: -13vw; |
|||
border-radius: 25px;display: flex;flex-direction: column; box-sizing: border-box;"> |
|||
|
|||
<view style="display: flex;flex-direction: row;height: 25px; width: 100%; flex-shrink: 0;"> |
|||
|
|||
<view style="width: 20%;background: #F7F7F7;border-top-left-radius: 25px;"></view> |
|||
<view style="width: 80%;background: #fff; border-top-right-radius: 25px;"></view> |
|||
</view> |
|||
|
|||
<view style="display: flex;flex-direction: row;min-height: calc(100% - 80px); "> |
|||
|
|||
<view style="display: flex;flex-direction: column;width: 21%;background: #F7F7F7; "> |
|||
<text style="font-weight: 600;font-family: sans-serif; |
|||
color: #333; |
|||
font-size: 15px; |
|||
padding-top: 15px; |
|||
padding-bottom: 15px; |
|||
margin-top: -20px; |
|||
text-align: center;">菜窖分类</text> |
|||
|
|||
|
|||
<scroll-view scroll-y="true" style="height: 100%; width: 100%;border-bottom-left-radius: 25px;" |
|||
:scroll-top="scrollLeftTop" bindscrolltoupper="upper" bindscrolltolower="lower" |
|||
:show-scrollbar="false" :enhanced="true" bindscroll="scroll"> |
|||
|
|||
|
|||
<view |
|||
style="width: 100%;height: 100%;; display: flex;flex-direction: column; background: #F7F7F7;border-bottom-left-radius: 25px;"> |
|||
<view v-for="(item,index) in data" @click="labelClick(index,item)" |
|||
style="display: flex;flex-direction: column;justify-content: center; margin-bottom: 15px; position: relative;"> |
|||
|
|||
<text class="label" :class="{ label2: selectIndex==index }">{{item.name}}</text> |
|||
|
|||
<view v-if="item.count>0" style="border-radius: 50%;text-align: center;background: #f00;color: #fff;font-size: 8px; |
|||
position: absolute; |
|||
top: 8px; |
|||
right: 3px; |
|||
padding: 2px 5px; |
|||
width: auto;">{{item.count}}</view> |
|||
</view> |
|||
|
|||
</view> |
|||
</scroll-view> |
|||
</view> |
|||
<view style="width: 80%;min-height: calc(100% - 80px); display: flex;flex-direction: column; |
|||
margin-left: 10px; margin-right: 10px; margin-top: -10px; "> |
|||
|
|||
<scroll-view scroll-y="true" style="height: 100%; width: 100%;" bindscrolltoupper="upper" |
|||
bindscrolltolower="lower" bindscroll="scroll" :show-scrollbar="false" |
|||
:scroll-top="scrollRightTop" :enhanced="true"> |
|||
|
|||
<view style="width: 100%; display: flex;flex-direction: column;"> |
|||
<view v-for="(item,index) in goods" @click="itemClick(item.goodsSid)" |
|||
style="display: flex;flex-direction: column;justify-content: center;width: 100%; margin-top: 15px; "> |
|||
|
|||
<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> |
|||
|
|||
<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: 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; |
|||
font-size: 10px;color: #EE752F; margin-right: 10px; ">{{item.weight}}{{item.specificationUnit}}/{{item.unitName}}</text> |
|||
|
|||
<text |
|||
style="border: 1px #EE752F solid; background: #FF9900; color: #fff; font-size: 10px;border-radius: 5px; padding: 0px 8px;" |
|||
v-if="item.type=='0'">百姓菜!</text> |
|||
<text |
|||
style="border: 1px #3AA15F solid; background: #40C772; color: #fff; font-size: 10px;border-radius: 5px; padding: 0px 8px;" |
|||
v-if="item.type=='1'">精品菜!</text> |
|||
<text |
|||
style="border: 1px #1D60C7 solid; background: #2489F7; color: #fff; font-size: 10px;border-radius: 5px; padding: 0px 8px;" |
|||
v-if="item.type=='2'">企业菜!</text> |
|||
|
|||
</view> |
|||
|
|||
<view style="display: flex;flex-direction: row;align-items: center;justify-content: space-between; margin-top: 15px; |
|||
margin-right: 15px;"> |
|||
|
|||
|
|||
<view style="display: flex;flex-direction: row;align-items: center;"> |
|||
<text style="font-size: 12px;color: #666;">存量:</text> |
|||
<text |
|||
style="font-size: 14px;color: #FF5006;">{{item.goodsNumber}}{{item.unitName}}</text> |
|||
</view> |
|||
|
|||
|
|||
|
|||
<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> |
|||
|
|||
<text |
|||
style="font-size: 14px;margin-left: 8px;margin-right: 8px;">{{item.count}}</text> |
|||
<image src="../../static/jia_icon.png" mode="aspectFill" |
|||
style="width: 20px;height: 20px;" @click.stop="jia(item)"></image> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
<view v-if="notData" |
|||
style="display: flex;flex-direction: column;justify-content: center;align-items: center;"> |
|||
|
|||
<image src="https://supervise.yxtsoft.com/lpk/image/buchongcaijiao.png" |
|||
mode="aspectFit" style="width: 15vm;height: 15vm;"></image> |
|||
<view style="display: flex;flex-direction: row;align-items: center;margin-top: 15px;"> |
|||
<text style="font-size: 14px; color: #666;margin-right: 5px;">您的菜窖为空,请</text> |
|||
<text |
|||
style="background: #FF9900; border-radius: 8px; padding: 3px 8px; color: #fff;" |
|||
@click="gotoShopp()">补充菜窖</text> |
|||
</view> |
|||
</view> |
|||
|
|||
</view> |
|||
</scroll-view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
<view style="display: flex;flex-direction: column;border-top: 1px solid #F8F8F8; border-bottom-left-radius: 25px;border-bottom-right-radius: 25px; |
|||
padding-top: 5px; flex-shrink: 0; "> |
|||
|
|||
<view |
|||
style="display: flex;flex-direction: row; justify-content: center;align-items: center;padding-bottom: 10px;margin-top: 5px;"> |
|||
|
|||
<text style="background: #FF9900; color: #fff;font-size: 13px; padding: 8px 15px; |
|||
border: 1px #FF5006 solid; border-top-left-radius: 25px; border-bottom-left-radius: 25px;">转赠亲友</text> |
|||
|
|||
<view style="border: 1px #FF5006 solid;margin-left: 5px;margin-right: 5px;padding: 5px 10px; |
|||
display: flex;flex-direction: row;align-items: center;" @click="gotoCart()"> |
|||
<image src="../../static/shoppCart_icon.png" mode="aspectFill" |
|||
style="height: 20px;width: 25px;"></image> |
|||
<text style="font-size: 12px;color: #666;margin-left: 10px; ">共选</text> |
|||
<text style="font-size: 15px;color: #FF5006;margin-left: 10px; ">{{page.count}}</text> |
|||
<text style="font-size: 12px;color: #666;margin-left: 10px; ">份蔬菜</text> |
|||
</view> |
|||
<text style="background: #FF9900; color: #fff;font-size: 13px; padding: 8px 15px; |
|||
border: 1px #FF5006 solid; border-top-right-radius: 25px; border-bottom-right-radius: 25px;" |
|||
@click="reservation()">预约提菜</text> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
|
|||
|
|||
<!-- 弹窗蒙版 --> |
|||
<view class="model" catchtouchmove='preventTouchMove' v-if='showModal' @click.stop="colseDialog()"></view> |
|||
<view class="modalDlg" catchtouchmove='preventTouchMove' v-if='showModal'> |
|||
|
|||
<scroll-view scroll-y="true" style="min-height: calc(100% - 50px);; padding-top: 10px;" |
|||
bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll"> |
|||
|
|||
<view style="display: flex;flex-direction: column; margin: 20px;padding-top: 10px;"> |
|||
|
|||
<view |
|||
style="display: flex;flex-direction: row;align-items: center;justify-content: space-between;"> |
|||
|
|||
<text |
|||
style="font-size: 16px; color: #333; font-weight: 600; font-family: sans-serif;">提菜点信息</text> |
|||
|
|||
<view style="display: flex;flex-direction: row;align-items: center;"> |
|||
<text v-if="pickingUp.name==''" |
|||
style="font-size: 14px;color: #666;margin-right: 10px;">{{pickingUp.type}}</text> |
|||
<text v-if="pickingUp.name!=''" |
|||
style="font-size: 16px;color: #333;margin-right: 10px;">{{pickingUp.name}}</text> |
|||
<image src="../../static/right_icon.png" mode="aspectFill" |
|||
style="width: 20px;height: 20px;"></image> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
<view v-if="pickingUp.name!=''" style="display: flex;flex-direction: column;"> |
|||
|
|||
<view style="display: flex;flex-direction: row;align-items: center;margin-top: 15px;"> |
|||
<image src="https://supervise.yxtsoft.com/lpk/image/date.png" |
|||
style="width:20px;height: 20px;"></image> |
|||
<text |
|||
style="margin-left: 5px;flex: 1;color: #666;font-size: 14px;">营业时间:{{pickingUp.date}}</text> |
|||
|
|||
</view> |
|||
|
|||
<view style="display: flex;flex-direction: row;align-items: center;margin-top: 15px;"> |
|||
<image src="https://supervise.yxtsoft.com/lpk/image/location.png" |
|||
style="width: 20px;height: 20px;"></image> |
|||
<text |
|||
style="margin-left: 5px;flex: 1; color: #666;font-size: 14px;">{{pickingUp.address}}</text> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
|
|||
<view |
|||
style="display: flex;flex-direction: row;align-items: center;justify-content: space-between;margin-top: 20px;"> |
|||
|
|||
<text |
|||
style="font-size: 16px; color: #333; font-weight: 600; font-family: sans-serif;">提菜人信息</text> |
|||
|
|||
<view style="display: flex;flex-direction: row;align-items: center;"> |
|||
<text v-if="userInfo.name==''" |
|||
style="font-size: 14px;color: #666;margin-right: 10px;">{{userInfo.type}}</text> |
|||
<text v-if="userInfo.name!=''" |
|||
style="font-size: 16px;color: #333;margin-right: 10px;">{{userInfo.name}}</text> |
|||
<text v-if="userInfo.phone!=''" |
|||
style="font-size: 14px;color: #666;margin-right: 10px;">{{userInfo.phone}}</text> |
|||
<image src="../../static/right_icon.png" mode="aspectFill" |
|||
style="width: 20px;height: 20px;"></image> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
|
|||
<view style="display: flex;flex-direction: column;margin-top: 20px;"> |
|||
|
|||
<text |
|||
style="font-size: 16px; color: #333; font-weight: 600; font-family: sans-serif;">所提蔬菜列表</text> |
|||
|
|||
<view style="width: 100%; display: flex;flex-direction: column;"> |
|||
<view v-for="(item,index) in pickingUpGoods" @click="itemClick(item.goodsSid)" |
|||
style="display: flex;flex-direction: column;justify-content: center;width: 100%; margin-top: 15px; "> |
|||
|
|||
<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> |
|||
|
|||
<view |
|||
style="display: flex;flex-direction: column;flex: 1; padding-bottom: 15px; margin-left: 10px;" |
|||
:style="{'border-bottom':(index == pickingUpGoods.length-1 ? 'none' : '1px #EFEFEF solid')}"> |
|||
|
|||
<text style="font-size: 13px;color: #000;">{{item.name}}</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; |
|||
font-size: 10px;color: #EE752F; margin-right: 10px; ">{{item.weight}}{{item.specificationUnit}}/{{item.unitName}}</text> |
|||
|
|||
<text |
|||
style="border: 1px #EE752F solid; background: #FF9900; color: #fff; font-size: 10px;border-radius: 5px; padding: 0px 8px;" |
|||
v-if="item.type=='0'">百姓菜!</text> |
|||
<text |
|||
style="border: 1px #3AA15F solid; background: #40C772; color: #fff; font-size: 10px;border-radius: 5px; padding: 0px 8px;" |
|||
v-if="item.type=='1'">精品菜!</text> |
|||
<text |
|||
style="border: 1px #1D60C7 solid; background: #2489F7; color: #fff; font-size: 10px;border-radius: 5px; padding: 0px 8px;" |
|||
v-if="item.type=='2'">企业菜!</text> |
|||
|
|||
</view> |
|||
|
|||
<view style="display: flex;flex-direction: row;align-items: center;justify-content: space-between; margin-top: 15px; |
|||
margin-right: 15px;"> |
|||
|
|||
|
|||
<view style="display: flex;flex-direction: row;align-items: center;"> |
|||
<text style="font-size: 12px;color: #FF5006;">剩余:</text> |
|||
<text |
|||
style="font-size: 14px;color: #FF5006;">{{item.goodsNumber}}{{item.unitName}}</text> |
|||
</view> |
|||
|
|||
|
|||
|
|||
<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> |
|||
|
|||
<text |
|||
style="font-size: 14px;margin-left: 8px;margin-right: 8px;">{{item.count}}</text> |
|||
<image src="../../static/jia_icon.png" mode="aspectFill" |
|||
style="width: 20px;height: 20px;" @click.stop="jia(item)"> |
|||
</image> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
<view style="height: 150px;"></view> |
|||
|
|||
<text style="background: #FF9900;color: #fff; margin-left: 20px; margin-right: 20px;border-radius: 20px; |
|||
padding-top: 10px;padding-bottom: 10px;text-align: center;">确认提菜</text> |
|||
|
|||
<view style="height: 80px;"></view> |
|||
|
|||
</view> |
|||
|
|||
</scroll-view> |
|||
</view> |
|||
|
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
notData: false, |
|||
showModal: false, |
|||
scrollHeight: "", |
|||
scrollLeftTop: "0", |
|||
scrollRightTop: "0", |
|||
brandType: "0", |
|||
styleObject: { |
|||
// 'position': 'fixed', |
|||
// 'top':'80vw', |
|||
'margin-top': '62vw', |
|||
'border-top-left-radius': '25px', |
|||
'border-top-right-radius': '25px', |
|||
'border-bottom-left-radius': '25px', |
|||
'border-bottom-right-radius': '25px', |
|||
'background': '#fff', |
|||
'padding-top': '10px', |
|||
'margin-bottom': "60px" |
|||
|
|||
}, |
|||
page: { |
|||
count: "0", |
|||
startHeight: 0, |
|||
endHeight: 0 |
|||
}, |
|||
data: [], |
|||
goods: [], |
|||
selectIndex: 0, |
|||
pickingUp: { |
|||
type: "去完善", |
|||
name: "", |
|||
date: "", |
|||
address: "" |
|||
}, |
|||
userInfo: { |
|||
type: "去完善", |
|||
name: "", |
|||
phone: "" |
|||
}, |
|||
pickingUpGoods: [ |
|||
|
|||
] |
|||
|
|||
} |
|||
}, |
|||
onShow() { |
|||
if (typeof this.$mp.page.getTabBar === 'function' && this.$mp.page.getTabBar()) { |
|||
this.$mp.page.getTabBar().setData({ |
|||
selected: 1 |
|||
}) |
|||
|
|||
} |
|||
}, |
|||
onHide() { |
|||
this.colseDialog() |
|||
}, |
|||
|
|||
onLoad() { |
|||
|
|||
let info = uni.getSystemInfoSync(); |
|||
|
|||
this.page.startHeight = info.windowWidth * 0.6 |
|||
this.page.endHeight = info.windowWidth * 0.8 |
|||
|
|||
this.request() |
|||
|
|||
}, |
|||
methods: { |
|||
labelClick(index, item) { |
|||
this.selectIndex = index |
|||
this.brandType = item.sid |
|||
this.pickingUpGoods = [] |
|||
this.page.count = 0 |
|||
this.getgoods() |
|||
|
|||
}, |
|||
request() { |
|||
let _this = this |
|||
var params = { |
|||
customerSid: getApp().globalData.sid |
|||
} |
|||
|
|||
_this.$api.vegeCellarTypeList(params).then((resp) => { |
|||
_this.data = resp |
|||
_this.selectIndex = 0 |
|||
_this.getgoods() |
|||
_this.scrollLeftTop = _this.scrollLeftTop == 0 ? -1 : 0 |
|||
_this.scrollRightTop = _this.scrollRightTop == 0 ? -1 : 0 |
|||
}).catch(e => {}) |
|||
}, |
|||
getgoods() { |
|||
let _this = this |
|||
|
|||
var params = { |
|||
customerSid: getApp().globalData.sid, |
|||
affiliation: this.brandType |
|||
} |
|||
|
|||
_this.$api.vegeCellarList(params).then((resp) => { |
|||
_this.goods = resp |
|||
|
|||
_this.notData = resp.length == 0 |
|||
}).catch(e => {}) |
|||
}, |
|||
jian(item) { |
|||
if (Number(item.count) > 0) { |
|||
item.count = Number(item.count) - 1 |
|||
this.addGoods(item) |
|||
} |
|||
this.getcount() |
|||
}, |
|||
jia(item) { |
|||
item.count = Number(item.count) + 1 |
|||
this.getcount() |
|||
this.addGoods(item) |
|||
}, |
|||
|
|||
getcount() { |
|||
|
|||
let num = 0; |
|||
for (var i = 0; i < this.goods.length; i++) { |
|||
num += Number(this.goods[i].count); |
|||
} |
|||
|
|||
this.page.count = num |
|||
}, |
|||
|
|||
addGoods(goods) { |
|||
|
|||
var item = this.pickingUpGoods.find(item => item.goodsSid == goods.goodsSid) |
|||
|
|||
if (item) { |
|||
|
|||
if (goods.count == 0) { |
|||
var index = this.pickingUpGoods.findIndex(item => item.goodsSid == goods.goodsSid) |
|||
this.pickingUpGoods.splice(index, 1) |
|||
} else { |
|||
item.count = goods.count |
|||
} |
|||
|
|||
} else { |
|||
this.pickingUpGoods.push(goods) |
|||
|
|||
} |
|||
|
|||
}, |
|||
|
|||
itemClick(goodsSid) { |
|||
uni.navigateTo({ |
|||
url: '/pages/good/goodsDetail?sid=' + goodsSid |
|||
}) |
|||
}, |
|||
|
|||
gotoShopp() { |
|||
uni.switchTab({ |
|||
url: '/pages/home/cloudCard2', |
|||
}) |
|||
}, |
|||
reservation() { |
|||
if (this.pickingUpGoods.length > 0){ |
|||
this.showModal = true |
|||
}else{ |
|||
this.shortToast('请先选择商品') |
|||
} |
|||
|
|||
}, |
|||
colseDialog() { |
|||
this.showModal = false |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
.top { |
|||
width: 100vw; |
|||
/* height: 126.66vw; */ |
|||
height: 75vw; |
|||
/* 加载背景图 */ |
|||
background-image: url(https://supervise.yxtsoft.com/lpk/image/clound_bj1.png); |
|||
/* background-image: url(../../static/clound_bj1.png); */ |
|||
/* 让背景图基于容器大小伸缩 */ |
|||
background-size: 100% 100%; |
|||
} |
|||
|
|||
.label { |
|||
background: #fff; |
|||
color: #FF9900; |
|||
font-size: 13px; |
|||
padding-top: 15px; |
|||
padding-bottom: 15px; |
|||
text-align: center; |
|||
} |
|||
|
|||
.label2 { |
|||
|
|||
background: #FF9900; |
|||
color: #fff; |
|||
font-size: 13px; |
|||
padding-top: 15px; |
|||
padding-bottom: 15px; |
|||
text-align: center; |
|||
} |
|||
|
|||
/* 弹窗样式 */ |
|||
.model { |
|||
position: absolute; |
|||
width: 100%; |
|||
height: 100%; |
|||
background: #000; |
|||
z-index: 999; |
|||
opacity: 0.5; |
|||
top: 0; |
|||
left: 0; |
|||
} |
|||
|
|||
.modalDlg { |
|||
/* 设置超出滚动 */ |
|||
overflow: auto; |
|||
width: 100%; |
|||
position: fixed; |
|||
top: 50vw; |
|||
left: 0; |
|||
right: 0; |
|||
bottom: 0; |
|||
z-index: 9999; |
|||
background-color: #fff; |
|||
border-top-right-radius: 20px; |
|||
border-top-left-radius: 20px; |
|||
display: flex; |
|||
flex-direction: column; |
|||
|
|||
|
|||
} |
|||
</style> |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 328 B |
After Width: | Height: | Size: 394 B |
After Width: | Height: | Size: 376 B |
After Width: | Height: | Size: 921 B |
Loading…
Reference in new issue