chenhaozhe
2025-07-29 372b5a0df938f843f98029a07311120ae23a86d3
优化页面呈现效果
4个文件已修改
228 ■■■■ 已修改文件
pages.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/login.vue 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/tiaomadaying/tiaomadaying.vue 125 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
plugins/BluetoothTool.js 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json
@@ -502,7 +502,7 @@
        {
            "path": "pages/tiaomadaying/tiaomadaying",
            "style": {
                "navigationBarTitleText": "来料条码打印"
                "navigationBarTitleText": "采购条码打印"
            }
        },
        {
pages/index/login.vue
@@ -22,7 +22,8 @@
                        <picker :range="arrayOrganization" :value="Organization" @change="OrganizationChange">
                            <view class="right" style="display: flex;align-items: center;">
                                <input type="text" disabled v-model="Organization" placeholder="请选择当前组织">
                                <uni-icons type="forward" color="#808080" style="border-left: 1px solid #aaaaaa;padding: 0 8rpx;" size="18"></uni-icons>
                                <uni-icons type="forward" color="#808080"
                                    style="border-left: 1px solid #aaaaaa;padding: 0 8rpx;" size="18"></uni-icons>
                            </view>
                        </picker>
                    </view>
@@ -44,16 +45,37 @@
                    <view class="apibtn" @tap="changeApi=true">修改服务器地址</view> -->
                </view>
            </view>
            <hFormAlert v-if="changeApi" placeholder="请输入服务器地址" @confirm="confirm" @cancel="cancel"></hFormAlert>
            <!-- <hFormAlert v-if="changeApi" placeholder="请输入服务器地址" @confirm="confirm" @cancel="cancel"></hFormAlert> -->
            <uni-popup ref="popup" type="center">
                <uni-popup-dialog title="服务器设置" mode="input" @confirm="confirmHandler">
                    <view class="popup-content">
                        <picker class="pop-item" :range="arrayServerOrganization" :value="serverOrganization"
                            @change="serverOrganizationChange">
                            <view class="right" style="display: flex;align-items: center;">
                                <input type="text" disabled v-model="serverOrganization" placeholder="请选择当前组织">
                                <uni-icons type="forward" color="#808080"
                                    style="border-left: 1px solid #aaaaaa;padding: 0 8rpx;" size="18"></uni-icons>
                            </view>
                        </picker>
                        <view class="pop-item">
                            <input type="text" :value="serverUrlCache" placeholder="请输入服务器地址" />
                        </view>
                    </view>
                </uni-popup-dialog>
            </uni-popup>
            
            <view class="btn" @tap="submit">登 录</view>
            <view class="btn apibtn" @tap="changeApi=true">服务器设置</view>
            <!-- <view class="btn apibtn" @tap="changeApi=true">服务器设置</view> -->
            <view class="btn apibtn" @click="openServerSettingHandler">服务器设置</view>
        </view>
    </view>
</template>
<script>
    import { setLoginData,setUserInfo} from "@/utils/auth.js";
    import {
        setLoginData,
        setUserInfo
    } from "@/utils/auth.js";
    import hFormAlert from '@/components/h-form-alert/h-form-alert.vue';
    export default {
        components: {
@@ -64,6 +86,12 @@
                arrayDataBases:[],
                DataBases:'',
                
                arrayServerOrganization: ["浙江智云迈思", "温州海诚"],
                arrayServerOrganizationValues: [
                    'http://47.96.97.237/API/',
                    'http://122.228.39.234:7177/API/'
                ],
                serverOrganization: '',
                arrayOrganization:[],
                Organization:'',
                HOrgNameList:[],
@@ -73,6 +101,7 @@
                PassWord:'',//123456
                changeApi:false,
                serverUrl: uni.getStorageSync('serverUrl')||'http://47.96.97.237/API',
                serverUrlCache: '',
            }
        },
        onLoad() {
@@ -85,8 +114,18 @@
                this.UserName = logindata.UserName
                this.PassWord = logindata.PassWord
            }
            this.serverUrlCache = this.serverUrl
            console.log('this.serverUrlCache: ',this.serverUrlCache);
            let index = this.arrayServerOrganizationValues.findIndex((e) => {
                return e == this.serverUrlCache
            })
            if (index == -1) {
                index = 0
            }
            this.serverOrganization = this.arrayServerOrganization[index]
            this.getOrganization()
            // this.getDataBases()
            this.getDataBases()
        },
        methods: {
            confirm(e){
@@ -96,8 +135,17 @@
                this.changeApi = false
                this.getOrganization()
            },
            confirmHandler() {
                uni.setStorageSync('serverUrl', this.serverUrlCache)
                this.serverUrl = this.serverUrlCache
                // this.changeApi = false
                this.getOrganization()
            },
            cancel(){
                this.changeApi = false
            },
            openServerSettingHandler() {
                this.$refs.popup.open()
            },
            getDataBases(){
                uni.request({
@@ -132,6 +180,8 @@
                            this.arrayOrganization[i] = res.data.data[i].Name
                            this.HOrgNameList[i] = res.data.data[i].ID
                        }
                        this.Organization = res.data.data[0].Name
                        this.HOrgName = res.data.data[0].ID
                        this.$forceUpdate();
                    },
                    fail: (res) => {
@@ -147,6 +197,12 @@
                // console.log(e.detail.value)
                this.Organization = this.arrayOrganization[e.detail.value]
                this.HOrgName = this.HOrgNameList[e.detail.value]
            },
            serverOrganizationChange(e) {
                // console.log(e.detail.value)
                let index = e.detail.value
                this.serverOrganization = this.arrayServerOrganization[index]
                this.serverUrlCache = this.arrayServerOrganizationValues[index]
            },
            submit(){
                if(!this.Organization){
@@ -226,6 +282,7 @@
    left: 0;
    z-index: -1;
}
.container{
    width: 100%;
    height: 100%;
@@ -233,18 +290,21 @@
    flex-direction: column;
    align-items: center;
    justify-content: center;
    .title{
        margin-top: 174rpx;
        font-size: 47rpx;
        font-weight: bold;
        color: #FFFFFF;
    }
    .box{
        width: 682rpx;
        position: relative;
        top: 120rpx;
        display: flex;
        justify-content: center;
        .logo{
            width: 155rpx;
            height: 155rpx;
@@ -253,6 +313,7 @@
            z-index: 9;
            background-color: rgba(255, 255, 255, 0.5);
            border-radius: 100%;
            image{
                width: 100%;
                height: 100%;
@@ -260,6 +321,7 @@
                background-color: #f0f3f7;
            }
        }
        .login{
            width: 100%;
            height: 480rpx;
@@ -270,22 +332,26 @@
            border-radius: 25rpx 0 25rpx 0;
            box-shadow: 0 6rpx 24rpx 8rpx rgba(21, 99, 210, 0.14);
            padding-top: 160rpx;
            .item{
                display: flex;
                align-items: center;
                justify-content: flex-end;
                margin-right: 38rpx;
                margin-bottom: 70rpx;
                .left{
                    font-size: 34rpx;
                    font-weight: 400;
                    color: #3C3C3C;
                }
                .right{
                    width: 441rpx;
                    height: 68rpx;
                    background: #EBEBEB;
                    border-radius: 10rpx;
                    input{
                        height: 100%;
                        padding: 0 30rpx;
@@ -293,6 +359,7 @@
                    }
                }
            }
            // .api{
            //     margin-left: 30rpx;
            //     font-size: 27rpx;
@@ -308,6 +375,7 @@
            // }
        }
    }
    .btn{
        width: 540rpx;
        height: 92rpx;
@@ -321,10 +389,28 @@
        text-align: center;
        font-size: 36rpx;
    }
    .apibtn{
        margin-top: 50rpx;
        background: #eec18e;
        box-shadow: 0rpx 0rpx 44rpx 7rpx rgba(253, 186, 118, 0.3);
    }
}
    .popup-content {
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        gap: 30rpx;
        .pop-item {
            border: #EBEBEB 2rpx solid;
            border-radius: 10rpx;
            padding: 14rpx 8rpx;
        }
        >picker {
            background-color: #EBEBEB;
        }
    }
</style>
pages/tiaomadaying/tiaomadaying.vue
@@ -6,7 +6,8 @@
                <view class="item">
                    <view class="left">条码编号:</view>
                    <view class="right">
                        <input name="HBarCode" v-model="lailiaoInfo.barCodeNo" placeholder="请扫描来料条码" />
                        <input name="HBarCode" v-model="lailiaoInfo.barCodeNo"
                            placeholder="请扫描商品条码" />
                    </view>
                    <view>
                        <uni-icons type="scan"
@@ -77,7 +78,7 @@
            </view>
        </view>
        <view class="operation-zone">
            <button class="btn-c" :disabled="buttonStatus.btn1 == false" @click="GenereateBarCode">生成</button>
            <!-- <button class="btn-c" @click="GenereateBarCode">生成</button> -->
            <button class="btn-c" :disabled="buttonStatus.btn2 == false" @click="print">打印</button>
            <view></view>
            <button class="btn-c" @click="setClearLailiaoInfo">新增</button>
@@ -278,29 +279,42 @@
                    // await this.$nextTick(() => {
                    //     this.$refs.labelPrinter.execPrint()
                    // })
// T 24 0 300 280 计划跟踪号: ${this.lailiaoInfo.HMTONo || ''}
                    this.printInfo = `! 0 200 200 400 1
PAGE-WIDTH 608
SETQRVER 3
B QR 500 30 M 2 U 3
LA,${this.generatedBarCode}
B QR 440 30 M 4 U 6
LA,${this.lailiaoInfo.barCodeNo}
ENDQR
T 24 0 30 30 供应商: ${this.lailiaoInfo.HSupName}
T 24 0 30 80 供应商料号:
T 24 0 30 130 物料编码: ${this.lailiaoInfo.HMaterName}
T 24 0 30 180 物料分组:
T 24 0 300 180 规格型号: ${this.lailiaoInfo.HMaterModel}
T 24 0 30 230 数量:  ${this.lailiaoInfo.HQty}
T 24 0 300 230 日期:
T 24 0 30 280 检验员:
T 24 0 300 280 计划跟踪号: ${this.lailiaoInfo.HMTONo || ''}
T 24 0 30 330 检验结果:
T 24 0 10 30 供应商: ${this.lailiaoInfo.HSupName}
T 24 0 10 55 (eng)
T 24 0 10 80 供应商料号:  ${this.lailiaoInfo.HMaterNumber}
T 24 0 10 105 (eng)
T 24 0 10 130 物料名称: ${this.lailiaoInfo.HMaterName}
T 24 0 5 155 (eng)
T 24 0 5 180 分组: ${this.lailiaoInfo.HBatchNo}
T 24 0 5 205 (eng)
T 24 0 300 180 规格: ${this.lailiaoInfo.HMaterModel}
T 24 0 300 205 (eng)
T 24 0 10 230 数量:  ${this.lailiaoInfo.HQty} (${this.lailiaoInfo.HPcsName})
T 24 0 5 255 (eng)
T 24 0 300 230 日期: ${this.lailiaoInfo.HDate}
T 24 0 300 255 (eng)
T 24 0 5 280 检验员:
T 24 0 5 305 (eng)
T 24 0 300 280 采购单号: ${this.lailiaoInfo.HBillNo || ''}
T 24 0 300 305 (eng)
T 24 0 5 330 检验结果:
T 24 0 5 355 (eng)
BOX 260 330 280 350 4
T 24 0 290 330 合格
T 24 0 290 355 (eng)
BOX 360 330 380 350 4
T 24 0 390 330 不合格
T 24 0 390 355 (eng)
BOX 480 330 500 350 4
T 24 0 510 330 特采
T 24 0 510 355 (eng)
FORM
PRINT`
@@ -319,6 +333,7 @@
                    })
                }
                let d = data[row - 1]
                console.log('条码接收数据: ',d)
                this.lailiaoInfo = Object.assign(this.lailiaoInfo, {
                    HMaterNumber: d['物料编码'],
                    HMaterName: d['物料名称'],
@@ -327,13 +342,15 @@
                    HQty: d['数量'],
                    HMinQty: d['数量'],
                    HBQty: d['数量'],
                    HDate: d['日期'],
                    HSupID: d['HSupID'],
                    HSupName: d['供应商'],
                    HSupNameShort: d['供应商'],
                    HMTONo: d['订单跟踪号'],
                    HMTONo: d['计划跟踪号'],
                    HMainID: d['linterid'],
                    HSubID: d['HEntryID'],
                    HMaterID: d['HMaterID'],
                    HPcsName: d['计量单位']
                })
            },
            setClearLailiaoInfo() {
@@ -370,6 +387,7 @@
                            console.log('条码内容:' + res.result);
                            this.lailiaoInfo.barCodeNo = res.result;
                            if (res.result.includes("@") === false) {
                                this.buttonStatus.btn2 = false
                                return uni.showToast({
                                    icon: 'none',
                                    title: '条码格式错误,请重新扫描...'
@@ -396,10 +414,11 @@
                                    } = res.data
                                    if (count > 0) {
                                        this.setLailiaoInfo(data, Row)
                                        this.buttonStatus.btn2 = true
                                    }
                                },
                                (error) => {
                                    this.buttonStatus.btn2 = false
                                }
                            )
@@ -416,49 +435,49 @@
                //获取选择的工厂代码
                let CampanyName = "xxx";
                //获取选择的源单类型
                let HSourceBillType = "来料通知单";
                let HSourceBillType = "采购订单";
                //获取选择的条码类型
                let HSelectBarCodeType = "唯一条码";
                let HSelectBarCodeType = "品种条码";
                //获取当前登录人员
                let UserName = uni.getStorageSync('HUserName');
                let sMainSub = sMainStr + ';' + HOrgType + ';' + HSourceBillType + ';' + HSelectBarCodeType + ';' +
                    CampanyName + ';' + UserName;
                CommonUtils.doRequest(
                    "/Sc_BarCode/Sub_SaveBill", {
                        msg: sMainSub,
                        CampanyName: CampanyName
                    },
                    (res) => {
                        console.log(res)
                        let {
                            data,
                            count,
                            Message
                        } = res.data
                        if (count > 0) {
                            this.buttonStatus = {
                                btn1: false,
                                btn2: true
                            }
                            this.generatedBarCode = data[0]['条码编号']
                            console.log(this.generatedBarCode)
                            uni.showToast({
                                icon: 'none',
                                title: Message
                            })
                        } else {
                            uni.showToast({
                                icon: 'none',
                                title: Message
                            })
                        }
                    },
                    (err) => {
                // CommonUtils.doRequest(
                //     "/Sc_BarCode/Sub_SaveBill", {
                //         msg: sMainSub,
                //         CampanyName: CampanyName
                //     },
                //     (res) => {
                //         console.log(res)
                //         let {
                //             data,
                //             count,
                //             Message
                //         } = res.data
                //         if (count > 0) {
                //             this.buttonStatus = {
                //                 btn1: false,
                //                 btn2: true
                //             }
                //             this.generatedBarCode = data[0]['条码编号']
                //             console.log(this.generatedBarCode)
                //             uni.showToast({
                //                 icon: 'none',
                //                 title: Message
                //             })
                //         } else {
                //             uni.showToast({
                //                 icon: 'none',
                //                 title: Message
                //             })
                //         }
                //     },
                //     (err) => {
                    },
                    "POST"
                )
                //     },
                //     "POST"
                // )
            },
            exit() {
                uni.navigateBack()
plugins/BluetoothTool.js
@@ -181,15 +181,17 @@
        
         //6.0以后的如果需要利用本机查找周围的wifi和蓝牙设备, 申请权限
        if(Build.VERSION.SDK_INT >= 6.0){
            console.log('Build.VERSION.SDK_INT: ',Build.VERSION.SDK_INT);
        }
        let options = this.options
        btFindReceiver = plus.android.implements("io.dcloud.android.content.BroadcastReceiver", {
            "onReceive": function(context, intent) {
                plus.android.importClass(context);
                plus.android.importClass(intent);
                let action = intent.getAction();
                console.log(BluetoothDevice)
                if(BluetoothDevice.ACTION_FOUND == action) { // 找到设备
                    let device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
                    let newDevice = {
@@ -204,6 +206,7 @@
                }
            }
        });
        let filter = new IntentFilter();
        filter.addAction(BluetoothDevice.ACTION_FOUND);
        filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);