Files
dvcp_v2_wxcp_app/src/apps/AppSuperMarket/SubmitOrder.vue
2022-02-22 13:51:10 +08:00

279 lines
6.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="order">
<div class="order-info">
<div><span class="tips">*</span>结算对象</div>
<div class="family-name" @click="toSearch">
<span v-if="familyInfo.familyId" class="name">{{familyInfo.familyName}} 剩余积分:{{familyInfo.familyIntegral}}</span>
<span v-else class="name">请选择</span>
<u-icon name="arrow-right" color="#666" size="24" style="margin-left:4px;" />
</div>
</div>
<image class="line" src="./components/img/line.png" />
<div class="order-list">
<div class="order-item" v-for="(item, index) in goods" :key="index">
<image :src="item.photo[0].url" />
<div class="order-item__right flex1">
<h2>{{ item.merchandiseName }}</h2>
<div class="order-item__right--info">
<span>{{ item.costIntegral }}</span>
<i>积分</i>
</div>
<div class="item-bottom">
<div></div>
<div class="item-bottom__right">
<span>x {{ item.num }}</span>
</div>
</div>
</div>
</div>
</div>
<div class="goods-footer">
<div class="goods-footer__bottom">
<div class="goods-footer__bottom__left">
<h3>{{ total }}件商品</h3>
<div class="goods-footer__bottom--middle">
<span>合计 </span>
<i>{{ money }}</i>
<em>积分</em>
</div>
</div>
<div class="goods-footer__bottom--btn" @click="submit" hover-class="text-hover">确认领取</div>
</div>
</div>
</div>
</template>
<script>
export default {
data () {
return {
total: 0,
money: 0,
goods: [],
areaId: '',
familyInfo: {}
}
},
onLoad (options) {
this.total = options.total
this.money = options.money
this.goods = JSON.parse(options.goods)
this.areaId = options.areaId
uni.$on('selectFamily', res => {
console.log(res)
this.familyInfo = res
})
},
onShow() {
document.title = '结算'
},
methods: {
toSearch() {
uni.navigateTo({url: `./Search?areaId=${this.areaId}`})
},
submit() {
if(!this.familyInfo.familyId) {
return this.$u.toast('请选择结算对象')
}
this.$http.post(`/app/appvillagerintegralshoporder/createOrderForWx`, {
memberId: this.familyInfo.memberId,
familyId: this.familyInfo.familyId,
orderIntegral: this.money,
shopId: this.goods[0].shopId,
merchandiseList: this.goods.map(item => {
return {
merchandiseId: item.id,
merchandiseNumber: item.num
}
})
}).then(res => {
if (res.code === 0) {
uni.navigateTo({url: `./Success?status=1`})
}
}).catch((err) => {
this.$u.toast(err)
})
}
},
}
</script>
<style lang="scss" scoped>
.order {
min-height: 100%;
background: #fff;
.line {
width: 100%;
height: 8rpx;
}
.order-item {
display: flex;
padding: 28rpx 30rpx 44rpx;
.order-item__right{
width: calc(100% - 230rpx);
}
.order-item__right--info {
display: flex;
align-items: baseline;
span {
margin-right: 8rpx;
color: #FA4A51;
font-size: 40rpx;
}
i {
color: #FA4A51;
font-size: 24rpx;
}
}
h2 {
margin-top: 2rpx;
margin-bottom: 30rpx;
color: #333333;
font-size: 30rpx;
text-align: justify;
}
& > image {
width: 192rpx;
height: 192rpx;
margin-right: 30rpx;
}
}
.order-list {
margin-top: 20rpx;
padding-bottom: 110rpx;
}
.order-info {
display: flex;
justify-content: space-between;
font-size: 32px;
font-family: PingFangSC-Regular, PingFang SC;
color: #333;
line-height: 44px;
padding: 40px 30px 20px 30px;
.tips{
display: inline-block;
width: 16px;
font-size: 32px;
font-family: PingFangSC-Regular, PingFang SC;
color: #FF4466;
margin-right: 4px;
}
.family-name{
color: #666;
width: calc(100% - 170px);
.name{
display: inline-block;
width: calc(100% - 40px);
word-break: break-all;
text-align: right;
}
}
}
.goods-footer {
position: fixed;
left: 0;
bottom: 0;
z-index: 11;
width: 100%;
box-shadow: 0px -1px 4px 0px rgba(214, 214, 214, 0.5);
background: #fff;
.goods-footer__bottom--btn {
width: 212rpx;
height: 104rpx;
line-height: 104rpx;
font-size: 36rpx;
color: #fff;
text-align: center;
background: #197DF0;
}
.goods-footer__bottom__left {
display: flex;
align-items: center;
justify-content: space-between;
flex: 1;
padding: 0 32rpx;
h3 {
color: #F94246;
font-size: 32rpx;
font-weight: normal;
}
.goods-footer__bottom--middle {
display: flex;
align-items: baseline;
span {
color: #F94246;
font-size: 32rpx;
}
i {
position: relative;
top: 2rpx;
margin-right: 6px;
color: #FA444B;
font-size: 40rpx;
}
em {
color: #F94246;
font-size: 24rpx;
}
}
}
.goods-footer__bottom {
display: flex;
align-items: center;
justify-content: space-between;
height: 104rpx;
}
}
.item-bottom {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 28rpx;
.item-bottom__right {
display: flex;
align-items: center;
color: #666;
}
image {
width: 40rpx;
height: 40rpx;
}
input {
width: 90rpx;
height: 60rpx;
padding: 0 20rpx;
margin: 0 10rpx;
background: #F6F6F6;
border-radius: 10rpx;
font-size: 26rpx;
color: #666;
}
}
}
i{
font-style: normal;
}
</style>