favorite.vue 49 KB

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