index.vue 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403
  1. <!-- type 1拼多多 2淘宝 -->
  2. <template>
  3. <div class="container">
  4. <div
  5. class="l_tabBar flex_r flex_jb"
  6. >
  7. <div class="search-box flex_r flex_jb">
  8. <div class="search flex_r flex_jb flex_ac">
  9. <span class="iconfont">&#xe661;</span>
  10. <input
  11. v-model="keyword"
  12. @confirm="toSearch"
  13. class="inp"
  14. placeholder="搜索你要的内容"
  15. />
  16. <span class="search_btn" @click="toSearch">搜索</span>
  17. </div>
  18. </div>
  19. </div>
  20. <!-- 平台-start -->
  21. <div class="nav_box flex_r">
  22. <div
  23. class="item flex_c flex_ac"
  24. v-for="(i, s) in platform"
  25. :key="s"
  26. @click="toPlatform(i,s)"
  27. >
  28. <uni-badge
  29. size="small"
  30. :text="i.badge"
  31. absolute="rightTop"
  32. type="error"
  33. >
  34. <img :src="i.image" alt="" class="ico" />
  35. </uni-badge>
  36. <div class="tit">{{ i.name }}</div>
  37. <div class="tit1">{{ i.text }}</div>
  38. </div>
  39. </div>
  40. <!-- 平台-end -->
  41. <!-- 平台切换-start -->
  42. <div class="flex_r flex_ac">
  43. <div
  44. :class="navIndex == s ? 'nav nav-active' : 'nav'"
  45. v-for="(i, s) in platform"
  46. :key="s"
  47. @click="changeNav(i, s)"
  48. >
  49. <span>{{ i.name }}</span>
  50. </div>
  51. </div>
  52. <!-- 平台切换-end -->
  53. <!-- 平台下分类-start -->
  54. <div class="sort_box flex_r flex_ac">
  55. <div
  56. :class="sortIndex == s ? 'sort sort-active' : 'sort'"
  57. v-for="(i, s) in sort"
  58. :key="s"
  59. @click="search(i, s)"
  60. >
  61. <span>{{ i.cat_name }}</span>
  62. </div>
  63. </div>
  64. <view class="product-list" v-if="goods.length > 0 && platformObj.type == 8">
  65. <view
  66. class="product"
  67. v-for="(i, s) in goods"
  68. :key="s"
  69. @click="NavToGoodsDetail(i)"
  70. >
  71. <view class="image-view">
  72. <image class="product-image" :src="i.goods.original_img"></image>
  73. </view>
  74. <view class="content-view">
  75. <view :class="['product-title', 'ellipsis2']">{{
  76. i.goods_name
  77. }}</view>
  78. <view class="product-price">
  79. <text class="product-price-original product-price-original1">{{ i.cost_price }}</text>
  80. <text class="product-text" v-if="['3', '4'].includes(type)"
  81. >赠<text class="corFE2C15">{{ i.give_cha_bao }}</text
  82. >贡献值</text
  83. >
  84. </view>
  85. <view class="product-txt" v-if="type == 4">
  86. <text class="product-price-favour">¥{{ i.market_price }}</text>
  87. <text class="product-text">消费券抵</text>
  88. <span class="corFE2C15">¥{{ Number(i.consume) }}</span>
  89. </view>
  90. <!-- <view class="product-txt" v-if="type == 1">赠送{{ i.give_integral + "批发券" }}</view> -->
  91. <view class="product-txt" v-if="type == 6"
  92. >每<text class="green">{{ i.interval_time }}</text> 分钟降价
  93. <text class="green">{{ i.drop_range * 100 }}%</text>
  94. </view>
  95. <view class="product-txt" v-if="['3'].includes(type)"
  96. >限时赠送<text class="corFE2C15">{{ i.teac }}</text
  97. >TeaC</view
  98. >
  99. <view class="product-txt fenxiang" v-if="['3'].includes(type)">
  100. <text class="iconfont red">&#xe62b;</text>
  101. <text class="red"
  102. >分享约获得{{ i.first_teac
  103. }}{{ type == 3 ? "TeaC" : "现金" }}</text
  104. >
  105. </view>
  106. <view v-if="['4'].includes(type)" class="flex_r flex_ac">
  107. <view class="product-txt"
  108. >赠<text class="corFE2C15">{{ i.teac }}</text
  109. >TeaC</view
  110. >
  111. <!-- <view class="product-txt fenxiang" style="background-color: rgba(0, 0, 0, 0);">
  112. <text class="iconfont red">&#xe62b;</text>
  113. <text class="red"
  114. >{{ i.first_teac }}</text
  115. >
  116. </view> -->
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. <!-- 平台下分类-end -->
  122. <view class="product-list" v-if="goods.length > 0 && platformObj.type != 5 && platformObj.type != 8">
  123. <view
  124. class="product"
  125. v-for="(i, s) in goods"
  126. :key="s"
  127. @click="NavToGoodsDetail(i)"
  128. >
  129. <view class="image-view" v-if="platformObj.type == 1">
  130. <image class="product-image" :src="i.goods_image_url"></image>
  131. </view>
  132. <view class="image-view" v-else-if="platformObj.type == 2">
  133. <image
  134. class="product-image"
  135. :src="i.item_basic_info.pict_url"
  136. ></image>
  137. </view>
  138. <view class="image-view" v-else-if="platformObj.type == 3">
  139. <image
  140. class="product-image"
  141. :src="i.imageInfo.imageList[0].url"
  142. ></image>
  143. </view>
  144. <view class="content-view">
  145. <view :class="['product-title', 'ellipsis2']">
  146. <span class="product-type">
  147. {{ platformObj.name }}
  148. </span>
  149. <span v-if="platformObj.type == 1">{{ i.goods_name }}</span>
  150. <span v-else-if="platformObj.type == 2">{{
  151. i.item_basic_info.title
  152. }}</span>
  153. <span v-else-if="platformObj.type == 3">{{ i.skuName }}</span>
  154. </view>
  155. <!-- 拼多多 -->
  156. <template v-if="platformObj.type == 1">
  157. <view class="quan_box flex_r flex_as flex_wrap">
  158. <view class="quan" v-if="i.has_coupon">
  159. <span class="pl">券</span>
  160. <span>¥{{ i.coupon_discount / 100 }}</span>
  161. </view>
  162. <view class="quan">
  163. <span>赠付宝:</span>
  164. <span>
  165. {{
  166. Math.floor(
  167. (i.min_group_price / 100) *
  168. (i.promotion_rate / 1000) *
  169. platformObj.ratio *
  170. 100
  171. ) / 100
  172. }}
  173. </span>
  174. </view>
  175. <view class="quan">
  176. <span>赠贡献值:</span>
  177. <span>
  178. {{
  179. Math.floor(
  180. (i.min_group_price / 100 - i.coupon_discount / 100) *
  181. platformObj.chabao *
  182. 100
  183. ) / 100
  184. }}
  185. </span>
  186. </view>
  187. </view>
  188. <view class="product-price">
  189. <text class="product-price-original">
  190. {{
  191. Math.floor(
  192. (i.min_group_price / 100 - i.coupon_discount / 100) * 100
  193. ) / 100
  194. }}
  195. </text>
  196. <text class="product-price-favour"
  197. >¥{{ i.min_group_price / 100 }}</text
  198. >
  199. </view>
  200. </template>
  201. <!-- 淘宝 -->
  202. <template v-else-if="platformObj.type == 2">
  203. <view class="quan_box flex_r flex_as flex_wrap">
  204. <view class="quan" v-if="i.coupon_discount > 0">
  205. <span class="pl">券</span>
  206. <span>¥{{ i.coupon_discount }}</span>
  207. </view>
  208. <view class="quan">
  209. <span>赠付宝:</span>
  210. <span>
  211. {{
  212. Math.floor(
  213. ((i.price_promotion_info.final_promotion_price *
  214. i.publish_info.income_rate) /
  215. 100) *
  216. platformObj.ratio *
  217. 100
  218. ) / 100
  219. }}
  220. </span>
  221. </view>
  222. <view class="quan">
  223. <span>赠贡献值:</span>
  224. <span>
  225. {{
  226. Math.floor(
  227. i.price_promotion_info.final_promotion_price *
  228. platformObj.chabao *
  229. 100
  230. ) / 100
  231. }}
  232. </span>
  233. </view>
  234. </view>
  235. <view class="product-price">
  236. <text class="product-price-original">
  237. <!-- // Math.floor(
  238. // (i.min_group_price / 100 - i.coupon_discount / 100) * 100
  239. // ) / 100 -->
  240. {{ i.price_promotion_info.final_promotion_price }}
  241. </text>
  242. <text class="product-price-favour">
  243. ¥{{ i.price_promotion_info.zk_final_price }}
  244. </text>
  245. </view>
  246. </template>
  247. <!-- 京东 -->
  248. <template v-else-if="platformObj.type == 3">
  249. <view class="quan_box flex_r flex_as flex_wrap">
  250. <view class="quan" v-if="i.coupon_discount > 0">
  251. <span class="pl">券</span>
  252. <span>¥{{ i.coupon_discount }}</span>
  253. </view>
  254. <view class="quan">
  255. <span>赠付宝:</span>
  256. <span>
  257. {{
  258. Math.floor(
  259. ((i.priceInfo.lowestCouponPrice *
  260. i.commissionInfo.commissionShare) /
  261. 100) *
  262. platformObj.ratio *
  263. 100
  264. ) / 100
  265. }}
  266. </span>
  267. </view>
  268. <view class="quan">
  269. <span>赠贡献值:</span>
  270. <span>
  271. {{
  272. Math.floor(
  273. i.priceInfo.lowestCouponPrice * platformObj.chabao * 100
  274. ) / 100
  275. }}
  276. </span>
  277. </view>
  278. </view>
  279. <view class="product-price">
  280. <text class="product-price-original">
  281. <!-- // Math.floor(
  282. // (i.min_group_price / 100 - i.coupon_discount / 100) * 100
  283. // ) / 100 -->
  284. {{ i.priceInfo.lowestCouponPrice }}
  285. </text>
  286. <text class="product-price-favour">
  287. ¥{{ i.priceInfo.price }}
  288. </text>
  289. </view>
  290. </template>
  291. <!-- 美团 -->
  292. <template v-else-if="platformObj.type == 5">
  293. <view class="quan_box flex_r flex_as flex_wrap">
  294. <!-- <view class="quan" v-if="i.coupon_discount > 0">
  295. <span class="pl">券</span>
  296. <span>¥{{ i.coupon_discount }}</span>
  297. </view> -->
  298. <view class="quan">
  299. <span>赠付宝:</span>
  300. <span>
  301. {{
  302. Math.floor(
  303. (i.couponPackDetail.sellPrice *
  304. Number(i.commissionInfo.commissionPercent) /
  305. 10000) *
  306. platformObj.ratio *
  307. 100
  308. ) / 100
  309. }}
  310. </span>
  311. </view>
  312. <view class="quan">
  313. <span>赠贡献值:</span>
  314. <span>
  315. {{
  316. Math.floor(
  317. i.couponPackDetail.sellPrice * platformObj.chabao * 100
  318. ) / 100
  319. }}
  320. </span>
  321. </view>
  322. </view>
  323. <view class="product-price">
  324. <text class="product-price-original">
  325. <!-- // Math.floor(
  326. // (i.min_group_price / 100 - i.coupon_discount / 100) * 100
  327. // ) / 100 -->
  328. {{ i.couponPackDetail.sellPrice }}
  329. </text>
  330. <text class="product-price-favour">
  331. ¥{{ i.couponPackDetail.originalPrice }}
  332. </text>
  333. </view>
  334. </template>
  335. </view>
  336. </view>
  337. </view>
  338. <view class="product-list" v-if="goods.length > 0 && platformObj.type == 5">
  339. <view
  340. class="product type5"
  341. v-for="(i, s) in goods"
  342. :key="s"
  343. >
  344. <view class="flex_r flex_jb flex_ac">
  345. <view class="image-view">
  346. <image
  347. class="product-image"
  348. :src="i.couponPackDetail.headUrl"
  349. ></image>
  350. </view>
  351. <view class="content-view">
  352. <view :class="['product-title', 'ellipsis2']">
  353. <span class="product-type">
  354. {{ platformObj.name }}
  355. </span>
  356. <span>{{ i.couponPackDetail.name }}</span>
  357. </view>
  358. <view class="flex_r flex_jb flex_ae">
  359. <view class="product-price">
  360. <text class="product-price-original">
  361. {{ i.couponPackDetail.sellPrice }}
  362. </text>
  363. <text class="product-price-favour"
  364. >¥{{ i.couponPackDetail.originalPrice }}</text
  365. >
  366. </view>
  367. <view class="buyed"> {{ i.couponPackDetail.saleVolume }} </view>
  368. </view>
  369. <view class="quan_box flex_r flex_as flex_wrap">
  370. <!-- <view class="quan" v-if="i.coupon_discount > 0">
  371. <span class="pl">券</span>
  372. <span>¥{{ i.coupon_discount }}</span>
  373. </view> -->
  374. <view class="quan">
  375. <span>赠付宝:</span>
  376. <span>
  377. {{
  378. Math.floor(
  379. (i.couponPackDetail.sellPrice *
  380. Number(i.commissionInfo.commissionPercent) /
  381. 10000) *
  382. platformObj.ratio *
  383. 100
  384. ) / 100
  385. }}
  386. </span>
  387. </view>
  388. <view class="quan">
  389. <span>赠贡献值:</span>
  390. <span>
  391. {{
  392. Math.floor(
  393. i.couponPackDetail.sellPrice * platformObj.chabao * 100
  394. ) / 100
  395. }}
  396. </span>
  397. </view>
  398. </view>
  399. <view class="shop"> {{ i.brandInfo.brandName || i.deliverablePoiInfo.poiName || "美团外卖" }} </view>
  400. </view>
  401. </view>
  402. <view class="flex_r flex_ac flex_jb ">
  403. <view class="mtBtn1" @click="copyMt(i)">分享好友</view>
  404. <view class="mtBtn2" @click="toMt(i)">立即抢券</view>
  405. </view>
  406. </view>
  407. </view>
  408. <not-goods v-if="goods.length <= 0" textStr="暂无数据"></not-goods>
  409. <!-- 精品推荐-end -->
  410. <view class="fz_w_text">好生活,茶付宝!</view>
  411. </div>
  412. </template>
  413. <script>
  414. let page = 1;
  415. import { post } from "@/request/api.js";
  416. import uniCopy from "@/utils/copy";
  417. import notGoods from "@/components/not-goods/index.vue";
  418. export default {
  419. components: { notGoods },
  420. data() {
  421. return {
  422. goods: [], // 商品列表
  423. haveGoods: false, // 是否有商品
  424. platform: [], //平台
  425. navIndex: 0, // 平台索引
  426. sort: [], //分类
  427. sortIndex: 0, // 分类索引
  428. head: false,
  429. keyword: "", // 搜索关键字
  430. banner: {}, // 顶部背景图
  431. ratio: 0, // 比例
  432. platformObj: {
  433. type: 8,
  434. }, // 选中平台
  435. catObj: {
  436. cat_id: 0,
  437. cat_name: "",
  438. }, //选中的分类
  439. type: 4, //享好物的固定类型
  440. categoryId: 11,
  441. };
  442. },
  443. async mounted() {
  444. // this.platform = [];
  445. // this.navIndex = 0;
  446. // this.platformObj = {
  447. // type: 1,
  448. // };
  449. // this.sortIndex = 0;
  450. // this.sort = [];
  451. // this.catObj = {
  452. // cat_id: 0,
  453. // cat_name: "",
  454. // };
  455. this.getIcon();
  456. uni.setTabBarStyle({
  457. color: "#999",
  458. selectedColor: "#E68B1E",
  459. });
  460. page = 1;
  461. this.goods = [];
  462. this.duoduoCats();
  463. this.goodsDay();
  464. this.$bus.$on("onReachBottom", (url) => {
  465. console.log(this.platformObj.type)
  466. if (page != -1) {
  467. setTimeout(() => {
  468. ++page;
  469. this.goodsDay();
  470. }, 500);
  471. }
  472. });
  473. },
  474. created(da) {
  475. this.getIcon();
  476. uni.setTabBarStyle({
  477. color: "#999",
  478. selectedColor: "#E68B1E",
  479. });
  480. this.duoduoCats();
  481. this.goodsDay();
  482. },
  483. onHide() {},
  484. onPageScroll(e) {
  485. // if (e.scrollTop > 0) {
  486. // this.head = true;
  487. // } else {
  488. // this.head = false;
  489. // }
  490. },
  491. methods: {
  492. // 获取平台
  493. getIcon() {
  494. post("v1/cashback/getIcon", {isApp: 1}).then((res) => {
  495. if (res.code === 0) {
  496. this.platform = res.data;
  497. this.platform.length = 5; // 后期要去掉
  498. this.platformObj = this.platform[this.navIndex];
  499. this.ratio = this.platform[this.navIndex].ratio;
  500. } else {
  501. this.$toast(res.msg);
  502. }
  503. });
  504. },
  505. // 获取拼多多平台下的分类
  506. duoduoCats() {
  507. post("v1/cashback/duoduoCats").then((res) => {
  508. if (res.code === 0) {
  509. if (this.platformObj.type == 1) {
  510. this.sort = res.data.cats;
  511. }
  512. this.banner = res.data.banner[0];
  513. } else {
  514. this.$toast(res.msg);
  515. }
  516. });
  517. },
  518. // 获取淘宝平台下的分类
  519. taobaoCats() {
  520. post("v1/cashback/taobaoCats").then((res) => {
  521. if (res.code === 0) {
  522. this.sort = res.data.cats;
  523. this.catObj = this.sort[0];
  524. } else {
  525. this.$toast(res.msg);
  526. }
  527. });
  528. },
  529. // 获取京东平台下的分类
  530. jingdongCats() {
  531. post("v1/cashback/jingdongCats").then((res) => {
  532. if (res.code === 0) {
  533. this.sort = res.data.cats;
  534. this.catObj = this.sort[0];
  535. } else {
  536. this.$toast(res.msg);
  537. }
  538. });
  539. },
  540. // 获取美团平台下的分类
  541. meituanCats() {
  542. post("v1/cashback/meituanCats").then((res) => {
  543. if (res.code === 0) {
  544. this.sort = res.data.cats;
  545. this.catObj = this.sort[0];
  546. } else {
  547. this.$toast(res.msg);
  548. }
  549. });
  550. },
  551. // 切换平台
  552. changeNav(item, index) {
  553. this.sortIndex = 0;
  554. this.catObj = {
  555. cat_id: 0,
  556. cat_name: "",
  557. };
  558. this.sort = [];
  559. this.platformObj = item;
  560. this.navIndex = index;
  561. if (this.platformObj.type == 1) {
  562. this.duoduoCats();
  563. } else if (this.platformObj.type == 2) {
  564. this.taobaoCats();
  565. } else if (this.platformObj.type == 3) {
  566. this.jingdongCats();
  567. } else if (this.platformObj.type == 5) {
  568. this.meituanCats();
  569. }
  570. page = 1;
  571. this.goods = [];
  572. this.goodsDay();
  573. },
  574. // 跳转
  575. toPage(url) {
  576. this.goto(url);
  577. },
  578. toSearch() {
  579. page = 1;
  580. this.goods = [];
  581. this.goodsDay();
  582. },
  583. // 搜索/切换分类
  584. search(item, index) {
  585. this.catObj = item;
  586. this.sortIndex = index;
  587. page = 1;
  588. this.goods = [];
  589. this.goodsDay();
  590. },
  591. // 获取商品列表
  592. async goodsDay() {
  593. uni.showLoading();
  594. let that = this;
  595. let data = {};
  596. if (this.platformObj.type == 1) {
  597. // post("v1/cashback/taobaoList",{cat:"女装"}).then((res) => {
  598. data = { p: page, cat_id: this.catObj.cat_id, keyword: this.keyword };
  599. post("v1/cashback/duoduoList", data)
  600. .then((res) => {
  601. uni.hideLoading();
  602. if (res.code === 0) {
  603. let obj = JSON.parse(res.data).goods_search_response.goods_list;
  604. console.log(obj);
  605. if (page <= 1) that.goods = [];
  606. if (obj.length > 0) {
  607. obj.forEach((e) => {
  608. that.goods.push(e);
  609. });
  610. } else {
  611. if (page == 1) {
  612. that.haveGoods = true;
  613. page = -1;
  614. } else {
  615. page = -1;
  616. this.$toast("暂无更多");
  617. }
  618. }
  619. } else {
  620. if (page == 1) {
  621. that.haveGoods = true;
  622. page = -1;
  623. } else {
  624. page = -1;
  625. this.$toast("暂无更多");
  626. }
  627. }
  628. })
  629. .catch((e) => {
  630. uni.hideLoading();
  631. });
  632. } else if (this.platformObj.type == 2) {
  633. this.catObj.cat_name
  634. ? (data = {
  635. p: page,
  636. cat: this.catObj.cat_name,
  637. keyword: this.keyword,
  638. })
  639. : (data = { p: page, keyword: this.keyword });
  640. post("v1/cashback/taobaoList", data)
  641. .then((res) => {
  642. uni.hideLoading();
  643. if (res.code === 0) {
  644. console.log(JSON.parse(res.data));
  645. let obj = JSON.parse(res.data)
  646. .tbk_dg_material_optional_upgrade_response.result_list.map_data;
  647. console.log(obj);
  648. obj.map((i) => {
  649. let arr =
  650. i.price_promotion_info?.final_promotion_path_list
  651. ?.final_promotion_path_map_data || [];
  652. if (arr.length > 0) {
  653. for (let ii = 0; ii < arr.length; ii++) {
  654. if (arr[ii].promotion_title == "商品券") {
  655. i.coupon_discount = arr[ii].promotion_fee;
  656. i.promotion_start_time = arr[ii].promotion_start_time;
  657. i.promotion_end_time = arr[ii].promotion_end_time;
  658. }
  659. }
  660. } else {
  661. i.coupon_discount = 0;
  662. i.promotion_start_time = 0;
  663. i.promotion_end_time = 0;
  664. }
  665. return i;
  666. });
  667. if (page <= 1) that.goods = [];
  668. if (obj.length > 0) {
  669. obj.forEach((e) => {
  670. that.goods.push(e);
  671. });
  672. } else {
  673. if (page == 1) {
  674. that.haveGoods = true;
  675. page = -1;
  676. } else {
  677. page = -1;
  678. this.$toast("暂无更多");
  679. }
  680. }
  681. } else {
  682. if (page == 1) {
  683. that.haveGoods = true;
  684. page = -1;
  685. } else {
  686. page = -1;
  687. this.$toast("暂无更多");
  688. }
  689. }
  690. })
  691. .catch((e) => {
  692. uni.hideLoading();
  693. });
  694. } else if (this.platformObj.type == 3) {
  695. this.catObj.cat_name
  696. ? (data = {
  697. p: page,
  698. cat_id: this.catObj.cat_id,
  699. keyword: this.keyword,
  700. })
  701. : (data = { p: page, keyword: this.keyword });
  702. post("v1/cashback/jingdongList", data)
  703. .then((res) => {
  704. uni.hideLoading();
  705. if (res.code === 0) {
  706. let obj = JSON.parse(
  707. res.data.jd_union_open_goods_query_responce.queryResult
  708. ).data;
  709. console.log(obj);
  710. obj.map((i) => {
  711. if (i.couponInfo.couponList.length > 0) {
  712. let arr = i.couponInfo.couponList;
  713. for (let ii = 0; ii < arr.length; ii++) {
  714. if (arr[ii].isBest == 1) {
  715. i.coupon_discount = arr[ii].discount;
  716. i.promotion_start_time = arr[ii].useStartTime;
  717. i.promotion_end_time = arr[ii].useEndTime;
  718. } else {
  719. let couponInfo = i.couponInfo.couponList[0] || {};
  720. i.coupon_discount = couponInfo.discount || 0;
  721. i.promotion_start_time = couponInfo.useStartTime || 0;
  722. i.promotion_end_time = couponInfo.useEndTime || 0;
  723. }
  724. }
  725. } else {
  726. i.coupon_discount = 0;
  727. i.promotion_start_time = 0;
  728. i.promotion_end_time = 0;
  729. }
  730. return i;
  731. });
  732. if (page <= 1) that.goods = [];
  733. if (obj.length > 0) {
  734. obj.forEach((e) => {
  735. that.goods.push(e);
  736. });
  737. } else {
  738. if (page == 1) {
  739. that.haveGoods = true;
  740. page = -1;
  741. } else {
  742. page = -1;
  743. this.$toast("暂无更多");
  744. }
  745. }
  746. } else {
  747. if (page == 1) {
  748. that.haveGoods = true;
  749. page = -1;
  750. } else {
  751. page = -1;
  752. this.$toast("暂无更多");
  753. }
  754. }
  755. })
  756. .catch((e) => {
  757. uni.hideLoading();
  758. });
  759. } else if (this.platformObj.type == 5) {
  760. let { lat, lng } = await uni.Location();
  761. this.catObj.cat_name
  762. ? (data = {
  763. pageNo: page,
  764. listTopiId: this.catObj.cat_id,
  765. searchText: this.keyword,
  766. latitude: lat,
  767. longitude: lng,
  768. })
  769. : (data = {
  770. pageNo: page,
  771. searchText: this.keyword,
  772. latitude: lat,
  773. longitude: lng,
  774. listTopiId: 2,
  775. });
  776. console.log(data);
  777. uni.request({
  778. url: "https://meituan-java.chafubao.cn/query_coupon", //仅为示例,并非真实接口地址。
  779. method: "POST",
  780. header: {
  781. token: uni.getStorageSync("token"),
  782. "Content-Type": "application/x-www-form-urlencoded",
  783. },
  784. data: data,
  785. success: (res) => {
  786. uni.hideLoading();
  787. console.log(res.data);
  788. if (res.data.statusCode === 200) {
  789. let obj = JSON.parse(
  790. res.data.body
  791. ).data;
  792. console.log(obj);
  793. if (page <= 1) that.goods = [];
  794. if (obj.length > 0) {
  795. obj.forEach((e) => {
  796. that.goods.push(e);
  797. });
  798. } else {
  799. if (page == 1) {
  800. that.haveGoods = true;
  801. page = -1;
  802. } else {
  803. page = -1;
  804. this.$toast("暂无更多");
  805. }
  806. }
  807. } else {
  808. if (page == 1) {
  809. that.haveGoods = true;
  810. page = -1;
  811. } else {
  812. page = -1;
  813. this.$toast("暂无更多");
  814. }
  815. }
  816. },
  817. fail: (error) => {
  818. uni.hideLoading();
  819. }
  820. });
  821. } else if (this.platformObj.type == 8) {
  822. let that = this;
  823. let data = { page, type: 4, category_id: 11 };
  824. post("v1/goods/categoryInfo", data).then((res) => {
  825. if (res.code === 0) {
  826. let obj = res.data.data.data;
  827. console.log(obj);
  828. if (page <= 1) that.goods = [];
  829. if (obj.length > 0) {
  830. obj.forEach((e) => {
  831. that.goods.push(e);
  832. });
  833. } else {
  834. if (page == 1) {
  835. that.haveGoods = true;
  836. page = -1;
  837. } else {
  838. page = -1;
  839. this.$toast("暂无更多");
  840. }
  841. }
  842. uni.hideLoading();
  843. } else {
  844. if (page == 1) {
  845. that.haveGoods = true;
  846. page = -1;
  847. } else {
  848. page = -1;
  849. this.$toast("暂无更多");
  850. }
  851. uni.hideLoading();
  852. }
  853. });
  854. }
  855. },
  856. toPlatform(i,s) {
  857. if(i.url) {
  858. this.goto(i.url + '&name=' + i.name)
  859. } else {
  860. this.changeNav(i, s);
  861. }
  862. },
  863. // 跳转到商品详情页
  864. NavToGoodsDetail(item) {
  865. if (this.platformObj.type == 1) {
  866. this.goto("/pagesC/shoppingMallType/p_details", {
  867. goods_sign: item.goods_sign,
  868. type: this.platformObj.type,
  869. });
  870. } else if (this.platformObj.type == 2) {
  871. this.goto("/pagesC/shoppingMallType/p_details", {
  872. item_id: item.item_id,
  873. type: this.platformObj.type,
  874. annual_vol: item.item_basic_info.annual_vol,
  875. yj_price:
  876. Math.floor(
  877. ((item.price_promotion_info.final_promotion_price *
  878. item.publish_info.income_rate) /
  879. 100) *
  880. this.platformObj.ratio *
  881. 100
  882. ) / 100 || 0,
  883. goods_price: item.price_promotion_info.final_promotion_price,
  884. coupon_discount: item.coupon_discount,
  885. promotion_start_time: item.promotion_start_time,
  886. promotion_end_time: item.promotion_end_time,
  887. });
  888. } else if (this.platformObj.type == 3) {
  889. console.log(item);
  890. this.goto("/pagesC/shoppingMallType/p_details", {
  891. item_id: item.itemId,
  892. type: this.platformObj.type,
  893. annual_vol: item.inOrderCount30Days,
  894. yj_price:
  895. Math.floor(
  896. ((item.priceInfo.lowestCouponPrice *
  897. item.commissionInfo.commissionShare) /
  898. 100) *
  899. this.platformObj.ratio *
  900. 100
  901. ) / 100 || 0,
  902. goods_price: item.priceInfo.lowestCouponPrice,
  903. goods_price_origin: item.priceInfo.price,
  904. coupon_discount: item.coupon_discount,
  905. shopName: item.shopInfo.shopName,
  906. promotion_start_time: item.promotion_start_time,
  907. promotion_end_time: item.promotion_end_time,
  908. });
  909. } else if (this.platformObj.type == 8) {
  910. this.goto("/pages/product/p_details", { id: item.id, type: 4 });
  911. }
  912. },
  913. copyMt(item){
  914. uni.request({
  915. url: "https://meituan-java.chafubao.cn/get_referral_link",
  916. method: "POST",
  917. header: {
  918. token: uni.getStorageSync("token"),
  919. "Content-Type": "application/x-www-form-urlencoded",
  920. },
  921. data: {
  922. skuViewId: item.couponPackDetail.skuViewId,
  923. linkType: 2,
  924. sid: uni.getStorageSync("userinfo").user_id
  925. },
  926. success: (res) => {
  927. uni.hideLoading();
  928. console.log(res.data);
  929. if (res.data.statusCode === 200) {
  930. let url = JSON.parse(
  931. res.data.body
  932. ).data;
  933. uniCopy({
  934. content: url,
  935. success: (res1) => {
  936. uni.showToast({
  937. title: "链接已复制",
  938. icon: "none",
  939. duration: 2000,
  940. });
  941. },
  942. error: (e) => {},
  943. });
  944. }
  945. },
  946. fail: (error) => {
  947. uni.hideLoading();
  948. }
  949. });
  950. },
  951. // 前往美团小程序
  952. toMt(item){
  953. uni.request({
  954. url: "https://meituan-java.chafubao.cn/get_referral_link",
  955. method: "POST",
  956. header: {
  957. token: uni.getStorageSync("token"),
  958. "Content-Type": "application/x-www-form-urlencoded",
  959. },
  960. data: {
  961. skuViewId: item.couponPackDetail.skuViewId,
  962. linkType: 4,
  963. sid: uni.getStorageSync("userinfo").user_id
  964. },
  965. success: (res) => {
  966. uni.hideLoading();
  967. console.log(res.data);
  968. if (res.data.statusCode === 200) {
  969. let url = JSON.parse(
  970. res.data.body
  971. ).data;
  972. wx.navigateToMiniProgram({
  973. appId: "wxde8ac0a21135c07d",
  974. path: url,
  975. extraData: {
  976. },
  977. envVersion: "release",
  978. success(res) {
  979. // 打开成功
  980. // _this.$refs.popup.close();
  981. },
  982. });
  983. }
  984. },
  985. fail: (error) => {
  986. uni.hideLoading();
  987. }
  988. });
  989. }
  990. },
  991. //页面上拉触底事件的处理函数
  992. onReachBottom() {
  993. if (page != -1) {
  994. setTimeout(() => {
  995. ++page;
  996. this.goodsDay();
  997. }, 500);
  998. }
  999. },
  1000. };
  1001. </script>
  1002. <style lang="scss" scoped>
  1003. // 页面配置
  1004. page {
  1005. background: #f5f5f5;
  1006. }
  1007. .head {
  1008. width: 100%;
  1009. height: 160rpx;
  1010. text-align: center;
  1011. position: fixed;
  1012. top: 0;
  1013. z-index: 999;
  1014. // padding: calc(var(--status-bar-height) + 50rpx) 0 36rpx;
  1015. background: #fff;
  1016. .title {
  1017. font-size: 16px;
  1018. font-weight: 600;
  1019. padding-top: calc(var(--status-bar-height) + 46rpx);
  1020. }
  1021. }
  1022. // 页面配置-end
  1023. .product-list {
  1024. width: 100%;
  1025. display: flex;
  1026. flex-wrap: wrap;
  1027. flex-direction: row;
  1028. padding: 0 30rpx;
  1029. .product {
  1030. width: 48.5%;
  1031. margin-bottom: 20rpx;
  1032. padding-bottom: 12rpx;
  1033. border-radius: 10rpx;
  1034. box-shadow: 4rpx 4rpx 8rpx 4rpx rgba(0, 0, 0, 0.06);
  1035. background-color: #fff;
  1036. &:nth-child(2n) {
  1037. margin-left: 3%;
  1038. }
  1039. }
  1040. .type5{
  1041. width: 100%;
  1042. margin-bottom: 20rpx;
  1043. padding: 12rpx;
  1044. border-radius: 10rpx;
  1045. box-shadow: 4rpx 4rpx 8rpx 4rpx rgba(0, 0, 0, 0.06);
  1046. background-color: #fff;
  1047. &:nth-child(2n) {
  1048. margin-left: 0%;
  1049. }
  1050. .product-image {
  1051. border-radius: 10rpx;
  1052. width: 29vw;
  1053. height: 29vw;
  1054. object-fit: cover;
  1055. }
  1056. .content-view {
  1057. width: calc(100% - 29vw);
  1058. padding: 0 16rpx;
  1059. box-sizing: border-box;
  1060. }
  1061. .shop {
  1062. font-size: 22rpx;
  1063. color: #c4c4c4;
  1064. }
  1065. .buyed {
  1066. color: #888888;
  1067. font-size: 22rpx;
  1068. margin: 16rpx 0 4rpx;
  1069. }
  1070. .quan_box {
  1071. min-height: 0;
  1072. font-size: 20rpx;
  1073. color: #e90406;
  1074. margin: 12rpx 0 14rpx;
  1075. }
  1076. .mtBtn1{
  1077. width: 45%;
  1078. color: #FE6232;
  1079. text-align: center;
  1080. font-size: 26rpx;
  1081. font-weight: bold;
  1082. letter-spacing: 2rpx;
  1083. padding: 10rpx 0;
  1084. border-radius: 50rpx;
  1085. border: 1rpx solid #FE6232;
  1086. margin-top: 15rpx;
  1087. }
  1088. .mtBtn2{
  1089. width: 45%;
  1090. color: #fff;
  1091. text-align: center;
  1092. font-size: 26rpx;
  1093. font-weight: bold;
  1094. letter-spacing: 2rpx;
  1095. padding: 10rpx 0;
  1096. border-radius: 50rpx;
  1097. border: 1rpx solid #FE6232;
  1098. background-color: #FE6232;
  1099. margin-top: 15rpx;
  1100. }
  1101. }
  1102. .product-image {
  1103. border-radius: 10rpx 10rpx 0 0;
  1104. width: 100%;
  1105. height: 42.3vw;
  1106. object-fit: cover;
  1107. }
  1108. .content-view {
  1109. padding: 0 16rpx;
  1110. }
  1111. .product-title {
  1112. width: 100%;
  1113. overflow: hidden;
  1114. line-height: 1.5;
  1115. font-size: 26rpx;
  1116. height: 80rpx;
  1117. font-weight: bold;
  1118. color: #121212;
  1119. }
  1120. .product-type {
  1121. font-size: 16rpx;
  1122. font-weight: bold;
  1123. color: #fff;
  1124. height: 26rpx;
  1125. display: inline-block;
  1126. line-height: 26rpx;
  1127. padding: 0 8rpx;
  1128. border-radius: 4rpx;
  1129. margin-right: 16rpx;
  1130. background-color: #e90406;
  1131. }
  1132. .product-price {
  1133. color: #121212;
  1134. font-size: 28rpx;
  1135. // position: relative;
  1136. margin: 16rpx 0 4rpx;
  1137. }
  1138. .product-price-original {
  1139. color: #000;
  1140. font-size: 32rpx;
  1141. font-weight: bold;
  1142. &:before {
  1143. content: "¥";
  1144. font-size: 20rpx;
  1145. }
  1146. }
  1147. .product-price-original1 {
  1148. color: #18bb88;
  1149. font-size: 32rpx;
  1150. font-weight: bold;
  1151. &:before {
  1152. content: "¥";
  1153. font-size: 20rpx;
  1154. }
  1155. }
  1156. .quan_box {
  1157. min-height: 88rpx;
  1158. font-size: 20rpx;
  1159. color: #e90406;
  1160. margin: 12rpx 0 0;
  1161. .quan {
  1162. padding: 2rpx 8rpx;
  1163. border-radius: 8rpx;
  1164. border: 1rpx solid rgba($color: #e90406, $alpha: 0.3);
  1165. margin-right: 10rpx;
  1166. margin-top: 6rpx;
  1167. .pl {
  1168. padding-right: 10rpx;
  1169. }
  1170. }
  1171. }
  1172. .product-price-favour {
  1173. color: #888888;
  1174. font-size: 22rpx;
  1175. text-decoration: line-through;
  1176. // margin-left: 20rpx;
  1177. }
  1178. .product-tip {
  1179. position: absolute;
  1180. right: 20rpx;
  1181. background-color: #ff3333;
  1182. color: #ffffff;
  1183. padding: 0 20rpx;
  1184. border-radius: 10rpx;
  1185. }
  1186. .product-unit {
  1187. font-size: 24rpx;
  1188. color: #18bb88;
  1189. }
  1190. .product-txt,
  1191. .product-text {
  1192. font-size: 22rpx;
  1193. color: #787878;
  1194. .iconfont {
  1195. margin-right: 6rpx;
  1196. }
  1197. }
  1198. .product-text {
  1199. margin-left: 16rpx;
  1200. }
  1201. .red {
  1202. color: #fa2e18;
  1203. }
  1204. .fenxiang {
  1205. font-size: 20rpx;
  1206. background: rgba(250, 46, 24, 0.08);
  1207. display: inline-block;
  1208. border-radius: 6rpx;
  1209. padding: 0 16rpx;
  1210. }
  1211. }
  1212. // 活动-end
  1213. .l_tabBar {
  1214. // height: 400rpx;
  1215. flex-wrap: wrap;
  1216. padding: 10rpx 20rpx;
  1217. border-radius: 10rpx;
  1218. margin: 0 0 30rpx;
  1219. // background: url("https://img1.baidu.com/it/u=3052557249,4146060588&fm=253&fmt=auto&app=138&f=JPEG?w=1000&h=465")
  1220. // no-repeat;
  1221. // background-size: 100% 100%;
  1222. .search-box {
  1223. width: 100%;
  1224. padding: 10rpx;
  1225. // margin-top: 68rpx;
  1226. margin-bottom: 12rpx;
  1227. .district {
  1228. font-size: 32rpx;
  1229. font-weight: 600;
  1230. color: #333;
  1231. .iconfont {
  1232. font-size: 20rpx;
  1233. margin-left: 12rpx;
  1234. }
  1235. }
  1236. .search {
  1237. border: 1px solid #d78c2e;
  1238. height: 60rpx;
  1239. line-height: 60rpx;
  1240. padding-left: 20rpx;
  1241. border-radius: 31rpx;
  1242. background-color: #fff;
  1243. .iconfont {
  1244. font-size: 30rpx;
  1245. }
  1246. .inp {
  1247. font-size: 25rpx;
  1248. padding: 0 8rpx;
  1249. width: 500rpx;
  1250. }
  1251. .search_btn {
  1252. background-color: #d78c2e;
  1253. height: 100%;
  1254. color: #fff;
  1255. border-radius: 31rpx;
  1256. font-size: 28rpx;
  1257. padding: 0 28rpx;
  1258. }
  1259. }
  1260. .scan-ico {
  1261. font-size: 55rpx;
  1262. }
  1263. }
  1264. }
  1265. .nav_box {
  1266. margin: -50rpx 0 10rpx;
  1267. padding: 20rpx 20rpx;
  1268. border-radius: 20rpx;
  1269. flex-wrap: wrap;
  1270. justify-content: space-between;
  1271. background-color: #f5f6f8;
  1272. .item {
  1273. width: 17%;
  1274. margin: 10rpx 10rpx;
  1275. }
  1276. .ico {
  1277. width: 62rpx;
  1278. height: 62rpx;
  1279. }
  1280. .tit {
  1281. font-size: 24rpx;
  1282. padding-top: 12rpx;
  1283. }
  1284. .tit1 {
  1285. font-size: 20rpx;
  1286. color: #a0a0a0;
  1287. }
  1288. }
  1289. .nav {
  1290. width: 25%;
  1291. height: 40rpx;
  1292. line-height: 40rpx;
  1293. text-align: center;
  1294. font-size: 28rpx;
  1295. color: #a0a0a0;
  1296. margin-bottom: 16rpx;
  1297. }
  1298. .nav:nth-child(2) {
  1299. border-left: 1rpx solid rgba($color: #a0a0a0, $alpha: 0.5);
  1300. border-right: 1rpx solid rgba($color: #a0a0a0, $alpha: 0.5);
  1301. }
  1302. .nav:nth-child(3) {
  1303. border-right: 1rpx solid rgba($color: #a0a0a0, $alpha: 0.5);
  1304. }
  1305. .nav:nth-child(4) {
  1306. border-right: 1rpx solid rgba($color: #a0a0a0, $alpha: 0.5);
  1307. }
  1308. .nav-active {
  1309. color: #1f1f1f;
  1310. }
  1311. .sort_box {
  1312. // position: sticky;
  1313. position: -webkit-sticky;
  1314. top: 110rpx;
  1315. z-index: 999;
  1316. left: 0;
  1317. overflow: scroll;
  1318. flex-wrap: nowrap;
  1319. padding: 16rpx 0;
  1320. margin: 0 30rpx 10rpx;
  1321. background-color: #f5f6f8;
  1322. .sort {
  1323. white-space: nowrap;
  1324. font-size: 23rpx;
  1325. color: #a0a0a0;
  1326. padding: 6rpx 15rpx;
  1327. border-radius: 6rpx;
  1328. border: 1rpx solid #fff;
  1329. margin-right: 14rpx;
  1330. background-color: #fff;
  1331. }
  1332. .sort-active {
  1333. color: #15acda;
  1334. border: 1rpx solid rgba($color: #58b0d9, $alpha: 0.5);
  1335. background-color: rgba($color: #e3f3fd, $alpha: 1);
  1336. }
  1337. }
  1338. .container {
  1339. overflow: visible;
  1340. }
  1341. /* 隐藏滚动条 */
  1342. ::-webkit-scrollbar {
  1343. display: none;
  1344. }
  1345. </style>