index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020
  1. <template>
  2. <view :data-theme="theme">
  3. <view class='productList'>
  4. <view class='search bg_color acea-row row-between-wrapper'>
  5. <!-- #ifdef H5 -->
  6. <view class="iconfont icon-xiangzuo" @click="goback()"></view>
  7. <!-- #endif -->
  8. <view :class="tabIndex !== 2?'searchIpt':''" class='input acea-row row-middle'><text class='iconfont icon-sousuo mr20'></text>
  9. <input :placeholder="tabIndex===1?'搜索商品名称':'搜索店铺名称'" placeholder-class='placeholder' confirm-type='search' name="search"
  10. v-model="keyword" @confirm="searchSubmit" maxlength="20"></input>
  11. </view>
  12. <view v-if="tabIndex === 2" class='iconfont icon-shaixuan' @click='open(2)'></view>
  13. </view>
  14. <view class="nav-wrapper mr-20px" v-if="merId===0 && cid === 0">
  15. <view class="tab-bar" :class="{'merTab':tabIndex===2}">
  16. <view class="tab-item" :class="{on:tabIndex===1}" @click="changetab(1)">商品</view>
  17. <view class="tab-item" :class="{on:tabIndex===2}" @click="changetab(2)">店铺</view>
  18. </view>
  19. </view>
  20. <view v-if="tabIndex===1" class='nav acea-row row-middle flex-between-center' :class="(merId > 0 || cid > 0) ? 'mer-nav' : ''">
  21. <view class='item' :class='title ? "font_color":""' @click='set_where(1,tabIndex)'>
  22. {{title ? title:'默认'}}
  23. </view>
  24. <view class='item' @click='set_where(2,tabIndex)'>
  25. 价格
  26. <image v-if="price==1" :src='upPng'></image>
  27. <image v-else-if="price==2" :src='downPng'></image>
  28. <image v-else :src="urlDomain+'crmebimage/presets/horn.png'"></image>
  29. </view>
  30. <template v-if="!flowType">
  31. <view class='item-c item' @click='set_where(3,tabIndex)'>
  32. 销量
  33. <image v-if="stock==1" :src='upPng'></image>
  34. <image v-else-if="stock==2" :src='downPng'></image>
  35. <image v-else :src="urlDomain+'crmebimage/presets/horn.png'"></image>
  36. </view>
  37. <!-- down -->
  38. <view class="item-shu"></view>
  39. <view class='item-icon iconfont' :class="is_switch?'icon-pailie':'icon-tupianpailie'" @click='Changswitch()'>
  40. </view>
  41. </template>
  42. <view class='item' v-else>
  43. <view class="flex-center" @tap="showCateDrawer = !showCateDrawer">
  44. <text>{{'预览' + rangeArr[tabActive].name}}</text>
  45. <view class="w-76 h-100 flex-center topic-box">
  46. <text class="iconfont fs-24" :class="!showCateDrawer?'icon-xiala3':'icon-xiangshang2'"></text>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <!-- 话题分类下拉 -->
  52. <view class="fixed-lt w-full bg--w111-fff rd-b-24rpx z-100 pt-22" v-if="showCateDrawer"
  53. :style="{top: (86+86) + 'rpx'}">
  54. <view class="w-full pr-20 pb-30 pl-30">
  55. <view>
  56. <view :class="tabActive == item.id ? 'bg-color-good' : ''" v-for="(item, index) of rangeArr" :key="index"
  57. class="flex-between-center h-40 mb-20" @click="tabActiveClick(item)">
  58. 预览{{item.name}}
  59. <text v-if="tabActive == item.id" class="iconfont icon-gou"></text>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view :style="{top: (86+86) + 'rpx'}" class="mask z-80" v-if="showCateDrawer" @tap="()=>{showCateDrawer = false}"></view>
  65. <view v-if="tabIndex===1" :class="is_switch==true?'proList':'listBox'">
  66. <view :class="[(merId > 0 || cid > 0) ? 'mer-listBox' : '']" v-if="productList.length>0">
  67. <view v-if="!is_switch" class='list acea-row row-between-wrapper' :class="[is_switch==true ? '' : 'on', (merId > 0 || cid > 0) ? 'mer-list' : ''] ">
  68. <view class='item' :class='is_switch==true?"":"on"' hover-class='none' v-for="(item,index) in productList" :key="index"
  69. @click="godDetail(item)">
  70. <view class='pictrue' :class='is_switch==true?"":"on"'>
  71. <view v-show="item.stock===0" class="sellOut">已售罄</view>
  72. <easy-loadimage :image-src="item.image" :class='is_switch==true?"":"on"'>
  73. </easy-loadimage>
  74. <span class="pictrue_log_class" :class="is_switch === true ? 'pictrue_log_big' : 'pictrue_log'" v-if="item.activityH5 && item.activityH5.type === '1'">秒杀</span>
  75. <span class="pictrue_log_class" :class="is_switch === true ? 'pictrue_log_big' : 'pictrue_log'" v-if="item.activityH5 && item.activityH5.type === '2'">砍价</span>
  76. <span class="pictrue_log_class" :class="is_switch === true ? 'pictrue_log_big' : 'pictrue_log'" v-if="item.activityH5 && item.activityH5.type === '3'">拼团</span>
  77. </view>
  78. <view class='text' :class='is_switch==true?"":"on"'>
  79. <view class='name box-line2 mb-10'>
  80. <span v-if="item.productTags && item.productTags.locationLeftTitle.length" class="font-bg-red mr10 merType bg-color">{{item.productTags.locationLeftTitle[0].tagName}}</span>
  81. {{item.name}}
  82. </view>
  83. <!-- 价格 -->
  84. <svip-price :svipIconStyle="svipIconStyle" :productPrice="item" :svipPriceStyle="svipPriceStyle"></svip-price>
  85. <view v-if="item.productTags && item.productTags.locationUnderTitle.length">
  86. <text v-for="items in item.productTags.locationUnderTitle.length>3?item.productTags.locationUnderTitle.slice(0,3):item.productTags.locationUnderTitle"
  87. class="mr10 tagSolid">{{items.tagName}}</text>
  88. </view>
  89. <view class='vip acea-row row-between-wrapper mt-10 mb-10' :class='is_switch==true?"":"on"'>
  90. <view>已售{{item.sales}}{{item.unitName}}</view>
  91. </view>
  92. <view v-if="item.merName" class="company" @click.stop="goStore(item.merId)">
  93. <text class='name line1'>{{item.merName}}</text>
  94. <view class="flex">
  95. 进店
  96. <text class="iconfont icon-xiangyou"></text>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. <view v-else class="goods">
  103. <WaterfallsFlow :wfList='productList' :isDynamics="flowType" :userFair="flowType" :type="1">
  104. <template slot-scope="{item}">
  105. <WaterfallsFlowItem :item="item" :type="1" :isStore="1" />
  106. </template>
  107. </WaterfallsFlow>
  108. </view>
  109. </view>
  110. <view class='loadingicon acea-row row-center-wrapper'>
  111. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{productList.length>0?loadTitle:''}}
  112. </view>
  113. </view>
  114. <view class="merList" v-if="tabIndex == 2">
  115. <view v-if="merchantList.length===0" style="background-color: #F5F5F5;" class='nav acea-row row-middle' :class="(merId > 0 || cid > 0) ? 'mer-nav' : ''">
  116. </view>
  117. <merchant-list :merchantList="merchantList"></merchant-list>
  118. <view class='loadingicon acea-row row-center-wrapper'>
  119. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>
  120. </view>
  121. </view>
  122. </view>
  123. <view class='noCommodity' :class="{'mer-mt194': tabIndex ==2, 'mer-mt100': cid !== 0}" :style="{'top':!is_switch?'-110rpx':''}"
  124. v-if="(productList.length==0 && isShow && tabIndex===1 && !loading ) || (merchantList.length==0 && isShow && tabIndex===2 && !loading)">
  125. <view class='pictrue'>
  126. <image :src="urlDomain+'crmebimage/presets/noSearch.png'"></image>
  127. </view>
  128. <text class="text-ccc">{{tabIndex===1?'暂无商品~':'暂无店铺~'}}</text>
  129. <!--recommend v-if="!merId && !fairCateId" ref="recommendIndex" class="mt-40"></recommend>
  130. <recommend v-if="fairCateId" :dynamics="true" :tabActive="tabActive" ref="recommendIndex" class="mt-40"></recommend-->
  131. </view>
  132. <tui-drawer mode="right" :visible="rightDrawer" @close="closeDrawer">
  133. <merSeach :whereMer="whereMer" @close="closeDrawer" @confirm="confirm"></merSeach>
  134. </tui-drawer>
  135. </view>
  136. </template>
  137. <script>
  138. // +----------------------------------------------------------------------
  139. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  140. // +----------------------------------------------------------------------
  141. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  142. // +----------------------------------------------------------------------
  143. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  144. // +----------------------------------------------------------------------
  145. // | Author: CRMEB Team <admin@crmeb.com>
  146. // +----------------------------------------------------------------------
  147. import {
  148. productList,productActivityList
  149. } from '@/api/product.js';
  150. import {
  151. getMerSearchApi,
  152. getMerActivitySearchApi,
  153. getMerActivityProListApi,
  154. getMerProListApi,
  155. getSecondHandListApi
  156. } from '@/api/merchant.js';
  157. import {
  158. mapGetters
  159. } from "vuex";
  160. import {
  161. goProductDetail
  162. } from '@/libs/order.js'
  163. import merSeach from '../components/merSeach/index.vue'
  164. import merchantList from '@/components/merchantList/index.vue'
  165. import WaterfallsFlow from '@/components/WaterfallsFlow/WaterfallsFlow.vue'
  166. import tuiDrawer from '../components/tui-drawer/index.vue'
  167. import recommend from "@/components/base/recommend.vue";
  168. import easyLoadimage from '@/components/base/easy-loadimage.vue';
  169. import WaterfallsFlowItem from '@/components/WaterfallsFlowItem/WaterfallsFlowItem.vue'
  170. import svipPrice from '@/components/svipPrice.vue';
  171. let app = getApp();
  172. export default {
  173. computed: mapGetters(['uid']),
  174. components: {
  175. merchantList,
  176. merSeach,
  177. WaterfallsFlow,
  178. tuiDrawer,
  179. recommend,
  180. easyLoadimage,
  181. WaterfallsFlowItem,
  182. svipPrice
  183. },
  184. mounted() {
  185. this.$store.dispatch('MerCategoryList');
  186. this.$store.dispatch('MerTypeList');
  187. },
  188. data() {
  189. return {
  190. //普通价格
  191. svipPriceStyle: {
  192. svipBox: {
  193. height: '26rpx',
  194. borderRadius: '60rpx 56rpx 56rpx 20rpx',
  195. },
  196. icon: {
  197. height: '26rpx',
  198. fontSize: '18rpx',
  199. borderRadius: '12rpx 0 12rpx 2rpx'
  200. },
  201. price: {
  202. fontSize: '38rpx'
  203. },
  204. svipPrice: {
  205. fontSize: '22rpx'
  206. }
  207. },
  208. //svip价格
  209. svipIconStyle: {
  210. svipBox: {
  211. height: '26rpx',
  212. borderRadius: '24rpx 40rpx 40rpx 0.4rpx',
  213. },
  214. price: {
  215. fontSize: '38rpx'
  216. },
  217. svipPrice: {
  218. fontSize: '18rpx'
  219. }
  220. },
  221. urlDomain: this.$Cache.get("imgHost"),
  222. keyword: '',
  223. rangeArr: [
  224. {id: 0, range: 'school', name: '本校'},
  225. {id: 1, range: 'city', name: '同城'},
  226. {id: 2, range: 'all', name: '全国'},
  227. ],
  228. rangeStr: '',
  229. tabActive: null,
  230. flowType: false,
  231. drawers: 0,
  232. tabIndex: 1,
  233. productList: [],
  234. is_switch: true,
  235. where: {
  236. latitude: uni.getStorageSync('user_latitude'),
  237. longitude: uni.getStorageSync('user_longitude'),
  238. keyword: '',
  239. priceOrder: '',
  240. salesOrder: '',
  241. //news: 0,
  242. page: 1,
  243. limit: 20,
  244. cid: '', //商城使用
  245. merId: '',
  246. cids: '' //商户使用
  247. },
  248. cid: 0, //分类id
  249. price: 0,
  250. stock: 0,
  251. nows: false,
  252. loadend: false,
  253. loading: false,
  254. loadTitle: '加载更多',
  255. title: '',
  256. theme: app.globalData.theme,
  257. upPng: '',
  258. downPng: '',
  259. whereMer: {
  260. latitude: uni.getStorageSync('user_latitude'),
  261. longitude: uni.getStorageSync('user_longitude'),
  262. categoryIds: '',
  263. isSelf: '',
  264. keywords: '',
  265. page: 1,
  266. limit: 20,
  267. typeIds: ''
  268. },
  269. rightDrawer: false,
  270. merchantList: [],
  271. merId: 0,
  272. cateId: null,
  273. goodScroll: true,
  274. isShow: false,
  275. fairCateId: '',
  276. showCateDrawer: false,
  277. isActivity: false,
  278. };
  279. },
  280. // 滚动监听
  281. onPageScroll(e) {
  282. // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
  283. uni.$emit('scroll');
  284. },
  285. onLoad: function(options) {
  286. this.downPng = `${this.urlDomain}crmebimage/presets/down_red.png`;
  287. this.upPng = `${this.urlDomain}crmebimage/presets/up_red.png`;
  288. this.merId = options.merId ? Number(options.merId) : 0;
  289. this.cateId = options.cateId ? Number(options.cateId) : '';
  290. this.fairCateId = Number(options.fairCateId) || '';
  291. this.isActivity=options.isActivity;
  292. if (this.isActivity) {
  293. uni.setNavigationBarTitle({
  294. title: '精选商品'
  295. });
  296. }
  297. this.$set(this, 'cid', Number(options.cid) || 0);
  298. this.title = options.title || '';
  299. if (this.fairCateId) {
  300. this.cid = 9999999999
  301. this.flowType = true
  302. this.$set(this, 'rangeStr', options.rangeStr || '');
  303. this.$set(this, 'tabActive', +options.tabActive);
  304. uni.setNavigationBarTitle({
  305. title: '二手交易'
  306. });
  307. }
  308. this.$set(this, 'keyword', options.searchValue || '');
  309. if (this.tabIndex === 1) this.get_product_list();
  310. switch (this.theme) {
  311. case 'theme2':
  312. this.upPng = `${this.urlDomain}crmebimage/presets/up_orange.png`;
  313. this.downPng = `${this.urlDomain}crmebimage/presets/down_orange.png`;
  314. break;
  315. case 'theme3':
  316. this.upPng = `${this.urlDomain}crmebimage/presets/up_green.png`;
  317. this.downPng = `${this.urlDomain}crmebimage/presets/down_green.png`;
  318. break;
  319. case 'theme4':
  320. this.upPng = `${this.urlDomain}crmebimage/presets/up_blue.png`;
  321. this.downPng = `${this.urlDomain}crmebimage/presets/down_blue.png`;
  322. break;
  323. case 'theme5':
  324. this.upPng = `${this.urlDomain}crmebimage/presets/up_pink.png`;
  325. this.downPng = `${this.urlDomain}crmebimage/presets/down_pink.png`;
  326. break;
  327. default:
  328. this.upPng = `${this.urlDomain}crmebimage/presets/up_red.png`;
  329. this.downPng = `${this.urlDomain}crmebimage/presets/down_red.png`;
  330. break;
  331. }
  332. console.log(this.productList, this.isShow, this.tabIndex, this.loading)
  333. },
  334. methods: {
  335. tabActiveClick(item) {
  336. this.tabActive = item.id;
  337. this.rangeStr = item.range;
  338. this.showCateDrawer = false;
  339. this.where.page = 1;
  340. this.loadend = false;
  341. this.loading = false;
  342. this.get_product_list(true);
  343. },
  344. goStore(id) {
  345. uni.navigateTo({
  346. url: `/pages/merchant/home/index?merId=${id}`
  347. })
  348. },
  349. confirm(data) {
  350. this.whereMer.typeIds = data.typeId;
  351. this.whereMer.categoryIds = data.categoryId;
  352. this.whereMer.keywords = this.where.keyword;
  353. this.loadend = false;
  354. this.$set(this.whereMer, 'page', 1)
  355. this.merchantList = [];
  356. this.rightDrawer = false
  357. this.getMerStreet();
  358. },
  359. changetab(n) {
  360. this.tabIndex = n;
  361. this.nows = 1;
  362. this.stock = 0;
  363. this.loadend = false;
  364. this.loading = false;
  365. if (n === 2) {
  366. this.merchantList = [];
  367. this.$set(this.whereMer, 'page', 1);
  368. this.getMerStreet();
  369. this.title = '';
  370. } else {
  371. this.whereMer.typeIds = '';
  372. this.whereMer.categoryIds = '';
  373. this.productList = [];
  374. this.$set(this.where, 'page', 1);
  375. this.get_product_list();
  376. }
  377. },
  378. open(n) {
  379. if (this.tabIndex === 2) {
  380. this.rightDrawer = true;
  381. this.drawers = n;
  382. }
  383. },
  384. closeDrawer(e) {
  385. this.rightDrawer = false
  386. if (!e) {
  387. this.rightDrawer = false
  388. }
  389. },
  390. goback() {
  391. // #ifdef H5
  392. return history.back();
  393. // #endif
  394. // #ifndef H5
  395. return uni.navigateBack({
  396. delta: 1,
  397. })
  398. // #endif
  399. },
  400. getMerStreet: function(isPage) {
  401. this.skeletonShow = true
  402. let that = this;
  403. that.setWhere();
  404. if (that.loadend) return;
  405. if (that.loading) return;
  406. that.loading = true;
  407. if (isPage === true) that.$set(that, 'merchantList', []);
  408. that.loadTitle = '';
  409. that.whereMer.keywords = encodeURIComponent(that.keyword);
  410. that.cateId ? that.whereMer.productType = that.cateId : '';
  411. let merchantSearchApi=this.isActivity?getMerActivitySearchApi:getMerSearchApi;
  412. merchantSearchApi(that.whereMer).then(res => {
  413. let list = res.data.list;
  414. let merchantList = that.$util.SplitArray(list, that.merchantList);
  415. let loadend = list.length < that.whereMer.limit;
  416. that.loadend = loadend;
  417. that.loadTitle = loadend ? '没有了' : '加载更多';
  418. that.$set(that, 'merchantList', merchantList);
  419. that.$set(that.whereMer, 'page', that.whereMer.page + 1);
  420. that.loading = false;
  421. this.skeletonShow = false;
  422. this.isShow = true
  423. }).catch(err => {
  424. that.loading = false;
  425. that.goodScroll = false;
  426. that.loadTitle = '加载更多';
  427. });
  428. },
  429. // 去详情页
  430. godDetail(item) {
  431. goProductDetail(item.id, 0, '');
  432. },
  433. Changswitch: function() {
  434. let that = this;
  435. that.is_switch = !that.is_switch
  436. },
  437. searchSubmit: function(e) {
  438. let that = this;
  439. that.loadend = false;
  440. that.$set(that, 'keyword', e.detail.value || '');
  441. if (that.tabIndex === 1) {
  442. that.$set(that.where, 'page', 1)
  443. this.get_product_list(true);
  444. } else {
  445. that.$set(that, 'merchantList', []);
  446. this.$set(this.whereMer, 'page', 1)
  447. this.getMerStreet();
  448. }
  449. },
  450. //点击事件处理
  451. set_where: function(e, n) {
  452. switch (e) {
  453. case 1:
  454. this.price = 0;
  455. this.stock = 0;
  456. break;
  457. case 2:
  458. if (this.price == 0) this.price = 1;
  459. else if (this.price == 1) this.price = 2;
  460. else if (this.price == 2) this.price = 0;
  461. this.stock = 0;
  462. break;
  463. case 3:
  464. if (this.stock == 0) this.stock = 1;
  465. else if (this.stock == 1) this.stock = 2;
  466. else if (this.stock == 2) this.stock = 0;
  467. this.price = 0
  468. break;
  469. case 4:
  470. this.price = 0;
  471. this.stock = 0;
  472. break;
  473. }
  474. if (n === 1) {
  475. this.loadend = false;
  476. this.$set(this.where, 'page', 1);
  477. this.get_product_list(true);
  478. } else {
  479. this.nows = 1;
  480. }
  481. },
  482. //设置where条件
  483. setWhere: function() {
  484. if (this.price == 0) this.where.priceOrder = '';
  485. else if (this.price == 1) this.where.priceOrder = 'asc';
  486. else if (this.price == 2) this.where.priceOrder = 'desc';
  487. if (this.stock == 0) this.where.salesOrder = '';
  488. else if (this.stock == 1) this.where.salesOrder = 'asc';
  489. else if (this.stock == 2) this.where.salesOrder = 'desc';
  490. //this.where.news = this.nows ? 1 : 0;
  491. },
  492. //查找产品
  493. get_product_list: function(isPage) {
  494. let that = this;
  495. that.setWhere();
  496. if (that.loadend) return;
  497. if (that.loading) return;
  498. if (isPage === true) that.$set(that, 'productList', []);
  499. that.loading = true;
  500. that.loadTitle = '';
  501. if (this.merId > 0) that.where.merId = that.merId
  502. that.where.keyword = encodeURIComponent(that.keyword);
  503. that.cateId ? that.where.productType = that.cateId : '';
  504. if (that.cid === 0) {
  505. that.where.cid = '';
  506. that.where.cids = '';
  507. } else {
  508. if (this.merId > 0) {
  509. that.where.cids = that.cid
  510. that.where.cid = '';
  511. } else {
  512. that.where.cid = that.cid;
  513. that.where.cids = ''
  514. }
  515. }
  516. if (this.fairCateId) {
  517. that.where.range = this.rangeStr
  518. if (that.where.range == 'city') {
  519. that.where.city = uni.getStorageSync('cityName')
  520. }
  521. that.where.categoryId = this.fairCateId
  522. console.log(this.where)
  523. getSecondHandListApi(that.where).then(res => {
  524. let list = res.data.list;
  525. let productList = that.$util.SplitArray(list, that.productList);
  526. let loadend = list.length < that.where.limit;
  527. that.loadend = loadend;
  528. that.loading = false;
  529. that.loadTitle = loadend ? '已全部加载' : '加载更多';
  530. that.$set(that, 'productList', productList);
  531. that.$set(that.where, 'page', that.where.page + 1);
  532. this.isShow = true
  533. }).catch(err => {
  534. that.loading = false;
  535. that.loadTitle = '加载更多'
  536. })
  537. } else {
  538. let productApi=this.isActivity?productActivityList:productList;
  539. let merchantProductApi=this.isActivity?getMerActivityProListApi:getMerProListApi;
  540. this.merId === 0 ?productApi(that.where).then(res => {
  541. let list = res.data.list;
  542. let productList = that.$util.SplitArray(list, that.productList);
  543. let loadend = list.length < that.where.limit;
  544. that.loadend = loadend;
  545. that.loading = false;
  546. that.loadTitle = loadend ? '已全部加载' : '加载更多';
  547. that.$set(that, 'productList', productList);
  548. that.$set(that.where, 'page', that.where.page + 1);
  549. this.isShow = true
  550. }).catch(err => {
  551. that.loading = false;
  552. that.loadTitle = '加载更多'
  553. }) : merchantProductApi(that.where).then(res => {
  554. let list = res.data.list;
  555. let productList = that.$util.SplitArray(list, that.productList);
  556. let loadend = list.length < that.where.limit;
  557. that.loadend = loadend;
  558. that.loading = false;
  559. that.loadTitle = loadend ? '已全部加载' : '加载更多';
  560. that.$set(that, 'productList', productList);
  561. that.$set(that.where, 'page', that.where.page + 1);
  562. this.isShow = true
  563. }).catch(err => {
  564. that.loading = false;
  565. that.loadTitle = '加载更多'
  566. })
  567. }
  568. },
  569. },
  570. onReachBottom() {
  571. console.log(1111111111111111)
  572. if (this.tabIndex === 2) {
  573. this.getMerStreet();
  574. }
  575. if (this.productList.length > 0) {
  576. this.get_product_list();
  577. }
  578. if ((this.productList.length == 0 && this.isShow && this.tabIndex === 1 && !this.loading) || (this.merchantList
  579. .length == 0 && this.isShow && this.tabIndex === 2 && !this.loading)) {
  580. this.$refs.recommendIndex.get_host_product();
  581. }
  582. }
  583. }
  584. </script>
  585. <style>
  586. body {
  587. height: auto !important;
  588. }
  589. </style>
  590. <style scoped lang="scss">
  591. .mt80 {
  592. margin-top: 80rpx;
  593. }
  594. .searchIpt {
  595. /* #ifdef H5 */
  596. width: 91% !important;
  597. /* #endif */
  598. /* #ifndef H5 */
  599. width: 100% !important;
  600. /* #endif */
  601. }
  602. .store-item .merTab {
  603. height: auto !important;
  604. .tab-item {
  605. margin-top: 8rpx !important;
  606. }
  607. }
  608. .text-ccc {
  609. text-align: center;
  610. display: block;
  611. }
  612. .company {
  613. display: flex;
  614. align-items: center;
  615. color: #737373 !important;
  616. font-size: 26rpx;
  617. .name {
  618. display: inline-block;
  619. // width: 120rpx;
  620. height: auto !important;
  621. overflow: hidden;
  622. white-space: nowrap;
  623. text-overflow: ellipsis;
  624. }
  625. .flex {
  626. display: flex;
  627. align-items: center;
  628. margin-left: 10rpx;
  629. color: #282828 !important;
  630. width: 100rpx;
  631. .iconfont {
  632. font-size: 16rpx;
  633. margin-top: 4rpx;
  634. }
  635. }
  636. }
  637. .icon-xiangzuo {
  638. color: #fff;
  639. }
  640. .goods {
  641. display: flex;
  642. flex-wrap: wrap;
  643. justify-content: space-between;
  644. padding-left: 24rpx;
  645. background-color: #F5F5F5;
  646. width: 100%;
  647. }
  648. .proList {
  649. margin-top: 256rpx;
  650. }
  651. .merList {
  652. position: relative;
  653. top: 154rpx;
  654. z-index: 66;
  655. }
  656. .merBox {
  657. /deep/.tui-drawer-container {
  658. width: 635rpx;
  659. }
  660. }
  661. .mer {
  662. &-nav {
  663. top: 80rpx !important;
  664. border-radius: inherit !important;
  665. }
  666. &-list {
  667. margin-top: 248rpx !important;
  668. }
  669. &-listBox {
  670. position: relative;
  671. top: -68rpx;
  672. }
  673. &-mt194 {
  674. margin-top: 260rpx !important;
  675. }
  676. &-mt100 {
  677. top: -200rpx !important;
  678. }
  679. }
  680. .no-shop {
  681. margin-top: 6rpx;
  682. background-color: #fff;
  683. padding-bottom: calc(100% - 109rpx);
  684. .pictrue {
  685. display: flex;
  686. flex-direction: column;
  687. align-items: center;
  688. //color: $uni-nothing-text;
  689. image {
  690. width: 414rpx;
  691. height: 380rpx;
  692. }
  693. }
  694. }
  695. .with50 {
  696. width: 50% !important;
  697. }
  698. .nav-wrapper {
  699. z-index: 9;
  700. position: fixed;
  701. left: 0;
  702. top: 86rpx;
  703. width: 100%;
  704. @include main_bg_color(theme);
  705. .tab-bar {
  706. display: flex;
  707. align-items: center;
  708. height: 131rpx;
  709. .tab-item {
  710. position: relative;
  711. flex: 1;
  712. display: flex;
  713. justify-content: center;
  714. align-items: center;
  715. padding-bottom: 40rpx;
  716. color: #fff;
  717. font-size: 28rpx;
  718. font-weight: bold;
  719. margin-top: -36rpx;
  720. &::after {
  721. content: ' ';
  722. position: absolute;
  723. left: 50%;
  724. bottom: 34rpx;
  725. width: 60rpx;
  726. height: 3rpx;
  727. background: transparent;
  728. transform: translateX(-50%);
  729. }
  730. &.on {
  731. &::after {
  732. background: #fff;
  733. }
  734. }
  735. }
  736. }
  737. }
  738. .bg_color {
  739. @include main_bg_color(theme);
  740. }
  741. .font_color {
  742. @include main_color(theme);
  743. }
  744. .x-money {
  745. font-size: 38rpx;
  746. font-weight: 900;
  747. @include price_color(theme);
  748. }
  749. .iconfont {
  750. //color: #fff;
  751. }
  752. .listBox {
  753. margin-top: 240rpx !important;
  754. background-color: #FFFFFF;
  755. }
  756. .fixed-top {
  757. position: fixed;
  758. top: 0;
  759. left: 0;
  760. z-index: 9;
  761. }
  762. .productList .search {
  763. width: 100%;
  764. height: 86rpx;
  765. padding: 0 30rpx;
  766. box-sizing: border-box;
  767. position: fixed;
  768. top: 0 !important;
  769. left: 0;
  770. z-index: 666;
  771. color: #fff;
  772. }
  773. .productList .search .input {
  774. width: 570rpx;
  775. height: 60rpx;
  776. background-color: #fff;
  777. border-radius: 50rpx;
  778. padding: 0 20rpx;
  779. box-sizing: border-box;
  780. color: #333;
  781. }
  782. .productList .search .input input {
  783. width: 88%;
  784. height: 100%;
  785. font-size: 26rpx;
  786. }
  787. .productList .search .input .placeholder {
  788. color: #CCCCCC;
  789. }
  790. .productList .search .input .iconfont {
  791. font-size: 26rpx;
  792. color: #999999;
  793. }
  794. .productList .search .icon-yangshi1,
  795. .icon-shaixuan {
  796. color: #fff;
  797. width: 62rpx;
  798. font-size: 40rpx;
  799. height: 86rpx;
  800. line-height: 86rpx;
  801. text-align: right;
  802. }
  803. .productList .nav {
  804. height: 86rpx;
  805. color: #454545;
  806. position: fixed;
  807. left: 0;
  808. width: 100%;
  809. font-size: 28rpx;
  810. background-color: #fff;
  811. top: 154rpx;
  812. z-index: 9;
  813. border-radius: 16rpx 16rpx 0rpx 0rpx;
  814. padding-left: 20rpx;
  815. }
  816. .productList .nav .item {
  817. width: 30%;
  818. text-align: center;
  819. .iconfont {
  820. //color: #fff;
  821. }
  822. }
  823. .item-c {
  824. width: 27% !important;
  825. }
  826. .item-icon {
  827. width: 8%;
  828. margin-left: 30rpx;
  829. }
  830. .item-shu {
  831. width: 1px;
  832. height: 12px;
  833. background: #666666;
  834. opacity: 0.2;
  835. }
  836. .productList .nav .item.font-color {
  837. font-weight: bold;
  838. }
  839. .productList .nav .item image {
  840. width: 15rpx;
  841. height: 19rpx;
  842. margin-left: 10rpx;
  843. }
  844. .productList .list.on {
  845. padding-top: 30rpx !important;
  846. background-color: #fff;
  847. border-top: 1px solid #F5F5F5;
  848. }
  849. .productList .list .item {
  850. width: 335rpx;
  851. background-color: #fff;
  852. border-radius: 14rpx;
  853. margin-bottom: 20rpx;
  854. }
  855. .productList .list .item.on {
  856. width: 100%;
  857. display: flex;
  858. padding: 0 24rpx 60rpx 24rpx;
  859. margin: 0;
  860. border-radius: 14rpx;
  861. }
  862. .productList .list .item .pictrue {
  863. position: relative;
  864. // width: 100%;
  865. }
  866. .productList .list .item .pictrue /deep/.easy-loadimage {
  867. width: 240rpx;
  868. height: 240rpx;
  869. border-radius: 14rpx;
  870. overflow: hidden;
  871. }
  872. .productList .list .item .pictrue image {
  873. width: 100%;
  874. height: 100%;
  875. border-radius: 20rpx 20rpx 0 0;
  876. overflow: hidden;
  877. }
  878. .productList .list .item .pictrue image.on {
  879. border-radius: 6rpx;
  880. }
  881. .productList .list .item .text {
  882. padding: 18rpx 20rpx;
  883. font-size: 30rpx;
  884. color: #222;
  885. }
  886. .productList .list .item .text.on {
  887. width: 456rpx;
  888. padding: 0 0 0 20rpx;
  889. position: relative;
  890. &::after {
  891. content: '';
  892. display: block;
  893. width: 94%;
  894. border-bottom: 1rpx solid #f6f6f6;
  895. position: absolute;
  896. right: 2rpx;
  897. bottom: -24rpx;
  898. }
  899. .name {
  900. height: 84rpx;
  901. line-height: 42rpx;
  902. }
  903. }
  904. .productList .list .item .text .money {
  905. font-size: 26rpx;
  906. font-weight: bold;
  907. margin-top: 8rpx;
  908. }
  909. .productList .list .item .text .money.on {
  910. margin-top: 50rpx;
  911. }
  912. .productList .list .item .text .money .num {
  913. font-size: 34rpx;
  914. }
  915. .productList .list .item .text .vip {
  916. font-size: 20rpx;
  917. color: #aaa;
  918. }
  919. .productList .list .item .text .vip .vip-money {
  920. font-size: 24rpx;
  921. color: #282828;
  922. font-weight: bold;
  923. }
  924. .productList .list .item .text .vip .vip-money image {
  925. width: 46rpx;
  926. height: 21rpx;
  927. margin-left: 4rpx;
  928. }
  929. .row-between-wrapper .input {
  930. height: 60rpx;
  931. margin: 10rpx 0 16rpx;
  932. }
  933. .box-line2 {
  934. overflow: hidden;
  935. }
  936. .mask {
  937. opacity: .5;
  938. position: fixed;
  939. inset: 0px;
  940. background-color: rgba(0, 0, 0, 0.4);
  941. transition: opacity 300ms ease 0ms, -webkit-transform 300ms ease 0ms, transform 300ms ease 0ms;
  942. transform-origin: 50% 50%;
  943. }
  944. .bg-color-good {
  945. color: $bg-color-primary;
  946. }
  947. </style>