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

222 lines
4.2 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. import QuickOrderEntry from '@/components/QuickOrderEntry.vue'
  58. export default {
  59. components: {
  60. tabber,
  61. productItem,
  62. QuickOrderEntry,
  63. },
  64. data() {
  65. return {
  66. current : 0,
  67. currentChildren : 0,
  68. category: [],
  69. list: [],
  70. chain: false,
  71. value: 0,
  72. }
  73. },
  74. computed: {
  75. categoryList(){
  76. if(!this.category[this.current] || !this.category[this.current].children){
  77. return []
  78. }
  79. return this.category[this.current].children[this.currentChildren]
  80. },
  81. },
  82. onLoad() {
  83. this.getCategory()
  84. },
  85. onShow() {
  86. if(uni.getStorageSync('token')){
  87. // 刷新快捷下单信息
  88. this.$refs.quickOrderEntry.refresh();
  89. }
  90. },
  91. methods: {
  92. clickTabs({index}){
  93. this.current = index
  94. this.currentChildren = 0
  95. },
  96. // 获取分类列表
  97. getCategory() {
  98. this.$api('getClassify', res => {
  99. if(res.code == 200) {
  100. this.category = res.result
  101. if(this.category.length > 0) {
  102. this.$nextTick(() => {
  103. this.getProductList(this.categoryList.id)
  104. })
  105. }
  106. }
  107. })
  108. },
  109. // 获取商品列表
  110. getProductList(shopIconId) {
  111. this.$api('getProductList', {
  112. shopClassId: shopIconId,
  113. pageNo: 1,
  114. pageSize: 99999
  115. }, res => {
  116. if(res.code == 200) {
  117. this.list = res.result.records
  118. }
  119. })
  120. },
  121. change(index) {
  122. this.currentChildren = index;
  123. if(this.category[index]) {
  124. this.$nextTick(() => {
  125. this.getProductList(this.categoryList.id)
  126. })
  127. }
  128. }
  129. }
  130. }
  131. </script>
  132. <style scoped lang="scss">
  133. .page{
  134. /deep/ .uv-vtabs{
  135. height: calc(100vh - 360rpx) !important;
  136. }
  137. /deep/ .uv-vtabs__bar{
  138. height: calc(100vh - 360rpx) !important;
  139. }
  140. /deep/ .uv-vtabs__content{
  141. height: calc(100vh - 360rpx) !important;
  142. }
  143. }
  144. .category {
  145. font-size: 30rpx;
  146. color: #333;
  147. .category-title{
  148. position: relative;
  149. display: flex;
  150. justify-content: center;
  151. align-items: center;
  152. height: 120rpx;
  153. &::before,
  154. &::after {
  155. position: absolute;
  156. top: 50%;
  157. content: '';
  158. width: 10%;
  159. border-top: 2rpx solid black;
  160. }
  161. &::before {
  162. left: 25%;
  163. }
  164. &::after {
  165. right: 25%;
  166. }
  167. }
  168. .list{
  169. display: flex;
  170. flex-wrap: wrap;
  171. margin: 0 auto;
  172. width: 490rpx;
  173. .item {
  174. padding: 10rpx 20rpx;
  175. display: flex;
  176. flex-direction: column;
  177. justify-content: center;
  178. align-items: center;
  179. margin-bottom: 20rpx;
  180. .item-image {
  181. width: 120rpx;
  182. height: 120rpx;
  183. image{
  184. height: 100%;
  185. width: 100%;
  186. border-radius: 50%;
  187. }
  188. }
  189. .item-unit {
  190. font-size: 24rpx;
  191. margin-top: 15rpx;
  192. color: #555;
  193. }
  194. }
  195. .gap {
  196. padding: 0 30rpx;
  197. }
  198. }
  199. }
  200. </style>