|
|
@@ -7,13 +7,11 @@
|
|
|
</view>
|
|
|
<view class="cu-form-group">
|
|
|
<view class="title">{{ $t('addressManage.mobile') }}</view>
|
|
|
- <input type="number" :placeholder="$t('addressManage.mobilePlaceholder')" v-model="addressData.mobile" maxlength="11" />
|
|
|
+ <input type="text" :placeholder="$t('addressManage.mobilePlaceholder')" v-model="addressData.mobile" />
|
|
|
</view>
|
|
|
- <view class="cu-form-group" @tap="openAddressPicker">
|
|
|
+ <view class="cu-form-group">
|
|
|
<view class="title">{{ $t('addressManage.region') }}</view>
|
|
|
- <view class="picker-text" :class="{ placeholder: !addressData.formatted_address }">
|
|
|
- {{ addressData.formatted_address || $t('addressManage.regionPlaceholder') }}
|
|
|
- </view>
|
|
|
+ <input type="text" v-model="addressData.formatted_address" :placeholder="$t('addressManage.regionPlaceholder')" />
|
|
|
</view>
|
|
|
<view class="cu-form-group align-start">
|
|
|
<view class="title">{{ $t('addressManage.detailAddress') }}</view>
|
|
|
@@ -29,13 +27,11 @@
|
|
|
<view class="padding-bj flex flex-direction margin-top">
|
|
|
<button @tap="confirm" class="cu-btn wanl-bg-orange lg">{{ $t('orderConfirm.complete') }}</button>
|
|
|
</view>
|
|
|
- <address-picker ref="addressPicker" @selectAddress="successSelectAddress"></address-picker>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { postAddressSave } from '@/features/mall/mall-gateway'
|
|
|
-import { buildRestPath } from '@/core/config/api-paths'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -66,8 +62,8 @@ export default {
|
|
|
}
|
|
|
if (option.type === 'newadd') {
|
|
|
this.addressData.default = 1
|
|
|
- this.manageType = 'add'
|
|
|
- } else if (option.type === 'edit') {
|
|
|
+ this.manageType = 'add'
|
|
|
+ } else if (option.type === 'edit') {
|
|
|
this.manageType = 'edit'
|
|
|
if (option.data) {
|
|
|
this.addressData = JSON.parse(option.data)
|
|
|
@@ -78,20 +74,6 @@ export default {
|
|
|
uni.setNavigationBarTitle({ title: this.manageType === 'edit' ? this.$t('addressManage.editTitle') : this.$t('addressManage.addTitle') })
|
|
|
},
|
|
|
methods: {
|
|
|
- openAddressPicker() {
|
|
|
- this.$refs.addressPicker.show()
|
|
|
- },
|
|
|
- successSelectAddress(address) {
|
|
|
- this.addressData.city = address.city
|
|
|
- this.addressData.country = address.country
|
|
|
- this.addressData.province = address.province
|
|
|
- this.addressData.citycode = address.citycode
|
|
|
- this.addressData.district = address.district
|
|
|
- this.addressData.formatted_address = address.formatted_address
|
|
|
- this.addressData.address_name = address.formatted_address
|
|
|
- this.addressData.location = address.location
|
|
|
- this.addressData.adcode = address.adcode
|
|
|
- },
|
|
|
switchChange(e) {
|
|
|
this.addressData.default = e.detail.value ? 1 : 0
|
|
|
},
|
|
|
@@ -114,19 +96,15 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
try {
|
|
|
- if (data.address) {
|
|
|
- data.address_full = data.address_name + data.address
|
|
|
- }
|
|
|
+ data.address_name = data.formatted_address
|
|
|
+ data.address_full = (data.formatted_address || '') + (data.address || '')
|
|
|
const resData = await postAddressSave({ data, type: this.manageType })
|
|
|
uni.showToast({
|
|
|
title: this.$t('addressManage.saveSuccess', [this.manageType === 'edit' ? '更新' : '添加']),
|
|
|
icon: 'none'
|
|
|
})
|
|
|
setTimeout(() => {
|
|
|
- // 先跳轉回地址列表
|
|
|
uni.navigateBack({ delta: 1 })
|
|
|
-
|
|
|
- // 然後發射事件(地址列表頁面的 onShow 已經執行了)
|
|
|
setTimeout(() => {
|
|
|
let newAddressId = null
|
|
|
if (resData && typeof resData === 'object') {
|
|
|
@@ -150,28 +128,6 @@ export default {
|
|
|
background: #fff;
|
|
|
}
|
|
|
|
|
|
-.cu-bar.fixed {
|
|
|
- position: fixed;
|
|
|
- top: 0;
|
|
|
- left: 0;
|
|
|
- right: 0;
|
|
|
- z-index: 999;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- height: 44px;
|
|
|
- padding: 0 20rpx;
|
|
|
- background: #fff;
|
|
|
-}
|
|
|
-
|
|
|
-.cu-bar.fixed .action:first-child {
|
|
|
- margin-left: 0;
|
|
|
-}
|
|
|
-
|
|
|
-.cu-bar .action text {
|
|
|
- font-size: 40rpx;
|
|
|
- color: #333;
|
|
|
-}
|
|
|
-
|
|
|
.form-wrap {
|
|
|
padding: 0 10rpx;
|
|
|
}
|
|
|
@@ -196,15 +152,6 @@ export default {
|
|
|
min-height: 160rpx;
|
|
|
}
|
|
|
|
|
|
-.picker-text {
|
|
|
- font-size: 28rpx;
|
|
|
- color: #333;
|
|
|
-}
|
|
|
-
|
|
|
-.picker-text.placeholder {
|
|
|
- color: #999;
|
|
|
-}
|
|
|
-
|
|
|
.wanl-bg-orange {
|
|
|
background: linear-gradient(135deg, #ff6b35, #ff3d2e) !important;
|
|
|
color: #fff !important;
|
|
|
@@ -214,4 +161,4 @@ export default {
|
|
|
font-size: 32rpx;
|
|
|
height: 86rpx;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|