selectionsquare.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467
  1. <template>
  2. <view class="nav">
  3. <view class="bg_box" style="background-color: #FFFFFF;" :style="{
  4. backgroundImage: mysNavConfig.bgImage,
  5. paddingTop: navBarTop,
  6. height: navBarHeight,
  7. opacity: opacity,
  8. }" :class="{ fixed: mysNavConfig.navFixed }"></view>
  9. <view class="mys_navBar" :style="{
  10. paddingTop: navBarTop,
  11. height: navBarHeight,
  12. paddingRight: navBarRight,
  13. }" :class="{ fixed: mysNavConfig.navFixed }">
  14. <!-- 左slot -->
  15. <view class="my_left_custom" :style="{ height: btnHeight }">
  16. <slot name="left"></slot>
  17. </view>
  18. <view class="btn_type" :style="{ height: btnHeight }">
  19. <view class="btn_box nav_btn_t1" :style="{
  20. width: btnWidth,
  21. height: btnHeight,
  22. marginLeft: navBarLeft,
  23. borderRadius: mysNavConfig.type2Config.radius,
  24. }">
  25. <view class="btn_back" @tap="onLeftClick()">
  26. <image class="nv_icon" :src="mysNavConfig.type2Config.leftPath"
  27. :style="{ height: btnHeight, width: iconW }" mode="aspectFit" />
  28. </view>
  29. <view class="line"></view>
  30. <view class="btn_home" @tap="onLeftHome('top')">
  31. <image class="nv_icon" :src="mysNavConfig.type2Config.rightPath"
  32. :style="{ height: btnHeight, width: iconW }" mode="aspectFit" />
  33. </view>
  34. </view>
  35. <!-- 标题 -->
  36. <view class="title_container" v-if="!mysNavConfig.searchConfig"
  37. :style="{ top: navBarTop, height: btnHeight }">
  38. <text class="title_text" v-if="!!mysNavConfig.navTitle" :style="{
  39. color: mysNavConfig.navTitle.color,
  40. fontSize: mysNavConfig.navTitle.fontSize,
  41. fontWeight: mysNavConfig.navTitle.fontWeight,
  42. }">{{ mysNavConfig.navTitle.text }}</text>
  43. <slot name="center2"></slot>
  44. </view>
  45. </view>
  46. </view>
  47. <aTip text="点击添加到我的小程序 \n下次访问更方便哦!" isCustom="true" />
  48. <view :style="{marginTop:navH}"></view>
  49. <view class="home">
  50. <view>
  51. <!-- 多选框弹窗 -->
  52. <uni-popup ref="popup" background-color="#fff">
  53. <view class="popup-content" :class="{ 'popup-height': type === 'left' || type === 'right' }">
  54. <!-- <view class="option1" style="margin-top: 20%;">
  55. <h3 style="margin-bottom: 10rpx;">社媒平台</h3>
  56. <uni-data-checkbox mode="tag" multiple v-model="formData.hobby" :localdata="hobby">
  57. </uni-data-checkbox>
  58. </view>
  59. <view class="option2">
  60. <h3 style="margin-bottom: 10rpx;">样品形式</h3>
  61. <uni-data-checkbox mode="tag" multiple v-model="formData.hobby1" :localdata="hobby1">
  62. </uni-data-checkbox>
  63. </view>
  64. <view class="option3">
  65. <h3 style="margin-bottom: 10rpx;">任务形式</h3>
  66. <uni-data-checkbox mode="tag" multiple v-model="formData.hobby2" :localdata="hobby2">
  67. </uni-data-checkbox>
  68. </view> -->
  69. <view class="option1" style="margin-top: 20%;">
  70. <h3 style="margin-bottom: 10rpx;font-weight: bold;"><strong>样品形式</strong></h3>
  71. <uni-data-checkbox mode="tag" multiple v-model="formData.hobby1" :localdata="hobby1">
  72. </uni-data-checkbox>
  73. </view>
  74. <view class="option2">
  75. <h3 style="margin-bottom: 10rpx;font-weight: bold;">任务形式</h3>
  76. <uni-data-checkbox mode="tag" multiple v-model="formData.hobby2" :localdata="hobby2">
  77. </uni-data-checkbox>
  78. </view>
  79. <view class="option3">
  80. <h3 style="margin-bottom: 10rpx;font-weight: bold;">商品类目</h3>
  81. <uni-data-checkbox mode="tag" multiple v-model="formData.hobby3" :localdata="hobby3">
  82. </uni-data-checkbox>
  83. </view>
  84. <view class="butto">
  85. <button class="mini-btn" size="mini" @tap="reset">重置</button>
  86. <button class="mini-btn" size="mini" @tap="submitSearch">确定</button>
  87. </view>
  88. </view>
  89. </uni-popup>
  90. </view>
  91. <!-- banner -->
  92. <view class="uni-margin-wrap">
  93. <swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay"
  94. :interval="interval" :duration="duration">
  95. <swiper-item v-for="item in list1" @click="pick(item)">
  96. <image :src="item.img" mode="scaleToFill" style="width: 100%;height: 100%;"></image>
  97. </swiper-item>
  98. </swiper>
  99. </view>
  100. <!-- 商品卡片细节 -->
  101. <view class="commodity" style="margin-top: 3%;">
  102. <view class="project" v-for="(item,index) in selectionList" :key="index" @tap="toDetail(item)">
  103. <!-- 主图 -->
  104. <view class="projectdiagram" :style="{backgroundImage:`url(${item.coverphoto})`}">
  105. <view class="Mask" v-if="item.isFinished">
  106. <image src="https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/home4.png" mode="">
  107. </image>
  108. </view>
  109. <view v-else>
  110. <view class="Mask" v-if="item.isLacked">
  111. <image src="https://horastar.obs.cn-east-3.myhuaweicloud.com/talent_upload/lack.png"
  112. mode="">
  113. </image>
  114. </view>
  115. </view>
  116. <view style="padding-left: 4%;padding-top: 2%;">
  117. </view>
  118. </view>
  119. <!-- 项目信息1 -->
  120. <view class="section">
  121. <view class="section1">
  122. <p>佣金:{{item.exclusive_commission}}%</p>
  123. </view>
  124. <view class="section2" v-if="item.task_mode == 1">
  125. <p>额外悬赏:¥{{item.show_task_reward}}</p>
  126. </view>
  127. </view>
  128. <!-- 平台logo、项目名称 -->
  129. <view class="projecttext">
  130. <image :src="item.platform_icon">
  131. </image>
  132. <span>{{item.selection_name|ellipsis}}</span>
  133. </view>
  134. <!-- 项目信息2 -->
  135. <view class="projectinfo">
  136. <view class="projectinfotxt">
  137. <p>预估赚:<span style="color: red;">¥{{item.show_earn}}</span></p>
  138. </view>
  139. <view class="projectinfotxt">
  140. <p>售价:<span style="color: red;">¥{{item.price}}</span></p>
  141. </view>
  142. </view>
  143. <!-- 项目信息3 -->
  144. <view class="projectinfo" style="justify-content: space-between;">
  145. <view class="projectinfotag">
  146. <view class="TitleText" v-if="item.sample_mode == 1">
  147. <p>免费领</p>
  148. </view>
  149. <view class="TitleText" style="background-color: #fcca00;" v-if="item.sample_mode !== 1">
  150. <p>查看</p>
  151. </view>
  152. </view>
  153. <view class="projectinfotxt" style="margin: 0 10rpx;" v-if="item.sample_mode == 1">
  154. <p>余<span style="color: #52b2f0;">{{item.remain_num}}</span>件</p>
  155. </view>
  156. </view>
  157. </view>
  158. </view>
  159. <!-- 普通弹窗 公众号-->
  160. <uni-popup ref="popup4" class="share" background-color="#fff" :maskClick="false">
  161. <view class="popup-content" :class="{ 'popup-height': type === 'left' || type === 'right' }">
  162. <view class="sharepage">
  163. <view class="projecttext1">
  164. <image src="https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/younggee_logo.png"
  165. style="width: 250rpx; height: 80rpx;" mode=""></image>
  166. <!-- <span>YoungGee</span> -->
  167. </view>
  168. <view class="sharemap">
  169. <image :src="kefuUrl" style="width: 400rpx;height: 400rpx;" mode=""></image>
  170. </view>
  171. <view style="margin: 30rpx 0;">
  172. <button class="butmin1" size="mini" @tap="saveImage">保存二维码</button>
  173. </view>
  174. <view class="sharetxt">
  175. <text>
  176. 使用样叽的过程中,有任何疑问,\n
  177. 请添加上方微信。\n
  178. 我们保证及时全力为您解决!
  179. </text>
  180. </view>
  181. <view style="margin: 30rpx 0;">
  182. <button class="butmin" size="mini" @tap="closepop">知道了</button>
  183. </view>
  184. </view>
  185. </view>
  186. </uni-popup>
  187. <view class="contact" @click="toggle4('center')">
  188. <view class="contt">
  189. <!-- <image class="img2" src="https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/home2.png" mode=""></image> -->
  190. <image class="img1"
  191. src="https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/kefu_20211124192542.png" mode="">
  192. </image>
  193. </view>
  194. </view>
  195. </view>
  196. </view>
  197. </view>
  198. </template>
  199. <script>
  200. import aTip from "@/components/mys-tip_1.0.01/a_tip/aTip";
  201. import {
  202. getQueryString,
  203. fansview,
  204. money,
  205. getDaysBetweenDates,
  206. getDaysAndHoursBetweenDates
  207. } from '@/components/utils.js';
  208. import {
  209. saveImageToPhotosAlbum,
  210. showToast,
  211. downloadFile
  212. } from '@/uni_modules/sakura-canvas/js_sdk/util'
  213. export default {
  214. // 父组件向子组件传值 props
  215. props: {
  216. mysNavConfig: {
  217. type: Object,
  218. default () {
  219. return {
  220. /* 固定导航 */
  221. navFixed: true,
  222. /* 开启单页显示首页图标 */
  223. isHome: true,
  224. /* 占位开启 */
  225. navPadding: true,
  226. /* 背景 */
  227. bgColor: "#f8f8f8",
  228. /* 渐变色 */
  229. opacity: 1,
  230. /* 渐变开启 */
  231. isOpacity: false,
  232. /* 渐变延时效果 */
  233. opacityTime: 100,
  234. /* 左侧按钮样式 可选 type1 type2 (type2根据小程序胶囊位置调整) */
  235. btnType: "type1",
  236. /* type1 左侧文字配置 */
  237. leftText: {
  238. text: "",
  239. color: "",
  240. fontSize: "16px", // px upx rpx
  241. fontWeight: "", // blod
  242. },
  243. /* 标题 */
  244. navTitle: {
  245. text: "带货",
  246. color: "",
  247. fontSize: "32rpx", // px upx rpx
  248. fontWeight: "normal", // blod
  249. },
  250. /* type2 按钮 */
  251. type2Config: {
  252. // 左图标
  253. leftPath: "https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/png3.png",
  254. // 右图标
  255. rightPath: "https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/png1.png",
  256. // 圆角
  257. radius: "40rpx",
  258. },
  259. };
  260. },
  261. },
  262. scrollTop: {
  263. type: Number,
  264. default: function() {
  265. return 0;
  266. },
  267. },
  268. },
  269. filters: {
  270. ellipsis(value) {
  271. if (!value) return "";
  272. if (value.length > 20) {
  273. return value.slice(0, 20) + "...";
  274. }
  275. return value;
  276. },
  277. },
  278. components: {
  279. aTip
  280. },
  281. data() {
  282. return {
  283. // nav
  284. navH: getApp().globalData.navHeight,
  285. kefuUrl: "https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/kefu.jpeg",
  286. iconW: undefined,
  287. iconH: undefined,
  288. btnWidth: undefined,
  289. btnHeight: undefined,
  290. navBarTop: undefined,
  291. navBarHeight: undefined,
  292. navBarLeft: undefined,
  293. navBarRight: undefined,
  294. inputHeight: undefined,
  295. // banner
  296. indicatorDots: true,
  297. autoplay: true,
  298. interval: 3000,
  299. duration: 1000,
  300. // 旧多选框
  301. /*formData: {
  302. hobby: [],
  303. hobby1: [],
  304. hobby2: [],
  305. },
  306. hobby: [{
  307. text: '红book',
  308. value: 1
  309. }, {
  310. text: '抖音',
  311. value: 2
  312. }, {
  313. text: '微博',
  314. value: 3
  315. }, {
  316. text: '快手',
  317. value: 4
  318. }, {
  319. text: 'B站',
  320. value: 5
  321. }, {
  322. text: '大众点评',
  323. value: 6
  324. }, {
  325. text: '知乎',
  326. value: 7
  327. }],
  328. hobby1: [{
  329. text: '免费领样',
  330. value: 1
  331. }, {
  332. text: '垫付后返',
  333. value: 2
  334. }, {
  335. text: '不提供样品',
  336. value: 3
  337. }],
  338. hobby2: [{
  339. text: '悬赏任务',
  340. value: 1
  341. }, {
  342. text: '纯佣带货',
  343. value: 2
  344. }], */
  345. // 多选框
  346. formData: {
  347. hobby1: [], //样品形式
  348. hobby2: [], //任务形式
  349. hobby3: [], //商品类目
  350. },
  351. //平台种类直接从表中获得,此版本中只有抖音平台
  352. hobby: [],
  353. hobby1: [{
  354. text: '免费领样',
  355. value: 1
  356. }, {
  357. text: '不提供样品',
  358. value: 3
  359. }],
  360. hobby2: [{
  361. text: '悬赏任务',
  362. value: 1
  363. }, {
  364. text: '纯佣带货',
  365. value: 2
  366. }],
  367. hobby3: [{
  368. text: '智能家居',
  369. value: 1
  370. }, {
  371. text: '食品饮料',
  372. value: 2
  373. }, {
  374. text: '珠宝文玩',
  375. value: 3
  376. }, {
  377. text: ' 奢侈品',
  378. value: 4
  379. }, {
  380. text: '个户家清',
  381. value: 5
  382. }, {
  383. text: '礼品文创',
  384. value: 6
  385. }, {
  386. text: '\u3000生鲜\u3000',
  387. value: 7
  388. }, {
  389. text: '农资绿植',
  390. value: 8
  391. }, {
  392. text: '本地生活',
  393. value: 9
  394. }, {
  395. text: '钟表配饰',
  396. value: 10
  397. }, {
  398. text: '玩具乐器',
  399. value: 11
  400. }, {
  401. text: '二手闲置',
  402. value: 12
  403. }, {
  404. text: '服饰内衣',
  405. value: 13
  406. }, {
  407. text: '\u3000美妆\u3000',
  408. value: 14
  409. }, {
  410. text: '数码家电',
  411. value: 15
  412. }, {
  413. text: '图书教育',
  414. value: 16
  415. }, {
  416. text: '鞋靴箱包',
  417. value: 17
  418. }, {
  419. text: '母婴宠物',
  420. value: 18
  421. }, {
  422. text: '虚拟充值',
  423. value: 19
  424. }, {
  425. text: '户外运动',
  426. value: 20
  427. }],
  428. list1: [{
  429. img: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/home1.png',
  430. name: '/page_tasksquare/banner/guide'
  431. },
  432. {
  433. img: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/home7.png',
  434. name: '/page_tasksquare/banner/cooperation'
  435. }
  436. ],
  437. per: 0,
  438. max_page: 0,
  439. filtCondition: '',
  440. selectionList: [],
  441. product: {},
  442. younggeeProductPhoto: {},
  443. }
  444. },
  445. watch: {
  446. scrollTop(val) {
  447. if (!this.mysNavConfig.isOpacity) {
  448. return;
  449. }
  450. this.setOpacity(val, this.mysNavConfig.opacityTime);
  451. },
  452. },
  453. created() {
  454. this.init();
  455. },
  456. //onshow生命周期执行完之后,this内部就有了很多内容
  457. async onShow() {
  458. this.isLoginApi()
  459. await this.getInfoListApi()
  460. this.per = 0
  461. this.selectionList = []
  462. this.getSelectionListApi()
  463. },
  464. async onLoad() {},
  465. //下拉刷新
  466. onPullDownRefresh() {
  467. this.per = 0
  468. this.selectionList = []
  469. this.getSelectionListApi()
  470. //停止下拉刷新
  471. uni.stopPullDownRefresh()
  472. },
  473. // 下拉懒加载
  474. async onReachBottom() {
  475. ++this.per;
  476. if (this.per >= this.max_page) {
  477. uni.showToast({
  478. title: "已加载全部"
  479. })
  480. } else {
  481. uni.showLoading({
  482. title: '加载中'
  483. })
  484. await this.getSelectionListApi()
  485. uni.hideLoading();
  486. }
  487. },
  488. methods: {
  489. /**
  490. * @param scrollTop 页面顶部距离
  491. * @param down 滑动显示效果延时
  492. */
  493. setOpacity(scrollTop, down = 60) {
  494. if (scrollTop > 0) {
  495. if (scrollTop < down) {
  496. this.opacity = scrollTop / down;
  497. }
  498. if (scrollTop > down) {
  499. this.opacity = 1;
  500. }
  501. } else {
  502. this.opacity = 0;
  503. }
  504. },
  505. /* type2 点击分类 */
  506. onLeftHome(type) {
  507. this.type = type
  508. // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
  509. this.$refs.popup.open(type)
  510. },
  511. init() {
  512. if (this.mysNavConfig.isHome) {
  513. let pages = getCurrentPages().length;
  514. /* 单页显示home图标 */
  515. pages === 1 ? (this.isHome = true) : (this.isHome = false);
  516. }
  517. // 开启渐变 强制fixed
  518. this.navBarTop = uni.getSystemInfoSync().statusBarHeight +
  519. "px";
  520. if (!this.mysNavConfig.opacity) {
  521. this.opacity = 1;
  522. !this.mysNavConfig.isOpacity ? (this.opacity = 1) : ((this
  523. .mysNavConfig.navFixed = true), (this
  524. .opacity = 0));
  525. } else {
  526. this.opacity = this.mysNavConfig.opacity;
  527. !this.mysNavConfig.isOpacity ? "" : ((this.mysNavConfig
  528. .navFixed = true), (this.opacity = 0));
  529. }
  530. // #ifdef MP
  531. this.initMP();
  532. // #endif
  533. // #ifdef APP-PLUS-NVUE
  534. this.navBarHeight = 44 + uni.getSystemInfoSync()
  535. .statusBarHeight + "px";
  536. // #endif
  537. },
  538. /* 小程序初始化位置 */
  539. initMP() {
  540. // getSystemInfoSync用于获取系统信息同步接口
  541. let gS = uni.getSystemInfoSync();
  542. // getMenuButtonBoundingClientRect用于获取胶囊按钮位置布局信息
  543. let rect = uni.getMenuButtonBoundingClientRect();
  544. let rectHeight = rect.height;
  545. this.btnWidth = rect.width + "px";
  546. this.btnHeight = rectHeight + "px";
  547. this.iconW = Math.floor(rect.width / 4 - 5) + "px";
  548. this.iconH = rectHeight / 2 + "px";
  549. this.inputHeight = rectHeight - 3 + "px";
  550. this.navBarTop = rect.top + "px";
  551. this.navBarLeft = gS.screenWidth - rect.right + "px";
  552. this.navBarRight = gS.screenWidth - rect.right + rect.width +
  553. "px";
  554. this.navBarHeight = gS.statusBarHeight + rectHeight + (rect
  555. .top - gS.statusBarHeight) * 2 + "px";
  556. },
  557. toDetail(item) {
  558. console.log("item:", item)
  559. uni.navigateTo({
  560. url: '/page_selectionsquare/selectiondetail/selectiondetail?id=' + item.selection_id +
  561. '&pid=' + item.YounggeeProduct[0].product_id
  562. });
  563. },
  564. async submitSearch() {
  565. //被选中的hobby才会加入数据中,加入的是value数字
  566. console.log('look-----', this.formData.hobby1)
  567. console.log('look-----333333', this.formData.hobby3)
  568. this.per = 0;
  569. this.$refs.popup.close()
  570. var filtCondition = ''
  571. //各平台名字展示
  572. // for (var i = 0; i < this.formData.hobby.length; i++) {
  573. // filtCondition += "&platform[]" + "=" + this.formData.hobby[i]
  574. // }
  575. //"&secform[]=" 是一个固定的字符串部分,用来表示参数格式
  576. //最后参数形如&secform[]=2&secform[]=3&secform[]=9
  577. //样品形式
  578. for (var j = 0; j < this.formData.hobby1.length; j++) {
  579. filtCondition += "&secform[]" + "=" + this.formData.hobby1[j]
  580. }
  581. //任务形式
  582. for (var j = 0; j < this.formData.hobby2.length; j++) {
  583. filtCondition += "&taskform[]" + "=" + this.formData.hobby2[j]
  584. }
  585. //商品类目
  586. for (var j = 0; j < this.formData.hobby3.length; j++) {
  587. filtCondition += "&categoryform[]" + "=" + this.formData.hobby3[j]
  588. }
  589. this.filtCondition = filtCondition
  590. console.log("过滤条件",this.filtCondition)
  591. uni.showLoading({
  592. title: '加载中'
  593. });
  594. this.selectionList = []
  595. await this.getSelectionListApi()
  596. uni.hideLoading();
  597. },
  598. async reset() {
  599. this.per = 0;
  600. this.$refs.popup.close()
  601. this.formData.hobby1 = [];
  602. this.formData.hobby2 = [];
  603. this.formData.hobby3 = [];
  604. this.filtCondition = '';
  605. uni.showLoading({
  606. title: '加载中'
  607. });
  608. this.selectionList = []
  609. await this.getSelectionListApi()
  610. uni.hideLoading();
  611. },
  612. /* 点击左侧 */
  613. onLeftClick() {
  614. uni.navigateTo({
  615. url: '/page_selectionsquare/search'
  616. });
  617. },
  618. isLoginApi() {
  619. return this.$https.get('/youngee/c/t/g/is-login')
  620. .then(res => {
  621. if (res.data.code === 403) {
  622. // 登陆已失效
  623. this.token = ""
  624. uni.clearStorage();
  625. } else {
  626. this.token = uni.getStorageSync('token')
  627. }
  628. })
  629. },
  630. //获取一些info表中的信息----包含thirdplatform
  631. //res是一个包含服务器响应的对象
  632. getInfoListApi() {
  633. return this.$http.get('/youngee/c/g/get-info-tables')
  634. .then(res => {
  635. this.hobby = []
  636. this.platformList = res.data.data.ThirdPlatform
  637. let l = this.platformList != null ? this.platformList.length : 0;
  638. for (var i = 0; i < l; i++) {
  639. var obj = {}
  640. obj.text = this.platformList[i].platform_name
  641. obj.value = this.platformList[i].id
  642. this.hobby.push(obj)
  643. }
  644. })
  645. },
  646. getSelectionListApi() {
  647. //idx:当前页 cnt:每页展示个数
  648. return this.$http.get('/youngee/c/g/get-selection-list' +
  649. "?" +
  650. "idx" +
  651. "=" +
  652. this.per +
  653. "&cnt" +
  654. "=" +
  655. 20 + this.filtCondition
  656. //请求发送后,使用 .then() 方法处理响应结果 res。
  657. ).then(res => {
  658. if (res.data.code === 0) {
  659. console.log("res is here------->: ", res)
  660. // 获取res返回数据
  661. this.max_page = res.data.data.max_page
  662. console.log("res")
  663. let selectionList = res.data.data.SelectionDetail
  664. const count = res.data.data.count
  665. // 数据处理
  666. if (selectionList === null) {
  667. return
  668. }
  669. for (var i = 0; i < selectionList.length; i++) {
  670. console.log("**** selectionList[i]****", selectionList[i])
  671. this.product = selectionList[i].YounggeeProduct[0]
  672. this.younggeeProductPhoto = selectionList[i].YounggeeProductPhoto
  673. for (let j = 0; j < this.younggeeProductPhoto.length; ++j) {
  674. //1为主图,2为详情图,3为视频 selectionList[i]就是item
  675. if (this.younggeeProductPhoto[j].symbol == 1) {
  676. selectionList[i].coverphoto = this.younggeeProductPhoto[j].photo_url
  677. }
  678. }
  679. for (var k = 0; k < this.platformList.length; k++) {
  680. if (selectionList[i].platform === this.platformList[k].id) {
  681. selectionList[i].platform_icon = this.platformList[k].platform_icon
  682. }
  683. }
  684. //打印商品详情表
  685. console.log(selectionList[i])
  686. // 商品价格
  687. selectionList[i].price = this.product.product_price
  688. //高佣
  689. selectionList[i].exclusive_commission = this.product.exclusive_commission
  690. //预估赚
  691. selectionList[i].show_earn = this.product.commission_price
  692. //额外悬赏
  693. if (selectionList[i].task_mode == 1) {
  694. selectionList[i].show_task_reward = selectionList[i].RewardStrategy[0].per_reward
  695. }
  696. // 判断是否到期
  697. selectionList[i].isFinished = this.isFinish(selectionList[i])
  698. // 判断是否有库存
  699. selectionList[i].isLacked = selectionList[i].remain_num == 0 ? true : false
  700. }
  701. //...selectionList 是扩展运算符的语法,它会将 selectionList 数组中的所有元素展开,并作为单独的参数传递给 push() 方法
  702. //用于在原有数据的基础上添加新的数据
  703. this.selectionList.push(...selectionList);
  704. }
  705. });
  706. },
  707. isFinish(selection) {
  708. var timeNow = new Date();
  709. var ddl = new Date(selection.task_ddl.replace(/-/g, "/"));
  710. var diff = getDaysAndHoursBetweenDates(timeNow, ddl);
  711. let remain_days = diff.days;
  712. let remain_hours = diff.hours;
  713. if (remain_days <= 0 & remain_hours <= 0) return true;
  714. // let remain_days = getDaysBetweenDates(timeNow, ddl);
  715. // if (remain_days < 0) return true;
  716. else return false;
  717. },
  718. toggle4(type) {
  719. this.type4 = type
  720. // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
  721. this.$refs.popup4.open(type)
  722. // this.$refs.popup1.close()
  723. },
  724. // 保存图片
  725. async saveImage() {
  726. // showToast('保存成功')
  727. wx.downloadFile({
  728. url: this.kefuUrl,
  729. success: function(res) {
  730. wx.saveImageToPhotosAlbum({
  731. filePath: res.tempFilePath,
  732. success: function(data) {
  733. wx.showToast({
  734. title: "保存成功",
  735. icon: "success",
  736. duration: 2000
  737. })
  738. },
  739. fail: function(err) {
  740. console.log(err);
  741. },
  742. complete(res) {
  743. console.log(res);
  744. }
  745. })
  746. }
  747. })
  748. },
  749. closepop() {
  750. this.$refs.popup4.close()
  751. },
  752. xieyi() {
  753. console.log('进入联系我们')
  754. },
  755. pick(item) {
  756. console.log(item)
  757. uni.navigateTo({
  758. url: item.name
  759. });
  760. },
  761. }
  762. }
  763. </script>
  764. <style>
  765. /deep/ .share .uni-popup .uni-popup__wrapper {
  766. width: 80% !important;
  767. border-radius: 15rpx !important;
  768. }
  769. </style>
  770. <style lang="scss" scoped>
  771. //nav
  772. .nav {
  773. position: relative;
  774. }
  775. .nv_padding {
  776. height: 88upx;
  777. background-color: transparent;
  778. }
  779. /* 图标默认大小 */
  780. .nv_icon {
  781. width: 16px;
  782. height: 16px;
  783. }
  784. .bg_box {
  785. position: absolute;
  786. width: 750upx;
  787. height: 88upx;
  788. z-index: 10;
  789. top: 0;
  790. background-color: transparent;
  791. /* #ifdef MP */
  792. box-sizing: border-box;
  793. /* #endif */
  794. /* #ifndef APP-PLUS-NVUE */
  795. background-size: cover;
  796. background-repeat: no-repeat;
  797. background-position: center center;
  798. /* #endif */
  799. }
  800. .mys_navBar {
  801. /* #ifndef APP-PLUS-NVUE */
  802. display: flex;
  803. height: 88upx;
  804. /* #endif */
  805. // #ifdef MP
  806. box-sizing: border-box;
  807. // #endif
  808. width: 750upx;
  809. flex-direction: row;
  810. background-color: transparent;
  811. position: absolute;
  812. z-index: 10;
  813. top: 0;
  814. }
  815. .fixed {
  816. position: fixed;
  817. }
  818. /*
  819. left 按钮
  820. */
  821. .btn_type {
  822. /* #ifndef APP-PLUS-NVUE */
  823. display: flex;
  824. /* #endif */
  825. /* #ifdef APP-PLUS-NVUE */
  826. margin-left: 16upx;
  827. /* #endif */
  828. // #ifndef MP
  829. align-items: center;
  830. // #endif
  831. flex: 1;
  832. flex-direction: row;
  833. // background-color: #fff;
  834. }
  835. .btn_box {
  836. /* #ifndef APP-PLUS-NVUE */
  837. display: flex;
  838. margin-left: 16upx;
  839. /* #endif */
  840. flex-direction: row;
  841. // #ifndef MP
  842. align-items: center;
  843. // #endif
  844. }
  845. .btn_back,
  846. .btn_home {
  847. /* #ifndef APP-PLUS-NVUE */
  848. display: flex;
  849. /* #endif */
  850. /* #ifndef APP-PLUS-NVUE */
  851. height: 100%;
  852. /* #endif */
  853. /* #ifdef APP-PLUS-NVUE */
  854. width: 76upx;
  855. height: 62upx;
  856. /* #endif */
  857. flex-direction: row;
  858. align-items: center;
  859. justify-content: center;
  860. flex: 1;
  861. }
  862. /* 按钮类型1 */
  863. .nav_btn_t1 {
  864. /* #ifndef APP-PLUS-NVUE */
  865. display: flex;
  866. /* #endif */
  867. // #ifdef MP
  868. box-sizing: border-box;
  869. // #endif
  870. flex-direction: row;
  871. align-items: center;
  872. border-style: solid;
  873. border-width: 1px;
  874. border-color: #C0C0C0;
  875. // background-color: rgba(0, 0, 0, 0.2);
  876. background-color: #FFFFFF;
  877. width: 130upx;
  878. height: 45upx;
  879. }
  880. .line {
  881. width: 1upx;
  882. height: 60%;
  883. /* #ifdef APP-PLUS-NVUE */
  884. height: 30upx;
  885. /* #endif */
  886. background-color: #C0C0C0;
  887. }
  888. /*
  889. 标题
  890. */
  891. .title_container {
  892. /* #ifndef APP-PLUS-NVUE */
  893. display: flex;
  894. /* #endif */
  895. position: absolute;
  896. left: 375upx;
  897. bottom: 0;
  898. transform: translateX(-50%);
  899. flex-direction: row;
  900. justify-content: center;
  901. align-items: center;
  902. }
  903. .title_text {
  904. // flex: 1;
  905. text-overflow: ellipsis;
  906. /* #ifndef APP-PLUS-NVUE */
  907. white-space: nowrap;
  908. overflow: hidden;
  909. font-weight: 550;
  910. /* #endif */
  911. /* #ifdef APP-PLUS-NVUE */
  912. lines: 1;
  913. /* #endif */
  914. }
  915. /*
  916. 左边自定义
  917. */
  918. .my_left_box {
  919. /* #ifndef APP-PLUS-NVUE */
  920. display: flex;
  921. /* #endif */
  922. flex-direction: row;
  923. align-items: center;
  924. }
  925. .my_left_icon {
  926. /* #ifndef APP-PLUS-NVUE */
  927. display: flex;
  928. /* #endif */
  929. flex-direction: row;
  930. align-items: center;
  931. justify-content: center;
  932. /* #ifndef MP */
  933. margin-left: 18upx;
  934. /* #endif */
  935. }
  936. .my_left_custom {
  937. /* #ifndef APP-PLUS-NVUE */
  938. display: flex;
  939. /* #endif */
  940. flex-direction: row;
  941. align-items: center;
  942. // justify-content: center;
  943. }
  944. /* 文字 */
  945. .leftText {
  946. /* #ifndef APP-PLUS-NVUE */
  947. display: flex;
  948. /* #endif */
  949. flex-direction: row;
  950. align-items: center;
  951. justify-content: center;
  952. padding-left: 4upx;
  953. font-size: 15px;
  954. }
  955. /*
  956. 中间
  957. */
  958. .my_custom_box {
  959. /* #ifndef APP-PLUS-NVUE */
  960. display: flex;
  961. /* #endif */
  962. flex-direction: row;
  963. align-items: center;
  964. justify-content: center;
  965. flex: 1;
  966. }
  967. /*
  968. 搜索框
  969. */
  970. .nv_search_box {
  971. /* #ifndef APP-PLUS-NVUE */
  972. display: flex;
  973. /* #endif */
  974. flex-direction: row;
  975. align-items: center;
  976. flex: 1;
  977. /* #ifndef MP */
  978. height: 60upx;
  979. /* #endif */
  980. background-color: #f8f8f8;
  981. padding-right: 20upx;
  982. padding-left: 20upx;
  983. border-radius: 60upx;
  984. margin-right: 15upx;
  985. margin-left: 15upx;
  986. }
  987. .nv_input {
  988. flex: 1;
  989. padding-left: 16upx;
  990. font-size: 13px;
  991. }
  992. .close {
  993. width: 50upx;
  994. /* #ifndef APP-PLUS-NVUE */
  995. display: flex;
  996. /* #endif */
  997. flex-direction: row;
  998. align-items: center;
  999. justify-content: center;
  1000. /* #ifndef MP */
  1001. height: 62upx;
  1002. /* #endif */
  1003. }
  1004. /*
  1005. 右边 自定义
  1006. */
  1007. .my_right_icon {
  1008. /* #ifndef APP-PLUS-NVUE */
  1009. display: flex;
  1010. /* #endif */
  1011. flex-direction: row;
  1012. align-items: center;
  1013. justify-content: center;
  1014. /* #ifndef MP */
  1015. // min-width: 70upx;
  1016. /* #endif */
  1017. padding-left: 6px;
  1018. padding-right: 10px;
  1019. }
  1020. .imge image {
  1021. width: 100%;
  1022. height: 260rpx;
  1023. }
  1024. </style>
  1025. <style lang="scss" scoped>
  1026. .option1 {
  1027. padding: 5rpx 18rpx;
  1028. /deep/.uni-data-checklist .checklist-group .checklist-box .checklist-content {
  1029. text-align: center;
  1030. }
  1031. }
  1032. .option2 {
  1033. padding: 5rpx 18rpx;
  1034. }
  1035. .option3 {
  1036. padding: 5rpx 18rpx;
  1037. /deep/.uni-data-checklist .checklist-group .checklist-box .checklist-content {
  1038. // width: 120rpx;
  1039. text-align: center;
  1040. }
  1041. }
  1042. .butmin {
  1043. // height: 48rpx;
  1044. width: 250rpx;
  1045. background-color: #FCCF41;
  1046. line-height: 48rpx;
  1047. }
  1048. .butmin1 {
  1049. // height: 48rpx;
  1050. width: 250rpx;
  1051. background-color: #fff;
  1052. border: #000000 1rpx solid;
  1053. line-height: 48rpx;
  1054. }
  1055. //弹出层
  1056. /deep/ .uni-data-checklist .checklist-group .checklist-box {
  1057. background-color: #FFFFFF !important;
  1058. border-radius: 20rpx !important;
  1059. padding: 8rpx 30rpx !important;
  1060. border: 0 !important;
  1061. }
  1062. /deep/ .uni-data-checklist .checklist-group .checklist-box .checklist-content .checklist-text {
  1063. font-size: 24rpx;
  1064. color: #333333;
  1065. }
  1066. /deep/ .mini-btn {
  1067. height: 70rpx;
  1068. width: 250rpx;
  1069. line-height: 70rpx;
  1070. margin: 20rpx;
  1071. letter-spacing: 4rpx;
  1072. background-color: #FCCF41;
  1073. }
  1074. /deep/ .mini-btn1 {
  1075. height: 70rpx;
  1076. width: 400rpx;
  1077. line-height: 70rpx;
  1078. margin: 20rpx;
  1079. letter-spacing: 4rpx;
  1080. color: white;
  1081. ;
  1082. }
  1083. /deep/ .uni-data-checklist .checklist-group .checklist-box.is--tag.is-checked {
  1084. background-color: #FCCF41 !important;
  1085. }
  1086. .butto {
  1087. text-align: center;
  1088. }
  1089. .swiper {
  1090. height: 300rpx;
  1091. }
  1092. .swiper-item {
  1093. display: block;
  1094. height: 300rpx;
  1095. line-height: 300rpx;
  1096. text-align: center;
  1097. }
  1098. .swiper-list {
  1099. margin-top: 40rpx;
  1100. margin-bottom: 0;
  1101. }
  1102. </style>
  1103. <style lang="scss" scoped>
  1104. .commodity {
  1105. margin-top: 10rpx;
  1106. display: flex;
  1107. flex-wrap: wrap;
  1108. justify-content: space-between;
  1109. }
  1110. .project {
  1111. width: 49%;
  1112. height: 550rpx;
  1113. border-radius: 20rpx;
  1114. margin-bottom: 4%;
  1115. }
  1116. .projectdiagram {
  1117. width: 100%;
  1118. height: 61%;
  1119. background-size: 100% 100%;
  1120. position: relative;
  1121. border-radius: 10rpx;
  1122. }
  1123. .projecttext {
  1124. // padding-top: 5%;
  1125. padding: 0 0 0 1%;
  1126. // height: 80rpx;
  1127. }
  1128. .projecttext span {
  1129. color: #333333;
  1130. font-size: 25rpx;
  1131. font-weight: 550;
  1132. text-indent: 2em;
  1133. }
  1134. .projecttext image {
  1135. vertical-align: middle;
  1136. width: 30rpx;
  1137. height: 30rpx;
  1138. display: inline-block;
  1139. margin-right: 14rpx;
  1140. }
  1141. .projectinfo {
  1142. display: flex;
  1143. justify-content: space-between;
  1144. margin-top: 5%;
  1145. }
  1146. .projectinfotxt {
  1147. display: flex;
  1148. flex-direction: column;
  1149. align-items: center;
  1150. justify-content: center;
  1151. }
  1152. .projectinfotxt p {
  1153. color: #767272;
  1154. font-size: 20rpx;
  1155. margin: 5rpx 0;
  1156. }
  1157. .projectinfotag {
  1158. display: flex;
  1159. justify-content: space-around;
  1160. align-items: center;
  1161. }
  1162. // 美化背景色
  1163. .section {
  1164. display: flex;
  1165. align-items: center;
  1166. justify-content: space-between;
  1167. font-size: 20rpx;
  1168. margin: 6rpx 0;
  1169. color: #ffffff;
  1170. }
  1171. .section1 {
  1172. background-image: linear-gradient(to top, #c54529, #e38e3e);
  1173. border-radius: 8px;
  1174. width: 140rpx;
  1175. height: 45rpx;
  1176. text-align: center;
  1177. line-height: 40rpx;
  1178. }
  1179. .section2 {
  1180. background-image: linear-gradient(to top, #6991e1, #db9c53);
  1181. border-radius: 8px;
  1182. width: 200rpx;
  1183. height: 45rpx;
  1184. text-align: center;
  1185. line-height: 40rpx;
  1186. }
  1187. .TitleText {
  1188. // height: 30rpx;
  1189. width: 120rpx;
  1190. height: 45rpx;
  1191. background-color: #f70606;
  1192. border-radius: 20rpx;
  1193. display: inline-block;
  1194. text-align: center;
  1195. // padding: 0rpx 10rpx 0rpx 10rpx;
  1196. margin-right: 6%;
  1197. line-height: 42rpx;
  1198. }
  1199. .TitleText p {
  1200. color: #fff;
  1201. font-size: 20rpx;
  1202. }
  1203. .Mask {
  1204. position: absolute;
  1205. background-color: #000000;
  1206. opacity: 0.6;
  1207. width: 100%;
  1208. height: 100%;
  1209. // z-index: 999;
  1210. text-align: center;
  1211. border-radius: 20rpx;
  1212. }
  1213. .Mask image {
  1214. width: 50%;
  1215. height: 52%;
  1216. padding-top: 25%;
  1217. }
  1218. .contt {
  1219. position: relative;
  1220. }
  1221. .contact {
  1222. position: fixed;
  1223. top: 80%;
  1224. right: 13%;
  1225. }
  1226. //弹窗
  1227. .sharepage {
  1228. // width: 90%;
  1229. margin: 0 auto;
  1230. // position: relative;
  1231. }
  1232. /deep/ .share.uni-popup .uni-popup__wrapper {
  1233. width: 70%;
  1234. border-radius: 15rpx;
  1235. }
  1236. .projecttext1 {
  1237. // padding-top: 5%;
  1238. padding: 0 0 0 1%;
  1239. height: 80rpx;
  1240. margin: 5% 0;
  1241. text-align: center;
  1242. }
  1243. .projecttext1 image {
  1244. vertical-align: middle;
  1245. width: 80rpx;
  1246. height: 80rpx;
  1247. display: inline-block;
  1248. padding-right: 14rpx;
  1249. }
  1250. .sharemap {
  1251. margin: 0 auto;
  1252. text-align: center;
  1253. // margin-top: 15%;
  1254. // margin-bottom: 15%;
  1255. }
  1256. .sharemap image {
  1257. width: 400rpx;
  1258. height: 400rpx;
  1259. }
  1260. .sharetxt {
  1261. height: 100rpx;
  1262. display: flex;
  1263. flex-direction: column;
  1264. align-items: center;
  1265. justify-content: center;
  1266. }
  1267. .sharetxt text {
  1268. font-size: 24rpx;
  1269. text-align: left;
  1270. line-height: 20rpx
  1271. }
  1272. .butmin {
  1273. // height: 48rpx;
  1274. width: 250rpx;
  1275. background-color: #FCCF41;
  1276. line-height: 48rpx;
  1277. }
  1278. .butmin1 {
  1279. // height: 48rpx;
  1280. width: 250rpx;
  1281. background-color: #fff;
  1282. border: #000000 1rpx solid;
  1283. line-height: 48rpx;
  1284. }
  1285. .share {
  1286. text-align: center;
  1287. line-height: 10rpx;
  1288. margin-top: 10rpx;
  1289. }
  1290. .share image {
  1291. vertical-align: middle;
  1292. width: 25rpx;
  1293. height: 25rpx;
  1294. display: inline-block
  1295. }
  1296. .share p {
  1297. // display: inline-block;
  1298. font-size: 24rpx;
  1299. // color: #333333;
  1300. }
  1301. .img1 {
  1302. width: 84rpx;
  1303. height: 124rpx;
  1304. position: absolute;
  1305. }
  1306. .demo-uni-row {
  1307. margin-bottom: 10px;
  1308. // 组件在小程序端display为inline
  1309. // QQ、抖音小程序文档写有 :host,但实测不生效
  1310. // 百度小程序没有 :host
  1311. /* #ifdef MP-TOUTIAO || MP-QQ || MP-BAIDU */
  1312. /* #endif */
  1313. }
  1314. // 支付宝小程序没有 demo-uni-row 层级
  1315. // 微信小程序使用了虚拟化节点,没有 demo-uni-row 层级
  1316. /* #ifdef MP-ALIPAY || MP-WEIXIN */
  1317. ::v-deep .uni-row {
  1318. margin-bottom: 10px;
  1319. }
  1320. /* #endif */
  1321. .demo-uni-col {
  1322. height: 36px;
  1323. border-radius: 5px;
  1324. }
  1325. .dark_deep {
  1326. background-color: #99a9bf;
  1327. }
  1328. .dark {
  1329. background-color: #d3dce6;
  1330. }
  1331. .light {
  1332. background-color: #e5e9f2;
  1333. }
  1334. .example-body {
  1335. /* #ifndef APP-NVUE */
  1336. display: block;
  1337. /* #endif */
  1338. padding: 5rpx 10rpx 0;
  1339. overflow: hidden;
  1340. }
  1341. </style>