order_addcart.vue 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581
  1. <template>
  2. <!-- 购物车模块 -->
  3. <view :style="colorStyle">
  4. <view class='shoppingCart copy-data'>
  5. <view class='labelNav acea-row row-around row-middle'>
  6. <view class='item'><text class='iconfont icon-xuanzhong'></text>100%正品保证</view>
  7. <view class='item'><text class='iconfont icon-xuanzhong'></text>所有商品精挑细选</view>
  8. <view class='item'><text class='iconfont icon-xuanzhong'></text>售后无忧</view>
  9. </view>
  10. <view class='nav acea-row row-between-wrapper'>
  11. <view><text class='num font-num'>{{cartNum || 0}}</text>购物数量</view>
  12. <view v-if="cartList.valid.length > 0 || cartList.invalid.length > 0"
  13. class='administrate acea-row row-center-wrapper' @click='manage'>{{ footerswitch ? '管理' : '取消'}}
  14. </view>
  15. </view>
  16. <view v-if="cartList.valid.length > 0 || cartList.invalid.length > 0">
  17. <view style="height: 171rpx;"></view>
  18. <view class='list'>
  19. <checkbox-group @change="checkboxChange">
  20. <view class="title acea-row row-between-wrapper" v-if="cartList.valid.length && Object.prototype.toString.call(discountInfo.coupon) === '[object Object]'">
  21. <view style="width:530rpx;"><text class="label">优惠券</text>最高可优惠{{discountInfo.deduction.coupon_price}}元</view>
  22. <view class="font-color" @click="couponTap">点击领用<text class="iconfont icon-jinru2"></text></view>
  23. </view>
  24. <view v-for="(j,jindex) in cartList.valid" :key="jindex">
  25. <view class="title acea-row row-between-wrapper" v-for="(p,proIndex) in j.promotions"
  26. :key="proIndex">
  27. <view style="width:530rpx;"><text class="label">{{p.title}}</text>{{p.desc}}<text v-if="p.differ_threshold>0">,还差{{p.differ_threshold}}{{p.threshold_type==1?'元':'件'}}</text></view>
  28. <view class="font-color" @click="goCollect(p)">{{p.is_valid == 1?'去逛逛':'去凑单'}}<text
  29. class="iconfont icon-jinru2"></text></view>
  30. </view>
  31. <!-- <checkbox-group @change="checkboxChange"> -->
  32. <block v-for="(item,index) in j.valid" :key="index">
  33. <view class='item acea-row row-between-wrapper'>
  34. <!-- #ifndef MP -->
  35. <checkbox :value="(item.id).toString()" :checked="item.checked"
  36. :disabled="(!item.attrStatus || item.is_gift?true:false) && footerswitch" />
  37. <!-- <checkbox :value="(item.id).toString()" :checked="item.checked" :disabled="item.attrStatus?false:true" /> -->
  38. <!-- #endif -->
  39. <!-- #ifdef MP -->
  40. <checkbox :value="item.id" :checked="item.checked"
  41. :disabled="(!item.attrStatus || item.is_gift?true:false) && footerswitch" />
  42. <!-- #endif -->
  43. <view class='picTxt acea-row row-between-wrapper'>
  44. <navigator class='pictrue' :url='"/pages/goods_details/index?id="+item.product_id' hover-class='none'>
  45. <image v-if="item.productInfo.attrInfo" :src='item.productInfo.attrInfo.image'>
  46. </image>
  47. <image v-else :src='item.productInfo.image'></image>
  48. </navigator>
  49. <view class='text'>
  50. <view class='line1' :class="item.attrStatus?'':'reColor'">
  51. {{item.productInfo.store_name}}
  52. </view>
  53. <view class='infor line1' v-if="item.productInfo.attrInfo && item.productInfo.spec_type && !item.is_gift" @click.stop="cartAttr(item)">
  54. <text class="name line1">属性:{{item.productInfo.attrInfo.suk}}</text>
  55. <text class="iconfont icon-xiangxia"></text>
  56. </view>
  57. <view class='infor line1' v-else>
  58. <text class="name line1">属性:{{item.productInfo.attrInfo.suk}}</text>
  59. </view>
  60. <view class='money' v-if="item.attrStatus && !item.is_gift">¥{{item.sum_price}}</view>
  61. <view class="isGift" v-if="item.is_gift">赠品</view>
  62. <view class="reElection acea-row row-between-wrapper" v-if="!item.attrStatus">
  63. <view class="titles">请重新选择商品规格</view>
  64. <view class="reBnt cart-color acea-row row-center-wrapper"
  65. @click.stop="reElection(item)">重选</view>
  66. </view>
  67. </view>
  68. <view class='carnum acea-row row-center-wrapper' v-if="item.attrStatus && !item.is_gift">
  69. <view class="reduce" :class="item.numSub ? 'on' : ''"
  70. @click.stop='subCart(jindex,index)'>-</view>
  71. <view class='num'>{{(item.productInfo.limit_num>0 && item.cart_num>=item.productInfo.limit_num)?item.productInfo.limit_num:item.cart_num}}</view>
  72. <!-- <view class="num">
  73. <input type="number" v-model="item.cart_num" @click.stop @input="iptCartNum(index)" @blur="blurInput(index)"/>
  74. </view> -->
  75. <view class="plus" :class="(item.numAdd || (item.productInfo.limit_num>0 && item.cart_num>=item.productInfo.limit_num)) ? 'on' : ''"
  76. @click.stop='addCart(jindex,index,item)'>+</view>
  77. </view>
  78. </view>
  79. <view class="evaluate" v-if="item.attrStatus && !item.is_gift && item.sum_price != item.truePrice">预估到手价<text class="num">¥{{item.truePrice}}</text></view>
  80. </view>
  81. </block>
  82. <!-- </checkbox-group> -->
  83. </view>
  84. </checkbox-group>
  85. </view>
  86. <view class='invalidGoods' v-if="cartList.invalid.length > 0">
  87. <view class='goodsNav acea-row row-between-wrapper'>
  88. <view @click='goodsOpen'><text class='iconfont'
  89. :class='goodsHidden==true?"icon-xiangxia":"icon-xiangshang"'></text>失效商品</view>
  90. <view class='del' @click='unsetCart'><text class='iconfont icon-shanchu1'></text>清空</view>
  91. </view>
  92. <view class='goodsList' :hidden='goodsHidden'>
  93. <block v-for="(item,index) in cartList.invalid" :key='index'>
  94. <view class='item acea-row row-between-wrapper'>
  95. <view class='invalid'>失效</view>
  96. <view class='pictrue'>
  97. <image v-if="item.productInfo.attrInfo" :src='item.productInfo.attrInfo.image'>
  98. </image>
  99. <image v-else :src='item.productInfo.image'></image>
  100. </view>
  101. <view class='text acea-row row-column-between'>
  102. <view class='line1 name'>{{item.productInfo.store_name}}</view>
  103. <view class='infor line1' v-if="item.productInfo.attrInfo">
  104. 属性:{{item.productInfo.attrInfo.suk}}</view>
  105. <view class='acea-row row-between-wrapper'>
  106. <!-- <view>¥{{item.truePrice}}</view> -->
  107. <view class='end'>{{item.invalid_desc}}</view>
  108. </view>
  109. </view>
  110. </view>
  111. </block>
  112. </view>
  113. </view>
  114. <!-- <view class='loadingicon acea-row row-center-wrapper' v-if="cartList.invalid.length && loadend">
  115. <text class='loading iconfont icon-jiazai'
  116. :hidden='loadingInvalid==false'></text>{{loadTitleInvalid}}
  117. </view> -->
  118. </view>
  119. <view class='noCart' v-if="cartList.valid.length == 0 && cartList.invalid.length == 0 && loadend">
  120. <view class='pictrue'>
  121. <image :src="imgHost + '/statics/images/no-thing.png'"></image>
  122. <view>暂无商品,去添加点什么吧</view>
  123. </view>
  124. <!-- 热门推荐显示 -->
  125. <recommend :hostProduct='hostProduct'></recommend>
  126. </view>
  127. <view v-if="cartList.valid.length == 0 && cartList.invalid.length == 0 && loadend" style='height:30rpx;color: #F5F5F5;'></view>
  128. <view v-else style='height:190rpx;color: #F5F5F5;'></view>
  129. <view class="tips acea-row row-middle" :class="isFooter?'':'on'" v-if="isTips"><text class="iconfont icon-tishi"></text>部分活动不能叠加,系统已自动为您计算最优惠的价格</view>
  130. <!-- 订单结算 -->
  131. <view class='footer acea-row row-between-wrapper' :class="isFooter?'':'on'"
  132. v-if="cartList.valid.length > 0">
  133. <view>
  134. <checkbox-group @change="checkboxAllChange">
  135. <checkbox value="all" :checked="!!isAllSelect" />
  136. <text class='checkAll'>全选({{selectValue.length}})</text>
  137. </checkbox-group>
  138. </view>
  139. <view class='money acea-row row-middle' v-if="footerswitch==true && discountInfo.deduction">
  140. <view class="left">
  141. 实付:
  142. <text class="font-color">¥{{selectValue.length?discountInfo.deduction.pay_price:0}}</text>
  143. <view class="detailed" @click="discountTap" v-if="(Object.prototype.toString.call(discountInfo.coupon) === '[object Object]' || discountInfo.deduction.first_order_price || discountInfo.deduction.promotions_price) && selectValue.length">优惠明细<text class="iconfont" :class="discountInfo.discount?'icon-xiangxia':'icon-xiangshang'"></text></view>
  144. </view>
  145. <form @submit="subOrder">
  146. <button class='placeOrder bg-color' :class="selectValue.length?'':'on'" formType="submit">{{Object.prototype.toString.call(discountInfo.coupon) === "[object Array]" || discountInfo.coupon.used?'立即':'领券'}}下单</button>
  147. </form>
  148. </view>
  149. <view class='button acea-row row-middle' v-else>
  150. <form @submit="subCollect">
  151. <button class='bnt cart-color' formType="submit">收藏</button>
  152. </form>
  153. <form @submit="subDel">
  154. <button class='bnt' formType="submit">删除</button>
  155. </form>
  156. </view>
  157. </view>
  158. </view>
  159. <!-- 产品属性显示 -->
  160. <productWindow :attr="attr" :isShow='1' :iSplus='1' :iScart='1' @myevent="onMyEvent" @ChangeAttr="ChangeAttr"
  161. @ChangeCartNum="ChangeCartNum" @attrVal="attrVal" @iptCartNum="iptCartNum" @goCat="reGoCat"
  162. id='product-window'></productWindow>
  163. <!-- 优惠明细显示 -->
  164. <cartDiscount :discountInfo="discountInfo" @myevent="myDiscount"></cartDiscount>
  165. <view class="uni-p-b-98"></view>
  166. <pageFooter @newDataStatus="newDataStatus"></pageFooter>
  167. <!-- 优惠券列表弹框显示 -->
  168. <couponListWindow :coupon="coupon" v-if="coupon" @ChangCouponsClone="ChangCouponsClone"
  169. @ChangCouponsUseState="ChangCouponsUseState" @tabCouponType="tabCouponType">
  170. </couponListWindow>
  171. <!-- #ifdef MP -->
  172. <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize>
  173. <!-- #endif -->
  174. </view>
  175. </template>
  176. <script>
  177. // #ifdef APP-PLUS
  178. let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  179. // #endif
  180. // #ifndef APP-PLUS
  181. let sysHeight = 0
  182. // #endif
  183. import {
  184. getCartList,
  185. getCartCounts,
  186. changeCartNum,
  187. cartDel,
  188. getResetCart,
  189. cartCompute
  190. } from '@/api/order.js';
  191. import {
  192. setCouponReceive,
  193. getCoupons
  194. } from '@/api/api.js';
  195. import {
  196. getProductHot,
  197. collectAll,
  198. getProductDetail
  199. } from '@/api/store.js';
  200. import {
  201. toLogin
  202. } from '@/libs/login.js';
  203. import {
  204. mapGetters
  205. } from "vuex";
  206. import recommend from '@/components/recommend';
  207. import productWindow from '@/components/productWindow';
  208. import cartDiscount from '@/components/cartDiscount';
  209. import couponListWindow from '@/components/couponListWindow';
  210. import pageFooter from '@/components/pageFooter/index.vue'
  211. import colors from "@/mixins/color";
  212. import {HTTP_REQUEST_URL} from '@/config/app';
  213. import {Debounce} from '@/utils/validate.js'
  214. export default {
  215. components: {
  216. couponListWindow,
  217. pageFooter,
  218. recommend,
  219. productWindow,
  220. cartDiscount
  221. },
  222. mixins: [colors],
  223. data() {
  224. return {
  225. isFooter:false,
  226. isTips:false,
  227. //属性是否打开
  228. coupon: {
  229. coupon: false,
  230. type: -1,
  231. list: [],
  232. count: [],
  233. goFrom:1
  234. },
  235. discountInfo:{
  236. discount:false,
  237. deduction:{},
  238. coupon:{}
  239. },
  240. goodsHidden: true,
  241. footerswitch: true,
  242. hostProduct: [],
  243. cartList: {
  244. valid: [],
  245. invalid: []
  246. },
  247. isAllSelect: false, //全选
  248. selectValue: [], //选中的数据
  249. selectCountPrice: 0.00,
  250. isAuto: false, //没有授权的不会自动授权
  251. isShowAuth: false, //是否隐藏授权
  252. hotScroll: false,
  253. hotPage: 1,
  254. hotLimit: 10,
  255. loading: false,
  256. loadend: false,
  257. loadTitle: '没有更多内容啦~', //提示语
  258. page: 1,
  259. limit: 20,
  260. loadingInvalid: false,
  261. loadendInvalid: false,
  262. loadTitleInvalid: '加载更多', //提示语
  263. pageInvalid: 1,
  264. limitInvalid: 20,
  265. attr: {
  266. cartAttr: false,
  267. productAttr: [],
  268. productSelect: {}
  269. },
  270. productValue: [], //系统属性
  271. storeInfo: {},
  272. attrValue: '', //已选属性
  273. attrTxt: '请选择', //属性页面提示
  274. cartId: 0,
  275. product_id: 0,
  276. sysHeight: sysHeight,
  277. footerSee: false,
  278. isCart: 0,
  279. imgHost:HTTP_REQUEST_URL
  280. };
  281. },
  282. computed: mapGetters(['isLogin','cartNum']),
  283. onLoad: function(options) {
  284. this.hotPage = 1;
  285. this.hostProduct = [],
  286. this.hotScroll = false,
  287. this.getHostProduct();
  288. },
  289. onShow: function() {
  290. uni.setStorageSync('form_type_cart', 1);
  291. uni.pageScrollTo({
  292. duration:0,
  293. scrollTop:0
  294. })
  295. if (this.isLogin == true){
  296. this.resetData();
  297. }else{
  298. // #ifdef H5 || APP-PLUS
  299. toLogin()
  300. // #endif
  301. // #ifdef MP
  302. this.isShowAuth = true;
  303. // #endif
  304. }
  305. },
  306. methods: {
  307. onLoadFun(){
  308. this.resetData();
  309. },
  310. resetData(){
  311. this.loadend = false;
  312. this.page = 1;
  313. this.cartList.valid = [];
  314. // 1:表示只有在onShow里面调用;
  315. this.getCartList();
  316. this.loadendInvalid = false;
  317. this.pageInvalid = 1;
  318. this.cartList.invalid = [];
  319. this.goodsHidden = true;
  320. this.footerswitch = true;
  321. this.hotLimit = 10;
  322. this.isAllSelect = false; //全选
  323. this.selectValue = []; //选中的数据
  324. this.selectCountPrice = 0.00;
  325. this.isShowAuth = false;
  326. },
  327. newDataStatus(val){
  328. this.isFooter = val;
  329. },
  330. tabCouponType: function(type) {
  331. this.$set(this.coupon, 'type', type);
  332. this.getCouponList(type);
  333. },
  334. ChangCouponsUseState(index) {
  335. let that = this;
  336. that.coupon.list[index].is_use = true;
  337. that.$set(that.coupon, 'list', that.coupon.list);
  338. that.$set(that.coupon, 'coupon', false);
  339. },
  340. ChangCouponsClone: function() {
  341. this.$set(this.coupon, 'coupon', false);
  342. },
  343. /**
  344. * 获取优惠券
  345. *
  346. */
  347. getCouponList(type) {
  348. let that = this,
  349. obj = {
  350. page: 1,
  351. limit: 20,
  352. product_id: that.id
  353. };
  354. if (type !== undefined || type !== null) {
  355. obj.type = type;
  356. }
  357. getCoupons(obj).then(res => {
  358. that.$set(that.coupon, 'count', res.data.count);
  359. if (type === undefined || type === null) {
  360. let count = [...that.coupon.count],
  361. indexs = '';
  362. let index = count.findIndex(item => item);
  363. let delCount = that.coupon.count,
  364. newDelCount = [];
  365. let countIndex = 0;
  366. delCount.forEach((item, index) => {
  367. if (item === 0) {
  368. countIndex = index;
  369. } else {
  370. newDelCount.push(item)
  371. }
  372. });
  373. if (newDelCount.length == 3) {
  374. indexs = 2;
  375. } else if (newDelCount.length == 2) {
  376. if (countIndex === 2) {
  377. indexs = 1;
  378. } else {
  379. indexs = 2;
  380. }
  381. } else {
  382. indexs = delCount.findIndex(item => item === count[index]);
  383. }
  384. that.$set(that.coupon, 'type', indexs);
  385. that.getCouponList(indexs);
  386. } else {
  387. that.$set(that.coupon, 'list', res.data.list);
  388. }
  389. });
  390. },
  391. /**
  392. * 打开优惠券插件
  393. */
  394. couponTap: function() {
  395. let that = this;
  396. that.getCouponList();
  397. that.$set(that.coupon, 'coupon', true);
  398. },
  399. goCollect(item){
  400. uni.navigateTo({
  401. url: `/pages/goods/goods_list/index?sid=0&title=默认&promotions_type=${item.promotions_type}&promotions_id=${item.id}`
  402. })
  403. },
  404. myDiscount(){
  405. this.discountInfo.discount = false;
  406. },
  407. discountTap(){
  408. this.coupon.coupon=false;
  409. this.discountInfo.discount = !this.discountInfo.discount;
  410. },
  411. // 授权关闭
  412. authColse: function(e) {
  413. this.isShowAuth = e;
  414. },
  415. // 修改购物车
  416. reGoCat: function() {
  417. let that = this,
  418. productSelect = that.productValue[this.attrValue];
  419. //如果有属性,没有选择,提示用户选择
  420. if (
  421. that.attr.productAttr.length &&
  422. productSelect === undefined
  423. )
  424. return that.$util.Tips({
  425. title: "产品库存不足,请选择其它"
  426. });
  427. let q = {
  428. id: that.cartId,
  429. product_id: that.product_id,
  430. num: that.attr.productSelect.cart_num,
  431. unique: that.attr.productSelect !== undefined ?
  432. that.attr.productSelect.unique : ""
  433. };
  434. getResetCart(q)
  435. .then(function(res) {
  436. that.attr.cartAttr = false;
  437. that.$util.Tips({
  438. title: "添加购物车成功",
  439. success: () => {
  440. that.loadend = false;
  441. that.page = 1;
  442. that.cartList.valid = [];
  443. that.getCartList();
  444. that.getCartNum();
  445. }
  446. });
  447. })
  448. .catch(res => {
  449. return that.$util.Tips({
  450. title: res.msg
  451. });
  452. });
  453. },
  454. onMyEvent: function() {
  455. this.$set(this.attr, 'cartAttr', false);
  456. },
  457. // 点击切换属性
  458. cartAttr(item){
  459. this.isCart = 1;
  460. this.getGoodsDetails(item);
  461. },
  462. reElection: function(item) {
  463. this.getGoodsDetails(item)
  464. },
  465. /**
  466. * 获取产品详情
  467. *
  468. */
  469. getGoodsDetails: function(item) {
  470. uni.showLoading({
  471. title: '加载中',
  472. mask: true
  473. });
  474. let that = this;
  475. that.cartId = item.id;
  476. that.product_id = item.product_id;
  477. console.log(item.id,item.product_id);
  478. getProductDetail(item.product_id).then(res => {
  479. uni.hideLoading();
  480. that.attr.cartAttr = true;
  481. let storeInfo = res.data.storeInfo;
  482. that.$set(that, 'storeInfo', storeInfo);
  483. console.log(storeInfo.store_name);
  484. that.$set(that.attr, 'productAttr', res.data.productAttr);
  485. that.$set(that, 'productValue', res.data.productValue);
  486. that.DefaultSelect();
  487. }).catch(err => {
  488. uni.hideLoading();
  489. })
  490. },
  491. /**
  492. * 属性变动赋值
  493. *
  494. */
  495. ChangeAttr: function(res) {
  496. let productSelect = this.productValue[res];
  497. if (productSelect && productSelect.stock > 0) {
  498. this.$set(this.attr.productSelect, "image", productSelect.image);
  499. this.$set(this.attr.productSelect, "price", productSelect.price);
  500. this.$set(this.attr.productSelect, "stock", productSelect.stock);
  501. this.$set(this.attr.productSelect, "unique", productSelect.unique);
  502. this.$set(this.attr.productSelect, "cart_num", 1);
  503. this.$set(this, "attrValue", res);
  504. this.$set(this, "attrTxt", "已选择");
  505. } else {
  506. this.$set(this.attr.productSelect, "image", this.storeInfo.image);
  507. this.$set(this.attr.productSelect, "price", this.storeInfo.price);
  508. this.$set(this.attr.productSelect, "stock", 0);
  509. this.$set(this.attr.productSelect, "unique", "");
  510. this.$set(this.attr.productSelect, "cart_num", 0);
  511. this.$set(this, "attrValue", "");
  512. this.$set(this, "attrTxt", "请选择");
  513. }
  514. },
  515. /**
  516. * 默认选中属性
  517. *
  518. */
  519. DefaultSelect: function() {
  520. let productAttr = this.attr.productAttr;
  521. let value = [],stock = 0,attrValue = [];
  522. for (var key in this.productValue) {
  523. if (this.productValue[key].stock > 0) {
  524. value = this.attr.productAttr.length ? key.split(",") : [];
  525. break;
  526. }
  527. }
  528. //isCart 1为触发购物车 0为商品
  529. if (this.isCart) {
  530. //购物车默认打开时,随着选中的属性改变
  531. // let attrValue = [];
  532. this.cartList.valid.forEach(j=>{
  533. j.valid.forEach(item=>{
  534. if (item.id == this.cartId) {
  535. attrValue = item.productInfo.attrInfo.suk.split(",");
  536. }
  537. })
  538. })
  539. let key = attrValue.join(",");
  540. console.log('几级',key);
  541. console.log(this.productValue);
  542. stock = this.productValue[key].stock;
  543. for (let i = 0; i < productAttr.length; i++) {
  544. this.$set(productAttr[i], "index", stock?attrValue[i]:value[i]);
  545. }
  546. } else {
  547. for (let i = 0; i < productAttr.length; i++) {
  548. this.$set(productAttr[i], "index", value[i]);
  549. }
  550. }
  551. //sort();排序函数:数字-英文-汉字;
  552. let productSelect = this.productValue[(this.isCart&&stock)?attrValue.join(","):value.join(",")];
  553. if (productSelect && productAttr.length) {
  554. this.$set(
  555. this.attr.productSelect,
  556. "store_name",
  557. this.storeInfo.store_name
  558. );
  559. this.$set(this.attr.productSelect, "image", productSelect.image);
  560. this.$set(this.attr.productSelect, "price", productSelect.price);
  561. this.$set(this.attr.productSelect, "stock", productSelect.stock);
  562. this.$set(this.attr.productSelect, "unique", productSelect.unique);
  563. this.$set(this.attr.productSelect, "cart_num", 1);
  564. this.$set(this, "attrValue", value.sort().join(","));
  565. this.$set(this, "attrTxt", "已选择");
  566. } else if (!productSelect && productAttr.length) {
  567. this.$set(
  568. this.attr.productSelect,
  569. "store_name",
  570. this.storeInfo.store_name
  571. );
  572. this.$set(this.attr.productSelect, "image", this.storeInfo.image);
  573. this.$set(this.attr.productSelect, "price", this.storeInfo.price);
  574. this.$set(this.attr.productSelect, "stock", 0);
  575. this.$set(this.attr.productSelect, "unique", "");
  576. this.$set(this.attr.productSelect, "cart_num", 0);
  577. this.$set(this, "attrValue", "");
  578. this.$set(this, "attrTxt", "请选择");
  579. } else if (!productSelect && !productAttr.length) {
  580. this.$set(
  581. this.attr.productSelect,
  582. "store_name",
  583. this.storeInfo.store_name
  584. );
  585. this.$set(this.attr.productSelect, "image", this.storeInfo.image);
  586. this.$set(this.attr.productSelect, "price", this.storeInfo.price);
  587. this.$set(this.attr.productSelect, "stock", this.storeInfo.stock);
  588. this.$set(
  589. this.attr.productSelect,
  590. "unique",
  591. this.storeInfo.unique || ""
  592. );
  593. this.$set(this.attr.productSelect, "cart_num", 1);
  594. this.$set(this, "attrValue", "");
  595. this.$set(this, "attrTxt", "请选择");
  596. }
  597. },
  598. attrVal(val) {
  599. this.$set(this.attr.productAttr[val.indexw], 'index', this.attr.productAttr[val.indexw].attr_values[val
  600. .indexn]);
  601. },
  602. /**
  603. * 购物车数量加和数量减
  604. *
  605. */
  606. ChangeCartNum: function(changeValue) {
  607. //changeValue:是否 加|减
  608. //获取当前变动属性
  609. let productSelect = this.productValue[this.attrValue];
  610. //如果没有属性,赋值给商品默认库存
  611. if (productSelect === undefined && !this.attr.productAttr.length)
  612. productSelect = this.attr.productSelect;
  613. //无属性值即库存为0;不存在加减;
  614. if (productSelect === undefined) return;
  615. let stock = productSelect.stock || 0;
  616. let num = this.attr.productSelect;
  617. if (changeValue) {
  618. num.cart_num++;
  619. if (num.cart_num > stock) {
  620. this.$set(this.attr.productSelect, "cart_num", stock ? stock : 1);
  621. this.$set(this, "cart_num", stock ? stock : 1);
  622. }
  623. } else {
  624. num.cart_num--;
  625. if (num.cart_num < 1) {
  626. this.$set(this.attr.productSelect, "cart_num", 1);
  627. this.$set(this, "cart_num", 1);
  628. }
  629. }
  630. },
  631. /**
  632. * 购物车手动填写
  633. *
  634. */
  635. iptCartNum: function(e) {
  636. this.$set(this.attr.productSelect, 'cart_num', e);
  637. },
  638. subDel: function(event) {
  639. let that = this,
  640. selectValue = that.selectValue,
  641. storeId = uni.getStorageSync('user_store_id');
  642. if (selectValue.length > 0)
  643. cartDel(selectValue,storeId).then(res => {
  644. that.loadend = false;
  645. that.page = 1;
  646. that.cartList.valid = [];
  647. that.getCartList();
  648. that.getCartNum();
  649. });
  650. else
  651. return that.$util.Tips({
  652. title: '请选择产品'
  653. });
  654. },
  655. getSelectValueProductId: function() {
  656. let that = this;
  657. let validList = that.cartList.valid;
  658. let selectValue = that.selectValue;
  659. let productId = [];
  660. if (selectValue.length > 0) {
  661. for (let j in validList) {
  662. for (let index in validList[j].valid){
  663. if (that.inArray(validList[j].valid[index].id, selectValue)) {
  664. productId.push(validList[j].valid[index].product_id);
  665. }
  666. }
  667. }
  668. };
  669. return productId;
  670. },
  671. subCollect: function(event) {
  672. let that = this,
  673. selectValue = that.selectValue;
  674. if (selectValue.length > 0) {
  675. let selectValueProductId = that.getSelectValueProductId();
  676. collectAll(that.getSelectValueProductId().join(',')).then(res => {
  677. return that.$util.Tips({
  678. title: res.msg,
  679. icon: 'success'
  680. });
  681. }).catch(err => {
  682. return that.$util.Tips({
  683. title: err
  684. });
  685. });
  686. } else {
  687. return that.$util.Tips({
  688. title: '请选择产品'
  689. });
  690. }
  691. },
  692. subOrder(event) {
  693. let that = this,
  694. selectValue = that.selectValue,delivery_type = 1,storeId = 0
  695. if (selectValue.length > 0) {
  696. that.cartList.valid.forEach(item=>{
  697. item.valid.forEach(j=>{
  698. if(j.id == selectValue[0]){
  699. let deliverySort = j.productInfo.delivery_type.sort((x,y)=>x - y);
  700. delivery_type = deliverySort[0];
  701. storeId = j.productInfo.type == 1?j.productInfo.relation_id:0
  702. }
  703. })
  704. })
  705. let coupon = this.discountInfo.coupon;
  706. if(Object.prototype.toString.call(coupon) === '[object Object]' && !coupon.used){
  707. setCouponReceive(this.discountInfo.coupon.id).then(res=>{
  708. uni.navigateTo({
  709. url: '/pages/goods/order_confirm/index?cartId=' + selectValue.join(',') + '&couponId=' + res.data.id +'&couponTitle='+ coupon.coupon_title+'&delivery_type='+delivery_type + '&store_id=' + storeId
  710. });
  711. }).catch(err=>{
  712. return that.$util.Tips({
  713. title: err
  714. });
  715. })
  716. }else{
  717. let url = '';
  718. if(Object.prototype.toString.call(coupon) === '[object Array]'){
  719. url = '/pages/goods/order_confirm/index?cartId=' + selectValue.join(',')+'&delivery_type='+delivery_type+ '&store_id=' + storeId
  720. }else{
  721. url = '/pages/goods/order_confirm/index?cartId=' + selectValue.join(',') + '&couponId=' + coupon.used.id +'&couponTitle='+ coupon.coupon_title+'&delivery_type='+delivery_type+ '&store_id=' + storeId
  722. }
  723. uni.navigateTo({
  724. url: url
  725. });
  726. }
  727. } else {
  728. return that.$util.Tips({
  729. title: '请选择产品'
  730. });
  731. }
  732. },
  733. checkboxAllChange: function(event) {
  734. let value = event.detail.value;
  735. if (value.length > 0) {
  736. this.setAllSelectValue(1)
  737. } else {
  738. this.setAllSelectValue(0)
  739. }
  740. },
  741. setAllSelectValue: function(status) {
  742. let that = this;
  743. let selectValue = [];
  744. let valid = that.cartList.valid;
  745. if (valid.length > 0) {
  746. valid.forEach(j=>{
  747. j.valid.forEach(item=>{
  748. if (status) {
  749. if (that.footerswitch) {
  750. if (item.attrStatus && !item.is_gift) {
  751. item.checked = true;
  752. selectValue.push(item.id);
  753. } else {
  754. item.checked = false;
  755. }
  756. } else {
  757. item.checked = true;
  758. selectValue.push(item.id);
  759. }
  760. that.isAllSelect = true;
  761. } else {
  762. item.checked = false;
  763. that.isAllSelect = false;
  764. }
  765. })
  766. })
  767. that.$set(that.cartList, 'valid', valid);
  768. that.selectValue = selectValue;
  769. that.switchSelect();
  770. }
  771. },
  772. checkboxChange: function(event) {
  773. let that = this;
  774. let value = event.detail.value;
  775. let valid = that.cartList.valid;
  776. let arr1 = [];
  777. let arr2 = [];
  778. let arr3 = [];
  779. let len = 0;
  780. valid.forEach(j=>{
  781. j.valid.forEach(item=>{
  782. len = len + 1;
  783. if (that.inArray(item.id, value)) {
  784. if (that.footerswitch) {
  785. if (item.attrStatus && !item.is_gift) {
  786. item.checked = true;
  787. arr1.push(item);
  788. } else {
  789. item.checked = false;
  790. }
  791. } else {
  792. item.checked = true;
  793. arr1.push(item);
  794. }
  795. } else {
  796. item.checked = false;
  797. arr2.push(item);
  798. }
  799. })
  800. })
  801. if (that.footerswitch) {
  802. arr3 = arr2.filter(item => !item.attrStatus || item.is_gift);
  803. }
  804. that.$set(that.cartList, 'valid', valid);
  805. that.isAllSelect = len === arr1.length + arr3.length;
  806. that.selectValue = value;
  807. that.switchSelect();
  808. },
  809. inArray: function(search, array) {
  810. for (let i in array) {
  811. if (array[i] == search) {
  812. return true;
  813. }
  814. }
  815. return false;
  816. },
  817. switchSelect: function() {
  818. let that = this;
  819. let validList = that.cartList.valid;
  820. let selectValue = that.selectValue;
  821. let selectCountPrice = 0.00;
  822. let cartId = [];
  823. if (selectValue.length < 1) {
  824. that.selectCountPrice = selectCountPrice;
  825. } else {
  826. for (let j in validList) {
  827. for(let index in validList[j].valid){
  828. if (that.inArray(validList[j].valid[index].id, selectValue)) {
  829. cartId.push(validList[j].valid[index].id)
  830. selectCountPrice = that.$util.$h.Add(selectCountPrice, that.$util.$h.Mul(validList[j].valid[index]
  831. .cart_num, validList[j].valid[
  832. index].truePrice))
  833. }
  834. }
  835. }
  836. that.selectCountPrice = selectCountPrice;
  837. }
  838. let data = {cartId:cartId.join(',')}
  839. if(cartId.length){
  840. this.getCartCompute(data);
  841. }
  842. },
  843. /**
  844. * 购物车手动填写
  845. *
  846. */
  847. // iptCartNum: function(index) {
  848. // let item = this.cartList.valid[index];
  849. // if (item.cart_num) {
  850. // this.setCartNum(item.id, item.cart_num);
  851. // }
  852. // this.switchSelect();
  853. // },
  854. // blurInput: function(index) {
  855. // let item = this.cartList.valid[index];
  856. // if (!item.cart_num) {
  857. // item.cart_num = 1;
  858. // this.$set(this.cartList, 'valid', this.cartList.valid)
  859. // }
  860. // },
  861. subCart: Debounce(function(jindex,index) {
  862. let that = this;
  863. let status = false;
  864. let item = that.cartList.valid[jindex].valid[index];
  865. item.cart_num = Number(item.cart_num) - 1;
  866. if (item.cart_num < 1) status = true;
  867. if (item.cart_num <= 1) {
  868. item.cart_num = 1;
  869. item.numSub = true;
  870. } else {
  871. item.numSub = false;
  872. item.numAdd = false;
  873. }
  874. if (false == status) {
  875. that.setCartNum(item.id, item.cart_num, function(data) {
  876. that.cartList.valid[jindex].valid[index] = item;
  877. that.getCartNum();
  878. // that.switchSelect();
  879. that.loadend = false;
  880. that.page = 1;
  881. // that.cartList.valid = [];
  882. that.getCartList();
  883. });
  884. }
  885. }),
  886. addCart: Debounce(function(jindex,index,obj) {
  887. if(obj.numAdd || (obj.productInfo.limit_num>0 && obj.cart_num>=obj.productInfo.limit_num)){
  888. return false
  889. }
  890. let that = this;
  891. let item = that.cartList.valid[jindex].valid[index];
  892. item.cart_num = Number(item.cart_num) + 1;
  893. let productInfo = item.productInfo;
  894. if (productInfo.hasOwnProperty('attrInfo') && item.cart_num >= item.productInfo.attrInfo.stock) {
  895. item.cart_num = item.productInfo.attrInfo.stock;
  896. item.numAdd = true;
  897. item.numSub = false;
  898. } else {
  899. item.numAdd = false;
  900. item.numSub = false;
  901. }
  902. that.setCartNum(item.id, item.cart_num, function(data) {
  903. that.cartList.valid[jindex].valid[index] = item;
  904. that.getCartNum();
  905. // that.switchSelect();
  906. that.loadend = false;
  907. that.page = 1;
  908. // that.cartList.valid = [];
  909. that.getCartList();
  910. });
  911. }),
  912. setCartNum(cartId, cartNum, successCallback) {
  913. let that = this;
  914. changeCartNum(cartId, cartNum).then(res => {
  915. successCallback && successCallback(res.data);
  916. });
  917. },
  918. getCartNum: function() {
  919. let that = this;
  920. let id = uni.getStorageSync('user_store_id') || 0;
  921. // let id = 0;
  922. getCartCounts(0,id).then(res => {
  923. this.$store.commit('indexData/setCartNum', res.data.count > 99 ? '..' : res.data.count)
  924. if (res.data.count > 0) {
  925. uni.setTabBarBadge({
  926. index: 3,
  927. text: res.data.count + ''
  928. })
  929. } else {
  930. uni.hideTabBarRedDot({
  931. index: 3
  932. })
  933. }
  934. });
  935. },
  936. // 购物车计算
  937. getCartCompute(cartId){
  938. cartCompute(cartId).then(res=>{
  939. this.discountInfo.coupon = res.data.coupon;
  940. this.discountInfo.deduction = res.data.deduction;
  941. }).catch(err=>{
  942. this.$util.Tips({
  943. title: err
  944. })
  945. })
  946. },
  947. getCartList: function() {
  948. let that = this;
  949. if (this.loadend) return false;
  950. if (this.loading) return false;
  951. let data = {
  952. page: that.page,
  953. limit: that.limit,
  954. status: 1,
  955. latitude: uni.getStorageSync('user_latitude'),
  956. longitude: uni.getStorageSync('user_longitude'),
  957. // store_id: uni.getStorageSync('user_store_id')
  958. store_id: 0
  959. }
  960. getCartList(data).then(res => {
  961. this.getInvalidList();
  962. // this.discountInfo.deduction = res.data.deduction;
  963. // this.discountInfo.coupon = res.data.coupon;
  964. this.isTips = false;
  965. let cartList = res.data.valid;
  966. let valid = cartList.map(x =>{
  967. return {
  968. valid : x.cart,
  969. promotions : x.promotions
  970. }
  971. })
  972. let loadend = valid.length < that.limit;
  973. // let validList = that.$util.SplitArray(valid, that.cartList.valid);
  974. let validList = valid;
  975. let numSub = [{
  976. numSub: true
  977. }, {
  978. numSub: false
  979. }];
  980. let numAdd = [{
  981. numAdd: true
  982. }, {
  983. numAdd: false
  984. }],
  985. selectValue = [];
  986. if (validList.length > 0) {
  987. for (let j in validList) {
  988. if(validList[j].promotions.length>1){
  989. that.isTips = true;
  990. }
  991. for (let index in validList[j].valid){
  992. if (validList[j].valid[index].cart_num == 1) {
  993. validList[j].valid[index].numSub = true;
  994. } else {
  995. validList[j].valid[index].numSub = false;
  996. }
  997. let productInfo = validList[j].valid[index].productInfo;
  998. if (productInfo.hasOwnProperty('attrInfo') && validList[j].valid[index].cart_num == validList[j].valid[index].productInfo.attrInfo.stock) {
  999. validList[j].valid[index].numAdd = true;
  1000. } else if (validList[j].valid[index].cart_num == validList[j].valid[index].productInfo.stock) {
  1001. validList[j].valid[index].numAdd = true;
  1002. } else {
  1003. validList[j].valid[index].numAdd = false;
  1004. }
  1005. if(validList[j].valid[index].attrStatus && !validList[j].valid[index].is_gift){
  1006. validList[j].valid[index].checked = true;
  1007. selectValue.push(validList[j].valid[index].id);
  1008. }else if(!this.footerswitch){
  1009. validList[j].valid[index].checked = true;
  1010. }else{
  1011. validList[j].valid[index].checked = false;
  1012. }
  1013. }
  1014. }
  1015. }
  1016. that.$set(that.cartList, 'valid', res.data.valid.length?validList:[]);
  1017. that.loadend = true;
  1018. that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  1019. that.page = that.page + 1;
  1020. that.loading = false;
  1021. // that.goodsHidden = cartList.valid.length <= 0 ? false : true;
  1022. that.selectValue = selectValue;
  1023. let newArr = []
  1024. validList.forEach(j=>{
  1025. j.valid.forEach(item=>{
  1026. if(item.attrStatus && !item.is_gift){
  1027. newArr.push(item)
  1028. }
  1029. })
  1030. })
  1031. that.isAllSelect = newArr.length == selectValue.length && newArr.length;
  1032. that.switchSelect();
  1033. }).catch(function(err) {
  1034. that.loading = false;
  1035. that.loadTitle = '加载失败';
  1036. that.$util.Tips({
  1037. title: err
  1038. })
  1039. })
  1040. },
  1041. getInvalidList: function() {
  1042. let that = this;
  1043. if (this.loadendInvalid) return false;
  1044. if (this.loadingInvalid) return false;
  1045. let data = {
  1046. page: that.pageInvalid,
  1047. limit: that.limitInvalid,
  1048. status: 0,
  1049. store_id: uni.getStorageSync('user_store_id'),
  1050. }
  1051. getCartList(data).then(res => {
  1052. let cartList = res.data,
  1053. invalid = cartList.invalid,
  1054. loadendInvalid = invalid.length < that.limitInvalid;
  1055. // let invalidList = that.$util.SplitArray(invalid, that.cartList.invalid);
  1056. let invalidList = invalid;
  1057. that.$set(that.cartList, 'invalid', invalidList);
  1058. that.loadendInvalid = loadendInvalid;
  1059. that.loadTitleInvalid = loadendInvalid ? '没有更多内容啦~' : '加载更多';
  1060. that.pageInvalid = that.pageInvalid + 1;
  1061. that.loadingInvalid = false;
  1062. }).catch(res => {
  1063. that.loadingInvalid = false;
  1064. that.loadTitleInvalid = '加载更多';
  1065. })
  1066. },
  1067. getHostProduct: function() {
  1068. let that = this;
  1069. if (that.hotScroll) return
  1070. getProductHot(
  1071. that.hotPage,
  1072. that.hotLimit,
  1073. ).then(res => {
  1074. that.hotPage++
  1075. that.hotScroll = res.data.length < that.hotLimit
  1076. that.hostProduct = that.hostProduct.concat(res.data)
  1077. });
  1078. },
  1079. goodsOpen: function() {
  1080. let that = this;
  1081. that.goodsHidden = !that.goodsHidden;
  1082. },
  1083. manage: function() {
  1084. let that = this;
  1085. that.footerswitch = !that.footerswitch;
  1086. let arr1 = [];
  1087. let arr2 = [];
  1088. let len = 0;
  1089. that.cartList.valid.forEach(j=>{
  1090. j.valid.forEach(item=>{
  1091. len = len+1;
  1092. if (that.footerswitch) {
  1093. if (item.attrStatus && !item.is_gift) {
  1094. if (item.checked) {
  1095. arr1.push(item.id);
  1096. }
  1097. } else {
  1098. item.checked = false;
  1099. arr2.push(item);
  1100. }
  1101. } else {
  1102. if (item.checked) {
  1103. arr1.push(item.id);
  1104. }
  1105. }
  1106. })
  1107. })
  1108. if (that.footerswitch) {
  1109. that.isAllSelect = len === arr1.length + arr2.length;
  1110. } else {
  1111. that.isAllSelect = len === arr1.length;
  1112. }
  1113. that.selectValue = arr1;
  1114. if(that.footerswitch){
  1115. that.switchSelect();
  1116. }
  1117. },
  1118. unsetCart: function() {
  1119. let that = this,
  1120. ids = [],
  1121. storeId = uni.getStorageSync('user_store_id');
  1122. for (let i = 0, len = that.cartList.invalid.length; i < len; i++) {
  1123. ids.push(that.cartList.invalid[i].id);
  1124. }
  1125. cartDel(ids,storeId).then(res => {
  1126. that.$util.Tips({
  1127. title: '清除成功'
  1128. });
  1129. that.$set(that.cartList, 'invalid', []);
  1130. that.getCartNum();
  1131. }).catch(res => {
  1132. });
  1133. }
  1134. },
  1135. onReachBottom() {
  1136. let that = this;
  1137. // if (that.loadend) {
  1138. // that.getInvalidList();
  1139. // } else {
  1140. // that.getCartList();
  1141. // }
  1142. if(that.cartList.invalid.length){
  1143. that.getInvalidList();
  1144. }
  1145. if (that.cartList.valid.length == 0 && that.cartList.invalid.length == 0) {
  1146. that.getHostProduct();
  1147. }
  1148. }
  1149. }
  1150. </script>
  1151. <style scoped lang="scss">
  1152. .shoppingCart .labelNav {
  1153. height: 76rpx;
  1154. padding: 0 30rpx;
  1155. font-size: 22rpx;
  1156. color: #8c8c8c;
  1157. position: fixed;
  1158. left: 0;
  1159. width: 100%;
  1160. box-sizing: border-box;
  1161. background-color: #f5f5f5;
  1162. z-index: 5;
  1163. top: 0;
  1164. }
  1165. .shoppingCart .labelNav .item .iconfont {
  1166. font-size: 25rpx;
  1167. margin-right: 10rpx;
  1168. }
  1169. .shoppingCart .nav {
  1170. width: 100%;
  1171. height: 80rpx;
  1172. background-color: #fff;
  1173. padding: 0 30rpx;
  1174. box-sizing: border-box;
  1175. font-size: 28rpx;
  1176. color: #282828;
  1177. position: fixed;
  1178. left: 0;
  1179. z-index: 5;
  1180. top: 76rpx;
  1181. }
  1182. .shoppingCart .nav .num {
  1183. margin-right: 12rpx;
  1184. }
  1185. .shoppingCart .nav .administrate {
  1186. font-size: 26rpx;
  1187. color: #666;
  1188. width: 110rpx;
  1189. height: 46rpx;
  1190. border-radius: 6rpx;
  1191. }
  1192. .shoppingCart .noCart {
  1193. margin-top: 171rpx;
  1194. background-color: #fff;
  1195. padding-top: 0.1rpx;
  1196. }
  1197. .shoppingCart .noCart .pictrue {
  1198. margin: 78rpx auto 56rpx auto;
  1199. text-align: center;
  1200. color: #999;
  1201. }
  1202. .shoppingCart .noCart .pictrue image {
  1203. width: 414rpx;
  1204. height: 304rpx;
  1205. display: block;
  1206. margin: 0 auto;
  1207. }
  1208. .shoppingCart .list {
  1209. margin: 0 20rpx 0 20rpx;
  1210. border-radius: 12rpx;
  1211. background-color: #fff;
  1212. }
  1213. .shoppingCart .list .title{
  1214. height: 74rpx;
  1215. padding: 0 24rpx;
  1216. font-size: 22rpx;
  1217. color: #333;
  1218. border-bottom: 1rpx solid #eee;
  1219. }
  1220. .shoppingCart .list .title .iconfont{
  1221. font-size: 18rpx;
  1222. }
  1223. .shoppingCart .list .title .label{
  1224. border-radius: 4rpx;
  1225. padding: 2rpx 8rpx;
  1226. background-color: var(--view-minorColorT);
  1227. font-size: 20rpx;
  1228. color: var(--view-theme);
  1229. margin-right: 8rpx;
  1230. }
  1231. .shoppingCart .list .item {
  1232. padding: 25rpx 30rpx;
  1233. position: relative;
  1234. }
  1235. .shoppingCart .list .item .evaluate{
  1236. font-size: 20rpx;
  1237. color: var(--view-theme);
  1238. margin-left: 248rpx;
  1239. .num{
  1240. font-size: 25rpx;
  1241. }
  1242. }
  1243. .shoppingCart .list .item::after{
  1244. position: absolute;
  1245. content: " ";
  1246. width: 618rpx;
  1247. height: 1px;
  1248. background: #EEEEEE;
  1249. bottom: 0;
  1250. right: 0;
  1251. }
  1252. .shoppingCart .list .item .picTxt {
  1253. width: 585rpx;
  1254. position: relative;
  1255. }
  1256. .shoppingCart .list .item .picTxt .pictrue {
  1257. width: 160rpx;
  1258. height: 160rpx;
  1259. border-radius: 6rpx;
  1260. }
  1261. .shoppingCart .list .item .picTxt .pictrue image {
  1262. width: 100%;
  1263. height: 100%;
  1264. border-radius: 6rpx;
  1265. }
  1266. .shoppingCart .list .item .picTxt .text {
  1267. width: 400rpx;
  1268. font-size: 28rpx;
  1269. color: #282828;
  1270. }
  1271. .shoppingCart .list .item .picTxt .text .reColor {
  1272. color: #999;
  1273. }
  1274. .shoppingCart .list .item .picTxt .text .reElection {
  1275. margin-top: 20rpx;
  1276. }
  1277. .shoppingCart .list .item .picTxt .text .reElection .titles {
  1278. font-size: 24rpx;
  1279. }
  1280. .shoppingCart .list .item .picTxt .text .reElection .reBnt {
  1281. width: 120rpx;
  1282. height: 46rpx;
  1283. border-radius: 23rpx;
  1284. font-size: 26rpx;
  1285. }
  1286. .shoppingCart .list .item .picTxt .text .infor {
  1287. font-size: 24rpx;
  1288. color: #868686;
  1289. margin-top: 16rpx;
  1290. }
  1291. .shoppingCart .list .item .picTxt .text .infor .name{
  1292. max-width: 320rpx;
  1293. display: inline-block;
  1294. vertical-align: bottom;
  1295. }
  1296. .shoppingCart .list .item .picTxt .text .infor .iconfont{
  1297. font-size: 20rpx;
  1298. display: inline-block;
  1299. padding: 3rpx 40rpx 0 10rpx;
  1300. }
  1301. .shoppingCart .list .item .picTxt .text .isGift{
  1302. margin-top: 16rpx;
  1303. color: var(--view-theme);
  1304. }
  1305. .shoppingCart .list .item .picTxt .text .money {
  1306. font-size: 32rpx;
  1307. color: #282828;
  1308. margin-top: 28rpx;
  1309. }
  1310. .shoppingCart .list .item .picTxt .carnum {
  1311. height: 47rpx;
  1312. position: absolute;
  1313. bottom: 7rpx;
  1314. right: 0;
  1315. }
  1316. .shoppingCart .list .item .picTxt .carnum view {
  1317. border: 1rpx solid #a4a4a4;
  1318. width: 66rpx;
  1319. text-align: center;
  1320. height: 100%;
  1321. line-height: 40rpx;
  1322. font-size: 28rpx;
  1323. color: #a4a4a4;
  1324. }
  1325. .shoppingCart .list .item .picTxt .carnum .reduce {
  1326. border-right: 0;
  1327. border-radius: 22rpx 0 0 22rpx;
  1328. }
  1329. .shoppingCart .list .item .picTxt .carnum .reduce.on {
  1330. border-color: #e3e3e3;
  1331. color: #dedede;
  1332. }
  1333. .shoppingCart .list .item .picTxt .carnum .plus {
  1334. border-left: 0;
  1335. border-radius: 0 22rpx 22rpx 0;
  1336. }
  1337. .shoppingCart .list .item .picTxt .carnum .plus.on{
  1338. border-color: #e3e3e3;
  1339. color: #dedede;
  1340. }
  1341. .shoppingCart .list .item .picTxt .carnum .num {
  1342. color: #282828;
  1343. }
  1344. .shoppingCart .invalidGoods {
  1345. background-color: #fff;
  1346. margin: 12rpx 20rpx 0 20rpx;
  1347. border-radius: 12rpx;
  1348. }
  1349. .shoppingCart .invalidGoods .goodsNav {
  1350. width: 100%;
  1351. height: 66rpx;
  1352. padding: 0 30rpx;
  1353. box-sizing: border-box;
  1354. font-size: 28rpx;
  1355. color: #282828;
  1356. }
  1357. .shoppingCart .invalidGoods .goodsNav .iconfont {
  1358. color: #424242;
  1359. font-size: 28rpx;
  1360. margin-right: 17rpx;
  1361. }
  1362. .shoppingCart .invalidGoods .goodsNav .del {
  1363. font-size: 26rpx;
  1364. color: #999;
  1365. }
  1366. .shoppingCart .invalidGoods .goodsNav .del .icon-shanchu1 {
  1367. color: #999;
  1368. font-size: 33rpx;
  1369. vertical-align: -2rpx;
  1370. margin-right: 8rpx;
  1371. }
  1372. .shoppingCart .invalidGoods .goodsList .item {
  1373. padding: 20rpx 30rpx;
  1374. border-top: 1rpx solid #f5f5f5;
  1375. }
  1376. .shoppingCart .invalidGoods .goodsList .item .invalid {
  1377. font-size: 22rpx;
  1378. color: #fff;
  1379. width: 70rpx;
  1380. height: 36rpx;
  1381. background-color: #aaa;
  1382. border-radius: 3rpx;
  1383. text-align: center;
  1384. line-height: 36rpx;
  1385. }
  1386. .shoppingCart .invalidGoods .goodsList .item .pictrue {
  1387. width: 140rpx;
  1388. height: 140rpx;
  1389. }
  1390. .shoppingCart .invalidGoods .goodsList .item .pictrue image {
  1391. width: 100%;
  1392. height: 100%;
  1393. border-radius: 6rpx;
  1394. }
  1395. .shoppingCart .invalidGoods .goodsList .item .text {
  1396. width: 400rpx;
  1397. font-size: 28rpx;
  1398. color: #ccc;
  1399. height: 140rpx;
  1400. }
  1401. .shoppingCart .invalidGoods .goodsList .item .text .name {
  1402. width: 100%;
  1403. }
  1404. .shoppingCart .invalidGoods .goodsList .item .text .infor {
  1405. font-size: 24rpx;
  1406. width: 100%;
  1407. }
  1408. .shoppingCart .invalidGoods .goodsList .item .text .end {
  1409. font-size: 26rpx;
  1410. color: #999;
  1411. width: 100%;
  1412. }
  1413. .shoppingCart .tips{
  1414. position: fixed;
  1415. z-index:9;
  1416. width: 100%;
  1417. height: 56rpx;
  1418. background: #FEF4E7;
  1419. color: #FE960F;
  1420. font-size: 24rpx;
  1421. padding: 0 20rpx;
  1422. box-sizing: border-box;
  1423. bottom: 192rpx;
  1424. bottom: calc(192rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  1425. bottom: calc(192rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  1426. .iconfont{
  1427. margin-right: 12rpx;
  1428. }
  1429. &.on{
  1430. // #ifndef H5
  1431. bottom: 96rpx;
  1432. // #endif
  1433. }
  1434. }
  1435. .shoppingCart .footer {
  1436. z-index: 999;
  1437. width: 100%;
  1438. height: 96rpx;
  1439. background-color: #fafafa;
  1440. position: fixed;
  1441. padding: 0 30rpx;
  1442. box-sizing: border-box;
  1443. border-top: 1rpx solid #eee;
  1444. // #ifdef H5
  1445. bottom: 94rpx;
  1446. bottom: calc(94rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  1447. bottom: calc(94rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  1448. // #endif
  1449. // #ifndef H5
  1450. bottom: 98rpx;
  1451. bottom: calc(98rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  1452. bottom: calc(98rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  1453. // #endif
  1454. }
  1455. .shoppingCart .footer.on {
  1456. // #ifndef H5
  1457. bottom: 0rpx;
  1458. // #endif
  1459. }
  1460. .shoppingCart .footer .checkAll {
  1461. font-size: 28rpx;
  1462. color: #282828;
  1463. margin-left: 16rpx;
  1464. }
  1465. // .shoppingCart .footer checkbox .wx-checkbox-input{background-color:#fafafa;}
  1466. .shoppingCart .footer .money {
  1467. font-size: 30rpx;
  1468. }
  1469. .shoppingCart .footer .money .left{
  1470. text-align: right;
  1471. font-size: 24rpx;
  1472. }
  1473. .shoppingCart .footer .money .left .font-color{
  1474. font-size: 30rpx;
  1475. font-weight: 600;
  1476. }
  1477. .shoppingCart .footer .money .left .detailed{
  1478. font-size: 22rpx;
  1479. }
  1480. .shoppingCart .footer .money .left .detailed .iconfont{
  1481. font-size: 24rpx;
  1482. margin-left: 8rpx;
  1483. }
  1484. .shoppingCart .footer .placeOrder {
  1485. color: #fff;
  1486. font-size: 30rpx;
  1487. width: 226rpx;
  1488. height: 70rpx;
  1489. border-radius: 50rpx;
  1490. text-align: center;
  1491. line-height: 70rpx;
  1492. margin-left: 22rpx;
  1493. &.on{
  1494. background-color: #ccc!important;
  1495. }
  1496. }
  1497. .shoppingCart .footer .button .bnt {
  1498. font-size: 28rpx;
  1499. color: #999;
  1500. border-radius: 50rpx;
  1501. border: 1px solid #999;
  1502. width: 160rpx;
  1503. height: 60rpx;
  1504. text-align: center;
  1505. line-height: 60rpx;
  1506. }
  1507. .shoppingCart .footer .button form~form {
  1508. margin-left: 17rpx;
  1509. }
  1510. .uni-p-b-96 {
  1511. height: 96rpx;
  1512. }
  1513. </style>