|
@@ -151,13 +151,22 @@
|
|
|
<van-picker title="邮购类型" show-toolbar :columns="addlist" @confirm="onConfirm8"
|
|
|
@cancel="addressshow = false" />
|
|
|
</van-popup>
|
|
|
+
|
|
|
+ <!-- 打印机选择器 -->
|
|
|
+ <van-popup v-model="printerShow" position="bottom">
|
|
|
+ <van-picker show-toolbar :columns="getPrintersList" @confirm="onPrinter" @cancel="printerShow = false">
|
|
|
+ <template v-slot:option="value">
|
|
|
+ {{ value.printerName }}
|
|
|
+ </template>
|
|
|
+ </van-picker>
|
|
|
+ </van-popup>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import areaList from "@/script/areas.js"
|
|
|
import { Toast } from 'vant';
|
|
|
-import { saveMailDo, getSendInfo, geLogisticsList } from '../api/index'
|
|
|
+import { saveMailDo, getSendInfo, geLogisticsList, getListOfPrinters, storagePrintSmallTab } from '../api/index'
|
|
|
export default {
|
|
|
|
|
|
data() {
|
|
@@ -202,6 +211,10 @@ export default {
|
|
|
pattern: /^\d{11}$/,
|
|
|
SendInfoValue: {},//寄件人信息
|
|
|
authorization: '',//授权码
|
|
|
+ getPrintersList: [],//打印机获取数据
|
|
|
+ printerShow: false,//打印机出现
|
|
|
+ printerName: '',//选中的打印机名称
|
|
|
+ printerId: '',//选中的打印机id
|
|
|
}
|
|
|
},
|
|
|
created: function () {
|
|
@@ -358,52 +371,42 @@ export default {
|
|
|
Toast('寄件人手机号不能为空')
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
if (!this.pattern.test(this.SendInfoValue.phone)) {
|
|
|
Toast('寄件人手机号码不正确')
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
if (this.transmitMessageVlaue.addresseeName == '' || this.transmitMessageVlaue.addresseeName == undefined) {
|
|
|
Toast('收件人姓名不能为空')
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
if (this.transmitMessageVlaue.addresseePhone == '' || this.transmitMessageVlaue.addresseePhone == undefined) {
|
|
|
Toast('手机号码不能为空')
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
if (!this.pattern.test(this.transmitMessageVlaue.addresseePhone)) {
|
|
|
Toast('收件人手机号码不正确')
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
if (this.expressInfo == '' || this.expressInfo == undefined) {
|
|
|
Toast('请选择快递公司')
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
if (this.wptype == '' || this.wptype == undefined) {
|
|
|
Toast('请选择物品类型')
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
if (this.stepper == '' || this.stepper == undefined) {
|
|
|
Toast('请选择重量')
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
if (this.pricetype == '' || this.pricetype == undefined) {
|
|
|
Toast('请选择付款方式')
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
if (this.authorization == '' & this.SendInfoValue.isVerification == 1) {
|
|
|
Toast('请填写授权码')
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
let payWay = ''
|
|
|
let mainType = ''
|
|
|
if (this.pricetype == "自费(个人件)") {
|
|
@@ -420,6 +423,44 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ const getPrinters = await getListOfPrinters({})
|
|
|
+ if (getPrinters.code == 0) {
|
|
|
+ const qwe = {
|
|
|
+ IMEI: "8672970676795912",
|
|
|
+ companyId: "990b526776e74ff9ab141ff28e09f0922",
|
|
|
+ correspondingRoles: "揽件员2",
|
|
|
+ id: 72,
|
|
|
+ printerName: "禁魔石打印机2",
|
|
|
+ recordDate: "2024-04-12 15:10:12.4282",
|
|
|
+ shareCode: "9077782",
|
|
|
+ st: "12",
|
|
|
+ type: "12",
|
|
|
+ useTheId: "11392",
|
|
|
+ } //脏数据
|
|
|
+ getPrinters.data.push(qwe)
|
|
|
+ this.getPrintersList = getPrinters.data.map((item) => {
|
|
|
+ return { printerName: item.printerName, id: item.id }
|
|
|
+ })
|
|
|
+ this.printerShow = true
|
|
|
+ } else {
|
|
|
+ Toast('系统异常')
|
|
|
+ }
|
|
|
+ return
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ async onPrinter(e) {
|
|
|
+ console.log(e, 'eeeeeeeeeeeeeee')
|
|
|
+ // const toask = this.$toast.loading({
|
|
|
+ // duration: 0, // 持续展示 toast
|
|
|
+ // forbidClick: true,
|
|
|
+ // message: '加载中',
|
|
|
+ // });
|
|
|
+ this.printerName = e.printerName;
|
|
|
+ this.printerId = e.id;
|
|
|
+
|
|
|
+ //先走基础打印
|
|
|
Toast.loading({
|
|
|
message: '保存中...',
|
|
|
forbidClick: true,
|
|
@@ -453,6 +494,7 @@ export default {
|
|
|
addresseeName: this.transmitMessageVlaue.addresseeName,//寄件人姓名
|
|
|
addresseePhone: this.transmitMessageVlaue.addresseePhone,//收件人手机号
|
|
|
verificationCode: this.authorization, //授权码
|
|
|
+ printId: e.id
|
|
|
}
|
|
|
const res = await saveMailDo({ ...parmas })
|
|
|
if (res.msg == 'success') {
|
|
@@ -460,6 +502,19 @@ export default {
|
|
|
this.$router.push('/')
|
|
|
}
|
|
|
Toast.clear()
|
|
|
+
|
|
|
+ // 开始走打印机面单
|
|
|
+ // try {
|
|
|
+ // const res = await storagePrintSmallTab({ printId: e.id })
|
|
|
+ // if (res.msg == 'success') {
|
|
|
+ // Toast('打印成功')
|
|
|
+ // }
|
|
|
+ // console.log(res, '最后')
|
|
|
+ // this.printerShow = false;
|
|
|
+ // } catch (error) {
|
|
|
+
|
|
|
+ // }
|
|
|
+ // toask.clear();
|
|
|
}
|
|
|
},
|
|
|
|