cart.vue 42 KB

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