goodList.vue 7.5 KB

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