immediatelyList.vue 29 KB

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