Files
xk-doctor-wx/subPackages/sub_platform_admin/store/edit.vue
2026-06-09 17:02:13 +08:00

112 lines
3.2 KiB
Vue

<template>
<store-page-layout title="编辑诊所" :show-back="true">
<view class="page">
<view class="field">
<text class="label">诊所名称</text>
<input class="input" v-model="form.name" placeholder="请输入" />
</view>
<view class="field">
<text class="label">联系人</text>
<input class="input" v-model="form.contact" placeholder="请输入" />
</view>
<view class="field">
<text class="label">联系电话</text>
<input class="input" v-model="form.mobile" type="number" placeholder="请输入" />
</view>
<view class="field">
<text class="label">详细地址</text>
<input class="input" v-model="form.position" placeholder="请输入" />
</view>
<view class="field">
<text class="label">营业开始</text>
<input class="input" v-model="form.start_time" placeholder="如 08:00" />
</view>
<view class="field">
<text class="label">营业结束</text>
<input class="input" v-model="form.end_time" placeholder="如 20:00" />
</view>
<view class="field">
<text class="label">销售倍率</text>
<input class="input" v-model="form.z_sale_percent" type="digit" placeholder="请输入" />
</view>
<view class="submit-btn" @click="submit">保存</view>
</view>
</store-page-layout>
</template>
<script>
import StorePageLayout from '@/subPackages/sub_platform_admin/components/store-page-layout.vue';
import { getPlatformStoreDetail, updatePlatformStore } from '@/api/platformStore.js';
export default {
components: { StorePageLayout },
data() {
return {
storeId: 0,
form: {
id: 0,
name: '',
contact: '',
mobile: '',
position: '',
start_time: '',
end_time: '',
z_sale_percent: '',
},
};
},
onLoad(options) {
this.storeId = Number(options.id || 0);
this.loadDetail();
},
methods: {
async loadDetail() {
if (!this.storeId) return;
const wrap = await getPlatformStoreDetail(this.storeId);
if (!wrap || !wrap.ok) return;
const d = wrap.data || {};
this.form = {
id: d.id,
name: d.name || '',
contact: d.contact || '',
mobile: d.mobile || '',
position: d.position || '',
start_time: d.start_time || '',
end_time: d.end_time || '',
z_sale_percent: d.z_sale_percent != null ? String(d.z_sale_percent) : '',
};
},
async submit() {
if (!this.form.name) {
uni.showToast({ title: '请填写诊所名称', icon: 'none' });
return;
}
uni.showLoading({ title: '保存中' });
try {
const wrap = await updatePlatformStore({ ...this.form });
if (wrap && wrap.ok) {
uni.showToast({ title: '保存成功', icon: 'success' });
setTimeout(() => uni.navigateBack(), 500);
}
} finally {
uni.hideLoading();
}
},
},
};
</script>
<style lang="scss" scoped>
.page { padding: 24rpx; }
.field {
display: flex; align-items: center; background: #fff; border-radius: 16rpx;
padding: 24rpx; margin-bottom: 16rpx;
}
.label { width: 180rpx; font-size: 28rpx; flex-shrink: 0; }
.input { flex: 1; font-size: 28rpx; text-align: right; }
.submit-btn {
margin-top: 40rpx; background: linear-gradient(90deg, #00BFA6, #6ACDBB);
color: #fff; text-align: center; padding: 24rpx; border-radius: 16rpx; font-size: 30rpx;
}
</style>