#
whycq
2023-12-01 d8e6f395fea1419c73f6b6f0a2ddd75eac3eed84
#
3个文件已添加
5个文件已修改
624 ■■■■■ 已修改文件
components/x-input/x-input.vue 215 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
components/z-input/z-input.vue 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
components/z-list/z-list.vue 148 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
components/zzz/zzz.vue 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/api/addMat.js 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/api/common/common.js 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/project/pakin/pakin.vue 93 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/project/project.json 71 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
components/x-input/x-input.vue
New file
@@ -0,0 +1,215 @@
<template>
    <view>
        <view class="main">
            <view class="inner1">{{attribute.lable}}</view>
            <view class="put inner2">
                <uni-icons class="p-icon"
                    type="scan"
                    size="16"
                    color="#a6a6a6"
                    @click="scanCode"
                    v-show="attribute.scanCode"
                    >
                </uni-icons>
                <input class="p-input"
                    type="text"
                    :placeholder="placeholder"
                    v-model="zzz"
                    :focus="focusData"
                    @input="change"
                    >
                <uni-icons class="p-icon"
                    type="closeempty"
                    size="16"
                    color="#b9b9b9"
                    v-show="data.length"
                    @click="clear">
                </uni-icons>
            </view>
            <view class="inner3" v-show="btn">
                <button class="m-btn" size="mini" @click="clickBtn">{{btnName}}</button>
            </view>
        </view>
    </view>
</template>
<script>
    export default {
        name:"x-input",
        data() {
            return {
                data:'',
                focusData: false
            };
        },
        props: {
            attribute: {
                type: Object,
                default() {
                    return {}
                }
            },
            index: {
                type: Number,
                default: 0
            },
            lable: {
                type: String,
                default: ''
            },
            name: {
                type: String,
                default: ''
            },
            btn: {
                type: Boolean,
                default: false
            },
            btnName: {
                type: String,
                default: 'button'
            },
            placeholder: {
                type: String,
                default: '扫码 / 录入'
            },
            value: {
                type: [String,Number],
                default: ''
            },
            v: {
                type: [String,Number],
                default: ''
            },
            lenCheck: {
                type: [Number],
                default: null
            },
            focus: {
                type: Boolean,
                default: false
            }
        },
        watch: {
            data(val) {
                // if (!this.lenCheck) {
                //     this.$emit('input',val)
                //     return
                // }
                // if (val.length != this.lenCheck) {
                //     setTimeout(()=>{
                //         this.data = ''
                //         this.$emit('input','')
                //     },10)
                // } else {
                //     this.$emit('input',val)
                // }
            },
            value(val) {
                this.data = val
            },
            focus(f) {
                this.focusData = !f
                setTimeout(()=>{
                    this.focusData = f
                },10)
            },
            zzz(val) {
                // this.v = val
            }
        },
        created() {
            this.data = this.value
            this.focusData = this.focus
        },
        methods: {
            change() {
                let _this = this
                console.log(`值改变了: ${this.zzz}`);
                // if (this.data.length > 8) {
                //     this.data = 66666
                // }
                this.$emit('change')
            },
            clear() {
                this.data = ''
                console.log(this.attribute);
            },
            clickBtn() {
                this.$emit('clickBtn');
            },
            inputVal() {
                this.$emit('inputVal',[this.data,this.name]);
            },
            scanCode() {
                let _this = this
                uni.scanCode({
                    onlyFromCamera: true,
                    success(res) {
                        _this.$parent.scanCode(res.result)
                        _this.data = res.result
                        console.log('扫到了');
                        console.log(res);
                    }
                })
            }
        }
    }
</script>
<style scoped>
    .main {
        display: flex;
        align-items: center;
        min-height: 50px;
        background-color: #fff;
    }
    .put {
        display: flex;
        flex-shrink: 0;
    }
    .inner1 {
        width: 55px;
        padding-left: 8px;
        color: #606164;
        font-weight: 900;
        font-family:'Helvetica Neue';
    }
    .inner2 {
        background-color: #f8f8f8;
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 5px;
        margin-right: 32rpx;
        color: #606266;
    }
    .p-input {
        flex:1;
        padding: 4px;
    }
    .p-icon {
        margin-left: 4px;
        margin-right: 4px;
    }
    .inner3 {
        width: 90px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .m-btn {
        background-color: #00aeec;
        color: #FFF;
    }
    .m-btn:active {
        background-color: #55bbff;
        color: #FFF;
    }
</style>
components/z-input/z-input.vue
@@ -7,6 +7,7 @@
                    type="scan" 
                    size="16" 
                    color="#a6a6a6" 
                    @click="scanCode"
                    >
                </uni-icons>
                <input class="p-input" 
@@ -87,7 +88,7 @@
                    setTimeout(()=>{
                        this.data = ''
                        this.$emit('input','')
                    },10)
                    },0)
                } else {
                    this.$emit('input',val)
                }
@@ -115,6 +116,18 @@
            },
            inputVal() {
                this.$emit('inputVal',[this.data,this.name]);
            },
            scanCode() {
                let _this = this
                uni.scanCode({
                    onlyFromCamera: true,
                    success(res) {
                        _this.$parent.scanCode(res.result)
                        _this.data = res.result
                        console.log('扫到了');
                        console.log(res);
                    }
                })
            }
        }
    }
components/z-list/z-list.vue
New file
@@ -0,0 +1,148 @@
<template>
    <view >
        <view class="main">
            <view class="main-left" >
                <view class="main-list" v-for="it in list" style="width: 100%;">
                    <view class="left-key">{{it.key}}</view>
                    <view>:</view>
                    <view class="left-val">
                        <text :class="it.valText">{{it.value}}</text>
                    </view>
                </view>
            </view>
            <uni-badge
                class="main-right uni-badge-left-margin"
                :text="index"
                absolute="rightTop"
                size="small"
                type="primary"
                >
                <view style="height: 100%;display: flex;align-items: center;" @click="goDetail">
                    <view class="list-options">
                        <uni-icons class="opt-icon" type="right" size="20" color="#b9b9b9"></uni-icons>
                    </view>
                </view>
            </uni-badge>
        </view>
    </view>
</template>
<script>
    export default {
        name:"z-list",
        data() {
            return {
                dataList: [
                    {key: '商品编码',value: 'fbr3242'},
                    {key: '批号',value: '20231006'},
                    {key: '数量',value: '200'},
                    {key: '商品编码',value: 'fbr3242'},
                    {key: '批号',value: '20231006'},
                    {key: '数量',value: '200'}
                ],
                detailList: [],
                dataKey: {},
                valText: 'val-text'
            };
        },
        methods: {
            goDetail() {
                this.$emit('goDetail');
            }
        },
        created() {
            // this.dataList = this.list.detl
        },
        props: {
            list: {
                type: Array,
                default() {
                    return {}
                }
            },
            keyName: {
                type: Object,
                default() {
                    return {}
                }
            },
            index: {
                type: Number,
                default: 2
            }
        }
    }
</script>
<!-- align-items: stretch -->
<!-- 牛逼!!! -->
<!-- 设置align-items为stretch,使子元素填充垂直方向的可用高度,实现高度相等的效果。 -->
<style scoped>
    .main {
        position: relative;
        min-height: 35px;
        background-color: #f5f5f5;
        display: flex;
        align-items: stretch;
        margin: 8px 12px 8px 12px;
        border-radius: 8px;
    }
    .main-left {
        flex: 7;
        display: flex;
        flex-direction: column;
        padding-top: 4px;
        padding-bottom: 4px;
        color: #606164;
        font-size: 14px;
    }
    .main-right {
        width: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-left: 1px solid #ffffff;
    }
    .main-right:active {
        background-color: #e3e5e7;
        color: #FFF;
    }
    .main-list {
        display: flex;
        align-items: center;
        margin: 2px 0;
    }
    .list-options {
        display: flex;
        flex-direction: column;
    }
    .list-number {
        position: absolute;
        right: 10px;
        top: 5px;
    }
    .opt-icon {
        display: flex;
    }
    .left-key {
        width: 65px;
        padding-right: 4px;
        text-align: end;
        font-weight: 700;
    }
    .left-val {
        flex: 1;
        padding-left: 4px;
        color: #606266;
    }
    .val-text {
        background-color: #00aeec;
        padding: 2px 4px;
        border-radius: 4px;
        color: #FFF;
    }
    .val-num {
        font-weight: 900;
        color: #d19a66;
        font-size: 16px;
    }
</style>
components/zzz/zzz.vue
New file
@@ -0,0 +1,70 @@
<template>
    <view>
        <uni-icons class="p-icon"
            type="scan"
            size="16"
            color="#a6a6a6"
            @click="scanCode"
            >
            </uni-icons>
        <input v-model="data" @input="change" >
    </view>
</template>
<script>
    export default {
        name:"zzz",
        data() {
            return {
                data: ''
            };
        },
        props: {
            value: {
                type: String,
                default: ""
            },
        },
        watch: {
            data(val){
                if (val.length != 8) {
                    setTimeout(()=>{
                        this.data = ''
                        // this.value = '9999'
                        this.$emit('input','')
                    },0)
                } else {
                    this.$emit('input',val)
                }
            },
            value(val) {
                this.data = val
            }
        },
        created() {
            this.data = this.value
        },
        methods: {
            change() {
                this.$emit('change1')
            },
            scanCode() {
                let _this = this
                uni.scanCode({
                    onlyFromCamera: true,
                    success(res) {
                        _this.$parent.scanCode(res.result)
                        _this.data = res.result
                        _this.value = res.result
                        console.log('扫到了');
                        console.log(res);
                    }
                })
            }
        }
    }
</script>
<style>
</style>
pages/api/addMat.js
@@ -1,5 +1,8 @@
let network = uni.getStorageSync('Network')
let baseUrl = `http://${network[0].ip}:${network[0].port}/${network[0].address}`
let baseUrl = ''
if (network) {
    baseUrl = `http://${network[0].ip}:${network[0].port}/${network[0].address}`
}
async function addMat(matnr) {
    let that = this,item = {};
    var ress = await uni.request({
pages/api/common/common.js
@@ -1,8 +1,11 @@
import md5 from '@/static/js/md5.js'
let network = uni.getStorageSync('Network')
let baseUrl = `http://${network[0].ip}:${network[0].port}/${network[0].address}`
let baseUrl = ''
if (network) {
    baseUrl = `http://${network[0].ip}:${network[0].port}/${network[0].address}`
}
console.log(network);
async function onLogin(user) {
    let _this = this,
        item = {};
pages/project/pakin/pakin.vue
@@ -1,22 +1,46 @@
<template>
    <view>
        <view class="head">
            <z-input v-for="it in input"
            :desc="it.title"
            :name="it.name"
            :btn="it.btn"
            :btn-name="it.btnName"
            v-model="it.val"
            :index="it.id"
            :lenCheck="it.lenCheck"
            :focus="it.focus"
            @inputVal='input2'
            ></z-input>
            <z-input :desc="input1.title"
                :name="input1.name"
                :btn="input1.btn"
                :btn-name="input1.btnName"
                v-model="barcode"
                :index="input1.id"
                :lenCheck="input1.lenCheck"
                :focus="input1.focus"
                @inputVal='input3'
            />
            <z-input
            :desc="input2.title"
            :name="input2.name"
            :btn="input2.btn"
            :btn-name="input2.btnName"
            v-model="matnr"
            :index="input2.id"
            :lenCheck="input2.lenCheck"
            :focus="input2.focus"
            @inputVal='input3'
            />
        </view>
        <!-- 基本属性绑定 -->
        <!-- 光标复位 -->
        <!-- 长度判断 -->
        
        <u-sticky  >
            <view class="sticky">商品列表</view>
            <view class="sticky">
                <view class="flex1">开启键盘</view>
                <view class="flex1">商品列表</view>
                <view class="flex1"></view>
            </view>
        </u-sticky>
        <view>barcode:{{barcode}}</view>
        <!-- <zzz v-model="barcode" @change1='change' @input="inputz"></zzz> -->
        <view>matnr:{{matnr}}</view>
        <!-- <zzz v-model="matnr" @change1='change' @input="inputz"></zzz> -->
        
        <z-data-list class="data-list"
            v-for="(it,i) in zDataList" 
@@ -24,20 +48,14 @@
            :lable="lable" 
            :fields="it"
            :index="i+1"
            @goDetail='goDetail(it.detl,i)'
            @goDetail='goDetail(it,i)'
        ></z-data-list>
        <!-- 垫高 -->
        <view style="height: 100rpx;"></view>
        
        <view class="z-floor">
            <view class="z-default">重置</view>
            <view class="z-primary">组托</view>
            <view class="z-primary" @click="comb">组托</view>
        </view>
        
    </view>
@@ -49,22 +67,36 @@
    export default {
        data() {
            return {
                zDataList: [
                    // {matnr: 'A1001',maktx: '1号物料',count: 99},
                    // {matnr: 'A1002',maktx: '2号物料',count: 77},
                    // {matnr: 'A1002',maktx: '2号物料',count: 77}
                ],
                zDataList: [ ],
                barcode: '80009991',
                matnr: '',
                inputCode: '托盘码',
            }
        },
        onShow() {
            // console.log(this.page);
        },
        computed: mapState({
            input: state => state.project.menu[0].page.input,
            input1: state => state.project.menu[0].page.input[0],
            input2: state => state.project.menu[0].page.input[1],
            xInput: state => state.project.menu[0].page.input1,
            lable: state => state.project.menu[0].page.lable
        }),
        methods: {
            input2(arr) {
            inputz() {
                // console.log(this.barcode);
                console.log(this.matnr);
            },
            change() {
                // console.log(this.barcode);
                // console.log(this.matnr);
            },
            scanCode(data) {
                // console.log(data);
            },
            input3(arr) {
                if(arr[1] == 'matnr') {
                    this.getMat(arr[0])
                }
@@ -95,6 +127,10 @@
                        }
                    },
                })
            },
            comb() {
                console.log(this.barcode);
                console.log(this.matnr);
            }
        }
    }
@@ -113,5 +149,8 @@
        align-items: center;
        justify-content: center;
    }
    .flex1 {
        flex: 1
    }
</style>
pages/project/project.json
@@ -1,8 +1,7 @@
{
    "title":"平湖品上新发现",
    "title": "平湖品上新发现",
    "name": "ps",
    "menu": [
        {
    "menu": [{
            "title": "组托入库",
            "name": "pakin",
            "url": "/pakin/pakin",
@@ -11,18 +10,64 @@
            "width": "90%",
            "sort": 1,
            "page": {
                "input": [
                    {"id":1,"name": "barcode","title": "托盘码","val": "2","lenCheck": 8,"focus": true},
                    {"id":2,"name": "matnr","title": "物料码","val": "2","btn": true,"btnName": "提取","focus": true}
                "input": [{
                        "id": 1,
                        "name": "barcode",
                        "title": "托盘码",
                        "val": "",
                        "lenCheck": 8,
                        "focus": true
                    },
                    {
                        "id": 2,
                        "name": "matnr",
                        "title": "物料码",
                        "val": "",
                        "btn": true,
                        "btnName": "提取",
                        "focus": false
                    }
                ],
                "lable": [
                    {"label": "商品码","attribute":"matnr","value": "fbr3242","valText": "val-text"},
                    {"label": "商品名称","attribute":"maktx","value": "fbr3242"},
                    {"label": "规格","attribute":"specs","value": "fbr3242"},
                    {"label": "批号","attribute":"batch","value": "fbr3242"},
                    {"label": "数量","attribute":"count","value": 9999,"type": "number-box","valText": "val-num"}
                "input1": {
                    "attribute": "barcode",
                    "lable": "托盘码",
                    "length": 8,
                    "scanCode": true
                },
                "input2": {
                    "attribute": "matnr",
                    "lable": "物料码"
                },
                "lable": [{
                        "label": "商品码",
                        "attribute": "matnr",
                        "value": "fbr3242",
                        "valText": "val-text"
                    },
                    {
                        "label": "商品名称",
                        "attribute": "maktx",
                        "value": "fbr3242"
                    },
                    {
                        "label": "规格",
                        "attribute": "specs",
                        "value": "fbr3242"
                    },
                    {
                        "label": "批号",
                        "attribute": "batch",
                        "value": "fbr3242"
                    },
                    {
                        "label": "数量",
                        "attribute": "count",
                        "value": 9999,
                        "type": "number-box",
                        "valText": "val-num"
                    }
                ]
            }
        },
        {