order_addcart.vue 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628
  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="HTTP_REQUEST_URL_IMG+'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. import { HTTP_REQUEST_URL_IMG } from "@/config/app";
  365. const appStore = useAppStore();
  366. const { Toast } = useToast();
  367. const cartCount = ref(0);
  368. const goodsHidden = ref(false);
  369. const footerswitch = ref(true);
  370. const hostProduct = ref([]);
  371. const cartList = reactive({
  372. valid: [],
  373. invalid: [],
  374. });
  375. const isAllSelect = ref(false); //全选
  376. const selectValue = ref([]); //选中的数据
  377. const selectCountPrice = ref(0.0);
  378. const isShowAuth = ref(false); //是否隐藏授权
  379. const hotScroll = ref(false);
  380. const hotPage = ref(1);
  381. const hotLimit = ref(10);
  382. const loading = ref(false);
  383. const loadend = ref(false);
  384. const page = ref(1);
  385. const limit = ref(20);
  386. const loadingInvalid = ref(false);
  387. const loadendInvalid = ref(false);
  388. const loadTitleInvalid = ref("加载更多");
  389. const pageInvalid = ref(1);
  390. const limitInvalid = ref(20);
  391. const attr = reactive({
  392. cartAttr: false,
  393. productAttr: [],
  394. productSelect: {},
  395. });
  396. const productValue = ref([]);
  397. const productInfo = ref({});
  398. const attrValue = ref("");
  399. const attrTxt = ref("请选择");
  400. const cartId = ref(0);
  401. const product_id = ref(0);
  402. const canShow = ref(false);
  403. const shopCheckbox = ref([]);
  404. const showProductPopup = ref(false);
  405. const isLogin = appStore.isLogin;
  406. // 添加全选的值控制
  407. const allCheckboxValue = ref([]);
  408. // 监听isAllSelect的变化,同步到allCheckboxValue
  409. watch(isAllSelect, (newVal) => {
  410. if (newVal) {
  411. allCheckboxValue.value = ['all'];
  412. } else {
  413. allCheckboxValue.value = [];
  414. }
  415. });
  416. onLoad((options) => {
  417. if (!isLogin) {
  418. toLogin();
  419. }
  420. });
  421. onShow(() => {
  422. canShow.value = false;
  423. if (isLogin) {
  424. hotPage.value = 1;
  425. hostProduct.value = [];
  426. hotScroll.value = false;
  427. loadend.value = false;
  428. page.value = 1;
  429. cartList.valid = [];
  430. getCartListFn();
  431. loadendInvalid.value = false;
  432. pageInvalid.value = 1;
  433. cartList.invalid = [];
  434. getInvalidList();
  435. footerswitch.value = true;
  436. hotScroll.value = false;
  437. hotPage.value = 1;
  438. hotLimit.value = 10;
  439. cartList.valid = [];
  440. cartList.invalid = [];
  441. isAllSelect.value = false;
  442. selectValue.value = [];
  443. selectCountPrice.value = 0.0;
  444. cartCount.value = 0;
  445. isShowAuth.value = false;
  446. }
  447. });
  448. onReachBottom(() => {
  449. if (loadend.value) {
  450. getInvalidList();
  451. }
  452. if (
  453. cartList.valid.length == 0 &&
  454. cartList.invalid.length == 0 &&
  455. hotPage.value != 1
  456. ) {
  457. getHostProduct();
  458. }
  459. });
  460. // 计算属性:按商家分组购物车商品
  461. const groupedCartList = computed(() => {
  462. const groups = {};
  463. cartList.valid.forEach(item => {
  464. const merchant = item.sbMerchant;
  465. if (merchant && merchant.id) {
  466. const merchantId = merchant.id;
  467. if (!groups[merchantId]) {
  468. groups[merchantId] = {
  469. id: merchantId,
  470. name: merchant.merchantName || '未知商家',
  471. logo: merchant.merchantLogo || '/static/avator.png',
  472. products: []
  473. };
  474. }
  475. item.editNum = false;
  476. groups[merchantId].products.push(item);
  477. } else {
  478. // 如果没有商家信息,放到默认分组
  479. const defaultId = 'default';
  480. if (!groups[defaultId]) {
  481. groups[defaultId] = {
  482. id: defaultId,
  483. name: '其他商家',
  484. logo: '/static/avator.png',
  485. products: []
  486. };
  487. }
  488. groups[defaultId].products.push(item);
  489. }
  490. });
  491. return Object.values(groups);
  492. });
  493. const orderGoodsCount = computed(() => {
  494. // console.log('fsdfsdfsd', cartList, cartList)
  495. return cartList.valid.length + cartList.invalid.length;
  496. });
  497. // 监听购物车数据变化,重新计算选中状态
  498. watch(() => cartList.valid, (newVal) => {
  499. calculateSelectStatus();
  500. }, { deep: true });
  501. // 重新计算选中状态
  502. function calculateSelectStatus() {
  503. const validList = cartList.valid;
  504. const selectValueArr = selectValue.value;
  505. let checkedCount = 0;
  506. let totalValidCount = 0;
  507. validList.forEach(item => {
  508. if (item.attrStatus) {
  509. totalValidCount++;
  510. if (selectValueArr.includes(item.id)) {
  511. checkedCount++;
  512. }
  513. }
  514. });
  515. isAllSelect.value = totalValidCount > 0 && checkedCount === totalValidCount;
  516. switchSelect();
  517. }
  518. const closeProductPopup = () => {
  519. showProductPopup.value = false;
  520. };
  521. function authColse(e) {
  522. isShowAuth.value = e;
  523. }
  524. async function handleSubmit() {
  525. try {
  526. const productSelect = productValue.value[attrValue.value];
  527. if (attr.productAttr.length && productSelect === undefined)
  528. return Toast({
  529. title: "产品库存不足,请选择其它",
  530. });
  531. const params = {
  532. id: cartId.value,
  533. productId: product_id.value,
  534. num: attr.productSelect.cart_num,
  535. unique:
  536. attr.productSelect !== undefined
  537. ? attr.productSelect.unique
  538. : productInfo.value.id,
  539. };
  540. await getResetCart(params);
  541. attr.cartAttr = false;
  542. Toast({
  543. title: "添加购物车成功",
  544. success: () => {
  545. loadend.value = false;
  546. page.value = 1;
  547. cartList.valid = [];
  548. getCartListFn();
  549. getCartNum();
  550. },
  551. });
  552. } catch (error) {
  553. Toast({
  554. title: error,
  555. });
  556. } finally {
  557. showProductPopup.value = false;
  558. }
  559. }
  560. function onMyEvent() {
  561. attr.cartAttr = false;
  562. }
  563. function reElection(item) {
  564. showProductPopup.value = true;
  565. getGoodsDetails(item);
  566. }
  567. function getGoodsDetails(item) {
  568. console.log("item", item);
  569. uni.showLoading({
  570. title: "加载中",
  571. mask: true,
  572. });
  573. cartId.value = item.id;
  574. product_id.value = item.productId;
  575. getProductDetail(item.productId)
  576. .then((res) => {
  577. uni.hideLoading();
  578. attr.cartAttr = true;
  579. productInfo.value = res.data.productInfo;
  580. attr.productAttr = res.data.productAttr.map((item) => ({
  581. ...item,
  582. attrValues: item.attrValues.split(","),
  583. }));
  584. productValue.value = res.data.productValue;
  585. DefaultSelect();
  586. })
  587. .catch((err) => {
  588. uni.hideLoading();
  589. });
  590. }
  591. function ChangeAttr(res) {
  592. const productSelect = productValue.value[res];
  593. if (productSelect && productSelect.stock > 0) {
  594. attr.productSelect = {
  595. ...attr.productSelect,
  596. image: productSelect.image,
  597. sales: productSelect.sales,
  598. weight: productSelect.weight,
  599. price: productSelect.price,
  600. storePrice: productSelect.storePrice,
  601. stock: productSelect.stock,
  602. unique: productSelect.id,
  603. cart_num: 1,
  604. };
  605. attrValue.value = res;
  606. attrTxt.value = "已选择";
  607. } else {
  608. attr.productSelect = {
  609. ...attr.productSelect,
  610. image: productInfo.value.image,
  611. weight: productSelect.weight,
  612. price: productInfo.value.price,
  613. storePrice: productSelect.storePrice,
  614. stock: 0,
  615. unique: productInfo.value.id,
  616. cart_num: 1,
  617. };
  618. attrValue.value = "";
  619. attrTxt.value = "请选择";
  620. }
  621. }
  622. function DefaultSelect() {
  623. const productAttr = attr.productAttr;
  624. console.log("productValue", productValue);
  625. let value = [];
  626. for (let key in productValue.value) {
  627. if (productValue.value[key].stock > 0) {
  628. value = attr.productAttr.length ? key.split(",") : [];
  629. break;
  630. }
  631. }
  632. for (let i = 0; i < productAttr.length; i++) {
  633. productAttr[i].index = value[i];
  634. }
  635. let productSelect = productValue.value[value.sort().join(",")];
  636. if (productSelect && productAttr.length) {
  637. attr.productSelect.storeName = productInfo.value.storeName;
  638. attr.productSelect.image = productSelect.image;
  639. attr.productSelect.price = productSelect.price;
  640. attr.productSelect.storePrice = productSelect.storePrice;
  641. attr.productSelect.stock = productSelect.stock;
  642. attr.productSelect.unique = productSelect.id;
  643. attr.productSelect.cart_num = 1;
  644. attrValue.value = value.sort().join(",");
  645. attrTxt.value = "已选择";
  646. } else if (!productSelect && productAttr.length) {
  647. attr.productSelect.storeName = productInfo.value.storeName;
  648. attr.productSelect.image = productInfo.value.image;
  649. attr.productSelect.price = productInfo.value.price;
  650. attr.productSelect.storePrice = productSelect.storePrice;
  651. attr.productSelect.stock = 0;
  652. attr.productSelect.unique = productInfo.value.id;
  653. attr.productSelect.cart_num = 0;
  654. attrValue.value = "";
  655. attrTxt.value = "请选择";
  656. } else if (!productSelect && !productAttr.length) {
  657. attr.productSelect.storeName = productInfo.value.storeName;
  658. attr.productSelect.image = productInfo.value.image;
  659. attr.productSelect.price = productInfo.value.price;
  660. attr.productSelect.storePrice = productSelect.storePrice;
  661. attr.productSelect.stock = productInfo.value.stock;
  662. attr.productSelect.unique = productInfo.value.id || "";
  663. attr.productSelect.cart_num = 1;
  664. attrValue.value = "";
  665. attrTxt.value = "请选择";
  666. }
  667. }
  668. function attrVal(val) {
  669. attr.productAttr[val.indexw].index =
  670. attr.productAttr[val.indexw].attrValues[val.indexn];
  671. }
  672. function ChangeCartNum(changeValue) {
  673. let productSelect = productValue.value[attrValue.value];
  674. if (productSelect === undefined && !attr.productAttr.length)
  675. productSelect = attr.productSelect;
  676. if (productSelect === undefined) return;
  677. let stock = productSelect.stock || 0;
  678. let num = attr.productSelect;
  679. if (changeValue) {
  680. num.cart_num++;
  681. if (num.cart_num > stock) {
  682. num.cart_num = stock ? stock : 1;
  683. }
  684. } else {
  685. num.cart_num--;
  686. if (num.cart_num < 1) {
  687. num.cart_num = 1;
  688. }
  689. }
  690. }
  691. function iptCartNum(e) {
  692. attr.productSelect.cart_num = e;
  693. }
  694. function subDel(event) {
  695. const selectValueArr = selectValue.value;
  696. if (selectValueArr.length > 0)
  697. cartDel(selectValueArr).then((res) => {
  698. loadend.value = false;
  699. page.value = 1;
  700. cartList.valid = [];
  701. getCartListFn();
  702. getCartNum();
  703. });
  704. else
  705. return Toast({
  706. title: "请选择产品",
  707. });
  708. }
  709. function getSelectValueProductId() {
  710. const validList = cartList.valid;
  711. const selectValueArr = selectValue.value;
  712. let productId = [];
  713. if (selectValueArr.length > 0) {
  714. for (let index in validList) {
  715. if (inArray(validList[index].id, selectValueArr)) {
  716. productId.push(validList[index].productId);
  717. }
  718. }
  719. }
  720. return productId;
  721. }
  722. function subCollect(event) {
  723. const selectValueArr = selectValue.value;
  724. if (selectValueArr.length > 0) {
  725. const selectValueProductId = getSelectValueProductId();
  726. collectAll(selectValueProductId)
  727. .then((res) => {
  728. return Toast({
  729. title: "收藏成功",
  730. icon: "success",
  731. });
  732. })
  733. .catch((err) => {
  734. return Toast({
  735. title: err,
  736. });
  737. });
  738. } else {
  739. return Toast({
  740. title: "请选择产品",
  741. });
  742. }
  743. }
  744. function subOrder(event) {
  745. if(appStore.userInfo.merchant){
  746. uni.showToast({
  747. title:'商家用户不能下单!',
  748. icon:'none',
  749. })
  750. return ;
  751. }
  752. const selectValueArr = selectValue.value;
  753. if (selectValueArr.length > 0) {
  754. // 检查是否选择了多个商家的商品
  755. if (hasMultipleMerchants()) {
  756. return Toast({
  757. title: "只能结算同一商家的商品",
  758. });
  759. }
  760. getPreOrderFn();
  761. } else {
  762. return Toast({
  763. title: "请选择产品",
  764. });
  765. }
  766. }
  767. // 检查是否选择了多个商家的商品
  768. function hasMultipleMerchants() {
  769. const selectValueArr = selectValue.value;
  770. const validList = cartList.valid;
  771. // 获取选中的商品
  772. const selectedItems = validList.filter(item =>
  773. selectValueArr.includes(item.id) && item.attrStatus
  774. );
  775. // 提取商家ID
  776. const merchantIds = new Set();
  777. selectedItems.forEach(item => {
  778. if (item.sbMerchant && item.sbMerchant.id) {
  779. merchantIds.add(item.sbMerchant.id);
  780. } else {
  781. // 如果没有商家信息,也作为一个独立的商家
  782. merchantIds.add('default');
  783. }
  784. });
  785. return merchantIds.size > 1;
  786. }
  787. function getPreOrderFn() {
  788. const shoppingCartId = selectValue.value.map((item) => {
  789. return {
  790. shoppingCartId: Number(item),
  791. };
  792. });
  793. const params = {
  794. mallType: 0,
  795. preOrderType: "shoppingCart",
  796. orderDetails: shoppingCartId,
  797. };
  798. getPreOrder(params);
  799. }
  800. function checkboxAllChange(value) {
  801. if (value.length > 0) {
  802. // 检查全选是否会选择多个商家
  803. if (footerswitch.value && willSelectMultipleMerchants()) {
  804. Toast({
  805. title: "只能选择同一商家的商品进行结算",
  806. });
  807. // 重置全选状态为未选中
  808. isAllSelect.value = false;
  809. allCheckboxValue.value = [];
  810. // 清空shopCheckbox的值
  811. shopCheckbox.value = [];
  812. setAllSelectValue(0);
  813. return;
  814. }else{
  815. setAllSelectValue(1);
  816. }
  817. } else {
  818. setAllSelectValue(0);
  819. }
  820. }
  821. // 检查全选是否会选择多个商家
  822. function willSelectMultipleMerchants() {
  823. const validList = cartList.valid.filter(item => item.attrStatus);
  824. const merchantIds = new Set();
  825. validList.forEach(item => {
  826. if (item.sbMerchant && item.sbMerchant.id) {
  827. merchantIds.add(item.sbMerchant.id);
  828. } else {
  829. merchantIds.add('default');
  830. }
  831. });
  832. return merchantIds.size > 1;
  833. }
  834. function setAllSelectValue(status) {
  835. const valid = cartList.valid;
  836. let selectValueArr = [];
  837. valid.forEach(item => {
  838. if (status) {
  839. if (footerswitch.value) {
  840. if (item.attrStatus) {
  841. item.checked = true;
  842. selectValueArr.push(item.id);
  843. } else {
  844. item.checked = false;
  845. }
  846. } else {
  847. item.checked = true;
  848. selectValueArr.push(item.id);
  849. }
  850. } else {
  851. item.checked = false;
  852. }
  853. });
  854. cartList.valid = [...valid];
  855. selectValue.value = selectValueArr;
  856. isAllSelect.value = status === 1;
  857. console.log(isAllSelect.value)
  858. switchSelect();
  859. }
  860. function checkboxChange(value) {
  861. const valid = cartList.valid;
  862. let checkedItems = [];
  863. let uncheckedItems = [];
  864. let invalidItems = [];
  865. valid.forEach(item => {
  866. if (value.includes(item.id)) {
  867. if (footerswitch.value) {
  868. if (item.attrStatus) {
  869. item.checked = true;
  870. checkedItems.push(item);
  871. } else {
  872. item.checked = false;
  873. }
  874. } else {
  875. item.checked = true;
  876. checkedItems.push(item);
  877. }
  878. } else {
  879. item.checked = false;
  880. uncheckedItems.push(item);
  881. }
  882. });
  883. if (footerswitch.value) {
  884. invalidItems = uncheckedItems.filter(item => !item.attrStatus);
  885. }
  886. cartList.valid = [...valid];
  887. // isAllSelect.value = valid.length === checkedItems.length + invalidItems.length;
  888. selectValue.value = value;
  889. // 计算全选状态
  890. if (footerswitch.value) {
  891. // 结算模式下,只计算有效商品
  892. const validItems = valid.filter(item => item.attrStatus);
  893. isAllSelect.value = validItems.length > 0 && value.length === validItems.length;
  894. } else {
  895. // 管理模式下,计算所有商品
  896. isAllSelect.value = valid.length > 0 && value.length === valid.length;
  897. }
  898. switchSelect();
  899. }
  900. function inArray(search, array) {
  901. for (let i in array) {
  902. if (array[i] == search) {
  903. return true;
  904. }
  905. }
  906. return false;
  907. }
  908. // 选中商品的价格
  909. function switchSelect() {
  910. const validList = cartList.valid;
  911. const selectValueArr = selectValue.value;
  912. let selectCount = 0.0;
  913. if (selectValueArr.length < 1) {
  914. selectCountPrice.value = selectCount;
  915. } else {
  916. for (let index in validList) {
  917. if (inArray(validList[index].id, selectValueArr)) {
  918. selectCount = util.$h.Add(
  919. selectCount,
  920. util.$h.Mul(validList[index].cartNum, validList[index].storePrice)
  921. );
  922. }
  923. }
  924. selectCountPrice.value = selectCount;
  925. }
  926. }
  927. function iptCartNumInput(index) {
  928. const item = cartList.valid[index];
  929. if (item.cartNum) {
  930. setCartNum(item.id, item.cartNum);
  931. }
  932. switchSelect();
  933. }
  934. function blurInput(index) {
  935. const item = cartList.valid[index];
  936. if (!item.cartNum) {
  937. item.cartNum = 1;
  938. }
  939. }
  940. function subCart(index) {
  941. let status = false;
  942. const item = cartList.valid[index];
  943. item.cartNum = Number(item.cartNum) - 1;
  944. if (item.cartNum < 1) status = true;
  945. if (item.cartNum <= 1) {
  946. item.cartNum = 1;
  947. item.numSub = true;
  948. } else {
  949. item.numSub = false;
  950. item.numAdd = false;
  951. }
  952. if (false == status) {
  953. setCartNum(item.id, item.cartNum, function (data) {
  954. cartList.valid[index] = item;
  955. switchSelect();
  956. getCartNum();
  957. });
  958. }
  959. }
  960. function addCart(index) {
  961. const item = cartList.valid[index];
  962. item.cartNum = Number(item.cartNum) + 1;
  963. if (item.cartNum >= item.stock) {
  964. item.cartNum = item.stock;
  965. item.numAdd = true;
  966. item.numSub = false;
  967. } else {
  968. item.numAdd = false;
  969. item.numSub = false;
  970. }
  971. setCartNum(item.id, item.cartNum, function (data) {
  972. cartList.valid[index] = item;
  973. switchSelect();
  974. getCartNum();
  975. });
  976. }
  977. function setCartNum(cartIdVal, cartNum, successCallback) {
  978. changeCartNum(cartIdVal, cartNum).then((res) => {
  979. successCallback && successCallback(res.data);
  980. });
  981. }
  982. function getCartNum() {
  983. getCartCounts(true, "sum").then((res) => {
  984. cartCount.value = res.data.count;
  985. });
  986. }
  987. function getCartData(data) {
  988. return new Promise((resolve, reject) => {
  989. getCartList(data)
  990. .then((res) => {
  991. resolve(res.data);
  992. })
  993. .catch(function (err) {
  994. loading.value = false;
  995. canShow.value = true;
  996. Toast({
  997. title: err,
  998. });
  999. });
  1000. });
  1001. }
  1002. async function getCartListFn() {
  1003. uni.showLoading({
  1004. title: "加载中",
  1005. mask: true,
  1006. });
  1007. let data = {
  1008. page: page.value,
  1009. limit: limit.value,
  1010. isValid: true,
  1011. };
  1012. getCartCounts(true, "sum").then(async (c) => {
  1013. // 获取购物车商品数量
  1014. cartCount.value = c.data.count;
  1015. // 当没有商品时,获取推荐商品
  1016. if (c.data.count === 0) getHostProduct();
  1017. for (let i = 0; i < Math.ceil(cartCount.value / limit.value); i++) {
  1018. let cartListData = await getCartData(data);
  1019. let valid = cartListData.list;
  1020. let validList = [...cartList.valid, ...valid];
  1021. let selectValueArr = [];
  1022. if (validList.length > 0) {
  1023. for (let index in validList) {
  1024. // 购物车加减状态
  1025. if (validList[index].cartNum == 1) {
  1026. validList[index].numSub = true;
  1027. } else {
  1028. validList[index].numSub = false;
  1029. }
  1030. // 库存
  1031. let stock = validList[index].stock ? validList[index].stock : 0;
  1032. // 当购物车数量大于库存时,设置购物车数量为库存
  1033. if (validList[index].cartNum == stock) {
  1034. validList[index].numAdd = true;
  1035. } else if (validList[index].cartNum == validList[index].stock) {
  1036. validList[index].numAdd = true;
  1037. } else {
  1038. validList[index].numAdd = false;
  1039. }
  1040. // attrStatus 判断商品是否有效
  1041. if (validList[index].attrStatus) {
  1042. // validList[index].checked = true;
  1043. // selectValueArr.push(validList[index].id);
  1044. validList[index].checked = false;
  1045. } else {
  1046. validList[index].checked = false;
  1047. }
  1048. }
  1049. }
  1050. cartList.valid = validList;
  1051. data.page += 1;
  1052. selectValue.value = selectValueArr;
  1053. let newArr = validList.filter((item) => item.attrStatus);
  1054. // 全选状态
  1055. // isAllSelect.value =
  1056. // newArr.length == selectValueArr.length && newArr.length;
  1057. isAllSelect.value = false;
  1058. switchSelect();
  1059. }
  1060. loading.value = false;
  1061. canShow.value = true;
  1062. uni.hideLoading();
  1063. });
  1064. }
  1065. function getInvalidList() {
  1066. if (loadendInvalid.value) return false;
  1067. if (loadingInvalid.value) return false;
  1068. let data = {
  1069. page: pageInvalid.value,
  1070. limit: limitInvalid.value,
  1071. isValid: false,
  1072. };
  1073. getCartList(data)
  1074. .then((res) => {
  1075. let invalid = res.data.list,
  1076. loadendInvalidFlag = invalid.length < limitInvalid.value;
  1077. cartList.invalid = [...invalid, ...cartList.invalid];
  1078. loadendInvalid.value = loadendInvalidFlag;
  1079. loadTitleInvalid.value = loadendInvalidFlag
  1080. ? "我也是有底线的"
  1081. : "加载更多";
  1082. pageInvalid.value = pageInvalid.value + 1;
  1083. loadingInvalid.value = false;
  1084. })
  1085. .catch((res) => {
  1086. loadingInvalid.value = false;
  1087. loadTitleInvalid.value = "加载更多";
  1088. });
  1089. }
  1090. function getHostProduct() {
  1091. if (hotScroll.value) return;
  1092. getProductHot(hotPage.value, hotLimit.value).then((res) => {
  1093. hotPage.value++;
  1094. hotScroll.value = res.data.list.length < hotLimit.value;
  1095. hostProduct.value = hostProduct.value.concat(res.data.list);
  1096. });
  1097. }
  1098. function goodsOpen() {
  1099. goodsHidden.value = !goodsHidden.value;
  1100. }
  1101. function manage() {
  1102. footerswitch.value = !footerswitch.value;
  1103. let arr1 = [];
  1104. let arr2 = [];
  1105. let newValid = cartList.valid.map((item) => {
  1106. if (footerswitch.value) {
  1107. if (item.attrStatus) {
  1108. if (item.checked) {
  1109. arr1.push(item.id);
  1110. }
  1111. } else {
  1112. item.checked = false;
  1113. arr2.push(item);
  1114. }
  1115. } else {
  1116. if (item.checked) {
  1117. arr1.push(item.id);
  1118. }
  1119. }
  1120. return item;
  1121. });
  1122. cartList.valid = newValid;
  1123. if (footerswitch.value) {
  1124. isAllSelect.value = newValid.length === arr1.length + arr2.length;
  1125. } else {
  1126. isAllSelect.value = newValid.length === arr1.length;
  1127. }
  1128. selectValue.value = arr1;
  1129. switchSelect();
  1130. }
  1131. function unsetCart() {
  1132. let ids = [];
  1133. for (let i = 0, len = cartList.invalid.length; i < len; i++) {
  1134. ids.push(cartList.invalid[i].id);
  1135. }
  1136. cartDel(ids)
  1137. .then((res) => {
  1138. Toast({
  1139. title: "清除成功",
  1140. });
  1141. cartList.invalid = [];
  1142. getHostProduct();
  1143. })
  1144. .catch((res) => {});
  1145. }
  1146. const toMerchant = (obj) => {
  1147. uni.navigateTo({ url:"/pages/merchant/index?merchantId="+obj.id });
  1148. }
  1149. </script>
  1150. <style scoped lang="scss">
  1151. .cartBox {
  1152. margin-top: 20rpx;
  1153. }
  1154. .shoppingCart {
  1155. // .labelNav
  1156. .labelNav {
  1157. position: sticky;
  1158. height: 178rpx;
  1159. padding: 30rpx 30rpx 0 30rpx;
  1160. font-size: 22rpx;
  1161. color: #fff;
  1162. position: fixed;
  1163. left: 0;
  1164. width: 100%;
  1165. box-sizing: border-box;
  1166. background-color: $theme-color;
  1167. z-index: 5;
  1168. top: 0;
  1169. height: calc(178rpx + 44px + 45rpx);
  1170. padding-top: calc(44px + 50rpx);
  1171. .item {
  1172. .iconfont {
  1173. font-size: 25rpx;
  1174. margin-right: 10rpx;
  1175. }
  1176. }
  1177. }
  1178. // .nav
  1179. .nav {
  1180. height: 90rpx;
  1181. background-color: #fff;
  1182. padding: 0 24rpx;
  1183. box-sizing: border-box;
  1184. font-size: 28rpx;
  1185. color: #282828;
  1186. border-top-left-radius: 14rpx;
  1187. border-top-right-radius: 14rpx;
  1188. .num {
  1189. margin-left: 12rpx;
  1190. }
  1191. .administrate {
  1192. font-size: 28rpx;
  1193. color: #333;
  1194. }
  1195. }
  1196. // .noCart
  1197. .noCart {
  1198. background-color: #fff;
  1199. padding-top: 0.1rpx;
  1200. .pictrue {
  1201. width: 414rpx;
  1202. height: 336rpx;
  1203. margin: 78rpx auto 56rpx auto;
  1204. image {
  1205. width: 100%;
  1206. height: 100%;
  1207. }
  1208. }
  1209. }
  1210. // .list
  1211. .list {
  1212. width: 100%;
  1213. overflow: hidden;
  1214. border-bottom-left-radius: 14rpx;
  1215. border-bottom-right-radius: 14rpx;
  1216. .item {
  1217. width: 100%;
  1218. padding: 24rpx;
  1219. background-color: #fff;
  1220. display: flex;
  1221. .picTxt {
  1222. flex: 1;
  1223. position: relative;
  1224. display: flex;
  1225. align-items: center;
  1226. .pictrue {
  1227. width: 160rpx;
  1228. height: 160rpx;
  1229. margin-right: 15rpx;
  1230. image {
  1231. width: 100%;
  1232. height: 100%;
  1233. border-radius: 6rpx;
  1234. }
  1235. }
  1236. .item-info,
  1237. .text {
  1238. width: 402rpx;
  1239. font-size: 28rpx;
  1240. color: #282828;
  1241. .storeName{
  1242. width: 40%;
  1243. }
  1244. .reColor {
  1245. color: #999;
  1246. }
  1247. .reElection {
  1248. margin-top: 20rpx;
  1249. .title {
  1250. font-size: 24rpx;
  1251. }
  1252. .reBnt {
  1253. width: 120rpx;
  1254. height: 46rpx;
  1255. border-radius: 23rpx;
  1256. font-size: 26rpx;
  1257. }
  1258. }
  1259. .attribute-box {
  1260. display: flex;
  1261. justify-content: space-between;
  1262. .attribute-suk {
  1263. }
  1264. .invalid-count {
  1265. text-align: right;
  1266. }
  1267. }
  1268. .infor {
  1269. font-size: 24rpx;
  1270. color: #999;
  1271. //margin-top: 10rpx;
  1272. }
  1273. .labor-costs {
  1274. font-size: 24rpx;
  1275. color: #FD5F3C;
  1276. margin-top: 10rpx;
  1277. .tag{
  1278. padding: 10rpx 16rpx;
  1279. background-color: #FFEFEC;
  1280. border-radius: 8rpx;
  1281. display: inline-block;
  1282. }
  1283. }
  1284. .money {
  1285. font-size: 32rpx;
  1286. color: #e93323;
  1287. margin-top: 20rpx;
  1288. font-weight: 600;
  1289. }
  1290. }
  1291. .carnum {
  1292. height: 47rpx;
  1293. //position: absolute;
  1294. //bottom: 7rpx;
  1295. //right: 0;
  1296. view {
  1297. border: 1rpx solid #a4a4a4;
  1298. width: 66rpx;
  1299. text-align: center;
  1300. height: 100%;
  1301. line-height: 44rpx;
  1302. font-size: 28rpx;
  1303. color: #a4a4a4;
  1304. }
  1305. .reduce {
  1306. border-right: 0;
  1307. border-radius: 22rpx 0 0 22rpx;
  1308. font-size: 34rpx;
  1309. line-height: 40rpx;
  1310. &.on {
  1311. border-color: #e3e3e3;
  1312. color: #dedede;
  1313. }
  1314. }
  1315. .plus {
  1316. border-left: 0;
  1317. border-radius: 0 22rpx 22rpx 0;
  1318. font-size: 34rpx;
  1319. line-height: 40rpx;
  1320. }
  1321. .num {
  1322. color: #282828;
  1323. }
  1324. }
  1325. }
  1326. }
  1327. }
  1328. // .invalidGoods
  1329. .invalidGoods {
  1330. background-color: #fff;
  1331. margin-top: 30rpx;
  1332. .goodsNav {
  1333. width: 100%;
  1334. height: 90rpx;
  1335. padding: 0 24rpx;
  1336. box-sizing: border-box;
  1337. font-size: 28rpx;
  1338. color: #333;
  1339. .iconfont {
  1340. color: #424242;
  1341. font-size: 28rpx;
  1342. margin-right: 17rpx;
  1343. }
  1344. .del {
  1345. font-size: 26rpx;
  1346. color: #333;
  1347. .icon-shanchu1 {
  1348. color: #333;
  1349. font-size: 33rpx;
  1350. vertical-align: -2rpx;
  1351. margin-right: 8rpx;
  1352. }
  1353. }
  1354. }
  1355. .goodsList {
  1356. .item {
  1357. padding: 24rpx;
  1358. .invalid {
  1359. font-size: 22rpx;
  1360. color: #ccc;
  1361. height: 36rpx;
  1362. border-radius: 3rpx;
  1363. text-align: center;
  1364. line-height: 36rpx;
  1365. }
  1366. .picTxt {
  1367. width: 576rpx;
  1368. .pictrue {
  1369. width: 160rpx;
  1370. height: 160rpx;
  1371. image {
  1372. width: 100%;
  1373. height: 100%;
  1374. border-radius: 6rpx;
  1375. }
  1376. }
  1377. .text {
  1378. width: 396rpx;
  1379. font-size: 28rpx;
  1380. color: #999;
  1381. height: 140rpx;
  1382. .name {
  1383. width: 100%;
  1384. }
  1385. .infor {
  1386. font-size: 24rpx;
  1387. }
  1388. .end {
  1389. font-size: 26rpx;
  1390. color: #bbb;
  1391. }
  1392. }
  1393. }
  1394. }
  1395. }
  1396. }
  1397. }
  1398. // footer
  1399. .footer {
  1400. z-index: 9;
  1401. width: 100%;
  1402. height: 132rpx;
  1403. background-color: #fff;
  1404. position: fixed;
  1405. padding: 0 24rpx;
  1406. box-sizing: border-box;
  1407. border-top: 1rpx solid #eee;
  1408. bottom: 0;
  1409. .checkAll {
  1410. font-size: 28rpx;
  1411. line-height: 56rpx;
  1412. color: #333333;
  1413. margin-left: 14rpx;
  1414. }
  1415. .money {
  1416. font-size: 30rpx;
  1417. .font-color {
  1418. font-weight: 600;
  1419. }
  1420. }
  1421. .placeOrder {
  1422. color: #333;
  1423. font-size: 32rpx;
  1424. width: 192rpx;
  1425. height: 88rpx;
  1426. border-radius: 16rpx;
  1427. text-align: center;
  1428. line-height: 88rpx;
  1429. margin-left: 22rpx;
  1430. }
  1431. .button {
  1432. .bnt {
  1433. font-size: 28rpx;
  1434. color: #999;
  1435. border-radius: 50rpx;
  1436. border: 1px solid #999;
  1437. width: 160rpx;
  1438. height: 60rpx;
  1439. text-align: center;
  1440. line-height: 60rpx;
  1441. }
  1442. form ~ form {
  1443. margin-left: 17rpx;
  1444. }
  1445. }
  1446. }
  1447. // 其它样式
  1448. .invalidClas {
  1449. position: relative;
  1450. z-index: 111;
  1451. top: -120rpx;
  1452. }
  1453. .invalidClasNO {
  1454. position: static;
  1455. margin-top: 15px;
  1456. }
  1457. .uni-p-b-96 {
  1458. height: 96rpx;
  1459. }
  1460. .merchant-groups {
  1461. margin-bottom: 20rpx;
  1462. }
  1463. .merchant-group {
  1464. background: #fff;
  1465. border-radius: 16rpx;
  1466. margin-bottom: 20rpx;
  1467. overflow: hidden;
  1468. .merchant-header {
  1469. padding: 24rpx;
  1470. .merchant-info {
  1471. .merchant-logo {
  1472. width: 40rpx;
  1473. height: 40rpx;
  1474. border-radius: 50%;
  1475. margin-right: 20rpx;
  1476. }
  1477. .merchant-name {
  1478. font-size: 24rpx;
  1479. color: #333;
  1480. }
  1481. }
  1482. .merchant-action {
  1483. display: flex;
  1484. align-items: center;
  1485. color: #999;
  1486. font-size: 24rpx;
  1487. text {
  1488. margin-right: 8rpx;
  1489. }
  1490. }
  1491. }
  1492. .merchant-products {
  1493. padding: 0 24rpx;
  1494. }
  1495. }
  1496. // 调整商品项样式以适应分组布局
  1497. .item {
  1498. padding: 24rpx 0;
  1499. border-bottom: 1rpx solid #f5f5f5;
  1500. &:last-child {
  1501. border-bottom: none;
  1502. }
  1503. }
  1504. // 其他原有样式保持不变
  1505. .cartBox {
  1506. margin-top: 20rpx;
  1507. }
  1508. .namAndNum{
  1509. display: flex;
  1510. align-items: center;
  1511. justify-content: space-between;
  1512. }
  1513. .carnumTag{
  1514. font-size: 24rpx;
  1515. color: #666666;
  1516. background: #F1F3F8;
  1517. border-radius: 8rpx;
  1518. padding: 10rpx 16rpx;
  1519. }
  1520. </style>