index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view class="user_store_attention" :style="viewColor">
  3. <view class="item" v-for="(item,index) in storeList" :key="index" :style="{ 'background-image': `url(${domain}/static/diy/store_bg${keyColor}.png)`}">
  4. <view class="store_header" @click="goStore(item)">
  5. <image :src="item.merchant.mer_avatar" mode=""></image>
  6. <view class="info">
  7. <view class="line1">
  8. <text class="name line1">{{item.merchant.mer_name}}</text>
  9. <text v-if="item.merchant.type_name" class="font-bg-red ml8">{{item.merchant.type_name}}</text>
  10. <text v-else-if="item.merchant.is_trader" class="font-bg-red ml8">自营</text>
  11. </view>
  12. <view class="btn" @click.stop="bindDetele(item,index)">取消关注</view>
  13. </view>
  14. </view>
  15. <view class="store_recommend" v-if="item.merchant && item.merchant.showProduct.length>0">
  16. <block v-for="(itemn,indexn) in item.merchant.showProduct" :key="indexn" v-if="indexn < 3">
  17. <navigator :url="'/pages/goods_details/index?id='+itemn.product_id"
  18. hover-class="none" class="list">
  19. <view class="picture">
  20. <easy-loadimage mode="widthFix" :image-src="itemn.image"></easy-loadimage>
  21. </view>
  22. <view class="price line1">¥ {{itemn.price}}</view>
  23. </navigator>
  24. </block>
  25. </view>
  26. </view>
  27. <view class='noCommodity' v-if="storeList.length == 0">
  28. <view class='pictrue'>
  29. <image src='http://ygs.hqgjsmc.com/baseimg/noCart.png'></image>
  30. </view>
  31. <view class="empty-txt" >暂无数据</view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. // +----------------------------------------------------------------------
  37. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  38. // +----------------------------------------------------------------------
  39. // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
  40. // +----------------------------------------------------------------------
  41. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  42. // +----------------------------------------------------------------------
  43. // | Author: CRMEB Team <admin@crmeb.com>
  44. // +----------------------------------------------------------------------
  45. let app = getApp();
  46. import { getMerchantLst,collectDel } from '@/api/store.js'
  47. import easyLoadimage from '@/components/easy-loadimage/easy-loadimage.vue';
  48. import {mapGetters} from "vuex";
  49. import { configMap } from '@/utils';
  50. import { HTTP_REQUEST_URL } from '@/config/app';
  51. export default{
  52. components: { easyLoadimage },
  53. computed: configMap(['hide_mer_status'], mapGetters(['viewColor', 'keyColor'])),
  54. data(){
  55. return {
  56. domain: HTTP_REQUEST_URL,
  57. storeList:[],
  58. isScroll:true,
  59. page:1,
  60. limit:20
  61. }
  62. },
  63. onLoad() {
  64. this.getList()
  65. },
  66. onReady(){
  67. },
  68. mounted: function() {
  69. },
  70. methods:{
  71. goStore(item){
  72. if(this.hide_mer_status != 1){
  73. uni.navigateTo({
  74. url:`/pages/store/index?id=${item.merchant.mer_id}`
  75. })
  76. }
  77. },
  78. getList(){
  79. if(!this.isScroll) return
  80. getMerchantLst({
  81. page:this.page,
  82. limit:this.limit
  83. }).then(res=>{
  84. this.isScroll = res.data.list.length>=this.limit
  85. this.storeList = this.storeList.concat(res.data.list)
  86. this.page+=1
  87. })
  88. },
  89. // 删除收藏
  90. bindDetele(item,index){
  91. collectDel({
  92. type:10,
  93. type_id:item.type_id
  94. }).then(res=>{
  95. uni.showToast({
  96. title:'已取消',
  97. icon:'none'
  98. })
  99. this.storeList.splice(index,1)
  100. })
  101. }
  102. },
  103. onReachBottom() {
  104. this.getList()
  105. },
  106. // 滚动监听
  107. onPageScroll(e) {
  108. // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
  109. uni.$emit('scroll');
  110. }
  111. }
  112. </script>
  113. <style lang="scss">
  114. .user_store_attention{
  115. padding: 20rpx;
  116. .item{
  117. background-color: #ffffff;
  118. background-size: 100%;
  119. background-repeat: no-repeat;
  120. border-radius: 16rpx;
  121. padding: 0 20rpx;
  122. margin-bottom: 20rpx;
  123. }
  124. .store_header{
  125. position: relative;
  126. display: flex;
  127. padding: 30rpx 10rpx;
  128. align-items: center;
  129. image{
  130. width: 88rpx;
  131. height: 88rpx;
  132. border-radius: 50%;
  133. }
  134. .info{
  135. flex: 1;
  136. display: flex;
  137. flex-direction: column;
  138. justify-content: space-between;
  139. margin-left: 20rpx;
  140. position: relative;
  141. .name{
  142. width: 410rpx;
  143. font-weight: bold;
  144. }
  145. .des{
  146. color: #666666;
  147. font-size: 22rpx;
  148. }
  149. .btn{
  150. display: flex;
  151. align-items: center;
  152. justify-content: center;
  153. position: absolute;
  154. right: 0;
  155. top: 50%;
  156. width:150rpx;
  157. height:50rpx;
  158. transform: translateY(-50%);
  159. border:1px solid #BBBBBB;
  160. border-radius:25rpx;
  161. font-size: 26rpx;
  162. }
  163. }
  164. }
  165. .store_recommend{
  166. display: flex;
  167. padding-bottom: 30rpx;
  168. .list{
  169. width: 210rpx;
  170. .picture,/deep/image,/deep/.easy-loadimage,uni-image{
  171. width: 210rpx;
  172. height: 210rpx;
  173. border-radius: 10rpx;
  174. }
  175. margin-right: 20rpx;
  176. &:last-child{
  177. margin-right: 0;
  178. }
  179. .price{
  180. text-align: center;
  181. color: var(--view-priceColor);
  182. font-size: 24rpx;
  183. margin-top: 10rpx;
  184. font-weight: bold;
  185. }
  186. }
  187. }
  188. }
  189. </style>