app-shipping-address.vue 5.8 KB

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