普兆健康管家前端代码仓库
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.

134 lines
2.7 KiB

  1. <template>
  2. <view class="card">
  3. <view class="top" @click="$emit('click')">
  4. <addressView :data="data"></addressView>
  5. </view>
  6. <view class="flex bottom">
  7. <view class="flex col">
  8. <view>
  9. <uv-radio-group
  10. v-model="radiovalue"
  11. shape="circle"
  12. size="36rpx"
  13. iconSize="36rpx"
  14. labelSize="24rpx"
  15. labelColor="#9B9B9B"
  16. activeColor="#7451DE"
  17. @change="onRadioChange"
  18. >
  19. <uv-radio :name="1">
  20. <view>默认地址</view>
  21. </uv-radio>
  22. </uv-radio-group>
  23. </view>
  24. </view>
  25. <button class="flex col btn" @click="onEdit">
  26. <image class="icon" src="@/pages_order/static/address/icon-edit.png" mode="scaleToFill"></image>
  27. <view>编辑</view>
  28. </button>
  29. <button class="flex col btn" @click="onDelete">
  30. <image class="icon" src="@/pages_order/static/address/icon-delete.png" mode="scaleToFill"></image>
  31. <view>删除</view>
  32. </button>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import addressView from './addressView.vue';
  38. export default {
  39. components: {
  40. addressView,
  41. },
  42. props: {
  43. data: {
  44. type: Object,
  45. default() {
  46. return {}
  47. }
  48. },
  49. },
  50. data() {
  51. return {
  52. radiovalue: null,
  53. }
  54. },
  55. computed: {
  56. isDefault: {
  57. set(val) {
  58. this.radiovalue = val
  59. if (this.data.defaultFlag == val) {
  60. return
  61. }
  62. this.$emit('defaultChange', val)
  63. },
  64. get() {
  65. return this.radiovalue
  66. }
  67. },
  68. },
  69. watch: {
  70. data: {
  71. handler(val) {
  72. this.isDefault = val.defaultFlag
  73. },
  74. immediate: true,
  75. deep: true,
  76. }
  77. },
  78. methods: {
  79. onRadioChange() {
  80. this.isDefault = 1
  81. },
  82. onEdit() {
  83. this.$emit('edit')
  84. },
  85. onDelete() {
  86. uni.showModal({
  87. title: '确认删除?',
  88. success : e => {
  89. if(e.confirm){
  90. this.$emit('delete')
  91. }
  92. }
  93. })
  94. },
  95. }
  96. }
  97. </script>
  98. <style scoped lang="scss">
  99. .card {
  100. padding: 24rpx 32rpx;
  101. background: #FFFFFF;
  102. border-radius: 24rpx;
  103. .top {
  104. padding-bottom: 24rpx;
  105. }
  106. .bottom {
  107. padding-top: 24rpx;
  108. column-gap: 24rpx;
  109. border-top: 2rpx dashed #DADADA;
  110. .col {
  111. flex: 1;
  112. column-gap: 8rpx;
  113. font-family: PingFang SC;
  114. font-weight: 400;
  115. font-size: 24rpx;
  116. line-height: 1.4;
  117. color: #9B9B9B;
  118. .icon {
  119. width: 36rpx;
  120. height: 36rpx;
  121. }
  122. }
  123. }
  124. }
  125. </style>