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