lin
2026-04-29 c55db3666410fc7b20c5ad526404880456fa7615
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
<script>
import provincesCity from '@/components/picker/provincesCity'
export default {
    components: {
        provincesCity
    },
  props: {
    addressDetail: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  computed: {
        provincesCityStr() {
            if(this.detail.provinceName || this.detail.cityName || this.detail.areaName) {
                return `${this.detail.provinceName}${this.detail.cityName}${this.detail.areaName}`
            } else {
                return ''
            }
        },
    customStyle() {
      return {
        height: "100rpx",
        background: "#FF1472",
        color: "#fff",
        borderRadius: "50rpx",
        fontSize: "34rpx",
      };
    },
    inputStyle() {
      return {
        fontWeight: "400",
        fontSize: "30rpx",
      };
    },
  },
 
  created() {
        this.detail = { ...this.addressDetail }
        const userName = uni.getStorageSync('userName');
        const mobile = uni.getStorageSync('mobile');
 
        this.detail.consignee = this.detail.consignee || userName
        this.detail.contactPhone = this.detail.contactPhone || mobile
  },
 
  data() {
    return {
      $webHost:'https://rbb98765.zrgy-bbg.com',
      lstyle: {
        color: "#333333",
        fontSize: "30rpx",
        fontWeight: "bold",
      },
      detail: {
                consignee: '',
                contactPhone: '',
                detailAddr: '',
                provinceCode: '',
                provinceName: '',
                cityName: '',
                cityCode: '',
                areaCode: '',
                areaName: '',
            },
    };
  },
  methods: {
        openProvincesCity() {
            let defaultData = []
            if(this.detail.provinceCode && this.detail.cityCode) {
                defaultData = [this.detail.provinceCode, this.detail.cityCode]
            }
 
            this.$refs.provincesCity.open(defaultData)
        },
        provincesCityChange(e) {
            if(e.value.length > 0) {
                this.detail.provinceCode = e.value[0].code
                this.detail.provinceName = e.value[0].title
 
                this.detail.cityCode = e.value[1].code
                this.detail.cityName = e.value[1].title
        console.log(e.value[2]);
        if(e.value[2]) {
                    this.detail.areaCode = e.value[2].code
                    this.detail.areaName = e.value[2].title
                } else {
                    this.detail.areaCode = ""
                    this.detail.areaName = ""
                }
            }
        },
    submit() {
      const _this = this;
      if (!this.detail.consignee) {
        uni.showToast({
          title: "请输入收货人姓名",
          icon: "none",
        });
        return;
      }
      if (!this.detail.contactPhone) {
        uni.showToast({
          title: "请输入收货人电话",
          icon: "none",
        });
        return;
      }
      if (!this.detail.provinceCode) {
        uni.showToast({
          title: "请选择所在地区",
          icon: "none",
        });
        return;
      }
      if (!this.detail.detailAddr) {
        uni.showToast({
          title: "请输入详细地址",
          icon: "none",
        });
        return;
      }
            if (this.detail.detailAddr.length < 8) {
              uni.showToast({
                title: "详细地址需大于等于8个字符",
                icon: "none",
              });
              return;
            }
      const params = uni.getStorageSync('qxgLogin')
      uni.request({
        url: _this.$webHost + "/api/v2/customer/appAddCstAddress",
        method: "POST",
        data: {
          ..._this.detail,
                    customerId: params.customerId,
          sourceId: params.appId
        },
        success(){
          _this.$emit("submit", _this.detail);
          _this.off()
        }
      })
    },
    off() {
      this.$emit("off");
    },
  },
};
</script>
 
<template>
  <view>
    <view class="head">
      <view
        style="
          text-align: left;
          font-weight: bold;
          font-size: 36rpx;
          position: relative;
          height: 100rpx;
        "
        >
                <text class="tips"></text>
                <view>请完善您的有效地址</view>
 
        <image
          @click="off"
          src="/static/img/close1.png"
          style="
            width: 50rpx;
            height: 50rpx;
            position: absolute;
            right: 0;
            top: -2rpx;
          "
        ></image>
      </view>
    </view>
 
    <view class="content">
      <uv-form
        :labelStyle="lstyle"
        labelPosition="left"
        :model="detail"
        ref="form"
        labelWidth="100"
      >
        <uv-form-item
          class="item"
          label="收货人"
          prop="consignee"
          borderBottom
        >
          <uv-input
            :adjustPosition="true"
            :customStyle="inputStyle"
            disabledColor="none"
            inputAlign="right"
            v-model="detail.consignee"
            border="none"
            placeholder="请输入收货人姓名"
          ></uv-input>
        </uv-form-item>
        <uv-form-item
          class="item"
          label="联系电话"
          prop="contactPhone"
          borderBottom
        >
          <uv-input
            :adjustPosition="true"
            maxlength="11"
            :customStyle="inputStyle"
            disabledColor="none"
            inputAlign="right"
            v-model="detail.contactPhone"
            border="none"
            placeholder="请输入收货人电话"
          ></uv-input>
        </uv-form-item>
 
                <uv-form-item
                  class="item"
                  label="所在地区"
                  prop="repayTermStr"
                  borderBottom
                    @click="openProvincesCity()"
                >
                  <uv-input
                    :adjustPosition="true"
                    :disabled="true"
                    :customStyle="inputStyle"
                    disabledColor="none"
                    inputAlign="right"
                    v-model="provincesCityStr"
                    border="none"
                    placeholder="请选择所在地区"
                  ></uv-input>
                    <uv-icon name="arrow-right"></uv-icon>
                </uv-form-item>
 
                <uv-form-item
                  class="item"
                  label="详细地址"
                  prop="detailAddr"
                  borderBottom
                >
                  <uv-input
                    :adjustPosition="true"
                    maxlength="30"
                    :customStyle="inputStyle"
                    disabledColor="none"
                    inputAlign="right"
                    v-model="detail.detailAddr"
                    border="none"
                    placeholder="请输入详细地址"
                  ></uv-input>
                </uv-form-item>
 
        <uv-form-item>
          <view class="but">
            <uv-button
              :customStyle="customStyle"
              shape="circle"
              @click="submit"
              >保存</uv-button
            >
          </view>
        </uv-form-item>
      </uv-form>
    </view>
 
        <provincesCity ref="provincesCity" @confirm="provincesCityChange" />
  </view>
</template>
 
<style scoped lang="scss">
.ks {
  color: #999999 !important;
}
.tips {
    margin-bottom: 10rpx;
    font-size: 26rpx;
    color: #999;
    font-weight: normal;
}
.but {
  width: 100%;
  margin-top: 46rpx;
  .pack {
    text-align: center;
    margin-top: 20rpx;
    font-size: 30rpx;
    display: flex;
    flex-direction: row;
    justify-content: center;
  }
}
.head {
  margin-top: 40rpx;
  padding: 0 40rpx;
 
  font-size: 32rpx;
  color: #252938;
  .title {
    display: flex;
    flex-direction: row;
    text-align: center;
    color: #252938;
    font-size: 32rpx;
    font-weight: bold;
    .num {
      color: #4766fe;
      display: contents;
    }
  }
}
 
.content {
  padding: 0 38rpx;
  .pt40 {
    padding-top: 40rpx;
  }
  .mr {
    margin-right: 20rpx;
  }
  .code {
    margin-left: 40rpx;
    font-size: 24rpx;
    color: #4766fe;
    background: none;
    border-radius: 8rpx 8rpx 8rpx 8rpx;
  }
}
</style>