merchapp/java-mall-app-shop-admin/pages/my/businessStatus.vue
2025-06-25 07:53:47 +08:00

153 lines
3.6 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>
<view class="businessStatus-container">
<view class="business-contetn">
<view class="title">营业状态</view>
<view class="business-box">
<view class="business-status">
<view class="status-name">店铺正常营业中</view>
<view class="business-time">
营业时间{{ dashboardInfo.store_info.info.store_opening_hours }} -
{{ dashboardInfo.store_info.info.store_close_hours }}
</view>
</view>
<u-switch
v-model="dashboardInfo.store_info.store_biz_state"
activeColor="#5ac725"
inactiveColor="#f56c6c"
:activeValue="1"
:inactiveValue="2"
@change="handerUpdateStoreBizState"
></u-switch>
</view>
</view>
</view>
</template>
<script>
import { GetAccountDashboard } from "../../api/user";
import { UpdateStoreBizState } from "../../api/store";
export default {
data() {
return {
dashboardInfo: {
data: {},
notice: {},
order: {
yestoday_num: 0,
},
product: {
illegal_num: 0,
normal_num: 0,
off_num: 0,
total_num: 0,
verify_passed_off_num: 0,
verify_refused_num: 0,
verify_waiting_num: 0,
},
return: {
fin_num: 0,
review_num: 0,
total_num: 0,
un_fin_num: 0,
},
store_info: {
store_id: 1,
store_name: "",
store_biz_state: 1,
info: {
store_opening_hours: "",
store_close_hours: "",
},
},
},
};
},
onShow() {
this.getAccountDashboard();
},
methods: {
async getAccountDashboard() {
let res = await GetAccountDashboard();
if (res && res.status == 200) {
uni.setStorageSync("accountDashboard", res.data);
this.dashboardInfo = res.data;
}
},
async handerUpdateStoreBizState(e) {
let params = {
store_id: this.dashboardInfo.store_info.store_id,
store_biz_state: e,
};
if (e == 2) {
uni.showModal({
title: "提示",
content: "你确定要暂时关闭店铺营业?",
success: async (res) => {
if (res.confirm) {
let res = await UpdateStoreBizState(params);
if (res && res.status == 200) {
uni.showToast({
title: `关闭成功`,
icon: "error",
duration: 1000,
});
}
}
},
});
} else {
let res = await UpdateStoreBizState(params);
if (res && res.status == 200) {
uni.showToast({
title: `打开成功`,
icon: "error",
duration: 1000,
});
}
}
},
},
};
</script>
<style lang="scss">
.businessStatus-container {
.business-contetn {
margin: 40rpx 20rpx;
background: #fff;
border-radius: 12rpx;
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1);
.title {
padding: 20rpx 32rpx;
font-weight: bold;
}
.business-status {
.status-name {
position: relative;
&::before {
content: "";
display: block;
width: 6px;
height: 6px;
background-color: #5ac725;
position: absolute;
right: 25%;
top: 36%;
border-radius: 50%;
}
}
}
.business-box {
padding: 20rpx 32rpx;
display: flex;
justify-content: space-between;
}
}
}
</style>