order_addcart.vue 44 KB

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