cart.vue 41 KB

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