mrr.sj.front/pages/shop/staff/serviceList.vue

234 lines
5.6 KiB
Vue
Raw Normal View History

2026-03-24 11:45:13 +08:00
<template>
<view class="container">
<custom-navbar title="服务项目" :leftImg="'/static/images/whiteBack.png'" :showUser="true"
2026-06-02 11:39:23 +08:00
backgroundColor="linear-gradient( 134deg, #F52540 0%, #FF4767 100%)" :showHeadle="false" titleColor="#fff"
2026-03-24 11:45:13 +08:00
borderBottom="none"></custom-navbar>
2026-06-02 11:39:23 +08:00
<serviecFirstTab :tabs="tabs" :activeId="activeId" activeColor="#FF4767" @tab-click="tabClick" bgColor="#fff">
2026-03-24 11:45:13 +08:00
</serviecFirstTab>
<view class="service-list">
2026-04-16 10:33:00 +08:00
<view class="service-item flex-row-center-between" v-for="(item, index) in getList" :key="index" v-if="(item.is_choice && isBack!=0) || isBack==0">
2026-03-24 11:45:13 +08:00
<view class="item-left flex-row-start">
<image class="item-left-photo" :src="item.photo[0]" mode="aspectFill"></image>
<view class="item-left-texts">
<view class="item-left-text1">
{{ item.title }}
</view>
<view class="flex-row-center">
2026-06-02 11:39:23 +08:00
<text class="item-left-text2" style="color: #FF4767">¥</text>
2026-03-24 11:45:13 +08:00
<text class="item-left-text2"
2026-06-02 11:39:23 +08:00
style="color: #FF4767; font-size: 28rpx">{{ item.server_price }}</text>
2026-03-24 11:45:13 +08:00
<view class="item-left-line"></view>
<text class="item-left-text2">{{ item.server_time }}分钟</text>
</view>
</view>
</view>
<!-- <view class="item-right" @click="item.is_choice = !item.is_choice">
{{ item.is_choice ? "取消" : "添加" }}
</view> -->
2026-04-16 10:33:00 +08:00
<view v-if="isBack==0">
<image class="item-right" src="/static/images/icons/staffCancel.png" @click="changeType(item)" v-if="item.is_choice"></image>
<image class="item-right" src="/static/images/icons/staffAdd.png" @click="changeType(item)" v-else></image>
</view>
2026-03-24 11:45:13 +08:00
</view>
</view>
<view class="container-footer">
<view class="container-footer-btn flex-row-center-center" @click="sure" v-if="isBack==0">
<text>确认</text>
</view>
<view class="container-footer-btn flex-row-center-center" @click="back" v-else>
<text>返回</text>
</view>
</view>
</view>
</template>
<script>
import request from "@/utils/request";
import serviecFirstTab from "@/components/common/service-first-tab.vue";
export default {
components: {
serviecFirstTab,
},
data() {
return {
activeId: "",
tabs: [],
userInfo: {},
serviceList: {},
isBack: 0,
};
},
async onLoad(options) {
if (options.isBack) {
this.isBack = options.isBack;
}
let type = 3;
let result = await request.post("/user/getuser", {
type,
});
this.userInfo = result.data;
if (options.syrid) {
this.sjservers(Number(options.syrid));
} else {
this.serviceList = JSON.parse(JSON.stringify(this.$store.state.sjServiceList))
2026-03-24 11:45:13 +08:00
}
this.sjfirstclass();
},
computed: {
getList() {
return this.serviceList[String(this.activeId)] || [];
},
},
methods: {
changeType(item){
2026-03-24 11:45:13 +08:00
if(this.isBack==0){
item.is_choice = !item.is_choice
console.log(this.$store.state.sjServiceList,'this.$store.state.sjServiceList');
2026-03-24 11:45:13 +08:00
}
},
tabClick(id) {
this.activeId = id;
},
sjfirstclass() {
request
.post("/sj/sjfirstclass", {
sjid: this.userInfo.id,
})
.then((res) => {
if (res.code == 200) {
this.tabs = res.data;
this.activeId = res.data[0].id;
}
});
},
sjservers(syrid) {
request
.post("/sj/sjservers", {
sjid: this.userInfo.id,
syrid: syrid,
})
.then((res) => {
if (res.code == 200) {
//将数据存在vuex里作为依据
this.serviceList = res.data;
}
});
},
sure() {
this.$store.commit("setSjServiceList", this.serviceList);
const pages = getCurrentPages();
const prevPage = pages[pages.length - 2];
if (prevPage) {
if (prevPage.$vm && typeof prevPage.$vm.makeservers === "function") {
prevPage.$vm.makeservers(); // 存在则调用
}
uni.navigateBack();
}
},
back(){
uni.navigateBack();
}
},
};
</script>
<style lang="less">
.container {
.service-list {
background-color: #fff;
margin: 20rpx 20rpx 26rpx 20rpx;
border-radius: 10rpx;
2026-04-21 17:07:28 +08:00
padding-bottom: 150rpx;
2026-03-24 11:45:13 +08:00
.service-item {
padding-top: 20rpx;
margin: 0rpx 20rpx 30rpx 20rpx;
padding-bottom: 30rpx;
border-bottom: 1rpx solid #f1f1f1;
.item-left {
.item-left-photo {
width: 100rpx;
height: 100rpx;
border-radius: 20rpx;
background: #000;
}
.item-left-texts {
margin-left: 20rpx;
.item-left-text1 {
font-weight: 500;
font-size: 30rpx;
color: #333333;
line-height: 34rpx;
text-align: left;
font-style: normal;
margin-bottom: 27rpx;
margin-top: 6rpx;
max-width: 400rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.item-left-text2 {
font-weight: 400;
font-size: 26rpx;
color: #666666;
line-height: 34rpx;
text-align: left;
font-style: normal;
}
.item-left-line {
margin: 0 10rpx;
width: 2rpx;
height: 20rpx;
background: #666666;
}
}
}
.item-right {
width: 132rpx;
height: 57rpx;
}
}
}
}
.service-first-tab {
padding-bottom: 20rpx !important;
box-shadow: none !important;
}
.container-footer {
padding: 0rpx 40rpx 40rpx 40rpx;
background: transparent;
position: fixed;
left: 0;
right: 0;
bottom: 0;
.container-footer-btn {
width: 670rpx;
height: 86rpx;
border-radius: 100rpx;
2026-06-02 11:39:23 +08:00
background: #FF4767;
2026-03-24 11:45:13 +08:00
font-weight: 400;
font-size: 34rpx;
color: #ffffff;
text-align: center;
font-style: normal;
}
.nobtn {
background: rgba(232, 16, 30, 0.4);
}
}
</style>