Skip to content

Commit

Permalink
Merge pull request #154 from Jzow/master
Browse files Browse the repository at this point in the history
Fix bug q1 in #153
  • Loading branch information
Jzow committed Nov 4, 2023
2 parents 4694d96 + 7f22a1f commit d9c096c
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public Response<String> deleteByIds(@RequestParam("ids") List<Long> ids) {
return retailService.deleteRetailShipments(ids);
}

@PostMapping("/shipments/updateStatus")
@PutMapping("/shipments/updateStatus")
public Response<String> updateStatus(@RequestParam("ids") List<Long> ids, @RequestParam("status") Integer status) {
return retailService.updateRetailShipmentsStatus(ids, status);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public class RetailShipmentsDTO {

private String remark;

private Integer status;

private List<ShipmentsDataBO> tableData;

private List<FileDataBO> files;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ public Response<String> addOrUpdateRetailShipments(RetailShipmentsDTO shipmentsD
.set(shipmentsDTO.getCollectAmount() != null, ReceiptMain::getChangeAmount, shipmentsDTO.getCollectAmount())
.set(shipmentsDTO.getReceiptAmount() != null, ReceiptMain::getTotalPrice, shipmentsDTO.getReceiptAmount())
.set(shipmentsDTO.getBackAmount() != null, ReceiptMain::getBackAmount, shipmentsDTO.getBackAmount())
.set(shipmentsDTO.getStatus() != null, ReceiptMain::getStatus, shipmentsDTO.getStatus())
.set(StringUtils.hasText(shipmentsDTO.getPaymentType()), ReceiptMain::getPaymentType, shipmentsDTO.getPaymentType())
.set(StringUtils.hasText(shipmentsDTO.getRemark()), ReceiptMain::getRemark, shipmentsDTO.getRemark())
.set(StringUtils.hasText(shipmentsDTO.getReceiptDate()), ReceiptMain::getCreateTime, shipmentsDTO.getReceiptDate())
.set(ReceiptMain::getUpdateBy, userId)
.set(ReceiptMain::getUpdateTime, LocalDateTime.now())
.update();
Expand Down Expand Up @@ -229,6 +231,7 @@ public Response<String> addOrUpdateRetailShipments(RetailShipmentsDTO shipmentsD
.backAmount(shipmentsDTO.getBackAmount())
.remark(shipmentsDTO.getRemark())
.fileId(fileIds)
.status(shipmentsDTO.getStatus())
.createBy(userId)
.createTime(LocalDateTime.now())
.build();
Expand Down
1 change: 1 addition & 0 deletions web/src/api/retail/model/shipmentsModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ interface AddOrUpdateShipmentsReq {
receiptAmount: number;
backAmount: number;
remark: string;
status: number;
tableData: ShipmentsData[];
fileDataList: FileData[];
}
Expand Down
2 changes: 1 addition & 1 deletion web/src/api/retail/shipments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function deleteShipments(ids: string[]) {
}

export function updateShipmentsStatus(ids: string[], status: number) {
return defHttp.post<BaseResp>(
return defHttp.put<BaseResp>(
{
url: `${API.UpdateStatus}?ids=${ids}&status=${status}`,
}
Expand Down
4 changes: 4 additions & 0 deletions web/src/views/financial/advance-charge/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ export default defineComponent({
}
async function handleEdit(record: Recordable) {
if (record.status === 1) {
createMessage.warn('抱歉,只有未审核的单据才能编辑!');
return;
}
advanceChargeModalRef.value.openAdvanceChargeModal(record.id);
}
Expand Down
37 changes: 18 additions & 19 deletions web/src/views/retail/shipments/components/AddEditModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</a-col>
<a-col :lg="6" :md="12" :sm="24">
<a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="单据日期" :rules="[{ required: true}]">
<a-date-picker v-model:value="formState.receiptDate" show-time placeholder="选择时间" @change="dateChange" @ok="dateOk"/>
<a-date-picker v-model:value="formState.receiptDate" show-time placeholder="选择时间" format="YYYY-MM-DD HH:mm:ss"/>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :sm="24">
Expand Down Expand Up @@ -76,7 +76,7 @@
<a-button v-if="showScanButton" type="primary" @click="scanEnter" style="margin-right: 10px">扫条码录入数据</a-button>
<a-input v-if="showScanPressEnter" placeholder="鼠标点击此处扫条码" style="width: 150px; margin-right: 10px" v-model:value="formState.scanBarCode"
@pressEnter="scanPressEnter" ref="scanBarCode"/>
<a-button v-if="showScanPressEnter" style="margin-right: 10px" @click="stopScan">收起扫码</a-button>
<a-button v-if="showScanPressEnter" style="margin-right: 10px" @click="stopScan">收起扫码</a-button>
<a-button @click="productModal" style="margin-right: 10px">批量添加出库商品</a-button>
<a-button @click="addRowData" style="margin-right: 10px">添加一行</a-button>
<a-button @click="deleteRowData" style="margin-right: 10px">删除选中行</a-button>
Expand Down Expand Up @@ -190,7 +190,12 @@
<script lang="ts">
import {defineComponent, ref} from 'vue';
import {PlusOutlined, UploadOutlined} from '@ant-design/icons-vue';
import {Dayjs} from 'dayjs';
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
import weekday from "dayjs/plugin/weekday";
import localeData from "dayjs/plugin/localeData";
dayjs.extend(weekday);
dayjs.extend(localeData);
import {
Textarea,
DatePicker,
Expand Down Expand Up @@ -248,7 +253,7 @@ const VNodes = {
return this.vnodes;
},
};
dayjs.locale('zh-cn');
export default defineComponent({
name: 'AddEditModal',
emits: ['success', 'cancel', 'error'],
Expand Down Expand Up @@ -339,6 +344,8 @@ export default defineComponent({
} else {
title.value = '新增-零售出库'
loadGenerateId();
// 获取系统时间然后转成dayjs格式
formState.receiptDate = dayjs(new Date());
}
}
Expand Down Expand Up @@ -381,14 +388,11 @@ export default defineComponent({
const data = result.data
formState.id = id
formState.memberId = data.memberId
// formState.receiptDate = data.receiptDate
formState.receiptDate = dayjs(data.receiptDate);
formState.accountId = data.accountId
formState.receiptNumber = data.receiptNumber
formState.remark = data.remark
formState.paymentType = data.paymentType
receiptAmount.value = data.receiptAmount
collectAmount.value = data.collectAmount
backAmount.value = `¥${XEUtils.commafy(XEUtils.toNumber(data.backAmount), { digits: 2 })}`
// file
fileList.value = data.files.map(item => ({
id: item.id,
Expand Down Expand Up @@ -418,6 +422,9 @@ export default defineComponent({
table.insert(tableData)
})
}
receiptAmount.value = `¥${XEUtils.commafy(XEUtils.toNumber(data.receiptAmount), { digits: 2 })}`
collectAmount.value = `¥${XEUtils.commafy(XEUtils.toNumber(data.collectAmount), { digits: 2 })}`
backAmount.value = `¥${XEUtils.commafy(XEUtils.toNumber(data.backAmount), { digits: 2 })}`
}
}
Expand All @@ -430,13 +437,6 @@ export default defineComponent({
backAmount.value = `¥${XEUtils.commafy(XEUtils.toNumber(numberAmount), { digits: 2 })}`
}
const dateChange = (value: Dayjs, dateString: string) => {
};
const dateOk = (value: Dayjs) => {
};
function scanPressEnter() {
const warehouseDefaultId = warehouseList.value.find(item => item.isDefault === 1)?.id || warehouseList.value[0].id
getProductSkuByBarCode(formState.scanBarCode, warehouseDefaultId).then(res => {
Expand Down Expand Up @@ -578,6 +578,7 @@ export default defineComponent({
...formState,
tableData: dataArray,
files: files,
status: type,
}
const result = await addOrUpdateShipments(params)
if (result.code === 'R0001' || 'R0002') {
Expand Down Expand Up @@ -605,8 +606,8 @@ export default defineComponent({
if(table) {
// 清空表格数据
table.reloadData()
}
formState.receiptDate = undefined
}
function beforeUpload(file: any) {
Expand Down Expand Up @@ -698,8 +699,6 @@ export default defineComponent({
refKey,
activeKey,
onChangePaymentAmount,
dateChange,
dateOk,
scanPressEnter,
scanEnter,
stopScan,
Expand Down Expand Up @@ -727,7 +726,7 @@ export default defineComponent({
productModal,
handleCheckSuccess,
addRowData,
deleteRowData
deleteRowData,
};
},
});
Expand Down
40 changes: 21 additions & 19 deletions web/src/views/retail/shipments/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<a-button type="primary" @click="handleCreate"> 新增</a-button>
<a-button type="primary" @click="handleBatchDelete"> 批量删除</a-button>
<a-button type="primary" @click="handleExport"> 导出</a-button>
<a-button type="primary" @click=""> 审核</a-button>
<a-button type="primary" @click=""> 反审核</a-button>
<a-button type="primary" @click="handleOnStatus(1)"> 审核</a-button>
<a-button type="primary" @click="handleOnStatus(0)"> 反审核</a-button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
Expand Down Expand Up @@ -53,7 +53,7 @@ import {useMessage} from "@/hooks/web/useMessage";
import {columns, searchFormSchema} from "@/views/retail/shipments/shipments.data";
import {exportXlsx} from "@/api/basic/common";
import {useI18n} from "vue-i18n";
import {getShipmentsPageList, deleteShipments} from "@/api/retail/shipments";
import {getShipmentsPageList, deleteShipments, updateShipmentsStatus} from "@/api/retail/shipments";
import AddEditModal from "@/views/retail/shipments/components/AddEditModal.vue"
import {Tag} from "ant-design-vue";
export default defineComponent({
Expand Down Expand Up @@ -106,6 +106,10 @@ export default defineComponent({
}
function handleEdit(record: Recordable) {
if (record.status === 1) {
createMessage.warn('抱歉,只有未审核的单据才能编辑!');
return;
}
addEditModalRef.value.openAddEditModal(record.id);
}
Expand All @@ -120,14 +124,6 @@ export default defineComponent({
await reload();
}
async function handleOnStatus(newStatus: number) {
const data = getSelectRows();
if (data.length === 0) {
createMessage.warn('请选择一条数据');
return;
}
}
async function handleCancel() {
await reload();
}
Expand All @@ -140,14 +136,6 @@ export default defineComponent({
}
function handleBatchShipmentsInfo() {
const data = getSelectRows();
if (data.length === 0) {
createMessage.warn('请选择一条数据');
return;
}
}
const getTimestamp = (date) => {
return (
date.getFullYear() * 10000000000 +
Expand All @@ -159,6 +147,20 @@ export default defineComponent({
).toString();
};
async function handleOnStatus(newStatus: number) {
const data = getSelectRows();
if (data.length === 0) {
createMessage.warn('请选择一条数据');
return;
}
const ids = data.map((item) => item.id);
const {code} = await updateShipmentsStatus(ids, newStatus);
if (code === "R0002") {
await reload();
}
}
async function handleExport() {
const file = await exportXlsx("零售出库列表")
const blob = new Blob([file]);
Expand Down
71 changes: 29 additions & 42 deletions web/src/views/retail/shipments/shipments.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {FormSchema} from "@/components/Form";
import {BasicColumn} from "@/components/Table";
import {useI18n} from "@/hooks/web/useI18n";
import {getMemberList} from "@/api/basic/member";
import {getAccountList} from "@/api/financial/account";

export const { t } = useI18n();

Expand Down Expand Up @@ -60,16 +62,7 @@ export const columns: BasicColumn[] = [
export const searchFormSchema: FormSchema[] = [
{
label: '单据编号',
field: 'receiptDate',
component: 'ApiTreeSelect',
colProps: {
xl: 8,
xxl: 8,
},
},
{
label: '商品信息',
field: 'productInfo',
field: 'receiptNumber',
component: 'Input',
colProps: {
xl: 8,
Expand All @@ -87,28 +80,13 @@ export const searchFormSchema: FormSchema[] = [
colProps: { span: 7 },
},
{
label: '会员卡号',
field: 'memberId',
component: 'ApiSelect',
componentProps: {
// api: test,
resultField: 'data',
labelField: 'name',
valueField: 'id',
},
colProps: {
xl: 8,
xxl: 8,
},
},
{
label: '仓库',
field: 'warehouseId',
label: '结算账户',
field: 'accountId',
component: 'ApiSelect',
componentProps: {
// api: test,
api: getAccountList,
resultField: 'data',
labelField: 'name',
labelField: 'accountName',
valueField: 'id',
},
colProps: {
Expand All @@ -117,35 +95,44 @@ export const searchFormSchema: FormSchema[] = [
},
},
{
label: '操作员',
field: 'operator',
component: 'ApiSelect',
componentProps: {
// api: test,
resultField: 'data',
labelField: 'name',
valueField: 'id',
},
label: '商品信息',
field: 'productInfo',
component: 'Input',
colProps: {
xl: 8,
xxl: 8,
},
},
{
label: '结算账户',
field: 'accountId',
label: '会员卡号',
field: 'memberId',
component: 'ApiSelect',
componentProps: {
// api: test,
api: getMemberList,
resultField: 'data',
labelField: 'name',
labelField: 'memberName',
valueField: 'id',
},
colProps: {
xl: 8,
xxl: 8,
},
},
// {
// label: '仓库',
// field: 'warehouseId',
// component: 'ApiSelect',
// componentProps: {
// api: getWarehouseList,
// resultField: 'data',
// labelField: 'warehouseName',
// valueField: 'id',
// },
// colProps: {
// xl: 8,
// xxl: 8,
// },
// },
{
label: '单据状态',
field: 'status',
Expand Down

0 comments on commit d9c096c

Please sign in to comment.