recommend.vue 9.5 KB

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