酒店桌布为微信小程序
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.

149 lines
2.9 KiB

9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
8 months ago
8 months ago
9 months ago
  1. <template>
  2. <uv-popup ref="addPopup" :round="30">
  3. <view class="title">
  4. 添加我的物品 进行水洗下单
  5. </view>
  6. <!-- 地址 -->
  7. <view class="address" @click="openAddress">
  8. <image src="/static/image/address/selectIcon.png" mode=""></image>
  9. <view class="">
  10. {{ address.name }}
  11. </view>
  12. <view class="">
  13. {{ address.addressDetail }}
  14. </view>
  15. <view class="icon">
  16. <uv-icon size="30rpx" name="arrow-right"></uv-icon>
  17. </view>
  18. </view>
  19. <uv-popup ref="addressPopup" :round="30">
  20. <addressList ref="addressList" height="60vh" @select="selectAddress" />
  21. </uv-popup>
  22. <addLeaseForm ref="addLeaseForm"/>
  23. <view class="btn" @click="submit">
  24. <button class="a">添加</button>
  25. </view>
  26. </uv-popup>
  27. </template>
  28. <script>
  29. import addLeaseForm from './addLeaseForm.vue'
  30. import addressList from '@/components/address/addressList.vue'
  31. export default {
  32. components : {
  33. addLeaseForm,
  34. addressList,
  35. },
  36. data() {
  37. return {
  38. address: {
  39. name: '请选择联系人',
  40. addressDetail: '',
  41. },
  42. addressTotal: 0,
  43. }
  44. },
  45. methods: {
  46. // 打开选择地址
  47. openAddress() {
  48. if (this.addressTotal == 0) {
  49. this.$refs.popup.close()
  50. return uni.navigateTo({
  51. url: '/pages_order/mine/address?type=back'
  52. })
  53. }
  54. this.$refs.addressPopup.open('bottom')
  55. },
  56. // 选择地址
  57. selectAddress(e) {
  58. this.address = e
  59. this.$refs.addressPopup.close()
  60. },
  61. submit() {
  62. if(!this.address.id){
  63. return uni.showToast({
  64. title: '请选择地址'
  65. })
  66. }
  67. this.$refs.addLeaseForm.submit(form => {
  68. form.addressId = this.address.id, //地址id
  69. this.$api('tablecloth', form, res => {
  70. if (res.code == 200) {
  71. this.$emit('submit')
  72. this.$refs.addPopup.close()
  73. }
  74. })
  75. })
  76. },
  77. open() {
  78. this.$refs.addLeaseForm.closeForm()
  79. this.$refs.addPopup.open('bottom')
  80. // 获取地址列表
  81. this.$refs.addressList.getAddressList().then(res => {
  82. this.addressTotal = res.total
  83. if (this.addressTotal != 0) {
  84. this.address = res.records[0]
  85. }
  86. })
  87. },
  88. }
  89. }
  90. </script>
  91. <style scoped lang="scss">
  92. .title{
  93. background-color: #fff;
  94. padding: 20rpx;
  95. text-align: center;
  96. font-weight: 900;
  97. }
  98. .address {
  99. display: flex;
  100. padding: 20rpx;
  101. background-color: #fff;
  102. border-bottom: 20rpx solid #f3f3f3;
  103. image {
  104. width: 30rpx;
  105. height: 30rpx;
  106. margin: 20rpx;
  107. }
  108. view {
  109. margin: 20rpx;
  110. overflow: hidden; //超出的文本隐藏
  111. text-overflow: ellipsis; //溢出用省略号显示
  112. white-space: nowrap; //溢出不换行
  113. }
  114. .icon {
  115. margin-left: auto;
  116. }
  117. }
  118. .btn {
  119. display: flex;
  120. justify-content: center;
  121. width: 100%;
  122. .a {
  123. display: flex;
  124. justify-content: center;
  125. align-items: center;
  126. width: 90%;
  127. height: 100rpx;
  128. color: #FFF;
  129. background-color: $uni-color;
  130. border: 1px solid red;
  131. border-radius: 100rpx;
  132. font-size: 30rpx;
  133. }
  134. }
  135. </style>