cart.vue 42 KB

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