qingyiay
2023-10-30 0978691dc9047c7090dca64406f5d0ac027e8df4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<template>
    <view>
        <u-modal :show="show"
            :title="title"
            @confirm="checkedConfirm">
            <view class="slot-content">
                <view class="radio-group">
                    <u-radio-group v-model="checkedStyle"
                        placement="column"
                        iconPlacement="right"
                        @change="radioChange">
                        <u-radio :customStyle="{marginBottom: '35px'}"
                            v-for="(item, index) in checkboxList"
                            :key="index"
                            :label="item.label"
                            :name="item.name"
                            shape="circle"
                            iconSize="32"
                            label-size="32"
                            size="40">
                        </u-radio>
                    </u-radio-group>
                </view>
                <view class="checked-Default">
                    <u-checkbox-group v-model="checkedDefault"
                        placement="column"
                        @change="checkboxDefaultChange">
                        <u-checkbox :customStyle="{marginTop: '8px'}"
                            label="下次默认选择此项,不需再次提示"
                            name="3"
                            shape="circle"
                            iconSize="32"
                            label-size="32"
                            size="40">
                        </u-checkbox>
                    </u-checkbox-group>
                </view>
            </view>
        </u-modal>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                show: false,
                title: '打印样式',
                checkedStyle: '',
                checkedName: null,
                checkboxList: [{
                        name: 1,
                        disabled: false,
                        label: '一页两联'
                    },
                    {
                        name: 2,
                        disabled: false,
                        label: '一页四联'
                    },
                ],
                checkedDefault: '',
                ischeckedDefault: false
            };
        },
        methods: {
            init() {
                this.show = true
            },
            radioChange(e) {
                this.checkedName = e
                uni.setStorageSync('selectedPrintStyle', this.checkedName) //存储选择的打印样式
            },
            checkboxDefaultChange(e) {
                this.ischeckedDefault = e.length !== 0 ? 1 : 0 //e.length!==0已经勾选
                uni.setStorageSync('ischeckedDefault', this.ischeckedDefault)
            },
            checkedConfirm() {
                if (!this.checkedName) {
                    this.$u.toast('请选择磅单打印样式')
                    this.show = true
                    return
                }
                if (!this.checkedDefault) {
                    uni.setStorageSync('ischeckedDefault', 0)
                }
                this.$u.toast('选择成功,后续修改请在个人中心进行修改')
                //如果勾选默认选择 则在打印时 不进行提醒
                this.$emit('selectedPrint', this.ischeckedDefault)
                // 个人中心 修改磅单打印样式
                this.$emit('selectedPrintStyle', this.checkedName)
                this.show = false
            }
        }
    }
</script>
 
<style lang="scss"
    scoped>
    .slot-content {
        width: 100%;
 
        .radio-group {
            width: 100%;
        }
    }
</style>