108 lines
2.2 KiB
Vue
108 lines
2.2 KiB
Vue
<template>
|
|
<div class="order">
|
|
|
|
<van-nav-bar
|
|
title="确认订单"
|
|
fixed
|
|
left-arrow
|
|
@click-left="$router.back()"
|
|
/>
|
|
<div class="content">
|
|
<van-contact-card
|
|
type="edit"
|
|
name="bmy"
|
|
tel="15155145354"/>
|
|
|
|
<van-card
|
|
v-for="(item,index) in getOrderArr"
|
|
:key="index"
|
|
:num="item.car_num"
|
|
:price="item.wares_nowprice"
|
|
:desc="item.wares_info"
|
|
:title="item.wares_title"
|
|
:thumb="item.wares_masterimg[0]">
|
|
</van-card>
|
|
|
|
<van-submit-bar :price="totalMoney" button-text=" 付 款 " @submit="onSubmit" />
|
|
|
|
<van-popup v-model="show" position="bottom" :style="{ height: '60%' }">
|
|
<van-button type="default" @click="changeOrderStatus"> 付 款 </van-button>
|
|
</van-popup>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapGetters, mapMutations, mapActions } from 'vuex'
|
|
|
|
export default {
|
|
name: "order",
|
|
data() {
|
|
return {
|
|
show: true
|
|
}
|
|
},
|
|
created() {
|
|
console.log(this.getOrderArr)
|
|
},
|
|
methods: {
|
|
async changeOrderStatus() {
|
|
let res = await this.$http.car.allOrder({
|
|
status: 0
|
|
});
|
|
|
|
let param = []
|
|
|
|
res.forEach(v => param.push(v.goods_id))
|
|
|
|
console.log(param)
|
|
|
|
let orderStatus = await this.$http.car.buyOrder({
|
|
goodsid: param
|
|
});
|
|
|
|
this.$toast.success({
|
|
message: '支付成功',
|
|
onClose: () => {
|
|
this.$router.replace('/status')
|
|
}
|
|
})
|
|
|
|
console.log(orderStatus)
|
|
},
|
|
async onSubmit() {
|
|
let param = []
|
|
this.getOrderArr.forEach(v => {
|
|
param.push({
|
|
waresid: v.wares_id,
|
|
goodsnum: v.car_num,
|
|
goodsprice: v.wares_nowprice,
|
|
})
|
|
})
|
|
|
|
let res = await this.$http.car.submitCar({
|
|
carList: param
|
|
});
|
|
this.show = true
|
|
console.log(res)
|
|
}
|
|
},
|
|
computed: {
|
|
totalMoney() {
|
|
let money = 0;
|
|
this.getOrderArr.forEach(v => {
|
|
money += v.car_num * v.wares_nowprice
|
|
})
|
|
return money * 100
|
|
},
|
|
...mapGetters([
|
|
'getOrderArr'
|
|
])
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
@import "~@page/order.less";
|
|
</style>
|