1
0

favorite.vue 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368
  1. <template>
  2. <app-layout>
  3. <view class="f-favorite">
  4. <view class="u-mask" :class="[show ? 'u-mask-show' : 'u-mask-no']" @tap="closeMask" catchtouchmove="true"></view>
  5. <view class="f-tabs">
  6. <scroll-view scroll-x class="u-scroll-view" :scroll-left="0" scroll-with-animation >
  7. <view class="u-tabs-scroll-box">
  8. <view
  9. class="u-tabs-item"
  10. :style="{
  11. fontWeight: (index == getCurrent) ? 'bold' : 'normal'
  12. }"
  13. :class="index == getCurrent ? getTheme + '-m-text ' + getTheme : ''"
  14. v-for="(item, index) in getTabs"
  15. :key="index"
  16. @tap="emit(index)"
  17. >
  18. {{ item['name']}}
  19. </view>
  20. <view
  21. class="u-scroll-bar"
  22. :style="'transform:translateX(' + left + 'rpx)'"
  23. :class="getTheme + '-m-back ' + getTheme"
  24. ></view>
  25. </view>
  26. </scroll-view>
  27. </view>
  28. <view class="f-set" catchtouchmove="true">
  29. <view class="f-status dir-left-nowrap cross-center" :style="'transform:translateY(' + statusTop + 'rpx)'">
  30. <view class="f-item dir-left-nowrap cross-center main-between" @click="setDef('left')"
  31. :class="rotate.left === 180 ? 'f-set ' + getTheme + '-m-text ' + getTheme : 'f-def-set'">
  32. <view>
  33. <text class="t-omit">{{leftSet | category}}</text>
  34. </view>
  35. <image :class="rotate.left === 180 ? getTheme + '-m-back ' + getTheme : 'f-img'"
  36. src="/static/image/icon/favorite/bottom.png" :style="'transform:rotate(' + rotate.left + 'deg)'"></image>
  37. </view>
  38. <view class="f-item dir-left-nowrap cross-center main-between" @click="setDef('right')"
  39. :class="rotate.right === 180 ? 'f-set ' + getTheme + '-m-text ' + getTheme : 'f-def-set'">
  40. <view>
  41. <text class="t-omit">{{rightSet | setStatus}}</text>
  42. </view>
  43. <image :class="rotate.right === 180 ? getTheme + '-m-back ' + getTheme : 'f-img'"
  44. src="/static/image/icon/favorite/bottom.png" :style="'transform:rotate(' + rotate.right + 'deg)'"></image>
  45. </view>
  46. <view class="f-good-btn" @click="edit">
  47. {{touch ? '完成' : '管理'}}
  48. </view>
  49. <image class="f-good-icon" @click="setListStyle()"
  50. :src="listStyle ? '/static/image/icon/favorite/square.png' : '/static/image/icon/favorite/row.png'"></image>
  51. </view>
  52. <view class="f-select" :style="'transform:translateY('+ typeY+'rpx)'">
  53. <scroll-view scroll-y>
  54. <view class="dir-left-wrap f-type">
  55. <view class="f-type-item" @tap="setStatus(it.id)"
  56. v-bind:class="selectStatus == it.id ? getTheme + '-m-text ' + getTheme : 'f-type-def'"
  57. v-for="it in statusList" :key="it.id">{{it.name}}</view>
  58. </view>
  59. </scroll-view>
  60. <view class="f-button dir-left-nowrap">
  61. <button class="box-grow-1" @click="sureStatus(0)">重置</button>
  62. <button class="box-grow-1" @click="sureStatus(1)" :class="getTheme + '-m-back ' + getTheme">确定</button>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="f-good" v-if="is_goods" :class="getCurrent === 0 ? 'f-good-show' : 'f-good-hidden'">
  67. <block v-if="listStyle" >
  68. <app-share-qr-code v-model="shareShow"
  69. :url="shareItem.newShareUrl"
  70. :goods="shareItem.goods"
  71. :poster-config="shareItem.posterConfig"
  72. :poster-generate="shareItem.posterGenerate"
  73. :has-poster-nav="shareItem.hasPosterNav"
  74. ></app-share-qr-code>
  75. <!-- #ifndef MP-TOUTIAO -->
  76. <view class="dir-left-nowrap" v-for="(item, index) in list" :key="index">
  77. <view class="f-radio box-grow-0 dir-top-nowrap main-center cross-center" style="background-color: #ffffff;" v-if="touch" @tap="setTouch(index)">
  78. <view class="f-radio-no" v-if="!item.touch"></view>
  79. <view class="f-radio-yes" v-if="item.touch"></view>
  80. </view>
  81. <good-action style="width: 750rpx" :index="index" :theme="getTheme"
  82. @del="del" @open="openAction"
  83. @share="share"
  84. :disabled="touch"
  85. :show="item.show">
  86. <view class="f-item u-border-bottom dir-left-nowrap" @click="route(item)">
  87. <image class="f-img" :src="item.cover_pic" />
  88. <!-- 此层wrap在此为必写的,否则可能会出现标题定位错误 -->
  89. <view class="f-content dir-top-wrap main-between">
  90. <text class="t-omit-two f-title">{{ item.name }}</text>
  91. <view>
  92. <view class="f-invalid dir-left-nowrap cross-center main-between"
  93. v-if="item.status_type === 3">
  94. <image src="/static/image/icon/invalid.png"></image>
  95. <text>失效</text>
  96. </view>
  97. <view class="f-low-stock dir-left-nowrap cross-center main-between"
  98. v-if="item.status_type === 2">
  99. <image src="/static/image/icon/low_stock.png"></image>
  100. <text>低库存</text>
  101. </view>
  102. <view class="f-low-price dir-left-nowrap"
  103. v-if="item.status_type === 1">
  104. <view class="dir-left-nowrap main-between cross-center">
  105. <image src="/static/image/icon/low_price.png"></image>
  106. 比收藏时降价{{item.low_price}}元
  107. </view>
  108. </view>
  109. <view class="dir-left-nowrap main-between" v-if="item.status_type !== 3">
  110. <view class="dir-top-wrap main-between">
  111. <text class="f-price" :class="getTheme + '-m-text ' + getTheme">{{item.price_content}}</text>
  112. <text class="f-scale">{{item.sales}}</text>
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. </view>
  118. </good-action>
  119. </view>
  120. <!-- #endif -->
  121. <!-- #ifdef MP-TOUTIAO -->
  122. <view class="f-swipe-content dir-left-nowrap" v-for="(item, index) in list" :key="item.id">
  123. <view class="f-radio box-grow-0 dir-top-nowrap main-center cross-center" v-if="touch" @tap="setTouch(index)">
  124. <view class="f-radio-no" v-if="!item.touch"></view>
  125. <view class="f-radio-yes" v-if="item.touch"></view>
  126. </view>
  127. <view class="f-item u-border-bottom dir-left-nowrap" @click="route(item)">
  128. <image class="f-img" :src="item.cover_pic" />
  129. <view class="f-content dir-top-wrap main-between">
  130. <text class="t-omit-two f-title">{{ item.name }}</text>
  131. <view>
  132. <view class="f-invalid dir-left-nowrap cross-center main-between"
  133. v-if="item.status_type === 3">
  134. <image src="/static/image/icon/invalid.png"></image>
  135. <text>失效</text>
  136. </view>
  137. <view class="f-low-stock dir-left-nowrap cross-center main-between"
  138. v-if="item.status_type === 2">
  139. <image src="/static/image/icon/low_stock.png"></image>
  140. <text>低库存</text>
  141. </view>
  142. <view class="f-low-price"
  143. v-if="item.status_type === 1">
  144. <view class="dir-left-nowrap main-between cross-center">
  145. <image src="/static/image/icon/low_price.png"></image>
  146. <text>比收藏时降价{{item.low_price}}元</text>
  147. </view>
  148. </view>
  149. <view class="dir-left-nowrap main-between" v-if="item.status_type !== 3">
  150. <view class="dir-top-wrap main-between">
  151. <text class="f-price" :class="getTheme + '-m-text ' + getTheme">{{item.price_content}}</text>
  152. <text class="f-scale">{{item.sales}}</text>
  153. </view>
  154. <view>
  155. <image class="f-share-icon" @click.stop="share(index)" src="./image/share.png"></image>
  156. <image class="f-delete-icon" @click.stop="del(index)" src="./image/delete.png"></image>
  157. </view>
  158. </view>
  159. </view>
  160. </view>
  161. </view>
  162. </view>
  163. <!-- #endif -->
  164. <view class="f-delete-box" v-if="touch"></view>
  165. <view class="f-delete dir-left-nowrap main-between cross-center" :class="touch ? 'f-delete-show' : 'f-delete-hidden'">
  166. <view class="dir-left-nowrap" @click="setTouchA(allTouch)">
  167. <view class="f-radio">
  168. <view class="f-kon" v-if="!allTouch"></view>
  169. <view class="f-touch" v-if="allTouch"></view>
  170. </view>
  171. <text>全选</text>
  172. </view>
  173. <button :class="touchNumber > 0 ? 'f-button-t ' : 'f-button-m'" @click="remove">删除</button>
  174. </view>
  175. </block>
  176. <block v-else>
  177. <view class="f-list dir-left-wrap"
  178. >
  179. <view class="f-list-item" @touchmove="handletouchmove"
  180. @touchstart="handletouchstart" @touchend="handletouchend(item, index)" v-for="(item, index) in list" :key="index" >
  181. <view class="f-img">
  182. <image :src="item.cover_pic"></image>
  183. <view class="f-invalid f-icon dir-left-nowrap cross-center main-between" v-if="item.status_type === 3">
  184. </view>
  185. <view class="f-low-price f-icon dir-left-nowrap cross-center main-between" v-if="item.status_type === 1">
  186. </view>
  187. <view class="f-low-stock f-icon dir-left-nowrap cross-center main-between" v-if="item.status_type === 2">
  188. </view>
  189. <view class="f-radio">
  190. <view class="f-kon" v-if="touch && !item.touch" ></view>
  191. <view class="f-touch" v-if="item.touch"></view>
  192. </view>
  193. </view>
  194. <view class="f-text dir-top-nowrap main-between">
  195. <text class="t-omit-two">{{item.name}}</text>
  196. <view class="dir-left-nowrap main-between">
  197. <text class="f-price" :class="getTheme + '-m-text ' + getTheme">{{item.price_content}}</text>
  198. <text class="f-sales">{{item.sales}}</text>
  199. </view>
  200. </view>
  201. </view>
  202. </view>
  203. <view class="f-delete-box" v-if="touch"></view>
  204. <view class="f-delete dir-left-nowrap main-between cross-center" :class="touch ? 'f-delete-show' : 'f-delete-hidden'">
  205. <view class="dir-left-nowrap" @click="setTouchA(allTouch)">
  206. <view class="f-radio">
  207. <view class="f-kon" v-if="!allTouch"></view>
  208. <view class="f-touch" v-if="allTouch"></view>
  209. </view>
  210. <text>全选</text>
  211. </view>
  212. <button :class="touchNumber > 0 ? 'f-button-t ' : 'f-button-m'" @click="remove">删除</button>
  213. </view>
  214. </block>
  215. <app-no-goods v-if="list.length === 0" background="#f7f7f7"></app-no-goods>
  216. </view>
  217. <view class="f-topic" v-if="!is_goods" :class="getCurrent === 1 ? 'f-good-show' : 'f-good-hidden'">
  218. <!-- #ifdef MP-TOUTIAO -->
  219. <app-special-topic-list :cat-show="false" :topic-list="topicList"></app-special-topic-list>
  220. <!-- #endif -->
  221. <!-- #ifndef MP-TOUTIAO -->
  222. <block v-for="(child, sub) in topicList" v-bind:key="sub" >
  223. <view style="margin-top: 10rpx;">
  224. <good-action style="width: 750rpx;" :index="sub" bgColor="#f7f7f7" :theme="getTheme"
  225. @del="del" @open="openAction"
  226. @share="share"
  227. :show="child.show">
  228. <template v-if="child.layout == 0">
  229. <app-jump-button form :url="`../topic/topic?id=${child.id}`" open_type="navigate">
  230. <view class="app-small-frame main-between ">
  231. <view class="app-content-text dir-top-nowrap main-between">
  232. <text class="app-text t-omit-two">{{child.title}}</text>
  233. <text class="app-text-read t-omit-two">{{child.abstract}}</text>
  234. <text class="app-text-read">{{child.read_count}}</text>
  235. </view>
  236. <image lazy-load class="app-image" mode="scaleToFill" :src="child.cover_pic"></image>
  237. </view>
  238. </app-jump-button>
  239. </template>
  240. <template v-if="child.layout == 1">
  241. <app-jump-button form :url="`../topic/topic?id=${child.id}`" open_type="navigate">
  242. <view class="app-big-frame dir-top-nowrap">
  243. <text class="app-text t-omit-two">{{child.title}}</text>
  244. <text class="app-text-read t-omit-two">{{child.abstract}}</text>
  245. <image lazy-load class="app-image" mode="scaleToFill" :src="child.cover_pic"></image>
  246. <text class="app-text-read">{{child.read_count}}</text>
  247. </view>
  248. </app-jump-button>
  249. </template>
  250. <template v-if="child.layout == 2">
  251. <app-jump-button form :url="`../topic/topic?id=${child.id}`" open_type="navigate">
  252. <view class="app-more-frame dir-top-nowrap">
  253. <text class="app-text t-omit-two">{{child.title}}</text>
  254. <text class="app-text-read t-omit-two">{{child.abstract}}</text>
  255. <view class="dir-left-nowrap">
  256. <block v-for="(item, index) in child.pic_list" :key="index">
  257. <image lazy-load class="app-image box-grow-1" mode="scaleToFill" :src="item.url"></image>
  258. </block>
  259. </view>
  260. <text class="app-text-read">{{child.read_count}}</text>
  261. </view>
  262. </app-jump-button>
  263. </template>
  264. </good-action>
  265. </view>
  266. </block>
  267. <app-share-qr-code v-model="topicShow"
  268. :url="shareItem.url"
  269. ></app-share-qr-code>
  270. <!-- #endif -->
  271. </view>
  272. </view>
  273. </app-layout>
  274. </template>
  275. <script>
  276. import {mapGetters} from "vuex";
  277. // #ifndef MP-TOUTIAO
  278. import goodAction from './component/good-action.vue';
  279. // #endif
  280. import appShareQrCode from '../../components/page-component/app-share-qr-code-poster/app-share-qr-code-poster.vue';
  281. import appSpecialTopicList from "../../components/page-component/app-special-topic/app-special-topic-list.vue";
  282. import appNoGoods from '../../components/page-component/app-no-goods/app-no-goods.vue';
  283. let catList = [];
  284. export default {
  285. name: 'favorite',
  286. data() {
  287. return {
  288. getCurrent: 0,
  289. is_goods: true,
  290. left: 0,
  291. rotate: {
  292. left: 0,
  293. right: 0
  294. },
  295. leftSet: 0,
  296. rightSet: 0,
  297. statusTop: 85,
  298. listStyle: true,
  299. statusList: [],
  300. selectStatus: 0,
  301. typeY: -800,
  302. show: false,
  303. list: [],
  304. topicList: [],
  305. timeOutEvent: -1,
  306. touch: false,
  307. allTouch: false,
  308. touchNumber: 0,
  309. shareShow: false,
  310. shareItem: {},
  311. goods_page: 1,
  312. topic_page: 1,
  313. topicShow: false
  314. }
  315. },
  316. computed: {
  317. getTabs: function() {
  318. return [
  319. {
  320. name: '商品'
  321. },
  322. {
  323. name: '专题'
  324. }
  325. ]
  326. },
  327. ...mapGetters('mallConfig', {
  328. cat_style: 'getCatStyle',
  329. getTheme: 'getTheme'
  330. }),
  331. },
  332. methods: {
  333. emit(index) {
  334. this.goods_page = 1;
  335. if (index === 0) {
  336. this.is_goods = true;
  337. this.left = 0;
  338. this.statusTop = 85;
  339. setTimeout(() => {
  340. this.getCurrent = index;
  341. });
  342. this.getFavorite();
  343. } else if (index === 1) {
  344. setTimeout(() => {
  345. this.is_goods = false;
  346. }, 500);
  347. this.getCurrent = index;
  348. this.left = 375;
  349. this.typeY = -800;
  350. this.statusTop = -85;
  351. for (let i in this.rotate) {
  352. this.rotate[i] = 0;
  353. }
  354. this.show = false;
  355. if (!this.listStyle) {
  356. for (let i = 0; i < this.list.length; i++) {
  357. this.list[i].touch = false;
  358. }
  359. this.touch = false;
  360. this.allTouch = false;
  361. }
  362. this.getTopicList();
  363. }
  364. },
  365. setDef(key) {
  366. if (key === 'right') {
  367. this.statusList = [
  368. {
  369. name: '全部状态',
  370. id: 0
  371. },
  372. {
  373. name: '优惠',
  374. id: 3
  375. },
  376. {
  377. name: '低库存',
  378. id: 1
  379. },
  380. {
  381. name: '失效',
  382. id: 2
  383. }
  384. ];
  385. this.rotate.left = 0;
  386. this.typeY = -800;
  387. } else {
  388. this.statusList = catList;
  389. this.rotate.right = 0;
  390. this.typeY = -800;
  391. }
  392. if (this.rotate[key] === 0) {
  393. this.rotate[key] = 180;
  394. this.show = true;
  395. this.typeY = -3;
  396. } else {
  397. this.rotate[key] = 0;
  398. }
  399. },
  400. setStatus(index) {
  401. this.selectStatus = index;
  402. },
  403. sureStatus(s) {
  404. this.goods_page = 1;
  405. this.typeY = -800;
  406. this.show = false;
  407. if (s === 1) {
  408. if (this.rotate.left !== 0) {
  409. this.leftSet = this.selectStatus;
  410. }
  411. if (this.rotate.right !== 0) {
  412. this.rightSet = this.selectStatus;
  413. }
  414. this.getFavorite();
  415. for (let i in this.rotate) {
  416. this.rotate[i] = 0;
  417. }
  418. } else {
  419. this.leftSet = 0;
  420. this.rightSet = 0;
  421. this.getFavorite();
  422. for (let i in this.rotate) {
  423. this.rotate[i] = 0;
  424. }
  425. }
  426. },
  427. async getCats() {
  428. const e = await this.$request({
  429. url: this.$api.favorite.cats,
  430. method: 'get'
  431. });
  432. catList = e.data.list;
  433. this.statusList = e.data.list;
  434. },
  435. async getFavorite(bool) {
  436. const e = await this.$request({
  437. url: this.$api.favorite.my_favorite_goods,
  438. method: 'get',
  439. data: {
  440. cat_id: this.leftSet,
  441. status: this.rightSet,
  442. page: this.goods_page
  443. }
  444. });
  445. if (!bool) {
  446. this.list = e.data.list;
  447. } else {
  448. this.list.push(...e.data.list);
  449. }
  450. },
  451. async getTopicList(bool) {
  452. const e = await this.$request({
  453. url: this.$api.user.my_favorite_topic,
  454. method: 'get',
  455. data: {
  456. page: this.topic_page
  457. }
  458. });
  459. let list = e.data.list;
  460. for (let i =0; i < list.length; i++) {
  461. list[i].show = false;
  462. }
  463. if (!bool) {
  464. this.topicList = list;
  465. } else {
  466. this.topicList.push(...list);
  467. }
  468. },
  469. del(index) {
  470. if (this.getCurrent === 0) {
  471. this.$request({
  472. url: this.$api.user.favorite_remove,
  473. method: 'get',
  474. data: {
  475. goods_id: this.list[index].id
  476. }
  477. });
  478. this.$delete(this.list, index);
  479. } else {
  480. this.$request({
  481. url: this.$api.topic.favorite,
  482. data: {
  483. id: this.topicList[index].id,
  484. is_favorite: 'no_love'
  485. },
  486. method: 'post'
  487. });
  488. this.$delete(this.topicList, index);
  489. }
  490. uni.showToast({
  491. title: '取消收藏成功',
  492. icon: 'none'
  493. });
  494. },
  495. remove() {
  496. let goods_ids = [];
  497. for (let i = 0; i < this.list.length; i++) {
  498. if (this.list[i].touch) {
  499. goods_ids.push(this.list[i].id);
  500. }
  501. }
  502. if (goods_ids.length === 0) return;
  503. this.$request({
  504. url: this.$api.user.favorite_batch_remove,
  505. method: 'post',
  506. data: {
  507. goods_ids: JSON.stringify(goods_ids)
  508. }
  509. });
  510. for (let i = 0; i < this.list.length; i++) {
  511. for (let j = 0; j < goods_ids.length; j++) {
  512. if (goods_ids[j] === this.list[i].id) {
  513. this.$delete(this.list, i);
  514. }
  515. }
  516. }
  517. uni.showToast({
  518. title: '取消收藏成功',
  519. icon: 'none'
  520. });
  521. },
  522. share(index) {
  523. if (this.getCurrent === 0) {
  524. let data = this.list[index];
  525. this.shareItem.goods = this.list[index];
  526. this.shareItem.hasPosterNav = true;
  527. this.shareItem.newShareUrl = this.$api.goods.poster + '&goods_id=' + data.id;
  528. this.shareShow = true;
  529. switch (data.sign) {
  530. case "step":
  531. this.shareItem.posterGenerate = this.$api.step.poster_generate + '&goods_id=' + data.id;
  532. this.shareItem.posterConfig = this.$api.step.poster_config + '&goods_id=' + data.id;
  533. break;
  534. case "book":
  535. this.shareItem.posterGenerate = this.$api.book.poster_generate + '&goods_id=' + data.id;
  536. this.shareItem.posterConfig = this.$api.book.poster_config + '&goods_id=' + data.id;
  537. break;
  538. case "bargain":
  539. this.shareItem.posterGenerate = this.$api.bargain.poster_generate + '&goods_id=' + data.id;
  540. this.shareItem.posterConfig = this.$api.bargain.poster_config + '&goods_id=' + data.id;
  541. break;
  542. case "integral_mall":
  543. this.shareItem.posterGenerate = this.$api.integral_mall.poster_generate + '&goods_id=' + data.id;
  544. this.shareItem.posterConfig = this.$api.integral_mall.poster_config + '&goods_id=' + data.id;
  545. break;
  546. case "pt":
  547. this.shareItem.posterGenerate = this.$api.pt.poster_generate + '&goods_id=' + data.id;
  548. this.shareItem.posterConfig = this.$api.pt.poster_config + '&goods_id=' + data.id;
  549. break;
  550. case "mch":
  551. this.shareItem.posterGenerate = this.$api.mch.poster_generate + '&goods_id=' + data.id;
  552. this.shareItem.posterConfig = this.$api.mch.poster_config + '&goods_id=' + data.id;
  553. break;
  554. case "miaosha":
  555. this.shareItem.posterGenerate = this.$api.miaosha.poster_generate + '&goods_id=' + data.id;
  556. this.shareItem.posterConfig = this.$api.miaosha.poster_config + '&goods_id=' + data.id;
  557. break;
  558. case "advance":
  559. this.shareItem.posterGenerate = this.$api.advance.poster_generate + '&goods_id=' + data.id;
  560. this.shareItem.posterConfig = this.$api.advance.poster_config + '&goods_id=' + data.id;
  561. break;
  562. case "quick_share":
  563. this.shareItem.posterGenerate = this.$api.quick_share.poster_generate + '&goods_id=' + data.id;
  564. this.shareItem.posterConfig = this.$api.quick_share.poster_config + '&goods_id=' + data.id;
  565. break;
  566. case "pick":
  567. this.shareItem.posterGenerate = this.$api.pick.poster_generate + '&goods_id=' + data.id;
  568. this.shareItem.posterConfig = this.$api.pick.poster_config + '&goods_id=' + data.id;
  569. break;
  570. default:
  571. this.shareItem.posterGenerate = this.$api.poster.goods_new + '&goods_id=' + data.id;
  572. this.shareItem.posterConfig = this.$api.goods.poster + '&goods_id=' + data.id;
  573. break;
  574. }
  575. } else {
  576. this.shareItem.url = this.$api.poster.topic + '&id=' + this.topicList[index].id;
  577. this.shareItem.topic = this.topicList[index];
  578. this.topicShow = true;
  579. }
  580. },
  581. openAction(index) {
  582. if (this.getCurrent === 0) {
  583. this.list[index].show = true;
  584. this.list.map((val, idx) => {
  585. if(index != idx) {
  586. this.list[idx].show = false;
  587. }
  588. });
  589. } else {
  590. this.topicList[index].show = true;
  591. this.topicList.map((val, idx) => {
  592. if(index != idx) {
  593. this.topicList[idx].show = false;
  594. }
  595. });
  596. }
  597. },
  598. handletouchmove() {
  599. clearTimeout(this.timeOutEvent); //清除定时器
  600. this.timeOutEvent = 0;
  601. },
  602. handletouchstart(e) {
  603. this.timeOutEvent = setTimeout(() => {
  604. this.onLongPress(e)
  605. }, 1000);
  606. return false;
  607. },
  608. handletouchend(item, index) {
  609. clearTimeout(this.timeOutEvent);
  610. if (this.timeOutEvent != 0) {
  611. //处理点击时间
  612. if (!this.touch) {
  613. this.route(item);
  614. } else if (this.touch) {
  615. this.setTouch(index);
  616. }
  617. }
  618. return false;
  619. },
  620. onLongPress(e) {
  621. this.touch = true;
  622. },
  623. setTouch(index) {
  624. this.list[index].touch = !this.list[index].touch;
  625. },
  626. setTouchA(allTouch) {
  627. this.allTouch = !allTouch;
  628. for (let i = 0; i < this.list.length; i++) {
  629. this.list[i].touch = this.allTouch;
  630. }
  631. },
  632. setListStyle() {
  633. this.listStyle = !this.listStyle;
  634. this.touch = false;
  635. if (!this.listStyle) {
  636. for (let i = 0; i < this.list.length; i++) {
  637. this.list[i].touch = false;
  638. }
  639. this.allTouch = false;
  640. }
  641. },
  642. route(item) {
  643. if (item.status_type !== 3) {
  644. uni.navigateTo({
  645. url: item.page_url
  646. })
  647. }
  648. },
  649. edit() {
  650. if (this.touch) {
  651. for (let i = 0; i < this.list.length; i++) {
  652. this.list[i].touch = false;
  653. }
  654. this.touch = false;
  655. this.allTouch = false;
  656. } else {
  657. this.touch = !this.touch;
  658. for (let i = 0; i < this.list.length; i++) {
  659. this.list[i].show = false;
  660. }
  661. }
  662. },
  663. closeMask() {
  664. this.show = false;
  665. this.rotate.left = 0;
  666. this.rotate.right = 0;
  667. this.typeY = -500;
  668. }
  669. },
  670. watch: {
  671. rotate: {
  672. handler(data) {
  673. if (data.left === 0 && data.right === 0) {
  674. this.show = false;
  675. }
  676. if (data.left !== 0) {
  677. this.selectStatus = this.leftSet;
  678. }
  679. if (data.right !== 0) {
  680. this.selectStatus = this.rightSet;
  681. }
  682. },
  683. deep: true
  684. },
  685. list: {
  686. handler(data) {
  687. let touch = 0;
  688. for (let i = 0; i < data.length; i++) {
  689. if (data[i].touch) {
  690. touch ++;
  691. }
  692. }
  693. this.touchNumber = touch;
  694. if (touch === data.length) {
  695. this.allTouch = true;
  696. } else {
  697. this.allTouch = false;
  698. }
  699. },
  700. deep: true
  701. }
  702. },
  703. onLoad() {
  704. this.getCats();
  705. this.getFavorite();
  706. },
  707. components: {
  708. // #ifndef MP-TOUTIAO
  709. goodAction,
  710. // #endif
  711. appShareQrCode,
  712. 'app-special-topic-list': appSpecialTopicList,
  713. appNoGoods
  714. },
  715. onReachBottom() {
  716. if (this.getCurrent === 0) {
  717. this.goods_page++;
  718. this.getFavorite(true);
  719. } else {
  720. this.topic_page++;
  721. this.getTopicList(true);
  722. }
  723. },
  724. onShareAppMessage(object) {
  725. if (object.from === 'button') {
  726. if (this.getCurrent === 0) {
  727. return this.$shareAppMessage({
  728. title: this.shareItem.goods.name,
  729. imageUrl: this.shareItem.goods.cover_pic,
  730. path: '/pages/goods/goods',
  731. params: {
  732. id:this.shareItem.goods.id
  733. }
  734. });
  735. } else {
  736. return this.$shareAppMessage({
  737. title: this.shareItem.topic.app_share_title ? this.shareItem.topic.app_share_title : this.shareItem.topic.title,
  738. imageUrl: this.shareItem.topic.cover_pic ? this.shareItem.topic.cover_pic : '',
  739. path: '/pages/topic/topic',
  740. params: {
  741. id:this.shareItem.topic.id
  742. }
  743. });
  744. }
  745. }
  746. },
  747. filters: {
  748. category(data) {
  749. for (let i = 0; i < catList.length; i++) {
  750. if (catList[i].id === data) {
  751. return catList[i].name;
  752. }
  753. }
  754. },
  755. setStatus(data) {
  756. let statusList = [
  757. {
  758. name: '全部状态',
  759. id: 0
  760. },
  761. {
  762. name: '优惠',
  763. id: 3
  764. },
  765. {
  766. name: '低库存',
  767. id: 1
  768. },
  769. {
  770. name: '失效',
  771. id: 2
  772. }
  773. ];
  774. for (let i = 0; i < statusList.length; i++) {
  775. if (statusList[i].id === data) {
  776. return statusList[i].name;
  777. }
  778. }
  779. }
  780. }
  781. }
  782. </script>
  783. <style scoped lang="scss">
  784. .item {
  785. display: flex;
  786. padding: 20rpx;
  787. image {
  788. width: 120rpx;
  789. flex: 0 0 120rpx;
  790. height: 120rpx;
  791. margin-right: 20rpx;
  792. border-radius: 12rpx;
  793. }
  794. }
  795. .title {
  796. text-align: left;
  797. font-size: 28rpx;
  798. color: red;
  799. margin-top: 20rpx;
  800. }
  801. .f-favorite {
  802. min-height: 600rpx;
  803. }
  804. .f-tabs {
  805. height: 88upx;
  806. background-color: #fff;
  807. border-bottom: 1upx solid #e2e2e2;
  808. z-index: 10;
  809. position: fixed;
  810. top: 0;
  811. width: 100%;
  812. }
  813. .u-tabs-scorll-flex {
  814. display: flex;
  815. justify-content: space-between;
  816. }
  817. .u-tabs-scroll-box {
  818. position: relative;
  819. }
  820. .u-tabs-scorll-flex .u-tabs-item {
  821. flex: 1;
  822. }
  823. .u-tabs-item {
  824. position: relative;
  825. display: inline-block;
  826. text-align: center;
  827. font-size: 32upx;
  828. height: 88upx;
  829. line-height: 88upx;
  830. width: 50%;
  831. transition-property: background-color, color, font-weight;
  832. }
  833. .u-scroll-bar {
  834. position: absolute;
  835. bottom: 0rpx;
  836. width: 58upx;
  837. height: 4upx;
  838. left: 160upx;
  839. transition: .5s;
  840. }
  841. .f-set {
  842. position: relative;
  843. .f-select {
  844. position: absolute;
  845. top: 0;
  846. width: 750upx;
  847. transition: .5s;
  848. z-index: 8;
  849. background-color: #f5f5f5;
  850. .f-button {
  851. height: 90upx;
  852. border-top: 1upx solid #e2e2e2;
  853. button {
  854. font-size: 26upx;
  855. line-height: 90upx;
  856. border-radius: 0;
  857. }
  858. button:first-child {
  859. color:#747474;
  860. background-color: #fff;
  861. }
  862. button:last-child {
  863. color: #fff;
  864. }
  865. }
  866. .f-type {
  867. padding: 48upx 24upx 24upx 24upx;
  868. max-height: 360upx;
  869. .f-type-item {
  870. margin-bottom: 24upx;
  871. background-color: #ffffff;
  872. border: 1upx solid;
  873. width: 339upx;
  874. border-radius: 37upx;
  875. height: 72upx;
  876. line-height: 72upx;
  877. font-size: 25upx;
  878. text-align: center;
  879. }
  880. .f-type-def {
  881. border: 1upx solid #e2e2e2;
  882. color: #353535;
  883. }
  884. .f-type-item:nth-child(odd) {
  885. margin-right: 23upx;
  886. }
  887. }
  888. }
  889. }
  890. .f-status {
  891. height: 78upx;
  892. background-color: #ffffff;
  893. border-bottom: 1upx solid #e2e2e2;
  894. padding: 0 24upx;
  895. transition: .5s;
  896. z-index: 9;
  897. position: fixed;
  898. width: 100%;
  899. top: 2upx;
  900. >view:first-child {
  901. margin-right: 22upx;
  902. }
  903. .f-item {
  904. border-radius: 26upx;
  905. height: 52upx;
  906. margin-right: 5upx;
  907. width: 160upx;
  908. image {
  909. width: 11upx;
  910. height: 6upx;
  911. transition: .3s;
  912. margin-right: 16upx;
  913. }
  914. >view {
  915. width: 133upx;
  916. padding-left: 25upx;
  917. padding-right: 10upx;
  918. }
  919. text {
  920. width: 98upx;
  921. font-size: 23upx;
  922. }
  923. }
  924. .f-set {
  925. border: 1upx solid;
  926. background-color: #ffffff;
  927. }
  928. .f-def-set {
  929. border: 1upx solid #f5f5f5;
  930. background-color: #f5f5f5;
  931. }
  932. .f-img {
  933. background-color: #353535;
  934. }
  935. text {
  936. font-size: 23upx;
  937. }
  938. .f-good-icon {
  939. width: 78upx;
  940. height: 78upx;
  941. position: absolute;
  942. right: 0;
  943. padding: 24upx;
  944. }
  945. .f-good-btn {
  946. position: absolute;
  947. right: 79upx;
  948. padding: 24upx;
  949. font-size:24upx;
  950. }
  951. }
  952. .u-mask {
  953. position: fixed;
  954. top: 0;
  955. left: 0;
  956. right: 0;
  957. bottom: 0;
  958. opacity: 0;
  959. visibility: hidden;
  960. background: rgba(0, 0, 0, 0.6);
  961. z-index: 6;
  962. transition: all .3s ease-in-out;
  963. transform: scale(1.2,1.2);
  964. }
  965. .u-mask-no {
  966. z-index: 0;
  967. }
  968. .u-mask-show {
  969. opacity: 1;
  970. visibility: visible;
  971. transform: scale(1);
  972. }
  973. .f-good-hidden {
  974. opacity: 0;
  975. visibility: hidden;
  976. }
  977. .f-good-show {
  978. opacity: 1;
  979. visibility: visible;
  980. }
  981. .f-good {
  982. margin-top: 166upx;
  983. visibility: visible;
  984. transition: all .3s ease-in-out;
  985. .f-item {
  986. width: 750upx;
  987. padding: 24upx;
  988. .f-img {
  989. width: 200upx;
  990. height: 200upx;
  991. border-radius: 23upx;
  992. margin-right: 24upx;
  993. }
  994. .f-content {
  995. width: 478upx;
  996. }
  997. .f-title {
  998. font-size: 26upx;
  999. color: #353535;
  1000. }
  1001. .f-invalid {
  1002. width: 128upx;
  1003. height: 42upx;
  1004. line-height: 42upx;
  1005. background-color: #f7f7f7;
  1006. padding: 0 27upx 0 18upx;
  1007. >text {
  1008. font-size: 23upx;
  1009. color: #999999;
  1010. }
  1011. >image {
  1012. width: 24upx;
  1013. height: 24upx;
  1014. }
  1015. }
  1016. .f-low-stock {
  1017. width: 148upx;
  1018. height: 42upx;
  1019. line-height: 42upx;
  1020. background-color: #ffecec;
  1021. padding: 0 27upx 0 18upx;
  1022. >text {
  1023. font-size: 23upx;
  1024. color: #ff4544;
  1025. }
  1026. >image {
  1027. width: 24upx;
  1028. height: 24upx;
  1029. }
  1030. }
  1031. .f-low-price {
  1032. height: 42upx;
  1033. line-height: 42upx;
  1034. display: inline-block;
  1035. background-color: #ffecec;
  1036. padding: 0 27upx 0 18upx;
  1037. position: relative;
  1038. font-size: 23upx;
  1039. color: #ff4544;
  1040. >text {
  1041. font-size: 23upx;
  1042. color: #ff4544;
  1043. vertical-align:center;
  1044. }
  1045. image {
  1046. width: 24upx;
  1047. height: 24upx;
  1048. margin-right: 14upx;
  1049. }
  1050. }
  1051. .f-delete-icon {
  1052. width: 46upx;
  1053. height: 50upx;
  1054. padding: 8upx;
  1055. }
  1056. .f-share-icon {
  1057. width: 46upx;
  1058. height: 46upx;
  1059. padding: 8upx;
  1060. margin-right: 10upx;
  1061. }
  1062. .f-price {
  1063. font-size: 24upx;
  1064. margin-top: 12upx;
  1065. }
  1066. .f-scale {
  1067. font-size: 21upx;
  1068. color: #b0b0b0;
  1069. }
  1070. }
  1071. .f-list {
  1072. padding: 0 24upx;
  1073. .f-list-item {
  1074. height: 492upx;
  1075. width: 344upx;
  1076. border-radius: 12upx;
  1077. margin-top: 14upx;
  1078. background-color: #fff;
  1079. overflow: hidden;
  1080. }
  1081. .f-list-item:nth-child(odd) {
  1082. margin-right: 15upx;
  1083. }
  1084. .f-img {
  1085. width: 344upx;
  1086. height: 344upx;
  1087. position: relative;
  1088. >image {
  1089. width: 344upx;
  1090. height: 344upx;
  1091. }
  1092. .f-radio {
  1093. width: 40upx;
  1094. height: 40upx;
  1095. border-radius: 50%;
  1096. position: absolute;
  1097. top: 10upx;
  1098. right: 10upx;
  1099. .f-kon {
  1100. width: 40upx;
  1101. height: 40upx;
  1102. border-radius: 50%;
  1103. border: 1upx solid #868686;
  1104. }
  1105. .f-touch {
  1106. width: 40upx;
  1107. height: 40upx;
  1108. background-size: 100% 100%;
  1109. background-repeat: no-repeat;
  1110. border-radius: 50%;
  1111. z-index: 1;
  1112. background-image: url("./image/touch.png");
  1113. }
  1114. }
  1115. }
  1116. .f-invalid {
  1117. width: 112upx;
  1118. background-image: url("./image/invalid.png");
  1119. }
  1120. .f-low-price {
  1121. width: 112upx;
  1122. background-image: url("./image/low_price.png");
  1123. }
  1124. .f-low-stock {
  1125. width: 152upx;
  1126. background-image: url("./image/low_stock.png");
  1127. }
  1128. .f-icon {
  1129. bottom: 24upx;
  1130. left: 0;
  1131. height: 46upx;
  1132. padding: 0 18upx 0 17upx;
  1133. position: absolute;
  1134. border-top-right-radius: 25upx;
  1135. border-bottom-right-radius: 25upx;
  1136. background-repeat: no-repeat;
  1137. background-size: 100% 100%;
  1138. }
  1139. .f-text {
  1140. width: 100%;
  1141. height: 148upx;
  1142. padding-bottom: 10upx;
  1143. >text {
  1144. font-size: 26upx;
  1145. padding: 18upx 23upx 0 23upx;
  1146. }
  1147. >view {
  1148. padding: 0 23upx 0 23upx;
  1149. margin-bottom: 18upx;
  1150. }
  1151. .f-price {
  1152. font-size: 21upx;
  1153. }
  1154. .f-sales {
  1155. font-size: 23upx;
  1156. color: #999999;
  1157. }
  1158. }
  1159. }
  1160. .f-delete-box {
  1161. width: 100%;
  1162. height: 100upx;
  1163. }
  1164. .f-delete {
  1165. position: fixed;
  1166. width: 100%;
  1167. height: 100upx;
  1168. border-top: 1px solid #e2e2e2;
  1169. background-color: #FFFFFF;
  1170. z-index: 8;
  1171. left: 0;
  1172. transition: all .3s ease-in-out;
  1173. font-size: 26upx;
  1174. padding: 0 24upx;
  1175. >button {
  1176. width: 138upx;
  1177. height: 64upx;
  1178. line-height: 64upx;
  1179. border-radius: 32upx;
  1180. background-color: #ffffff;
  1181. margin: 0;
  1182. border-width: 1upx;
  1183. border-style: solid;
  1184. transform: rotateZ(360deg);
  1185. }
  1186. .f-button-m {
  1187. border-color: #999999;
  1188. color: #999999;
  1189. }
  1190. .f-button-t {
  1191. border-color: #ff4544;
  1192. color: #ff4544;
  1193. }
  1194. >view {
  1195. width: 103upx;
  1196. .f-radio {
  1197. width: 40upx;
  1198. height: 40upx;
  1199. border-radius: 50%;
  1200. margin-right: 10upx;
  1201. .f-kon {
  1202. width: 40upx;
  1203. height: 40upx;
  1204. border-radius: 50%;
  1205. border: 1upx solid #868686;
  1206. }
  1207. .f-touch {
  1208. width: 40upx;
  1209. height: 40upx;
  1210. background-size: 100% 100%;
  1211. background-repeat: no-repeat;
  1212. border-radius: 50%;
  1213. z-index: 1;
  1214. background-image: url("./image/touch.png");
  1215. }
  1216. }
  1217. }
  1218. }
  1219. .f-delete-show {
  1220. bottom: 0;
  1221. visibility: visible;
  1222. }
  1223. .f-delete-hidden {
  1224. bottom: -101upx;
  1225. visibility: hidden;
  1226. }
  1227. }
  1228. // #ifndef MP-TOUTIAO
  1229. .f-swipe-content {
  1230. background-color: #ffffff;
  1231. }
  1232. //#endif
  1233. .f-topic {
  1234. margin-top: 88upx;
  1235. }
  1236. .f-radio {
  1237. width: 85upx;
  1238. height: 248upx;
  1239. .f-radio-no {
  1240. border-radius: 50%;
  1241. width: 40upx;
  1242. height: 40upx;
  1243. border: 1upx solid #868686;
  1244. }
  1245. .f-radio-yes {
  1246. width: 40upx;
  1247. height: 40upx;
  1248. background-size: 100% 100%;
  1249. background-repeat: no-repeat;
  1250. border-radius: 50%;
  1251. background-image: url("./image/touch.png");
  1252. }
  1253. }
  1254. .app-content-item {
  1255. width: #{750rpx};
  1256. border-top: #{0.1rpx} solid transparent;
  1257. }
  1258. .app-text-read {
  1259. font-size: #{24rpx};
  1260. color: #919191;
  1261. }
  1262. .app-small-frame {
  1263. background-color: #ffffff;
  1264. width: #{750rpx};
  1265. overflow: hidden;
  1266. padding: #{20rpx} #{24rpx};
  1267. .app-image {
  1268. width: #{268rpx};
  1269. height: #{202rpx};
  1270. }
  1271. .app-content-text {
  1272. width: #{394rpx};
  1273. height: #{190rpx};
  1274. .app-text {
  1275. font-size: #{32rpx};
  1276. color: #353535;
  1277. width: #{394rpx};
  1278. }
  1279. }
  1280. }
  1281. .app-big-frame {
  1282. padding: #{32rpx} #{24rpx} #{24rpx} #{24rpx};
  1283. background-color: #ffffff;
  1284. .app-text {
  1285. font-size: #{32rpx};
  1286. width: #{750-24-24rpx};
  1287. color: #353535;
  1288. display: -webkit-box;
  1289. -webkit-box-orient: vertical;
  1290. -webkit-line-clamp: 2;
  1291. overflow: hidden;
  1292. }
  1293. .app-image {
  1294. width: #{750-24-24rpx};
  1295. height: #{350rpx};
  1296. margin: #{24rpx} 0;
  1297. }
  1298. }
  1299. .app-more-frame {
  1300. padding: #{32rpx} #{24rpx} #{24rpx} #{24rpx};
  1301. background-color: #ffffff;
  1302. .app-text {
  1303. font-size: #{32rpx};
  1304. width: #{750-24-24rpx};
  1305. color: #353535;
  1306. }
  1307. .app-image {
  1308. margin-top: #{16rpx};
  1309. width: #{226rpx};
  1310. height: #{170rpx};
  1311. margin-right: #{12rpx};
  1312. margin-bottom: #{16rpx};
  1313. display: block;
  1314. }
  1315. }
  1316. </style>