湘妃到家前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 lines
3.0 KiB

1 month ago
  1. <template>
  2. <view class="redact-address">
  3. <template #default>
  4. <view class="redact-address-title">{{title}}</view>
  5. <van-form label-width="110rpx" ref="form">
  6. <van-cell-group inset>
  7. <van-field v-model="addressDetail.name" name="联系人" label="联系人" placeholder="请输入联系人姓名"
  8. :rules="[{ required: true, message: '请填写联系人' }]" />
  9. <van-field v-model="addressDetail.phone" name="手机号" label="手机号" placeholder="请输入手机号"
  10. :rules="[{ required: true, message: '请填写手机号' }]" />
  11. <van-field @click="$emit('clickAddressIcon')"
  12. v-model="addressDetail.address" name="所在地区"
  13. label="所在地区"
  14. placeholder="选择省市区街道"
  15. :rules="[{ required: true, message: '请选择省市区街道' }]">
  16. <template #right-icon v-if="configList.open_address == 1">
  17. <image @click.stop="$emit('clickAddressIcon')" src="../../static/address/position-icon.png" mode="aspectFit"></image>定位
  18. </template>
  19. </van-field>
  20. <van-field v-model="addressDetail.addressDetail" name="详细地址" label="详细地址" placeholder="小区楼栋、门牌号、村等"
  21. :rules="[{ required: true, message: '请填写详细地址' }]" />
  22. </van-cell-group>
  23. </van-form>
  24. <view @click="onSubmit" class="save">{{ addressDetail.id ? '修改地址' : '新增地址'}}</view>
  25. </template>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. data() {
  31. return {}
  32. },
  33. props : {
  34. addressDetail : {
  35. type : Object,
  36. default : function(){ return {} }
  37. },
  38. title : {
  39. type : String,
  40. default : '新增地址'
  41. }
  42. },
  43. methods: {
  44. //新增和修改地址
  45. onSubmit() {
  46. this.$emit('saveOrUpdate', this.addressDetail)
  47. }
  48. }
  49. }
  50. </script>
  51. <style lang="scss" scoped>
  52. .redact-address {
  53. box-sizing: border-box;
  54. .redact-address-title {
  55. height: 80rpx;
  56. line-height: 80rpx;
  57. font-size: 30rpx;
  58. color: #333333;
  59. font-weight: 600;
  60. }
  61. .save {
  62. display: flex;
  63. align-items: center;
  64. justify-content: center;
  65. width: 90%;
  66. height: 80rpx;
  67. border-radius: 40rpx;
  68. color: white;
  69. font-size: 28rpx;
  70. margin: 0rpx auto;
  71. background: linear-gradient(180deg, #6FDFBE, #5AC796);
  72. }
  73. image {
  74. width: 25rpx;
  75. height: 25rpx;
  76. }
  77. //修改组件默认样式
  78. .van-form {
  79. padding: 30rpx 0rpx;
  80. }
  81. &::v-deep .van-cell {
  82. padding: 0rpx 0rpx;
  83. font-size: 26rpx;
  84. &::after {
  85. border: none !important;
  86. }
  87. .van-field__label {
  88. display: flex;
  89. align-items: center;
  90. height: 80rpx;
  91. }
  92. .van-field__control,
  93. .van-field__right-icon {
  94. height: 80rpx;
  95. font-size: 26rpx;
  96. border-bottom: 2rpx solid #cbc8c8;
  97. }
  98. .van-field__right-icon {
  99. display: flex;
  100. align-items: center;
  101. height: 78rpx;
  102. color: #5FCC9F;
  103. }
  104. .van-cell__value {
  105. height: 120rpx;
  106. }
  107. }
  108. &::v-deep .van-field__error-message {
  109. color: #5AC796;
  110. font-size: 20rpx;
  111. margin-top: 10rpx;
  112. }
  113. }
  114. </style>