selectionsquare.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464
  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.commission_rate}}%</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_commission}}</span></p>
  138. </view>
  139. <view class="projectinfotxt">
  140. <p>售价:<span style="color: red;">¥{{item.show_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 == 2">
  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: 2
  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. }
  442. },
  443. watch: {
  444. scrollTop(val) {
  445. if (!this.mysNavConfig.isOpacity) {
  446. return;
  447. }
  448. this.setOpacity(val, this.mysNavConfig.opacityTime);
  449. },
  450. },
  451. created() {
  452. this.init();
  453. },
  454. //onshow生命周期执行完之后,this内部就有了很多内容
  455. async onShow() {
  456. this.isLoginApi()
  457. await this.getInfoListApi()
  458. this.per = 0
  459. this.selectionList = []
  460. this.getSelectionListApi()
  461. },
  462. async onLoad() {},
  463. //下拉刷新
  464. onPullDownRefresh() {
  465. this.per = 0
  466. this.selectionList = []
  467. this.getSelectionListApi()
  468. //停止下拉刷新
  469. uni.stopPullDownRefresh()
  470. },
  471. // 下拉懒加载
  472. async onReachBottom() {
  473. ++this.per;
  474. if (this.per >= this.max_page) {
  475. uni.showToast({
  476. title: "已加载全部"
  477. })
  478. } else {
  479. uni.showLoading({
  480. title: '加载中'
  481. })
  482. await this.getSelectionListApi()
  483. uni.hideLoading();
  484. }
  485. },
  486. methods: {
  487. /**
  488. * @param scrollTop 页面顶部距离
  489. * @param down 滑动显示效果延时
  490. */
  491. setOpacity(scrollTop, down = 60) {
  492. if (scrollTop > 0) {
  493. if (scrollTop < down) {
  494. this.opacity = scrollTop / down;
  495. }
  496. if (scrollTop > down) {
  497. this.opacity = 1;
  498. }
  499. } else {
  500. this.opacity = 0;
  501. }
  502. },
  503. /* type2 点击分类 */
  504. onLeftHome(type) {
  505. this.type = type
  506. // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
  507. this.$refs.popup.open(type)
  508. },
  509. init() {
  510. if (this.mysNavConfig.isHome) {
  511. let pages = getCurrentPages().length;
  512. /* 单页显示home图标 */
  513. pages === 1 ? (this.isHome = true) : (this.isHome = false);
  514. }
  515. // 开启渐变 强制fixed
  516. this.navBarTop = uni.getSystemInfoSync().statusBarHeight +
  517. "px";
  518. if (!this.mysNavConfig.opacity) {
  519. this.opacity = 1;
  520. !this.mysNavConfig.isOpacity ? (this.opacity = 1) : ((this
  521. .mysNavConfig.navFixed = true), (this
  522. .opacity = 0));
  523. } else {
  524. this.opacity = this.mysNavConfig.opacity;
  525. !this.mysNavConfig.isOpacity ? "" : ((this.mysNavConfig
  526. .navFixed = true), (this.opacity = 0));
  527. }
  528. // #ifdef MP
  529. this.initMP();
  530. // #endif
  531. // #ifdef APP-PLUS-NVUE
  532. this.navBarHeight = 44 + uni.getSystemInfoSync()
  533. .statusBarHeight + "px";
  534. // #endif
  535. },
  536. /* 小程序初始化位置 */
  537. initMP() {
  538. // getSystemInfoSync用于获取系统信息同步接口
  539. let gS = uni.getSystemInfoSync();
  540. // getMenuButtonBoundingClientRect用于获取胶囊按钮位置布局信息
  541. let rect = uni.getMenuButtonBoundingClientRect();
  542. let rectHeight = rect.height;
  543. this.btnWidth = rect.width + "px";
  544. this.btnHeight = rectHeight + "px";
  545. this.iconW = Math.floor(rect.width / 4 - 5) + "px";
  546. this.iconH = rectHeight / 2 + "px";
  547. this.inputHeight = rectHeight - 3 + "px";
  548. this.navBarTop = rect.top + "px";
  549. this.navBarLeft = gS.screenWidth - rect.right + "px";
  550. this.navBarRight = gS.screenWidth - rect.right + rect.width +
  551. "px";
  552. this.navBarHeight = gS.statusBarHeight + rectHeight + (rect
  553. .top - gS.statusBarHeight) * 2 + "px";
  554. },
  555. toDetail(item) {
  556. uni.navigateTo({
  557. url: '/page_selectionsquare/selectiondetail/selectiondetail?id=' + item.selection_id
  558. });
  559. },
  560. async submitSearch() {
  561. //被选中的hobby才会加入数据中,加入的是value数字
  562. console.log('look-----', this.formData.hobby1)
  563. console.log('look-----333333', this.formData.hobby3)
  564. this.per = 0;
  565. this.$refs.popup.close()
  566. var filtCondition = ''
  567. //各平台名字展示
  568. // for (var i = 0; i < this.formData.hobby.length; i++) {
  569. // filtCondition += "&platform[]" + "=" + this.formData.hobby[i]
  570. // }
  571. //"&secform[]=" 是一个固定的字符串部分,用来表示参数格式
  572. //最后参数形如&secform[]=2&secform[]=3&secform[]=9
  573. //样品形式
  574. for (var j = 0; j < this.formData.hobby1.length; j++) {
  575. filtCondition += "&secform[]" + "=" + this.formData.hobby1[j]
  576. }
  577. //任务形式
  578. for (var j = 0; j < this.formData.hobby2.length; j++) {
  579. filtCondition += "&taskform[]" + "=" + this.formData.hobby2[j]
  580. }
  581. //商品类目
  582. for (var j = 0; j < this.formData.hobby3.length; j++) {
  583. filtCondition += "&categoryform[]" + "=" + this.formData.hobby3[j]
  584. }
  585. this.filtCondition = filtCondition
  586. uni.showLoading({
  587. title: '加载中'
  588. });
  589. this.selectionList = []
  590. await this.getSelectionListApi()
  591. uni.hideLoading();
  592. },
  593. async reset() {
  594. this.per = 0;
  595. this.$refs.popup.close()
  596. this.formData.hobby1 = [];
  597. this.formData.hobby2 = [];
  598. this.formData.hobby3 = [];
  599. this.filtCondition = '';
  600. uni.showLoading({
  601. title: '加载中'
  602. });
  603. this.selectionList = []
  604. await this.getSelectionListApi()
  605. uni.hideLoading();
  606. },
  607. /* 点击左侧 */
  608. onLeftClick() {
  609. uni.navigateTo({
  610. url: '/page_selectionsquare/search'
  611. });
  612. },
  613. isLoginApi() {
  614. return this.$https.get('/youngee/c/t/g/is-login')
  615. .then(res => {
  616. if (res.data.code === 403) {
  617. // 登陆已失效
  618. this.token = ""
  619. uni.clearStorage();
  620. } else {
  621. this.token = uni.getStorageSync('token')
  622. }
  623. })
  624. },
  625. //获取一些info表中的信息----包含thirdplatform
  626. //res是一个包含服务器响应的对象
  627. getInfoListApi() {
  628. return this.$http.get('/youngee/c/g/get-info-tables')
  629. .then(res => {
  630. console.log("llllllool", res); // 这行会输出响应对象到控制台
  631. this.hobby = []
  632. this.platformList = res.data.data.ThirdPlatform
  633. let l = this.platformList != null ? this.platformList.length : 0;
  634. for (var i = 0; i < l; i++) {
  635. var obj = {}
  636. obj.text = this.platformList[i].platform_name
  637. obj.value = this.platformList[i].id
  638. this.hobby.push(obj)
  639. }
  640. })
  641. },
  642. getSelectionListApi() {
  643. //idx:当前页 cnt:每页展示个数
  644. return this.$http.get('/youngee/c/g/get-selection-list' +
  645. "?" +
  646. "idx" +
  647. "=" +
  648. this.per +
  649. "&cnt" +
  650. "=" +
  651. 20 + this.filtCondition
  652. //请求发送后,使用 .then() 方法处理响应结果 res。
  653. ).then(res => {
  654. if (res.data.code === 0) {
  655. console.log("res is here------->: ", res)
  656. // 获取res返回数据
  657. this.max_page = res.data.data.max_page
  658. let selectionList = res.data.data.SeletionInfos
  659. const count = res.data.data.count
  660. // 数据处理
  661. if (selectionList === null) {
  662. return
  663. }
  664. for (var i = 0; i < selectionList.length; i++) {
  665. // 封面图片
  666. selectionList[i].ProductInfo = JSON.parse(selectionList[i].product_snap);
  667. // if (selectionList[i] !== undefined && 'product_snap' in selectionList[i]) {
  668. // }
  669. // 封面图片
  670. let ProductPhoto = JSON.parse(selectionList[i].product_photo_snap);
  671. for (let j = 0; j < ProductPhoto.length; ++j) {
  672. if (ProductPhoto[j].Symbol == 1) {
  673. selectionList[i].coverphoto = ProductPhoto[j].PhotoUrl
  674. }
  675. }
  676. // if (selectionList[i] !== undefined && 'product_photo_snap' in selectionList[i]) {
  677. // }
  678. for (var j = 0; j < this.platformList.length; j++) {
  679. if (selectionList[i].platform === this.platformList[j].id) {
  680. selectionList[i].platform_icon = this.platformList[j].platform_icon
  681. }
  682. }
  683. // 佣金计算
  684. selectionList[i].price = selectionList[i].ProductInfo.ProductPrice
  685. //打印商品详情表
  686. // console.table(selectionList[i].ProductInfo)
  687. selectionList[i].commission = selectionList[i].price * selectionList[i]
  688. .commission_rate * 0.01
  689. selectionList[i].show_commission = money(selectionList[i].commission) // 佣金比例
  690. selectionList[i].show_price = money(selectionList[i].price) // 售价
  691. selectionList[i].show_task_reward = money(selectionList[i].task_reward) // 任务悬赏
  692. // 判断是否到期
  693. selectionList[i].isFinished = this.isFinish(selectionList[i])
  694. // 判断是否有库存
  695. selectionList[i].isLacked = selectionList[i].remain_num == 0 ? true : false
  696. }
  697. //...selectionList 是扩展运算符的语法,它会将 selectionList 数组中的所有元素展开,并作为单独的参数传递给 push() 方法
  698. //用于在原有数据的基础上添加新的数据
  699. this.selectionList.push(...selectionList);
  700. }
  701. });
  702. },
  703. isFinish(selection) {
  704. var timeNow = new Date();
  705. var ddl = new Date(selection.task_ddl.replace(/-/g, "/"));
  706. var diff = getDaysAndHoursBetweenDates(timeNow, ddl);
  707. let remain_days = diff.days;
  708. let remain_hours = diff.hours;
  709. if (remain_days <= 0 & remain_hours <= 0) return true;
  710. // let remain_days = getDaysBetweenDates(timeNow, ddl);
  711. // if (remain_days < 0) return true;
  712. else return false;
  713. },
  714. toggle4(type) {
  715. this.type4 = type
  716. // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
  717. this.$refs.popup4.open(type)
  718. // this.$refs.popup1.close()
  719. },
  720. // 保存图片
  721. async saveImage() {
  722. // showToast('保存成功')
  723. wx.downloadFile({
  724. url: this.kefuUrl,
  725. success: function(res) {
  726. wx.saveImageToPhotosAlbum({
  727. filePath: res.tempFilePath,
  728. success: function(data) {
  729. wx.showToast({
  730. title: "保存成功",
  731. icon: "success",
  732. duration: 2000
  733. })
  734. },
  735. fail: function(err) {
  736. console.log(err);
  737. },
  738. complete(res) {
  739. console.log(res);
  740. }
  741. })
  742. }
  743. })
  744. },
  745. closepop() {
  746. this.$refs.popup4.close()
  747. },
  748. xieyi() {
  749. console.log('进入联系我们')
  750. },
  751. pick(item) {
  752. console.log(item)
  753. uni.navigateTo({
  754. url: item.name
  755. });
  756. },
  757. }
  758. }
  759. </script>
  760. <style>
  761. /deep/ .share .uni-popup .uni-popup__wrapper {
  762. width: 80% !important;
  763. border-radius: 15rpx !important;
  764. }
  765. </style>
  766. <style lang="scss" scoped>
  767. //nav
  768. .nav {
  769. position: relative;
  770. }
  771. .nv_padding {
  772. height: 88upx;
  773. background-color: transparent;
  774. }
  775. /* 图标默认大小 */
  776. .nv_icon {
  777. width: 16px;
  778. height: 16px;
  779. }
  780. .bg_box {
  781. position: absolute;
  782. width: 750upx;
  783. height: 88upx;
  784. z-index: 10;
  785. top: 0;
  786. background-color: transparent;
  787. /* #ifdef MP */
  788. box-sizing: border-box;
  789. /* #endif */
  790. /* #ifndef APP-PLUS-NVUE */
  791. background-size: cover;
  792. background-repeat: no-repeat;
  793. background-position: center center;
  794. /* #endif */
  795. }
  796. .mys_navBar {
  797. /* #ifndef APP-PLUS-NVUE */
  798. display: flex;
  799. height: 88upx;
  800. /* #endif */
  801. // #ifdef MP
  802. box-sizing: border-box;
  803. // #endif
  804. width: 750upx;
  805. flex-direction: row;
  806. background-color: transparent;
  807. position: absolute;
  808. z-index: 10;
  809. top: 0;
  810. }
  811. .fixed {
  812. position: fixed;
  813. }
  814. /*
  815. left 按钮
  816. */
  817. .btn_type {
  818. /* #ifndef APP-PLUS-NVUE */
  819. display: flex;
  820. /* #endif */
  821. /* #ifdef APP-PLUS-NVUE */
  822. margin-left: 16upx;
  823. /* #endif */
  824. // #ifndef MP
  825. align-items: center;
  826. // #endif
  827. flex: 1;
  828. flex-direction: row;
  829. // background-color: #fff;
  830. }
  831. .btn_box {
  832. /* #ifndef APP-PLUS-NVUE */
  833. display: flex;
  834. margin-left: 16upx;
  835. /* #endif */
  836. flex-direction: row;
  837. // #ifndef MP
  838. align-items: center;
  839. // #endif
  840. }
  841. .btn_back,
  842. .btn_home {
  843. /* #ifndef APP-PLUS-NVUE */
  844. display: flex;
  845. /* #endif */
  846. /* #ifndef APP-PLUS-NVUE */
  847. height: 100%;
  848. /* #endif */
  849. /* #ifdef APP-PLUS-NVUE */
  850. width: 76upx;
  851. height: 62upx;
  852. /* #endif */
  853. flex-direction: row;
  854. align-items: center;
  855. justify-content: center;
  856. flex: 1;
  857. }
  858. /* 按钮类型1 */
  859. .nav_btn_t1 {
  860. /* #ifndef APP-PLUS-NVUE */
  861. display: flex;
  862. /* #endif */
  863. // #ifdef MP
  864. box-sizing: border-box;
  865. // #endif
  866. flex-direction: row;
  867. align-items: center;
  868. border-style: solid;
  869. border-width: 1px;
  870. border-color: #C0C0C0;
  871. // background-color: rgba(0, 0, 0, 0.2);
  872. background-color: #FFFFFF;
  873. width: 130upx;
  874. height: 45upx;
  875. }
  876. .line {
  877. width: 1upx;
  878. height: 60%;
  879. /* #ifdef APP-PLUS-NVUE */
  880. height: 30upx;
  881. /* #endif */
  882. background-color: #C0C0C0;
  883. }
  884. /*
  885. 标题
  886. */
  887. .title_container {
  888. /* #ifndef APP-PLUS-NVUE */
  889. display: flex;
  890. /* #endif */
  891. position: absolute;
  892. left: 375upx;
  893. bottom: 0;
  894. transform: translateX(-50%);
  895. flex-direction: row;
  896. justify-content: center;
  897. align-items: center;
  898. }
  899. .title_text {
  900. // flex: 1;
  901. text-overflow: ellipsis;
  902. /* #ifndef APP-PLUS-NVUE */
  903. white-space: nowrap;
  904. overflow: hidden;
  905. font-weight: 550;
  906. /* #endif */
  907. /* #ifdef APP-PLUS-NVUE */
  908. lines: 1;
  909. /* #endif */
  910. }
  911. /*
  912. 左边自定义
  913. */
  914. .my_left_box {
  915. /* #ifndef APP-PLUS-NVUE */
  916. display: flex;
  917. /* #endif */
  918. flex-direction: row;
  919. align-items: center;
  920. }
  921. .my_left_icon {
  922. /* #ifndef APP-PLUS-NVUE */
  923. display: flex;
  924. /* #endif */
  925. flex-direction: row;
  926. align-items: center;
  927. justify-content: center;
  928. /* #ifndef MP */
  929. margin-left: 18upx;
  930. /* #endif */
  931. }
  932. .my_left_custom {
  933. /* #ifndef APP-PLUS-NVUE */
  934. display: flex;
  935. /* #endif */
  936. flex-direction: row;
  937. align-items: center;
  938. // justify-content: center;
  939. }
  940. /* 文字 */
  941. .leftText {
  942. /* #ifndef APP-PLUS-NVUE */
  943. display: flex;
  944. /* #endif */
  945. flex-direction: row;
  946. align-items: center;
  947. justify-content: center;
  948. padding-left: 4upx;
  949. font-size: 15px;
  950. }
  951. /*
  952. 中间
  953. */
  954. .my_custom_box {
  955. /* #ifndef APP-PLUS-NVUE */
  956. display: flex;
  957. /* #endif */
  958. flex-direction: row;
  959. align-items: center;
  960. justify-content: center;
  961. flex: 1;
  962. }
  963. /*
  964. 搜索框
  965. */
  966. .nv_search_box {
  967. /* #ifndef APP-PLUS-NVUE */
  968. display: flex;
  969. /* #endif */
  970. flex-direction: row;
  971. align-items: center;
  972. flex: 1;
  973. /* #ifndef MP */
  974. height: 60upx;
  975. /* #endif */
  976. background-color: #f8f8f8;
  977. padding-right: 20upx;
  978. padding-left: 20upx;
  979. border-radius: 60upx;
  980. margin-right: 15upx;
  981. margin-left: 15upx;
  982. }
  983. .nv_input {
  984. flex: 1;
  985. padding-left: 16upx;
  986. font-size: 13px;
  987. }
  988. .close {
  989. width: 50upx;
  990. /* #ifndef APP-PLUS-NVUE */
  991. display: flex;
  992. /* #endif */
  993. flex-direction: row;
  994. align-items: center;
  995. justify-content: center;
  996. /* #ifndef MP */
  997. height: 62upx;
  998. /* #endif */
  999. }
  1000. /*
  1001. 右边 自定义
  1002. */
  1003. .my_right_icon {
  1004. /* #ifndef APP-PLUS-NVUE */
  1005. display: flex;
  1006. /* #endif */
  1007. flex-direction: row;
  1008. align-items: center;
  1009. justify-content: center;
  1010. /* #ifndef MP */
  1011. // min-width: 70upx;
  1012. /* #endif */
  1013. padding-left: 6px;
  1014. padding-right: 10px;
  1015. }
  1016. .imge image {
  1017. width: 100%;
  1018. height: 260rpx;
  1019. }
  1020. </style>
  1021. <style lang="scss" scoped>
  1022. .option1 {
  1023. padding: 5rpx 18rpx;
  1024. /deep/.uni-data-checklist .checklist-group .checklist-box .checklist-content {
  1025. text-align: center;
  1026. }
  1027. }
  1028. .option2 {
  1029. padding: 5rpx 18rpx;
  1030. }
  1031. .option3 {
  1032. padding: 5rpx 18rpx;
  1033. /deep/.uni-data-checklist .checklist-group .checklist-box .checklist-content {
  1034. // width: 120rpx;
  1035. text-align: center;
  1036. }
  1037. }
  1038. .butmin {
  1039. // height: 48rpx;
  1040. width: 250rpx;
  1041. background-color: #FCCF41;
  1042. line-height: 48rpx;
  1043. }
  1044. .butmin1 {
  1045. // height: 48rpx;
  1046. width: 250rpx;
  1047. background-color: #fff;
  1048. border: #000000 1rpx solid;
  1049. line-height: 48rpx;
  1050. }
  1051. //弹出层
  1052. /deep/ .uni-data-checklist .checklist-group .checklist-box {
  1053. background-color: #FFFFFF !important;
  1054. border-radius: 20rpx !important;
  1055. padding: 8rpx 30rpx !important;
  1056. border: 0 !important;
  1057. }
  1058. /deep/ .uni-data-checklist .checklist-group .checklist-box .checklist-content .checklist-text {
  1059. font-size: 24rpx;
  1060. color: #333333;
  1061. }
  1062. /deep/ .mini-btn {
  1063. height: 70rpx;
  1064. width: 250rpx;
  1065. line-height: 70rpx;
  1066. margin: 20rpx;
  1067. letter-spacing: 4rpx;
  1068. background-color: #FCCF41;
  1069. }
  1070. /deep/ .mini-btn1 {
  1071. height: 70rpx;
  1072. width: 400rpx;
  1073. line-height: 70rpx;
  1074. margin: 20rpx;
  1075. letter-spacing: 4rpx;
  1076. color: white;
  1077. ;
  1078. }
  1079. /deep/ .uni-data-checklist .checklist-group .checklist-box.is--tag.is-checked {
  1080. background-color: #FCCF41 !important;
  1081. }
  1082. .butto {
  1083. text-align: center;
  1084. }
  1085. .swiper {
  1086. height: 300rpx;
  1087. }
  1088. .swiper-item {
  1089. display: block;
  1090. height: 300rpx;
  1091. line-height: 300rpx;
  1092. text-align: center;
  1093. }
  1094. .swiper-list {
  1095. margin-top: 40rpx;
  1096. margin-bottom: 0;
  1097. }
  1098. </style>
  1099. <style lang="scss" scoped>
  1100. .commodity {
  1101. margin-top: 10rpx;
  1102. display: flex;
  1103. flex-wrap: wrap;
  1104. justify-content: space-between;
  1105. }
  1106. .project {
  1107. width: 49%;
  1108. height: 550rpx;
  1109. border-radius: 20rpx;
  1110. margin-bottom: 4%;
  1111. }
  1112. .projectdiagram {
  1113. width: 100%;
  1114. height: 61%;
  1115. background-size: 100% 100%;
  1116. position: relative;
  1117. border-radius: 10rpx;
  1118. ;
  1119. }
  1120. .projecttext {
  1121. // padding-top: 5%;
  1122. padding: 0 0 0 1%;
  1123. // height: 80rpx;
  1124. }
  1125. .projecttext span {
  1126. color: #333333;
  1127. font-size: 25rpx;
  1128. font-weight: 550;
  1129. text-indent: 2em;
  1130. }
  1131. .projecttext image {
  1132. vertical-align: middle;
  1133. width: 30rpx;
  1134. height: 30rpx;
  1135. display: inline-block;
  1136. margin-right: 14rpx;
  1137. }
  1138. .projectinfo {
  1139. display: flex;
  1140. justify-content: space-between;
  1141. margin-top: 5%;
  1142. }
  1143. .projectinfotxt {
  1144. display: flex;
  1145. flex-direction: column;
  1146. align-items: center;
  1147. justify-content: center;
  1148. }
  1149. .projectinfotxt p {
  1150. color: #767272;
  1151. font-size: 20rpx;
  1152. margin: 5rpx 0;
  1153. }
  1154. .projectinfotag {
  1155. display: flex;
  1156. justify-content: space-around;
  1157. align-items: center;
  1158. }
  1159. // 美化背景色
  1160. .section {
  1161. display: flex;
  1162. align-items: center;
  1163. justify-content: space-between;
  1164. font-size: 20rpx;
  1165. margin: 6rpx 0;
  1166. color: #ffffff;
  1167. }
  1168. .section1 {
  1169. background-image: linear-gradient(to top , #c54529, #e38e3e);
  1170. border-radius: 8px;
  1171. width: 140rpx;
  1172. height: 45rpx;
  1173. text-align: center;
  1174. line-height: 40rpx;
  1175. }
  1176. .section2 {
  1177. background-image: linear-gradient(to top , #6991e1, #db9c53);
  1178. border-radius: 8px;
  1179. width: 200rpx;
  1180. height: 45rpx;
  1181. text-align: center;
  1182. line-height: 40rpx;
  1183. }
  1184. .TitleText {
  1185. // height: 30rpx;
  1186. width: 120rpx;
  1187. height: 45rpx;
  1188. background-color: #f70606;
  1189. border-radius: 20rpx;
  1190. display: inline-block;
  1191. text-align: center;
  1192. // padding: 0rpx 10rpx 0rpx 10rpx;
  1193. margin-right: 6%;
  1194. line-height: 42rpx;
  1195. }
  1196. .TitleText p {
  1197. color: #fff;
  1198. font-size: 20rpx;
  1199. }
  1200. .Mask {
  1201. position: absolute;
  1202. background-color: #000000;
  1203. opacity: 0.6;
  1204. width: 100%;
  1205. height: 100%;
  1206. // z-index: 999;
  1207. text-align: center;
  1208. border-radius: 20rpx;
  1209. }
  1210. .Mask image {
  1211. width: 50%;
  1212. height: 52%;
  1213. padding-top: 25%;
  1214. }
  1215. .contt {
  1216. position: relative;
  1217. }
  1218. .contact {
  1219. position: fixed;
  1220. top: 80%;
  1221. right: 13%;
  1222. }
  1223. //弹窗
  1224. .sharepage {
  1225. // width: 90%;
  1226. margin: 0 auto;
  1227. // position: relative;
  1228. }
  1229. /deep/ .share.uni-popup .uni-popup__wrapper {
  1230. width: 70%;
  1231. border-radius: 15rpx;
  1232. }
  1233. .projecttext1 {
  1234. // padding-top: 5%;
  1235. padding: 0 0 0 1%;
  1236. height: 80rpx;
  1237. margin: 5% 0;
  1238. text-align: center;
  1239. }
  1240. .projecttext1 image {
  1241. vertical-align: middle;
  1242. width: 80rpx;
  1243. height: 80rpx;
  1244. display: inline-block;
  1245. padding-right: 14rpx;
  1246. }
  1247. .sharemap {
  1248. margin: 0 auto;
  1249. text-align: center;
  1250. // margin-top: 15%;
  1251. // margin-bottom: 15%;
  1252. }
  1253. .sharemap image {
  1254. width: 400rpx;
  1255. height: 400rpx;
  1256. }
  1257. .sharetxt {
  1258. height: 100rpx;
  1259. display: flex;
  1260. flex-direction: column;
  1261. align-items: center;
  1262. justify-content: center;
  1263. }
  1264. .sharetxt text {
  1265. font-size: 24rpx;
  1266. text-align: left;
  1267. line-height: 20rpx
  1268. }
  1269. .butmin {
  1270. // height: 48rpx;
  1271. width: 250rpx;
  1272. background-color: #FCCF41;
  1273. line-height: 48rpx;
  1274. }
  1275. .butmin1 {
  1276. // height: 48rpx;
  1277. width: 250rpx;
  1278. background-color: #fff;
  1279. border: #000000 1rpx solid;
  1280. line-height: 48rpx;
  1281. }
  1282. .share {
  1283. text-align: center;
  1284. line-height: 10rpx;
  1285. margin-top: 10rpx;
  1286. }
  1287. .share image {
  1288. vertical-align: middle;
  1289. width: 25rpx;
  1290. height: 25rpx;
  1291. display: inline-block
  1292. }
  1293. .share p {
  1294. // display: inline-block;
  1295. font-size: 24rpx;
  1296. // color: #333333;
  1297. }
  1298. .img1 {
  1299. width: 84rpx;
  1300. height: 124rpx;
  1301. position: absolute;
  1302. }
  1303. .demo-uni-row {
  1304. margin-bottom: 10px;
  1305. // 组件在小程序端display为inline
  1306. // QQ、抖音小程序文档写有 :host,但实测不生效
  1307. // 百度小程序没有 :host
  1308. /* #ifdef MP-TOUTIAO || MP-QQ || MP-BAIDU */
  1309. /* #endif */
  1310. }
  1311. // 支付宝小程序没有 demo-uni-row 层级
  1312. // 微信小程序使用了虚拟化节点,没有 demo-uni-row 层级
  1313. /* #ifdef MP-ALIPAY || MP-WEIXIN */
  1314. ::v-deep .uni-row {
  1315. margin-bottom: 10px;
  1316. }
  1317. /* #endif */
  1318. .demo-uni-col {
  1319. height: 36px;
  1320. border-radius: 5px;
  1321. }
  1322. .dark_deep {
  1323. background-color: #99a9bf;
  1324. }
  1325. .dark {
  1326. background-color: #d3dce6;
  1327. }
  1328. .light {
  1329. background-color: #e5e9f2;
  1330. }
  1331. .example-body {
  1332. /* #ifndef APP-NVUE */
  1333. display: block;
  1334. /* #endif */
  1335. padding: 5rpx 10rpx 0;
  1336. overflow: hidden;
  1337. }
  1338. </style>