珠宝小程序前端代码
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.6 KiB

11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
  1. <template>
  2. <view class="page">
  3. <!-- 导航栏 -->
  4. <navbar title="商品列表"
  5. leftClick
  6. @leftClick="$utils.navigateBack"
  7. bgColor="#E3441A"
  8. color="#fff" />
  9. <!-- 搜索栏 -->
  10. <view class="search">
  11. <uv-search placeholder="搜你喜欢的产品" bgColor="#fff"
  12. @search="search"
  13. @change="search"
  14. @custom="search"
  15. v-model="queryParams.title"></uv-search>
  16. </view>
  17. <!-- 商品列表 -->
  18. <view style="position: 20rpx;"
  19. v-if="queryParams.title">
  20. <productList :list="list" />
  21. </view>
  22. <!-- 分类商品列表 -->
  23. <view class="category"
  24. v-else>
  25. <view class="tabs">
  26. <uv-tabs
  27. :list="category"
  28. :activeStyle="{color : '#f00', fontWeight : 600}"
  29. lineColor="#f00"
  30. :inactiveStyle="{color: 'rgba(0,0,0,.8)'}"
  31. lineHeight="8rpx"
  32. lineWidth="50rpx"
  33. :current="current"
  34. @click="clickTabs"></uv-tabs>
  35. </view>
  36. <uv-vtabs
  37. :list="category[current].children"
  38. :current="currentChildren"
  39. keyName="name"
  40. :chain="false"
  41. @change="change">
  42. <!-- <view class="list"> -->
  43. <!-- <template v-for="(item, index) in category[current].children">
  44. <uv-vtabs-item :index="index" :key="index">
  45. <view class="category-item">
  46. <view class="category-title">
  47. {{ item.name }}
  48. </view>
  49. <productItem :item="pro"
  50. v-for="(pro, i) in item.shopList" :key="i"
  51. @click="$utils.navigateTo(`/pages_order/product/productDetail?id=${pro.id}`)" />
  52. </view>
  53. </uv-vtabs-item>
  54. </template> -->
  55. <!-- </view> -->
  56. <uv-vtabs-item>
  57. <view class="category-item">
  58. <productItem :item="pro"
  59. v-for="(pro, i) in categoryList.shopList" :key="i"
  60. @click="$utils.navigateTo(`/pages_order/product/productDetail?id=${pro.id}`)" />
  61. <uv-empty v-if="categoryList.shopList.length == 0" text="还没有呢"/>
  62. </view>
  63. </uv-vtabs-item>
  64. </uv-vtabs>
  65. </view>
  66. <kefu></kefu>
  67. <!-- tabbar -->
  68. <tabber select="category" />
  69. </view>
  70. </template>
  71. <script>
  72. import productItem from '@/components/product/productItem.vue';
  73. import mixinsList from '@/mixins/list.js'
  74. import {
  75. mapState
  76. } from 'vuex'
  77. import tabber from '@/components/base/tabbar.vue'
  78. import productList from '@/components/user/productList.vue'
  79. export default {
  80. mixins: [mixinsList],
  81. components: {
  82. productItem,
  83. tabber,
  84. productList,
  85. },
  86. data() {
  87. return {
  88. mixinsListApi: 'getClassShopPageList',
  89. current : 0,
  90. currentChildren : 0,
  91. }
  92. },
  93. computed: {
  94. ...mapState(['category']),
  95. categoryList(){
  96. return this.category[this.current].children[this.currentChildren]
  97. },
  98. },
  99. onLoad({
  100. search,
  101. cid
  102. }) {
  103. if (search) {
  104. this.queryParams.title = search
  105. }
  106. // this.$store.commit('getCategoryList')
  107. if(this.category.length > 0 && cid){
  108. this.category.forEach((n, i) => {
  109. if(n.id == cid){
  110. this.current = i
  111. }
  112. })
  113. // this.queryParams.classId = cid
  114. }else if (this.category.length > 0) {
  115. // this.queryParams.classId = this.category[0].id
  116. }
  117. },
  118. methods: {
  119. change(e) {
  120. // this.queryParams.classId = this.category[e].id
  121. this.currentChildren = e
  122. },
  123. clickTabs({index}){
  124. this.current = index
  125. this.currentChildren = 0
  126. },
  127. search(){
  128. for(let i = 0;i < 10;i++){
  129. delete this.queryParams[i]
  130. }
  131. this.queryParams.pageSize = 10
  132. this.getData()
  133. },
  134. }
  135. }
  136. </script>
  137. <style scoped lang="scss">
  138. .page {
  139. /deep/ .uv-vtabs {
  140. height: calc(100vh - 600rpx) !important;
  141. }
  142. /deep/ .uv-vtabs__bar {
  143. height: calc(100vh - 600rpx) !important;
  144. }
  145. /deep/ .uv-vtabs__content {
  146. height: calc(100vh - 600rpx) !important;
  147. }
  148. .search {
  149. position: relative;
  150. background: #FFFFFF;
  151. margin: 20rpx;
  152. border-radius: 41rpx;
  153. padding: 10rpx 20rpx;
  154. display: flex;
  155. align-items: center;
  156. /deep/ .uv-search__action {
  157. background-color: $uni-color;
  158. color: #FFFFFF;
  159. padding: 10rpx 20rpx;
  160. border-radius: 30rpx;
  161. }
  162. }
  163. &::v-deep .uv-vtabs__content {
  164. background: transparent !important;
  165. overflow: hidden;
  166. }
  167. }
  168. .category {
  169. font-size: 30rpx;
  170. color: #333;
  171. .category-title{
  172. position: relative;
  173. display: flex;
  174. justify-content: center;
  175. align-items: center;
  176. height: 120rpx;
  177. &::before,
  178. &::after {
  179. position: absolute;
  180. top: 50%;
  181. content: '';
  182. width: 10%;
  183. border-top: 2rpx solid black;
  184. }
  185. &::before {
  186. left: 25%;
  187. }
  188. &::after {
  189. right: 25%;
  190. }
  191. }
  192. &::v-deep .uv-vtabs {
  193. width: 750rpx;
  194. overflow: hidden;
  195. }
  196. .list {
  197. width: 100%;
  198. padding: 0rpx 20rpx;
  199. box-sizing: border-box;
  200. }
  201. }
  202. </style>