recommend.vue 10 KB

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