123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <template>
- <view>
- <template v-for="(item, index) in addInfoArr" :key="index">
- <add-component ref="addComponentRef"></add-component>
- </template>
- <view class="Wrapper-Btn">
- <up-button @click="handleQux" type="error" :plain="true" :hairline="true" text="取消" :customStyle="hadlClickEdit"></up-button>
- <up-button type="error" text="确定" @click="handlOk" :customStyle="hadlClickEdit"></up-button>
- </view>
- </view>
- </template>
- <script setup>
- import {
- ref,
- reactive
- } from 'vue';
- import {
- useraDdressData
- } from "@/api/userSettings.js"
- import pickerAddress from '@/pages_mine/components/pickerAddress/pickerAddress.vue' // 地区选择器组件
- import addComponent from '@/pages_mine/components/setupUser/Add.vue'
- const addComponentRef = ref(null)
- const addInfoArr = ref([{}])
- function handleAdd() {
- if (addInfoArr.value.length < 4) addInfoArr.value.push({})
- }
- const handlOk = async () => {
- const params = []
- addInfoArr.value.forEach((item, index) => {
- params.push(addComponentRef.value[index].modelForm)
- })
- params.forEach(async (obj) => {
- const res = await useraDdressData(obj)
- if (res.code == 200) {
- uni.showToast({
- title: '新增成功',
- icon: 'success', // 或者 'none'
- duration: 1500, // 显示时间,单位毫秒,默认1500
- mask: true, // 是否显示透明蒙层,防止触摸穿透,默认false
- });
- setTimeout(() => {
- uni.navigateBack({
- delta: 2
- })
- }, 1500)
- }
- })
- }
-
- const handleQux = () =>{
- uni.navigateBack({
- delta:-1
- })
- }
- const hadlClickEdit = {
- width: '240rpx',
- marginTop: '30rpx'
- }
- </script>
- <style scoped lang="scss">
- .address-inp {
- color: #929292;
- }
-
- .Wrapper-Btn{
- display: flex;
- justify-content: center;
- align-items: center;
- }
- </style>
|