浏览代码

fix: 暂存

Hello小健 3 周之前
父节点
当前提交
6163b78481
共有 4 个文件被更改,包括 141 次插入131 次删除
  1. 0 112
      components/printerListScan.vue
  2. 119 0
      components/printerListScan/index.vue
  3. 21 19
      pages/instock/index.vue
  4. 1 0
      utils/api.js

+ 0 - 112
components/printerListScan.vue

@@ -1,112 +0,0 @@
-<template>
-	<uni-popup v-model="printerList!.visible">
-		<uni-popup-dialog ref="inputClose" mode="input" title="输入内容" value="对话框预置提示内容!" placeholder="请输入内容" @confirm="dialogInputConfirm">
-			<template #default>
-				<text class="title">
-					{{ printerList.title }}
-					<text class="ml-2">{{ printerList?.postData?.order_no }}</text>
-				</text>
-			</template>
-			<view v-if="printerList">
-				<uni-data-checkbox multiple v-model="downloadFile" :disabled="true" :localdata=" [{
-					text: '下载文件',
-					value: 1
-				}]">></uni-data-checkbox>
-
-				<!-- <view><el-checkbox label="下载文件" v-model="downloadFile" :disabled="true"></el-checkbox></view> -->
-				<view class="ml-4">
-					<!-- 		<view>
-						<el-checkbox label="发送到标签打印机打印" v-model="sendToPeinter" @change="sendToPeinterFun"></el-checkbox>
-					</view>
-					<el-radio-group v-model="printer_code">
-						<el-radio v-for="(item, i) in printerList.printers as any" :key="i" :label="item.value">{{ item.name }}</el-radio>
-					</el-radio-group> -->
-				</view>
-			</view>
-		</uni-popup-dialog>
-
-		<!-- <template #footer>
-			<div>
-				<el-button @click="printerList.visible = false">{{ t('Cancel') }}</el-button>
-				<el-button :loading="submitLoading" @click="toPrint()" type="primary" v-blur>
-					{{ '打印' }}
-				</el-button>
-			</div>
-		</template> -->
-	</uni-popup>
-</template>
-<script setup lang="ts">
-import { inject, ref } from 'vue';
-const printerList = inject('printerList') as any;
-const printer_code = ref('');
-const submitLoading = ref(false);
-const downloadFile = ref(true);
-const sendToPeinter = ref(true);
-const sendToPeinterFun = () => {
-	if (!sendToPeinter.value) {
-		printer_code.value = '';
-	} else {
-		printer_code.value = Object.keys(printerList.value.printers)[0];
-	}
-};
-const dialogInputConfirm = () => {
-	printerList.value && (printer_code.value = Object.keys(printerList.value.printers)[0]);
-};
-const openPrinterSelect = () => {
-	printerList.value && (printer_code.value = Object.keys(printerList.value.printers)[0]);
-};
-const toPrint = async () => {
-	const { postURL, batoken, postData, resetForm } = printerList.value;
-	/*
-    const loading = ElLoading.service({
-        lock: true,
-        text: 'Loading',
-        background: 'rgba(0, 0, 0, 0.7)',
-    })
-    */
-	submitLoading.value = true;
-	uni.request({
-		url: postURL,
-		method: 'POST',
-		header: {
-			batoken: batoken
-		},
-		data: {
-			...postData,
-			printer_code: printer_code.value
-		},
-		success: (res) => {
-			console.log(res);
-		}
-	});
-	/*
-	await postPrint({
-		...postData,
-		printer_code: printer_code.value
-	})
-		.then((res: any) => {
-			//loading.close()
-			const list = res.data?.label_path || res.data?.labels || (res.data?.express_label ? [res.data?.express_label] : []);
-			if (list.length === 0) {
-				// ElMessage.error('没有可打印的文件');
-				return;
-			}
-
-			list.map((url: string) => {
-				let path = fullUrl(url);
-				window.open(path, '_blank');
-			});
-			submitLoading.value = false;
-			printerList.value.visible = false;
-			resetForm();
-		})
-		.catch((error: any) => {
-			console.log('error--', error);
-			//loading.close()
-			submitLoading.value = false;
-		});
-		*/
-};
-</script>
-
-<style scoped lang="scss"></style>

+ 119 - 0
components/printerListScan/index.vue

@@ -0,0 +1,119 @@
+<template>
+    <uni-popup v-model="printerList!.visible">
+        {{printerList}}
+        <uni-popup-dialog ref="inputClose" mode="input" title="输入内容" value="对话框预置提示内容!" placeholder="请输入内容" @confirm="dialogInputConfirm">
+            <!-- <template #default>
+                <text class="title">
+                    {{ printerList.title }}
+                    <text class="ml-2">{{ printerList?.postData?.order_no }}</text>
+                </text>
+            </template> -->
+            <!-- <view v-if="printerList">
+                <uni-data-checkbox multiple v-model="downloadFile" :disabled="true" :localdata=" [{
+                    text: '下载文件',
+                    value: 1
+                }]">></uni-data-checkbox>
+
+                <view><el-checkbox label="下载文件" v-model="downloadFile" :disabled="true"></el-checkbox></view>
+                <view class="ml-4">
+                            <view>
+                        <el-checkbox label="发送到标签打印机打印" v-model="sendToPeinter" @change="sendToPeinterFun"></el-checkbox>
+                    </view>
+                    <el-radio-group v-model="printer_code">
+                        <el-radio v-for="(item, i) in printerList.printers as any" :key="i" :label="item.value">{{ item.name }}</el-radio>
+                    </el-radio-group>
+                </view>
+            </view> -->
+        </uni-popup-dialog>
+
+        <!-- <template #footer>
+            <div>
+                <el-button @click="printerList.visible = false">{{ t('Cancel') }}</el-button>
+                <el-button :loading="submitLoading" @click="toPrint()" type="primary" v-blur>
+                    {{ '打印' }}
+                </el-button>
+            </div>
+        </template> -->
+    </uni-popup>
+</template>
+<script setup lang="ts">
+import { inject, ref } from 'vue';
+import { printWaybillLabelURL } from '../../utils/api';
+const printerList = inject('printerList') as any;
+const printer_code = ref('');
+const submitLoading = ref(false);
+const downloadFile = ref(true);
+const sendToPeinter = ref(true);
+const sendToPeinterFun = () => {
+    if (!sendToPeinter.value) {
+        printer_code.value = '';
+    } else {
+        printer_code.value = Object.keys(printerList.value.printers)[0];
+    }
+};
+const dialogInputConfirm = () => {
+    printerList.value && (printer_code.value = Object.keys(printerList.value.printers)[0]);
+};
+const openPrinterSelect = () => {
+    printerList.value && (printer_code.value = Object.keys(printerList.value.printers)[0]);
+};
+const toPrint = async () => {
+    const { batoken, postData, resetForm } = printerList.value;
+    /*
+    const loading = ElLoading.service({
+        lock: true,
+        text: 'Loading',
+        background: 'rgba(0, 0, 0, 0.7)',
+    })
+    */
+    submitLoading.value = true;
+    uni.request({
+        url: printWaybillLabelURL,
+        method: 'POST',
+        header: {
+            batoken: batoken
+        },
+        data: {
+            ...postData,
+            printer_code: printer_code.value
+        },
+        success: (res) => {
+            console.log(res);
+        }
+    });
+    /*
+    await postPrint({
+        ...postData,
+        printer_code: printer_code.value
+    })
+        .then((res: any) => {
+            //loading.close()
+            const list = res.data?.label_path || res.data?.labels || (res.data?.express_label ? [res.data?.express_label] : []);
+            if (list.length === 0) {
+                // ElMessage.error('没有可打印的文件');
+                return;
+            }
+
+            list.map((url: string) => {
+                let path = fullUrl(url);
+                window.open(path, '_blank');
+            });
+            submitLoading.value = false;
+            printerList.value.visible = false;
+            resetForm();
+        })
+        .catch((error: any) => {
+            console.log('error--', error);
+            //loading.close()
+            submitLoading.value = false;
+        });
+        */
+};
+</script>
+<script lang="ts">
+import { defineComponent } from 'vue'
+export default defineComponent({
+    name: 'printer-list-scan',
+})
+</script>
+<style scoped lang="scss"></style>

+ 21 - 19
pages/instock/index.vue

@@ -9,7 +9,7 @@
 				<uni-forms-item v-if="valiFormData.search_order_choice === 2" label="批次号" name="batch_number">
 					<uni-data-select v-model="valiFormData.batch_number" :localdata="batchOptions" placeholder="请选择批次号"></uni-data-select>
 				</uni-forms-item>
-				<uni-forms-item v-if="valiFormData.search_order_choice !== 2" label="仓位编码" name="space_code">
+				<uni-forms-item v-if="valiFormData.search_order_choice === 1" label="仓位编码" name="space_code">
 					<uni-data-select v-model="valiFormData.space_code" :localdata="spaces" placeholder="请选择仓位编码"></uni-data-select>
 				</uni-forms-item>
 				<uni-forms-item v-if="valiFormData.search_order_choice !== 2" label="重量" required name="weight">
@@ -97,13 +97,14 @@
 				@close="dialogClose"
 			></uni-popup-dialog>
 		</uni-popup>
-		<PrinterListScan></PrinterListScan>
+		<printer-list-scan></printer-list-scan>
 	</view>
 </template>
 <script>
 import permision from '@/common/permission.js';
+import printerListScan from '@/components/printerListScan';
 import { ref, reactive, nextTick, provide } from 'vue';
-import { instockScanURL, outStockScanURL, weighScanURL, checkWaybillGoodsURL, getWarehouseSpaceURL, getBindParamsURL,getPrinterListURL } from '@/utils/api.js';
+import { instockScanURL, outStockScanURL, weighScanURL, checkWaybillGoodsURL, getWarehouseSpaceURL, getBindParamsURL, getPrinterListURL } from '@/utils/api.js';
 export default {
 	data() {
 		const token = ref(null);
@@ -390,12 +391,8 @@ export default {
 							this.printerList.batoken = this.token;
 							this.printerList.title = '打印尾程面单';
 							this.printerList.postData = {
-								order_no: this.valiFormData.orderNum,
-								weight: this.valiFormData.weight,
-								space_code: this.valiFormData.space_code,
-								is_save_goods: is_save_goods
+								order_no: this.valiFormData.orderNum
 							};
-							this.printerList.postURL = instockScanURL;
 							// this.printerList.resetForm = () => resetForm(ruleFormRef.value);
 							// res.data.data.labels.map((url: string) => {
 							// 	let path = fullUrl(url);
@@ -466,10 +463,8 @@ export default {
 							this.printerList.batoken = this.token;
 							this.printerList.title = '打印尾程面单';
 							this.printerList.postData = {
-								order_no: this.valiFormData.orderNum,
-								batch_number: this.valiFormData.batch_number
+								order_no: this.valiFormData.orderNum
 							};
-							this.printerList.postURL = outStockScanURL;
 							// res.data.data.labels.map((url: string) => {
 							// 	let path = fullUrl(url);
 							// 	window.open(path, '_blank');
@@ -570,14 +565,21 @@ export default {
 			this.instockScan(0);
 		},
 		onsubmit() {
-			this.$refs.valiForm
-				.validate()
-				.then((res) => {
-					this.warehouseScan();
-				})
-				.catch((err) => {
-					console.log('err', err);
-				});
+			this.printerList.visible = true;
+			this.printerList.batoken = this.token;
+			this.printerList.title = '打印尾程面单';
+			this.printerList.postData = {
+				order_no: this.valiFormData.orderNum
+			};
+
+			// this.$refs.valiForm
+			// 	.validate()
+			// 	.then((res) => {
+			// 		this.warehouseScan();
+			// 	})
+			// 	.catch((err) => {
+			// 		console.log('err', err);
+			// 	});
 		},
 		getHistory() {
 			// this.instockHistory = uni.getStorageSync('history')

+ 1 - 0
utils/api.js

@@ -11,6 +11,7 @@ export const getBindParamsURL = baseURL+"/admin/order.scanOrder/getBindParams"//
 export const getPrinterListURL = baseURL+"/admin/printer//getPrinterList"//获取 扫描 托盘号、批次号
 export const bindShippingURL = baseURL+"/admin/order.scanOrder/bindShipping" /*扫描托盘*/
 export const getWaybillsURL = baseURL+"/admin/order.scanOrder/getWaybills" /*扫描托盘*/
+export const printWaybillLabelURL = baseURL+"/admin/order.ScanOrder/printWaybillLabel" /*打印尾程面单*/
 export const loginURL = baseURL+"/admin/index/login"//登录
 export const getcaptchaURL = baseURL+"/api/common/captcha"//获取验证码
 export const pickupWaybillDeliveryOrderURL = baseURL + '/admin/pickup.waybillDeliveryOrder'