wk
2024-08-13 e22b9321aae0322de93d50c0e21407f3cb514659
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
<template>
    <view class="main">
        <u-form labelPosition="top"
            :model="form"
            :rules="rules"
            ref="uForm"
            label-width="80px">
            <u-form-item label="送货客户"
                prop="addressContent">
                <u--textarea v-model="form.addressContent"
                    placeholder="请输入送货客户名称"
                    border="bottom"
                    confirmType="done"
                    height='140'
                    count></u--textarea>
            </u-form-item>
        </u-form>
        <view class="add-address">
            <view class="address-block">
                <u-button text="保存"
                    shape="circle"
                    type="primary"
                    @click="saveAddress"></u-button>
            </view>
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                form: {
                    addressContent: ''
                },
                rules: {
                    addressContent: {
                        type: 'string',
                        required: true,
                        message: '请填写地址',
                        trigger: ['blur', 'change']
                    }
                }
            }
        },
        methods: {
            saveAddress() {
                this.$reqPost('saveShipTo', { customerName: this.form.addressContent }, 'params').then(res => {
                    if (res.code === 0) {
                        this.$u.toast('保存成功')
                        setTimeout(() => {
                            uni.navigateBack({
                                delta: 1
                            })
                        }, 1500)
                    } else {
                        this.$u.toast(res.msg ? res.msg : '保存失败')
                    }
                })
            }
        }
    }
</script>
 
<style lang="scss"
    scoped>
    .main {
        width: 94%;
        margin: vww(10) auto;
        border-bottom: 1px solid #dadbde;
 
        .add-address {
            width: 100%;
            height: vww(60);
            position: fixed;
            bottom: 0;
            background-color: #ffffff;
            box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12);
 
            .address-block {
                width: 88%;
                margin: vww(8) auto;
            }
        }
    }
</style>