cart.vue 43 KB

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