提交
This commit is contained in:
parent
bf82e71e85
commit
b30fdabd8f
@ -1052,7 +1052,11 @@ const printNew = async () => {
|
||||
const LODOP = (await createPrintTask(expressType.value, res.data)) as LODOPObject;
|
||||
LODOP.SET_PRINTER_INDEX(printerData.value);
|
||||
LODOP.PRINT();
|
||||
faHuo('POSTBBZ', res.data.waybillNo, currentItem.erpOrderId);
|
||||
if (expressType.value == 'YZXB') {
|
||||
faHuo('POSTBBZ', res.data.waybillNo, currentItem.erpOrderId);
|
||||
} else {
|
||||
faHuo(expressType.value, res.data.waybillNo, currentItem.erpOrderId);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
buttonLoading.value = false;
|
||||
@ -1077,7 +1081,11 @@ const printNew = async () => {
|
||||
const LODOP = (await createPrintTask(expressType.value, res.data)) as LODOPObject;
|
||||
LODOP.SET_PRINTER_INDEX(printerData.value);
|
||||
LODOP.PRINT();
|
||||
faHuo('POSTBBZ', res.data.waybillNo, erpOrderId.value);
|
||||
if (expressType.value == 'YZXB') {
|
||||
faHuo('POSTBBZ', res.data.waybillNo, erpOrderId.value);
|
||||
} else {
|
||||
faHuo(expressType.value, res.data.waybillNo, erpOrderId.value);
|
||||
}
|
||||
buttonLoading.value = false;
|
||||
dialogCompany.visible = false;
|
||||
getList();
|
||||
@ -1266,7 +1274,7 @@ const getFastMailLabel = (item) => {
|
||||
return '协议客户号:' + item.partnerId;
|
||||
} else if (item.type == 'JTSD') {
|
||||
return '客户编码:' + item.partnerId + ' 客户密码:' + item.secret;
|
||||
}else if (item.type == 'YTO') {
|
||||
} else if (item.type == 'YTO') {
|
||||
return '商家代码:' + item.partnerId + ' 商家秘钥:' + item.secret;
|
||||
}
|
||||
} else if (item.fastMailType == '2') {
|
||||
|
||||
@ -23,10 +23,14 @@
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['zhishu:warehouseSettings:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['zhishu:warehouseSettings:edit']">修改</el-button>
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['zhishu:warehouseSettings:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['zhishu:warehouseSettings:remove']">删除</el-button>
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['zhishu:warehouseSettings:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
@ -36,43 +40,42 @@
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="" align="center" prop="id" v-if="false" />
|
||||
<el-table-column label="设置模板名称" align="center" prop="settingName" />
|
||||
<el-table-column label="库存同步形式" align="center" prop="stockSynchronizeType" >
|
||||
<el-table-column label="库存同步形式" align="center" prop="stockSynchronizeType">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.stockSynchronizeType === 0">下单减库存</span>
|
||||
<span v-else-if="scope.row.stockSynchronizeType === 1">支付减库存</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="自动下发" align="center" prop="autoIssue" >
|
||||
<el-table-column label="自动下发" align="center" prop="autoIssue">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.autoIssue === 0">关闭</span>
|
||||
<span v-else-if="scope.row.autoIssue === 1">开启</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="亏损保护" align="center" prop="lossProtection" >
|
||||
<el-table-column label="亏损保护" align="center" prop="lossProtection">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.lossProtection === 0">关闭</span>
|
||||
<span v-else-if="scope.row.lossProtection === 1">开启</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="退款自动回退库存" align="center" prop="stockRollback" >
|
||||
<el-table-column label="退款自动回退库存" align="center" prop="stockRollback">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.stockRollback === 0">关闭</span>
|
||||
<span v-else-if="scope.row.stockRollback === 1">开启</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status" >
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="t_is_open" :value="scope.row.status" @click="clickStatus(scope.row)" style="cursor: pointer;" />
|
||||
<dict-tag :options="t_is_open" :value="scope.row.status" @click="clickStatus(scope.row)" style="cursor: pointer" />
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createAt" >
|
||||
<el-table-column label="创建时间" align="center" prop="createAt">
|
||||
<template #default="scope">
|
||||
{{ formatTimestamp(scope.row.createAt) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="修改时间" align="center" prop="updateAt" >
|
||||
<template #default="scope">
|
||||
<el-table-column label="修改时间" align="center" prop="updateAt">
|
||||
<template #default="scope">
|
||||
{{ formatTimestamp(scope.row.updateAt) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -82,7 +85,13 @@
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['zhishu:warehouseSettings:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['zhishu:warehouseSettings:remove']"></el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['zhishu:warehouseSettings:remove']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -91,66 +100,43 @@
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</el-card>
|
||||
|
||||
<!-- 新增修改弹窗 -->
|
||||
<!-- 新增修改弹窗 -->
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" @close="resetFormData" width="672px" append-to-body>
|
||||
<el-form ref="priceTemplateFormRef" :model="form" :rules="rules" >
|
||||
|
||||
<div class="headClass" style="margin-top:10px">
|
||||
基本规则
|
||||
</div>
|
||||
<el-divider style="color:black"/>
|
||||
|
||||
<el-form-item label="应用店铺" prop="templateName" label-width="100px">
|
||||
<el-select-v2
|
||||
v-model="chooseShopList"
|
||||
:options="shopList"
|
||||
multiple
|
||||
clearable
|
||||
collapse-tags
|
||||
placeholder="选择应用的店铺"
|
||||
popper-class="custom-header"
|
||||
:max-collapse-tags="1"
|
||||
style="width: 240px"
|
||||
>
|
||||
<template #header>
|
||||
<el-checkbox
|
||||
v-model="checkAll"
|
||||
:indeterminate="indeterminate"
|
||||
@change="handleCheckAll"
|
||||
>
|
||||
全选
|
||||
</el-checkbox>
|
||||
</template>
|
||||
</el-select-v2>
|
||||
</el-form-item>
|
||||
|
||||
<el-form ref="priceTemplateFormRef" :model="form" :rules="rules">
|
||||
<div class="headClass" style="margin-top: 10px">基本规则</div>
|
||||
<el-divider style="color: black" />
|
||||
|
||||
<el-form-item label="应用店铺" prop="templateName" label-width="100px">
|
||||
<el-select-v2
|
||||
v-model="chooseShopList"
|
||||
:options="shopList"
|
||||
multiple
|
||||
clearable
|
||||
collapse-tags
|
||||
placeholder="选择应用的店铺"
|
||||
popper-class="custom-header"
|
||||
:max-collapse-tags="1"
|
||||
style="width: 240px"
|
||||
>
|
||||
<template #header>
|
||||
<el-checkbox v-model="checkAll" :indeterminate="indeterminate" @change="handleCheckAll"> 全选 </el-checkbox>
|
||||
</template>
|
||||
</el-select-v2>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="规则模板名称" prop="templateName" label-width="100px">
|
||||
<el-input v-model="form.settingName" style="width: 300px" placeholder="请输入模板名称" />
|
||||
</el-form-item>
|
||||
|
||||
|
||||
|
||||
<el-form-item
|
||||
label="库存同步形式"
|
||||
prop="stockSynchronizeType"
|
||||
label-width="100px"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-form-item label="库存同步形式" prop="stockSynchronizeType" label-width="100px" style="width: 100%">
|
||||
<el-radio-group v-model="form.stockSynchronizeType">
|
||||
<el-radio :key="0" :value="0" disabled>下单减库存</el-radio>
|
||||
<el-radio :key="1" :value="1">支付减库存</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<div style="color:red;margin-top:-25px;font-size:12px;margin-left:2px;margin-bottom:10px">下单减库存功能暂未开放</div>
|
||||
<div style="color: red; margin-top: -25px; font-size: 12px; margin-left: 2px; margin-bottom: 10px">下单减库存功能暂未开放</div>
|
||||
|
||||
<el-form-item
|
||||
label="开启自动下发"
|
||||
prop="autoIssue"
|
||||
label-width="100px"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-form-item label="开启自动下发" prop="autoIssue" label-width="100px" style="width: 100%">
|
||||
<el-radio-group v-model="form.autoIssue">
|
||||
<el-radio :key="0" :value="0">否</el-radio>
|
||||
<el-radio :key="1" :value="1">是</el-radio>
|
||||
@ -158,103 +144,90 @@
|
||||
</el-form-item>
|
||||
|
||||
<div v-if="form.autoIssue == 1">
|
||||
<div class="headClass">
|
||||
商品匹配规则
|
||||
</div>
|
||||
<div class="headClass">商品匹配规则</div>
|
||||
<el-divider />
|
||||
<el-form-item
|
||||
label="开启亏损保护"
|
||||
prop="lossProtection"
|
||||
label-width="100px"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-radio-group v-model="form.lossProtection">
|
||||
<el-radio :key="0" :value="0">否</el-radio>
|
||||
<el-radio :key="1" :value="1">是</el-radio>
|
||||
</el-radio-group>
|
||||
|
||||
<el-input v-if="form.lossProtection == 1"
|
||||
v-model="form.profitFloor"
|
||||
placeholder="请输入利润下限"
|
||||
type="number"
|
||||
style="width:150px;margin-left:20px"
|
||||
/>
|
||||
|
||||
</el-form-item>
|
||||
|
||||
<el-table :data="form.ruleList" border style="width: 100%" :cell-style="() => ({ padding: '2px' })">
|
||||
|
||||
<!-- 规则内容 -->
|
||||
<el-table-column label="规则名称" align="center" width="300">
|
||||
<template #default="scope">
|
||||
<el-form-item>
|
||||
<el-select v-model="scope.row.attributeId" placeholder="请选择规则" clearable @change="ruleIdChange(scope.row)">
|
||||
<el-option v-for="attribute in attributeList" :key="attribute.id" :label="attribute.attributeName" :value="attribute.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规则内容" align="center" width="190">
|
||||
<template #default="scope">
|
||||
<el-form-item>
|
||||
<el-select v-if="scope.row.attributeId == '1'" v-model="scope.row.attributeValue" placeholder="请选择规则值" clearable >
|
||||
<el-option :key="'0'" :label="'货号优先匹配'" :value="'0'"/>
|
||||
<el-option :key="'1'" :label="'ISBN优先匹配'" :value="'1'"/>
|
||||
</el-select>
|
||||
<el-select v-else-if="scope.row.attributeId == '4'" v-model="scope.row.attributeValue" placeholder="请选择发货地" clearable :loading="loading">
|
||||
<el-option v-for="item in districtList" :key="item.id" :label="item.name" :value="item.name" />
|
||||
</el-select>
|
||||
|
||||
<el-select v-else-if="scope.row.attributeId == '6'" v-model="scope.row.attributeValue" placeholder="请选择品相" clearable :loading="loading">
|
||||
<el-option v-for="item in conditionCodeList" :key="item.id" :label="item.value" :value="item.id" />
|
||||
</el-select>
|
||||
|
||||
<el-input v-else
|
||||
v-model="scope.row.attributeValue"
|
||||
placeholder="请输入规则内容"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 操作列 -->
|
||||
<el-table-column label="操作" align="center" width="120">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-if="scope.$index > 0"
|
||||
type="danger"
|
||||
icon="Minus"
|
||||
circle
|
||||
@click="removeAdjustment(scope.$index)"
|
||||
/>
|
||||
<el-button
|
||||
v-if="scope.$index === form.ruleList.length - 1 && form.ruleList.length < 30"
|
||||
type="primary"
|
||||
icon="Plus"
|
||||
circle
|
||||
@click="addAdjustment"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div class="headClass">
|
||||
退货规则<span style="color:red;font-size:15px">(仅针对未发货订单退款,自动回退库存)</span>
|
||||
</div>
|
||||
<el-divider />
|
||||
|
||||
<el-form-item
|
||||
label="退款后是否自动回退库存"
|
||||
prop="stockRollback"
|
||||
label-width="170px"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-radio-group v-model="form.stockRollback">
|
||||
<el-form-item label="开启亏损保护" prop="lossProtection" label-width="100px" style="width: 100%">
|
||||
<el-radio-group v-model="form.lossProtection">
|
||||
<el-radio :key="0" :value="0">否</el-radio>
|
||||
<el-radio :key="1" :value="1">是</el-radio>
|
||||
</el-radio-group>
|
||||
|
||||
<el-input
|
||||
v-if="form.lossProtection == 1"
|
||||
v-model="form.profitFloor"
|
||||
placeholder="请输入利润下限"
|
||||
type="number"
|
||||
style="width: 150px; margin-left: 20px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-table :data="form.ruleList" border style="width: 100%" :cell-style="() => ({ padding: '2px' })">
|
||||
<!-- 规则内容 -->
|
||||
<el-table-column label="规则名称" align="center" width="300">
|
||||
<template #default="scope">
|
||||
<el-form-item>
|
||||
<el-select v-model="scope.row.attributeId" placeholder="请选择规则" clearable @change="ruleIdChange(scope.row)">
|
||||
<el-option v-for="attribute in attributeList" :key="attribute.id" :label="attribute.attributeName" :value="attribute.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规则内容" align="center" width="190">
|
||||
<template #default="scope">
|
||||
<el-form-item>
|
||||
<el-select v-if="scope.row.attributeId == '1'" v-model="scope.row.attributeValue" placeholder="请选择规则值" clearable>
|
||||
<el-option :key="'0'" :label="'货号优先匹配'" :value="'0'" />
|
||||
<el-option :key="'1'" :label="'ISBN优先匹配'" :value="'1'" />
|
||||
</el-select>
|
||||
<el-select
|
||||
v-else-if="scope.row.attributeId == '4'"
|
||||
v-model="scope.row.attributeValue"
|
||||
placeholder="请选择发货地"
|
||||
clearable
|
||||
:loading="loading"
|
||||
>
|
||||
<el-option v-for="item in districtList" :key="item.id" :label="item.name" :value="item.name" />
|
||||
</el-select>
|
||||
|
||||
<el-select
|
||||
v-else-if="scope.row.attributeId == '6'"
|
||||
v-model="scope.row.attributeValue"
|
||||
placeholder="请选择品相"
|
||||
clearable
|
||||
:loading="loading"
|
||||
>
|
||||
<el-option v-for="item in conditionCodeList" :key="item.id" :label="item.value" :value="item.id" />
|
||||
</el-select>
|
||||
|
||||
<el-input v-else v-model="scope.row.attributeValue" placeholder="请输入规则内容" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 操作列 -->
|
||||
<el-table-column label="操作" align="center" width="120">
|
||||
<template #default="scope">
|
||||
<el-button v-if="scope.$index > 0" type="danger" icon="Minus" circle @click="removeAdjustment(scope.$index)" />
|
||||
<el-button
|
||||
v-if="scope.$index === form.ruleList.length - 1 && form.ruleList.length < 30"
|
||||
type="primary"
|
||||
icon="Plus"
|
||||
circle
|
||||
@click="addAdjustment"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div class="headClass">退货规则<span style="color: red; font-size: 15px">(仅针对未发货订单退款,自动回退库存)</span></div>
|
||||
<el-divider />
|
||||
|
||||
<el-form-item label="退款后是否自动回退库存" prop="stockRollback" label-width="170px" style="width: 100%">
|
||||
<el-radio-group v-model="form.stockRollback">
|
||||
<el-radio :key="0" :value="0">否</el-radio>
|
||||
<el-radio :key="1" :value="1">是</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
@ -267,21 +240,23 @@
|
||||
</template>
|
||||
|
||||
<script setup name="WarehouseSettings" lang="ts">
|
||||
import { listWarehouseSettings, getWarehouseSettings, delWarehouseSettings, addWarehouseSettings, updateWarehouseSettings,getWarehouseSettingsAttribute,updateWarehouseSettingsStatus } from '@/api/zhishu/warehouseSettings';
|
||||
import {
|
||||
listWarehouseSettings,
|
||||
getWarehouseSettings,
|
||||
delWarehouseSettings,
|
||||
addWarehouseSettings,
|
||||
updateWarehouseSettings,
|
||||
getWarehouseSettingsAttribute,
|
||||
updateWarehouseSettingsStatus
|
||||
} from '@/api/zhishu/warehouseSettings';
|
||||
import { WarehouseSettingsVO, WarehouseSettingsQuery, WarehouseSettingsForm } from '@/api/zhishu/warehouseSettings/types';
|
||||
import { getFreInfo, getProvinces } from '@/api/zhishu/district';
|
||||
import { TDistrictVo } from '@/api/zhishu/district/types';
|
||||
import { getListShop } from '@/api/zhishu/shop';
|
||||
import type { CheckboxValueType } from 'element-plus'
|
||||
import type { CheckboxValueType } from 'element-plus';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const {
|
||||
t_is_open
|
||||
} = toRefs<any>(
|
||||
proxy?.useDict(
|
||||
't_is_open'
|
||||
)
|
||||
);
|
||||
const { t_is_open } = toRefs<any>(proxy?.useDict('t_is_open'));
|
||||
|
||||
const warehouseSettingsList = ref<WarehouseSettingsVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
@ -296,66 +271,46 @@ const districtList = ref<TDistrictVo[]>([]);
|
||||
const shopList = ref([]);
|
||||
const conditionCodeList = ref([
|
||||
{
|
||||
id:"N",
|
||||
value:"全新"
|
||||
id: '100',
|
||||
value: '全新'
|
||||
},
|
||||
{
|
||||
id:"M",
|
||||
value:"九五品"
|
||||
id: '95',
|
||||
value: '九五品'
|
||||
},
|
||||
{
|
||||
id:"L",
|
||||
value:"九品"
|
||||
id: '90',
|
||||
value: '九品'
|
||||
},
|
||||
{
|
||||
id:"K",
|
||||
value:"八五品"
|
||||
id: '85',
|
||||
value: '八五品'
|
||||
},
|
||||
{
|
||||
id:"J",
|
||||
value:"八品"
|
||||
id: '80',
|
||||
value: '八品'
|
||||
},
|
||||
{
|
||||
id:"I",
|
||||
value:"七五品"
|
||||
id: '75',
|
||||
value: '七五品'
|
||||
},
|
||||
{
|
||||
id:"H",
|
||||
value:"七品"
|
||||
id: '70',
|
||||
value: '七品'
|
||||
},
|
||||
{
|
||||
id:"G",
|
||||
value:"六五品"
|
||||
id: '65',
|
||||
value: '六五品'
|
||||
},
|
||||
{
|
||||
id:"F",
|
||||
value:"六品"
|
||||
},
|
||||
{
|
||||
id:"E",
|
||||
value:"五品"
|
||||
},
|
||||
{
|
||||
id:"D",
|
||||
value:"四品"
|
||||
},
|
||||
{
|
||||
id:"C",
|
||||
value:"三品"
|
||||
},
|
||||
{
|
||||
id:"B",
|
||||
value:"二品"
|
||||
},
|
||||
{
|
||||
id:"A",
|
||||
value:"一品"
|
||||
id: '60',
|
||||
value: '六品'
|
||||
}
|
||||
])
|
||||
]);
|
||||
|
||||
const checkAll = ref(false)
|
||||
const indeterminate = ref(false)
|
||||
const chooseShopList = ref<CheckboxValueType[]>([])
|
||||
const checkAll = ref(false);
|
||||
const indeterminate = ref(false);
|
||||
const chooseShopList = ref<CheckboxValueType[]>([]);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const warehouseSettingsFormRef = ref<ElFormInstance>();
|
||||
@ -371,7 +326,7 @@ const initFormData: WarehouseSettingsForm = {
|
||||
stockSynchronizeType: 1,
|
||||
autoIssue: 1,
|
||||
lossProtection: 1,
|
||||
profitFloor:undefined,
|
||||
profitFloor: undefined,
|
||||
status: undefined,
|
||||
delFlag: undefined,
|
||||
stockRollback: 1,
|
||||
@ -379,26 +334,26 @@ const initFormData: WarehouseSettingsForm = {
|
||||
createAt: undefined,
|
||||
updateBy: undefined,
|
||||
updateAt: undefined,
|
||||
shopIds:undefined,
|
||||
shopIds: undefined,
|
||||
userSettingsAttributeListStr: undefined,
|
||||
ruleList: [
|
||||
{
|
||||
id:undefined,
|
||||
id: undefined,
|
||||
attributeId: undefined,
|
||||
attributeValue: undefined
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
const data = reactive<PageData<WarehouseSettingsForm, WarehouseSettingsQuery>>({
|
||||
form: {...initFormData},
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
settingName: undefined,
|
||||
stockSynchronizeType: undefined,
|
||||
autoIssue: undefined,
|
||||
lossProtection:undefined,
|
||||
profitFloor:undefined,
|
||||
lossProtection: undefined,
|
||||
profitFloor: undefined,
|
||||
status: undefined,
|
||||
delFlag: undefined,
|
||||
stockRollback: undefined,
|
||||
@ -406,15 +361,12 @@ const data = reactive<PageData<WarehouseSettingsForm, WarehouseSettingsQuery>>({
|
||||
createAt: undefined,
|
||||
updateBy: undefined,
|
||||
updateAt: undefined,
|
||||
shopIds:undefined,
|
||||
shopIds: undefined,
|
||||
userSettingsAttributeListStr: undefined,
|
||||
params: {
|
||||
}
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
settingName:[
|
||||
{ required: true, message: "模板名称不能为空", trigger: "blur" }
|
||||
]
|
||||
settingName: [{ required: true, message: '模板名称不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
@ -427,64 +379,64 @@ const getList = async () => {
|
||||
warehouseSettingsList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
chooseShopList.value.length = 0;
|
||||
form.value = {...initFormData};
|
||||
form.value.ruleList = [{
|
||||
|
||||
id:undefined,
|
||||
form.value = { ...initFormData };
|
||||
form.value.ruleList = [
|
||||
{
|
||||
id: undefined,
|
||||
attributeId: undefined,
|
||||
attributeValue: undefined
|
||||
|
||||
}];
|
||||
}
|
||||
];
|
||||
|
||||
checkAll.value = false;
|
||||
warehouseSettingsFormRef.value?.resetFields();
|
||||
}
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
}
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: WarehouseSettingsVO[]) => {
|
||||
ids.value = selection.map(item => item.id);
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
reset();
|
||||
dialog.visible = true;
|
||||
dialog.title = "添加设置";
|
||||
}
|
||||
dialog.title = '添加设置';
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: WarehouseSettingsVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0]
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getWarehouseSettings(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = "修改设置";
|
||||
dialog.title = '修改设置';
|
||||
|
||||
/**
|
||||
* 解析后赋值店铺
|
||||
@ -494,14 +446,16 @@ const handleUpdate = async (row?: WarehouseSettingsVO) => {
|
||||
* 解析后赋值规则
|
||||
*/
|
||||
form.value.ruleList = JSON.parse(res.data.userSettingsAttributeListStr);
|
||||
if(form.value.ruleList.length == 0){
|
||||
form.value.ruleList = [{
|
||||
id:undefined,
|
||||
if (form.value.ruleList.length == 0) {
|
||||
form.value.ruleList = [
|
||||
{
|
||||
id: undefined,
|
||||
attributeId: undefined,
|
||||
attributeValue: undefined
|
||||
}];
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 定义时间格式化函数
|
||||
const formatTimestamp = (timestamp: number | undefined | null) => {
|
||||
@ -547,77 +501,81 @@ const formatTimestamp = (timestamp: number | undefined | null) => {
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = async () => {
|
||||
if (chooseShopList.value.length <= 0) {
|
||||
proxy?.$modal.msgError('请选择应用店铺');
|
||||
return false;
|
||||
}
|
||||
if (!form.value.settingName) {
|
||||
proxy?.$modal.msgError('规则模板名称不能为空');
|
||||
return false;
|
||||
}
|
||||
|
||||
if(chooseShopList.value.length <= 0){
|
||||
proxy?.$modal.msgError('请选择应用店铺');
|
||||
if (form.value.autoIssue == 1) {
|
||||
if (
|
||||
form.value.lossProtection == 1 &&
|
||||
(form.value.profitFloor == undefined || form.value.profitFloor == null || form.value.profitFloor == '' || form.value.profitFloor < 0)
|
||||
) {
|
||||
proxy?.$modal.msgError('利润下限不能为空或小于0');
|
||||
return false;
|
||||
}
|
||||
if(!form.value.settingName){
|
||||
proxy?.$modal.msgError('规则模板名称不能为空');
|
||||
return false;
|
||||
}
|
||||
|
||||
if(form.value.autoIssue == 1){
|
||||
if(form.value.lossProtection == 1 && (form.value.profitFloor == undefined || form.value.profitFloor == null || form.value.profitFloor == '' || form.value.profitFloor < 0)){
|
||||
proxy?.$modal.msgError('利润下限不能为空或小于0');
|
||||
return false;
|
||||
for (var i = 0; i < form.value.ruleList.length; i++) {
|
||||
if (!form.value.ruleList[i].attributeId) {
|
||||
proxy?.$modal.msgError('商品匹配规则 第' + (i + 1) + '行,请选择规则');
|
||||
return false;
|
||||
}
|
||||
for(var i=0;i<form.value.ruleList.length;i++){
|
||||
if(!form.value.ruleList[i].attributeId){
|
||||
proxy?.$modal.msgError('商品匹配规则 第'+(i+1)+"行,请选择规则");
|
||||
return false;
|
||||
}
|
||||
if(!form.value.ruleList[i].attributeValue){
|
||||
proxy?.$modal.msgError('商品匹配规则 第'+(i+1)+"行,请填写规则内容");
|
||||
return false;
|
||||
}
|
||||
if (form.value.ruleList[i].attributeId == 7) {
|
||||
form.value.ruleList[i].attributeValue = '不匹配';
|
||||
}else if (!form.value.ruleList[i].attributeValue) {
|
||||
proxy?.$modal.msgError('商品匹配规则 第' + (i + 1) + '行,请填写规则内容');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let shopIds = '';
|
||||
for(var i=0;i<chooseShopList.value.length;i++){
|
||||
if(shopIds == ''){
|
||||
shopIds = chooseShopList.value[i]
|
||||
}else{
|
||||
shopIds += ','+chooseShopList.value[i]
|
||||
}
|
||||
}
|
||||
form.value.shopIds = shopIds;
|
||||
|
||||
form.value.userSettingsAttributeListStr = JSON.stringify(form.value.ruleList);
|
||||
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateWarehouseSettings(form.value).finally(() => buttonLoading.value = false);
|
||||
let shopIds = '';
|
||||
for (var i = 0; i < chooseShopList.value.length; i++) {
|
||||
if (shopIds == '') {
|
||||
shopIds = chooseShopList.value[i];
|
||||
} else {
|
||||
await addWarehouseSettings(form.value).finally(() => buttonLoading.value = false);
|
||||
shopIds += ',' + chooseShopList.value[i];
|
||||
}
|
||||
proxy?.$modal.msgSuccess("操作成功");
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
}
|
||||
form.value.shopIds = shopIds;
|
||||
|
||||
form.value.userSettingsAttributeListStr = JSON.stringify(form.value.ruleList);
|
||||
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateWarehouseSettings(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addWarehouseSettings(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: WarehouseSettingsVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除设置编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
||||
await proxy?.$modal.confirm('是否确认删除设置编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delWarehouseSettings(_ids);
|
||||
proxy?.$modal.msgSuccess("删除成功");
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
}
|
||||
};
|
||||
|
||||
/** 获取匹配属性 */
|
||||
|
||||
const getAttribute = async () => {
|
||||
attributeList.value = await getWarehouseSettingsAttribute()
|
||||
}
|
||||
attributeList.value = await getWarehouseSettingsAttribute();
|
||||
};
|
||||
|
||||
// 添加调整项
|
||||
const addAdjustment = () => {
|
||||
const lastItem = form.value.ruleList[form.value.ruleList.length - 1];
|
||||
form.value.ruleList.push({
|
||||
id:undefined,
|
||||
value:undefined
|
||||
id: undefined,
|
||||
value: undefined
|
||||
});
|
||||
};
|
||||
|
||||
@ -627,12 +585,12 @@ const removeAdjustment = (index: number) => {
|
||||
};
|
||||
|
||||
const ruleIdChange = (row) => {
|
||||
var j=0;
|
||||
for(var i=0;i<form.value.ruleList.length;i++){
|
||||
if(row.attributeId == form.value.ruleList[i].attributeId){
|
||||
j++;
|
||||
var j = 0;
|
||||
for (var i = 0; i < form.value.ruleList.length; i++) {
|
||||
if (row.attributeId == form.value.ruleList[i].attributeId) {
|
||||
j++;
|
||||
}
|
||||
if(j > 1){
|
||||
if (j > 1) {
|
||||
row.attributeId = undefined;
|
||||
row.attributeValue = undefined;
|
||||
proxy?.$modal.msgError('请勿重复选择规则');
|
||||
@ -640,7 +598,7 @@ const ruleIdChange = (row) => {
|
||||
}
|
||||
}
|
||||
row.attributeValue = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取发货地(省)
|
||||
@ -654,50 +612,50 @@ const getDistrict = async () => {
|
||||
* 设置启用禁用
|
||||
*/
|
||||
const clickStatus = async (row) => {
|
||||
const loading = ElLoading.service({
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '正在修改规则状态',
|
||||
background: 'rgba(0, 0, 0, 0.7)',
|
||||
})
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
|
||||
await updateWarehouseSettingsStatus(row).finally(() => loading.close());;
|
||||
proxy?.$modal.msgSuccess("操作成功");
|
||||
await getList();
|
||||
}
|
||||
await updateWarehouseSettingsStatus(row).finally(() => loading.close());
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取店铺列表
|
||||
*/
|
||||
const getShops = async () => {
|
||||
const res = await getListShop();
|
||||
for(var i=0;i<res.length;i++){
|
||||
for (var i = 0; i < res.length; i++) {
|
||||
shopList.value.push({
|
||||
value : res[i].id,
|
||||
label : res[i].shopName
|
||||
})
|
||||
value: res[i].id,
|
||||
label: res[i].shopName
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
watch(chooseShopList, (val) => {
|
||||
if (val.length === 0) {
|
||||
checkAll.value = false
|
||||
indeterminate.value = false
|
||||
checkAll.value = false;
|
||||
indeterminate.value = false;
|
||||
} else if (val.length === shopList.value.length) {
|
||||
checkAll.value = true
|
||||
indeterminate.value = false
|
||||
checkAll.value = true;
|
||||
indeterminate.value = false;
|
||||
} else {
|
||||
indeterminate.value = true
|
||||
indeterminate.value = true;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
const handleCheckAll = (val: CheckboxValueType) => {
|
||||
indeterminate.value = false
|
||||
indeterminate.value = false;
|
||||
if (val) {
|
||||
chooseShopList.value = shopList.value.map((_) => _.value)
|
||||
chooseShopList.value = shopList.value.map((_) => _.value);
|
||||
} else {
|
||||
chooseShopList.value = []
|
||||
chooseShopList.value = [];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
@ -709,10 +667,10 @@ onMounted(() => {
|
||||
|
||||
<style scoped>
|
||||
.headClass {
|
||||
font-size: 18px;
|
||||
font-weight: 1000;
|
||||
margin-top: 30px;
|
||||
margin-bottom: -15px;
|
||||
color: #000000;
|
||||
font-size: 18px;
|
||||
font-weight: 1000;
|
||||
margin-top: 30px;
|
||||
margin-bottom: -15px;
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user