immediatelyList.vue 29 KB

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