250108
This commit is contained in:
+13
-126
@@ -91,18 +91,14 @@
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import GoodsEdit from './components/goodsEdit.vue';
|
||||
import {
|
||||
pageGoods,
|
||||
removeGoods,
|
||||
removeBatchGoods,
|
||||
updateGoods
|
||||
} from '@/api/shop/goods';
|
||||
|
||||
import type { Goods, GoodsParam } from '@/api/shop/goods/model';
|
||||
import { formatNumber } from 'ele-admin-pro/es';
|
||||
import router from '@/router';
|
||||
import { openSpmUrl, openUrl } from '@/utils/common';
|
||||
import { getSiteDomain } from '@/utils/domain';
|
||||
import { getMerchantId } from '@/utils/merchant';
|
||||
import { pageThinkGoods, removeBatchThinkGoods, removeThinkGoods, updateThinkGoods } from "@/api/think/thinkGoods";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
@@ -115,8 +111,6 @@
|
||||
const showEdit = ref(false);
|
||||
// 是否显示批量移动弹窗
|
||||
const showMove = ref(false);
|
||||
// 网站域名
|
||||
const domain = getSiteDomain();
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
@@ -130,7 +124,7 @@
|
||||
where.status = filters.status;
|
||||
}
|
||||
where.merchantId = getMerchantId();
|
||||
return pageGoods({
|
||||
return pageThinkGoods({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
@@ -141,7 +135,7 @@
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '22商品ID',
|
||||
title: '商品ID',
|
||||
dataIndex: 'goodsId',
|
||||
key: 'goodsId',
|
||||
align: 'center',
|
||||
@@ -149,37 +143,9 @@
|
||||
},
|
||||
{
|
||||
title: '商品名称',
|
||||
dataIndex: 'goodsName',
|
||||
key: 'goodsName',
|
||||
dataIndex: 'title',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '商品图片',
|
||||
dataIndex: 'image',
|
||||
key: 'image',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '所属门店',
|
||||
dataIndex: 'merchantName',
|
||||
key: 'merchantName',
|
||||
ellipsis: true,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '商品编码',
|
||||
dataIndex: 'code',
|
||||
key: 'code',
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '分类ID',
|
||||
dataIndex: 'categoryId',
|
||||
@@ -187,38 +153,9 @@
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '一级分类',
|
||||
dataIndex: 'categoryParent',
|
||||
key: 'categoryParent',
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '二级分类',
|
||||
dataIndex: 'categoryChildren',
|
||||
key: 'categoryChildren',
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '多规格',
|
||||
dataIndex: 'specs',
|
||||
key: 'specs',
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '货架',
|
||||
dataIndex: 'position',
|
||||
key: 'position',
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '商品价格',
|
||||
dataIndex: 'salePrice',
|
||||
key: 'salePrice',
|
||||
dataIndex: 'linePrice',
|
||||
sorter: true,
|
||||
align: 'center'
|
||||
},
|
||||
@@ -229,60 +166,9 @@
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '库存计算方式',
|
||||
dataIndex: 'deductStockType',
|
||||
key: 'deductStockType',
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '销量',
|
||||
dataIndex: 'sales',
|
||||
key: 'sales',
|
||||
sorter: true,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '库存',
|
||||
dataIndex: 'stock',
|
||||
key: 'stock',
|
||||
sorter: true,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '商品重量',
|
||||
dataIndex: 'goodsWeight',
|
||||
key: 'goodsWeight',
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '推荐',
|
||||
dataIndex: 'recommend',
|
||||
key: 'recommend',
|
||||
sorter: true,
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '商户ID',
|
||||
dataIndex: 'merchantId',
|
||||
key: 'merchantId',
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'isShow',
|
||||
key: 'isShow',
|
||||
sorter: true,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '排序号',
|
||||
dataIndex: 'sortNumber',
|
||||
key: 'sortNumber',
|
||||
dataIndex: 'sort',
|
||||
sorter: true,
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
@@ -293,7 +179,8 @@
|
||||
key: 'createTime',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
sorter: true
|
||||
sorter: true,
|
||||
customRender: ({text}) => dayjs(text * 1000).format('YYYY-MM-DD HH:mm')
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
@@ -324,7 +211,7 @@
|
||||
|
||||
const onUpdate = (row?: Goods) => {
|
||||
const isShow = row?.isShow == 0 ? 1 : 0;
|
||||
updateGoods({ ...row, isShow }).then((msg) => {
|
||||
updateThinkGoods({ ...row, isShow }).then((msg) => {
|
||||
message.success(msg);
|
||||
reload();
|
||||
});
|
||||
@@ -333,7 +220,7 @@
|
||||
/* 删除单个 */
|
||||
const remove = (row: Goods) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeGoods(row.goodsId)
|
||||
removeThinkGoods(row.goodsId)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
@@ -358,7 +245,7 @@
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchGoods(selection.value.map((d) => d.goodsId))
|
||||
removeBatchThinkGoods(selection.value.map((d) => d.goodsId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="600"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:title="isUpdate ? '发货' : '发货'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="物流公司" name="expressName">
|
||||
<SelectExpress
|
||||
:placeholder="`选择物流公司`"
|
||||
v-model:value="form.expressName"
|
||||
@done="chooseExpressId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="快递单号" name="expressNo">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="快递单号"
|
||||
v-model:value="form.expressNo"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject } from 'ele-admin-pro';
|
||||
import { Order } from '@/api/shop/order/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { OrderDelivery } from '@/api/shop/orderDelivery/model';
|
||||
import { Express } from '@/api/shop/express/model';
|
||||
import {
|
||||
addOrderDelivery,
|
||||
updateOrderDelivery
|
||||
} from '@/api/shop/orderDelivery';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
|
||||
const useForm = Form.useForm;
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: Order | null;
|
||||
}>();
|
||||
|
||||
export interface step {
|
||||
title?: String | undefined;
|
||||
subTitle?: String | undefined;
|
||||
description?: String | undefined;
|
||||
}
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
expressName: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请选择物流公司',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
expressNo: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写快递单号',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 订单信息
|
||||
const form = reactive<OrderDelivery>({
|
||||
deliveryId: undefined,
|
||||
orderId: undefined,
|
||||
deliveryMethod: undefined,
|
||||
packMethod: undefined,
|
||||
expressId: undefined,
|
||||
expressName: undefined,
|
||||
expressNo: undefined,
|
||||
eorderHtml: undefined,
|
||||
sortNumber: undefined,
|
||||
tenantId: undefined
|
||||
});
|
||||
|
||||
// 请求状态
|
||||
const loading = ref(true);
|
||||
// 表格选中数据
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
const chooseExpressId = (data: Express) => {
|
||||
form.expressName = data.expressName;
|
||||
form.expressId = data.expressId;
|
||||
};
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value
|
||||
? updateOrderDelivery
|
||||
: addOrderDelivery;
|
||||
saveOrUpdate(formData)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
if (props.data) {
|
||||
loading.value = true;
|
||||
assignObject(form, props.data);
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
@@ -219,7 +219,7 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<OrderInfo v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<!-- 发货弹窗 -->
|
||||
<Delivery v-model:visible="showDelivery" :data="current" @done="reload" />
|
||||
<!-- <Delivery v-model:visible="showDelivery" :data="current" @done="reload" />-->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -232,7 +232,6 @@
|
||||
CheckOutlined,
|
||||
CloseOutlined,
|
||||
AlipayCircleOutlined,
|
||||
EllipsisOutlined,
|
||||
DownOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
|
||||
@@ -243,7 +242,6 @@
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import OrderInfo from './components/orderInfo.vue';
|
||||
import Delivery from './components/delivery.vue';
|
||||
import { pageOrder, removeOrder, removeBatchOrder } from '@/api/shop/order';
|
||||
import type { Order, OrderParam } from '@/api/shop/order/model';
|
||||
import { formatNumber } from 'ele-admin-pro/es';
|
||||
|
||||
Reference in New Issue
Block a user