feat 初始化店铺列表
This commit is contained in:
parent
377c767ecd
commit
2d6ea51e00
54
src/api/business/ShopManager/Shops/shop.js
Normal file
54
src/api/business/ShopManager/Shops/shop.js
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Descripttion: 店铺Api接口
|
||||||
|
* @version: (1.0)
|
||||||
|
* @Author: (黎文豪)
|
||||||
|
* @Date: (2023-06-09)
|
||||||
|
* @LastEditors: (黎文豪)
|
||||||
|
* @LastEditTime: (2023-06-09)
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 店铺分页查询列表
|
||||||
|
export function shopList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/business/Shop/getShopList',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 店铺新增或修改
|
||||||
|
export function addOrUpdateShop(data) {
|
||||||
|
return request({
|
||||||
|
url: '/business/Shop/addOrUpdateShop',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 店铺删除
|
||||||
|
export function delShop(ids) {
|
||||||
|
return request({
|
||||||
|
url: '/business/Shop/'+ ids,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 店铺导出
|
||||||
|
export function exportShop(query) {
|
||||||
|
return request({
|
||||||
|
url: 'business/Shop/exportShop',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 店铺审核
|
||||||
|
export function audit(data) {
|
||||||
|
return request({
|
||||||
|
url: 'business/Shop/audit',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
175
src/views/business/ShopManager/Shops/components/AddDialog.vue
Normal file
175
src/views/business/ShopManager/Shops/components/AddDialog.vue
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
<!--
|
||||||
|
* @Descripttion: (店铺/tb_shop 添加弹窗)
|
||||||
|
* @version: (1.0)
|
||||||
|
* @Author: (黎文豪)
|
||||||
|
* @Date: (2023-06-09)
|
||||||
|
* @LastEditors: (黎文豪)
|
||||||
|
* @LastEditTime: (2023-06-09)
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<el-dialog v-model="props.modelValue" title="添加店铺信息" width="900px" @closed="closeDialog" @open="openDialog">
|
||||||
|
<el-form ref="formRef" :model="formData" :rules="rules">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="用户id" prop="shopUserId">
|
||||||
|
<el-input v-model="formData.shopUserId" placeholder="请输入用户id" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="客户guid" prop="shopCustomerGuid">
|
||||||
|
<el-input v-model="formData.shopCustomerGuid" placeholder="请输入客户guid" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="经营类目guid" prop="shopBusinessCategoryGuid">
|
||||||
|
<el-input v-model="formData.shopBusinessCategoryGuid" placeholder="请输入经营类目guid" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="图标" prop="shopLogo">
|
||||||
|
<UploadImage ref="uploadRef" v-model="formData.shopLogo" :data=imgData :limit="1" :fileSize="5"
|
||||||
|
:drag="true" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="营业执照" prop="shopBusinessLicense">
|
||||||
|
<UploadImage ref="uploadRef" v-model="formData.shopBusinessLicense" :data=imgData :limit="1" :fileSize="5"
|
||||||
|
:drag="true" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="名称" prop="shopName">
|
||||||
|
<el-input v-model="formData.shopName" placeholder="请输入名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item :label-width="labelWidth" label="简介" prop="shopIntro">
|
||||||
|
<el-input v-model="formData.shopIntro" type="textarea" :rows="5" placeholder="请输入简介" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="排序" prop="shopSort">
|
||||||
|
<el-input-number v-model.number="formData.shopSort" controls-position="right" :min="0" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="销售单量" prop="shopSalesOrderCount">
|
||||||
|
<el-input-number v-model.number="formData.shopSalesOrderCount" controls-position="right" :min="0" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="审核状态" prop="shopAuditStatus">
|
||||||
|
<el-select v-model="formData.shopAuditStatus" placeholder="请选择审核状态">
|
||||||
|
<el-option v-for="item in audit_status " :key="item.dictValue" :label="item.dictLabel"
|
||||||
|
:value="parseInt(item.dictValue)"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="审核人" prop="shopAuditUserGuid">
|
||||||
|
<el-input v-model="formData.shopAuditUserGuid" placeholder="请输入审核人" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<div key="dialog-footer">
|
||||||
|
<el-button type="primary" @click="handleAddClick(formRef)">添加</el-button>
|
||||||
|
<el-button @click="handleResetClick(formRef)">重置</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { reactive, ref, watch } from "vue";
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import modal from '@/plugins/modal.js'
|
||||||
|
import { addOrUpdateShop } from '@/api/business/ShopManager/Shops/shop.js';
|
||||||
|
|
||||||
|
|
||||||
|
// 打开弹窗时回调
|
||||||
|
const openDialog = async () => {
|
||||||
|
|
||||||
|
await getaudit_status()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -业务参数
|
||||||
|
// 审核状态字典选项列表
|
||||||
|
const audit_status = ref([]);
|
||||||
|
|
||||||
|
|
||||||
|
// -业务方法
|
||||||
|
// 字典获取
|
||||||
|
async function getaudit_status() {
|
||||||
|
await proxy.getDicts('audit_status').then((res) => {
|
||||||
|
audit_status.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -基础参数
|
||||||
|
const labelWidth = 100;
|
||||||
|
const formRef = ref();
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
const emits = defineEmits(["update:modelValue"]);
|
||||||
|
const formData = reactive({
|
||||||
|
shopSort: 100,
|
||||||
|
shopSalesOrderCount: 0
|
||||||
|
});
|
||||||
|
const props = defineProps({
|
||||||
|
modelValue: Boolean,
|
||||||
|
done: Function,
|
||||||
|
});
|
||||||
|
const imgData = ref({
|
||||||
|
fileDir: "Shop"
|
||||||
|
})
|
||||||
|
|
||||||
|
// 验证
|
||||||
|
const rules = reactive({
|
||||||
|
shopBusinessCategoryGuid: [{ required: true, message: "经营类目guid不能为空", trigger: "blur" }],
|
||||||
|
shopLogo: [{ required: true, message: "图标不能为空", trigger: "blur" }],
|
||||||
|
shopBusinessLicense: [{ required: true, message: "营业执照不能为空", trigger: "blur" }],
|
||||||
|
shopName: [{ required: true, message: "名称不能为空", trigger: "blur" }],
|
||||||
|
shopIntro: [{ required: true, message: "简介不能为空", trigger: "blur" }],
|
||||||
|
shopSort: [{ required: true, message: "排序不能为空", trigger: "blur", type: "number" }],
|
||||||
|
shopSalesOrderCount: [{ required: true, message: "销售单量不能为空", trigger: "blur", type: "number" }],
|
||||||
|
shopAuditStatus: [{ required: true, message: "审核状态不能为空", trigger: "change", type: "number" }],
|
||||||
|
shopAuditUserGuid: [{ required: true, message: "审核人不能为空", trigger: "blur"}],
|
||||||
|
});
|
||||||
|
|
||||||
|
// -基础方法
|
||||||
|
|
||||||
|
// 提交
|
||||||
|
const handleAddClick = async (formEl) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.validate(async (valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const { code } = await addOrUpdateShop(formData);
|
||||||
|
if (code == 200) {
|
||||||
|
modal.msgSuccess('添加成功')
|
||||||
|
closeDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const closeDialog = () => {
|
||||||
|
handleResetClick(formRef.value);
|
||||||
|
props.done();
|
||||||
|
emits("update:modelValue", false);
|
||||||
|
};
|
||||||
|
const handleResetClick = async (formEl) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.resetFields();
|
||||||
|
};
|
||||||
|
</script>
|
148
src/views/business/ShopManager/Shops/components/DetailDialog.vue
Normal file
148
src/views/business/ShopManager/Shops/components/DetailDialog.vue
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
<!--
|
||||||
|
* @Descripttion: (店铺/tb_shop 详情弹窗)
|
||||||
|
* @version: (1.0)
|
||||||
|
* @Author: (黎文豪)
|
||||||
|
* @Date: (2023-06-09)
|
||||||
|
* @LastEditors: (黎文豪)
|
||||||
|
* @LastEditTime: (2023-06-09)
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<el-dialog v-model="props.modelValue" title="店铺信息详情" width="900px" @closed="closeDialog" @open="openDialog">
|
||||||
|
<el-form ref="formRef" :model="formData" :disabled="true">
|
||||||
|
|
||||||
|
<el-row :gutter="20">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="用户id" >
|
||||||
|
<el-input v-model="formData.shopUserId" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="客户guid" >
|
||||||
|
<el-input v-model="formData.shopCustomerGuid" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="经营类目guid" >
|
||||||
|
<el-input v-model="formData.shopBusinessCategoryGuid" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="图标" >
|
||||||
|
<UploadImage ref="uploadRef" v-model="formData.shopLogo" :limit="1" :fileSize="5"
|
||||||
|
:drag="true" :isShowTip="false" :isDisabled="true"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="营业执照" >
|
||||||
|
<UploadImage ref="uploadRef" v-model="formData.shopBusinessLicense" :limit="1" :fileSize="5"
|
||||||
|
:drag="true" :isShowTip="false" :isDisabled="true"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="名称" >
|
||||||
|
<el-input v-model="formData.shopName" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item :label-width="labelWidth" label="简介" >
|
||||||
|
<el-input v-model="formData.shopIntro" type="textarea" :rows="5" placeholder="请输入简介" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="排序" >
|
||||||
|
<el-input-number v-model.number="formData.shopSort" controls-position="right" :precision="2" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="销售单量" >
|
||||||
|
<el-input-number v-model.number="formData.shopSalesOrderCount" controls-position="right" :precision="2" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="审核状态" >
|
||||||
|
<el-select v-model="formData.shopAuditStatus" >
|
||||||
|
<el-option v-for="item in audit_status " :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="审核人" >
|
||||||
|
<el-input v-model="formData.shopAuditUserGuid" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import { reactive, ref, watch } from "vue";
|
||||||
|
|
||||||
|
|
||||||
|
// 打开弹窗时回调
|
||||||
|
const openDialog = async () => {
|
||||||
|
await getaudit_status()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const formData = ref({
|
||||||
|
...props.data,
|
||||||
|
});
|
||||||
|
watch(props, async (v) => {
|
||||||
|
formData.value = v.data;
|
||||||
|
});
|
||||||
|
|
||||||
|
// -业务参数
|
||||||
|
// 审核状态字典选项列表
|
||||||
|
const audit_status = ref([]);
|
||||||
|
|
||||||
|
// -业务方法
|
||||||
|
// 字典获取
|
||||||
|
async function getaudit_status() {
|
||||||
|
await proxy.getDicts('audit_status').then((res) => {
|
||||||
|
audit_status.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 基础参数
|
||||||
|
const formRef = ref();
|
||||||
|
const labelWidth = 100;
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
const props = defineProps({
|
||||||
|
modelValue: Boolean,
|
||||||
|
data: Object,
|
||||||
|
done: Function,
|
||||||
|
});
|
||||||
|
const emits = defineEmits(["update:modelValue"]);
|
||||||
|
|
||||||
|
|
||||||
|
// -基础方法
|
||||||
|
const closeDialog = () => {
|
||||||
|
emits("update:modelValue", false);
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
196
src/views/business/ShopManager/Shops/components/EditDialog.vue
Normal file
196
src/views/business/ShopManager/Shops/components/EditDialog.vue
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
<!--
|
||||||
|
* @Descripttion: (店铺/tb_shop 编辑弹窗)
|
||||||
|
* @version: (1.0)
|
||||||
|
* @Author: (黎文豪)
|
||||||
|
* @Date: (2023-06-09)
|
||||||
|
* @LastEditors: (黎文豪)
|
||||||
|
* @LastEditTime: (2023-06-09)
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<el-dialog v-model="props.modelValue" title="修改店铺信息" width="900px" @closed="closeDialog" @open="openDialog">
|
||||||
|
<el-form ref="formRef" :model="formData" :rules="rules">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="用户id" prop="shopUserId">
|
||||||
|
<el-input v-model="formData.shopUserId" placeholder="请输入用户id" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="客户guid" prop="shopCustomerGuid">
|
||||||
|
<el-input v-model="formData.shopCustomerGuid" placeholder="请输入客户guid" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="经营类目guid" prop="shopBusinessCategoryGuid">
|
||||||
|
<el-input v-model="formData.shopBusinessCategoryGuid" placeholder="请输入经营类目guid" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="图标" prop="shopLogo">
|
||||||
|
<UploadImage ref="uploadRef" v-model="formData.shopLogo" :data=imgData :limit="1" :fileSize="5"
|
||||||
|
:drag="true" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="营业执照" prop="shopBusinessLicense">
|
||||||
|
<UploadImage ref="uploadRef" v-model="formData.shopBusinessLicense" :data=imgData :limit="1" :fileSize="5"
|
||||||
|
:drag="true" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="名称" prop="shopName">
|
||||||
|
<el-input v-model="formData.shopName" placeholder="请输入名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item :label-width="labelWidth" label="简介" prop="shopIntro">
|
||||||
|
<el-input v-model="formData.shopIntro" type="textarea" :rows="5" placeholder="请输入简介" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="排序" prop="shopSort">
|
||||||
|
<el-input-number v-model.number="formData.shopSort" controls-position="right" :min="0" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="销售单量" prop="shopSalesOrderCount">
|
||||||
|
<el-input-number v-model.number="formData.shopSalesOrderCount" controls-position="right" :min="0" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="审核状态" prop="shopAuditStatus">
|
||||||
|
<el-select v-model="formData.shopAuditStatus" placeholder="请选择审核状态">
|
||||||
|
<el-option v-for="item in audit_status " :key="item.dictValue" :label="item.dictLabel"
|
||||||
|
:value="parseInt(item.dictValue)"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="审核人" prop="shopAuditUserGuid">
|
||||||
|
<el-input v-model="formData.shopAuditUserGuid" placeholder="请输入审核人" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="handleEditClick(formRef)">编辑</el-button>
|
||||||
|
<el-button @click="handleResetClick(formRef)">重置</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import modal from '@/plugins/modal.js'
|
||||||
|
import { reactive, ref, watch } from "vue";
|
||||||
|
import { addOrUpdateShop } from "@/api/business/ShopManager/Shops/shop.js";
|
||||||
|
|
||||||
|
|
||||||
|
// 打开弹窗时回调
|
||||||
|
const openDialog = async () => {
|
||||||
|
await getaudit_status()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const formData = ref({
|
||||||
|
...props.data,
|
||||||
|
});
|
||||||
|
watch(props, async (v) => {
|
||||||
|
formData.value = v.data;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// 业务参数
|
||||||
|
// 审核状态字典选项列表
|
||||||
|
const audit_status = ref([]);
|
||||||
|
|
||||||
|
// -业务方法
|
||||||
|
//字典获取
|
||||||
|
async function getaudit_status() {
|
||||||
|
await proxy.getDicts('audit_status').then((res) => {
|
||||||
|
audit_status.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -基础参数
|
||||||
|
const props = defineProps({
|
||||||
|
modelValue: Boolean,
|
||||||
|
data: Object,
|
||||||
|
done: Function,
|
||||||
|
});
|
||||||
|
|
||||||
|
const labelWidth = 100;
|
||||||
|
const formRef = ref();
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
const emits = defineEmits(["update:modelValue"]);
|
||||||
|
const imgData = ref({
|
||||||
|
fileDir: "Shop"
|
||||||
|
})
|
||||||
|
|
||||||
|
// 验证
|
||||||
|
const rules = reactive({
|
||||||
|
shopBusinessCategoryGuid: [{ required: true, message: "经营类目guid不能为空", trigger: "blur" }],
|
||||||
|
shopLogo: [{ required: true, message: "图标不能为空", trigger: "blur" }],
|
||||||
|
shopBusinessLicense: [{ required: true, message: "营业执照不能为空", trigger: "blur" }],
|
||||||
|
shopName: [{ required: true, message: "名称不能为空", trigger: "blur" }],
|
||||||
|
shopIntro: [{ required: true, message: "简介不能为空", trigger: "blur" }],
|
||||||
|
shopSort: [{ required: true, message: "排序不能为空", trigger: "blur", type: "number" }],
|
||||||
|
shopSalesOrderCount: [{ required: true, message: "销售单量不能为空", trigger: "blur", type: "number" }],
|
||||||
|
shopAuditStatus: [{ required: true, message: "审核状态不能为空", trigger: "change", type: "number" }],
|
||||||
|
shopAuditUserGuid: [{ required: true, message: "审核人不能为空", trigger: "blur" }],
|
||||||
|
});
|
||||||
|
|
||||||
|
// -基础方法
|
||||||
|
// 提交
|
||||||
|
const handleEditClick = async (formEl) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.validate(async (valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const { code } = await addOrUpdateShop(formData.value);
|
||||||
|
if (code == 200) {
|
||||||
|
modal.msgSuccess('修改成功')
|
||||||
|
closeDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleResetClick = async (formEl) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.resetFields();
|
||||||
|
}
|
||||||
|
const closeDialog = () => {
|
||||||
|
props.done();
|
||||||
|
emits("update:modelValue", false);
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
302
src/views/business/ShopManager/Shops/index.vue
Normal file
302
src/views/business/ShopManager/Shops/index.vue
Normal file
@ -0,0 +1,302 @@
|
|||||||
|
<!--
|
||||||
|
* @Descripttion: (店铺/tb_shop)
|
||||||
|
* @version: (1.0)
|
||||||
|
* @Author: (黎文豪)
|
||||||
|
* @Date: (2023-06-09)
|
||||||
|
* @LastEditors: (黎文豪)
|
||||||
|
* @LastEditTime: (2023-06-09)
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<!-- 搜索框 queryParams.需要搜索的字段 -->
|
||||||
|
<el-form :model="queryParams" label-position="left" style="margin:15px;" inline ref="queryForm" v-show="showSearch"
|
||||||
|
@submit.prevent>
|
||||||
|
<el-form-item label="名称" prop="shopName">
|
||||||
|
<el-input v-model="queryParams.shopName" placeholder="请输入名称" clearable @keyup.enter="handleQuery"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="审核状态" prop="shopAuditStatus">
|
||||||
|
<el-select v-model="queryParams.shopAuditStatus" placeholder="请选择审核状态" clearable @change="handleQuery">
|
||||||
|
<el-option v-for="item in audit_status " :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button icon="search" type="primary" @click="handleQuery">{{ $t('btn.search') }}</el-button>
|
||||||
|
<el-button icon="refresh" @click="resetQuery">{{ $t('btn.reset') }}</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 工具按钮 -->
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" v-hasPermi="['business:shop:addOrUpdateKey']" plain icon="plus" @click="AddDialogVisible = true">
|
||||||
|
{{ $t('btn.add') }}
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" :disabled="multiple" v-hasPermi="['business:shop:delete']" plain icon="delete" @click="handleDelete">
|
||||||
|
{{ $t('btn.delete') }}
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" :disabled="multiple" v-hasPermi="['business:shop:audit']" plain icon="check"
|
||||||
|
@click="handleAudit">审核</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="download" @click="handleExport" v-hasPermi="['business:shop:export']">
|
||||||
|
{{ $t('btn.export') }}
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 表格渲染 prop="对应的字段"-->
|
||||||
|
<el-table v-loading="loading" :data="dataList" ref="tableRef" border highlight-current-row @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="50" align="center" />
|
||||||
|
|
||||||
|
<el-table-column prop="shopUserId" label="用户id" align="center" />
|
||||||
|
<el-table-column prop="shopLogo" label="图标" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-image preview-teleported :hide-on-click-modal="true" lazy class="table-td-thumb" fit="contain" :src="scope.row.shopLogo.split(',')[0]" :preview-src-list="scope.row.shopLogo.split(',')">
|
||||||
|
<div><el-icon :size="15"><document /></el-icon></div>
|
||||||
|
</el-image>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="shopBusinessLicense" label="营业执照" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-image preview-teleported :hide-on-click-modal="true" lazy class="table-td-thumb" fit="contain" :src="scope.row.shopBusinessLicense.split(',')[0]" :preview-src-list="scope.row.shopBusinessLicense.split(',')">
|
||||||
|
<div><el-icon :size="15"><document /></el-icon></div>
|
||||||
|
</el-image>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="shopName" label="名称" align="center" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column prop="shopIntro" label="简介" align="center" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column prop="shopSort" label="排序" align="center" sortable />
|
||||||
|
<el-table-column prop="shopSalesOrderCount" label="销售单量" align="center" sortable />
|
||||||
|
<el-table-column prop="shopAuditStatus" label="审核状态" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options=" audit_status " :value="scope.row.shopAuditStatus" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="操作" width="350" fixed="right">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button type="warning" v-if="scope.row.shopAuditStatus == 1" size="small" icon="check"
|
||||||
|
@click="handleAudit(scope.row)" v-hasPermi="['business:shop:audit']">审核</el-button>
|
||||||
|
<el-button type="primary" v-if="scope.row.shopAuditStatus == 2" size="small" icon="edit" @click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['business:shop:addOrUpdateKey']">编辑</el-button>
|
||||||
|
<el-button type="danger" size="small" icon="delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['business:shop:delete']">删除</el-button>
|
||||||
|
<el-button size="small" icon="view" @click="handleDetail(scope.row)">查看</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
</el-table>
|
||||||
|
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 添加 -->
|
||||||
|
<AddDialog v-model="AddDialogVisible" :done="() => resetQuery()"></AddDialog>
|
||||||
|
<!-- 编辑 -->
|
||||||
|
<EditDialog v-model="EditDialogVisible" :data="EditDialogRow" :done="() => resetQuery()"></EditDialog>
|
||||||
|
<!-- 详情 -->
|
||||||
|
<DetailDialog v-model="DetailDialogVisible" :data="DetailDialogRow" :done="() => resetQuery()"></DetailDialog>
|
||||||
|
</template>
|
||||||
|
<script setup name="shop">
|
||||||
|
import { ElMessageBox } from 'element-plus'
|
||||||
|
import modal from '@/plugins/modal.js'
|
||||||
|
import { exportShop, audit, shopList , delShop } from '@/api/business/ShopManager/Shops/shop.js'
|
||||||
|
import AddDialog from "./components/AddDialog.vue";
|
||||||
|
import EditDialog from "./components/EditDialog.vue";
|
||||||
|
import DetailDialog from "./components/DetailDialog.vue";
|
||||||
|
|
||||||
|
const AddDialogVisible = ref(false);
|
||||||
|
const EditDialogVisible = ref(false);
|
||||||
|
const EditDialogRow = ref({});
|
||||||
|
const DetailDialogVisible = ref(false);
|
||||||
|
const DetailDialogRow = ref({});
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
|
// 选中categoryId数组数组
|
||||||
|
const ids = ref([])
|
||||||
|
// 非单选禁用
|
||||||
|
const single = ref(true)
|
||||||
|
// 非多个禁用
|
||||||
|
const multiple = ref(true)
|
||||||
|
// 显示搜索条件
|
||||||
|
const showSearch = ref(true)
|
||||||
|
// 数据列表
|
||||||
|
const dataList = ref([])
|
||||||
|
// 总记录数
|
||||||
|
const total = ref(0)
|
||||||
|
// 是否加载
|
||||||
|
const loading = ref(true)
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const { queryParams } = toRefs(data)
|
||||||
|
|
||||||
|
// 业务参数
|
||||||
|
|
||||||
|
|
||||||
|
// 业务方法
|
||||||
|
|
||||||
|
// 字典获取
|
||||||
|
const audit_status = ref([]);
|
||||||
|
async function getaudit_status() {
|
||||||
|
await proxy.getDicts('audit_status').then((res) => {
|
||||||
|
audit_status.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
getaudit_status()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//基础方法
|
||||||
|
|
||||||
|
// 查询数据
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
|
||||||
|
|
||||||
|
shopList(queryParams.value).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
loading.value = false;
|
||||||
|
dataList.value = res.data.result;
|
||||||
|
total.value = res.data.totalNum;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 多选框选中数据
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map((item) => item.shopId)
|
||||||
|
single.value = selection.length != 1
|
||||||
|
multiple.value = !selection.length
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置查询操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm('queryForm')
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const Ids = row.shopId || ids.value
|
||||||
|
|
||||||
|
ElMessageBox.confirm("是否确认删除?", "系统提示", {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
return delShop(Ids)
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
handleQuery()
|
||||||
|
modal.msgSuccess("删除成功")
|
||||||
|
})
|
||||||
|
.catch(() => { })
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport(row) {
|
||||||
|
const Ids = row.shopId || ids.value
|
||||||
|
const name = ref("所有")
|
||||||
|
|
||||||
|
if (Ids.length != 0) {
|
||||||
|
let str = ''
|
||||||
|
for (const key in Ids) {
|
||||||
|
str += Ids[key] + ','
|
||||||
|
}
|
||||||
|
str = str.slice(0, str.length - 1)
|
||||||
|
queryParams.value.ids = str
|
||||||
|
name.value = "选中"
|
||||||
|
}
|
||||||
|
|
||||||
|
ElMessageBox.confirm('是否确认导出' + name.value + '数据?', '警告', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
return exportShop(queryParams.value)
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
proxy.download(response.data.path)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 审核按钮操作 */
|
||||||
|
const AuditData = reactive({
|
||||||
|
ids: null,
|
||||||
|
shopAuditStatus: null,
|
||||||
|
})
|
||||||
|
function handleAudit(row) {
|
||||||
|
const Ids = row.shopId || ids.value.toString()
|
||||||
|
|
||||||
|
ElMessageBox.confirm("是否通过审核?", "系统提示", {
|
||||||
|
distinguishCancelAndClose: true,
|
||||||
|
confirmButtonText: '通过',
|
||||||
|
cancelButtonText: '驳回',
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(async () => {
|
||||||
|
AuditData.shopAuditStatus = 2
|
||||||
|
AuditData.ids = Ids
|
||||||
|
Audit()
|
||||||
|
})
|
||||||
|
.catch((action) => {
|
||||||
|
if (action == 'cancel') {
|
||||||
|
AuditData.shopAuditStatus = 3
|
||||||
|
AuditData.ids = Ids
|
||||||
|
Audit()
|
||||||
|
// console.log("拒绝");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// console.log("关闭");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async function Audit() {
|
||||||
|
audit(AuditData).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
handleQuery()
|
||||||
|
ElMessageBox.alert(res.data, "审核信息", {
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改
|
||||||
|
function handleUpdate(row) {
|
||||||
|
EditDialogVisible.value = true
|
||||||
|
EditDialogRow.value = row
|
||||||
|
}
|
||||||
|
|
||||||
|
// 详情
|
||||||
|
function handleDetail(row) {
|
||||||
|
DetailDialogVisible.value = true
|
||||||
|
DetailDialogRow.value = row
|
||||||
|
}
|
||||||
|
|
||||||
|
handleQuery()
|
||||||
|
</script>
|
Loading…
Reference in New Issue
Block a user