|
@@ -97,14 +97,60 @@
|
|
|
@close="dialogClose"
|
|
|
></uni-popup-dialog>
|
|
|
</uni-popup>
|
|
|
- <printer-list-scan></printer-list-scan>
|
|
|
+
|
|
|
+ <uni-popup ref="printerDialog" type="dialog">
|
|
|
+ <uni-popup-dialog type="info" cancelText="关闭" confirmText="打印" title="打印尾程面单" @confirm="printConfirm">
|
|
|
+ <template #default>
|
|
|
+ <view v-if="printerList">
|
|
|
+ <uni-data-checkbox
|
|
|
+ multiple
|
|
|
+ v-model="downloadFile"
|
|
|
+ :disabled="true"
|
|
|
+ :localdata="[
|
|
|
+ {
|
|
|
+ text: '下载文件',
|
|
|
+ value: 1
|
|
|
+ }
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ >
|
|
|
+ </uni-data-checkbox>
|
|
|
+ <view>
|
|
|
+ <uni-data-checkbox
|
|
|
+ multiple
|
|
|
+ v-model="sendToPeinter"
|
|
|
+ :localdata="[
|
|
|
+ {
|
|
|
+ text: '发送到标签打印机打印',
|
|
|
+ value: 1
|
|
|
+ }
|
|
|
+ ]"
|
|
|
+ @change="sendToPeinterFun"
|
|
|
+ >
|
|
|
+ >
|
|
|
+ </uni-data-checkbox>
|
|
|
+ <uni-data-checkbox v-model="selectPrinter" :localdata="printers"></uni-data-checkbox>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ </uni-popup-dialog>
|
|
|
+ </uni-popup>
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
import permision from '@/common/permission.js';
|
|
|
-import printerListScan from '@/components/printerListScan';
|
|
|
+import printerListScan from './components/printerListScan.vue';
|
|
|
import { ref, reactive, nextTick, provide } from 'vue';
|
|
|
-import { instockScanURL, outStockScanURL, weighScanURL, checkWaybillGoodsURL, getWarehouseSpaceURL, getBindParamsURL, getPrinterListURL } from '@/utils/api.js';
|
|
|
+import {
|
|
|
+ instockScanURL,
|
|
|
+ outStockScanURL,
|
|
|
+ weighScanURL,
|
|
|
+ checkWaybillGoodsURL,
|
|
|
+ printWaybillLabelURL,
|
|
|
+ getWarehouseSpaceURL,
|
|
|
+ getBindParamsURL,
|
|
|
+ getPrinterListURL
|
|
|
+} from '@/utils/api.js';
|
|
|
export default {
|
|
|
data() {
|
|
|
const token = ref(null);
|
|
@@ -119,6 +165,10 @@ export default {
|
|
|
spaces: [],
|
|
|
printerList: {},
|
|
|
instockHistory: [],
|
|
|
+ printers: [],
|
|
|
+ downloadFile: [],
|
|
|
+ sendToPeinter: [1],
|
|
|
+ selectPrinter: 0,
|
|
|
focusType: true,
|
|
|
loading,
|
|
|
// 校验表单数据
|
|
@@ -149,11 +199,6 @@ export default {
|
|
|
]
|
|
|
};
|
|
|
},
|
|
|
- provide() {
|
|
|
- return {
|
|
|
- printerList: this.printerList
|
|
|
- };
|
|
|
- },
|
|
|
computed: {
|
|
|
rules: function () {
|
|
|
return {
|
|
@@ -258,6 +303,12 @@ export default {
|
|
|
success: (res) => {
|
|
|
if (res.data.code === 1) {
|
|
|
this.printerList = res.data.data.printers;
|
|
|
+ this.printers = Object.values(this.printerList).map((item) => {
|
|
|
+ return {
|
|
|
+ text: item.name,
|
|
|
+ value: item.value
|
|
|
+ };
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
fail(e) {
|
|
@@ -387,12 +438,12 @@ export default {
|
|
|
|
|
|
if (res.data.data.labels && res.data.data.labels.length > 0) {
|
|
|
console.log('有打印面单');
|
|
|
- this.printerList.visible = true;
|
|
|
- this.printerList.batoken = this.token;
|
|
|
- this.printerList.title = '打印尾程面单';
|
|
|
- this.printerList.postData = {
|
|
|
- order_no: this.valiFormData.orderNum
|
|
|
- };
|
|
|
+ // this.printerList.visible = true;
|
|
|
+ // this.printerList.batoken = this.token;
|
|
|
+ // this.printerList.title = '打印尾程面单';
|
|
|
+ // this.printerList.postData = {
|
|
|
+ // order_no: this.valiFormData.orderNum
|
|
|
+ // };
|
|
|
// this.printerList.resetForm = () => resetForm(ruleFormRef.value);
|
|
|
// res.data.data.labels.map((url: string) => {
|
|
|
// let path = fullUrl(url);
|
|
@@ -459,12 +510,12 @@ export default {
|
|
|
|
|
|
if (res.data.data.labels && res.data.data.labels.length > 0) {
|
|
|
console.log('有打印面单');
|
|
|
- this.printerList.visible = true;
|
|
|
- this.printerList.batoken = this.token;
|
|
|
- this.printerList.title = '打印尾程面单';
|
|
|
- this.printerList.postData = {
|
|
|
- order_no: this.valiFormData.orderNum
|
|
|
- };
|
|
|
+ // this.printerList.visible = true;
|
|
|
+ // this.printerList.batoken = this.token;
|
|
|
+ // this.printerList.title = '打印尾程面单';
|
|
|
+ // this.printerList.postData = {
|
|
|
+ // order_no: this.valiFormData.orderNum
|
|
|
+ // };
|
|
|
// res.data.data.labels.map((url: string) => {
|
|
|
// let path = fullUrl(url);
|
|
|
// window.open(path, '_blank');
|
|
@@ -564,13 +615,39 @@ export default {
|
|
|
dialogClose() {
|
|
|
this.instockScan(0);
|
|
|
},
|
|
|
+ sendToPeinterFun(res) {
|
|
|
+ if (!res.detail.value.length > 0) {
|
|
|
+ this.selectPrinter = 0;
|
|
|
+ } else {
|
|
|
+ this.selectPrinter = this.printers[0].value;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ printConfirm() {
|
|
|
+ uni.request({
|
|
|
+ url: printWaybillLabelURL,
|
|
|
+ method: 'POST',
|
|
|
+ header: {
|
|
|
+ batoken: this.token
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ order_no: this.valiFormData.orderNum,
|
|
|
+ printer_code: this.selectPrinter
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ console.log('打印成功', res);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
onsubmit() {
|
|
|
- this.printerList.visible = true;
|
|
|
- this.printerList.batoken = this.token;
|
|
|
- this.printerList.title = '打印尾程面单';
|
|
|
- this.printerList.postData = {
|
|
|
- order_no: this.valiFormData.orderNum
|
|
|
- };
|
|
|
+ this.selectPrinter = this.printers[0].value;
|
|
|
+ this.$refs.printerDialog.open();
|
|
|
+
|
|
|
+ // this.printerList.visible = true;
|
|
|
+ // this.printerList.batoken = this.token;
|
|
|
+ // this.printerList.title = '打印尾程面单';
|
|
|
+ // this.printerList.postData = {
|
|
|
+ // order_no: this.valiFormData.orderNum
|
|
|
+ // };
|
|
|
|
|
|
// this.$refs.valiForm
|
|
|
// .validate()
|