index.vue 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482
  1. <template>
  2. <view class="container cart clearfix" v-if="hasLogin">
  3. <tui-skeleton
  4. v-if="skeletonShow"
  5. backgroundColor="#fafafa"
  6. borderRadius="10rpx"
  7. :isLoading="true"
  8. :loadingType="5"
  9. ></tui-skeleton>
  10. <view class="container-cart-main tui-skeleton" :style="{ paddingTop: isshowDelbtn ? '0rpx' : '80rpx' }">
  11. <view class="foot-check-delbtn" v-if="!isshowDelbtn && goodsList.length > 0">
  12. <view class="foot-text"
  13. >共<text>{{ kindCount }}</text
  14. >件商品</view
  15. >
  16. <view class="delBtn" @tap.stop="showDelManager">删除</view>
  17. </view>
  18. <view v-if="!isEmpty" class="container-cart">
  19. <view class="cart-content" :style="{ paddingBottom: isIphoneX ? '130rpx' : '100rpx' }">
  20. <view class="goods-list">
  21. <view v-for="(item, index) in goodsList" :key="index" class="goods-item clearfix">
  22. <view class="shoptitle">
  23. <!--选择商店的全部商品"-->
  24. <view class="checkbox-box" @click.stop="checkShop(item)">
  25. <view
  26. class="checkbox iconfont"
  27. :class="[item.checked ? 'icon-xuanze' : 'icon-weixuanze']"
  28. ></view>
  29. </view>
  30. <view class="text">{{ item.name }}</view>
  31. </view>
  32. <view class="productlist">
  33. <view class="goods-pros" v-for="(pros, idx) in item.productList" :key="idx">
  34. <view class="goods-pros-t">
  35. <!--选择商品-->
  36. <view class="checkbox-box" @click.stop="ischeck(item, pros)">
  37. <view
  38. class="checkbox iconfont"
  39. :class="[pros.productsChecked ? 'icon-xuanze' : 'icon-weixuanze']"
  40. ></view>
  41. </view>
  42. <view class="pros-img" @click.stop="navToListPage(pros)"
  43. ><image :src="pros.mainImage ? pros.mainImage : ''" alt=""
  44. /></view>
  45. <view class="pros-product">
  46. <view class="producttitle" @click.stop="navToListPage(pros)">{{
  47. pros.productName
  48. }}</view>
  49. <view class="productspec">规格:{{ pros.unit ? pros.unit : '' }}</view>
  50. <view class="floor-item-act" v-if="pros.activeStatus == 1">
  51. <text class="tag tag-01" v-if="!pros.heUserId">自营</text>
  52. <text class="tag tag-01" v-else>促销</text>
  53. <text class="tag tag-02" @click.stop="clickPopupShow(pros, 2)"
  54. >活动价</text
  55. >
  56. </view>
  57. <view class="productprice">
  58. <!--使用过滤器对总价改变-->
  59. <view class="price"><text>¥</text>{{ pros.price | NumFormat }}</view>
  60. <view class="count">
  61. <view class="number-box">
  62. <view
  63. class="iconfont icon-jianhao"
  64. @click="changeCountSub(item, pros)"
  65. ></view>
  66. <input
  67. class="btn-input"
  68. type="number"
  69. maxlength="4"
  70. v-model="pros.productCount"
  71. @blur="changeNnmber($event, item, pros)"
  72. @focus="changeInput(pros)"
  73. />
  74. <view
  75. class="iconfont icon-jiahao"
  76. @click="changeCountAdd(item, pros)"
  77. ></view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <view class="goods-pros-b clearfix" :class="[isshowDelbtn ? 'none' : 'show']">
  86. <view class="sum-none" v-if="item.reducedPrice > 0">
  87. <text class="money-sign">¥</text>
  88. <text class="money">{{ item.totalOriginalPrice | NumFormat }}</text>
  89. <text class="money-reduced"
  90. >减<text>¥{{ item.reducedPrice | NumFormat }}</text></text
  91. >
  92. </view>
  93. <view class="sum"
  94. >合计:<text class="money"
  95. ><text class="money-sign">¥</text>{{ item.totalPrice | NumFormat }}</text
  96. ></view
  97. >
  98. </view>
  99. </view>
  100. </view>
  101. <view class="failure-list" v-if="failureList.length > 0">
  102. <view class="failure-title">
  103. <view class="title-txt"
  104. >失效商品<text>{{ failureList.length }}件</text></view
  105. >
  106. <view class="title-btn" @click.stop="deletefailureList"
  107. ><text class="butto">清空失效商品</text></view
  108. >
  109. </view>
  110. <view class="productlist">
  111. <view class="goods-pros" v-for="(failure, failureIdx) in failureList" :key="failureIdx">
  112. <view class="goods-pros-t" @click.stop="navToListPage(failure)">
  113. <!--选择商品-->
  114. <view
  115. class="checkbox-box"
  116. @click.stop="ischeckFailure(failure)"
  117. v-if="isshowDelbtn"
  118. >
  119. <button
  120. class="checkbox iconfont"
  121. :class="[failure.productsChecked ? 'icon-xuanze' : 'icon-weixuanze']"
  122. ></button>
  123. </view>
  124. <text class="img-tip">失效</text>
  125. <view class="pros-img">
  126. <image :src="failure.mainImage ? failure.mainImage : ''" alt="" />
  127. </view>
  128. <view class="pros-product">
  129. <view class="producttitle">{{ failure.name }}</view>
  130. <view class="productspec">规格:{{ failure.unit ? failure.unit : '' }}</view>
  131. <view class="productstate">商品已下架</view>
  132. </view>
  133. </view>
  134. </view>
  135. </view>
  136. </view>
  137. </view>
  138. <!-- 脚部菜单 -->
  139. <view class="footer">
  140. <view class="footer-le">
  141. <view class="foot-check checkbox-box" @tap.stop="checkAll()">
  142. <button
  143. class="checkbox iconfont"
  144. :class="[isCheckAll ? 'icon-xuanze' : 'icon-weixuanze']"
  145. ></button>
  146. <view class="text">全选</view>
  147. </view>
  148. <view class="sum">
  149. <view v-if="!isshowDelbtn" class="sum-price">
  150. 总价:<text class="money-sign">¥</text
  151. ><text class="money">{{ allPrice | NumFormat }}</text>
  152. </view>
  153. </view>
  154. </view>
  155. <view v-if="!isshowDelbtn" class="footer-ri">
  156. <view class="btn hanld-btn" @tap="toConfirmation">去结算({{ allCount }})</view>
  157. </view>
  158. <view v-else class="footer-del">
  159. <view class="btn btn-cancel" @tap.stop="hideDelManage">取消</view>
  160. <view class="btn btn-confirm" @tap.stop="deleteList">删除</view>
  161. </view>
  162. </view>
  163. </view>
  164. <view v-else class="cart-content empty">
  165. <view class="empty-container">
  166. <image
  167. class="empty-container-image"
  168. :src="StaticUrl + 'icon-empty-cart.png'"
  169. mode="aspectFit"
  170. ></image>
  171. <text class="error-text">购物车空空的,快去逛逛吧~</text>
  172. </view>
  173. </view>
  174. </view>
  175. <!-- 操作弹窗 -->
  176. <tui-modal
  177. :show="modal"
  178. @click="handleClick"
  179. @cancel="hideMobel"
  180. :content="contentModalText"
  181. color="#333"
  182. :size="32"
  183. shape="circle"
  184. :maskClosable="false"
  185. ></tui-modal>
  186. <!-- 促销活动弹窗 -->
  187. <activi-popup :product="handlerPros" :popupShow="popupShow"></activi-popup>
  188. <!-- 透明模态层 -->
  189. <modal-layer v-if="modallayer"></modal-layer>
  190. </view>
  191. </template>
  192. <script>
  193. import authorize from '@/common/config/authorize.js'
  194. import tuiSkeleton from '@/components/tui-skeleton/tui-skeleton'
  195. import tuiLoadmore from '@/components/tui-components/loadmore/loadmore'
  196. import tuiNomore from '@/components/tui-components/nomore/nomore'
  197. import activiPopup from '@/components/cm-module/productDetails/cm-activipopu'
  198. import modalLayer from '@/components/modal-layer'
  199. import { mapGetters } from 'vuex'
  200. export default {
  201. components: {
  202. tuiSkeleton,
  203. tuiLoadmore,
  204. tuiNomore,
  205. activiPopup,
  206. modalLayer
  207. },
  208. data() {
  209. return {
  210. StaticUrl: this.$Static,
  211. CustomBar: this.CustomBar, // 顶部导航栏高度
  212. isIphoneX: this.$store.state.isIphoneX,
  213. userId: '',
  214. popupShow: false,
  215. handlerPros: {}, //监听单挑促销商品
  216. failureList: [], //失效商品列表
  217. goodsList: [], //购物车的商品
  218. delGoodsList: '', //要删除的商品
  219. setGoodData: '', //确认订单的商品
  220. isCheckAll: false, //是否全选
  221. kindCount: 0, //购物车宝贝数量
  222. allPrice: 0, //所有价格
  223. totalOriginalPrice: 0, //所有原价价
  224. reducedPrice: 0, //满减
  225. allCount: 0, //被选中的产品数量
  226. isModallayer: false,
  227. skeletonShow: true,
  228. isshowDelbtn: false,
  229. isDisabled: false, // 供应商/店铺全选是否禁用状态
  230. isEmpty: false, //显示空购物车
  231. scrollHeight: 'auto',
  232. nomoreText: '上拉显示更多',
  233. hasNextPage: false,
  234. loadding: false,
  235. pullUpOn: true,
  236. pullFlag: true,
  237. pageSize: 10,
  238. pageNum: 1,
  239. submitIds: [],
  240. modal: false,
  241. contentModalText: '',
  242. deleteType: 0
  243. }
  244. },
  245. onLoad() {
  246. this.setScrollHeight()
  247. },
  248. computed: {
  249. ...mapGetters(['hasLogin'])
  250. },
  251. filters: {
  252. NumFormat(value) {
  253. //处理金额
  254. return Number(value).toFixed(2)
  255. },
  256. totalprice(val, count) {
  257. //单件商品的价格 × 数量
  258. return (val * count).toFixed(2)
  259. }
  260. },
  261. methods: {
  262. initData() {
  263. this.isModallayer = false //遮罩层 防止多次点击
  264. this.isCheckAll = false //是否全选
  265. this.submitIds = []
  266. this.$api.getStorage().then(resolve => {
  267. this.userId = resolve.userId ? resolve.userId : 0
  268. this.InitGetCartGoodsList()
  269. this.GetCartNumber()
  270. })
  271. },
  272. clickPopupShow(pros, type) {
  273. if (pros.ladderList.length > 0) {
  274. this.popupShow = true
  275. this.handlerPros = pros
  276. }
  277. },
  278. setScrollHeight() {
  279. // 窗口高度-footer高度
  280. const { windowHeight, pixelRatio } = uni.getSystemInfoSync()
  281. setTimeout(() => {
  282. const query = uni.createSelectorQuery().in(this)
  283. query.selectAll('.footer').boundingClientRect()
  284. query.exec(res => {
  285. this.windowHeight = windowHeight
  286. if (res[0][0]) {
  287. this.scrollHeight = windowHeight - res[0][0].height
  288. }
  289. })
  290. }, 500)
  291. },
  292. InitGetCartGoodsList() {
  293. //初始化购物车 index:1
  294. this.ProductService.QueryShoppingCartList({ userId: this.userId })
  295. .then(response => {
  296. this.skeletonShow = false
  297. let data = response.data
  298. this.kindCount = data.cartQuantity
  299. if (data.shopList.length > 0 || data.products.length > 0) {
  300. this.isEmpty = false
  301. } else {
  302. this.isEmpty = true
  303. }
  304. if (data.shopList && data.shopList.length > 0) {
  305. this.goodsList = data.shopList
  306. console.log(this.goodsList)
  307. this.totalShopPeice()
  308. } else {
  309. this.goodsList = []
  310. }
  311. if (data.products && data.products.length > 0) {
  312. this.failureList = data.products
  313. } else {
  314. this.failureList = []
  315. }
  316. })
  317. .catch(error => {
  318. this.$util.msg(error.msg, 2000)
  319. })
  320. },
  321. ischeckFailure(failure) {
  322. failure.productsChecked = !failure.productsChecked
  323. this.updateCheckAllBtn()
  324. },
  325. ischeck(item, pro) {
  326. //为未选中的时候改变为true,反之为true
  327. pro.productsChecked = !pro.productsChecked
  328. if (pro.productsChecked) {
  329. if (!this.submitIds.includes(pro.productID * 1)) {
  330. this.submitIds.push(pro.productID)
  331. }
  332. } else {
  333. var lent = this.submitIds.indexOf(pro.productID * 1)
  334. if (lent >= 0) {
  335. this.submitIds.splice(lent, 1)
  336. }
  337. }
  338. this.updateProductCheckedAllBtn(item)
  339. this.updateCheckAllBtn()
  340. },
  341. updateProductCheckedAllBtn(item) {
  342. // 单独每个供应商的勾选判断
  343. let productList = item.productList,
  344. productsCheckedLength = 0,
  345. disabledLength = 0
  346. if (this.isshowDelbtn) {
  347. productList.forEach(pros => {
  348. if (pros.productsChecked) {
  349. productsCheckedLength++
  350. }
  351. })
  352. } else {
  353. productList.forEach(pros => {
  354. if (pros.productsChecked) {
  355. productsCheckedLength++
  356. }
  357. })
  358. }
  359. item.checked = productsCheckedLength === productList.length
  360. },
  361. updateCheckAllBtn() {
  362. // 全选勾选判断
  363. let goodsCheckedLength = 0,
  364. goodsList = this.goodsList,
  365. failureList = this.failureList
  366. goodsList.forEach(item => {
  367. if (item.checked) {
  368. goodsCheckedLength++
  369. }
  370. })
  371. failureList.forEach(failureItem => {
  372. if (failureItem.productsChecked) {
  373. goodsCheckedLength++
  374. }
  375. })
  376. if (this.isshowDelbtn) {
  377. this.isCheckAll = goodsCheckedLength === goodsList.length + failureList.length
  378. } else {
  379. this.isCheckAll = goodsCheckedLength === goodsList.length
  380. }
  381. },
  382. checkShop(item) {
  383. //与单选商品类似
  384. item.checked = !item.checked
  385. this.setProductChecked(item)
  386. this.updateCheckAllBtn()
  387. },
  388. setProductChecked(item) {
  389. item.productList.forEach(pros => {
  390. if (item.checked) {
  391. pros.productsChecked = true
  392. if (!this.submitIds.includes(pros.productId * 1)) {
  393. this.submitIds.push(pros.productId)
  394. }
  395. } else {
  396. pros.productsChecked = false
  397. var lent = this.submitIds.indexOf(pros.productId * 1)
  398. if (lent >= 0) {
  399. this.submitIds.splice(lent, 1)
  400. }
  401. }
  402. })
  403. },
  404. updateBothCheckBtn() {
  405. if (this.isshowDelbtn) {
  406. // 当管理删除按钮出现时,失效的商品可被选择
  407. this.goodsList.forEach(item => {
  408. item.checked = this.isCheckAll
  409. this.setProductChecked(item)
  410. })
  411. //删除按钮 全选包括失效商品勾选
  412. this.failureList.forEach(failureItem => {
  413. failureItem.productsChecked = this.isCheckAll
  414. })
  415. } else {
  416. this.goodsList.forEach(item => {
  417. item.checked = this.isCheckAll && !item.isDisabled
  418. this.setProductChecked(item)
  419. })
  420. }
  421. },
  422. checkAll() {
  423. //全选方法内调用方法
  424. this.isCheckAll = !this.isCheckAll
  425. this.updateBothCheckBtn()
  426. },
  427. totalShopPeice() {
  428. //每次所属会所下的商品增减重新计算合计价格&减去含有下架的商品
  429. let touchPrice = 0
  430. let reducedPrice = 0 //商铺合计满减价
  431. this.goodsList.map((item, index) => {
  432. let _totalPrice = 0
  433. let _reducedPrice = 0
  434. let _totalOriginalPrice = 0
  435. item.productList.forEach(pros => {
  436. let _price = pros.price * pros.productCount
  437. _totalOriginalPrice += pros.price * pros.productCount
  438. if (pros.promotion && pros.promotion.type != 2 && pros.promotion.mode == 2) {
  439. if (_price >= pros.promotion.touchPrice) {
  440. _price = _price - pros.promotion.reducedPrice
  441. _reducedPrice += pros.promotion.reducedPrice
  442. }
  443. _totalPrice += _price
  444. } else {
  445. _reducedPrice = 0
  446. _totalPrice += pros.price * pros.productCount
  447. }
  448. })
  449. item.reducedPrice = _reducedPrice
  450. item.totalOriginalPrice = _totalOriginalPrice
  451. item.totalPrice = _totalPrice
  452. })
  453. },
  454. totalPeice() {
  455. //计算总价格,每次调用此方法,将初始值为0,遍历价格并累加
  456. let totalPrice = 0
  457. let reducedPrice = 0
  458. let originalPrice = 0
  459. this.goodsList.forEach((item, index) => {
  460. let supplierPrice = 0
  461. let supplierReducedPrice = 0
  462. item.totalprice = 0
  463. item.reducedprice = 0
  464. item.originalprice = 0
  465. item.productList.forEach(pros => {
  466. if (pros.productsChecked) {
  467. supplierPrice += pros.price * pros.productCount
  468. // 单品满减
  469. if (pros.promotion && pros.promotion.type * 1 === 1 && pros.promotion.mode * 1 === 2) {
  470. // 单品满减-重新计算供应商总价/满减金额
  471. if (pros.price * pros.productCount >= pros.promotion.touchPrice) {
  472. supplierPrice -= pros.promotion.reducedPrice
  473. supplierReducedPrice += pros.promotion.reducedPrice
  474. }
  475. }
  476. }
  477. })
  478. item.totalprice = supplierPrice
  479. item.reducedprice = supplierReducedPrice
  480. item.originalprice = supplierPrice + supplierReducedPrice
  481. totalPrice += item.totalprice
  482. reducedPrice += item.reducedprice
  483. originalPrice += item.originalprice
  484. })
  485. //最后统计商品原价
  486. this.totalOriginalPrice = originalPrice
  487. //最后满减金额 = 店铺减去金额 + 单品减去金额 + 凑单减去金额
  488. this.reducedPrice = reducedPrice
  489. //最终合计价格 = 店铺满减合计 + 单品满减 + 正常合计 + 凑单满减
  490. this.allPrice = totalPrice
  491. },
  492. totalCount() {
  493. //计算总数量
  494. this.allCount = 0
  495. let prosAllCount = 0
  496. let validCount = 0
  497. let validList = []
  498. let productList = []
  499. this.goodsList.forEach(item => {
  500. productList = item.productList
  501. productList.forEach(pros => {
  502. if (pros.productsChecked) {
  503. prosAllCount += parseInt(pros.productCount)
  504. this.allCount = prosAllCount
  505. }
  506. })
  507. })
  508. },
  509. changeCountAdd(item, pros) {
  510. //商品数量加加
  511. pros.productCount++
  512. this.processActivityPrice(pros)
  513. this.updateShoppogNum(pros)
  514. this.totalShopPeice()
  515. },
  516. changeCountSub(item, pros) {
  517. //商品数量减减
  518. if (pros.productCount <= 1) {
  519. pros.productCount = 1
  520. this.$util.msg('购买数量不能少于1', 2000)
  521. return
  522. } else {
  523. pros.productCount--
  524. }
  525. this.processActivityPrice(pros)
  526. this.updateShoppogNum(pros)
  527. this.totalShopPeice()
  528. },
  529. changeInput(pros) {
  530. //输入商品数量更新
  531. },
  532. changeNnmber(e, item, pros) {
  533. //输入商品数量更新
  534. let _value = Number(e.detail.value)
  535. if (!this.$api.isNumber(_value)) {
  536. pros.productCount = 1
  537. } else if (_value <= 1) {
  538. this.$util.msg('购买数量不能少于1', 2000)
  539. pros.productCount = 1
  540. } else {
  541. pros.productCount = e.detail.value
  542. }
  543. this.processActivityPrice(pros)
  544. this.updateShoppogNum(pros)
  545. this.totalShopPeice()
  546. },
  547. processActivityPrice(pros) {
  548. //单独处理活动价格和阶梯价格
  549. if (pros.activeStatus == 1) {
  550. pros.ladderList.forEach((item, index) => {
  551. if (pros.productCount >= item.buyNum) {
  552. pros.price = item.buyPrice
  553. }
  554. })
  555. } else {
  556. pros.price = pros.price
  557. }
  558. },
  559. updateShoppogNum(pros) {
  560. //加减购物车商品更新到后台
  561. this.ProductService.ShoppingCartUpdate({
  562. cartId: pros.cartId,
  563. productCount: pros.productCount
  564. })
  565. .then(response => {
  566. this.isshowDelbtn = false
  567. this.InitGetCartGoodsList()
  568. })
  569. .catch(error => {
  570. this.$util.msg(error.msg, 2000)
  571. })
  572. },
  573. toConfirmation() {
  574. //跳转确认订单页面
  575. let setGoodsList = []
  576. this.goodsList.forEach(res => {
  577. let products = res.productList
  578. products.forEach(pros => {
  579. if (pros.productsChecked) {
  580. setGoodsList.push(pros.productId)
  581. }
  582. })
  583. })
  584. if (setGoodsList == '') {
  585. this.$util.msg('请先选择结算商品~', 2000)
  586. return
  587. }
  588. let cartIds = ''
  589. this.goodsList.forEach(el => {
  590. //获取勾选的商品ID拼接字符串逗号隔开,最后一个逗号去掉
  591. el.productList.forEach(pros => {
  592. if (pros.productsChecked) {
  593. cartIds += pros.cartId + ','
  594. }
  595. })
  596. })
  597. let cartPramsData = {
  598. allPrice: this.allPrice,
  599. allCount: this.allCount,
  600. cartIds: cartIds.substring(0, cartIds.lastIndexOf(',')),
  601. productCount: ''
  602. }
  603. this.$api.navigateTo(`/pages/user/order/create-order?data=${JSON.stringify({ data: cartPramsData })}`)
  604. },
  605. showDelManager() {
  606. //显示删除商品管理
  607. this.isshowDelbtn = true
  608. if (this.isCheckAll) {
  609. this.updateBothCheckBtn()
  610. } else {
  611. this.goodsList.forEach(item => {
  612. if (item.checked) {
  613. item.productList.forEach(pros => {
  614. pros.productsChecked = true
  615. })
  616. }
  617. })
  618. this.updateCheckAllBtn()
  619. }
  620. // 失效也被勾选
  621. this.failureList.forEach(failureItem => {
  622. if (failureItem.isFailureLayer) {
  623. failureItem.isFailureLayer = false
  624. }
  625. })
  626. },
  627. hideDelManage() {
  628. //隐藏删除商品管理
  629. this.isshowDelbtn = false
  630. let isFailureLayer,
  631. newFailureList = []
  632. if (this.isCheckAll) {
  633. this.updateBothCheckBtn()
  634. } else {
  635. // 失效商品取消勾选
  636. this.goodsList.forEach(item => {
  637. if (item.isDisabled) {
  638. item.checked = false
  639. }
  640. item.productList.forEach(pros => {
  641. if (pros.validFlag == 3) {
  642. pros.productsChecked = false
  643. }
  644. })
  645. })
  646. this.updateCheckAllBtn()
  647. }
  648. this.failureList.forEach((failure, index) => {
  649. if (failure.failureState == 1 || failure.failureState == 2) {
  650. isFailureLayer = true
  651. } else {
  652. isFailureLayer = false
  653. }
  654. newFailureList.push(Object.assign({}, failure, { isFailureLayer: isFailureLayer }))
  655. })
  656. this.failureList = newFailureList
  657. },
  658. deleteList() {
  659. //删除购物车商品
  660. this.delGoodsList = []
  661. this.goodsList.forEach(delitem => {
  662. let products = delitem.productList
  663. products.forEach(pros => {
  664. if (pros.productsChecked) {
  665. this.delGoodsList += pros.cartId + ','
  666. }
  667. })
  668. })
  669. this.failureList.forEach(failure => {
  670. if (failure.productsChecked) {
  671. this.delGoodsList += failure.cartId + ','
  672. }
  673. })
  674. if (this.delGoodsList.length == 0) {
  675. this.$util.msg('请选择要删除的商品~', 2000)
  676. return
  677. } else {
  678. this.modal = true
  679. this.contentModalText = '确定删除选中的商品吗?'
  680. this.deleteType = 1
  681. }
  682. },
  683. deletefailureList() {
  684. this.delGoodsList = ''
  685. this.failureList.forEach(failure => {
  686. this.delGoodsList += failure.cartId + ','
  687. })
  688. this.modal = true
  689. this.contentModalText = '确定清除所有失效商品吗?'
  690. this.deleteType = 2
  691. },
  692. handleClick(e) {
  693. //用户操作订单
  694. let index = e.index
  695. if (index == 1) {
  696. this.ProductService.ShoppingCartDelete({
  697. cartIds: this.delGoodsList
  698. })
  699. .then(response => {
  700. this.$util.msg('删除成功', 2000)
  701. setTimeout(() => {
  702. this.isshowDelbtn = false
  703. this.InitGetCartGoodsList()
  704. }, 1000)
  705. })
  706. .catch(error => {
  707. this.$util.msg(error.msg, 2000)
  708. })
  709. .finally(() => {
  710. this.GetCartNumber()
  711. })
  712. }
  713. this.modal = false
  714. },
  715. hideMobel() {
  716. this.modal = false
  717. },
  718. GetCartNumber() {
  719. //查询购物车数量
  720. this.ProductService.QueryShoppingQuantity({
  721. userId: this.userId
  722. })
  723. .then(response => {
  724. this.$store.commit('app/updateAllNum', response.data)
  725. })
  726. .catch(error => {
  727. console.log('查询购物车数量错误信息', error)
  728. })
  729. },
  730. navToListPage(item) {
  731. this.isModallayer = true
  732. this.$api.navigateTo(`/pages/goods/product?productId=${item.productId}`)
  733. },
  734. setHeaderBtnPosi() {
  735. // 获得胶囊按钮位置信息
  736. let headerBtnPosi = uni.getMenuButtonBoundingClientRect()
  737. return headerBtnPosi
  738. },
  739. setSysteminfo() {
  740. let systeminfo
  741. uni.getSystemInfo({
  742. // 获取设备信息
  743. success: res => {
  744. systeminfo = res
  745. }
  746. })
  747. return systeminfo
  748. },
  749. PromotionsFormat(promo) {
  750. //促销活动类型数据处理
  751. if (promo != null) {
  752. if (promo.type == 1 && promo.mode == 1) {
  753. return true
  754. } else {
  755. return false
  756. }
  757. }
  758. return false
  759. }
  760. },
  761. watch: {
  762. //深度监听所有数据,每次改变重新计算总价和总数
  763. goodsList: {
  764. deep: true,
  765. handler(val, oldval) {
  766. this.totalPeice()
  767. this.totalCount()
  768. }
  769. }
  770. },
  771. onPullDownRefresh() {
  772. //下拉刷新
  773. this.InitGetCartGoodsList()
  774. uni.stopPullDownRefresh()
  775. },
  776. onShow() {
  777. if (this.hasLogin) {
  778. this.initData()
  779. } else {
  780. this.$api.redirectTo('/pages/login/login')
  781. }
  782. }
  783. }
  784. </script>
  785. <style lang="scss">
  786. page {
  787. background: #f7f7f7;
  788. height: auto;
  789. }
  790. .cart-content {
  791. position: relative;
  792. }
  793. .container-cart-main.none {
  794. display: none;
  795. }
  796. .container-cart-main.show {
  797. display: block;
  798. }
  799. .cart-content.empty.none {
  800. display: none;
  801. }
  802. .cart-content.empty.show {
  803. display: block;
  804. }
  805. .container-cart.show {
  806. display: block;
  807. }
  808. .container-cart.none {
  809. display: none;
  810. }
  811. .empty-container.none {
  812. display: none;
  813. }
  814. .empty-container.show {
  815. display: flex;
  816. }
  817. .foot-check-delbtn {
  818. width: 100%;
  819. height: 80rpx;
  820. position: fixed;
  821. top: 0;
  822. left: 0;
  823. box-sizing: border-box;
  824. padding: 15rpx 24rpx;
  825. background-color: #f7f7f7;
  826. z-index: 990;
  827. .foot-text {
  828. font-size: $font-size-26;
  829. height: 50rpx;
  830. line-height: 50rpx;
  831. color: #666666;
  832. float: left;
  833. padding-left: 10rpx;
  834. text {
  835. margin: 0 6rpx;
  836. }
  837. }
  838. .delBtn {
  839. width: 100rpx;
  840. display: inline-block;
  841. padding: 0 15rpx;
  842. font-size: $font-size-26;
  843. height: 50rpx;
  844. line-height: 50rpx;
  845. border-radius: 30rpx;
  846. background: #ffffff;
  847. border: 1px solid #ff457b;
  848. color: #ff457b;
  849. float: right;
  850. text-align: center;
  851. &.none {
  852. display: none;
  853. }
  854. }
  855. }
  856. .checkbox-box {
  857. display: flex;
  858. align-items: center;
  859. .checkbox {
  860. display: flex;
  861. margin: 0;
  862. padding: 0 5rpx;
  863. display: flex;
  864. flex-direction: column;
  865. align-items: center;
  866. box-sizing: border-box;
  867. text-align: center;
  868. text-decoration: none;
  869. border-radius: 0;
  870. -webkit-tap-highlight-color: transparent;
  871. overflow: hidden;
  872. background-color: #ffffff;
  873. font-size: 36rpx;
  874. color: #999999;
  875. &.icon-xuanze {
  876. color: $color-system;
  877. }
  878. }
  879. &.disabled {
  880. .checkbox {
  881. color: #999999;
  882. }
  883. }
  884. .text {
  885. font-size: $font-size-24;
  886. margin-left: 10rpx;
  887. }
  888. }
  889. .goods-list {
  890. width: 100%;
  891. height: auto;
  892. background-color: #f7f7f7;
  893. .goods-item {
  894. width: 702rpx;
  895. padding: 0 24rpx;
  896. background: #ffffff;
  897. margin-bottom: 24rpx;
  898. }
  899. .shoptitle {
  900. display: flex;
  901. align-items: center;
  902. height: 80rpx;
  903. line-height: 80rpx;
  904. .checkbox-box {
  905. padding: 10rpx;
  906. }
  907. .text {
  908. width: 450rpx;
  909. display: block;
  910. overflow: hidden;
  911. text-overflow: ellipsis;
  912. white-space: nowrap;
  913. margin-left: 20rpx;
  914. font-size: $font-size-28;
  915. color: $text-color;
  916. text-align: left;
  917. font-weight: bold;
  918. }
  919. }
  920. .goods-pros {
  921. width: 100%;
  922. height: auto;
  923. margin-bottom: 20rpx;
  924. }
  925. .goods-pros-t {
  926. display: flex;
  927. align-items: center;
  928. width: 100%;
  929. height: 210rpx;
  930. padding: 0 0 26rpx 0;
  931. .checkbox-box {
  932. padding: 10rpx;
  933. }
  934. .pros-img {
  935. width: 210rpx;
  936. height: 100%;
  937. border-radius: 10rpx;
  938. margin: 0 20rpx;
  939. border: 1px solid #f3f3f3;
  940. image {
  941. width: 100%;
  942. height: 100%;
  943. border-radius: 10rpx;
  944. }
  945. }
  946. }
  947. .goods-pros-b {
  948. width: 100%;
  949. height: auto;
  950. padding: 0 0 24rpx 0;
  951. box-sizing: border-box;
  952. &.show {
  953. display: block;
  954. }
  955. &.none {
  956. display: none;
  957. }
  958. .sum-none {
  959. width: 100%;
  960. height: 48rpx;
  961. line-height: 48rpx;
  962. color: $text-color;
  963. float: left;
  964. text-align: right;
  965. .money {
  966. font-size: $font-size-26;
  967. color: #999999;
  968. text-decoration: line-through;
  969. }
  970. .money-sign {
  971. font-size: $font-size-26;
  972. color: #999999;
  973. text-decoration: line-through;
  974. }
  975. .money-reduced {
  976. margin-left: 10rpx;
  977. font-size: $font-size-26;
  978. color: $color-system;
  979. .iconfont {
  980. font-size: $font-size-34;
  981. }
  982. }
  983. }
  984. .sum {
  985. width: 100%;
  986. height: 40rpx;
  987. font-size: $font-size-26;
  988. line-height: 40rpx;
  989. color: $text-color;
  990. float: left;
  991. display: flex;
  992. justify-content: flex-end;
  993. font-weight: bold;
  994. .money {
  995. color: $color-system;
  996. font-size: $font-size-26;
  997. }
  998. .money-sign {
  999. font-size: $font-size-24;
  1000. color: $color-system;
  1001. }
  1002. }
  1003. }
  1004. .pros-product {
  1005. width: 416rpx;
  1006. height: 100%;
  1007. line-height: 36rpx;
  1008. font-size: $font-size-28;
  1009. position: relative;
  1010. .producttitle {
  1011. width: 100%;
  1012. display: inline-block;
  1013. height: auto;
  1014. text-overflow: ellipsis;
  1015. display: -webkit-box;
  1016. word-break: break-all;
  1017. -webkit-box-orient: vertical;
  1018. -webkit-line-clamp: 2;
  1019. overflow: hidden;
  1020. margin-bottom: 15rpx;
  1021. .no-text {
  1022. display: inline-block;
  1023. height: 36rpx;
  1024. padding: 0 12rpx;
  1025. line-height: 36rpx;
  1026. background: linear-gradient(315deg, rgba(231, 0, 0, 1) 0%, rgba(255, 104, 1, 1) 100%);
  1027. border-radius: 18rpx;
  1028. text-align: center;
  1029. color: #ffffff;
  1030. font-size: $font-size-28;
  1031. margin-right: 24rpx;
  1032. }
  1033. }
  1034. .productspec {
  1035. height: 36rpx;
  1036. color: #999999;
  1037. font-size: $font-size-26;
  1038. }
  1039. .productprice {
  1040. position: absolute;
  1041. bottom: 0;
  1042. width: 100%;
  1043. height: 48rpx;
  1044. margin: 30rpx 0 0 0;
  1045. .price {
  1046. line-height: 48rpx;
  1047. font-size: $font-size-26;
  1048. width: 48%;
  1049. color: $color-system;
  1050. float: left;
  1051. font-weight: bold;
  1052. &.disabled {
  1053. color: #999999;
  1054. text-decoration: line-through;
  1055. }
  1056. .money-sign {
  1057. font-size: $font-size-24;
  1058. color: $color-system;
  1059. }
  1060. }
  1061. .count {
  1062. height: 100%;
  1063. float: right;
  1064. position: relative;
  1065. &.show {
  1066. display: block;
  1067. }
  1068. &.none {
  1069. display: none;
  1070. }
  1071. .count-tips {
  1072. width: auto;
  1073. display: inline-block;
  1074. padding: 0 15rpx;
  1075. line-height: 44rpx;
  1076. height: 44rpx;
  1077. border-radius: 22rpx;
  1078. background: $btn-confirm;
  1079. font-size: $font-size-24;
  1080. text-align: center;
  1081. color: #ffffff;
  1082. position: absolute;
  1083. top: -60rpx;
  1084. left: -5rpx;
  1085. z-index: 5;
  1086. &.step {
  1087. left: -217rpx;
  1088. }
  1089. &::before {
  1090. content: '';
  1091. position: absolute;
  1092. bottom: -30rpx;
  1093. right: 15rpx;
  1094. z-index: 1;
  1095. width: 0;
  1096. height: 0;
  1097. border-width: 18rpx;
  1098. border-style: solid;
  1099. border-color: $color-system transparent transparent transparent;
  1100. }
  1101. }
  1102. .number-box {
  1103. display: flex;
  1104. justify-content: center;
  1105. align-items: center;
  1106. border: 2rpx solid #e1e1e1;
  1107. border-radius: 30rpx;
  1108. height: 48rpx;
  1109. margin-left: 20rpx;
  1110. .iconfont {
  1111. font-size: $font-size-24;
  1112. padding: 0 14rpx;
  1113. color: #666666;
  1114. text-align: center;
  1115. line-height: 48rpx;
  1116. font-weight: bold;
  1117. background: #ffffff;
  1118. &.icon-jianhao {
  1119. border-radius: 30rpx 0 0 30rpx;
  1120. }
  1121. &.icon-jiahao {
  1122. border-radius: 0 30rpx 30rpx 0;
  1123. }
  1124. }
  1125. .btn-input {
  1126. width: 56rpx;
  1127. height: 44rpx;
  1128. line-height: 44rpx;
  1129. border-radius: 4rpx;
  1130. text-align: center;
  1131. font-size: $font-size-24;
  1132. color: #333333;
  1133. background-color: #f7f7f7;
  1134. }
  1135. }
  1136. .uni-numbox {
  1137. position: absolute;
  1138. left: 45rpx;
  1139. bottom: 0;
  1140. .uni-numbox-minus,
  1141. .uni-numbox-plus {
  1142. width: 50rpx;
  1143. line-height: 40rpx;
  1144. }
  1145. .uni-numbox-value {
  1146. font-size: $font-size-28;
  1147. width: 60rpx;
  1148. }
  1149. }
  1150. }
  1151. }
  1152. .floor-item-act {
  1153. width: 100%;
  1154. height: 30rpx;
  1155. margin-top: 8rpx;
  1156. float: left;
  1157. .tag {
  1158. display: inline-block;
  1159. height: 32rpx;
  1160. font-size: 22rpx;
  1161. line-height: 30rpx;
  1162. text-align: center;
  1163. color: #f83c6c;
  1164. float: left;
  1165. margin-right: 10rpx;
  1166. &.tag-02 {
  1167. width: 80rpx;
  1168. background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png) top center
  1169. no-repeat;
  1170. background-size: contain;
  1171. }
  1172. &.tag-01 {
  1173. width: 56rpx;
  1174. color: #fff;
  1175. background-color: #f83c6c;
  1176. border-radius: 4rpx;
  1177. }
  1178. }
  1179. }
  1180. }
  1181. }
  1182. .failure-list {
  1183. width: 702rpx;
  1184. height: auto;
  1185. padding: 0 24rpx;
  1186. margin-top: 20rpx;
  1187. background: #ffffff;
  1188. .failure-title {
  1189. width: 100%;
  1190. height: 82rpx;
  1191. line-height: 82rpx;
  1192. font-size: $font-size-28;
  1193. border-bottom: 1px solid #ebebeb;
  1194. .title-txt {
  1195. float: left;
  1196. color: #666666;
  1197. text-align: left;
  1198. }
  1199. .title-btn {
  1200. float: right;
  1201. color: $color-system;
  1202. text-align: right;
  1203. line-height: 80rpx;
  1204. .butto {
  1205. display: inline-block;
  1206. padding: 0 15rpx;
  1207. font-size: $font-size-26;
  1208. height: 50rpx;
  1209. line-height: 50rpx;
  1210. border-radius: 30rpx;
  1211. background: #fff8fd;
  1212. border: 1px solid #ff457b;
  1213. color: #ff457b;
  1214. margin-top: 15rpx;
  1215. }
  1216. }
  1217. }
  1218. .productlist {
  1219. padding-top: 10rpx;
  1220. .goods-pros {
  1221. width: 100%;
  1222. height: auto;
  1223. padding: 20rpx 0;
  1224. }
  1225. .goods-pros-t {
  1226. display: flex;
  1227. align-items: center;
  1228. width: 100%;
  1229. height: 210rpx;
  1230. position: relative;
  1231. .img-tip {
  1232. display: block;
  1233. width: 72rpx;
  1234. height: 36rpx;
  1235. line-height: 36rpx;
  1236. font-size: $font-size-24;
  1237. text-align: center;
  1238. color: #ffffff;
  1239. border-radius: 24rpx;
  1240. background: rgba(51, 51, 51, 0.3);
  1241. // position: absolute;
  1242. // left: 0;
  1243. // top: 0;
  1244. }
  1245. .checkbox-box {
  1246. padding: 10rpx;
  1247. }
  1248. .pros-img {
  1249. width: 180rpx;
  1250. height: 100%;
  1251. border-radius: 10rpx;
  1252. margin: 0 20rpx;
  1253. border: 1px solid #f3f3f3;
  1254. position: relative;
  1255. image {
  1256. width: 100%;
  1257. height: 100%;
  1258. border-radius: 10rpx;
  1259. }
  1260. }
  1261. .pros-marks {
  1262. width: 730rpx;
  1263. height: 250rpx;
  1264. z-index: 90;
  1265. background: rgba(0, 0, 0, 0.05);
  1266. position: absolute;
  1267. left: -20rpx;
  1268. top: -20rpx;
  1269. }
  1270. }
  1271. .goods-pros-b {
  1272. width: 622rpx;
  1273. margin-left: 84rpx;
  1274. height: 40rpx;
  1275. padding: 0 0 26rpx 0;
  1276. // border-top: 1px solid #EBEBEB;
  1277. &.show {
  1278. display: block;
  1279. }
  1280. &.none {
  1281. display: none;
  1282. }
  1283. .sum {
  1284. font-size: $font-size-28;
  1285. line-height: 40rpx;
  1286. color: $text-color;
  1287. display: flex;
  1288. justify-content: flex-end;
  1289. .money {
  1290. color: #ff2a2a;
  1291. font-size: $font-size-28;
  1292. }
  1293. .money-sign {
  1294. font-size: $font-size-24;
  1295. color: #ff2a2a;
  1296. }
  1297. }
  1298. }
  1299. .pros-product {
  1300. width: 402rpx;
  1301. height: 100%;
  1302. line-height: 36rpx;
  1303. font-size: $font-size-28;
  1304. position: relative;
  1305. .producttitle {
  1306. width: 100%;
  1307. display: inline-block;
  1308. height: auto;
  1309. text-overflow: ellipsis;
  1310. display: -webkit-box;
  1311. word-break: break-all;
  1312. -webkit-box-orient: vertical;
  1313. -webkit-line-clamp: 2;
  1314. overflow: hidden;
  1315. margin-bottom: 8rpx;
  1316. .no-text {
  1317. display: inline-block;
  1318. height: 36rpx;
  1319. padding: 0 12rpx;
  1320. line-height: 36rpx;
  1321. background: linear-gradient(315deg, rgba(231, 0, 0, 1) 0%, rgba(255, 104, 1, 1) 100%);
  1322. border-radius: 18rpx;
  1323. text-align: center;
  1324. color: #ffffff;
  1325. font-size: $font-size-28;
  1326. margin-right: 24rpx;
  1327. }
  1328. }
  1329. .productspec {
  1330. height: 36rpx;
  1331. color: #999999;
  1332. font-size: $font-size-26;
  1333. margin-top: 20rpx;
  1334. }
  1335. .productstate {
  1336. font-size: $font-size-28;
  1337. height: 44rpx;
  1338. color: #ff2a2a;
  1339. position: absolute;
  1340. bottom: 0;
  1341. left: 0;
  1342. }
  1343. }
  1344. }
  1345. }
  1346. .footer {
  1347. width: 100%;
  1348. background-color: #ffffff;
  1349. height: 100rpx;
  1350. position: fixed;
  1351. bottom: 0rpx;
  1352. z-index: 100;
  1353. .footer-le {
  1354. width: 520rpx;
  1355. height: 100%;
  1356. padding: 10rpx 24rpx;
  1357. float: left;
  1358. box-sizing: border-box;
  1359. .foot-check {
  1360. width: 100rpx;
  1361. float: left;
  1362. line-height: 80rpx;
  1363. font-size: $font-size-24;
  1364. .checkbox {
  1365. width: 40rpx;
  1366. text-align: center;
  1367. }
  1368. .text {
  1369. width: 60rpx;
  1370. float: right;
  1371. }
  1372. }
  1373. .sum {
  1374. width: 360rpx;
  1375. height: 100%;
  1376. float: right;
  1377. box-sizing: border-box;
  1378. padding: 0 10rpx;
  1379. .sum-price {
  1380. text-align: right;
  1381. width: 100%;
  1382. height: 80rpx;
  1383. line-height: 80rpx;
  1384. font-size: $font-size-30;
  1385. color: $text-color;
  1386. float: left;
  1387. font-weight: normal;
  1388. .money {
  1389. color: $color-system;
  1390. }
  1391. .money-sign {
  1392. font-size: $font-size-24;
  1393. color: $color-system;
  1394. }
  1395. }
  1396. }
  1397. }
  1398. .footer-ri {
  1399. width: 230rpx;
  1400. height: 100%;
  1401. float: right;
  1402. display: flex;
  1403. justify-content: space-between;
  1404. align-items: center;
  1405. z-index: 999;
  1406. box-sizing: border-box;
  1407. padding: 13rpx 15rpx;
  1408. &.none {
  1409. display: none;
  1410. }
  1411. .btn {
  1412. width: 200rpx;
  1413. height: 100%;
  1414. background: $btn-confirm;
  1415. font-size: $font-size-28;
  1416. line-height: 80rpx;
  1417. color: #ffffff;
  1418. display: flex;
  1419. border-radius: 40rpx;
  1420. justify-content: center;
  1421. align-items: center;
  1422. }
  1423. }
  1424. .footer-del {
  1425. width: 420rpx;
  1426. height: 100rpx;
  1427. position: absolute;
  1428. padding-left: 200rpx;
  1429. background: #ffffff;
  1430. right: 0;
  1431. top: 0;
  1432. z-index: 1000;
  1433. box-sizing: border-box;
  1434. padding: 10rpx 0;
  1435. display: flex;
  1436. &.show {
  1437. animation: showDelbtn 0s linear both;
  1438. }
  1439. &.none {
  1440. animation: hideDelbtn 0s linear both;
  1441. }
  1442. .btn {
  1443. flex: 1;
  1444. margin: 0 8rpx;
  1445. height: 100%;
  1446. line-height: 80rpx;
  1447. font-size: $font-size-28;
  1448. color: #ffffff;
  1449. text-align: center;
  1450. float: left;
  1451. border-radius: 40rpx;
  1452. }
  1453. .btn.btn-cancel {
  1454. background: #f7f7f7;
  1455. color: #b2b2b2;
  1456. }
  1457. .btn.btn-confirm {
  1458. background: $btn-confirm;
  1459. color: #ffffff;
  1460. }
  1461. @keyframes showDelbtn {
  1462. 0% {
  1463. transform: translateX(0);
  1464. }
  1465. 100% {
  1466. transform: translateX(-100%);
  1467. }
  1468. }
  1469. @keyframes hideDelbtn {
  1470. 0% {
  1471. transform: translateX(-100%);
  1472. }
  1473. 100% {
  1474. transform: translateX(0);
  1475. }
  1476. }
  1477. }
  1478. }
  1479. </style>