app-shipping-address.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <view class="app-view">
  3. <view class="app-information">
  4. <view class="app-contact-information main-between">
  5. <text>收货人:{{item.name}}</text>
  6. <text>{{item.mobile}}</text>
  7. </view>
  8. <text>收货地址: {{item.address}}</text>
  9. </view>
  10. <view @click.stop="editStop" class="app-operating dir-left-nowrap cross-center">
  11. <view v-if="is_hide_default_btn" class="dir-left-nowrap cross-center">
  12. <view class="app-radio">
  13. <!-- <radio color="red" class="radio"></radio>-->
  14. <app-radio @click.stop="changeDefault" width="32" height="32" v-model="item.is_default == 1"
  15. type="round"></app-radio>
  16. </view>
  17. <text class="app-text app-text-color-default" v-if="item.is_default === `0`">设为默认</text>
  18. <text class="app-text app-text-color-selection" v-else-if="item.is_default === `1`">
  19. 已设为默认
  20. </text>
  21. </view>
  22. <view class="app-operating-view dir-left-nowrap cross-center main-between">
  23. <view @click.stop="edit" class="app-modify dir-left-nowrap cross-center main-between">
  24. <icon class="app-icon app-modify-icon"></icon>
  25. <text>编辑</text>
  26. </view>
  27. <view @click.stop="destroy" class="app-delete dir-left-nowrap cross-center main-between">
  28. <icon class="app-icon app-delete-icon"></icon>
  29. <text>删除</text>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import appRadio from '../../basic-component/app-radio/app-radio.vue';
  37. export default {
  38. name: "app-shipping-address",
  39. components: {appRadio},
  40. props: {
  41. item: {
  42. type: Object,
  43. },
  44. is_hide_default_btn: {
  45. type: Boolean,
  46. default: false,
  47. },
  48. destroy_url: {
  49. type: String,
  50. default: ''
  51. },
  52. is_refund_address: {
  53. type: Number,
  54. default: 0,
  55. }
  56. },
  57. methods: {
  58. changeDefault() {
  59. const self = this;
  60. self.$request({
  61. url: self.$api.user.address_default,
  62. method: 'POST',
  63. data: {
  64. id: self.item.id,
  65. is_default: self.item.is_default == 1 ? 0 : 1,
  66. }
  67. }).then((info) => {
  68. if (info.code === 0) {
  69. self.$emit('handleAddress', 'price-sort-default.png')
  70. } else {
  71. uni.showToast({title: info.msg, icon: 'none'})
  72. }
  73. }).catch(() => {
  74. })
  75. },
  76. edit() {
  77. uni.navigateTo({url: `/pages/address/address-edit?id=` + this.item.id + '&is_refund_address=' + this.is_refund_address});
  78. },
  79. editStop(){
  80. this.$emit('handleStop', 'editStop')
  81. },
  82. destroy() {
  83. const self = this;
  84. uni.showModal({
  85. content: '确定删除收货地址',
  86. success: function (res) {
  87. if (res.confirm) {
  88. self.$request({
  89. url: self.destroy_url,
  90. method: 'POST',
  91. data: {
  92. id: self.item.id,
  93. }
  94. }).then((info) => {
  95. if (info.code === 0) {
  96. self.$emit('handleAddress', 'delete')
  97. } else {
  98. uni.showToast({title: info.msg, icon: 'none'})
  99. }
  100. }).catch(() => {
  101. })
  102. } else if (res.cancel) {
  103. }
  104. }
  105. });
  106. },
  107. }
  108. }
  109. </script>
  110. <style scoped lang="scss">
  111. text {
  112. font-size: #{28rpx};
  113. color: #353535;
  114. }
  115. .radio {
  116. width: #{32upx};
  117. height: #{32upx};
  118. }
  119. .app-view {
  120. margin-top: #{20rpx};
  121. margin-bottom: #{20rpx};
  122. margin-left: #{24rpx};
  123. margin-right: #{24rpx};
  124. background: #FFFFFF;
  125. border-radius: #{16rpx};
  126. .app-information {
  127. padding: #{32rpx} #{24rpx};
  128. border-bottom: #{1rpx} solid #e2e2e2;
  129. .app-contact-information {
  130. margin-bottom: #{24rpx};
  131. }
  132. }
  133. .app-operating {
  134. margin-top: #{24rpx};
  135. padding-bottom: #{24rpx};
  136. .app-radio {
  137. margin-left: #{24rpx};
  138. margin-right: #{20rpx};
  139. }
  140. .app-text {
  141. font-size: #{28rpx};
  142. }
  143. .app-text-color-default {
  144. color: #999999;
  145. }
  146. .app-text-color-selection {
  147. color: #ff4544;
  148. }
  149. .app-operating-view {
  150. margin-left: auto;
  151. right: #{24rpx};
  152. width: #{106rpx + 106rpx + 48rpx + 24rpx};
  153. height: #{32rpx};
  154. text {
  155. color: #999999;
  156. }
  157. .app-modify {
  158. width: #{106rpx};
  159. }
  160. .app-delete {
  161. width: #{106rpx};
  162. margin-right:#{24rpx};
  163. }
  164. .app-icon {
  165. width: #{32rpx};
  166. height: #{32rpx};
  167. background-size: 100% 100%;
  168. background-repeat: no-repeat;
  169. }
  170. .app-modify-icon {
  171. background-image: url("../../../static/image/icon/modify.png");
  172. }
  173. .app-delete-icon {
  174. background-image: url("../../../static/image/icon/delete.png");
  175. }
  176. }
  177. }
  178. }
  179. </style>