This commit is contained in:
aihe 2023-12-23 15:50:49 +08:00
parent 1b82cde9e1
commit c403eabc4d
5 changed files with 200 additions and 116 deletions

View File

@ -66,7 +66,10 @@ const scanCode = ()=> {
return new Promise((resolve, reject)=> {
uni.scanCode({
onlyFromCamera: false,
success: resolve,
success: (res) =>{
console.log("scanCode res========", res)
resolve(res.result)
},
fail: reject
})
})

View File

@ -1,16 +1,11 @@
<template>
<view>
日志======
<view v-for="(v, index) in debugLog" class="">{{index + 1}}: {{v}}</view>
</view>
<view></view>
</template>
<script>
export default {
props: {
customintent: {
type: Object,
default () {
return {
// !!注意: 不同的设备配置项是不同的
@ -20,10 +15,14 @@
}
}
},
value: {
default () {
return ''
}
},
},
data() {
return {
debugLog: [],
receiver: '',
filter: '',
codeQueryTag: false,
@ -35,72 +34,70 @@
this.startScan();
},
onHide() {
this.stopScan();
// this.stopScan();
},
destroyed() {
unmounted() {
this.stopScan();
},
methods: {
initScan() {
let that = this;
that.debugLog.push("执行initScan调用")
that.debugLog.push("actionKey==== " + that.customintent.actionKey)
that.debugLog.push("codeKey==== " + that.customintent.codeKey)
console.log("执行initScan调用")
console.log("actionKey==== " + that.customintent.actionKey)
console.log("codeKey==== " + that.customintent.codeKey)
// #ifdef APP
that.debugLog.push('initScan');
console.log('initScan');
that.main = plus.android.runtimeMainActivity(); //获取activity
//var context = plus.android.importClass('android.content.Context'); //上下文
var IntentFilter = plus.android.importClass('android.content.IntentFilter');
that.filter = new IntentFilter();
//下面的addAction内改为自己的广播动作
that.filter.addAction(that.customintent.actionKey);
that.debugLog.push("receive_pda_sn注册成功")
console.log("receive_pda_sn注册成功")
that.receiver = plus.android.implements('io.dcloud.feature.internal.reflect.BroadcastReceiver', {
onReceive: (context, intent) => {
that.debugLog.push("BroadcastReceiver--onReceive-回调执行")
that.debugLog.push('onReceive');
console.log("BroadcastReceiver--onReceive-回调执行")
console.log('onReceive');
plus.android.importClass(intent);
//下面的getStringExtra内改为自己的广播标签--有误
let code = intent.getStringExtra(that.customintent.codeKey);
that.debugLog.push("getStringExtra - code:" + code)
console.log("getStringExtra - code:" + code)
that.queryCode(code);
}
});
that.debugLog.push("BroadcastReceiver绑定完成")
console.log("BroadcastReceiver绑定完成")
// #endif
},
startScan() {
const that = this
// #ifdef APP
this.main.registerReceiver(this.receiver, this.filter);
that.debugLog.push('startScan');
console.log('startScan');
// #endif
},
stopScan() {
console.log('stopScan');
const that = this
// #ifdef APP
this.main.unregisterReceiver(this.receiver);
that.debugLog.push('stopScan');
// #endif
},
queryCode: function(code) {
let that = this;
// #ifdef APP
that.debugLog.push('queryCode');
console.log('queryCode');
if (that.codeQueryTag) return false;
that.codeQueryTag = true;
setTimeout(function() {
that.codeQueryTag = false;
}, 150);
uni.$emit('wuli-appscan', {
code
})
that.debugLog.push("uni.$emit触发wuli-appscan")
that.$emit('onChange', code)
console.log("uni.$emit触发wuli-appscan")
// #endif
},
triggerKeyScan() {
const that = this
that.debugLog.push("执行triggerKeyScan调用")
console.log("执行triggerKeyScan调用")
debugger
// #ifdef APP
//获取Android意图类
@ -110,10 +107,10 @@
//定义意图,模拟按下L键,L键实际上是打开激光的物理键映射,由厂商提供
const scanDownKey = "com.android.action.keyevent." + this.customintent.scanDownKey
intent.setAction(scanDownKey);
that.debugLog.push("模拟按下L键: " + scanDownKey)
console.log("模拟按下L键: " + scanDownKey)
//广播这个意图
that.main.sendBroadcast(intent);
that.debugLog.push("广播按下L键")
console.log("广播按下L键")
// #endif
}
}

View File

@ -0,0 +1,69 @@
<template>
<u-input :placeholder="placeholder" :fontSize="fontSize" :modelValue="value"
:custom-style="`border-radius: 10rpx;padding: 8rpx 12rpx;${customStyle};`"
@change="handleChange"
>
<template v-slot:prefix>
<u-icon @click="handleScan" name="scan" :size="fontSize*1.5"></u-icon>
</template>
</u-input>
<tpx-physics-scan onChange="handleChange"></tpx-physics-scan>
</template>
<script>
import { scanCode } from "@/common/untool"
export default {
props: {
value: {
default () {
return ''
}
},
placeholder:{
default () {
return '请输入或扫码'
}
},
fontSize: {
default () {
return 26
}
},
customStyle:{
default () {
return ''
}
},
placeholderStyle:{
default () {
return ''
}
},
},
data() {
},
created() {
},
onHide() {
},
destroyed() {},
methods: {
async handleScan() {
const res = await scanCode()
this.handleChange(res)
},
handleChange(val){
this.$emit('change', val)
this.$emit('update:value', val)
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@ -3,60 +3,21 @@
<template v-slot:body>
<view class="com-jianju pos-rlt pb-30" style="padding-top: 2rpx;">
<view class="blcok-white">
<view>
<u-row @click="handleAddressChoose(1)" custom-style="position:relative;" align="top"
justify="between">
<view>
<image style="height: 50rpx;width: 42rpx;" :src="getCdnUrl(`post/ji.png`)"></image>
</view>
<view style="flex: 1;padding: 0 30rpx;">
<u-text text="寄件人信息" size="28" :bold="true"></u-text>
<view style="margin: 8rpx 0 0 0;">
<u-text text="请新建您的寄件地址信息" size="26" color="#999"></u-text>
</view>
</view>
<view class="flex-column-center">
<image style="height: 32rpx;width: 28rpx;" :src="getCdnUrl(`post/adress.png`)">
</image>
<u-text align="center" text="地址薄" size="26" :bold="true"
margin="8rpx 0 0 0"></u-text>
</view>
<view style="position: absolute;left: 20rpx;bottom: -20rpx;top: 46rpx;">
<u-line custom-style="height:100%;" direction="col" dashed="true"></u-line>
</view>
</u-row>
<view style="padding-left: 76rpx;">
<u-line margin="20rpx 0"></u-line>
</view>
<u-row @click="handleAddressChoose(2)" custom-style="position:relative;" align="top"
justify="between">
<view style="position: absolute;left: 20rpx;top: -20rpx;bottom: 100%;">
<u-line custom-style="height:100%;" direction="col" dashed="true"></u-line>
</view>
<view>
<image style="height: 50rpx;width: 42rpx;" :src="getCdnUrl(`post/shou.png`)">
</image>
</view>
<view class="pr-30 pl-30" style="flex: 1;">
<u-text text="收件人信息" size="28" :bold="true"></u-text>
<view style="margin: 8rpx 0 0 0;">
<u-text text="请填写收件人国家、姓名,电话" size="26" color="#999"></u-text>
</view>
</view>
<view class="flex-column-center">
<image style="height: 32rpx;width: 28rpx;" :src="getCdnUrl(`post/adress.png`)">
</image>
<u-text align="center" text="地址薄" size="26" :bold="true"
margin="8rpx 0 0 0"></u-text>
</view>
</u-row>
</view>
</view>
<view class="blcok-white" style="padding-top: 0;padding-bottom: 0;">
<view>
<view @click="handleDialogClick(countryModal)" class="pt-30 pb-30" style="border-bottom: 2rpx solid #F6F6F6;" >
<u-row>
<view>
<u-text text="始发网点" size="28" :bold="true"></u-text>
</view>
<u-row custom-style="flex: 1;" justify="end" align="center">
<u-text align="right" margin="0 12rpx 0 0" size="26" text="柬埔寨"></u-text>
<u-icon size="26" name="arrow-right" color="#333"></u-icon>
</u-row>
</u-row>
</view>
<view @click="handleDialogClick(countryModal)" class="pt-30 pb-30" style="border-bottom: 2rpx solid #F6F6F6;" >
<u-row>
<view>
@ -68,7 +29,29 @@
</u-row>
</u-row>
</view>
<view @click="handleDialogClick(countryModal)" class="pt-30 pb-30" style="border-bottom: 2rpx solid #F6F6F6;" >
<u-row>
<view>
<u-text text="省/州" size="28" :bold="true"></u-text>
</view>
<u-row custom-style="flex: 1;" justify="end" align="center">
<u-text align="right" margin="0 12rpx 0 0" size="26" text="柬埔寨"></u-text>
<u-icon size="26" name="arrow-right" color="#333"></u-icon>
</u-row>
</u-row>
</view>
<view @click="handleDialogClick(countryModal)" class="pt-30 pb-30" style="border-bottom: 2rpx solid #F6F6F6;" >
<u-row>
<view>
<u-text text="目的网点" size="28" :bold="true"></u-text>
</view>
<u-row custom-style="flex: 1;" justify="end" align="center">
<u-text align="right" margin="0 12rpx 0 0" size="26" text="柬埔寨"></u-text>
<u-icon size="26" name="arrow-right" color="#333"></u-icon>
</u-row>
</u-row>
</view>
<view @click="handleDialogClick(wayModal)" class="pt-30 pb-30" style="border-bottom: 2rpx solid #F6F6F6;;">
<u-row>
<view>
@ -81,7 +64,40 @@
</u-row>
</u-row>
</view>
<view class="pt-30 pb-30" style="border-bottom: 2rpx solid #F6F6F6;;">
<tpx-select v-model:value="submitParam.type1" :list="baoguanList"
mode="drop" customInput="true"
>
<u-row>
<view>
<u-text text="报关方式" size="28" :bold="true"></u-text>
</view>
<u-row custom-style="flex: 1;" justify="end" align="center">
<u-text align="right" margin="0 12rpx 0 0" size="26" color="#999"
text="请选择"></u-text>
<u-icon size="26" name="arrow-right" color="#333"></u-icon>
</u-row>
</u-row>
</tpx-select>
</view>
<view class="pt-30 pb-30" style="border-bottom: 2rpx solid #F6F6F6;;">
<tpx-select v-model:value="submitParam.type2" :list="qingguanList"
mode="drop" customInput="true"
>
<u-row>
<view>
<u-text text="清关方式" size="28" :bold="true"></u-text>
</view>
<u-row custom-style="flex: 1;" justify="end" align="center">
<u-text align="right" margin="0 12rpx 0 0" size="26" color="#999"
text="请选择"></u-text>
<u-icon size="26" name="arrow-right" color="#333"></u-icon>
</u-row>
</u-row>
</tpx-select>
</view>
<view @click="handleDialogClick(goodChooseModal)" class="pt-30 pb-30" style="border-bottom: 2rpx solid #F6F6F6;;"
v-if="submitParam.type != sendTypeEnum.container"
@ -160,7 +176,7 @@
<script>
import getCdnUrl from "@/common/getCdnUrl"
import { sendTypeEnum, sendTypeList } from "@/common/enum"
import { sendTypeEnum, sendTypeList, qingguanList, baoguanList, } from "@/common/enum"
import { goto } from "@/common/untool"
export default {
props: {
@ -173,7 +189,7 @@
},
data() {
return {
...(JSON.parse(JSON.stringify({ sendTypeEnum, sendTypeList }))),
...(JSON.parse(JSON.stringify({ sendTypeEnum, sendTypeList, qingguanList, baoguanList }))),
proList: [
{val: 1 },{ val: 2 }
],

View File

@ -2,14 +2,35 @@
<tpx-layout>
<template v-slot:body>
<view class="com-jianju pos-rlt pb-30" style="padding-top: 2rpx;">
<view class="blcok" style="background-color: #0E0708;">
<u-row>
<image class="mr-20" style="height: 28rpx;width: 34rpx;"
:src="getCdnUrl(`post/gangbo.png`)"></image>
<u-text size="24" color="#fff" text="下单后会有业务员及时联系您,请保持电话畅通!"></u-text>
<view class="blcok-white">
<u-row justify="between">
<view style="width: 130rpx;">运单号</view>
<view style="flex:1;">
<tpx-scan-input v-model:value="submitParam.yundanhao"></tpx-scan-input>
</view>
<view class="pl-10">
<u-checkbox-group placement="column" @change="handleAgree()">
<u-checkbox size="26" labelSize="26" :checked="agreePrivateRule" label="电子主单"
label-color=":#999" activeColor="#B12D29"
custom-style="margin-bottom: 10rpx;"></u-checkbox>
</u-checkbox-group>
</view>
</u-row>
<u-row justify="between" custom-style="margin-top:20rpx;">
<view style="width: 130rpx;">选择客户</view>
<view style="flex:1;">
<u-input placeholder="请输入客户手机号" font-size="26"
custom-style="border-radius: 10rpx;padding: 8rpx 12rpx;"
>
</u-input>
</view>
<view class="pl-10">
<u-button custom-style="width: 140rpx;height:56rpx;border-radius: 10rpx;font-size: 28rpx;">确定</u-button>
</view>
</u-row>
</view>
<view class="blcok-white">
<view>
<u-row @click="handleAddressChoose(1)" custom-style="position:relative;" align="top"
@ -204,32 +225,9 @@
</template>
<template v-slot:footer>
<view class="pos-rlt blcok-white" style="border-radius: 0;margin-top: 0;">
<u-row justify="between">
<view>
<u-row align="top">
<u-checkbox-group placement="column" @change="handleAgree()">
<u-checkbox size="26" labelSize="26" :checked="agreePrivateRule" label="我已同意接受"
label-color=":#999" activeColor="#B12D29"
custom-style="margin-bottom: 10rpx;"></u-checkbox>
</u-checkbox-group>
<view @click="handleDialogClick(privacyModal)" class="pl-10" style="padding-top: 6rpx;">
<u-text text="《快件运单契约条款》" size="26"></u-text>
</view>
</u-row>
<view @click="handleAgree()">
<u-row>
<view class="mr-10">
<u-text text="预估" :bold="true" size="28"></u-text>
</view>
<u-text :text="80" mode="price" color="#B12D29" :bold="true" size="28"></u-text>
</u-row>
<u-text margin="10rpx 0 0 0" text="温馨提示:具体费用以快递小哥核实为准" color="#999" size="26"></u-text>
</view>
</view>
<u-row>
<u-button size="large" shape="circle"
custom-style="width: 200rpx;height:80rpx;font-size: 30rpx;" type="primary">下单</u-button>
</u-row>
<u-row>
<u-button size="large" shape="circle"
custom-style="width: 500rpx;height:80rpx;font-size: 30rpx;" type="primary">提交订单</u-button>
</u-row>
</view>
</template>
@ -291,6 +289,7 @@
show: false,
},
submitParam: {
yundanhao: '',
stockRoomId: '',
countryId: '',
wayId: '',