shopDetail.vue 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560
  1. <template>
  2. <view class="orderFood">
  3. <view class="shop-info">
  4. <view class="shop-name">
  5. {{shopInfo.shopName}}
  6. </view>
  7. <view class="address">
  8. {{shopInfo.address}}
  9. </view>
  10. </view>
  11. <view class="content">
  12. <scroll-view :scroll-y="true" class="left" :scroll-into-view="scrollTo1" scroll-with-animation>
  13. <!-- <view class="left"> -->
  14. <view class="item" :class="[active == index?'active':'']" v-for="(item,index) in list" :id="'tab'+index" :key="index" @click="handleTab(index)">
  15. <image class="icon" :src="item.imageCnUrl" mode=""></image>
  16. <view class="name">
  17. {{item.topName}}
  18. </view>
  19. </view>
  20. <!-- </view> -->
  21. </scroll-view>
  22. <scroll-view :scroll-y="true" class="right" :scroll-into-view="scrollTo" scroll-with-animation @scroll="scroll">
  23. <!-- <view class="test">
  24. </view> -->
  25. <!-- <view class="right"> -->
  26. <view class="section" v-for="(item,index) in list" :key="index">
  27. <view class="section-name" :class="'title'+index" :id="'title'+index" >
  28. {{item.topName}}
  29. </view>
  30. <!-- <zs-title :title="item.topName" :value="index" :class="'title'+index" :id="'title'+index" @changeTag="chooseTag"></zs-title> -->
  31. <view class="item" v-for="(i,d) in item.menuVoList" :key="d" >
  32. <image class="img" :src="i.imageUrl" mode=""></image>
  33. <view class="info">
  34. <view class="title">
  35. {{i.nameCn}}
  36. </view>
  37. <view class="btn-box">
  38. <view class="price-box">
  39. <view class="price">
  40. <view class="unit">
  41. </view>
  42. <view class="num">
  43. {{i.priceHead}}
  44. </view>
  45. </view>
  46. <view class="old-price">
  47. ¥{{i.price}}
  48. </view>
  49. </view>
  50. <image class="btn" @click.stop="add(i,1,item)" src="../static/add-active.png" mode=""></image>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <!-- </view> -->
  56. </scroll-view>
  57. </view>
  58. <view class="total-box">
  59. <view class="price-box" @click="handleCar">
  60. <view class="car-box">
  61. <image class="icon" src="../static/shop-car.png" mode=""></image>
  62. <view class="num" v-if="totalNum">
  63. {{totalNum}}
  64. </view>
  65. </view>
  66. <view class="price">
  67. <view class="unit">
  68. </view>
  69. <view class="num">
  70. {{total}}
  71. </view>
  72. </view>
  73. </view>
  74. <button class="buy" :class="[!carList.length?'disabled':'']" :disabled="!carList.length" type="default" @click="buy">{{carList.length?'选好了':'未选择商品'}}</button>
  75. </view>
  76. <!-- 购物车 -->
  77. <u-popup :show="show" round="32rpx" mode="bottom" @close="close('show')">
  78. <view class="popup-title-box" >
  79. <view class="title">
  80. 已选商品
  81. </view>
  82. <view class="clear" v-if="carList.length" @click="clear">
  83. 清空
  84. </view>
  85. </view>
  86. <u-empty
  87. mode="car"
  88. icon="http://cdn.uviewui.com/uview/empty/car.png"
  89. v-if="!carList.length"
  90. >
  91. </u-empty>
  92. <view class="car-content" v-else>
  93. <view class="item" v-for="(item,index) in carList" :key="index">
  94. <image class="img" :src="item.imageUrl" mode=""></image>
  95. <view class="info">
  96. <view class="title">
  97. {{item.nameCn}}
  98. </view>
  99. <view class="type" v-if="item.config">
  100. {{item.config}}
  101. </view>
  102. <view class="btn-box">
  103. <view class="price-box">
  104. <view class="price">
  105. <view class="unit">
  106. </view>
  107. <view class="num">
  108. {{item.sellPrice}}
  109. </view>
  110. </view>
  111. <view class="old-price">
  112. ¥{{item.orgPrice}}
  113. </view>
  114. </view>
  115. <view class="count-box">
  116. <image class="btn" src="../static/remove.png" v-if="item.quantity" @click="add(item,-1,{},index)" mode=""></image>
  117. <view class="num">
  118. {{item.quantity}}
  119. </view>
  120. <image class="btn" src="../static/add-active.png" @click="add(item,1,{},index)" mode=""></image>
  121. </view>
  122. </view>
  123. </view>
  124. </view>
  125. </view>
  126. <view class="total-box total-box1">
  127. <view class="price-box" @click="handleCar">
  128. <view class="car-box">
  129. <image class="icon" src="../static/shop-car.png" mode=""></image>
  130. <view class="num" v-if="totalNum">
  131. {{totalNum}}
  132. </view>
  133. </view>
  134. <view class="price">
  135. <view class="unit">
  136. </view>
  137. <view class="num">
  138. {{total}}
  139. </view>
  140. </view>
  141. </view>
  142. <button class="buy" :class="[!carList.length?'disabled':'']" :disabled="!carList.length" type="default" @click="buy">{{carList.length?'选好了':'未选择商品'}}</button>
  143. </view>
  144. </u-popup>
  145. <!-- 商品详情 -->
  146. <u-popup :show="show2" round="32rpx" mode="bottom" @close="close('show2')">
  147. <view class="popup-goodsDetail">
  148. <view class="box">
  149. <image class="img" :src="goodsInfo.product_img" mode="aspectFit"></image>
  150. <view class="popup-content">
  151. <view class="title">
  152. {{goodsInfo.product_name}}
  153. </view>
  154. <view class="desc" v-html="goodsInfo.product_description" v-if="goodsInfo.product_description">
  155. {{goodsInfo.product_description}}
  156. </view>
  157. <view class="choose-box" v-if="goodsInfo.details&&ot == 'NXDC'">
  158. <view class="choose-item" v-for="item in goodsInfo.details.spu_specs" :key="item.code">
  159. <view class="choose-title">
  160. {{item.name}}
  161. </view>
  162. <view class="item-box">
  163. <view class="item" :class="[i.code == chooseInfo[item.code].code?'active':'',isDisable(i,'NXDC',item)?'disable':'']" v-for="i in item.values" :key="i.code" @click="choose(i,item.code)">
  164. {{i.name}} {{i.price?`¥${i.price}`:''}}
  165. </view>
  166. </view>
  167. </view>
  168. </view>
  169. <view class="choose-box" v-else-if="ot == 'MDL'">
  170. <view class="choose-item" v-for="item in goodsInfo.details.optional" :key="item.code">
  171. <view class="choose-title">
  172. {{item.name}}
  173. </view>
  174. <view class="item-box">
  175. <view class="item" :class="[i.id == chooseInfo[item.name+'-'+item.id].id?'active':'',i.disable?'disable':'']" v-for="i in item.sku_infos" :key="i.id" @click="()=>choose(i,item.name+'-'+item.id)">
  176. {{i.name}} {{i.price?`¥${i.price}`:''}}
  177. </view>
  178. </view>
  179. </view>
  180. <view class="choose-item" >
  181. <view class="choose-title">
  182. 套餐内容
  183. </view>
  184. <view class="item-box">
  185. <view class="item active" v-for="i in goodsInfo.details.required" :key="i.id">
  186. {{i.product_name}}x{{i.amount}}
  187. </view>
  188. </view>
  189. </view>
  190. </view>
  191. <view class="choose-box" v-else-if="ot == 'XBK'">
  192. <view class="choose-item" v-for="item in goodsInfo.details.optional" :key="item.code">
  193. <view class="choose-title">
  194. {{item.name}}
  195. </view>
  196. <view class="item-box">
  197. <view class="item" :class="[i.id == chooseInfo[item.id].id?'active':'',i.disable?'disable':'']" v-for="i in item.sku_infos" :key="i.id" @click="()=>choose(i,item.id)">
  198. {{i.name}} {{i.price?`¥${i.price}`:''}}
  199. </view>
  200. </view>
  201. </view>
  202. </view>
  203. <view class="choose-box" v-else-if="goodsInfo.details&&goodsInfo.details.specifications&&ot == 'XC'">
  204. <view class="choose-item" v-for="item in goodsInfo.details.specifications" :key="item.id">
  205. <view class="choose-title">
  206. {{item.name}}
  207. </view>
  208. <view class="item-box">
  209. <!-- ,isDisable(i.id,'XC')?'disable':'' -->
  210. <view class="item " :class="[i.id == chooseInfo[item.id].id?'active':'',isDisable(i.id,'XC')?'disable':'']" v-for="i in item.values" :key="i.id" @click="choose(i,item.id,item)">
  211. {{i.name}} {{i.price?`¥${i.price}`:''}}
  212. </view>
  213. </view>
  214. </view>
  215. </view>
  216. <view class="choose-box" v-else-if="ot == 'RXKF'">
  217. <view class="choose-item" v-for="item in goodsInfo.details.specifications" :key="item.code">
  218. <view class="choose-title">
  219. {{item.name}}
  220. </view>
  221. <view class="item-box">
  222. <view class="item" :class="[i.name == chooseInfo[item.name].name?'active':'']" v-for="(i,d) in item.ingredients" :key="d" @click="()=>choose(i,item.name,item)">
  223. {{i.name}} {{i.price?`¥${i.price}`:''}}
  224. </view>
  225. </view>
  226. </view>
  227. </view>
  228. <view class="choose-box" v-else-if="ot == 'KD'">
  229. <view class="choose-item" v-for="item in goodsInfo.specItems" :key="item.specItemNo">
  230. <view class="choose-title">
  231. {{item.specItemName}}
  232. </view>
  233. <view class="item-box">
  234. <view class="item" :class="[i.name == chooseInfo[item.specItemNo].specItemValueName?'active':'',isDisable(i,'KD')?'disable':'']" v-for="(i,d) in item.specValueList" :key="d" @click="()=>choose(i,item.specItemNo,item)">
  235. {{i.name}}
  236. </view>
  237. </view>
  238. </view>
  239. </view>
  240. </view>
  241. </view>
  242. <view class="btn-box">
  243. <view class="order-info">
  244. <view class="left">
  245. <view class="price-box">
  246. <view class="price">
  247. ¥{{(itemPrice.price*10000)*num/10000}}
  248. </view>
  249. <view class="old-price">
  250. ¥{{ (itemPrice.oldPrice*10000)*num/10000}}
  251. </view>
  252. </view>
  253. <view class="choose">
  254. {{config}}
  255. </view>
  256. </view>
  257. <view class="count-box">
  258. <image class="btn1" src="../static/remove.png" v-if="num" @click="add1(-1)" mode=""></image>
  259. <view class="num">
  260. {{num}}
  261. </view>
  262. <image class="btn1" src="../static/add-active.png" @click="add1(1)" mode=""></image>
  263. </view>
  264. </view>
  265. <button class="btn" type="default" @click="handleAdd">加入购物车</button>
  266. </view>
  267. </view>
  268. </u-popup>
  269. <u-modal :show="show1" :title="shopInfo.shopName" confirmColor="#FF4D3A" confirmText="更换门店" @confirm="confirm">
  270. <view class="modal-box">
  271. <view class="shopName">
  272. 店铺暂未营业或已暂停营业
  273. </view>
  274. <view class="notice">
  275. 请尝试更换门店~
  276. </view>
  277. </view>
  278. </u-modal>
  279. <u-modal :show="show3" title="提示" confirmColor="#FF4D3A" confirmText="更换门店" @confirm="goShopList">
  280. <view class="modal-box">
  281. <view class="notice">
  282. 当前门店暂时无商品上架,您可以切换至其他门店进行购买。
  283. </view>
  284. </view>
  285. </u-modal>
  286. </view>
  287. </template>
  288. <script>
  289. import {shopDetail,menuList,foodGoodsDetail} from '@/api/orderFood.js'
  290. export default {
  291. data() {
  292. return {
  293. shopId:"63836999-5117-4980-8632-497f007808ef",
  294. show:false,
  295. show1:false,
  296. show2:false,
  297. show3:false,
  298. active:0,
  299. list:[],
  300. shopInfo:{
  301. shopName:'',
  302. address:'',
  303. },
  304. carList:[],
  305. scrollTo:'title0',
  306. scrollTo1:'',
  307. topList:[],
  308. offsetTop:0,//顶部距离
  309. cateName:'',//跳转过来携带的分类名称
  310. ot:uni.getStorageSync('ot'),
  311. goodsInfo:{},
  312. num:1,
  313. chooseInfo:{},
  314. item:{},//弹窗内商品信息
  315. productId:'',
  316. itemPrice:{//弹窗内商品价格
  317. price:0,
  318. oldPrice:0
  319. },
  320. test:false
  321. };
  322. },
  323. computed: {
  324. totalNum(){
  325. let total = 0
  326. this.carList.map(item=>{
  327. total+=item.quantity
  328. })
  329. return total
  330. },
  331. total() {
  332. let total = 0
  333. this.carList.map(item=>{
  334. total+=(item.sellPrice*10000*item.quantity)
  335. })
  336. return total/10000
  337. },
  338. // 选择的规格文字 同时计算当前选择的价格
  339. config(){
  340. console.log('config');
  341. let str = ''
  342. for (let key in this.chooseInfo) {
  343. if(this.ot == 'KD'){
  344. str +=this.chooseInfo[key].specItemValueName +'/'
  345. }else{
  346. str +=this.chooseInfo[key].name +'/'
  347. }
  348. }
  349. if(this.goodsInfo.details&&this.goodsInfo.details.sku_infos&&this.ot=='NXDC'){
  350. let {productId,price,oldPrice} = this.findData()
  351. this.productId = productId
  352. this.itemPrice = {
  353. price,
  354. oldPrice
  355. }
  356. }else if(this.ot=='XC'&&this.goodsInfo.details&&this.goodsInfo.details.specifications){
  357. let addPrice = 0
  358. for (let key in this.chooseInfo) {
  359. addPrice += this.chooseInfo[key].price
  360. }
  361. this.itemPrice = {
  362. price:this.item.priceHead+addPrice,
  363. oldPrice:this.item.price+addPrice
  364. }
  365. }else if(this.ot == 'MDL'){
  366. this.itemPrice = {
  367. price:this.item.priceHead,
  368. oldPrice:this.item.price
  369. }
  370. }else if(this.ot == 'XBK'){
  371. let addPrice = 0
  372. for (let key in this.chooseInfo) {
  373. addPrice += this.chooseInfo[key].price
  374. }
  375. this.itemPrice = {
  376. price:this.item.priceHead+addPrice,
  377. oldPrice:this.item.price+addPrice
  378. }
  379. }else if(this.goodsInfo.details&&this.goodsInfo.details.sku_infos&&this.ot == 'RXKF'){
  380. let {productId,price,oldPrice} = this.findData1()
  381. this.productId = productId
  382. this.itemPrice = {
  383. price,
  384. oldPrice
  385. }
  386. }else if(this.goodsInfo.skuCombinList&&this.ot == 'KD'){
  387. this.productId = this.findData2()
  388. this.itemPrice = {
  389. price:this.item.priceHead,
  390. oldPrice:this.item.price
  391. }
  392. }
  393. return str
  394. }
  395. },
  396. methods: {
  397. isDisable(item,type,data){
  398. console.log('isDisable');
  399. if(type == 'KD'){
  400. let flag = true
  401. this.goodsInfo.skuCombinList.map(skuItem=>{
  402. skuItem.skusSpecs.map(skuIt=>{
  403. if(skuIt.specItemValueName == item.name){
  404. flag = false
  405. }
  406. })
  407. })
  408. return flag
  409. }else if(type == 'XC'){
  410. let flag = false
  411. for (let key in this.chooseInfo) {
  412. if(this.chooseInfo[key].exclusives.length){
  413. this.chooseInfo[key].exclusives.map(i=>{
  414. i.values.map(it=>{
  415. if(it.id == item){
  416. flag = true
  417. }
  418. })
  419. })
  420. }
  421. }
  422. return flag
  423. }else if(type == 'NXDC'){
  424. let flag = true
  425. let cur = {}
  426. for (let key in this.chooseInfo) {
  427. if(data.code == key){
  428. cur[key] = item.code
  429. }else{
  430. cur[key] = this.chooseInfo[key].code
  431. }
  432. }
  433. this.goodsInfo.details.sku_infos.map(item=>{
  434. let obj = {}
  435. item.specs.map(i=>{
  436. obj[i.code] = i.spec_code
  437. })
  438. if(this.areObjectsEqual(cur,obj)){
  439. flag = false
  440. }
  441. })
  442. return flag
  443. }
  444. },
  445. // 选择规格
  446. choose(item,key,data){
  447. console.log(item,key,data,this.chooseInfo);
  448. if(this.ot == 'XC'){
  449. if(this.chooseInfo[key]&&this.chooseInfo[key].id == item.id &&!data.mandatory){
  450. this.$delete(this.chooseInfo,key)
  451. }else{
  452. this.$set(this.chooseInfo,key,item)
  453. }
  454. }else if(this.ot == 'MDL'){
  455. if(this.chooseInfo[key]&&this.chooseInfo[key].id == item.id){//麦当劳不能不选择
  456. // this.$delete(this.chooseInfo,key)
  457. }else{
  458. this.$set(this.chooseInfo,key,item)
  459. }
  460. }
  461. else if(this.ot == 'XBK'){
  462. if(this.chooseInfo[key]&&this.chooseInfo[key].id == item.id){//星巴克不能不选择
  463. // this.$delete(this.chooseInfo,key)
  464. }else{
  465. this.$set(this.chooseInfo,key,item)
  466. }
  467. }
  468. else if(this.ot == 'KD'){
  469. let flag = false
  470. this.goodsInfo.skuCombinList.map(skuItem=>{
  471. skuItem.skusSpecs.map(skuIt=>{
  472. if(skuIt.specItemValueName == item.name){
  473. flag = true
  474. }
  475. })
  476. })
  477. // 在sku内有的才能选择
  478. if(flag){
  479. // 把数据组装成自己转换成skusSpecs格式对象
  480. this.$set(this.chooseInfo,key,
  481. {specItemName: data.specItemName,
  482. specItemNo: key,
  483. specItemValue: item.value,
  484. specItemValueName: item.name})
  485. }
  486. }
  487. else{//奈雪的茶 瑞幸
  488. this.$set(this.chooseInfo,key,item)
  489. }
  490. },
  491. confirm(){
  492. this.show1 = false
  493. uni.navigateTo({
  494. url:'./shopList'
  495. })
  496. },
  497. goShopList(){
  498. this.show3 = false
  499. uni.navigateTo({
  500. url:'./shopList'
  501. })
  502. },
  503. // 滚动的选择商品
  504. scroll(val){
  505. if(!this.offsetTop){
  506. this.offsetTop = val.currentTarget.offsetTop
  507. }
  508. this.topList.map((item,index)=>{
  509. if(index!=this.topList.length-1){
  510. if(val.detail.scrollTop>= (item-this.offsetTop)&&(val.detail.scrollTop <=this.topList[index+1]-this.offsetTop)){
  511. this.scrollTo1 = 'tab'+index
  512. this.active = index
  513. }
  514. }else{
  515. if(val.detail.scrollTop>= (item-this.offsetTop)){
  516. this.scrollTo1 = 'tab'+index
  517. this.active = index
  518. }
  519. }
  520. })
  521. },
  522. clear(){
  523. this.carList = []
  524. },
  525. // 购物车内添加数量 商品添加数量 选择规格时不走这里 但是选择规格的购物车内数量操作走这里
  526. add(item,num,data={},idx){//item:当前操作item num:增加或者减少 data:当前item的上层栏目,idx:购物车内当前操作商品index 方便删除
  527. console.log('add',item);
  528. // 如果需要选择规格
  529. if(data.childClassList) return this.handleItem(item,data)
  530. // 影响逻辑太大 暂时不改
  531. // if(item.menuFlag == "C") return this.handleItem(item,data)
  532. // 肯德基
  533. if(this.ot == 'Kfc'){
  534. if(this.carList.some(i=>item.productId == i.productId)){
  535. this.carList.forEach((row,index)=>{
  536. if(item.productId == row.productId){
  537. row.quantity+=num
  538. if(row.quantity == 0){
  539. this.carList.splice(index,1)
  540. }
  541. }
  542. })
  543. }else{
  544. let obj ={
  545. "imageUrl": item.imageUrl,
  546. "nameCn": item.nameCn,
  547. "productId": item.productId,
  548. "quantity": 1,
  549. "sellPrice": item.priceHead,
  550. "orgPrice": item.price,
  551. }
  552. this.carList.push(obj)
  553. }
  554. // }else if(this.ot == 'NXDC'){
  555. }else{
  556. if(this.carList.some((i,d)=>item.productId == i.productId)){
  557. this.carList.forEach((row,index)=>{
  558. if(index == idx){
  559. row.quantity+=num
  560. if(row.quantity == 0){
  561. this.carList.splice(index,1)
  562. }
  563. }
  564. })
  565. }else{//单品直接添加
  566. console.log(2222);
  567. this.chooseInfo = {}
  568. this.itemPrice = {
  569. price:this.item.priceHead,
  570. oldPrice:this.item.price
  571. }
  572. this.item = item
  573. this.handleAdd()
  574. }
  575. }
  576. },
  577. // 商品详情内数量操作
  578. add1(num){
  579. this.num+=num
  580. },
  581. // 计算奈雪当前选择规格价格和code
  582. findData(){
  583. let productId = ''
  584. let cur = {}
  585. let price = 0
  586. let oldPrice = 0
  587. let addPrice = 0
  588. for (let key in this.chooseInfo) {
  589. cur[key] = this.chooseInfo[key].code
  590. addPrice += this.chooseInfo[key].price
  591. }
  592. this.goodsInfo.details.sku_infos.map(item=>{
  593. let obj = {}
  594. item.specs.map(i=>{
  595. obj[i.code] = i.spec_code
  596. })
  597. if(this.areObjectsEqual(cur,obj)){
  598. price = item.salePrice
  599. oldPrice = item.price
  600. return productId = item.code
  601. }
  602. })
  603. console.log('找到对应的',productId,price);
  604. return {
  605. productId,
  606. price:price+addPrice,
  607. oldPrice:oldPrice+addPrice
  608. }
  609. },
  610. // 计算瑞幸当前选择规格价格和code
  611. findData1(){
  612. let productId = ''
  613. let cur = {}
  614. let price = 0
  615. let oldPrice = 0
  616. let addPrice = 0
  617. for (let key in this.chooseInfo) {
  618. cur[key] = this.chooseInfo[key].name
  619. addPrice += this.chooseInfo[key].price
  620. }
  621. this.goodsInfo.details.sku_infos.map(item=>{
  622. let obj = {}
  623. item.values.map(i=>{
  624. obj[i.name] = i.spec_name
  625. })
  626. if(this.areObjectsEqual(cur,obj)){
  627. price = this.item.priceHead
  628. oldPrice = this.item.price
  629. return productId = item.code
  630. }
  631. })
  632. console.log('找到对应的1',productId,price);
  633. return {
  634. productId,
  635. price:price+addPrice,
  636. oldPrice:oldPrice+addPrice
  637. }
  638. },
  639. // 计算库迪当前选择规格
  640. findData2(){
  641. let productId = ''
  642. let cur = {}
  643. for (let key in this.chooseInfo) {
  644. cur[key] = this.chooseInfo[key].specItemValue
  645. }
  646. this.goodsInfo.skuCombinList.map(item=>{
  647. let obj = {}
  648. item.skusSpecs.map(i=>{
  649. obj[i.specItemNo] = i.specItemValue
  650. })
  651. console.log(cur,obj);
  652. if(this.areObjectsEqual(cur,obj)){
  653. return productId = item.skuNo
  654. }
  655. })
  656. console.log('找到对应的3',productId);
  657. return productId
  658. },
  659. // 选择规格后,加入购物车
  660. handleAdd(){
  661. this.show2 = false
  662. // let {productId,price,addPrice} = this.findData()
  663. let obj = {}
  664. if(this.ot == 'NXDC'){
  665. obj ={
  666. "imageUrl": this.item.imageUrl,
  667. "nameCn": this.item.nameCn,
  668. "productId": this.item.productId,
  669. "quantity": this.num,
  670. "sellPrice": this.itemPrice.price,//市场价(如果存在套餐选项加价,这里的金额需要计算加价)
  671. "orgPrice": this.itemPrice.oldPrice,
  672. "config": JSON.parse(JSON.stringify(this.config)) , //这里只是为了直观展示套餐选项,实际下单可以传空
  673. "selected": [
  674. {
  675. "round": 0, //奈雪产品round目前没有使用,传0
  676. "products": [
  677. {
  678. "linkId": "",
  679. "productId": this.productId, //套餐选项skuID,商品详情的sku列表里面已经包含所有选项组合
  680. "quantity": 1
  681. }
  682. ]
  683. }
  684. ]
  685. }
  686. }else if(this.ot == 'XC'){
  687. let products = []
  688. for (let key in this.chooseInfo) {
  689. products.push(
  690. { "linkId": key, "productId": this.chooseInfo[key].id, "quantity": 1 }
  691. )
  692. }
  693. obj ={
  694. "imageUrl": this.item.imageUrl,
  695. "nameCn": this.item.nameCn,
  696. "productId": this.item.productId,
  697. "quantity": this.num,
  698. "sellPrice": this.itemPrice.price,//市场价(如果存在套餐选项加价,这里的金额需要计算加价)
  699. "orgPrice": this.itemPrice.oldPrice,
  700. "config": JSON.parse(JSON.stringify(this.config)) , //这里只是为了直观展示套餐选项,实际下单可以传空
  701. "selected": [
  702. {
  703. "round": 0,//喜茶产品round目前没有使用,传0
  704. "products": products
  705. }
  706. ]
  707. }
  708. }else if(this.ot == 'MDL'){
  709. let products = []
  710. if(this.goodsInfo.details.optional.length){//有可选才添加 没有默认空数组
  711. for (let key in this.chooseInfo) {
  712. products.push(
  713. {
  714. "linkId": key.split('-')[1],//下单参数linkId(有时会和主商品id相同)
  715. "productId": this.chooseInfo[key].id,//套餐选项商品id
  716. "quantity": 1
  717. }
  718. )
  719. }
  720. obj ={
  721. "imageUrl": this.item.imageUrl,
  722. "nameCn": this.item.nameCn,
  723. "productId": this.item.productId,
  724. "quantity": this.num,
  725. "sellPrice": this.itemPrice.price,//市场价(如果存在套餐选项加价,这里的金额需要计算加价)
  726. "orgPrice": this.itemPrice.oldPrice,
  727. "config": JSON.parse(JSON.stringify(this.config)) , //这里只是为了直观展示套餐选项,实际下单可以传空
  728. "selected": [
  729. {
  730. "round": 0,//喜茶产品round目前没有使用,传0
  731. "products": products
  732. }
  733. ]
  734. }
  735. }else{
  736. obj ={
  737. "imageUrl": this.item.imageUrl,
  738. "nameCn": this.item.nameCn,
  739. "productId": this.item.productId,
  740. "quantity": this.num,
  741. "sellPrice": this.itemPrice.price,//市场价(如果存在套餐选项加价,这里的金额需要计算加价)
  742. "orgPrice": this.itemPrice.oldPrice,
  743. "config": JSON.parse(JSON.stringify(this.config)) , //这里只是为了直观展示套餐选项,实际下单可以传空
  744. "selected": []
  745. }
  746. }
  747. }
  748. else if(this.ot == 'XBK'){
  749. let products = []
  750. for (let key in this.chooseInfo) {
  751. products.push(
  752. {
  753. "linkId": key,
  754. "productId": this.chooseInfo[key].id,//套餐选项商品id
  755. "quantity": 1
  756. }
  757. )
  758. }
  759. obj ={
  760. "imageUrl": this.item.imageUrl,
  761. "nameCn": this.item.nameCn,
  762. "productId": this.item.productId,
  763. "quantity": this.num,
  764. "sellPrice": this.itemPrice.price,//市场价(如果存在套餐选项加价,这里的金额需要计算加价)
  765. "orgPrice": this.itemPrice.oldPrice,
  766. "config": JSON.parse(JSON.stringify(this.config)) , //这里只是为了直观展示套餐选项,实际下单可以传空
  767. "selected": [
  768. {
  769. "round": 0,//喜茶产品round目前没有使用,传0
  770. "products": products
  771. }
  772. ]
  773. }
  774. }else if(this.ot == 'RXKF'){
  775. obj ={
  776. "imageUrl": this.item.imageUrl,
  777. "nameCn": this.item.nameCn,
  778. "productId": this.item.productId,
  779. "quantity": this.num,
  780. "sellPrice": this.itemPrice.price,//市场价(如果存在套餐选项加价,这里的金额需要计算加价)
  781. "orgPrice": this.itemPrice.oldPrice,
  782. "config": JSON.parse(JSON.stringify(this.config)) , //这里只是为了直观展示套餐选项,实际下单可以传空
  783. "selected": [
  784. {
  785. "round": 0, //奈雪产品round目前没有使用,传0
  786. "products": [
  787. {
  788. "productId": this.productId, //套餐选项skuID,商品详情的sku列表里面已经包含所有选项组合
  789. "quantity": 1
  790. }
  791. ]
  792. }
  793. ]
  794. }
  795. }else if(this.ot == 'KD'){
  796. obj ={
  797. "linkId": this.productId,//套餐选项skuID(必须)
  798. "imageUrl": this.item.imageUrl,
  799. "nameCn": this.item.nameCn,
  800. "productId": this.item.productId,
  801. "quantity": this.num,
  802. "sellPrice": this.itemPrice.price,//市场价(如果存在套餐选项加价,这里的金额需要计算加价)
  803. "orgPrice": this.itemPrice.oldPrice,
  804. "config": JSON.parse(JSON.stringify(this.config)) , //这里只是为了直观展示套餐选项,实际下单可以传空
  805. "selected": [
  806. {
  807. "round": 0,//库迪产品round目前没有使用,传0
  808. "products": [{ "productId": this.productId, "quantity": 1 }]//套餐选项skuID,跟外层的linkId值相同
  809. }
  810. ]
  811. }
  812. }
  813. this.carList.push(obj)
  814. },
  815. // 对比两个对象是否内容相同
  816. areObjectsEqual(obj1, obj2) {
  817. const keys1 = Object.keys(obj1);
  818. const keys2 = Object.keys(obj2);
  819. if (keys1.length!== keys2.length) {
  820. return false;
  821. }
  822. for (const key in obj1) {
  823. if (obj1.hasOwnProperty(key)) {
  824. if (obj1[key]!== obj2[key]) {
  825. return false;
  826. }
  827. }
  828. }
  829. return true;
  830. },
  831. close(key){
  832. this[key] = false
  833. },
  834. handleItem(i,item){
  835. console.log(item,111);
  836. this.num = 1
  837. this.item = i
  838. if(!item.childClassList) return
  839. this.show2 = true
  840. this.goodsInfo = {
  841. product_name:'-',
  842. product_description:'-',
  843. product_img:'',
  844. }
  845. this.chooseInfo = {}
  846. foodGoodsDetail({productId:i.productId,shopId:this.shopId}).then(res=>{
  847. if(res.state = 'Success'){
  848. this.goodsInfo = res.content.data
  849. if(this.goodsInfo.details&&this.goodsInfo.details.spu_specs&&this.ot=='NXDC'){//奈雪的茶
  850. this.goodsInfo.details.spu_specs.map(item=>{
  851. this.$set(this.chooseInfo,item.code,item.values[0])
  852. })
  853. }else if(this.goodsInfo.details&&this.goodsInfo.details.specifications&&this.ot=='XC'){//喜茶
  854. this.goodsInfo.details.specifications.map(item=>{
  855. item.values.map(i=>{
  856. if(i.checked){
  857. this.$set(this.chooseInfo,item.id,item.values[0])
  858. }
  859. })
  860. })
  861. }else if(this.goodsInfo.details&&this.goodsInfo.details.optional&&this.goodsInfo.details.optional.length&&this.ot=='XBK'){//星巴克
  862. this.goodsInfo.details.optional.map(item=>{
  863. item.sku_infos.map(i=>{
  864. if(i.checked){
  865. this.$set(this.chooseInfo,item.id,i)
  866. }
  867. })
  868. // this.$set(this.chooseInfo,item.id,item.sku_infos[0])
  869. })
  870. }else if(this.goodsInfo.details&&this.goodsInfo.details.optional&&this.goodsInfo.details.optional.length){//麦当劳
  871. this.goodsInfo.details.optional.map(item=>{
  872. item.sku_infos.map(i=>{
  873. if(i.checked){
  874. this.$set(this.chooseInfo,item.name+'-'+item.id,i)
  875. }
  876. })
  877. // id可能相同 所以加上类目的name 方便创建订单时能取到id
  878. // this.$set(this.chooseInfo,item.name+'-'+item.id,item.sku_infos[0])
  879. })
  880. }else if(this.goodsInfo.details&&this.goodsInfo.details.specifications&&this.ot=='RXKF'){//瑞幸
  881. this.goodsInfo.details.specifications.map(item=>{
  882. item.ingredients.map(i=>{
  883. if(i.checked){
  884. this.$set(this.chooseInfo,item.name,i)
  885. }
  886. })
  887. // this.$set(this.chooseInfo,item.name,item.ingredients[0])
  888. })
  889. }else if(this.goodsInfo.firstSku&&this.goodsInfo.firstSku.skusSpecs&&this.ot=='KD'){//库迪
  890. this.goodsInfo.product_img = this.goodsInfo.detailImgUrl
  891. this.goodsInfo.product_name = this.goodsInfo.title
  892. this.goodsInfo.firstSku.skusSpecs.map(item=>{
  893. this.$set(this.chooseInfo,item.specItemNo,item)
  894. })
  895. }
  896. console.log(this.chooseInfo);
  897. }
  898. })
  899. },
  900. handleCar(){
  901. this.show = true
  902. },
  903. handleTab(index){
  904. this.active = index
  905. this.scrollTo = 'title'+index
  906. },
  907. chooseTag(val){
  908. console.log('当前',val);
  909. },
  910. menuList(){
  911. uni.showLoading({
  912. title:'加载中'
  913. })
  914. menuList(this.shopId).then(res=>{
  915. uni.hideLoading()
  916. if(res.state = 'Success'){
  917. this.list = res.content.data
  918. if(!this.list.length){
  919. this.show3 = true
  920. }
  921. this.list.map((item,index)=>{
  922. if(this.ot != 'Kfc'&&item.childClassList){
  923. item.menuVoList = JSON.parse(JSON.stringify(item.childClassList[0].menuVoList))
  924. // delete item.childClassList
  925. }
  926. // 滚动到对应栏目
  927. if(this.cateName&&(item.topName == this.cateName)){
  928. this.handleTab(index)
  929. }
  930. })
  931. this.$nextTick(()=>{
  932. let query = uni.createSelectorQuery().in(this);
  933. query.selectAll('.section-name').boundingClientRect(data=>{
  934. this.topList =data.map(item=>{
  935. return item.top
  936. })
  937. }).exec();
  938. })
  939. }
  940. })
  941. },
  942. shopDetail(){
  943. shopDetail({"id": this.shopId,
  944. "lat": "",
  945. "lon": ""}).then(res=>{
  946. if(res.state = 'Success'){
  947. this.shopInfo.shopName = res.content.data.shopName
  948. this.shopInfo.address = res.content.data.address
  949. //是否在营业时间内
  950. if(res.content.data.openTime&&res.content.data.closeTime&&!this.isInBusinessHours(res.content.data.openTime,res.content.data.closeTime)){
  951. this.show1 = true
  952. }
  953. }
  954. })
  955. },
  956. buy() {
  957. let that = this
  958. if (uni.getStorageSync('token')) {
  959. if(JSON.parse(uni.getStorageSync('userInfo')).setMealCode != 0&&JSON.parse(uni.getStorageSync('userInfo')).setMealCode){
  960. let info ={
  961. shopName:this.shopInfo.shopName,
  962. address:this.shopInfo.address,
  963. shopId:this.shopId,
  964. products:this.carList,
  965. total:this.total,
  966. openTime:this.shopInfo.openTime,
  967. closeTime:this.shopInfo.closeTime,
  968. totalNum:this.totalNum
  969. }
  970. uni.navigateTo({
  971. url:`/orderFood/pay`,
  972. success: function(res) {
  973. // 通过eventChannel向被打开页面传送数据
  974. res.eventChannel.emit('pay', info)
  975. }
  976. })
  977. }else{
  978. uni.showModal({
  979. title:'此商品需要开通会员才能购买',
  980. cancelText:'下次再说',
  981. confirmText:'立即开通',
  982. success(res) {
  983. if(res.confirm){
  984. uni.navigateTo({
  985. url:'/my/memberCenter/index'
  986. })
  987. }
  988. }
  989. })
  990. }
  991. }else{
  992. uni.showModal({
  993. title:'请登录',
  994. confirmText:'去登录',
  995. success(res){
  996. console.log(res);
  997. if(res.confirm){
  998. uni.navigateTo({
  999. url:`/login/login/login?redirect=/orderFood/shopDetail&id=${that.shopId}`
  1000. })
  1001. }
  1002. }
  1003. })
  1004. }
  1005. },
  1006. isInBusinessHours(openTimeStr, closeTimeStr) {
  1007. let open = openTimeStr
  1008. let close = closeTimeStr
  1009. if(open.indexOf('.') != -1){
  1010. let index = open.indexOf('.')
  1011. open = open.substr(0,index)
  1012. }
  1013. if(close.indexOf('.') != -1){
  1014. let index = close.indexOf('.')
  1015. close = close.substr(0,index)
  1016. }
  1017. const now = new Date();
  1018. const openTime = new Date(open);
  1019. const closeTime = new Date(close);
  1020. // 获取当前时间的时分秒
  1021. const nowHours = now.getHours();
  1022. const nowMinutes = now.getMinutes();
  1023. const nowSeconds = now.getSeconds();
  1024. // 获取开店时间的时分秒
  1025. const openHours = openTime.getHours();
  1026. const openMinutes = openTime.getMinutes();
  1027. const openSeconds = openTime.getSeconds();
  1028. // 获取关店时间的时分秒
  1029. const closeHours = closeTime.getHours();
  1030. const closeMinutes = closeTime.getMinutes();
  1031. const closeSeconds = closeTime.getSeconds();
  1032. // 将当前时间、开店时间和关店时间转换为秒数
  1033. const nowSecondsTotal = nowHours * 3600 + nowMinutes * 60 + nowSeconds;
  1034. const openSecondsTotal = openHours * 3600 + openMinutes * 60 + openSeconds;
  1035. const closeSecondsTotal = closeHours * 3600 + closeMinutes * 60 + closeSeconds;
  1036. if ( openSecondsTotal <nowSecondsTotal && nowSecondsTotal<closeSecondsTotal ) {
  1037. return true
  1038. } else {
  1039. return false
  1040. }
  1041. }
  1042. },
  1043. onLoad(options) {
  1044. console.log(this.isInBusinessHours("2019-08-24T09:15:22.123Z","2019-08-24T14:15:22.123"));
  1045. this.cateName = options.cateName
  1046. this.shopId = options.id || "63836999-5117-4980-8632-497f007808ef"
  1047. // this.shopId = "63836999-5117-4980-8632-497f007808ef"
  1048. this.shopDetail()
  1049. this.menuList()
  1050. },
  1051. onReady () {
  1052. // this.Observer = uni.createIntersectionObserver(this)
  1053. // this.Observer.relativeTo('.test',{bottom: 0}).observe('.title0', (res) => {
  1054. // console.log(12312);
  1055. // // this.$emit('changeTag',this.value)
  1056. // })
  1057. }
  1058. }
  1059. </script>
  1060. <style lang="scss" >
  1061. .orderFood{
  1062. .shop-info{
  1063. width: 100%;
  1064. height: 140rpx;
  1065. padding: 20rpx 24rpx;
  1066. box-sizing: border-box;
  1067. border-bottom: 2rpx solid #F0F0F0;
  1068. // position: fixed;
  1069. // top: 0%;
  1070. // left: 0%;
  1071. // z-index: 9;
  1072. background: #fff;
  1073. .shop-name{
  1074. font-weight: bold;
  1075. font-size: 32rpx;
  1076. color: #222222;
  1077. }
  1078. .address{
  1079. font-size: 24rpx;
  1080. color: #AAAAAA;
  1081. margin-top: 8rpx;
  1082. }
  1083. }
  1084. .content{
  1085. height: calc(100vh - 140rpx);
  1086. display: flex;
  1087. overflow: auto;
  1088. box-sizing: border-box;
  1089. padding-bottom: calc(98rpx + env(safe-area-inset-bottom)) ;
  1090. .left{
  1091. flex: 0 0 176rpx;
  1092. background: #F7F7F7;
  1093. .item{
  1094. text-align: center;
  1095. padding: 16rpx 0;
  1096. .icon{
  1097. width: 76rpx;
  1098. height: 76rpx;
  1099. }
  1100. .name{
  1101. font-size: 24rpx;
  1102. color: #AAAAAA;
  1103. }
  1104. }
  1105. .item.active{
  1106. background: #FFFFFF;
  1107. .name{
  1108. color: #222222;
  1109. }
  1110. }
  1111. }
  1112. .right{
  1113. flex: 1;
  1114. padding: 0 24rpx;
  1115. overflow: auto;
  1116. position: relative;
  1117. .test{
  1118. width: 100%;
  1119. height: 60rpx;
  1120. background: red;
  1121. position: fixed;
  1122. }
  1123. .section{
  1124. .section-name{
  1125. font-weight: bold;
  1126. font-size: 28rpx;
  1127. color: #222222;
  1128. padding-top: 30rpx;
  1129. }
  1130. .item{
  1131. display: flex;
  1132. margin-top: 28rpx;
  1133. .img{
  1134. width: 160rpx;
  1135. height: 160rpx;
  1136. border-radius: 8rpx 8rpx 8rpx 8rpx;
  1137. }
  1138. .info{
  1139. flex: 1;
  1140. margin-left: 26rpx;
  1141. display: flex;
  1142. flex-direction: column;
  1143. justify-content: space-around;
  1144. .title{
  1145. font-weight: bold;
  1146. font-size: 32rpx;
  1147. color: #222222;
  1148. }
  1149. .btn-box{
  1150. display: flex;
  1151. justify-content: space-between;
  1152. .price-box{
  1153. display: flex;
  1154. align-items: center;
  1155. .price{
  1156. display: flex;
  1157. align-items: flex-end;
  1158. color: #FF4D3A;
  1159. .unit{
  1160. font-size: 20rpx;
  1161. }
  1162. .num{
  1163. font-weight: bold;
  1164. font-size: 36rpx;
  1165. }
  1166. }
  1167. .old-price{
  1168. font-weight: normal;
  1169. font-size: 24rpx;
  1170. color: #AAAAAA;
  1171. text-decoration: line-through;
  1172. margin-left: 16rpx;
  1173. }
  1174. }
  1175. .btn{
  1176. width: 40rpx;
  1177. height: 40rpx;
  1178. }
  1179. }
  1180. }
  1181. }
  1182. }
  1183. }
  1184. }
  1185. .total-box1{
  1186. position: inherit!important;
  1187. padding-bottom: 0!important;
  1188. }
  1189. .total-box{
  1190. position: fixed;
  1191. left: 0%;
  1192. bottom: 0;
  1193. width: 100%;
  1194. padding: 10rpx 24rpx env(safe-area-inset-bottom);
  1195. box-sizing: border-box;
  1196. display: flex;
  1197. align-items: center;
  1198. justify-content: space-between;
  1199. border-top: 1rpx solid #EEEEEE;
  1200. .price-box{
  1201. display: flex;
  1202. .car-box{
  1203. position: relative;
  1204. display: flex;
  1205. align-items: center;
  1206. .icon{
  1207. width: 48rpx;
  1208. height: 48rpx;
  1209. }
  1210. .num{
  1211. position: absolute;
  1212. top: -18rpx;
  1213. right: -18rpx;
  1214. min-width: 36rpx;
  1215. height: 36rpx;
  1216. line-height: 36rpx;
  1217. text-align: center;
  1218. border-radius: 18rpx;
  1219. background: #222222;
  1220. font-weight: bold;
  1221. font-size: 24rpx;
  1222. color: #FFFFFF;
  1223. margin-left: 20rpx;
  1224. }
  1225. }
  1226. .price{
  1227. display: flex;
  1228. align-items: flex-end;
  1229. color: #FF4D3A;
  1230. .unit{
  1231. font-size: 20rpx;
  1232. }
  1233. .num{
  1234. font-weight: bold;
  1235. font-size: 36rpx;
  1236. }
  1237. }
  1238. }
  1239. .buy{
  1240. width: 200rpx;
  1241. height: 80rpx;
  1242. line-height: 80rpx;
  1243. text-align: center;
  1244. background: #EE4320;
  1245. border-radius: 40rpx 40rpx 40rpx 40rpx;
  1246. font-weight: bold;
  1247. font-size: 28rpx;
  1248. color: #FFFFFF;
  1249. margin: 0;
  1250. }
  1251. .buy::after{
  1252. border: none;
  1253. outline: none;
  1254. }
  1255. .buy.disabled{
  1256. background: #F6F6F6;
  1257. color: #AAAAAA;
  1258. }
  1259. }
  1260. .popup-title-box{
  1261. display: flex;
  1262. justify-content: space-between;
  1263. padding: 24rpx;
  1264. .title{
  1265. font-weight: bold;
  1266. font-size: 28rpx;
  1267. color: #222222;
  1268. }
  1269. .clear{
  1270. font-size: 28rpx;
  1271. color: #AAAAAA;
  1272. }
  1273. }
  1274. .u-empty{
  1275. padding: 30rpx 0;
  1276. }
  1277. .car-content{
  1278. padding-bottom: 30rpx;
  1279. max-height: 700rpx;
  1280. overflow: auto;
  1281. .item{
  1282. display: flex;
  1283. margin-top: 28rpx;
  1284. padding: 0 24rpx;
  1285. .img{
  1286. width: 160rpx;
  1287. height: 160rpx;
  1288. border-radius: 8rpx 8rpx 8rpx 8rpx;
  1289. }
  1290. .info{
  1291. flex: 1;
  1292. margin-left: 26rpx;
  1293. display: flex;
  1294. flex-direction: column;
  1295. justify-content: space-between;
  1296. .title{
  1297. font-weight: bold;
  1298. font-size: 32rpx;
  1299. color: #222222;
  1300. }
  1301. .type{
  1302. font-weight: normal;
  1303. font-size: 24rpx;
  1304. color: #AAAAAA;
  1305. }
  1306. .btn-box{
  1307. display: flex;
  1308. justify-content: space-between;
  1309. .price-box{
  1310. display: flex;
  1311. align-items: center;
  1312. .price{
  1313. display: flex;
  1314. align-items: flex-end;
  1315. color: #FF4D3A;
  1316. .unit{
  1317. font-size: 20rpx;
  1318. }
  1319. .num{
  1320. font-weight: bold;
  1321. font-size: 36rpx;
  1322. }
  1323. }
  1324. .old-price{
  1325. font-weight: normal;
  1326. font-size: 24rpx;
  1327. color: #AAAAAA;
  1328. text-decoration: line-through;
  1329. margin-left: 16rpx;
  1330. }
  1331. }
  1332. .count-box{
  1333. display: flex;
  1334. align-items: center;
  1335. .num{
  1336. width: 100rpx;
  1337. text-align: center;
  1338. font-size: 28rpx;
  1339. color: #222222;
  1340. }
  1341. .btn{
  1342. width: 40rpx;
  1343. height: 40rpx;
  1344. }
  1345. }
  1346. }
  1347. }
  1348. }
  1349. }
  1350. .modal-box{
  1351. .shop-name{
  1352. font-weight: 600;
  1353. font-size: 32rpx;
  1354. color: #181818;
  1355. width: 100%;
  1356. text-align: center;
  1357. }
  1358. .address{
  1359. font-weight: 300;
  1360. font-size: 24rpx;
  1361. color: #AAAAAA;
  1362. margin-top: 4rpx;
  1363. width: 100%;
  1364. text-align: center;
  1365. }
  1366. .notice{
  1367. margin-top: 20rpx;
  1368. font-weight: 300;
  1369. font-size: 24rpx;
  1370. color: #AAAAAA;
  1371. text-align: center;
  1372. }
  1373. }
  1374. .popup-goodsDetail{
  1375. padding-bottom: env(safe-area-inset-bottom);
  1376. .img{
  1377. width: 750rpx;
  1378. height: 400rpx;
  1379. vertical-align: bottom;
  1380. }
  1381. .box{
  1382. max-height: 60vh;
  1383. overflow: auto;
  1384. }
  1385. .popup-content{
  1386. padding: 0 24rpx;
  1387. .title{
  1388. font-weight: 800;
  1389. font-size: 32rpx;
  1390. color: #222222;
  1391. margin-top: 24rpx;
  1392. }
  1393. .desc{
  1394. font-size: 24rpx;
  1395. color: #222222;
  1396. margin: 24rpx 0;
  1397. }
  1398. .choose-box{
  1399. margin-top: 20rpx;
  1400. .choose-item{
  1401. .choose-title{
  1402. font-size: 28rpx;
  1403. color: #222222;
  1404. }
  1405. .item-box{
  1406. display: flex;
  1407. flex-wrap: wrap;
  1408. padding: 20rpx 0;
  1409. .item{
  1410. font-size: 24rpx;
  1411. color: #222222;
  1412. padding: 0 20rpx;
  1413. line-height: 44rpx;
  1414. height: 44rpx;
  1415. background: #fff;
  1416. border-radius: 8rpx 8rpx 8rpx 8rpx;
  1417. border: 2rpx solid #F0F0F0;
  1418. margin-right: 20rpx;
  1419. margin-bottom: 10rpx;
  1420. }
  1421. .item.active{
  1422. border: 2rpx solid #EE4320;
  1423. background: #FEECE8;
  1424. }
  1425. .item.disable{
  1426. color: #AAAAAA;
  1427. pointer-events: none;
  1428. }
  1429. }
  1430. }
  1431. }
  1432. }
  1433. .btn-box{
  1434. padding: 20rpx 24rpx;
  1435. border-top: 1rpx solid #EEEEEE;
  1436. .order-info{
  1437. display: flex;
  1438. align-items: center;
  1439. justify-content: space-between;
  1440. .left{
  1441. .price-box{
  1442. display: flex;
  1443. align-items: center;
  1444. .price{
  1445. font-weight: bold;
  1446. font-size: 28rpx;
  1447. color: #222222;
  1448. }
  1449. .old-price{
  1450. font-size: 22rpx;
  1451. color: #AAAAAA;
  1452. text-decoration: line-through;
  1453. }
  1454. }
  1455. .choose{
  1456. font-size: 20rpx;
  1457. color: #AAAAAA;
  1458. margin-top: 8rpx;
  1459. }
  1460. }
  1461. .count-box{
  1462. display: flex;
  1463. align-items: center;
  1464. .num{
  1465. width: 100rpx;
  1466. text-align: center;
  1467. font-size: 28rpx;
  1468. color: #222222;
  1469. }
  1470. .btn1{
  1471. width: 40rpx;
  1472. height: 40rpx;
  1473. }
  1474. }
  1475. }
  1476. .btn{
  1477. width: 702rpx;
  1478. height: 80rpx;
  1479. background: #EE4320;
  1480. font-weight: bold;
  1481. font-size: 28rpx;
  1482. color: #FFFFFF;
  1483. margin-top: 24rpx;
  1484. }
  1485. }
  1486. }
  1487. }
  1488. </style>