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

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