immediatelyList.vue 29 KB

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