goodList.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <view>
  3. <view class='goodList' v-if="isShow && bastList.length && !isIframe">
  4. <block v-for="(item,index) in bastList" :key="index">
  5. <view @click="goDetail(item)" class='item acea-row row-between-wrapper' hover-class="none">
  6. <view class='pictrue'>
  7. <image :src='item.image'></image>
  8. <span class="pictrue_log pictrue_log_class"
  9. v-if="item.activity && item.activity.type === '1'">{{$t(`秒杀`)}}</span>
  10. <span class="pictrue_log pictrue_log_class"
  11. v-if="item.activity && item.activity.type === '2'">{{$t(`砍价`)}}</span>
  12. <span class="pictrue_log pictrue_log_class"
  13. v-if="item.activity && item.activity.type === '3'">{{$t(`拼团`)}}</span>
  14. </view>
  15. <view class='underline'>
  16. <view class='text'>
  17. <view class='line1'>{{item.store_name}}</view>
  18. <view class='money font-color'>{{$t(`¥`)}}<text class='num'>{{item.price}}</text></view>
  19. <view class="vip-money acea-row row-middle"
  20. v-if="item.base && item.vip_price && item.vip_price > 0">{{$t(`¥`)}}{{item.vip_price || 0}}
  21. <image src='/static/images/jvip.png' class="jvip"></image><text
  22. class='num'>{{$t(`已售`)}}{{item.sales}}{{item.unit_name}}</text>
  23. </view>
  24. <view class='vip-money acea-row row-middle'
  25. v-if="item.is_vip && item.vip_price && item.vip_price > 0">{{$t(`¥`)}}{{item.vip_price || 0}}
  26. <image src='/static/images/vip.png'></image><text
  27. class='num'>{{$t(`已售`)}}{{item.sales}}{{item.unit_name}}</text>
  28. </view>
  29. <view class='vip-money acea-row row-middle' v-else><text
  30. class='num'>{{$t(`已售`)}}{{item.sales}}{{item.unit_name}}</text></view>
  31. </view>
  32. </view>
  33. </view>
  34. </block>
  35. </view>
  36. <view class='goodList' v-if="bastList.length && isIframe">
  37. <block v-for="(item,index) in bastList" :key="index">
  38. <view @click="goDetail(item)" class='item acea-row row-between-wrapper' hover-class="none">
  39. <view class='pictrue'>
  40. <image :src='item.image'></image>
  41. <span class="pictrue_log pictrue_log_class"
  42. v-if="item.activity && item.activity.type === '1'">{{$t(`秒杀`)}}</span>
  43. <span class="pictrue_log pictrue_log_class"
  44. v-if="item.activity && item.activity.type === '2'">{{$t(`砍价`)}}</span>
  45. <span class="pictrue_log pictrue_log_class"
  46. v-if="item.activity && item.activity.type === '3'">{{$t(`拼团`)}}</span>
  47. </view>
  48. <view class='underline'>
  49. <view class='text'>
  50. <view class='line1'>{{item.store_name}}</view>
  51. <view class='money font-color'>{{$t(`¥`)}}<text class='num'>{{item.price}}</text></view>
  52. <view class="vip-money acea-row row-middle"
  53. v-if="item.base && item.vip_price && item.vip_price > 0">{{$t(`¥`)}}{{item.vip_price || 0}}
  54. <image src='/static/images/jvip.png' class="jvip"></image><text
  55. class='num'>{{$t(`已售`)}}{{item.sales}}{{item.unit_name}}</text>
  56. </view>
  57. <view class='vip-money acea-row row-middle'
  58. v-if="item.is_vip && item.vip_price && item.vip_price > 0">{{$t(`¥`)}}{{item.vip_price || 0}}
  59. <image src='/static/images/vip.png'></image><text
  60. class='num'>{{$t(`已售`)}}{{item.sales}}{{item.unit_name}}</text>
  61. </view>
  62. <view class='vip-money acea-row row-middle' v-else><text
  63. class='num'>{{$t(`已售`)}}{{item.sales}}{{item.unit_name}}</text></view>
  64. </view>
  65. </view>
  66. </view>
  67. </block>
  68. </view>
  69. <view class="empty-img" v-if="!bastList.length && isIframe">{{$t(`商品列表,暂无数据`)}}</view>
  70. </view>
  71. </template>
  72. <script>
  73. let app = getApp()
  74. import {
  75. mapGetters
  76. } from "vuex";
  77. import {
  78. goShopDetail,
  79. goPage
  80. } from '@/libs/order.js';
  81. import {
  82. getHomeProducts
  83. } from '@/api/store.js';
  84. export default {
  85. name: 'goodList',
  86. computed: mapGetters(['uid']),
  87. props: {
  88. dataConfig: {
  89. type: Object,
  90. default: () => {}
  91. }
  92. },
  93. watch: {
  94. dataConfig: {
  95. immediate: true,
  96. handler(nVal, oVal) {
  97. if (nVal) {
  98. this.isShow = nVal.isShow.val;
  99. this.selectType = nVal.tabConfig.tabVal;
  100. this.$set(this, 'selectId', nVal.selectConfig.activeValue || '');
  101. this.$set(this, 'type', nVal.selectSortConfig.activeValue);
  102. this.salesOrder = nVal.goodsSort.type == 1 ? 'desc' : '';
  103. this.newsOrder = nVal.goodsSort.type == 2 ? 'news' : '';
  104. this.ids = nVal.ids ? nVal.ids.join(',') : '';
  105. this.numConfig = nVal.numConfig.val;
  106. this.productslist();
  107. }
  108. }
  109. }
  110. },
  111. data() {
  112. return {
  113. bastList: [],
  114. name: this.$options.name,
  115. isIframe: false,
  116. isShow: true,
  117. selectType: 0,
  118. selectId: '',
  119. salesOrder: '',
  120. newsOrder: '',
  121. ids: '',
  122. page: 1,
  123. limit: this.$config.LIMIT,
  124. type: '',
  125. numConfig: 0
  126. };
  127. },
  128. created() {
  129. this.isIframe = app.globalData.isIframe;
  130. },
  131. mounted() {},
  132. methods: {
  133. // 产品列表
  134. productslist: function() {
  135. let that = this;
  136. let data = {};
  137. if (that.selectType) {
  138. data = {
  139. page: that.page,
  140. limit: that.limit,
  141. type: that.type,
  142. ids: that.ids,
  143. selectType: that.selectType
  144. }
  145. } else {
  146. data = {
  147. page: that.page,
  148. limit: that.numConfig <= that.limit ? that.numConfig : that.limit,
  149. type: that.type,
  150. newsOrder: that.newsOrder,
  151. salesOrder: that.salesOrder,
  152. selectId: that.selectId,
  153. selectType: that.selectType
  154. }
  155. }
  156. getHomeProducts(data).then(res => {
  157. that.bastList = res.data.list;
  158. }).catch(err => {
  159. that.$util.Tips({
  160. title: err
  161. });
  162. });
  163. },
  164. goDetail(item) {
  165. goPage().then(res => {
  166. goShopDetail(item, this.uid).then(res => {
  167. uni.navigateTo({
  168. url: `/pages/goods_details/index?id=${item.id}`
  169. })
  170. })
  171. })
  172. }
  173. }
  174. }
  175. </script>
  176. <style scoped lang='scss'>
  177. .empty-img {
  178. width: 690rpx;
  179. height: 300rpx;
  180. border-radius: 14rpx;
  181. margin: 26rpx auto 0 auto;
  182. background-color: #ccc;
  183. text-align: center;
  184. line-height: 300rpx;
  185. .iconfont {
  186. font-size: 50rpx;
  187. }
  188. }
  189. .goodList .item {
  190. position: relative;
  191. padding-left: 30rpx;
  192. box-shadow: 2px 1px 6px 1px rgba(0, 0, 0, 0.03);
  193. }
  194. .goodList .item .pictrue {
  195. width: 180rpx;
  196. height: 180rpx;
  197. position: relative;
  198. }
  199. .goodList .item .pictrue image {
  200. width: 100%;
  201. height: 100%;
  202. border-radius: 20rpx;
  203. }
  204. .goodList .item .pictrue .numPic {
  205. position: absolute;
  206. left: 7rpx;
  207. top: 7rpx;
  208. width: 40rpx;
  209. height: 40rpx;
  210. border-radius: 50%;
  211. }
  212. .goodList .item .underline {
  213. padding: 30rpx 30rpx 30rpx 0;
  214. border-bottom: 1px solid #f5f5f5;
  215. }
  216. .goodList .item:nth-last-child(1) .underline {
  217. border-bottom: 0;
  218. }
  219. .goodList .item .text {
  220. font-size: 30rpx;
  221. color: #222;
  222. width: 489rpx;
  223. }
  224. .goodList .item .text .money {
  225. font-size: 26rpx;
  226. font-weight: bold;
  227. margin-top: 50rpx;
  228. }
  229. .goodList .item .text .money .num {
  230. font-size: 34rpx;
  231. }
  232. .goodList .item .text .vip-money {
  233. font-size: 24rpx;
  234. color: #282828;
  235. font-weight: bold;
  236. margin-top: 15rpx;
  237. }
  238. .goodList .item .text .vip-money .jvip {
  239. width: 46rpx;
  240. height: 22rpx;
  241. }
  242. .goodList .item .text .vip-money image {
  243. width: 66rpx;
  244. height: 25rpx;
  245. margin-right: 8rpx;
  246. margin-left: 8rpx;
  247. }
  248. .goodList .item .text .vip-money .num {
  249. font-size: 22rpx;
  250. color: #aaa;
  251. font-weight: normal;
  252. margin-top: -2rpx;
  253. ~.num {
  254. margin-left: 22rpx;
  255. }
  256. }
  257. .goodList .item .iconfont {
  258. position: absolute;
  259. right: 30rpx;
  260. width: 50rpx;
  261. height: 50rpx;
  262. border-radius: 50%;
  263. font-size: 30rpx;
  264. bottom: 38rpx;
  265. }
  266. </style>