immediatelyList.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092
  1. <template>
  2. <view
  3. class="container commodity-list-wrapper"
  4. :style="{ overflow: showSkeleton ? 'hidden' : 'auto', height: showSkeleton ? windowHeight + 'px' : 'auto' }"
  5. >
  6. <view class="good-search clearfix" v-if="searchStatus">
  7. <view class="nav-tab-bar u-f-ajc">
  8. <block v-for="(tab, index) in tabBars" :key="tab.id" :class="{ current: tabIndex === index }">
  9. <view class="tabstyle u-f-ajc" :class="{ addstyle: tabIndex == index }" @tap="changeTab(index)">
  10. {{ tab.name }}<i v-if="tabIndex == index" class="nav-tab-line iconfont icon-gou"></i>
  11. </view>
  12. </block>
  13. </view>
  14. <view class="search-from name">
  15. <text class="iconfont icon-iconfonticonfontsousuo1"></text>
  16. <input
  17. class="input"
  18. type="text"
  19. :focus="isFocus"
  20. confirm-type="search"
  21. v-model="searchInputVal"
  22. placeholder="请输入商品关键词"
  23. @input="onShowClose"
  24. @confirm="searchOpertor(tabIndex)"
  25. maxlength="20"
  26. />
  27. <text class="iconfont icon-shanchu1" v-if="isShowClose" @click="delInputText(tabIndex)"></text>
  28. </view>
  29. </view>
  30. <list-skeleton v-if="showSkeleton"></list-skeleton>
  31. <view class="empty-container" v-if="isShowEmpty">
  32. <image
  33. class="empty-container-image"
  34. src="https://img.caimei365.com/group1/M00/03/71/Cmis2F3wna6AY2ZjAABpmnBICH4247.png"
  35. ></image>
  36. <text class="error-text">{{ isShowEmptyText }}</text>
  37. </view>
  38. <!-- 单一商品 -->
  39. <view class="product-container" v-else>
  40. <view :class="tabIndex" v-if="tabIndex === 0" :style="{ paddingTop: searchStatus ? '128rpx' : '' }">
  41. <scroll-view
  42. :style="{ height: scrollHeight + 'px' }"
  43. @scrolltolower="scrolltolower(tabIndex)"
  44. scroll-y
  45. v-if="listData.length > 0"
  46. >
  47. <view
  48. v-for="(pros, index) in listData"
  49. :key="index"
  50. :id="pros.productId"
  51. class="all-type-list-content commodity-list"
  52. @click.stop="navToDetailPage(pros.productId)"
  53. >
  54. <image mode="widthFix" :src="pros.image" class="list-img" alt="list-img"></image>
  55. <view class="list-details-info">
  56. <text class="list-details-title">{{ isInterceptHtmlFn(pros.name) }}</text>
  57. <text class="list-details-specs">规格:{{ pros.unit ? pros.unit : '' }}</text>
  58. <text class="list-details-miniQuantity list-details-specs"
  59. >起订量:{{ pros.minBuyNumber }}</text
  60. >
  61. <view class="list-details-specs" v-if="pros.code != '' && pros.code != null">
  62. <view>商品编码:{{ pros.code }}</view>
  63. </view>
  64. <view class="list-details-price">
  65. <template v-if="priceLoading">
  66. <view class="list-price-loding">正在获取价格...</view>
  67. </template>
  68. <template v-else>
  69. <view class="list-shop">
  70. <view class="list-price">
  71. <text
  72. class="price-larger"
  73. :class="
  74. PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1
  75. ? 'none'
  76. : ''
  77. "
  78. >
  79. ¥{{
  80. (PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1
  81. ? pros.originalPrice
  82. : pros.price) | NumFormat
  83. }}
  84. </text>
  85. </view>
  86. </view>
  87. <button class="add-cart-btn" @click.stop="operationHanld(pros)">数量</button>
  88. </template>
  89. </view>
  90. <view class="list-details-price">
  91. <view class="floor-item-act">
  92. <view class="coupon-tags" v-if="pros.couponsLogo">优惠券</view>
  93. <template v-if="pros.actStatus == 1">
  94. <view class="floor-tags" v-if="PromotionsFormat(pros.promotions)">
  95. {{ pros.promotions.name }}<text>:¥{{ pros.price | NumFormat }}</text>
  96. </view>
  97. <view class="floor-tags" v-else>{{ pros.promotions.name }}</view>
  98. </template>
  99. <template v-if="pros.svipProductFlag == 1">
  100. <view class="svip-tags">
  101. <view class="tags">SVIP</view>
  102. <view class="price">{{ pros.svipPriceTag }}</view>
  103. </view>
  104. </template>
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. <view v-if="showLoading && listData.length > 4 && !showRegularBtn">
  110. <view class="loading-wrapper loading-wrapper-now" v-if="loadingNow"
  111. >{{ loadingText }}<text v-if="loadingText === '已至底部'">‧ ‧ ‧</text></view
  112. >
  113. <view class="loading-wrapper loading-wrapper-btm" v-else
  114. >———<text class="btm-text">已至底部</text>———</view
  115. >
  116. </view>
  117. </scroll-view>
  118. </view>
  119. <!-- 组合商品 -->
  120. <view :class="tabIndex" v-if="tabIndex === 1">
  121. <scroll-view
  122. :style="{ height: scrollHeight + 'px', paddingTop: searchStatus ? '112rpx' : '' }"
  123. @scrolltolower="scrolltolower(tabIndex)"
  124. scroll-y
  125. >
  126. <view class="all-zuhe-list" v-for="(item, index) in combinationProduct" :key="index" :id="item.id">
  127. <view class="zuhe_title" :class="index % 2 == 0 ? 'active' : ''">{{ item.name }}</view>
  128. <view
  129. v-for="(pros, proIndex) in item.combinationProductList"
  130. :class="index % 2 == 0 ? 'stylecontent' : ''"
  131. :key="proIndex"
  132. :id="pros.productId"
  133. class="zuhe-list-content commodity-list"
  134. >
  135. <view class="list-details-info">
  136. <text class="list-details-title zuhe_list_text">商品编码:{{ pros.code }}</text>
  137. <text
  138. class="list-details-specs zuhe_list_text"
  139. @click.stop="navToDetailPage(pros.productId)"
  140. >{{ pros.name }}</text
  141. >
  142. <view class="list-details-price zuhe_list_price">
  143. <view class="list-shop com">
  144. <view class="list-price zuhe_list_price">
  145. <view class="zuhe_price-larger zuhe_list_text">
  146. <view class="list-price-none" v-if="pros.repurchaseFlag == 1">
  147. <text class="price-none">价格:¥{{ pros.originalPrice }}</text>
  148. <text
  149. class="iconfont icon-wenhao"
  150. @click.stop="repurchModel"
  151. ></text>
  152. </view>
  153. <view class="price-larger">价格:¥{{ pros.price | NumFormat }}</view>
  154. </view>
  155. <view class="zuhe_price-larger zuhe_list_text">
  156. <view class="floor-item-act">
  157. <view class="coupon-tags" v-if="pros.couponsLogo">优惠券</view>
  158. <template v-if="pros.actStatus == 1">
  159. <view
  160. class="floor-tags"
  161. v-if="PromotionsFormat(pros.promotions)"
  162. >
  163. {{ pros.promotions.name
  164. }}<text>:¥{{ pros.price | NumFormat }}</text>
  165. </view>
  166. <view class="floor-tags" v-else>{{
  167. pros.promotions.name
  168. }}</view>
  169. </template>
  170. <template v-if="pros.svipProductFlag == 1">
  171. <view class="svip-tags">
  172. <view class="tags">SVIP</view>
  173. <view class="price">{{ pros.svipPriceTag }}</view>
  174. </view>
  175. </template>
  176. </view>
  177. <view class="count">
  178. <view class="number-box">
  179. <view
  180. class="iconfont icon-jianhao"
  181. @click.stop="changeCountSub(item, pros)"
  182. ></view>
  183. <input
  184. class="btn-input"
  185. type="number"
  186. maxlength="6"
  187. v-model="pros.initProductNum"
  188. @blur="changeNnmber($event, item, pros)"
  189. />
  190. <view
  191. class="iconfont icon-jiahao"
  192. @click.stop="changeCountAdd(item, pros)"
  193. ></view>
  194. </view>
  195. </view>
  196. </view>
  197. <view class="list-price-all" :style="{ overflow: 'hidden' }">
  198. <view class="price-two zuhe_list_text"
  199. >总价:<text class="zuhe_list_zj"
  200. >¥ {{ pros.totalPrice | NumFormat }}</text
  201. ></view
  202. >
  203. </view>
  204. </view>
  205. </view>
  206. </view>
  207. </view>
  208. </view>
  209. <view class="foot_conten">
  210. <view class="zuhe_foot-box">
  211. <view class="">
  212. <text>种类:{{ item.productKind }}</text>
  213. <text>总数:{{ item.productTotalNum }}</text>
  214. </view>
  215. <text
  216. >总额:<text class="foot_text">{{
  217. item.productTotalAmount | NumFormat
  218. }}</text></text
  219. >
  220. </view>
  221. <button type="default" class="buycart" @click.stop="operationHanld(item)">
  222. 加入购物车
  223. </button>
  224. </view>
  225. </view>
  226. <view v-if="showLoading && combinationProduct.length > 4 && !showRegularBtn">
  227. <view class="loading-wrapper loading-wrapper-now" v-if="loadingNow"
  228. >{{ loadingText }}<text v-if="loadingText === '已至底部'">‧ ‧ ‧</text></view
  229. >
  230. <view class="loading-wrapper loading-wrapper-btm" v-else
  231. >———<text class="btm-text">已至底部</text>———</view
  232. >
  233. </view>
  234. </scroll-view>
  235. </view>
  236. </view>
  237. <!-- 可拖动悬浮按钮 -->
  238. <cm-drag
  239. :cartNum="cartQuantity"
  240. :isDock="true"
  241. :existTabBar="true"
  242. @btnClick="btnClick"
  243. @btnTouchstart="btnTouchstart"
  244. @btnTouchend="btnTouchend"
  245. >
  246. </cm-drag>
  247. <!-- 透明模态层 -->
  248. <modal-layer v-if="isModallayer"></modal-layer>
  249. </view>
  250. </template>
  251. <script>
  252. import listSkeleton from '@/components/cm-module/listTemplate/listSkeleton'
  253. import modalLayer from '@/components/modal-layer'
  254. import uniStars from '@/components/uni-stars/uni-stars.vue'
  255. import cmDrag from '@/components/cm-custom/cm-drag.vue'
  256. import { mapState, mapMutations } from 'vuex'
  257. export default {
  258. name: 'productList',
  259. components: {
  260. listSkeleton,
  261. modalLayer,
  262. uniStars,
  263. cmDrag
  264. },
  265. props: {
  266. searchStatus: {
  267. type: Boolean,
  268. default: false
  269. }
  270. },
  271. data() {
  272. return {
  273. isShowClose: false,
  274. searchInputVal: '',
  275. isModallayer: false,
  276. windowHeight: '',
  277. showSkeleton: false,
  278. priceLoading: true,
  279. isShowEmpty: false,
  280. isShowEmptyText: '搜索相关商品',
  281. userId:0,
  282. clubUserId: '',
  283. identity: 0,
  284. isFocus: false,
  285. scrollHeight: '',
  286. listData: [],
  287. combinationProduct: [],
  288. zuheProductList: [], //组合商品列表
  289. showLoading: false,
  290. loadingNow: true,
  291. loadingText: '上拉加载更多',
  292. pageSize: 20,
  293. zuhepageSize: 5,
  294. pageNum: 1,
  295. totalPage: 1,
  296. hasNextPage: false,
  297. pullFlag: true,
  298. fromRegularPurchasePage: false,
  299. cartQuantity: 0,
  300. showRegularBtn: false,
  301. isPrecedence: false,
  302. ladderPriceList: [], //是否 阶梯,
  303. tabIndex: 0,
  304. goodsList: [],
  305. tabBars: [{ name: '单一', id: 'danyi' }, { name: '组合', id: 'zuhe' }],
  306. isShow: false
  307. }
  308. },
  309. created() {
  310. this.setScrollHeight()
  311. this.initGetStotage()
  312. this.isFocus = true
  313. },
  314. filters: {
  315. NumFormat: function(text) {
  316. //处理金额
  317. return Number(text).toFixed(2)
  318. }
  319. },
  320. computed: {
  321. ...mapState(['hasLogin', 'userInfo'])
  322. },
  323. methods: {
  324. async initGetStotage() {// 初始化
  325. const userInfo = await this.$api.getStorage()
  326. const clubInfo = await this.$api.getComStorage('orderUserInfo')
  327. this.userId = userInfo.userId ? userInfo.userId : 0
  328. this.identity = userInfo.userIdentity ? userInfo.userIdentity : 0
  329. this.clubUserId = clubInfo.userId ? clubInfo.userId : 0
  330. this.getProductAgainInfo()
  331. },
  332. scrolltolower(tabIndex) {
  333. if (tabIndex == 0) {
  334. if (this.totalPage > this.listData.length && this.pullFlag) {
  335. this.getProductAgainInfo(true)
  336. }
  337. } else if (tabIndex == 1) {
  338. if (this.hasNextPage && this.pullFlag) {
  339. this.getcombinationProduct(true)
  340. }
  341. }
  342. },
  343. setScrollHeight() {
  344. const { windowHeight, pixelRatio } = wx.getSystemInfoSync()
  345. this.windowHeight = windowHeight - 1
  346. this.scrollHeight = windowHeight - 1
  347. },
  348. getProductAgainInfo(loadMore) {
  349. this.showLoading = true
  350. this.priceLoading = true
  351. this.loadingNow = true
  352. this.loadingText = '加载中'
  353. this.isShowEmpty = false
  354. if (loadMore) {
  355. this.pageNum += 1
  356. }
  357. this.ProductService.GetProductSearchList({
  358. identity: this.identity,
  359. keyword: this.searchInputVal,
  360. pageNum: this.pageNum,
  361. pageSize: this.pageSize,
  362. sortField: '',
  363. sortType: ''
  364. })
  365. .then(response => {
  366. this.isShowWrapper = true
  367. const resData = JSON.parse(response.data)
  368. const resList = resData.items
  369. if (resList && resList.length > 0) {
  370. this.totalPage = resData.total
  371. this.showEmpty = false
  372. if (loadMore) {
  373. this.listData = [...this.listData, ...resList]
  374. this.getProductPrice()
  375. } else {
  376. this.listData = [...resList]
  377. this.getProductPrice()
  378. this.showSkeleton = false
  379. }
  380. // 防上拉暴滑
  381. this.pullFlag = false
  382. setTimeout(() => {
  383. this.pullFlag = true
  384. }, 500)
  385. // 底部提示文案
  386. if (this.totalPage > this.listData.length) {
  387. this.loadingText = '上拉加载更多'
  388. } else {
  389. this.showLoading = true
  390. this.loadingNow = false
  391. }
  392. } else {
  393. if (!loadMore) {
  394. this.isShowEmpty = true
  395. this.isShowEmptyText = '暂无相关商品'
  396. }
  397. }
  398. })
  399. .catch(error => {
  400. this.$util.msg(error.msg, 2000)
  401. })
  402. },
  403. getProductPrice() {
  404. //获取商品或者活动价格
  405. let productIdArr = []
  406. let productIds = ''
  407. this.listData.map(item => {
  408. // 0公开价格 1不公开价格 2仅对资质机构公开
  409. productIdArr.push(item.productId)
  410. })
  411. productIds = productIdArr.join(',')
  412. this.ProductService.querySearchProductPrice({
  413. flag:this.identity, //查询促销标记 1协销 2机构 3供应商
  414. userId: this.userId,
  415. productIds: productIds,
  416. source: 2
  417. })
  418. .then(response => {
  419. this.listData = this.ReturnNewProducts(this.listData, response.data)
  420. this.priceLoading = false
  421. })
  422. .catch(error => {
  423. this.$util.msg(error.msg, 2000)
  424. })
  425. },
  426. ReturnNewProducts(Array, list) {
  427. //合并字段
  428. let NewArray = []
  429. Array.map(item => {
  430. for (let i = 0; i < list.length; i++) {
  431. if (item.productId == list[i].productId) {
  432. NewArray.push(Object.assign(item, list[i]))
  433. }
  434. }
  435. })
  436. return NewArray
  437. },
  438. searchOpertor(tabIndex) {
  439. //搜索商品
  440. if (tabIndex == 0) {
  441. if (this.searchInputVal == '') {
  442. this.$util.msg('请输入商品关键词', 2000)
  443. } else {
  444. this.pageNum = 1
  445. this.showSkeleton = true
  446. this.getProductAgainInfo()
  447. this.isFocus = false
  448. }
  449. } else {
  450. this.pageNum = 1
  451. this.showSkeleton = true
  452. this.getcombinationProduct()
  453. this.isFocus = false
  454. }
  455. },
  456. getcombinationProduct(loadMore) {
  457. //组合搜索商品
  458. this.showLoading = true
  459. this.loadingNow = true
  460. this.loadingText = '加载中'
  461. this.isShowEmpty = false
  462. if (loadMore) {
  463. this.pageNum += 1
  464. }
  465. this.ProductService.GetSearchCombinationProduct({
  466. clubUserId: this.clubUserId,
  467. pageNum: this.pageNum,
  468. pageSize: this.zuhepageSize,
  469. searchWord: this.searchInputVal
  470. })
  471. .then(response => {
  472. this.isShowWrapper = true
  473. const responseData = response.data
  474. console.log(responseData)
  475. if (responseData.results && responseData.results.length > 0) {
  476. this.hasNextPage = responseData.hasNextPage
  477. this.isShowEmpty = false
  478. if (loadMore) {
  479. this.combinationProduct = [...this.combinationProduct, ...responseData.results]
  480. } else {
  481. this.combinationProduct = [...responseData.results]
  482. this.showSkeleton = false
  483. }
  484. // 防上拉暴滑
  485. this.pullFlag = false
  486. setTimeout(() => {
  487. this.pullFlag = true
  488. }, 500)
  489. // 底部提示文案
  490. if (this.hasNextPage) {
  491. this.loadingText = '上拉加载更多'
  492. } else {
  493. this.showLoading = true
  494. this.loadingNow = false
  495. }
  496. } else {
  497. this.isShowEmpty = true
  498. this.isShowEmptyText = '暂无相关商品'
  499. }
  500. })
  501. .catch(error => {
  502. this.$util.msg(error.msg, 2000)
  503. })
  504. },
  505. changeCountAdd(item, pros) {
  506. //商品数量加加
  507. if (pros.initProductNum == 0) {
  508. pros.initProductNum = pros.minBuyNumber
  509. this.processActivityPrice(pros)
  510. } else if (pros.initProductNum >= pros.minBuyNumber) {
  511. pros.initProductNum++
  512. this.processActivityPrice(pros)
  513. }
  514. this.totalPeice(item)
  515. this.totalCount(item)
  516. this.totalKind(item)
  517. },
  518. changeCountSub(item, pros) {
  519. //商品数量减减
  520. if (pros.initProductNum == 0) {
  521. this.$util.msg('采购数量不能小于0', 2000)
  522. return
  523. } else if (pros.initProductNum == pros.minBuyNumber) {
  524. pros.initProductNum = 0
  525. this.processActivityPrice(pros)
  526. } else {
  527. pros.initProductNum--
  528. this.processActivityPrice(pros)
  529. }
  530. this.totalPeice(item)
  531. this.totalCount(item)
  532. this.totalKind(item)
  533. },
  534. changeNnmber(e, item, pros) {
  535. //输入商品数量更新
  536. let _value = e.detail.value
  537. if (!this.$api.isNumber(_value)) {
  538. pros.initProductNum = pros.minBuyNumber
  539. } else if (_value < pros.minBuyNumber) {
  540. this.$util.msg(`该商品最小起订量为${pros.minBuyNumber}`, 2000)
  541. pros.initProductNum = pros.minBuyNumber
  542. } else {
  543. pros.initProductNum = parseInt(e.detail.value)
  544. this.processActivityPrice(pros)
  545. }
  546. this.totalPeice(item)
  547. this.totalCount(item)
  548. this.totalKind(item)
  549. },
  550. totalPeice(item) {
  551. //计算总价格,每次调用此方法,将初始值为0,遍历价格并累加
  552. let prosPrice = 0
  553. let productsList = []
  554. productsList = item.combinationProductList
  555. productsList.forEach(pros => {
  556. prosPrice += pros.price * pros.initProductNum
  557. item.productTotalAmount = prosPrice
  558. })
  559. // console.log(prosPrice)
  560. },
  561. totalCount(item) {
  562. //计算总数量
  563. let prosAllCount = 0
  564. let productsList = []
  565. productsList = item.combinationProductList
  566. productsList.forEach(pros => {
  567. prosAllCount += parseInt(pros.initProductNum)
  568. item.productTotalNum = prosAllCount
  569. })
  570. // console.log(prosAllCount)
  571. },
  572. totalKind(item) {
  573. //计算商品种类
  574. let productsList = []
  575. let checkList = []
  576. productsList = item.combinationProductList
  577. productsList.forEach(pros => {
  578. if (pros.initProductNum > 0) {
  579. checkList.push(pros)
  580. item.productKind = checkList.length
  581. } else {
  582. item.productKind = checkList.length
  583. }
  584. })
  585. },
  586. processActivityPrice(pros) {
  587. //单独处理活动价格和阶梯价格
  588. let ladderPriceList = pros.ladderPrices
  589. if (pros.ladderPriceFlag == '0' || pros.actStatus == 1) {
  590. pros.totalPrice = pros.initProductNum * pros.price
  591. } else {
  592. ladderPriceList.forEach((item, index) => {
  593. if (pros.initProductNum >= item.buyNum) {
  594. pros.price = item.buyPrice
  595. pros.totalPrice = pros.initProductNum * item.buyPrice
  596. }
  597. })
  598. }
  599. },
  600. operationHanld(prop) {
  601. this.$emit('operationConfim', prop)
  602. },
  603. alertjieti(pros) {
  604. this.$emit('alertjietiConfim', pros)
  605. },
  606. changeTab(index) {
  607. this.tabIndex = index
  608. if (index == 0) {
  609. this.pageNum = 1
  610. this.getProductAgainInfo()
  611. } else {
  612. this.getcombinationProduct()
  613. }
  614. // this.$emit('changetab',index);
  615. },
  616. navToDetailPage(id) {
  617. this.isModallayer = true
  618. this.$api.navigateTo(`/pages/goods/product?id=${id}`)
  619. this.isModallayer = false
  620. },
  621. repurchModel() {
  622. this.$util.modal('', '此商品的价格有变化,原来的购买价已不适用', '知道了', '', false, () => {})
  623. },
  624. onShowClose() {
  625. //输入框失去焦点时触发
  626. if (this.searchInputVal != '') {
  627. this.isShowClose = true
  628. } else {
  629. this.isShowClose = false
  630. }
  631. },
  632. delInputText(tabIndex) {
  633. //清除输入框内容
  634. if (tabIndex == 0) {
  635. this.searchInputVal = ''
  636. this.listData = []
  637. this.isFocus = true
  638. this.isShowClose = false
  639. this.loadingNow = false
  640. this.isShowEmpty = true
  641. this.isShowEmptyText = '暂无相关商品'
  642. } else {
  643. this.searchInputVal = ''
  644. this.isShowClose = false
  645. this.isFocus = true
  646. this.getcombinationProduct()
  647. }
  648. },
  649. isInterceptHtmlFn(text) {
  650. let name = this.$reg.interceptHtmlFn(text)
  651. return name
  652. },
  653. PromotionsFormat(promo) {
  654. //促销活动类型数据处理
  655. if (promo != null) {
  656. if (promo.type == 1 && promo.mode == 1) {
  657. return true
  658. } else {
  659. return false
  660. }
  661. }
  662. return false
  663. },
  664. btnClick() {
  665. this.$emit('goCartPage')
  666. },
  667. btnTouchstart() {
  668. // console.log('btnTouchstart');
  669. },
  670. btnTouchend() {
  671. // console.log('btnTouchend');
  672. }
  673. }
  674. }
  675. </script>
  676. <style lang="scss">
  677. .all-zuhe-list {
  678. background: #ffffff;
  679. }
  680. .foot_conten {
  681. width: 655rpx;
  682. background: #fff;
  683. font-size: 28rpx;
  684. height: 80rpx;
  685. // line-height: 80rpx;
  686. display: inherit;
  687. padding: 10px;
  688. overflow: hidden;
  689. margin: 20rpx auto;
  690. }
  691. .zuhe_foot-box {
  692. float: left;
  693. overflow: hidden;
  694. white-space: nowrap;
  695. // text-overflow: ellipsis;
  696. width: 490rpx;
  697. }
  698. .zuhe_foot-box text {
  699. margin-right: 36rpx;
  700. }
  701. .foot_text {
  702. color: #ff2a2a;
  703. }
  704. .foot_conten .buycart {
  705. width: 162rpx;
  706. height: 64rpx;
  707. background: #efaf00 !important;
  708. color: #fff;
  709. font-size: 26rpx;
  710. border-radius: 36rpx;
  711. text-align: center;
  712. line-height: 64rpx;
  713. float: right;
  714. }
  715. .price-none {
  716. font-size: 24rpx;
  717. color: #666666;
  718. }
  719. .zuhe_title {
  720. background: #ffffff;
  721. height: 76rpx;
  722. font-size: 28rpx;
  723. color: #1675e1;
  724. border-bottom: 4rpx solid #1675e1;
  725. line-height: 76rpx;
  726. padding-left: 30rpx;
  727. &.active {
  728. color: #e15616;
  729. border-bottom: 4rpx solid #e15616;
  730. }
  731. }
  732. .tabstyle {
  733. width: 128rpx;
  734. height: 76rpx;
  735. font-size: 26rpx;
  736. display: inline-block;
  737. border-radius: 10rpx;
  738. text-align: center;
  739. line-height: 76rpx;
  740. border: 2rpx solid #eeeeee;
  741. position: relative;
  742. margin-right: 12rpx;
  743. &.addstyle {
  744. background: $btn-confirm;
  745. color: #ffffff;
  746. &::before {
  747. content: '';
  748. width: 0;
  749. height: 0;
  750. border-top: 20rpx solid transparent;
  751. border-right: 20rpx solid #ffffff;
  752. border-left: 20rpx solid transparent;
  753. border-bottom: 20rpx solid #ffffff;
  754. position: absolute;
  755. right: 0;
  756. bottom: 0;
  757. }
  758. }
  759. .icon-gou {
  760. width: 36rpx;
  761. height: 36rpx;
  762. line-height: 36rpx;
  763. text-align: center;
  764. color: #e15616;
  765. position: absolute;
  766. bottom: -5rpx;
  767. right: -5rpx;
  768. font-weight: bold;
  769. font-size: $font-size-28;
  770. }
  771. }
  772. .commodity-list-wrapper {
  773. scroll-view {
  774. height: 100%;
  775. }
  776. .show-more-btn {
  777. width: 276rpx;
  778. height: 52rpx;
  779. line-height: 52rpx;
  780. border: 2rpx solid #d8d8d8;
  781. background: #f7f7f7;
  782. font-size: 26rpx;
  783. margin: 26rpx 0;
  784. position: absolute;
  785. left: 50%;
  786. margin-left: -138rpx;
  787. }
  788. }
  789. .good-search {
  790. height: 80rpx;
  791. width: 100%;
  792. padding: 24rpx;
  793. background: #ffffff;
  794. display: flex;
  795. align-items: center;
  796. margin-bottom: 20rpx;
  797. position: fixed;
  798. top: 0;
  799. left: 0;
  800. z-index: 19;
  801. .search-from {
  802. width: 420rpx;
  803. height: 80rpx;
  804. background: #f7f7f7;
  805. border-radius: 40rpx;
  806. float: left;
  807. position: relative;
  808. .input {
  809. width: 340rpx;
  810. height: 80rpx;
  811. float: left;
  812. line-height: 80rpx;
  813. color: $text-color;
  814. font-size: $font-size-24;
  815. }
  816. .icon-iconfonticonfontsousuo1 {
  817. width: 64rpx;
  818. height: 80rpx;
  819. line-height: 80rpx;
  820. text-align: center;
  821. display: block;
  822. font-size: $font-size-38;
  823. float: left;
  824. color: #999999;
  825. }
  826. .icon-shanchu1 {
  827. font-size: $font-size-32;
  828. color: #999999;
  829. position: absolute;
  830. width: 120rpx;
  831. height: 80rpx;
  832. line-height: 80rpx;
  833. top: 0;
  834. right: 0;
  835. text-align: center;
  836. z-index: 10;
  837. }
  838. }
  839. .search-btn {
  840. // width: 120rpx;
  841. line-height: 64rpx;
  842. text-align: center;
  843. font-size: $font-size-28;
  844. color: $color-system;
  845. float: left;
  846. background: #ffffff;
  847. margin-left: 10rpx;
  848. }
  849. }
  850. .all-type-list-content {
  851. // height: 240rpx;
  852. padding: 24rpx;
  853. background: #fff;
  854. margin-bottom: 2rpx;
  855. display: flex;
  856. flex-direction: row;
  857. box-sizing: content-box;
  858. .list-img {
  859. width: 312rpx;
  860. height: 207rpx !important;
  861. margin-right: 26rpx;
  862. border-radius: 10rpx;
  863. border: 2rpx solid #f3f3f3;
  864. }
  865. }
  866. .zuhe-list-content {
  867. width: 655rpx;
  868. // height: 214rpx;
  869. background: #fff;
  870. border: 2rpx solid #def4ff;
  871. display: flex;
  872. flex-direction: row;
  873. box-sizing: content-box;
  874. margin-top: 10rpx;
  875. border-radius: 14rpx;
  876. margin: 10rpx auto;
  877. padding: 20rpx;
  878. &.stylecontent {
  879. border: 2rpx solid #fff0de;
  880. }
  881. }
  882. .list-details-info {
  883. width: 100%;
  884. flex-direction: column;
  885. font-size: 26rpx;
  886. position: relative;
  887. .list-details-title {
  888. line-height: 38rpx;
  889. text-overflow: ellipsis;
  890. overflow: hidden;
  891. display: -webkit-box;
  892. -webkit-line-clamp: 2;
  893. line-clamp: 2;
  894. -webkit-box-orient: vertical;
  895. }
  896. .list-details-specs {
  897. width: 100%;
  898. display: inline-block;
  899. margin: 5rpx 0;
  900. color: #666666;
  901. }
  902. .list-details-miniQuantity {
  903. width: 100%;
  904. display: inline-block;
  905. margin-top: 7rpx;
  906. }
  907. }
  908. .list-details-price {
  909. width: 100%;
  910. .floor-item-act {
  911. height: 54rpx;
  912. text-align: center;
  913. box-sizing: border-box;
  914. float: left;
  915. padding: 11rpx 0;
  916. }
  917. .price-icon {
  918. width: 22rpx;
  919. height: 28rpx;
  920. vertical-align: middle;
  921. margin-right: 10rpx;
  922. }
  923. .price-icon + text {
  924. font-size: 25rpx;
  925. vertical-align: middle;
  926. }
  927. .list-login-now {
  928. width: 375rpx;
  929. color: #f8c499;
  930. .p-no {
  931. float: left;
  932. font-size: $font-size-24;
  933. color: $color-system;
  934. margin-right: 10rpx;
  935. }
  936. }
  937. .login-now {
  938. padding: 10rpx 10rpx 10rpx 0;
  939. }
  940. .list-none {
  941. margin-top: 15rpx;
  942. .price-small {
  943. font-size: $font-size-24;
  944. line-height: 40rpx;
  945. color: #ff2a2a;
  946. }
  947. }
  948. .list-price-loding {
  949. font-size: $font-size-24;
  950. line-height: 54rpx;
  951. color: #ff2a2a;
  952. }
  953. .list-shop {
  954. float: left;
  955. overflow: hidden;
  956. &.com {
  957. width: 100%;
  958. }
  959. .list-price {
  960. color: #ff2a2a;
  961. float: left;
  962. line-height: 54rpx;
  963. align-items: center;
  964. justify-content: center;
  965. .price-larger {
  966. font-size: $font-size-26;
  967. display: inline-block;
  968. &.none {
  969. text-decoration: line-through;
  970. color: #999999;
  971. }
  972. }
  973. .list-price-all {
  974. width: 100%;
  975. float: left;
  976. }
  977. .zuhe_price-larger {
  978. width: 100%;
  979. float: left;
  980. height: 54rpx;
  981. color: #666666;
  982. .price-larger {
  983. float: left;
  984. margin-right: 20rpx;
  985. }
  986. }
  987. .price-two {
  988. color: #666666;
  989. float: left;
  990. }
  991. .zuhe_list_zj {
  992. color: #ff2a2a;
  993. }
  994. .price-view {
  995. display: inline-block;
  996. width: 40rpx;
  997. border-radius: 10rpx;
  998. font-size: $font-size-22;
  999. text-align: center;
  1000. color: #ffffff;
  1001. height: 36rpx;
  1002. line-height: 36rpx;
  1003. margin-right: 8rpx;
  1004. &.ladder {
  1005. background: linear-gradient(135deg, rgba(255, 0, 0, 1) 0%, rgba(242, 143, 49, 1) 100%);
  1006. }
  1007. &.activity {
  1008. background: linear-gradient(135deg, rgba(128, 0, 255, 1) 0%, rgba(242, 49, 153, 1) 100%);
  1009. }
  1010. }
  1011. }
  1012. .zuhe_list_price .price-view {
  1013. margin-left: 20rpx;
  1014. float: left;
  1015. margin-top: 5rpx;
  1016. }
  1017. .zuhe_list_price {
  1018. width: 100%;
  1019. overflow: hidden;
  1020. margin-top: 10rpx;
  1021. }
  1022. .count {
  1023. float: right;
  1024. border: 1px solid #eeeeee;
  1025. border-radius: 10rpx;
  1026. .number-box {
  1027. display: flex;
  1028. justify-content: center;
  1029. align-items: center;
  1030. .iconfont {
  1031. font-size: $font-size-24;
  1032. padding: 0 16rpx;
  1033. color: $text-color;
  1034. text-align: center;
  1035. line-height: 48rpx;
  1036. font-weight: bold;
  1037. }
  1038. .btn-input {
  1039. width: 100rpx;
  1040. height: 48rpx;
  1041. line-height: 48rpx;
  1042. background: #f8f8f8;
  1043. border-radius: 4rpx;
  1044. text-align: center;
  1045. font-size: $font-size-24;
  1046. border-right: 1px solid #eeeeee;
  1047. border-left: 1px solid #eeeeee;
  1048. }
  1049. }
  1050. }
  1051. .list-price-none {
  1052. width: 100%;
  1053. .price-none {
  1054. text-decoration: line-through;
  1055. color: #999999;
  1056. display: inline-block;
  1057. }
  1058. .icon-wenhao {
  1059. font-size: $font-size-32;
  1060. color: #0091ff;
  1061. margin-left: 6rpx;
  1062. }
  1063. }
  1064. }
  1065. .add-cart-btn {
  1066. flex: 4;
  1067. width: 140rpx;
  1068. height: 54rpx;
  1069. line-height: 54rpx;
  1070. border-radius: 27rpx;
  1071. color: #fff;
  1072. font-size: 24rpx;
  1073. margin-right: 0;
  1074. background: #ffffff;
  1075. border: 1px solid #c9c9c9;
  1076. color: $text-color;
  1077. }
  1078. .zuhe_btn {
  1079. float: right;
  1080. }
  1081. }
  1082. .zuhe_list_price {
  1083. display: block !important;
  1084. }
  1085. .zuhe_list_text {
  1086. margin-top: 0;
  1087. }
  1088. </style>