feat 初始化商品服务与承诺
This commit is contained in:
parent
793c79d787
commit
0f1977e10d
@ -0,0 +1,46 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Descripttion: 商品服务与承诺Api接口
|
||||||
|
* @version: (1.0)
|
||||||
|
* @Author: (黎文豪)
|
||||||
|
* @Date: (2023-06-18)
|
||||||
|
* @LastEditors: (黎文豪)
|
||||||
|
* @LastEditTime: (2023-06-18)
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 商品服务与承诺分页查询列表
|
||||||
|
export function goodsServicesList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/business/GoodsServices/getGoodsServicesList',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 商品服务与承诺新增或修改
|
||||||
|
export function addOrUpdateGoodsServices(data) {
|
||||||
|
return request({
|
||||||
|
url: '/business/GoodsServices/addOrUpdateGoodsServices',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 商品服务与承诺删除
|
||||||
|
export function delGoodsServices(ids) {
|
||||||
|
return request({
|
||||||
|
url: '/business/GoodsServices/'+ ids,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 商品服务与承诺导出
|
||||||
|
export function exportGoodsServices(query) {
|
||||||
|
return request({
|
||||||
|
url: 'business/GoodsServices/exportGoodsServices',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,176 @@
|
|||||||
|
<!--
|
||||||
|
* @Descripttion: (商品服务与承诺/tb_goods_services 添加弹窗)
|
||||||
|
* @version: (1.0)
|
||||||
|
* @Author: (黎文豪)
|
||||||
|
* @Date: (2023-06-18)
|
||||||
|
* @LastEditors: (黎文豪)
|
||||||
|
* @LastEditTime: (2023-06-18)
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<el-dialog v-model="props.modelValue" title="添加服务与承诺信息" width="600px" @closed="closeDialog" @open="openDialog">
|
||||||
|
<el-form ref="formRef" :model="formData" :rules="rules">
|
||||||
|
|
||||||
|
<el-row :gutter="20" v-if="userid == 1">
|
||||||
|
<el-col :lg="18">
|
||||||
|
<el-form-item :label-width="labelWidth" label="店铺" prop="shopGuid">
|
||||||
|
<el-input v-model='formData.shopName' disabled type="text" placeholder='点击选择店铺'>
|
||||||
|
<template #append>
|
||||||
|
<div @click="handleChooseShop">选择</div>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row :gutter="20">
|
||||||
|
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item :label-width="labelWidth" label="服务名称" prop="goodsServicesName">
|
||||||
|
<el-input v-model="formData.goodsServicesName" placeholder="请输入服务名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item :label-width="labelWidth" label="概述" prop="goodsServicesSummary">
|
||||||
|
<el-input v-model="formData.goodsServicesSummary" type="textarea" :rows="5" placeholder="请输入概述" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="是否默认" prop="goodsServicesIsDefault">
|
||||||
|
<el-radio-group v-model="formData.goodsServicesIsDefault">
|
||||||
|
<el-radio v-for="item in is_default " :key="item.dictValue" :label="parseInt(item.dictValue)">{{
|
||||||
|
item.dictLabel }}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item :label-width="labelWidth" label="显示状态" prop="goodsServicesDisplayStatus">
|
||||||
|
<el-radio-group v-model="formData.goodsServicesDisplayStatus">
|
||||||
|
<el-radio v-for="item in display_status " :key="item.dictValue" :label="parseInt(item.dictValue)">{{
|
||||||
|
item.dictLabel }}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item :label-width="labelWidth" label="排序" prop="goodsServicesSort">
|
||||||
|
<el-input-number v-model.number="formData.goodsServicesSort" controls-position="right" :min="0" />
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<!-- 选择店铺 -->
|
||||||
|
<ChooseShopDialog v-model="ChooseShopDialogVisible" :data="ChooseShopDialogRow"></ChooseShopDialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { reactive, ref, watch } from "vue";
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import modal from '@/plugins/modal.js'
|
||||||
|
import { addOrUpdateGoodsServices } from '@/api/business/GoodsManager/GoodsServicess/goodsServices.js';
|
||||||
|
import useUserStore from '@/store/modules/user'
|
||||||
|
import ChooseShopDialog from './ChooseShopDialog.vue';
|
||||||
|
|
||||||
|
// 打开弹窗时回调
|
||||||
|
const openDialog = async () => {
|
||||||
|
|
||||||
|
await getis_default()
|
||||||
|
await getdisplay_status()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -业务参数
|
||||||
|
// 是否默认字典选项列表
|
||||||
|
const is_default = ref([]);
|
||||||
|
// 显示状态字典选项列表
|
||||||
|
const display_status = ref([]);
|
||||||
|
// 选择店铺弹窗参数
|
||||||
|
const ChooseShopDialogVisible = ref(false);
|
||||||
|
const ChooseShopDialogRow = ref({});
|
||||||
|
const userid = useUserStore().userId
|
||||||
|
|
||||||
|
// -业务方法
|
||||||
|
// 字典获取
|
||||||
|
async function getis_default() {
|
||||||
|
await proxy.getDicts('is_default').then((res) => {
|
||||||
|
is_default.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 字典获取
|
||||||
|
async function getdisplay_status() {
|
||||||
|
await proxy.getDicts('display_status').then((res) => {
|
||||||
|
display_status.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开选择店铺弹窗
|
||||||
|
const handleChooseShop = () => {
|
||||||
|
ChooseShopDialogVisible.value = true
|
||||||
|
ChooseShopDialogRow.value = formData
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -基础参数
|
||||||
|
const labelWidth = 100;
|
||||||
|
const formRef = ref();
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
const emits = defineEmits(["update:modelValue"]);
|
||||||
|
const formData = reactive({
|
||||||
|
goodsServicesIsDefault: 1,
|
||||||
|
goodsServicesDisplayStatus: 1,
|
||||||
|
goodsServicesSort: 100,
|
||||||
|
});
|
||||||
|
const props = defineProps({
|
||||||
|
modelValue: Boolean,
|
||||||
|
done: Function,
|
||||||
|
});
|
||||||
|
const imgData = ref({
|
||||||
|
fileDir: "GoodsServices"
|
||||||
|
})
|
||||||
|
|
||||||
|
// 验证
|
||||||
|
const rules = reactive({
|
||||||
|
shopGuid: [{ required: true, message: "店铺不能为空", trigger: "blur"}],
|
||||||
|
goodsServicesName: [{ required: true, message: "服务名称不能为空", trigger: "blur" }],
|
||||||
|
goodsServicesIsDefault: [{ required: true, message: "是否默认不能为空", trigger: "blur", type: "number" }],
|
||||||
|
goodsServicesDisplayStatus: [{ required: true, message: "显示状态不能为空", trigger: "blur", type: "number" }],
|
||||||
|
goodsServicesSort: [{ required: true, message: "排序不能为空", trigger: "blur", type: "number" }],
|
||||||
|
});
|
||||||
|
|
||||||
|
// -基础方法
|
||||||
|
|
||||||
|
// 提交
|
||||||
|
const handleAddClick = async (formEl) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.validate(async (valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const { code } = await addOrUpdateGoodsServices(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>
|
@ -0,0 +1,117 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog v-model="props.modelValue" title="选择店铺" width="900px" @closed="closeDialog" @open="openDialog">
|
||||||
|
|
||||||
|
<el-form inline :model="queryParams">
|
||||||
|
<el-form-item label="店铺名称">
|
||||||
|
<el-input v-model='queryParams.shopName' placeholder='请输入店铺名称'></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="tableRef.reload()" icon="ElIconSearch">
|
||||||
|
搜索
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 表格渲染 prop="对应的字段"-->
|
||||||
|
<el-table v-loading="loading" :data="shopsList" ref="tableRef" border highlight-current-row
|
||||||
|
@row-click="handleRowClick">
|
||||||
|
<el-table-column prop="shopName" label="店铺名称" align="left" :show-overflow-tooltip="true" />
|
||||||
|
</el-table>
|
||||||
|
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getShopListFun" />
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="handleEditClick()">添加</el-button>
|
||||||
|
<el-button @click="handleResetClick()">重置</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { reactive, ref, watch, nextTick } from 'vue';
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import { shopList } from '@/api/business/ShopManager/Shops/shop.js'
|
||||||
|
|
||||||
|
// 业务参数
|
||||||
|
const total = ref(0)
|
||||||
|
const loading = ref(false)
|
||||||
|
|
||||||
|
// 基础参数
|
||||||
|
const tableRef = ref(null);
|
||||||
|
// 查询参数
|
||||||
|
const queryParams = reactive({
|
||||||
|
shopName: "",
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10
|
||||||
|
});
|
||||||
|
|
||||||
|
const emits = defineEmits(['update:modelValue']);
|
||||||
|
const props = defineProps({
|
||||||
|
modelValue: Boolean,
|
||||||
|
data: Object,
|
||||||
|
});
|
||||||
|
const formData = ref({
|
||||||
|
...props.data
|
||||||
|
});
|
||||||
|
|
||||||
|
let shopsList = ref([]);
|
||||||
|
// 打开窗口时运行
|
||||||
|
const openDialog = async () => {
|
||||||
|
await getShopListFun()
|
||||||
|
}
|
||||||
|
|
||||||
|
const getShopListFun = async () => {
|
||||||
|
loading.value = true
|
||||||
|
await shopList(queryParams).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
shopsList.value = res.data.result
|
||||||
|
total.value = res.totalNum
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(props, (v) => {
|
||||||
|
formData.value = v.data;
|
||||||
|
});
|
||||||
|
|
||||||
|
// -业务方法
|
||||||
|
let shopName = ref("");
|
||||||
|
let shopGuid = ref("");
|
||||||
|
|
||||||
|
|
||||||
|
// -基础方法
|
||||||
|
|
||||||
|
// 点击行
|
||||||
|
const handleRowClick = (row) => {
|
||||||
|
shopName.value = row.shopName
|
||||||
|
shopGuid.value = row.shopGuid
|
||||||
|
}
|
||||||
|
|
||||||
|
const closeDialog = () => {
|
||||||
|
shopName.value = ""
|
||||||
|
emits('update:modelValue', false);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 提交
|
||||||
|
const handleEditClick = async () => {
|
||||||
|
if (shopName.value !== "") {
|
||||||
|
|
||||||
|
formData.value.shopName = shopName.value
|
||||||
|
formData.value.shopGuid = shopGuid.value
|
||||||
|
if (formData.value.shopName != null) {
|
||||||
|
closeDialog();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ElMessage.error("请选择店铺")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleResetClick = async formEl => {
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,123 @@
|
|||||||
|
<!--
|
||||||
|
* @Descripttion: (商品服务与承诺/tb_goods_services 详情弹窗)
|
||||||
|
* @version: (1.0)
|
||||||
|
* @Author: (黎文豪)
|
||||||
|
* @Date: (2023-06-18)
|
||||||
|
* @LastEditors: (黎文豪)
|
||||||
|
* @LastEditTime: (2023-06-18)
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<el-dialog v-model="props.modelValue" title="商品服务与承诺信息详情" width="600px" @closed="closeDialog" @open="openDialog">
|
||||||
|
<el-form ref="formRef" :model="formData" :disabled="true">
|
||||||
|
<el-row :gutter="20" v-if="userid == 1">
|
||||||
|
<el-col :lg="18">
|
||||||
|
<el-form-item :label-width="labelWidth" label="店铺">
|
||||||
|
<el-input v-model='formData.shopName' disabled type="text">
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row :gutter="20">
|
||||||
|
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item :label-width="labelWidth" label="服务名称" >
|
||||||
|
<el-input v-model="formData.goodsServicesName" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item :label-width="labelWidth" label="概述" >
|
||||||
|
<el-input v-model="formData.goodsServicesSummary" type="textarea" :rows="5" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="是否默认" >
|
||||||
|
<el-radio-group v-model="formData.goodsServicesIsDefault">
|
||||||
|
<el-radio v-for="item in is_default " :key="item.dictValue" :label="parseInt(item.dictValue)">{{
|
||||||
|
item.dictLabel }}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item :label-width="labelWidth" label="显示状态" >
|
||||||
|
<el-radio-group v-model="formData.goodsServicesDisplayStatus">
|
||||||
|
<el-radio v-for="item in display_status " :key="item.dictValue" :label="parseInt(item.dictValue)">{{
|
||||||
|
item.dictLabel }}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item :label-width="labelWidth" label="排序" prop="goodsServicesSort">
|
||||||
|
<el-input-number v-model.number="formData.goodsServicesSort" controls-position="right" :min="0" />
|
||||||
|
</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";
|
||||||
|
import useUserStore from '@/store/modules/user'
|
||||||
|
|
||||||
|
|
||||||
|
// 打开弹窗时回调
|
||||||
|
const openDialog = async () => {
|
||||||
|
await getis_default()
|
||||||
|
await getdisplay_status()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const formData = ref({
|
||||||
|
...props.data,
|
||||||
|
});
|
||||||
|
watch(props, async (v) => {
|
||||||
|
formData.value = v.data;
|
||||||
|
});
|
||||||
|
|
||||||
|
// -业务参数
|
||||||
|
// 是否默认字典选项列表
|
||||||
|
const is_default = ref([]);
|
||||||
|
// 显示状态字典选项列表
|
||||||
|
const display_status = ref([]);
|
||||||
|
const userid = useUserStore().userId
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -业务方法
|
||||||
|
// 字典获取
|
||||||
|
async function getis_default() {
|
||||||
|
await proxy.getDicts('is_default').then((res) => {
|
||||||
|
is_default.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 字典获取
|
||||||
|
async function getdisplay_status() {
|
||||||
|
await proxy.getDicts('display_status').then((res) => {
|
||||||
|
display_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>
|
@ -0,0 +1,164 @@
|
|||||||
|
<!--
|
||||||
|
* @Descripttion: (商品服务与承诺/tb_goods_services 编辑弹窗)
|
||||||
|
* @version: (1.0)
|
||||||
|
* @Author: (黎文豪)
|
||||||
|
* @Date: (2023-06-18)
|
||||||
|
* @LastEditors: (黎文豪)
|
||||||
|
* @LastEditTime: (2023-06-18)
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<el-dialog v-model="props.modelValue" title="修改商品服务与承诺信息" width="600px" @closed="closeDialog" @open="openDialog">
|
||||||
|
<el-form ref="formRef" :model="formData" :rules="rules">
|
||||||
|
|
||||||
|
<el-row :gutter="20" v-if="userid == 1">
|
||||||
|
<el-col :lg="18">
|
||||||
|
<el-form-item :label-width="labelWidth" label="店铺">
|
||||||
|
<el-input v-model='formData.shopName' disabled type="text">
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row :gutter="20">
|
||||||
|
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item :label-width="labelWidth" label="服务名称" prop="goodsServicesName">
|
||||||
|
<el-input v-model="formData.goodsServicesName" placeholder="请输入服务名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item :label-width="labelWidth" label="概述" prop="goodsServicesSummary">
|
||||||
|
<el-input v-model="formData.goodsServicesSummary" type="textarea" :rows="5" placeholder="请输入概述" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-form-item :label-width="labelWidth" label="是否默认" prop="goodsServicesIsDefault">
|
||||||
|
<el-radio-group v-model="formData.goodsServicesIsDefault">
|
||||||
|
<el-radio v-for="item in is_default " :key="item.dictValue" :label="parseInt(item.dictValue)">{{
|
||||||
|
item.dictLabel }}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item :label-width="labelWidth" label="显示状态" prop="goodsServicesDisplayStatus">
|
||||||
|
<el-radio-group v-model="formData.goodsServicesDisplayStatus">
|
||||||
|
<el-radio v-for="item in display_status " :key="item.dictValue" :label="parseInt(item.dictValue)">{{
|
||||||
|
item.dictLabel }}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="24">
|
||||||
|
<el-form-item :label-width="labelWidth" label="排序" prop="goodsServicesSort">
|
||||||
|
<el-input-number v-model.number="formData.goodsServicesSort" controls-position="right" :min="0" />
|
||||||
|
</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 { addOrUpdateGoodsServices } from "@/api/business/GoodsManager/GoodsServicess/goodsServices.js";
|
||||||
|
import useUserStore from '@/store/modules/user'
|
||||||
|
|
||||||
|
// 打开弹窗时回调
|
||||||
|
const openDialog = async () => {
|
||||||
|
await getis_default()
|
||||||
|
await getdisplay_status()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const formData = ref({
|
||||||
|
...props.data,
|
||||||
|
});
|
||||||
|
watch(props, async (v) => {
|
||||||
|
formData.value = v.data;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// 业务参数
|
||||||
|
// 是否默认字典选项列表
|
||||||
|
const is_default = ref([]);
|
||||||
|
// 显示状态字典选项列表
|
||||||
|
const display_status = ref([]);
|
||||||
|
|
||||||
|
const userid = useUserStore().userId
|
||||||
|
|
||||||
|
|
||||||
|
// -业务方法
|
||||||
|
//字典获取
|
||||||
|
async function getis_default() {
|
||||||
|
await proxy.getDicts('is_default').then((res) => {
|
||||||
|
is_default.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//字典获取
|
||||||
|
async function getdisplay_status() {
|
||||||
|
await proxy.getDicts('display_status').then((res) => {
|
||||||
|
display_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: "GoodsServices"
|
||||||
|
})
|
||||||
|
|
||||||
|
// 验证
|
||||||
|
const rules = reactive({
|
||||||
|
goodsServicesName: [{ required: true, message: "服务名称不能为空", trigger: "blur" }],
|
||||||
|
goodsServicesIsDefault: [{ required: true, message: "是否默认不能为空", trigger: "blur", type: "number" }],
|
||||||
|
goodsServicesDisplayStatus: [{ required: true, message: "显示状态不能为空", trigger: "blur", type: "number" }],
|
||||||
|
goodsServicesSort: [{ required: true, message: "排序不能为空", trigger: "blur", type: "number" }],
|
||||||
|
});
|
||||||
|
|
||||||
|
// -基础方法
|
||||||
|
// 提交
|
||||||
|
const handleEditClick = async (formEl) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.validate(async (valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const { code } = await addOrUpdateGoodsServices(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>
|
266
src/views/business/GoodsManager/GoodsServicess/index.vue
Normal file
266
src/views/business/GoodsManager/GoodsServicess/index.vue
Normal file
@ -0,0 +1,266 @@
|
|||||||
|
<!--
|
||||||
|
* @Descripttion: (商品服务与承诺/tb_goods_services)
|
||||||
|
* @version: (1.0)
|
||||||
|
* @Author: (黎文豪)
|
||||||
|
* @Date: (2023-06-18)
|
||||||
|
* @LastEditors: (黎文豪)
|
||||||
|
* @LastEditTime: (2023-06-18)
|
||||||
|
-->
|
||||||
|
<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="goodsServicesName">
|
||||||
|
<el-input v-model="queryParams.goodsServicesName" placeholder="请输入服务名称" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否默认" prop="goodsServicesIsDefault">
|
||||||
|
<el-radio-group v-model="queryParams.goodsServicesIsDefault">
|
||||||
|
<el-radio v-for="item in is_default " :key="item.dictValue"
|
||||||
|
:label="item.dictValue">{{ item.dictLabel }}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="显示状态" prop="goodsServicesDisplayStatus">
|
||||||
|
<el-radio-group v-model="queryParams.goodsServicesDisplayStatus">
|
||||||
|
<el-radio v-for="item in display_status " :key="item.dictValue"
|
||||||
|
:label="item.dictValue">{{ item.dictLabel }}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</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:goodsservices:addOrUpdate']" 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:goodsservices:delete']" plain icon="delete"
|
||||||
|
@click="handleDelete">
|
||||||
|
{{ $t('btn.delete') }}
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="download" @click="handleExport"
|
||||||
|
v-hasPermi="['business:goodsservices: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" highlight-current-row
|
||||||
|
@selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="50" align="center" />
|
||||||
|
|
||||||
|
<el-table-column prop="shopName" label="店铺名称" align="center" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column prop="goodsServicesName" label="服务名称" align="center" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column prop="goodsServicesSummary" label="概述" align="center" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column prop="goodsServicesIsDefault" label="是否默认" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="is_default" :value="scope.row.goodsServicesIsDefault" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="goodsServicesDisplayStatus" label="显示状态" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="display_status" :value="scope.row.goodsServicesDisplayStatus" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="goodsServicesSort" label="排序" align="center" sortable />
|
||||||
|
|
||||||
|
<el-table-column label="操作" width="350" fixed="right">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button type="primary" size="small" icon="edit" @click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['business:goodsservices:addOrUpdate']">编辑</el-button>
|
||||||
|
<el-button type="danger" size="small" icon="delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['business:goodsservices: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="goodsservices">
|
||||||
|
import { ElMessageBox } from 'element-plus'
|
||||||
|
import modal from '@/plugins/modal.js'
|
||||||
|
import { exportGoodsServices, goodsServicesList, delGoodsServices } from '@/api/business/GoodsManager/GoodsServicess/goodsServices.js'
|
||||||
|
import AddDialog from "./components/AddDialog.vue";
|
||||||
|
import EditDialog from "./components/EditDialog.vue";
|
||||||
|
import DetailDialog from "./components/DetailDialog.vue";
|
||||||
|
import useUserStore from '@/store/modules/user'
|
||||||
|
|
||||||
|
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 userid = useUserStore().userId
|
||||||
|
|
||||||
|
|
||||||
|
// 业务方法
|
||||||
|
|
||||||
|
// 字典获取
|
||||||
|
const is_default = ref([]);
|
||||||
|
async function getis_default() {
|
||||||
|
await proxy.getDicts('is_default').then((res) => {
|
||||||
|
is_default.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
getis_default()
|
||||||
|
// 字典获取
|
||||||
|
const display_status = ref([]);
|
||||||
|
async function getdisplay_status() {
|
||||||
|
await proxy.getDicts('display_status').then((res) => {
|
||||||
|
display_status.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
getdisplay_status()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//基础方法
|
||||||
|
|
||||||
|
// 查询数据
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
|
||||||
|
|
||||||
|
goodsServicesList(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.goodsServicesId)
|
||||||
|
single.value = selection.length != 1
|
||||||
|
multiple.value = !selection.length
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置查询操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm('queryForm')
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const Ids = row.goodsServicesId || ids.value
|
||||||
|
|
||||||
|
ElMessageBox.confirm("是否确认删除?", "系统提示", {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
return delGoodsServices(Ids)
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
handleQuery()
|
||||||
|
modal.msgSuccess("删除成功")
|
||||||
|
})
|
||||||
|
.catch(() => { })
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport(row) {
|
||||||
|
const Ids = row.goodsServicesId || 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 exportGoodsServices(queryParams.value)
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
proxy.download(response.data.path)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 修改
|
||||||
|
function handleUpdate(row) {
|
||||||
|
EditDialogVisible.value = true
|
||||||
|
EditDialogRow.value = row
|
||||||
|
}
|
||||||
|
|
||||||
|
// 详情
|
||||||
|
function handleDetail(row) {
|
||||||
|
DetailDialogVisible.value = true
|
||||||
|
DetailDialogRow.value = row
|
||||||
|
}
|
||||||
|
|
||||||
|
handleQuery()
|
||||||
|
</script>
|
@ -79,8 +79,8 @@
|
|||||||
import { reactive, ref, watch } from "vue";
|
import { reactive, ref, watch } from "vue";
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import modal from '@/plugins/modal.js'
|
import modal from '@/plugins/modal.js'
|
||||||
import useUserStore from '@/store/modules/user'
|
|
||||||
import { shopGoodsCategoryTreeList, addOrUpdateShopGoodsCategory } from '@/api/business/GoodsManager/ShopGoodsCategorys/shopGoodsCategory.js';
|
import { shopGoodsCategoryTreeList, addOrUpdateShopGoodsCategory } from '@/api/business/GoodsManager/ShopGoodsCategorys/shopGoodsCategory.js';
|
||||||
|
import useUserStore from '@/store/modules/user'
|
||||||
import ChooseShopDialog from './ChooseShopDialog.vue';
|
import ChooseShopDialog from './ChooseShopDialog.vue';
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user