address.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <view>
  3. <u-field @click="getAddress(3)" disabled label="收货地址" :placeholder="hyend.name?hyend.name:'请选择'">
  4. <u-icon name="arrow-right" slot="right"></u-icon>
  5. </u-field>
  6. <u-field v-model="floor" label="楼层" placeholder="请输入楼层(选填)">
  7. <u-icon name="arrow-right" slot="right"></u-icon>
  8. </u-field>
  9. <u-field v-model="code" label="门牌号" placeholder="请输入门牌号(选填)">
  10. <u-icon name="arrow-right" slot="right"></u-icon>
  11. </u-field>
  12. <u-field v-model="tel" type="tel" label="联系电话" placeholder="请输入手机号(选填)">
  13. <u-icon name="arrow-right" slot="right"></u-icon>
  14. </u-field>
  15. <view class="fixed-bottom pd-36">
  16. <u-button v-if="index" class="pb-20" type="" @click="delAddr">删除收货地信息</u-button>
  17. <view style="height: 20rpx;"></view>
  18. <u-button type="primary" @click="addAddr">确认收货地信息</u-button>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import {mapState} from 'vuex'
  24. export default {
  25. data() {
  26. return {
  27. floor: '',
  28. code: '',
  29. tel: '',
  30. index:'', //编辑地址索引
  31. };
  32. },
  33. computed:{
  34. ...mapState(["start","hyend"])
  35. },
  36. methods:{
  37. getAddress(type) {
  38. uni.navigateTo({
  39. url: '/pages/home/search?type=' + type + '&location=' + location
  40. })
  41. },
  42. addAddr(){
  43. if(!this.hyend.name){
  44. uni.showToast({
  45. title:'请选择收货地址',
  46. icon:'none'
  47. })
  48. }else{
  49. let addr={
  50. address:this.hyend,
  51. floor: this.floor,
  52. code: this.code,
  53. tel: this.tel
  54. }
  55. console.log(addr);
  56. this.$store.commit('getHyAddress',addr)
  57. this.$store.commit('getHyEnd',{})
  58. uni.navigateBack({
  59. delta: 1
  60. });
  61. }
  62. }
  63. }
  64. }
  65. </script>
  66. <style lang="scss" scoped>
  67. /deep/.u-primary-hover {
  68. background: linear-gradient(to right,#00b6b4,#00d496) !important;
  69. }
  70. </style>