建材商城系统20241014
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.

215 lines
4.1 KiB

7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
  1. <template>
  2. <view class="page">
  3. <navbar bgColor="#DC2828"/>
  4. <view class="category">
  5. <view class="tabs">
  6. <uv-tabs
  7. :list="category"
  8. :activeStyle="{color : '#f00', fontWeight : 600}"
  9. lineColor="#f00"
  10. :inactiveStyle="{color: 'rgba(0,0,0,.8)'}"
  11. lineHeight="8rpx"
  12. lineWidth="50rpx"
  13. keyName="title"
  14. :current="current"
  15. @click="clickTabs"></uv-tabs>
  16. </view>
  17. <uv-vtabs
  18. :chain="chain"
  19. :list="category[current].children"
  20. keyName="title"
  21. :barItemBadgeStyle="{right:'20px',top:'12px'}"
  22. @change="change">
  23. <uv-vtabs-item>
  24. <!-- <view class="category-title">
  25. 租赁
  26. </view>
  27. <view class="list">
  28. <view class="item" v-for="(item,index) in list" :key="index"
  29. @click="$utils.navigateTo(`/pages_order/product/productDetail?id=${item.id}`)">
  30. <view class="item-image">
  31. <image
  32. :src="item.image"
  33. mode="aspectFill"></image>
  34. </view>
  35. <view class="item-unit">
  36. <text class="text">{{item.name}}</text>
  37. </view>
  38. </view>
  39. </view> -->
  40. <productItem
  41. :btn="false"
  42. @click="$utils.navigateTo(`/pages_order/product/productDetail?id=${item.id}`)"
  43. :item="item" v-for="(item, index) in list" :key="index"/>
  44. </uv-vtabs-item>
  45. </uv-vtabs>
  46. </view>
  47. <quick-order-entry
  48. ref="quickOrderEntry"
  49. />
  50. <kefu/>
  51. <tabber select="category" />
  52. </view>
  53. </template>
  54. <script>
  55. import tabber from '@/components/base/tabbar.vue'
  56. import productItem from '@/components/productItem.vue'
  57. export default {
  58. components: {
  59. tabber,
  60. productItem,
  61. },
  62. data() {
  63. return {
  64. current : 0,
  65. currentChildren : 0,
  66. category: [],
  67. list: [],
  68. chain: false,
  69. value: 0,
  70. }
  71. },
  72. computed: {
  73. categoryList(){
  74. if(!this.category[this.current] || !this.category[this.current].children){
  75. return []
  76. }
  77. return this.category[this.current].children[this.currentChildren]
  78. },
  79. },
  80. onLoad() {
  81. this.getCategory()
  82. },
  83. onShow() {
  84. this.$refs.quickOrderEntry.refresh();
  85. },
  86. methods: {
  87. clickTabs({index}){
  88. this.current = index
  89. this.currentChildren = 0
  90. },
  91. // 获取分类列表
  92. getCategory() {
  93. this.$api('getClassify', res => {
  94. if(res.code == 200) {
  95. this.category = res.result
  96. if(this.category.length > 0) {
  97. this.$nextTick(() => {
  98. this.getProductList(this.categoryList.id)
  99. })
  100. }
  101. }
  102. })
  103. },
  104. // 获取商品列表
  105. getProductList(shopIconId) {
  106. this.$api('getProductList', {
  107. shopClassId: shopIconId,
  108. pageNo: 1,
  109. pageSize: 99999
  110. }, res => {
  111. if(res.code == 200) {
  112. this.list = res.result.records
  113. }
  114. })
  115. },
  116. change(index) {
  117. this.currentChildren = index;
  118. if(this.category[index]) {
  119. this.$nextTick(() => {
  120. this.getProductList(this.categoryList.id)
  121. })
  122. }
  123. }
  124. }
  125. }
  126. </script>
  127. <style scoped lang="scss">
  128. .page{
  129. /deep/ .uv-vtabs{
  130. height: calc(100vh - 360rpx) !important;
  131. }
  132. /deep/ .uv-vtabs__bar{
  133. height: calc(100vh - 360rpx) !important;
  134. }
  135. /deep/ .uv-vtabs__content{
  136. height: calc(100vh - 360rpx) !important;
  137. }
  138. }
  139. .category {
  140. font-size: 30rpx;
  141. color: #333;
  142. .category-title{
  143. position: relative;
  144. display: flex;
  145. justify-content: center;
  146. align-items: center;
  147. height: 120rpx;
  148. &::before,
  149. &::after {
  150. position: absolute;
  151. top: 50%;
  152. content: '';
  153. width: 10%;
  154. border-top: 2rpx solid black;
  155. }
  156. &::before {
  157. left: 25%;
  158. }
  159. &::after {
  160. right: 25%;
  161. }
  162. }
  163. .list{
  164. display: flex;
  165. flex-wrap: wrap;
  166. margin: 0 auto;
  167. width: 490rpx;
  168. .item {
  169. padding: 10rpx 20rpx;
  170. display: flex;
  171. flex-direction: column;
  172. justify-content: center;
  173. align-items: center;
  174. margin-bottom: 20rpx;
  175. .item-image {
  176. width: 120rpx;
  177. height: 120rpx;
  178. image{
  179. height: 100%;
  180. width: 100%;
  181. border-radius: 50%;
  182. }
  183. }
  184. .item-unit {
  185. font-size: 24rpx;
  186. margin-top: 15rpx;
  187. color: #555;
  188. }
  189. }
  190. .gap {
  191. padding: 0 30rpx;
  192. }
  193. }
  194. }
  195. </style>