cart.vue 42 KB

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