update: 增加打印

This commit is contained in:
admin 2024-05-15 16:43:19 +08:00
parent e5bb761556
commit b71988a8f0
3 changed files with 67 additions and 28 deletions

View File

@ -98,7 +98,9 @@
<view class="active" @click="handleReviewPay"> 审核立即支付 </view>
</view>
<!-- 零皮重不需要重新过皮 -->
<view v-if="state.order.scaleStatus === 2 && state.order.weighingMethod === 0">
<view
v-if="state.order.scaleStatus === 2 && state.order.weighingMethod === 0"
>
<u-button
text="重新过皮"
plain
@ -123,6 +125,7 @@
text="打印"
type="primary"
:customStyle="{ 'border-radius': '43rpx' }"
@click="handlePrint"
></u-button>
</view>
</view>
@ -164,10 +167,10 @@
</template>
<script setup lang="ts">
import { ReceiveApi } from "@/services/index";
import { DeviceApi, ReceiveApi } from "@/services/index";
import { onLoad } from "@dcloudio/uni-app";
import SmallModal from "@/components/Modal/smallModal.vue";
import { ScaleStatus } from "@/utils/enum";
import { OrderType, ScaleStatus } from "@/utils/enum";
const keyword = ref("");
const contrlModalParams = reactive<{ [attrName: string]: any }>({
paySelect: {
@ -222,7 +225,7 @@ const state = reactive<{
}>({
order: {
carNumber: "",
balanceTotalPrice: 0
balanceTotalPrice: 0,
},
sheetList: [
{
@ -319,7 +322,7 @@ const handleConfirm = () => {
],
}).then((res) => {
if (res.code === 200) {
state.order.balanceTotalPrice = amount.value || 0
state.order.balanceTotalPrice = amount.value || 0;
uni.showToast({ title: "修改成功" });
gridList1[gridList1.length - 1].num = amount.value || "";
isInput.value = false;
@ -387,6 +390,20 @@ const handleReWeight = () => {
}
});
};
const handlePrint = () => {
DeviceApi.print({
id: state.order.id,
orderType: OrderType.Receive,
userId: state.order.deviceId
}).then((res) => {
if (res.code === 200) {
uni.showToast({
title: "打印成功",
})
}
});
};
onLoad((option) => {
state.order.id = parseInt((option as any).id);
state.scaleStatus = parseInt((option as any).scaleStatus);

View File

@ -180,6 +180,7 @@
text="打印"
type="primary"
:customStyle="{ 'border-radius': '43rpx' }"
@click="handlePrint"
></u-button>
</view>
</view>
@ -207,8 +208,8 @@
</template>
<script setup lang="ts">
import { ShipmentApi } from "@/services/index";
import { ScaleStatusBtnType } from "@/utils/enum";
import { DeviceApi, ShipmentApi } from "@/services/index";
import { OrderType, ScaleStatusBtnType } from "@/utils/enum";
import { onLoad, onShow } from "@dcloudio/uni-app";
import SmallModal from "@/components/Modal/smallModal.vue";
const payMethodMap: any = {
@ -586,6 +587,19 @@ const init = () => {
});
}
};
const handlePrint = () => {
DeviceApi.print({
id: state.order.id,
orderType: OrderType.Shipment,
userId: state.order.deviceId
}).then((res) => {
if (res.code === 200) {
uni.showToast({
title: "打印成功",
})
}
});
};
onShow(() => {
init();
});

View File

@ -1,46 +1,54 @@
import { http } from '@/utils/http'
import { http } from "@/utils/http";
// 设备信息新增
export const addDevice = (data: any) => {
return http({
method: 'POST',
url: '/api/device/addDevice',
method: "POST",
url: "/api/device/addDevice",
data,
})
}
});
};
// 设备信息修改
export const editDevice = (data: any) => {
return http({
method: 'POST',
url: '/api/device/edit',
method: "POST",
url: "/api/device/edit",
data,
})
}
});
};
// 设备信息逻辑删除
export const deleteDevice = (data: any) => {
return http({
method: 'POST',
url: '/api/device/deleteDevice',
method: "POST",
url: "/api/device/deleteDevice",
data,
})
}
});
};
// 设备信息根据id查询
export const selectDeviceId = (data: any) => {
return http({
method: 'POST',
url: '/api/device/selectDeviceId',
method: "POST",
url: "/api/device/selectDeviceId",
data,
})
}
});
};
// 设备信息根据id查询
export const getDeviceList = (data: any) => {
return http({
method: 'POST',
url: '/api/device/getDeviceList',
method: "POST",
url: "/api/device/getDeviceList",
data,
})
}
});
};
// 打印
export const print = (data: any) => {
return http({
method: "POST",
url: "/api/machine/print",
data,
});
};