|
|
@@ -111,9 +111,16 @@
|
|
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
|
|
v-hasPermi="['system:store:edit']"></el-button>
|
|
|
</el-tooltip>
|
|
|
- <el-tooltip content="更多" placement="top">
|
|
|
+ <el-dropdown @command="(command: string) => handleCommand(command, scope.row)" v-hasPermi="['system:store:edit']">
|
|
|
<el-button link type="primary" icon="More"></el-button>
|
|
|
- </el-tooltip>
|
|
|
+ <template #dropdown>
|
|
|
+ <el-dropdown-menu>
|
|
|
+ <el-dropdown-item command="handleRenew" icon="Calendar">续期</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="handleBan" icon="CircleClose" v-if="scope.row.status === 1">禁用</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="handleEnable" icon="CircleCheck" v-if="scope.row.status === 2">启用</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </template>
|
|
|
+ </el-dropdown>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -269,12 +276,33 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <!-- 门店续期对话框 -->
|
|
|
+ <el-dialog title="门店续期" v-model="renewDialog.visible" width="400px" append-to-body>
|
|
|
+ <el-form :model="renewForm" label-width="80px">
|
|
|
+ <el-form-item label="有效期至">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="renewForm.to"
|
|
|
+ type="datetime"
|
|
|
+ value-format="YYYY-MM-DD HH:mm:ss"
|
|
|
+ placeholder="选择日期时间"
|
|
|
+ style="width: 100%"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitRenew" :loading="renewLoading">确 定</el-button>
|
|
|
+ <el-button @click="renewDialog.visible = false">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup name="Store" lang="ts">
|
|
|
-import { listStore, getStore, delStore, addStore, updateStore, listStoreStatus } from '@/api/system/store';
|
|
|
-import { StoreVO, StoreQuery, StoreForm, StoreStatusVO, SysStorePageBo } from '@/api/system/store/types';
|
|
|
+import { listStore, getStore, delStore, addStore, updateStore, listStoreStatus, renewStore, banStore, enableStore } from '@/api/system/store';
|
|
|
+import { StoreVO, StoreForm, StoreQuery, StoreStatusVO, SysStorePageBo } from '@/api/system/store/types';
|
|
|
import { listOnStore } from '@/api/system/tenant';
|
|
|
import { listOnStore as listTenantCategoriesOnStore } from '@/api/system/tenantCategories';
|
|
|
import { listOnStore as listServiceOnStore } from '@/api/service/list';
|
|
|
@@ -370,6 +398,90 @@ const handleDetail = async (row: StoreVO) => {
|
|
|
detailDialog.visible = true;
|
|
|
};
|
|
|
|
|
|
+/** 续期对话框 */
|
|
|
+const renewDialog = reactive({
|
|
|
+ visible: false
|
|
|
+});
|
|
|
+const renewForm = reactive({
|
|
|
+ id: undefined as string | number | undefined,
|
|
|
+ to: ''
|
|
|
+});
|
|
|
+const renewLoading = ref(false);
|
|
|
+
|
|
|
+/** 处理下拉菜单命令 */
|
|
|
+const handleCommand = (command: string, row: StoreVO) => {
|
|
|
+ switch (command) {
|
|
|
+ case 'handleRenew':
|
|
|
+ handleRenew(row);
|
|
|
+ break;
|
|
|
+ case 'handleBan':
|
|
|
+ handleBan(row);
|
|
|
+ break;
|
|
|
+ case 'handleEnable':
|
|
|
+ handleEnable(row);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+/** 续期按钮操作 */
|
|
|
+const handleRenew = (row: StoreVO) => {
|
|
|
+ renewForm.id = row.id;
|
|
|
+ renewForm.to = ''; // 清空之前的选择
|
|
|
+ renewDialog.visible = true;
|
|
|
+};
|
|
|
+
|
|
|
+/** 提交续期 */
|
|
|
+const submitRenew = async () => {
|
|
|
+ if (!renewForm.to) {
|
|
|
+ proxy?.$modal.msgError("请选择有效期");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ renewLoading.value = true;
|
|
|
+ try {
|
|
|
+ await renewStore({
|
|
|
+ id: renewForm.id!,
|
|
|
+ to: renewForm.to
|
|
|
+ });
|
|
|
+ proxy?.$modal.msgSuccess("续期成功");
|
|
|
+ renewDialog.visible = false;
|
|
|
+ getList();
|
|
|
+ } finally {
|
|
|
+ renewLoading.value = false;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+/** 禁用按钮操作 */
|
|
|
+const handleBan = async (row: StoreVO) => {
|
|
|
+ try {
|
|
|
+ await proxy?.$modal.confirm('是否确认禁用门店?');
|
|
|
+ loading.value = true;
|
|
|
+ await banStore({ id: row.id });
|
|
|
+ proxy?.$modal.msgSuccess("禁用成功");
|
|
|
+ getList();
|
|
|
+ } catch (err) {
|
|
|
+ // 取消确认或请求失败
|
|
|
+ } finally {
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+/** 启用按钮操作 */
|
|
|
+const handleEnable = async (row: StoreVO) => {
|
|
|
+ try {
|
|
|
+ await proxy?.$modal.confirm('是否确认启用门店?');
|
|
|
+ loading.value = true;
|
|
|
+ await enableStore({ id: row.id });
|
|
|
+ proxy?.$modal.msgSuccess("启用成功");
|
|
|
+ getList();
|
|
|
+ } catch (err) {
|
|
|
+ // 取消确认或请求失败
|
|
|
+ } finally {
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
const initFormData: StoreForm = {
|
|
|
id: undefined,
|
|
|
logo: undefined,
|