Files
dvcp_v2_wxcp_app/src/apps/AppSuperMarket/SubmitOrder.vue

279 lines
6.4 KiB
Vue
Raw Normal View History

2022-02-15 10:48:33 +08:00
<template>
<div class="order">
<div class="order-info">
2022-02-17 10:31:45 +08:00
<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>
2022-02-15 10:48:33 +08:00
</div>
2022-02-17 10:31:45 +08:00
<image class="line" src="./components/img/line.png" />
2022-02-15 10:48:33 +08:00
<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>
2022-02-17 10:31:45 +08:00
<div class="goods-footer__bottom--btn" @click="submit" hover-class="text-hover">确认领取</div>
2022-02-15 10:48:33 +08:00
</div>
</div>
</div>
</template>
<script>
export default {
data () {
return {
total: 0,
money: 0,
goods: [],
2022-02-17 10:31:45 +08:00
areaId: '',
familyInfo: {}
2022-02-15 10:48:33 +08:00
}
},
2022-02-17 10:31:45 +08:00
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 = '结算'
2022-02-15 10:48:33 +08:00
},
methods: {
2022-02-17 10:31:45 +08:00
toSearch() {
uni.navigateTo({url: `./Search?areaId=${this.areaId}`})
},
submit() {
if(!this.familyInfo.familyId) {
return this.$u.toast('请选择结算对象')
}
2022-02-15 10:48:33 +08:00
this.$http.post(`/app/appvillagerintegralshoporder/createOrderForWx`, {
2022-02-17 10:31:45 +08:00
memberId: this.familyInfo.memberId,
familyId: this.familyInfo.familyId,
2022-02-15 10:48:33 +08:00
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) {
2022-02-17 10:39:29 +08:00
uni.navigateTo({url: `./Success?status=1`})
2022-02-15 10:48:33 +08:00
}
2022-02-22 11:21:01 +08:00
}).catch((err) => {
this.$u.toast(err)
2022-02-15 10:48:33 +08:00
})
}
},
}
</script>
<style lang="scss" scoped>
.order {
min-height: 100%;
background: #fff;
.line {
width: 100%;
height: 8rpx;
}
.order-item {
display: flex;
padding: 28rpx 30rpx 44rpx;
2022-02-22 13:51:10 +08:00
.order-item__right{
width: calc(100% - 230rpx);
}
2022-02-15 10:48:33 +08:00
.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;
2022-02-17 10:31:45 +08:00
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;
}
}
2022-02-15 10:48:33 +08:00
}
.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;
2022-02-17 10:31:45 +08:00
font-weight: normal;
2022-02-15 10:48:33 +08:00
}
.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;
}
}
}
2022-02-17 10:31:45 +08:00
i{
font-style: normal;
}
2022-02-15 10:48:33 +08:00
</style>