feat(shop): 添加企业微信ID字段支持
为商品和商店相关接口及页面添加corpid字段,支持企业微信集成 在表单和查询中自动填充当前企业微信ID 修改商品搜索输入框支持回车触发查询
This commit is contained in:
parent
128afe950e
commit
15bb35c029
|
@ -1,12 +1,19 @@
|
|||
import { http } from "@/utils/http";
|
||||
|
||||
export interface GoodsQuery extends BasePageQuery {
|
||||
/** 商品名称 */
|
||||
goodsName?: string;
|
||||
categoryId?: number;
|
||||
/** 商品状态(0下架 1上架) */
|
||||
status?: number;
|
||||
/** 商品ID */
|
||||
goodsId?: number;
|
||||
/** 自动审批开关(0关闭 1开启) */
|
||||
autoApproval?: number;
|
||||
/** 所属类型(0智借还 1固资通) */
|
||||
belongType?: number;
|
||||
/** 企业微信ID */
|
||||
corpid: string;
|
||||
}
|
||||
|
||||
/** 商品DTO */
|
||||
|
@ -17,6 +24,8 @@ export interface GoodsDTO {
|
|||
goodsName: string;
|
||||
/** 商品分类ID */
|
||||
categoryId: number;
|
||||
/** 企业微信ID */
|
||||
corpid: string;
|
||||
/** 商品价格 */
|
||||
price: number;
|
||||
/** 库存数量 */
|
||||
|
@ -68,6 +77,8 @@ export interface GoodsRequest {
|
|||
remark?: string;
|
||||
/** 商品使用说明 */
|
||||
usageInstruction?: string;
|
||||
/** 企业微信ID */
|
||||
corpid: string;
|
||||
}
|
||||
|
||||
/** 获取商品列表 */
|
||||
|
|
|
@ -3,21 +3,25 @@ import { http } from '@/utils/http';
|
|||
/** 商店分页查询参数 */
|
||||
export interface ShopQuery extends BasePageQuery {
|
||||
shopName?: string;
|
||||
corpid?: string;
|
||||
}
|
||||
|
||||
/** 商店DTO */
|
||||
export interface ShopDTO {
|
||||
shopId: number;
|
||||
shopName: string;
|
||||
corpid?: string;
|
||||
}
|
||||
|
||||
/** 新增商店命令 */
|
||||
export interface AddShopCommand {
|
||||
shopName: string;
|
||||
corpid: string;
|
||||
}
|
||||
|
||||
/** 更新商店命令 */
|
||||
export interface UpdateShopCommand {
|
||||
corpid: string;
|
||||
shopId: number;
|
||||
shopName: string;
|
||||
}
|
||||
|
|
|
@ -13,11 +13,13 @@ import { ElMessage, ElMessageBox } from "element-plus";
|
|||
import ShopFormModal from "./shop-form-modal.vue";
|
||||
import ReQrcode from "@/components/ReQrcode";
|
||||
import { copyTextToClipboard } from "@pureadmin/utils";
|
||||
import { useWxStore } from "@/store/modules/wx";
|
||||
|
||||
defineOptions({
|
||||
name: "Shop"
|
||||
});
|
||||
|
||||
const wxStore = useWxStore();
|
||||
const formRef = ref();
|
||||
const tableRef = ref();
|
||||
const modalVisible = ref(false);
|
||||
|
@ -28,6 +30,7 @@ const handleRefresh = () => {
|
|||
};
|
||||
|
||||
const searchFormParams = ref<ShopQuery>({
|
||||
corpid: wxStore.corpid,
|
||||
shopName: ""
|
||||
});
|
||||
|
||||
|
@ -48,6 +51,7 @@ const getList = async () => {
|
|||
loading.value = true;
|
||||
const { data } = await getShopList({
|
||||
...searchFormParams.value,
|
||||
corpid: wxStore.corpid,
|
||||
pageSize: pagination.value.pageSize,
|
||||
pageNum: pagination.value.currentPage
|
||||
});
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, watch } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { addShop, updateShop, ShopDTO, UpdateShopCommand } from "@/api/shop/shop";
|
||||
import { addShop, updateShop, ShopDTO, UpdateShopCommand, AddShopCommand } from "@/api/shop/shop";
|
||||
import { useWxStore } from "@/store/modules/wx";
|
||||
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
|
@ -16,8 +17,11 @@ const props = defineProps({
|
|||
|
||||
const emit = defineEmits(["update:visible", "refresh"]);
|
||||
|
||||
const wxStore = useWxStore();
|
||||
|
||||
const formRef = ref();
|
||||
const formData = ref<UpdateShopCommand>({
|
||||
corpid: wxStore.corpid,
|
||||
shopId: 0,
|
||||
shopName: ""
|
||||
});
|
||||
|
@ -33,12 +37,14 @@ watch(
|
|||
if (props.row?.shopId) {
|
||||
formData.value = {
|
||||
...props.row,
|
||||
shopId: props.row.shopId
|
||||
shopId: props.row.shopId,
|
||||
corpid: props.row.corpid,
|
||||
};
|
||||
} else {
|
||||
formData.value = {
|
||||
shopId: 0,
|
||||
shopName: ""
|
||||
shopName: "",
|
||||
corpid: wxStore.corpid
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,7 +95,8 @@ defineExpose({ getList });
|
|||
<div class="config-modal">
|
||||
<el-form :inline="true" :model="searchFormParams" class="search-form">
|
||||
<el-form-item>
|
||||
<el-input v-model="searchFormParams.goodsName" placeholder="请输入商品名称" clearable />
|
||||
<el-input @keydown.enter.prevent="getList" v-model="searchFormParams.goodsName" placeholder="请输入商品名称"
|
||||
clearable />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="状态:">
|
||||
<el-select v-model="searchFormParams.status" placeholder="请选择状态" clearable>
|
||||
|
|
|
@ -31,7 +31,8 @@ const goodsInfo = ref<GoodsDTO>({
|
|||
autoApproval: 0,
|
||||
coverImg: "",
|
||||
goodsDetail: "",
|
||||
belongType: 0
|
||||
belongType: 0,
|
||||
corpid: ""
|
||||
});
|
||||
const loading = ref(false);
|
||||
const activeTab = ref('basic');
|
||||
|
|
|
@ -6,6 +6,7 @@ import { addGoodsApi, GoodsDTO } from "@/api/shop/goods";
|
|||
import { CategoryDTO, getCategoryAllApi } from "@/api/shop/category";
|
||||
import Confirm from "@iconify-icons/ep/check";
|
||||
import Upload from "@iconify-icons/ep/upload";
|
||||
import { useWxStore } from "@/store/modules/wx";
|
||||
const { VITE_APP_BASE_API } = import.meta.env;
|
||||
|
||||
const props = defineProps({
|
||||
|
@ -17,6 +18,7 @@ const props = defineProps({
|
|||
|
||||
const emit = defineEmits(["update:visible", "refresh"]);
|
||||
|
||||
const wxStore = useWxStore();
|
||||
const formRef = ref();
|
||||
const formData = reactive<GoodsDTO>({
|
||||
goodsName: "",
|
||||
|
@ -27,7 +29,9 @@ const formData = reactive<GoodsDTO>({
|
|||
categoryId: 0,
|
||||
goodsDetail: "",
|
||||
coverImg: "",
|
||||
usageInstruction: ""
|
||||
usageInstruction: "",
|
||||
belongType: 0,
|
||||
corpid: wxStore.corpid
|
||||
});
|
||||
|
||||
const rules = reactive<FormRules>({
|
||||
|
@ -48,6 +52,7 @@ const rules = reactive<FormRules>({
|
|||
const handleConfirm = async () => {
|
||||
try {
|
||||
await formRef.value.validate();
|
||||
formData.corpid = wxStore.corpid;
|
||||
await addGoodsApi(formData);
|
||||
ElMessage.success("商品添加成功");
|
||||
emit("refresh");
|
||||
|
|
|
@ -16,11 +16,13 @@ import { ElMessage, ElMessageBox } from "element-plus";
|
|||
import { deleteGoodsApi } from "@/api/shop/goods";
|
||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useWxStore } from "@/store/modules/wx";
|
||||
|
||||
defineOptions({
|
||||
name: "ShopGoods"
|
||||
});
|
||||
|
||||
const wxStore = useWxStore();
|
||||
const router = useRouter();
|
||||
const formRef = ref();
|
||||
const tableRef = ref();
|
||||
|
@ -28,6 +30,7 @@ const modalVisible = ref(false);
|
|||
|
||||
// 搜索表单
|
||||
const searchFormParams = ref({
|
||||
corpid: wxStore.corpid,
|
||||
belongType: null,
|
||||
goodsName: "",
|
||||
status: null
|
||||
|
@ -52,6 +55,7 @@ const getList = async () => {
|
|||
loading.value = true;
|
||||
const { data } = await getGoodsListApi({
|
||||
...searchFormParams.value,
|
||||
corpid: wxStore.corpid,
|
||||
pageSize: pagination.value.pageSize,
|
||||
pageNum: pagination.value.currentPage
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue