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

148 lines
3.1 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
  1. <template>
  2. <scroll-view scroll-y="true" :style="{height: height}" @scrolltolower="more">
  3. <view v-if="commodityList.length">
  4. <view v-for="(item, index) in commodityList" :key="index" class="address-item">
  5. <view class="itme1" @click="selectSp(item)">
  6. <view class="left">
  7. <image src="https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg" mode="aspectFill"/>
  8. </view>
  9. <view class="center">
  10. <view>{{ item.title }}</view>
  11. <view>{{ item.smallTitle }}</view>
  12. <view>起租时间2024.03.02</view>
  13. </view>
  14. <view class="right">×{{item.total}}</view>
  15. </view>
  16. <uv-line></uv-line>
  17. </view>
  18. </view>
  19. <view style="padding: 100rpx 0;" v-else>
  20. <uv-empty mode="history" textSize="28rpx" iconSize="100rpx" />
  21. </view>
  22. </scroll-view>
  23. </template>
  24. <script>
  25. export default {
  26. props: {
  27. height: {
  28. default: 'calc(90vh - 180rpx)'
  29. }
  30. },
  31. data() {
  32. return {
  33. total: 0,
  34. commodityList: [
  35. {
  36. title: '商品名称',
  37. smallTitle: '产品规格:120*4*75【桌子尺寸】',
  38. total: 1,
  39. },
  40. {
  41. title: '商品名称1',
  42. smallTitle: '产品规格:120*4*75【桌子尺寸】',
  43. total: 1,
  44. },
  45. {
  46. title: '商品名称2',
  47. smallTitle: '产品规格:120*4*75【桌子尺寸】',
  48. total: 1,
  49. }
  50. ],
  51. queryParams: {
  52. pageNo: 1,
  53. pageSize: 10,
  54. },
  55. }
  56. },
  57. methods: {
  58. // 选择了商品
  59. selectSp(e) {
  60. this.$emit('selectSp', e)
  61. },
  62. //获取地址列表
  63. getList() {
  64. return new Promise((success, fail) => {
  65. this.$api('addressPage', this.queryParams, res => {
  66. if (res.code == 200) {
  67. this.commodityList = res.result.records || [];
  68. this.total = res.result.total || 0;
  69. this.commodityList.forEach(n => { //筛选默认地址
  70. if (n.defaultFlag == 1) {
  71. this.selectAddress = n.id
  72. }
  73. })
  74. success(res.result)
  75. }
  76. })
  77. })
  78. },
  79. // 加载更多
  80. more(){
  81. if(this.queryParams.pageSize > this.total){
  82. return
  83. }
  84. this.queryParams.pageSize += 10
  85. this.getList()
  86. },
  87. }
  88. }
  89. </script>
  90. <style scoped lang="scss">
  91. .itme1 {
  92. display: flex;
  93. width: 100vw;
  94. background-color: #ffffff;
  95. .left {
  96. padding: 20rpx;
  97. width: 150rpx;
  98. height: 150rpx;
  99. border-radius: 20rpx;
  100. background-color: #ffffff;
  101. flex-shrink: 0;
  102. image{
  103. width: 100%;
  104. height: 100%;
  105. border-radius: 20rpx;
  106. }
  107. }
  108. .center {
  109. display: flex;
  110. flex-direction: column;
  111. justify-content: center;
  112. gap: 20rpx;
  113. width: 60%;
  114. padding: 0rpx 0 0 20rpx;
  115. background-color: #ffffff;
  116. // 给第一个 view 设置样式
  117. >view:first-of-type {
  118. font-size: 34rpx;
  119. color: #333;
  120. }
  121. // 给第二个 view 设置样式
  122. >view:nth-of-type(2) {
  123. font-size: 26rpx;
  124. color: #666666;
  125. }
  126. // 给第二个 view 设置样式
  127. >view:nth-of-type(3) {
  128. font-size: 26rpx;
  129. color: #666666;
  130. }
  131. }
  132. .right {
  133. display: flex;
  134. justify-content: center;
  135. align-items: center;
  136. width: 10%;
  137. color: #666666;
  138. background-color: #ffffff;
  139. }
  140. }
  141. </style>