integral_goods_list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. <template>
  2. <!-- 商品列表模块 -->
  3. <view :style="viewColor">
  4. <view class='productList'>
  5. <view class='search acea-row row-between-wrapper'>
  6. <view class='input acea-row row-between-wrapper'><text class='iconfont icon-sousuo'></text>
  7. <input placeholder='搜索商品名称' placeholder-class='placeholder' confirm-type='search' name="search"
  8. :value='where.keyword' @confirm="searchSubmit"></input>
  9. </view>
  10. <view class='iconfont' :class='is_switch==true?"icon-pailie":"icon-tupianpailie"' @click.native='Changswitch'>
  11. </view>
  12. </view>
  13. <view class='nav acea-row row-middle'>
  14. <view class='item line1' :class="{'font-num': where.order==''}" @click.native='set_where(1)'>默认</view>
  15. <view class='item' :class="{'font-num': where.order=='ot_price_desc' || where.order=='ot_price_asc'}" @click='set_where(2)'>
  16. 积分
  17. <image v-if="price==1" :src="domain+'/static/diy/up'+keyColor+'.png'"></image>
  18. <image v-else-if="price==2" :src="domain+'/static/diy/down'+keyColor+'.png'"></image>
  19. <image v-else :src='`${domain}/static/images/horn.png`'></image>
  20. </view>
  21. <view class='item' :class="{'font-num': where.order=='sales'}" @click.native='set_where(3)'>
  22. 销量
  23. </view>
  24. </view>
  25. <view class='list acea-row row-between-wrapper' :class='is_switch==true?"":"on"'>
  26. <view class='item' :class='is_switch==true?"":"on"' hover-class='none'
  27. v-for="(item,index) in productList" :key="index" @click.native="godDetail(item)">
  28. <view class='pictrue' :class='is_switch==true?"":"on"'>
  29. <image :src='item.image' :class='is_switch==true?"":"on"'></image>
  30. <view v-if="item.stock == 0" class="sell_out" :class='is_switch==true?"":"on"'>已兑完</view>
  31. </view>
  32. <view class='text' :class='is_switch==true?"":"on"'>
  33. <view class='name' :class='is_switch==true?"line1":"line2"'>{{item.store_name}}</view>
  34. <view class='vip' :class='is_switch==true?"":"on"'>
  35. <view class="acea-row price-count">
  36. <image class="image" :src="`${domain}/static/images/jf-point.png`" mode="widthFix"></image>
  37. <view class="price-box">
  38. <text>{{ item.ot_price }}</text>积分
  39. </view>
  40. <view v-if="item.price!=0" class="sales">+{{parseFloat(Number(item.price).toFixed(2))}}元</view>
  41. </view>
  42. <view class="exchange">
  43. {{item.sales}}人兑换
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class='loadingicon acea-row row-center-wrapper' v-if='loading'>
  49. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  50. </view>
  51. </view>
  52. </view>
  53. <view class='noCommodity' v-if="productList.length==0 && !loading">
  54. <view class='emptyBox'>
  55. <image :src="`${domain}/static/images/noCart.png`"></image>
  56. <view class="tips">暂无商品,去看点别的吧</view>
  57. </view>
  58. <recommend :hostProduct="hostProduct"></recommend>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. // +----------------------------------------------------------------------
  64. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  65. // +----------------------------------------------------------------------
  66. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  67. // +----------------------------------------------------------------------
  68. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  69. // +----------------------------------------------------------------------
  70. // | Author: CRMEB Team <admin@crmeb.com>
  71. // +----------------------------------------------------------------------
  72. import { getProductHot } from '@/api/store.js';
  73. import {getIntegralGoodsList } from '@/api/points_mall.js';
  74. import recommend from '@/components/recommend';
  75. import { mapGetters } from "vuex";
  76. import { goShopDetail } from '@/libs/order.js'
  77. import {HTTP_REQUEST_URL} from '@/config/app';
  78. export default {
  79. computed: mapGetters(['uid','viewColor','keyColor']),
  80. components: {
  81. recommend,
  82. },
  83. data() {
  84. return {
  85. productList: [],
  86. is_switch: true,
  87. where: {
  88. order: '',
  89. keyword: '',
  90. page: 1,
  91. cate_id: '',
  92. limit: 20,
  93. },
  94. price: 0,
  95. stock: 0,
  96. nows: false,
  97. loadend: false,
  98. loading: false,
  99. loadTitle: '加载更多',
  100. title: '',
  101. hostProduct: [],
  102. hotPage: 1,
  103. hotLimit: 10,
  104. hotScroll: false,
  105. domain:HTTP_REQUEST_URL
  106. };
  107. },
  108. onLoad: function(option) {
  109. this.where.cid = option.cid || 0;
  110. this.$set(this.where, 'cate_id', option.cate_id || '');
  111. this.$set(this.where, 'keyword', option.searchValue || '');
  112. this.get_product_list();
  113. },
  114. onShow(){
  115. uni.removeStorageSync('form_type_cart');
  116. },
  117. methods: {
  118. // 去详情页
  119. godDetail(item) {
  120. uni.navigateTo({
  121. url: `/pages/points_mall/integral_goods_details?id=${item.product_id}`
  122. })
  123. },
  124. Changswitch: function() {
  125. let that = this;
  126. that.is_switch = !that.is_switch
  127. },
  128. searchSubmit: function(e) {
  129. let that = this;
  130. that.$set(that.where, 'keyword', e.detail.value);
  131. that.productList = [];
  132. that.loadend = false;
  133. that.loading = false;
  134. that.$set(that.where, 'page', 1);
  135. that.get_product_list();
  136. },
  137. //点击事件处理
  138. set_where: function(e) {
  139. switch (e) {
  140. case 1:
  141. this.price = 0
  142. this.where = {
  143. keyword: '',
  144. order: '',
  145. page: 1,
  146. limit: 20,
  147. }
  148. break
  149. case 2:
  150. if (this.price == 0 || this.price == 2) {
  151. this.price = 1;
  152. } else if (this.price == 1) {
  153. this.price = 2;
  154. }
  155. this.where.order = this.where.order == 'ot_price_asc' ? 'ot_price_desc' : 'ot_price_asc'
  156. break;
  157. case 3:
  158. this.price = 0;
  159. this.$set(this.where, 'order', 'sales')
  160. this.get_product_list(true);
  161. break;
  162. }
  163. this.loadend = false;
  164. this.loading = false
  165. this.productList = []
  166. this.$set(this.where, 'page', 1);
  167. this.get_product_list();
  168. },
  169. //查找产品
  170. get_product_list: function() {
  171. let that = this;
  172. if (that.loadend) return;
  173. if (that.loading) return;
  174. that.loading = true;
  175. that.loadTitle = '';
  176. getIntegralGoodsList(that.where).then(res => {
  177. let list = res.data.list;
  178. let productList = that.$util.SplitArray(list, that.productList);
  179. let loadend = list.length < that.where.limit;
  180. that.loadend = loadend;
  181. that.loading = false;
  182. that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  183. that.$set(that, 'productList', productList);
  184. that.$set(that.where, 'page', that.where.page + 1);
  185. }).catch(err => {
  186. that.loading = false;
  187. that.loadTitle = '加载更多';
  188. });
  189. },
  190. },
  191. onPullDownRefresh() {
  192. },
  193. onReachBottom() {
  194. this.get_product_list();
  195. }
  196. }
  197. </script>
  198. <style scoped lang="scss">
  199. .productList .search {
  200. width: 100%;
  201. height: 86rpx;
  202. padding-left: 23rpx;
  203. box-sizing: border-box;
  204. position: fixed;
  205. left: 0;
  206. top: 0;
  207. z-index: 9;
  208. background-color: var(--view-theme);
  209. }
  210. .productList .search .input {
  211. width: 640rpx;
  212. height: 60rpx;
  213. background-color: #fff;
  214. border-radius: 50rpx;
  215. padding: 0 20rpx;
  216. box-sizing: border-box;
  217. }
  218. .productList .search .input input {
  219. width: 548rpx;
  220. height: 100%;
  221. font-size: 26rpx;
  222. }
  223. .productList .search .input .placeholder {
  224. color: #999;
  225. }
  226. .productList .search .input .iconfont {
  227. font-size: 35rpx;
  228. color: #555;
  229. }
  230. .productList .search .icon-pailie,
  231. .productList .search .icon-tupianpailie {
  232. color: #fff;
  233. width: 62rpx;
  234. font-size: 40rpx;
  235. height: 86rpx;
  236. line-height: 86rpx;
  237. }
  238. .productList .nav {
  239. height: 86rpx;
  240. color: #454545;
  241. position: fixed;
  242. left: 0;
  243. width: 100%;
  244. font-size: 28rpx;
  245. background-color: #fff;
  246. margin-top: 86rpx;
  247. top: 0;
  248. z-index: 9;
  249. }
  250. .productList .nav .item {
  251. width: 33%;
  252. text-align: center;
  253. &.font-num{
  254. font-weight: bold;
  255. }
  256. }
  257. .productList .nav .item image {
  258. width: 15rpx;
  259. height: 19rpx;
  260. margin-left: 10rpx;
  261. }
  262. .productList .list {
  263. padding: 0 20rpx 20rpx;
  264. margin-top: 172rpx;
  265. }
  266. .productList .list.on {
  267. background-color: #fff;
  268. border-top: 1px solid #f6f6f6;
  269. }
  270. .productList .list .item {
  271. width: 345rpx;
  272. margin-top: 20rpx;
  273. background-color: #fff;
  274. border-radius: 20rpx;
  275. }
  276. .productList .list .item.on {
  277. width: 100%;
  278. display: flex;
  279. border-bottom: 1rpx solid #f6f6f6;
  280. padding: 30rpx 0;
  281. margin: 0;
  282. }
  283. .productList .list .item .pictrue {
  284. position: relative;
  285. width: 100%;
  286. height: 345rpx;
  287. .sell_out {
  288. display: flex;
  289. width: 150rpx;
  290. height: 150rpx;
  291. align-items: center;
  292. justify-content: center;
  293. border-radius: 100%;
  294. background: rgba(0,0,0,.6);
  295. color: #fff;
  296. font-size: 30rpx;
  297. position: absolute;
  298. top: 50%;
  299. left: 50%;
  300. margin: -75rpx 0 0 -75rpx;
  301. &::before{
  302. content: "";
  303. display: block;
  304. width: 140rpx;
  305. height: 140rpx;
  306. border-radius: 100%;
  307. border: 1px dashed #fff;
  308. position: absolute;
  309. top: 5rpx;
  310. left: 5rpx;
  311. }
  312. &.on{
  313. width: 110rpx;
  314. height: 110rpx;
  315. margin: -55rpx 0 0 -55rpx;
  316. &::before{
  317. width: 100rpx;
  318. height: 100rpx;
  319. }
  320. }
  321. }
  322. }
  323. .productList .list .item .pictrue.on {
  324. width: 180rpx;
  325. height: 180rpx;
  326. }
  327. .productList .list .item .pictrue image {
  328. width: 100%;
  329. height: 100%;
  330. border-radius: 20rpx 20rpx 0 0;
  331. }
  332. .productList .list .item .pictrue image.on {
  333. border-radius: 6rpx;
  334. }
  335. .productList .list .item .text {
  336. padding: 20rpx 17rpx 26rpx 17rpx;
  337. font-size: 30rpx;
  338. color: #222;
  339. }
  340. .productList .list .item .text.on {
  341. width: 508rpx;
  342. padding: 0 0 0 22rpx;
  343. .name{
  344. height: 74rpx;
  345. }
  346. }
  347. .productList .list .item .text .money {
  348. font-size: 22rpx;
  349. margin-top: 8rpx;
  350. }
  351. .productList .list .item .text .money.on {
  352. margin-top: 50rpx;
  353. }
  354. .productList .list .item .text .money .num {
  355. font-size: 34rpx;
  356. }
  357. .productList .list .item .text .vip {
  358. font-size: 22rpx;
  359. margin-top: 20rpx;
  360. .sales {
  361. font-size: 22rpx;
  362. color: var(--view-theme);
  363. }
  364. }
  365. .productList .list .item .price-count{
  366. display: flex;
  367. margin-top: 8rpx;
  368. align-items: baseline;
  369. .price-box {
  370. font-size: 22rpx;
  371. color: var(--view-theme);
  372. text{
  373. font-size: 34rpx;
  374. }
  375. }
  376. .image{
  377. width: 26rpx;
  378. height: 26rpx;
  379. margin-right: 10rpx;
  380. border-radius: 0;
  381. }
  382. }
  383. .productList .list .item .exchange {
  384. font-size: 24rpx;
  385. margin-top: 18rpx;
  386. color: #737373;
  387. }
  388. .productList .list .item .text .vip.on {
  389. margin-top: 50rpx;
  390. display: flex;
  391. justify-content: space-between;
  392. }
  393. .productList .list .item .text .vip .vip-money {
  394. font-size: 24rpx;
  395. color: #282828;
  396. font-weight: bold;
  397. }
  398. .productList .list .item .text .vip .vip-money image {
  399. width: 56rpx;
  400. height: 20rpx;
  401. margin-left: 4rpx;
  402. }
  403. .noCommodity {
  404. background-color: #fff;
  405. padding-bottom: 30rpx;
  406. .emptyBox{
  407. text-align: center;
  408. margin-top: 40rpx;
  409. .tips{
  410. color: #aaa;
  411. font-size: 26rpx;
  412. }
  413. image {
  414. width: 414rpx;
  415. height: 304rpx;
  416. }
  417. }
  418. }
  419. </style>