mrr.sj.front/pages/shop/groupBuying/selectServe.vue

107 lines
2.3 KiB
Vue

<template>
<view class="select-serve">
<custom-navbar
title="选择服务"
:showBack="false"
backgroundColor="#FFFFFF"
></custom-navbar>
<view class="serve-lists">
<view
v-for="(item, index) in info"
:key="index"
class="serve-lists__list"
>
<serveCard :info="item" v-model="value"></serveCard>
</view>
</view>
<view class="select-serve-footer">
<view class="select-serve-footer__btn" @click="submit">提交</view>
</view>
</view>
</template>
<script>
import request from "@/utils/request";
import serveCard from "./components/serveCard.vue";
export default {
name: "SelectServe",
data() {
return {
info: [],
value: null,
};
},
components: {
serveCard,
},
onLoad() {
this.getServeList();
},
methods: {
getServeList() {
request.post("/user/sjserverlist", { state: 2,is_team_buy:1 }).then((res) => {
this.info = res.data;
console.log(res);
});
},
submit() {
if (!this.value) {
uni.showToast({
title: "请选择服务",
icon: "none",
});
return;
}
const pages = getCurrentPages();
const prevPage = pages[pages.length - 2]; // 上一个页面
uni.navigateBack({
delta: 1,
success: () => {
this.$set(prevPage.$vm.formData, 'server_id', this.value)
let item = this.info.find(i => i.id === this.value)
prevPage.$vm.serveDetail = item;
},
});
},
},
};
</script>
<style lang="scss" scoped>
.select-serve {
background-color: #f5f5f5;
min-height: 100vh;
padding-bottom: 160rpx;
.serve-lists {
padding: 20rpx 30rpx;
&__list {
margin-bottom: 20rpx;
}
}
.select-serve-footer {
background-color: #fff;
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 40rpx 30rpx;
&__btn {
width: 690rpx;
height: 78rpx;
background: #FF4767;
border-radius: 798rpx;
display: flex;
align-items: center;
justify-content: center;
font-weight: 400;
font-size: 30rpx;
color: #ffffff;
line-height: 39rpx;
text-align: center;
font-style: normal;
}
}
}
</style>