order_addcart.vue 45 KB

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