cart.vue 52 KB

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