index.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359
  1. <template>
  2. <view :style="viewColor">
  3. <view class='productList'>
  4. <view class='search acea-row row-between-wrapper'>
  5. <view class="back" @click='set_where(1)'>
  6. <view class="iconfont icon-xiangzuo"></view>
  7. </view>
  8. <view class='input acea-row row-between-wrapper'><text class='iconfont icon-sousuo'></text>
  9. <input placeholder='搜索商品名称' placeholder-class='placeholder' confirm-type='search' name="search" :value='where.keyword'
  10. @confirm="searchSubmit" @input="inputChange"></input>
  11. </view>
  12. <view style="text-align: right;" v-if="tabIndex==1" class='iconfont' :class='is_switch==true?"icon-pailie":"icon-tupianpailie"'
  13. @click='Changswitch'></view>
  14. <view v-else-if="mer_location == 1" style="text-align: right;" class='iconfont icon-dingwei' @click="showMaoLocation(latitude,longitude)"></view>
  15. </view>
  16. <view class="nav-wrapper">
  17. <view v-if="hide_mer_status == 0" class="tab-bar">
  18. <view class="tab-item" :class="{on:tabIndex==1}" @click="tabIndex = 1">商品</view>
  19. <view class="tab-item" :class="{on:tabIndex==2}" @click="tabIndex = 2">店铺</view>
  20. </view>
  21. <block v-if="tabIndex==1">
  22. <view class='nav acea-row row-middle'>
  23. <view class='item' @click="downStatus = !downStatus" :class="{'t-color':downKey>0 && firstKey == 0}">
  24. {{downMenu[downKey].title}}
  25. <text v-if="!downStatus" class="iconfont icon-xiala1 spin"></text>
  26. <text v-else class="iconfont icon-xiala1"></text>
  27. </view>
  28. <view class='item' :class="{'t-color': where.order=='sales'}" @click='set_where(3)'>
  29. 销量
  30. </view>
  31. <view class='item' :class="{'t-color': where.order=='price_desc'}" @click='set_where(2)'>
  32. 价格
  33. <image v-if="price==1" :src="domain+'/static/diy/up'+keyColor+'.png'"></image>
  34. <image v-else-if="price==2" :src="domain+'/static/diy/down'+keyColor+'.png'"></image>
  35. <image v-else src='/static/images/horn.png'></image>
  36. </view>
  37. <!-- down -->
  38. <view class='item' @click='bindRight'>
  39. 筛选
  40. <text class="iconfont icon-shaixuan"></text>
  41. </view>
  42. </view>
  43. </block>
  44. <block v-if="tabIndex==2">
  45. <view class='nav acea-row row-middle'>
  46. <view class='item' v-for="item in shopTab" :key="item.key" :class=" {'t-color':storeKey==item.key}" @click="storeTab(item.key)">
  47. {{item.title}}
  48. </view>
  49. <view class="item" :class="{'t-colors':firstKey == 4}" @click="bindRight2">
  50. <view>筛选
  51. <text class="iconfont icon-shaixuan"></text>
  52. </view>
  53. <view class="line" :class="{'font-line':firstKey == 4}">
  54. </view>
  55. </view>
  56. </view>
  57. </block>
  58. </view>
  59. <!-- 商品 -->
  60. <block v-if="tabIndex == 1">
  61. <view class='list acea-row row-between-wrapper on' v-if="!is_switch">
  62. <view class='item on' v-for="(item,index) in productList" :key="index"
  63. @click="godDetail(item)">
  64. <view class='pictrue on'>
  65. <image :src='item.image' class="on"></image>
  66. </view>
  67. <view class='text on acea-row row-between-wrapper'>
  68. <view class='name'>
  69. <text class="name_text line2">{{item.store_name}}</text>
  70. </view>
  71. <view class="item_bot">
  72. <view class='money on'>
  73. ¥<text class='num'>{{item.price}}</text>
  74. </view>
  75. <view class="item_tags acea-row">
  76. <text v-if="item.merchant.type_name && item.product_type == 0" class="font-bg-red bt-color line1">{{item.merchant.type_name}}</text>
  77. <text v-else-if="item.merchant.is_trader && item.product_type == 0" class="font-bg-red bt-color line1">自营</text>
  78. <text v-if="item.product_type != 0" :class="'font_bg-red bt-color type'+item.product_type">{{item.product_type == 1 ? "秒杀" : item.product_type == 2 ? "预售" : item.product_type == 3 ? "助力" : item.product_type == 4 ? "拼团" : ""}}</text>
  79. <text class="tags_item ticket" v-if="item.issetCoupon">领券</text>
  80. <text class="tags_item delivery" v-if="item.delivery_free == 1">包邮</text>
  81. <!-- <view class="ticket-big" v-if="!is_switch && item.issetCoupon">领券满{{item.issetCoupon.use_min_price}}减{{item.issetCoupon.coupon_price}}</view> -->
  82. </view>
  83. <view class="score">{{item.rate}}评分 {{item.reply_count}}条评论</view>
  84. <view class="company" v-if="item.merchant && hide_mer_status==0">
  85. <text class='name line1'>{{item.merchant.mer_name}}</text>
  86. <view class="flex" v-if="item.merchant" @click.stop="goStore(item.merchant.mer_id)">
  87. 进店
  88. <text class="iconfont icon-xiangyou"></text>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. <!-- 返佣 -->
  94. <block v-if="item.max_extension && (item.product_type == 2 || item.product_type == 0)">
  95. <view class="foot-bar on">
  96. <text class="iconfont icon-fenxiang" v-if="is_switch==true"></text>
  97. <text class="line1">最高赚 ¥{{item.max_extension}}</text>
  98. </view>
  99. </block>
  100. </view>
  101. <view class='loadingicon acea-row row-center-wrapper' v-if='productList.length > 0'>
  102. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  103. </view>
  104. </view>
  105. <view v-else class="list">
  106. <WaterfallsFlow :wfList='productList' :isStore="hide_mer_status" @itemTap="godDetail" :type="1" @goShop="goStore"/>
  107. <view class='loadingicon acea-row row-center-wrapper' v-if='productList.length > 0'>
  108. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  109. </view>
  110. </view>
  111. <view class='noCommodity' v-if="productList.length==0 && !loading">
  112. <view class='pictrue' style="margin: 0 auto;">
  113. <image src='/static/images/noCart.png'></image>
  114. <text>暂无商品,快去搜索其他商品吧</text>
  115. </view>
  116. <recommend :hostProduct="hostProduct" :isLogin="isLogin"></recommend>
  117. </view>
  118. </block>
  119. <!-- 店铺 -->
  120. <block v-if="tabIndex == 2">
  121. <view v-if="storeList.length" class="store-wrapper">
  122. <view class="store-item" v-for="(item,index) in storeList" :key="index">
  123. <view class="head">
  124. <view class="left-wrapper">
  125. <view class="logo">
  126. <image :src="item.mer_avatar" mode=""></image>
  127. </view>
  128. <view class="con-box">
  129. <view class="name acea-row row-between-wrapper line1">
  130. <text class="mer_name line1">{{item.mer_name}}</text>
  131. <text v-if="item.type_name" class="font-bg-red bt-color">{{item.type_name}}</text>
  132. <text v-else-if="item.is_trader" class="font-bg-red bt-color">自营</text>
  133. </view>
  134. <view class="star-box">
  135. <view class="star">
  136. <view class="star-active" :style="'width:'+item.allScore+'%'"></view>
  137. </view>
  138. <view class="num">{{item.product_score}}</view>
  139. <view class="line" v-if="item.distance"></view>
  140. <view class="distance" v-if="item.distance" @click="showMaoLocation(item.lat,item.long)">{{item.distance}}
  141. <view class="iconfont icon-xiangyou"></view>
  142. </view>
  143. </view>
  144. </view>
  145. </view>
  146. <view class="link" @click="goStore(item.mer_id)">进店</view>
  147. </view>
  148. <view class="pic-wrapper">
  149. <view class="pic-item" v-for="(goods,index) in item.recommend" :key="index">
  150. <navigator :url="`/pages/goods_details/index?id=${goods.product_id}`">
  151. <image :src="goods.image" mode=""></image>
  152. <view class="price">
  153. <text>¥</text>{{goods.price}}
  154. </view>
  155. </navigator>
  156. </view>
  157. </view>
  158. </view>
  159. <view class='loadingicon acea-row row-center-wrapper' v-if='loading'>
  160. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  161. </view>
  162. </view>
  163. <view class='no-shop' v-if="!storeList.length && !loading">
  164. <view class='pictrue' style="margin: 0 auto;">
  165. <image src='/static/images/no-Cart.png'></image>
  166. <text>暂无店铺,快去搜索其他店铺吧</text>
  167. </view>
  168. </view>
  169. </block>
  170. <rightSlider1 v-if="rightBox" :status="rightBox" :brandList="brandList" :price_on="where.price_on" :price_off="where.price_off"
  171. @confirm="confirm" @close="close"></rightSlider1>
  172. </view>
  173. <view class="down-wrapper" v-if="downStatus">
  174. <view class="bg"></view>
  175. <view class="down-box">
  176. <view class="down-item" v-for="(item,index) in downMenu" :key="item.key" :class="{'on':index == downKey}" @click="bindDown(item,index)">
  177. {{item.title}}
  178. <text v-if="index == downKey" class="iconfont icon-gou"></text>
  179. </view>
  180. </view>
  181. </view>
  182. <rightSlider2 v-if="rightBox2" :status="rightBox2" :merList="merList" :storeTypeArr="storeTypeArr" @confirm="confirm2" @close="close"></rightSlider2>
  183. <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
  184. <!-- #ifndef H5 -->
  185. <passwordPopup></passwordPopup>
  186. <!-- #endif -->
  187. </view>
  188. </template>
  189. <script>
  190. import {
  191. getProductslist,
  192. getProductHot,
  193. getBrandlist,
  194. storeMerchantList,
  195. getGeocoder
  196. } from '@/api/store.js';
  197. import {openBargainSubscribe} from '@/utils/SubscribeMessage.js';
  198. import {initiateAssistApi} from '@/api/activity.js';
  199. import recommend from '@/components/recommend';
  200. import rightSlider1 from '@/components/rightSlider.vue';
  201. import rightSlider2 from '@/components/rightSlider/index';
  202. import WaterfallsFlow from '@/components/WaterfallsFlow/WaterfallsFlow.vue'
  203. import { merClassifly, getStoreTypeApi } from '@/api/store.js';
  204. import { configMap } from "@/utils";
  205. import { mapGetters } from "vuex";
  206. // #ifndef H5
  207. import passwordPopup from '@/components/passwordPopup';
  208. // #endif
  209. import authorize from '@/components/Authorize';
  210. import { HTTP_REQUEST_URL } from '@/config/app';
  211. import {
  212. goShopDetail
  213. } from '@/libs/order.js'
  214. import {
  215. getconfig,
  216. } from '@/api/public.js';
  217. const app = getApp();
  218. export default {
  219. components: {
  220. recommend,
  221. rightSlider1,
  222. rightSlider2,
  223. WaterfallsFlow,
  224. // #ifndef H5
  225. passwordPopup,
  226. // #endif
  227. authorize,
  228. },
  229. watch: {
  230. tabIndex(nVal, oVal) {
  231. if (nVal == 1) {
  232. this.loadend = false;
  233. this.$set(this.where, 'page', 1)
  234. this.get_product_list(true);
  235. } else {
  236. console.log('222')
  237. this.downStatus = false
  238. this.storeScroll = true
  239. this.storeMerchantList('tab')
  240. }
  241. }
  242. },
  243. data() {
  244. return {
  245. domain: HTTP_REQUEST_URL,
  246. productList: [],
  247. is_switch: true,
  248. where: {
  249. cate_id: '',
  250. order: '',
  251. price_on: '',
  252. price_off: '',
  253. brand_id: '',
  254. keyword: '',
  255. is_trader: '',
  256. page: 1,
  257. limit: 30
  258. },
  259. shopTabs: [{
  260. title: '默认',
  261. key: 0,
  262. order: ""
  263. },
  264. {
  265. title: '销量',
  266. key: 1,
  267. order: 'sales'
  268. },
  269. {
  270. title: '好评',
  271. key: 2,
  272. order: 'rate'
  273. },
  274. {
  275. title: '距离',
  276. key: 3,
  277. order: 'location'
  278. }
  279. ],
  280. price: 0,
  281. stock: 0,
  282. nows: false,
  283. loadend: false,
  284. loading: false,
  285. loadTitle: '加载更多',
  286. title: '',
  287. hostProduct: [],
  288. hotPage: 1,
  289. hotLimit: 10,
  290. hotScroll: false,
  291. // 筛选框
  292. rightBox: false,
  293. rightBox2: false,
  294. //品牌列表
  295. brandList: [],
  296. downKey: 0,
  297. downStatus: false,
  298. // 下拉菜单
  299. downMenu: [{
  300. title: '综合',
  301. key: 1,
  302. },
  303. {
  304. title: '评分',
  305. key: 2,
  306. },
  307. {
  308. title: '新品',
  309. key: 3,
  310. }
  311. ],
  312. // 是否第一个
  313. firstKey: 0,
  314. // tab切换
  315. tabIndex: 1,
  316. // 商铺列表
  317. storeList: [],
  318. sotreParam: {
  319. keyword: '',
  320. page: 1,
  321. limit: 10,
  322. order: '',
  323. category_id : '',
  324. type_id: ''
  325. },
  326. storeKey: 0,
  327. storeScroll: true,
  328. detaile_address: "", //详细地址
  329. recommend_address: "", //当前地点
  330. latitude: "",
  331. longitude: "",
  332. mer_location: 0,
  333. count: 0, //店铺总条数
  334. isAuto: false, //没有授权的不会自动授权
  335. isShowAuth: false, //是否隐藏授权
  336. storeTypeArr: [], //店铺类型
  337. merList: [], //商户分类
  338. };
  339. },
  340. onLoad: function(options) {
  341. console.log(this.isLogin)
  342. this.$set(this.where, 'cate_id', options.id || '');
  343. this.title = options.title || '';
  344. this.$set(this.where, 'keyword', options.searchValue || '');
  345. this.get_product_list();
  346. this.get_host_product();
  347. this.getClassfication();
  348. this.getStoreType();
  349. },
  350. onReady() {
  351. },
  352. mounted() {
  353. uni.getStorage({
  354. key: 'GLOBAL_DATA',
  355. success: (res) => {
  356. console.log(res);
  357. if (res.data.mer_location == 1) {
  358. this.mer_location = res.data.mer_location
  359. this.selfLocation()
  360. }
  361. }
  362. });
  363. },
  364. computed: {
  365. shopTab: function() {
  366. return this.shopTabs.filter((item) => {
  367. if (this.mer_location == 1) {
  368. return item
  369. } else {
  370. return item.key < 3
  371. }
  372. })
  373. },
  374. ...configMap({hide_mer_status:0},mapGetters(['uid','isLogin','scrollTop','viewColor','keyColor'])),
  375. },
  376. // 滚动监听
  377. onPageScroll() {
  378. uni.$emit('scroll');
  379. },
  380. methods: {
  381. //查看地图
  382. showMaoLocation(lat, lon) {
  383. console.log(lat, lon)
  384. if (!lat || !lon) return this.$util.Tips({
  385. title: '请设置允许商城访问您的位置!'
  386. });
  387. //#ifdef H5
  388. if (this.$wechat.isWeixin() === true) {
  389. this.$wechat.seeLocation({
  390. latitude: Number(lat),
  391. longitude: Number(lon)
  392. }).then(res=>{
  393. console.log('success');
  394. })
  395. }else{
  396. //#endif
  397. uni.openLocation({
  398. latitude: parseFloat(lat),
  399. longitude: parseFloat(lon),
  400. scale: 8,
  401. geocode: true,
  402. success: function(res) {
  403. console.log(res)
  404. },
  405. });
  406. // #ifdef H5
  407. }
  408. //#endif
  409. },
  410. //获取定位
  411. selfLocation() {
  412. let self = this
  413. uni.getLocation({
  414. type: 'gcj02',
  415. success: (res) => {
  416. console.log(res)
  417. let latitude, longitude;
  418. latitude = res.latitude.toString();
  419. longitude = res.longitude.toString();
  420. this.latitude = res.latitude
  421. this.longitude = res.longitude
  422. console.log(res)
  423. getGeocoder({
  424. lat: latitude,
  425. long: longitude
  426. }).then(res => {
  427. console.log(res)
  428. this.detaile_address = res.data.address;
  429. this.recommend_address = res.data.formatted_addresses.recommend;
  430. })
  431. },
  432. complete: function() {
  433. // self.getList();
  434. }
  435. });
  436. },
  437. // 获取商户分类
  438. getClassfication: function() {
  439. let temp = []
  440. merClassifly()
  441. .then(res => {
  442. temp = res.data.map(item => {
  443. return {
  444. ...item,
  445. check: false
  446. }
  447. })
  448. if (this.sotreParam.category_id.length > 0) {
  449. this.sotreParam.category_id.forEach((ids, index) => {
  450. temp.forEach(el => {
  451. if (ids == el.merchant_category_id) {
  452. el.check = true
  453. }
  454. })
  455. })
  456. }
  457. this.merList = temp
  458. })
  459. .catch(res => {
  460. this.$util.Tips({
  461. title: res
  462. });
  463. });
  464. },
  465. // 获取店铺类型
  466. getStoreType: function() {
  467. let temp = []
  468. getStoreTypeApi()
  469. .then(res => {
  470. temp = res.data.map(item => {
  471. return {
  472. ...item,
  473. check: false
  474. }
  475. })
  476. if (this.sotreParam.type_id.length > 0) {
  477. this.sotreParam.type_id.forEach((ids, index) => {
  478. temp.forEach(el => {
  479. if (ids == el.mer_type_id) {
  480. el.check = true
  481. }
  482. })
  483. })
  484. }
  485. this.storeTypeArr = temp
  486. })
  487. .catch(res => {
  488. this.$util.Tips({
  489. title: res
  490. });
  491. });
  492. },
  493. // 查找店铺
  494. storeMerchantList(type) {
  495. if (!this.storeScroll) return
  496. if(type == 'tab') {
  497. this.storeList = []
  498. }
  499. this.loading = true
  500. let serachData = {
  501. keyword: this.where.keyword,
  502. page: this.sotreParam.page,
  503. limit: this.sotreParam.limit,
  504. order: this.sotreParam.order,
  505. category_id: this.sotreParam.category_id,
  506. type_id: this.sotreParam.type_id
  507. }
  508. if (this.latitude) {
  509. serachData.location = this.latitude + ',' + this.longitude
  510. }
  511. storeMerchantList(serachData).then(res => {
  512. res.data.list.forEach(item => {
  513. var tempNum = parseFloat(item.product_score) + parseFloat(item.service_score) + parseInt(item.postage_score)
  514. tempNum = tempNum / 3 / 5 * 100
  515. item.allScore = tempNum.toFixed(2)
  516. })
  517. this.storeScroll = res.data.list.length >= this.sotreParam.limit
  518. this.storeList = this.storeList.concat(res.data.list)
  519. this.count = res.data.count
  520. this.loading = false
  521. })
  522. },
  523. // 店铺排序
  524. storeTab(key) {
  525. if (this.loading) return
  526. this.storeKey = key
  527. this.sotreParam.order = this.shopTabs[key].order
  528. this.sotreParam.page = 1
  529. this.storeScroll = true
  530. this.storeList = []
  531. this.storeMerchantList()
  532. },
  533. // 右侧切换
  534. bindRight() {
  535. this.price = 0;
  536. this.firstKey = 4
  537. this.getBrandlist()
  538. },
  539. // 品牌列表
  540. getBrandlist() {
  541. let temp = []
  542. getBrandlist({
  543. cate_id: this.where.cate_id,
  544. keyword: this.where.keyword
  545. }).then(res => {
  546. temp = res.data.list.map(item => {
  547. return {
  548. ...item,
  549. check: false
  550. }
  551. })
  552. if (this.where.brand_id.length > 0) {
  553. this.where.brand_id.forEach((ids, index) => {
  554. temp.forEach(el => {
  555. if (ids == el.brand_id) {
  556. el.check = true
  557. }
  558. })
  559. })
  560. }
  561. this.brandList = temp
  562. this.rightBox = true
  563. })
  564. },
  565. onLoadFun: function(e) {
  566. this.isShowAuth = false
  567. },
  568. // 授权关闭
  569. authColse: function(e) {
  570. this.isShowAuth = e;
  571. },
  572. // 去详情页
  573. godDetail(item) {
  574. goShopDetail(item, this.uid).then(res => {
  575. if (this.isLogin) {
  576. initiateAssistApi(item.activity_id).then(res => {
  577. let id = res.data.product_assist_set_id;
  578. uni.hideLoading();
  579. // #ifndef MP
  580. uni.navigateTo({
  581. url: '/pages/activity/assist_detail/index?id=' + id
  582. });
  583. // #endif
  584. // #ifdef MP
  585. openBargainSubscribe().then(res => {
  586. uni.hideLoading();
  587. uni.navigateTo({
  588. url: '/pages/activity/assist_detail/index?id=' + id
  589. });
  590. }).catch((err) => {
  591. uni.hideLoading();
  592. });
  593. // #endif
  594. }).catch((err) => {
  595. uni.showToast({
  596. title: err,
  597. icon: 'none'
  598. })
  599. });
  600. } else {
  601. this.isAuto = true;
  602. this.isShowAuth = true
  603. }
  604. })
  605. },
  606. // 组件确定
  607. confirm(data) {
  608. let arr = []
  609. if (data.brandList.length == 0) {
  610. this.where.brand_id = ''
  611. } else {
  612. data.brandList.forEach(item => {
  613. arr.push(item.brand_id)
  614. })
  615. this.where.brand_id = arr
  616. }
  617. console.log(this.where.brand_id)
  618. this.rightBox = data.status
  619. this.where.price_on = data.price_on
  620. this.where.price_off = data.price_off
  621. this.where.is_trader = data.is_trader
  622. this.loadend = false;
  623. console.log(this.where)
  624. this.$set(this.where, 'page', 1)
  625. this.get_product_list(true);
  626. },
  627. // 右侧切换
  628. bindRight2() {
  629. this.price = 0;
  630. this.sotreParam.page = 1
  631. this.sotreParam.order = '',
  632. this.rightBox2 = true
  633. },
  634. // 组件确定
  635. confirm2(data) {
  636. let arr1 = [],arr2 = []
  637. if (data.storeTypeArr.length == 0) {
  638. this.sotreParam.type_id = ''
  639. } else {
  640. data.storeTypeArr.forEach(item => {
  641. arr1.push(item.mer_type_id)
  642. })
  643. this.sotreParam.type_id = arr1.toString();
  644. }
  645. if (data.merList.length == 0) {
  646. this.sotreParam.category_id = ''
  647. } else {
  648. data.merList.forEach(item => {
  649. arr2.push(item.merchant_category_id)
  650. })
  651. this.sotreParam.category_id = arr2.toString();
  652. }
  653. console.log(this.sotreParam.type_id)
  654. this.rightBox2 = data.status
  655. this.loadend = false;
  656. console.log(this.sotreParam)
  657. this.$set(this.sotreParam, 'page', 1)
  658. this.storeList = [];
  659. this.storeScroll = true
  660. this.storeMerchantList();
  661. },
  662. // 组件关闭
  663. close() {
  664. this.rightBox = false
  665. this.rightBox2 = false
  666. },
  667. // 下拉选项
  668. bindDown(item, index) {
  669. this.firstKey = 0
  670. if (index == 0) {
  671. this.where.order = ''
  672. } else if (index == 1) {
  673. this.where.order = 'rate'
  674. } else if (index == 2) {
  675. this.where.order = 'is_new'
  676. }
  677. this.downKey = index
  678. this.downStatus = false
  679. this.loadend = false;
  680. this.$set(this.where, 'page', 1)
  681. this.get_product_list(true);
  682. },
  683. Changswitch: function() {
  684. let that = this;
  685. that.is_switch = !that.is_switch
  686. },
  687. searchSubmit: function(e) {
  688. let that = this;
  689. if (!e.detail.value.trim()) {
  690. uni.showToast({
  691. title: '请输入搜索内容',
  692. icon: 'none',
  693. duration: 1000
  694. });
  695. return
  696. }
  697. that.$set(that.where, 'keyword', e.detail.value);
  698. if (this.tabIndex == 1) {
  699. that.loadend = false;
  700. that.$set(that.where, 'page', 1)
  701. this.get_product_list(true);
  702. } else {
  703. this.sotreParam.page = 1
  704. this.storeScroll = true
  705. this.storeList = []
  706. this.storeMerchantList('search')
  707. }
  708. },
  709. inputChange: function(e) {
  710. let that = this;
  711. that.$set(that.where, 'keyword', e.detail.value);
  712. },
  713. /**
  714. * 获取我的推荐
  715. */
  716. get_host_product: function() {
  717. let that = this;
  718. if (that.hotScroll) return
  719. getProductHot(
  720. that.hotPage,
  721. that.hotLimit,
  722. ).then(res => {
  723. that.hotPage++
  724. that.hotScroll = res.data.list.length < that.hotLimit
  725. that.hostProduct = that.hostProduct.concat(res.data.list)
  726. });
  727. },
  728. //点击事件处理
  729. set_where: function(e) {
  730. switch (e) {
  731. case 1:
  732. uni.navigateBack()
  733. break
  734. case 2:
  735. this.firstKey = e
  736. if (this.price == 0) {
  737. this.price = 1;
  738. this.where.order = 'price_asc'
  739. } else if (this.price == 1) {
  740. this.price = 2;
  741. this.where.order = 'price_desc'
  742. } else if (this.price == 2) {
  743. this.price = 0;
  744. this.where.order = ''
  745. }
  746. this.$set(this.where, 'page', 1)
  747. this.get_product_list(true);
  748. break;
  749. case 3:
  750. this.price = 0;
  751. this.loadend = false;
  752. this.$set(this.where, 'order', 'sales')
  753. this.$set(this.where, 'page', 1)
  754. this.get_product_list(true);
  755. this.firstKey = e
  756. break;
  757. }
  758. this.loadend = false;
  759. this.$set(this.where, 'page', 1);
  760. this.get_product_list(true);
  761. },
  762. //查找产品
  763. get_product_list: function(isPage) {
  764. let that = this;
  765. if (that.loadend) return;
  766. if (that.loading) return;
  767. if (isPage === true) that.$set(that, 'productList', []);
  768. that.loading = true;
  769. that.loadTitle = '';
  770. getProductslist(that.where).then(res => {
  771. let list = res.data.list;
  772. let productList = that.$util.SplitArray(list, that.productList);
  773. let loadend = list.length < that.where.limit;
  774. that.loadend = loadend;
  775. that.loading = false;
  776. that.loadTitle = loadend ? '已全部加载' : '加载更多';
  777. that.$set(that, 'productList', productList);
  778. console.log(that.productList)
  779. that.$set(that.where, 'page', that.where.page + 1);
  780. }).catch(err => {
  781. that.loading = false;
  782. that.loadTitle = '加载更多';
  783. });
  784. },
  785. goStore: function(id) {
  786. if (this.hide_mer_status != 1) {
  787. uni.navigateTo({
  788. url: `/pages/store/index?id=${id}`
  789. })
  790. }
  791. }
  792. },
  793. onPullDownRefresh() {
  794. },
  795. onReachBottom() {
  796. if (this.tabIndex == 1) {
  797. if (this.productList.length > 0) {
  798. this.get_product_list(false);
  799. } else {
  800. this.get_host_product();
  801. }
  802. } else {
  803. if (this.count === this.storeList.length) {
  804. if (this.count === 0) {
  805. return
  806. }
  807. uni.showToast({
  808. title: '已加载全部',
  809. icon: 'none',
  810. duration: 1000
  811. });
  812. } else {
  813. this.sotreParam.page += 1
  814. this.storeMerchantList()
  815. }
  816. }
  817. },
  818. onPullDownRefresh(){
  819. setTimeout(()=>{
  820. const newList = this.productList.reverse();
  821. this.productList = newList;
  822. uni.stopPullDownRefresh();
  823. },500)
  824. }
  825. }
  826. </script>
  827. <style lang="scss" scoped>
  828. .productList .search {
  829. width: 100%;
  830. height: 86rpx;
  831. padding: 0 20rpx;
  832. box-sizing: border-box;
  833. position: fixed;
  834. left: 0;
  835. top: 0;
  836. z-index: 9;
  837. background-color: var(--view-theme);
  838. .icon-dingwei {
  839. color: #fff;
  840. font-weight: 0;
  841. font-size: 40rpx;
  842. line-height: 86rpx;
  843. width: 62rpx;
  844. }
  845. }
  846. .productList .search .back {
  847. display: flex;
  848. align-items: center;
  849. width: 40rpx;
  850. height: 60rpx;
  851. .iconfont {
  852. color: #fff;
  853. font-size: 36rpx;
  854. }
  855. }
  856. .productList .search .input {
  857. flex: 1;
  858. height: 60rpx;
  859. background-color: #fff;
  860. border-radius: 50rpx;
  861. padding: 0 20rpx;
  862. box-sizing: border-box;
  863. }
  864. .productList .search .input input {
  865. flex: 1;
  866. height: 100%;
  867. font-size: 26rpx;
  868. margin-left: 10rpx;
  869. }
  870. .productList .search .input .placeholder {
  871. color: #999;
  872. }
  873. .productList .search .input .iconfont {
  874. font-size: 35rpx;
  875. color: #555;
  876. }
  877. .productList .search .icon-pailie,
  878. .productList .search .icon-tupianpailie,
  879. .productList .search .iconempty {
  880. color: #fff;
  881. width: 62rpx;
  882. font-size: 40rpx;
  883. height: 86rpx;
  884. line-height: 86rpx;
  885. }
  886. .productList .nav-wrapper {
  887. z-index: 9;
  888. position: fixed;
  889. left: 0;
  890. top: 0;
  891. width: 100%;
  892. margin-top: 86rpx;
  893. background-color: var(--view-theme);
  894. .tab-bar {
  895. display: flex;
  896. align-items: center;
  897. .tab-item {
  898. position: relative;
  899. flex: 1;
  900. display: flex;
  901. justify-content: center;
  902. align-items: center;
  903. padding: 8rpx 0 20rpx;
  904. color: #fff;
  905. font-size: 28rpx;
  906. font-weight: bold;
  907. &::after {
  908. content: ' ';
  909. position: absolute;
  910. left: 50%;
  911. bottom: 18rpx;
  912. width: 30rpx;
  913. height: 3rpx;
  914. background: transparent;
  915. transform: translateX(-50%);
  916. }
  917. &.on {
  918. &::after {
  919. background: #fff;
  920. }
  921. }
  922. }
  923. }
  924. }
  925. .productList .nav {
  926. height: 86rpx;
  927. color: #454545;
  928. font-size: 28rpx;
  929. background-color: #fff;
  930. display: flex;
  931. justify-content: space-between;
  932. padding: 0 28rpx;
  933. }
  934. .productList .nav .item {
  935. display: flex;
  936. align-items: center;
  937. justify-content: center;
  938. flex: 1;
  939. }
  940. .t-color {
  941. color: var(--view-theme);
  942. }
  943. .productList .nav .item.t-color {
  944. font-weight: bold;
  945. color: #454545;
  946. }
  947. .productList .nav .item image {
  948. width: 15rpx;
  949. height: 19rpx;
  950. margin-left: 10rpx;
  951. }
  952. .productList .list {
  953. padding: 0 20rpx;
  954. margin-top: 240rpx;
  955. }
  956. .productList .list.on {
  957. background-color: #fff;
  958. border-top: 1px solid #f6f6f6;
  959. }
  960. .productList .list .item {
  961. position: relative;
  962. width: 345rpx;
  963. margin-top: 20rpx;
  964. background-color: #fff;
  965. border-radius: 20rpx;
  966. .name{
  967. display: flex;
  968. align-items: center;
  969. .name_text{
  970. // max-width: 420rpx;
  971. }
  972. }
  973. }
  974. .productList .list .item.on {
  975. width: 100%;
  976. display: flex;
  977. padding: 30rpx 0;
  978. margin: 0;
  979. }
  980. .productList .list .item .pictrue {
  981. position: relative;
  982. width: 100%;
  983. height: 345rpx;
  984. }
  985. .productList .list .item .pictrue.on {
  986. width: 260rpx;
  987. height: 260rpx;
  988. }
  989. .productList .list .item .pictrue image {
  990. width: 100%;
  991. height: 100%;
  992. border-radius: 20rpx 20rpx 0 0;
  993. }
  994. .productList .list .item .pictrue image.on {
  995. border-radius: 16rpx;
  996. width: 260rpx;
  997. height: 260rpx;
  998. }
  999. .productList .list .item .text {
  1000. padding: 20rpx 17rpx 26rpx 17rpx;
  1001. font-size: 30rpx;
  1002. color: #222;
  1003. }
  1004. .productList .list .item .text.on {
  1005. width: 508rpx;
  1006. padding: 0 0 0 22rpx;
  1007. justify-content: space-between;
  1008. .font-bg-red{
  1009. max-width: 120rpx;
  1010. }
  1011. .bt-color {
  1012. background-color: var(--view-theme);
  1013. border: 1rpx solid var(--view-theme);
  1014. &.type2{
  1015. background-color: #FD6523;
  1016. border: 1rpx solid #FD6523;
  1017. }
  1018. }
  1019. .name,.item_bot{
  1020. width: 100%;
  1021. }
  1022. .item_bot{
  1023. position: relative;
  1024. &::after{
  1025. content: '';
  1026. display: block;
  1027. width: 100%;
  1028. border-bottom: 1rpx solid #f6f6f6;
  1029. position: absolute;
  1030. right: 20rpx;
  1031. bottom: -30rpx;
  1032. }
  1033. }
  1034. }
  1035. .productList .list .item .text .money {
  1036. display: flex;
  1037. align-items: center;
  1038. font-size: 26rpx;
  1039. font-weight: bold;
  1040. margin-top: 8rpx;
  1041. color: var(--view-priceColor);
  1042. }
  1043. .productList .list .item .text .money .num {
  1044. font-size: 34rpx;
  1045. }
  1046. .productList .distance {
  1047. display: flex;
  1048. align-items: center;
  1049. font-size: 24rpx;
  1050. color: #999999;
  1051. .icon-xiangyou {
  1052. font-size: 24rpx;
  1053. line-height: 24rpx;
  1054. }
  1055. }
  1056. .productList .list .item .text .money .ticket {
  1057. margin-left: 10rpx;
  1058. padding: 0 5rpx;
  1059. font-weight: initial;
  1060. font-size: 20rpx;
  1061. border: 1px solid var(--view-theme);
  1062. border-radius: 4rpx;
  1063. }
  1064. .productList .list .item .text .money .ticket-big {
  1065. display: flex;
  1066. align-items: center;
  1067. justify-content: center;
  1068. min-width: 163rpx;
  1069. height: 28rpx;
  1070. margin-left: 10rpx;
  1071. background-image: url(~static/images/yh.png);
  1072. background-size: 100% 100%;
  1073. font-size: 20rpx;
  1074. font-weight: normal;
  1075. padding: 0 10rpx;
  1076. }
  1077. .productList .list .item .item_tags{
  1078. margin-top: 8rpx;
  1079. }
  1080. .productList .list .item .item_tags .tags_item {
  1081. display: inline-block;
  1082. font-size: 20rpx;
  1083. text-align: center;
  1084. border-radius: 5rpx;
  1085. padding: 0 4rpx;
  1086. line-height: 28rpx;
  1087. margin-right: 8rpx;
  1088. }
  1089. .productList .list .item .item_tags .tags_item.ticket{
  1090. color: var(--view-theme);
  1091. border: 1rpx solid var(--view-theme);
  1092. }
  1093. .item_tags .tags_item.delivery{
  1094. color: #FF9000;
  1095. border: 1rpx solid #FF9000;
  1096. }
  1097. .productList .list .item .text .score {
  1098. margin-top: 10rpx;
  1099. color: #737373;
  1100. font-size: 20rpx;
  1101. }
  1102. .productList .list .item .text .company {
  1103. display: flex;
  1104. align-items: center;
  1105. color: #737373;
  1106. font-size: 20rpx;
  1107. margin-top: 10rpx;
  1108. width: 240rpx;
  1109. .name {
  1110. display: inline-block;
  1111. width: 120rpx;
  1112. overflow: hidden;
  1113. white-space: nowrap;
  1114. text-overflow: ellipsis;
  1115. }
  1116. .flex {
  1117. display: flex;
  1118. align-items: center;
  1119. margin-left: 10rpx;
  1120. color: #282828;
  1121. width: 100rpx;
  1122. .iconfont {
  1123. font-size: 16rpx;
  1124. margin-top: 4rpx;
  1125. }
  1126. }
  1127. }
  1128. .productList .list .item .foot-bar {
  1129. width: 100%;
  1130. height: 52rpx;
  1131. display: flex;
  1132. align-items: center;
  1133. justify-content: center;
  1134. background-image: linear-gradient(-90deg, var(--view-bntColor21) 0%, var(--view-bntColor22) 100%);
  1135. border-radius: 0px 0px 16rpx 16rpx;
  1136. color: #fff;
  1137. font-size: 24rpx;
  1138. .icon-fenxiang {
  1139. font-size: 24rpx;
  1140. margin-right: 10rpx;
  1141. }
  1142. &.on {
  1143. position: absolute;
  1144. right: 0;
  1145. bottom: 30rpx;
  1146. width: 200rpx;
  1147. height: 44rpx;
  1148. border-radius: 22rpx;
  1149. }
  1150. }
  1151. .noCommodity {
  1152. background-color: #fff;
  1153. .pictrue {
  1154. height: 420rpx;
  1155. color: $uni-nothing-text;
  1156. image {
  1157. width: 414rpx;
  1158. height: 336rpx;
  1159. }
  1160. }
  1161. }
  1162. .no-shop {
  1163. margin-top: 240rpx;
  1164. background-color: #fff;
  1165. padding-bottom: calc(100% - 109rpx);
  1166. .pictrue {
  1167. display: flex;
  1168. flex-direction: column;
  1169. align-items: center;
  1170. color: $uni-nothing-text;
  1171. image {
  1172. width: 414rpx;
  1173. height: 336rpx;
  1174. }
  1175. }
  1176. }
  1177. .spin {
  1178. display: block;
  1179. transform: rotate(180deg);
  1180. font-size: 36rpx;
  1181. }
  1182. .icon-xiala1 {
  1183. margin-top: 6rpx;
  1184. }
  1185. .icon-shaixuan {
  1186. font-size: 30rpx;
  1187. margin-left: 10rpx;
  1188. }
  1189. .down-wrapper {
  1190. .bg {
  1191. z-index: 8;
  1192. position: fixed;
  1193. left: 0;
  1194. top: 0;
  1195. width: 100%;
  1196. height: 100%;
  1197. background: rgba(0, 0, 0, .5);
  1198. }
  1199. .down-box {
  1200. z-index: 8;
  1201. position: fixed;
  1202. left: 0;
  1203. top: 238rpx;
  1204. width: 100%;
  1205. padding: 0 40rpx 28rpx 74rpx;
  1206. background-color: #F8F8F8;
  1207. border-radius: 0 0 24rpx 24rpx;
  1208. .down-item {
  1209. margin-top: 28rpx;
  1210. font-size: 24rpx;
  1211. color: #454545;
  1212. &.on {
  1213. color: var(--view-theme);
  1214. }
  1215. .iconfont{
  1216. float: right;
  1217. }
  1218. }
  1219. }
  1220. }
  1221. .store-wrapper {
  1222. margin-top: 240rpx;
  1223. border-top: 1px solid #F6F6F6;
  1224. .star-box {
  1225. display: flex;
  1226. align-items: center;
  1227. .line {
  1228. width: 2rpx;
  1229. height: 20rpx;
  1230. background: #BFBFBF;
  1231. margin: 0 12rpx;
  1232. }
  1233. .star {
  1234. position: relative;
  1235. width: 111rpx;
  1236. height: 19rpx;
  1237. background: url(~pages/columnGoods/images/star.png);
  1238. background-size: 111rpx 19rpx;
  1239. }
  1240. .star-active {
  1241. position: absolute;
  1242. left: 0;
  1243. top: 0;
  1244. width: 111rpx;
  1245. height: 19rpx;
  1246. overflow: hidden;
  1247. background: url(~pages/columnGoods/images/star_active.png);
  1248. background-size: 111rpx 19rpx;
  1249. }
  1250. .num {
  1251. color: $theme-color;
  1252. font-size: 24rpx;
  1253. margin-left: 10rpx;
  1254. }
  1255. }
  1256. .store-item {
  1257. margin-bottom: 12rpx;
  1258. padding: 40rpx 20rpx;
  1259. background-color: #fff;
  1260. .head {
  1261. display: flex;
  1262. align-items: center;
  1263. justify-content: space-between;
  1264. .left-wrapper {
  1265. display: flex;
  1266. align-items: center;
  1267. .logo {
  1268. width: 80rpx;
  1269. height: 80rpx;
  1270. image {
  1271. width: 80rpx;
  1272. height: 80rpx;
  1273. border-radius: 6rpx;
  1274. }
  1275. }
  1276. .con-box {
  1277. margin-left: 20rpx;
  1278. .font-bg-red {
  1279. width: max-content;
  1280. white-space: nowrap;
  1281. margin-left: 20rpx;
  1282. font-size: 18rpx;
  1283. padding: 2rpx 10rpx;
  1284. color: #FFFFFF;
  1285. background-color: #E93323;
  1286. border-radius: 13rpx;
  1287. }
  1288. .name {
  1289. font-size: 30rpx;
  1290. color: #333;
  1291. font-weight: bold;
  1292. margin-bottom: 10rpx;
  1293. .mer_name{
  1294. max-width: 360rpx;
  1295. }
  1296. }
  1297. }
  1298. }
  1299. .link {
  1300. width: 114rpx;
  1301. height: 50rpx;
  1302. line-height: 50rpx;
  1303. background: linear-gradient(-90deg, rgba(246, 122, 56, 1) 0%, rgba(241, 27, 9, 1) 100%);
  1304. border-radius: 25rpx;
  1305. text-align: center;
  1306. color: #fff;
  1307. font-size: 24rpx;
  1308. }
  1309. }
  1310. .pic-wrapper {
  1311. display: flex;
  1312. margin-top: 30rpx;
  1313. .pic-item {
  1314. position: relative;
  1315. width: 226rpx;
  1316. height: 226rpx;
  1317. margin-right: 16rpx;
  1318. image {
  1319. width: 226rpx;
  1320. height: 226rpx;
  1321. border-radius: 16rpx;
  1322. }
  1323. .price {
  1324. position: absolute;
  1325. right: 0;
  1326. bottom: 0;
  1327. height: 36rpx;
  1328. padding: 0 10rpx;
  1329. line-height: 36rpx;
  1330. text-align: center;
  1331. background: rgba(0, 0, 0, .5);
  1332. border-radius: 16rpx 2rpx 16rpx 2rpx;
  1333. color: #fff;
  1334. font-size: 24rpx;
  1335. text {
  1336. font-size: 18rpx;
  1337. }
  1338. }
  1339. &:nth-child(3n) {
  1340. margin-right: 0;
  1341. }
  1342. }
  1343. }
  1344. }
  1345. }
  1346. </style>