index.vue 37 KB

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