recommend.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <template>
  2. <view>
  3. <view class="productList" :style="colorStyle">
  4. <view class='index-wrapper acea-row row-between-wrapper' v-if="isShow && bastList.length">
  5. <view class='title acea-row row-between-wrapper'>
  6. <view class='text'>
  7. <view class='name line1'>
  8. <text class="iconfont icon-jingpintuijian1"></text>
  9. {{$t(titleInfo[0].val)}}
  10. </view>
  11. <view class='line1 txt-btn'>{{$t(titleInfo[1].val)}}</view>
  12. </view>
  13. <view class='more' @click="gopage(titleInfo[2].val)">
  14. {{$t(`更多`)}}
  15. <text class='iconfont icon-jiantou'></text>
  16. </view>
  17. </view>
  18. <view class="item-box">
  19. <view class='item' v-for="(item,index) in bastList" :key="index" @click="goDetail(item)">
  20. <view class='pictrue'>
  21. <image :src='item.image'></image>
  22. <!-- <span class="pictrue_log_class pictrue_log_big" v-if="item.activity && item.activity.type === '1'">秒杀</span>
  23. <span class="pictrue_log_class pictrue_log_big" v-if="item.activity && item.activity.type === '2'">砍价</span>
  24. <span class="pictrue_log_class pictrue_log_big" v-if="item.activity && item.activity.type === '3'">拼团</span> -->
  25. </view>
  26. <view class='text'>
  27. <view class='name line2'>{{item.store_name}}</view>
  28. <view class="type">
  29. <view class="type-sty" v-if="item.activity && item.activity.type == '1'">{{$t(`秒杀`)}}</view>
  30. <view class="type-sty" v-if="item.activity && item.activity.type == '2'">{{$t(`砍价`)}}</view>
  31. <view class="type-sty" v-if="item.activity && item.activity.type == '3'">{{$t(`砍价`)}}</view>
  32. </view>
  33. <view class='vip acea-row'>
  34. <view class='money font-color'>{{$t(`¥`)}}<text class='num'>{{item.price}}</text></view>
  35. <view class='vip-money' v-if="item.vip_price && item.vip_price > 0 && item.base">
  36. {{$t(`¥`)}}{{item.vip_price}}
  37. <image src='/static/images/jvip.png' class="jvip"></image>
  38. </view>
  39. <view class='vip-money' v-if="item.vip_price && item.vip_price > 0 && item.is_vip">
  40. {{$t(`¥`)}}{{item.vip_price}}
  41. <image src='/static/images/vip.png'></image>
  42. </view>
  43. <!-- <view>已售{{item.sales}}{{item.unit_name}}</view> -->
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <view class='index-wrapper list acea-row row-between-wrapper' v-if="!isShow && isIframe && bastList.length">
  50. <view class='title acea-row row-between-wrapper'>
  51. <view class='text'>
  52. <view class='name line1'>
  53. <text class="iconfont icon-jingpintuijian1"></text>
  54. {{titleInfo[0].val}}
  55. </view>
  56. <view class='line1 txt-btn'>{{titleInfo[1].val}}</view>
  57. </view>
  58. <view class='more' @click="gopage(titleInfo[2].val)">
  59. {{$t(`更多`)}}
  60. <text class='iconfont icon-jiantou'></text>
  61. </view>
  62. </view>
  63. <view class="item-box">
  64. <view class='item' v-for="(item,index) in bastList" :key="index" @click="goDetail(item)">
  65. <view class='pictrue'>
  66. <image :src='item.image'></image>
  67. <!-- <span class="pictrue_log_class pictrue_log_big" v-if="item.activity && item.activity.type === '1'">秒杀</span>
  68. <span class="pictrue_log_class pictrue_log_big" v-if="item.activity && item.activity.type === '2'">砍价</span>
  69. <span class="pictrue_log_class pictrue_log_big" v-if="item.activity && item.activity.type === '3'">拼团</span> -->
  70. </view>
  71. <view class='text'>
  72. <view class='name line2'>{{item.store_name}}</view>
  73. <view class="type">
  74. <view class="type-sty" v-if="item.activity && item.activity.type == '1'">{{$t(`秒杀`)}}</view>
  75. <view class="type-sty" v-if="item.activity && item.activity.type == '2'">{{$t(`砍价`)}}</view>
  76. <view class="type-sty" v-if="item.activity && item.activity.type == '3'">{{$t(`砍价`)}}</view>
  77. <view class="type-sty" v-if="item.checkCoupon">{{$t(`ticket`)}}</view>
  78. </view>
  79. <view class='money font-color'>{{$t(`¥`)}}<text class='num'>{{item.price}}</text></view>
  80. <view class='vip acea-row row-between-wrapper'>
  81. <view class='vip-money' v-if="item.vip_price && item.vip_price > 0 && item.base">
  82. {{$t(`¥`)}}{{item.vip_price}}
  83. <image src='/static/images/jvip.png' class="jvip"></image>
  84. </view>
  85. <view class='vip-money' v-if="item.vip_price && item.vip_price > 0 && item.is_vip">
  86. {{$t(`¥`)}}{{item.vip_price}}
  87. <image src='/static/images/vip.png'></image>
  88. </view>
  89. <!-- <view>已售{{item.sales}}{{item.unit_name}}</view> -->
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. <block v-if="isIframe && !bastList.length">
  96. <view class='index-wrapper' v-if="isIframe && !fastList.length">
  97. <view class='title acea-row row-between-wrapper'>
  98. <view class='text'>
  99. <view class='name line1'>
  100. <text class="iconfont icon-jingpintuijian1"></text>
  101. {{titleInfo[0].val}}
  102. </view>
  103. <view class='line1 txt-btn'>{{titleInfo[1].val}}</view>
  104. </view>
  105. <navigator class='more' open-type="switchTab" :url="titleInfo[2].val">{{$t(`更多`)}}<text
  106. class='iconfont icon-jiantou'></text></navigator>
  107. </view>
  108. <view class='scroll-product'>
  109. <view class="empty-img">{{$t(`精品推荐,暂无数据`)}}</view>
  110. </view>
  111. </view>
  112. </block>
  113. </view>
  114. </view>
  115. </template>
  116. <script>
  117. let app = getApp()
  118. import {
  119. mapState
  120. } from 'vuex'
  121. import {
  122. goShopDetail,
  123. goPage
  124. } from '@/libs/order.js'
  125. import {
  126. getHomeProducts
  127. } from '@/api/store.js';
  128. import goodLists from '@/components/goodList/index.vue'
  129. import colors from "@/mixins/color";
  130. export default {
  131. name: 'goodList',
  132. props: {
  133. dataConfig: {
  134. type: Object,
  135. default: () => {}
  136. }
  137. },
  138. mixins: [colors],
  139. components: {
  140. goodLists
  141. },
  142. created() {
  143. },
  144. mounted() {},
  145. watch: {
  146. dataConfig: {
  147. immediate: true,
  148. handler(nVal, oVal) {
  149. if (nVal) {
  150. this.isShow = nVal.isShow.val;
  151. this.selectType = nVal.tabConfig.tabVal;
  152. this.$set(this, 'selectId', nVal.selectConfig.activeValue || '');
  153. this.$set(this, 'type', nVal.selectSortConfig.activeValue);
  154. this.salesOrder = nVal.goodsSort.type == 1 ? 'desc' : '';
  155. this.newsOrder = nVal.goodsSort.type == 2 ? 'news' : '';
  156. this.ids = nVal.ids ? nVal.ids.join(',') : '';
  157. this.numConfig = nVal.numConfig.val;
  158. this.titleInfo = nVal.titleInfo.list;
  159. this.productslist();
  160. }
  161. }
  162. }
  163. },
  164. data() {
  165. return {
  166. circular: true,
  167. interval: 3000,
  168. duration: 500,
  169. bastList: [],
  170. name: this.$options.name,
  171. isShow: true,
  172. isIframe: app.globalData.isIframe,
  173. selectType: 0,
  174. selectId: '',
  175. salesOrder: '',
  176. newsOrder: '',
  177. ids: '',
  178. page: 1,
  179. limit: this.$config.LIMIT,
  180. type: '',
  181. numConfig: 0,
  182. titleInfo: []
  183. }
  184. },
  185. methods: {
  186. // 产品列表
  187. productslist: function() {
  188. let that = this;
  189. let data = {};
  190. if (that.selectType) {
  191. data = {
  192. page: that.page,
  193. limit: that.limit,
  194. type: that.type,
  195. ids: that.ids,
  196. selectType: that.selectType
  197. }
  198. } else {
  199. data = {
  200. page: that.page,
  201. limit: that.numConfig <= that.limit ? that.numConfig : that.limit,
  202. type: that.type,
  203. newsOrder: that.newsOrder,
  204. salesOrder: that.salesOrder,
  205. selectId: that.selectId,
  206. selectType: that.selectType
  207. }
  208. }
  209. getHomeProducts(data).then(res => {
  210. that.bastList = res.data.list;
  211. }).catch(err => {
  212. that.$util.Tips({
  213. title: err
  214. });
  215. });
  216. },
  217. gopage(url) {
  218. uni.navigateTo({
  219. url: url
  220. })
  221. },
  222. goDetail(item) {
  223. goPage().then(res => {
  224. goShopDetail(item, this.uid).then(res => {
  225. uni.navigateTo({
  226. url: `/pages/goods_details/index?id=${item.id}`
  227. })
  228. })
  229. })
  230. }
  231. }
  232. }
  233. </script>
  234. <style lang="scss">
  235. .productList {
  236. background-color: #fff;
  237. margin: 20rpx 30rpx;
  238. border-radius: $uni-border-radius-index;
  239. }
  240. .title {
  241. display: flex;
  242. margin: 0;
  243. width: 100%;
  244. margin: 0 20rpx;
  245. .text {
  246. display: flex;
  247. .name {
  248. font-size: $uni-index-title-font-size;
  249. font-weight: bold;
  250. }
  251. .txt-btn {
  252. display: flex;
  253. align-items: flex-end;
  254. margin-bottom: 8rpx;
  255. margin-left: 12rpx;
  256. }
  257. }
  258. }
  259. .productList .item {
  260. width: 100%;
  261. padding: 25rpx 0;
  262. background-color: #fff;
  263. border-radius: 10rpx;
  264. display: flex;
  265. // border:1rpx solid #eee;
  266. }
  267. .productList .item .pictrue {
  268. position: relative;
  269. width: 180rpx;
  270. height: 180rpx;
  271. }
  272. .productList .item .pictrue image {
  273. width: 100%;
  274. height: 100%;
  275. border-radius: 10rpx;
  276. }
  277. .productList .item:nth-child(even) {
  278. border-top: 1rpx solid #EEEEEE;
  279. border-bottom: 1rpx solid #EEEEEE;
  280. }
  281. .productList .item .text {
  282. width: 460rpx;
  283. padding: 0rpx 17rpx 0rpx 17rpx;
  284. font-size: 30rpx;
  285. color: #222;
  286. display: flex;
  287. flex-direction: column;
  288. justify-content: space-between;
  289. .name {
  290. font-size: 28rpx;
  291. }
  292. .type {
  293. display: flex;
  294. .type-sty {
  295. padding: 0 5rpx;
  296. border: 1px solid var(--view-theme);
  297. color: var(--view-theme);
  298. font-size: 24rpx;
  299. border-radius: 4rpx;
  300. }
  301. }
  302. }
  303. .productList .item .text .money {
  304. font-size: 26rpx;
  305. font-weight: bold;
  306. }
  307. .productList .item .text .money .num {
  308. font-size: 34rpx;
  309. color: var(--view-priceColor);
  310. }
  311. .productList .item .text .vip {
  312. font-size: 22rpx;
  313. color: var(--view-priceColor);
  314. margin-top: 7rpx;
  315. display: flex;
  316. align-items: center;
  317. }
  318. .productList .item .text .vip .vip-money {
  319. font-size: 24rpx;
  320. color: #282828;
  321. font-weight: bold;
  322. }
  323. .productList .item .text .vip .vip-money image {
  324. width: 46rpx;
  325. height: 21rpx;
  326. margin-left: 4rpx;
  327. }
  328. .empty-img {
  329. width: 690rpx;
  330. height: 300rpx;
  331. border-radius: 10rpx;
  332. margin: 26rpx auto 0 auto;
  333. background-color: #ccc;
  334. text-align: center;
  335. line-height: 300rpx;
  336. .iconfont {
  337. font-size: 50rpx;
  338. }
  339. }
  340. .font-color {
  341. color: var(--view-priceColor);
  342. }
  343. .item-box {
  344. margin: 0 auto;
  345. }
  346. </style>