cart.vue 42 KB

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