cart.vue 52 KB

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