createOrder.vue 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195
  1. <template>
  2. <view>
  3. <!-- <view class="navbar">
  4. <view v-for="(item, index) in navList" :key="index" class="nav-item"
  5. :class="{ current: tabCurrentIndex === item.state }" @click="tabClick(item.state)">{{ item.text }}</view>
  6. </view> -->
  7. <!-- 地址 -->
  8. <navigator v-if="tabCurrentIndex == 0" class="address-section" url="/pages/set/address?source=1">
  9. <view class="order-content" v-if="addressData.real_name">
  10. <text class="iconfont iconlocation"></text>
  11. <view class="cen">
  12. <view class="top">
  13. <text class="name">{{ addressData.real_name }}</text>
  14. <text class="mobile">{{ addressData.phone }}</text>
  15. </view>
  16. <text class="address">{{ addressData.province + addressData.city + addressData.district }}
  17. {{ addressData.detail }}</text>
  18. </view>
  19. <text class="iconfont iconenter"></text>
  20. </view>
  21. <view class="order-content" v-if="!addressData.real_name">
  22. <view class="addAddress">
  23. <text class="iconfont iconaddition"></text>
  24. <text>添加收货地址</text>
  25. </view>
  26. </view>
  27. <image class="a-bg" :src="addressImg"></image>
  28. </navigator>
  29. <view v-if="tabCurrentIndex == 1" class="address-section">
  30. <view id="list-box">
  31. <view class="chose">
  32. <view class="title">选择门店</view>
  33. <view class="chose-name" @click.stop="selectPoint" v-if="tabCurrentIndex == 1">
  34. 选择门店
  35. <view class="img">
  36. <image src="https://bamboo.zfhzy.com/static/img/img39.png" mode=""></image>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="stores-wrapper" v-if="checkedPoint && checkedPoint.name">
  41. <view class="store">
  42. <view class="store-logo">
  43. <image :src="checkedPoint.image" mode=""></image>
  44. <text class="store-name clamp">{{ checkedPoint.name }}</text>
  45. </view>
  46. <template v-if="checkedPoint.detailed_address != '测试'">
  47. <view class="store-addr store-base">
  48. 地址:
  49. <text>{{ checkedPoint.detailed_address }}</text>
  50. </view>
  51. <view class="store-addr store-base">
  52. 电话:
  53. <text>{{ checkedPoint.phone }}</text>
  54. </view>
  55. </template>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="personal" v-if="tabCurrentIndex == 1">
  60. <view class="info">
  61. <view class="name">提货人</view>
  62. <input type="text" class="box-right" v-model="addressData.real_name" style="color: #000000"
  63. placeholder="请填写提货人" />
  64. </view>
  65. <view class="info">
  66. <view class="name">手机号</view>
  67. <input type="text" class="box-right" v-model="addressData.phone" style="color: #000000" size="8"
  68. maxlength="11" placeholder="请填写提货人手机号" />
  69. </view>
  70. </view>
  71. <image class="a-bg" :src="addressImg"></image>
  72. </view>
  73. <view class="goods-section" v-for="(ls, ind) in shopList" :key="ind">
  74. <!-- <view class="g-header b-b">
  75. <image class="logo" :src="ls.productInfo.image"></image>
  76. <text class="name">{{ ls.name }}</text>
  77. </view> -->
  78. <!-- 商品列表 -->
  79. <view class="g-item">
  80. <image :src="ls.productInfo.image"></image>
  81. <view class="right">
  82. <text class="title clamp">{{ ls.productInfo.store_name }}</text>
  83. <text class="spec">{{ ls.productInfo.attrInfo ? ls.productInfo.attrInfo.suk : '默认' }}</text>
  84. <view class="price-box">
  85. <text
  86. class="price">¥{{ ls.productInfo.attrInfo ? ls.productInfo.attrInfo.price : ls.productInfo.price }}</text>
  87. <text class="number">{{ 'x' + ls.cart_num }} {{(ls.productInfo.unit_name ? '(' + ls.productInfo.unit_name + ')': '')}}</text>
  88. <!-- <view><text class="price">¥{{lss.price}}</text></view> -->
  89. <!-- <view class="number">
  90. <uni-number-box class="step" :value="lss.number" :index="indx" @eventChange="numberChange"></uni-number-box>
  91. </view> -->
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. <!-- 优惠明细 -->
  97. <!-- <view class="yt-list">
  98. <view class="yt-list-cell b-b" @click="couponListshow ? toggleMask('show') : ''">
  99. <view class="cell-icon">券</view>
  100. <text class="cell-tit clamp">优惠券</text>
  101. <text class="cell-tip active" v-if="couponListshow && !couponChecked.coupon_price">选择优惠券</text>
  102. <text class="cell-tip red" v-if="couponChecked.coupon_price">-¥{{ couponChecked.coupon_price }}</text>
  103. <text class="cell-tip disabled" v-if="!couponListshow && !couponChecked.coupon_price">没有优惠券</text>
  104. <text class="cell-more wanjia wanjia-gengduo-d"></text>
  105. </view>
  106. <view class="yt-list-cell b-b" v-if="moneyAll.storeFreePostage > 0">
  107. <view class="cell-icon hb">减</view>
  108. <text class="cell-tit clamp">商家促销</text>
  109. <text class="cell-tip disabled">满{{ moneyAll.storeFreePostage }}包邮</text>
  110. </view>
  111. </view> -->
  112. <!-- 金额明细 -->
  113. <view class="yt-list">
  114. <!-- <view class="yt-list-cell b-b">
  115. <text class="cell-tit clamp">优惠金额</text>
  116. <text class="cell-tip red">-¥35</text>
  117. </view> -->
  118. <!-- <view class="yt-list-cell b-b" v-if="integralAll > 0">
  119. <text class="cell-tit clamp">积分抵扣{{ '(当前积分:' + integralAll + ')' }}</text>
  120. <view class="cell-tip"><radio @click="checkedPoints = !checkedPoints" color="#ff5319" :checked="checkedPoints" /></view>
  121. </view> -->
  122. <view class="yt-list-cell b-b" v-if="tabCurrentIndex == 0">
  123. <text class="cell-tit clamp">运费</text>
  124. <text class="cell-tip">{{ Postage }}</text>
  125. </view>
  126. <view class="yt-list-cell b-b">
  127. <text class="cell-tit clamp">备注</text>
  128. <input class="desc" type="text" v-model="desc" placeholder="请填写备注信息" placeholder-class="placeholder" />
  129. </view>
  130. </view>
  131. <view class="yt-list">
  132. <view class="yt-list-cell b-b">
  133. <text class="cell-tit clamp">商品金额</text>
  134. <text class="cell-tip">¥{{ payAllMoney }}</text>
  135. </view>
  136. <view class="yt-list-cell b-b" v-if="checkedPoints && integralShow">
  137. <text class="cell-tit clamp">积分抵扣</text>
  138. <text class="cell-tip">-¥{{ integralMoney }}</text>
  139. </view>
  140. <view class="yt-list-cell b-b" v-if="moneyAll.vipPrice > 0">
  141. <text class="cell-tit clamp">VIP优惠</text>
  142. <text class="cell-tip">-¥{{ moneyAll.vipPrice }}</text>
  143. </view>
  144. </view>
  145. <!-- 底部 -->
  146. <view class="footer" v-if="showbtn">
  147. <view class="price-content">
  148. <text>实付款</text>
  149. <text class="price-tip">¥</text>
  150. <text class="price">{{ payPrice }}</text>
  151. </view>
  152. <text class="submit" :class="{ submitNo: !payType }" @click="payType ? submit() : ''">提交订单</text>
  153. </view>
  154. <!-- 优惠券面板 -->
  155. <view class="mask" :class="maskState === 0 ? 'none' : maskState === 1 ? 'show' : ''" @click="toggleMask">
  156. <view class="mask-content">
  157. <!-- 优惠券页面,仿mt -->
  158. <view class="coupon-item" @click="checkedCp(item)" v-for="(item, index) in couponList" :key="index">
  159. <view class="con">
  160. <view class="left">
  161. <text class="title">{{ item.coupon_title }}</text>
  162. <text class="time">领取时间{{ item.add_time }}</text>
  163. </view>
  164. <view class="right">
  165. <text class="price">{{ item.coupon_price }}</text>
  166. <text>满{{ item.use_min_price }}可用</text>
  167. </view>
  168. <view class="circle l"></view>
  169. <view class="circle r"></view>
  170. </view>
  171. <text class="tips">有效期至{{ item.end_time }}</text>
  172. </view>
  173. </view>
  174. </view>
  175. <uni-popup ref="popupstore" type="bottom" @change="popchange">
  176. <view class="store-list">
  177. <scroll-view scroll-y="true" style="max-height: 500rpx;">
  178. <view class="store" v-for="store in store_list" @click="chooseStore(store)">
  179. <view class="store-logo">
  180. <image :src="store.image" mode=""></image>
  181. <text class="store-name clamp">{{ store.name }}</text>
  182. </view>
  183. <template v-if="store.detailed_address != '测试'">
  184. <view class="store-addr store-base">
  185. 地址:
  186. <text>{{ store.detailed_address }}</text>
  187. </view>
  188. <view class="store-addr store-base">
  189. 电话:
  190. <text>{{ store.phone }}</text>
  191. </view>
  192. </template>
  193. </view>
  194. </scroll-view>
  195. </view>
  196. </uni-popup>
  197. <home></home>
  198. </view>
  199. </template>
  200. <script>
  201. import {
  202. confirm,
  203. computedOrderkey,
  204. couponsOrder,
  205. storeList
  206. } from '@/api/order.js';
  207. import {
  208. getUserInfo
  209. } from '@/api/user.js';
  210. import {
  211. cartAdd
  212. } from '@/api/product.js';
  213. import {
  214. mapState,
  215. mapMutations
  216. } from 'vuex';
  217. export default {
  218. data() {
  219. return {
  220. showbtn: true,
  221. store_list: [],
  222. checkedPoint: {},
  223. addressImg: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAu4AAAAFCAYAAAAaAWmiAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Rjk3RjkzMjM2NzMxMTFFOUI4RkU4OEZ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oSL9NZiZNMTKStp6g5/x5NsW37vWQaS1WXzPHvjihzYS/lgshbeJ75WySHm7wNXXk8SbK/xutOX4ntHtYRxE0eJn6uARaGf6ie++7GPNxVkf/78AAwCn1+RYqusbZQAAAABJRU5ErkJggg==',
  224. // 当前选中的支付方式
  225. tabCurrentIndex: 0,
  226. navList: [
  227. {
  228. state: 1,
  229. text: '到店自提'
  230. },{
  231. state: 0,
  232. text: '快递配送'
  233. },
  234. ],
  235. maskState: 0, //优惠券面板显示状态
  236. desc: '', //备注
  237. payType: 1, //1微信 2支付宝
  238. // 优惠券列表
  239. couponList: [],
  240. couponListshow: false, //是有可以显示优惠券列表
  241. couponChecked: {}, //选中的优惠券
  242. // 收货地址
  243. addressData: {},
  244. // 店铺地址
  245. shopAddress: {
  246. name: '',
  247. mobile: '',
  248. addressName: '',
  249. address: '',
  250. area: '',
  251. default: false
  252. },
  253. // 商品列表
  254. shopList: [],
  255. // 购物车id
  256. cartId: '',
  257. //购物金额详情
  258. moneyAll: {
  259. storeFreePostage: 0, //邮费优惠
  260. storePostage: 0, //邮费
  261. totalPrice: 0, //总支付金额
  262. vipPrice: 0 //vip优惠价
  263. },
  264. payPrice: 0, //总支付金额
  265. orderKey: '', //订单id
  266. checkedPoints: false, //判断是否积分抵扣
  267. integralAll: 0, //可使用的积分
  268. integralMoney: 0, //积分抵扣金额
  269. integralShow: false, //是否显示积分抵扣金额
  270. payType: true, //是否可支付
  271. pinkid: '' ,//保存拼团商品id
  272. is_pack: 0,
  273. is_zero: 0,
  274. affiliation_uid: 0,
  275. is_level: 0,
  276. is_agent: 0
  277. };
  278. },
  279. onLoad(option) {
  280. if(option.is_pack) {
  281. this.is_pack = option.is_pack
  282. }
  283. if(option.is_agent) {
  284. this.is_agent = option.is_agent
  285. }
  286. if(option.is_zero) {
  287. this.is_zero = option.is_zero
  288. }
  289. if(option.is_level) {
  290. this.is_level = option.is_level
  291. }
  292. if(option.affiliation_uid) {
  293. this.affiliation_uid = option.affiliation_uid
  294. }
  295. // 判断是否为拼团商品
  296. if (option.type == 'pink') {
  297. this.pinkid = option.pinkId;
  298. this.cartAdd(option);
  299. } else {
  300. // 保存当前商品在购物车中的id
  301. this.cartId = option.id;
  302. this.loadData();
  303. }
  304. this.userinfo();
  305. this.storeList()
  306. },
  307. watch: {
  308. checkedPoints(newValue, oldValue) {
  309. this.integralShow = false;
  310. this.payMoneyNub();
  311. },
  312. tabCurrentIndex(newValue, oldValue) {
  313. this.payMoneyNub();
  314. }
  315. },
  316. computed: {
  317. Postage() {
  318. let money = +this.moneyAll.storePostage;
  319. if (money == 0) {
  320. return '免运费';
  321. } else {
  322. return '¥' + money;
  323. }
  324. },
  325. payAllMoney() {
  326. return +this.moneyAll.totalPrice + +this.moneyAll.vipPrice;
  327. },
  328. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  329. },
  330. methods: {
  331. storeList() {
  332. storeList().then(res => {
  333. console.log(res)
  334. this.store_list = res.data.list
  335. this.checkedPoint = this.store_list[0]
  336. })
  337. },
  338. // 添加商品到购物车
  339. cartAdd(opt) {
  340. let obj = this;
  341. cartAdd({
  342. cartNum: 1, //商品数量
  343. new: 1, //商品是否新增加到购物车1为不加入0为加入
  344. mer_id: +opt.merid, //商店id
  345. combinationId: +opt.gid, //拼团商品id
  346. productId: +opt.pid //普通商品id
  347. })
  348. .then(function(e) {
  349. let da = e.data;
  350. // 獲取购物车号
  351. obj.cartId = da.cartId;
  352. // 加载数据
  353. obj.loadData();
  354. })
  355. .catch(e => {
  356. console.log(e);
  357. });
  358. },
  359. // 加载用户基础信息
  360. userinfo() {
  361. getUserInfo({}).then(({
  362. data
  363. }) => {
  364. this.integralAll = data.integral;
  365. });
  366. },
  367. // 计算支付金额
  368. payMoneyNub() {
  369. computedOrderkey({
  370. orderkey: this.orderKey,
  371. useIntegral: this.checkedPoints ? 1 : 0, //是否积分抵扣
  372. couponId: this.couponChecked.id, //优惠券编号
  373. addressId: this.addressData.id, //地址编号
  374. shipping_type: this.tabCurrentIndex + 1
  375. })
  376. .then(({
  377. data
  378. }) => {
  379. console.log(data, '111');
  380. this.payType = true;
  381. this.integralShow = true;
  382. // 获取支付金额
  383. this.payPrice = +data.result.pay_price;
  384. this.integralMoney = data.result.deduction_price;
  385. })
  386. .catch(e => {
  387. console.log(e);
  388. this.integralShow = false;
  389. this.payType = false;
  390. });
  391. },
  392. // 是否使用积分
  393. checkedIntegral() {
  394. this.checkedPoints = !this.checkedPoints;
  395. },
  396. // 选中优惠券
  397. checkedCp(item) {
  398. this.couponChecked = item;
  399. this.payMoneyNub();
  400. },
  401. // 加载优惠券列表
  402. couponsOrder(money) {
  403. couponsOrder({}, money).then(e => {
  404. if (e.data.length > 0) {
  405. this.couponListshow = true;
  406. }
  407. this.couponList = e.data;
  408. });
  409. },
  410. //顶部tab点击
  411. tabClick(index) {
  412. this.tabCurrentIndex = index;
  413. },
  414. //显示优惠券面板
  415. toggleMask(type) {
  416. let timer = type === 'show' ? 10 : 300;
  417. let state = type === 'show' ? 1 : 0;
  418. this.maskState = 2;
  419. setTimeout(() => {
  420. this.maskState = state;
  421. }, timer);
  422. },
  423. loadData() {
  424. let obj = this;
  425. confirm({
  426. cartId: obj.cartId + ''
  427. }).then(({
  428. data
  429. }) => {
  430. obj.addressData = data.addressInfo || {};
  431. obj.shopList = data.cartInfo; //商品列表
  432. obj.moneyAll = data.priceGroup; //金额数据
  433. obj.orderKey = data.orderKey; //订单key
  434. // 计算金额
  435. this.payMoneyNub();
  436. // 加载优惠券
  437. // obj.couponsOrder(data.priceGroup.totalPrice);
  438. });
  439. },
  440. // 购买数量变化
  441. numberChange(data) {
  442. this.number = data.number;
  443. },
  444. // 修改支付方式
  445. changePayType(type) {
  446. this.payType = type;
  447. },
  448. // 提交订单
  449. submit() {
  450. if (this.checkedPoints && this.shopList.length > 1) {
  451. this.$api.msg('积分商品只可单件购买');
  452. return false;
  453. }
  454. if (this.tabCurrentIndex == 0) {
  455. if (!this.addressData.real_name) {
  456. this.$api.msg('请选择收货地址');
  457. return false;
  458. }
  459. }else {
  460. if(!this.addressData.real_name) {
  461. this.$api.msg('请填写提货人');
  462. return false;
  463. }
  464. if(!this.addressData.phone) {
  465. this.$api.msg('请填写提货人手机号');
  466. return false;
  467. }
  468. }
  469. let url = '/pages/money/pay?key=' + this.orderKey
  470. if (this.pinkid) {
  471. url += '&pinkid=' + this.pinkid
  472. }
  473. if(this.is_zero) {
  474. url += '&is_zero=' + this.is_zero
  475. }
  476. if(this.userInfo.level > 4 && (this.is_level == 1 || this.is_pack == 1)) {
  477. return this.$api.msg('您当前等级无法购买该商品')
  478. }
  479. uni.navigateTo({
  480. url
  481. });
  482. },
  483. selectPoint() {
  484. this.$refs.popupstore.open()
  485. },
  486. popchange(e) {
  487. this.showbtn = !e.show
  488. },
  489. chooseStore(item) {
  490. this.checkedPoint = item
  491. this.$refs.popupstore.close()
  492. }
  493. }
  494. };
  495. </script>
  496. <style lang="scss">
  497. page {
  498. background: $page-color-base;
  499. padding-bottom: 100rpx;
  500. }
  501. .navbar {
  502. display: flex;
  503. height: 80rpx;
  504. padding: 0 5px;
  505. background: #fff;
  506. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.06);
  507. position: relative;
  508. z-index: 10;
  509. .nav-item {
  510. flex: 1;
  511. display: flex;
  512. justify-content: center;
  513. align-items: center;
  514. height: 100%;
  515. font-size: $font-lg + 4rpx;
  516. color: $font-color-dark;
  517. position: relative;
  518. &.current {
  519. color: $base-color;
  520. &:after {
  521. content: '';
  522. position: absolute;
  523. left: 50%;
  524. bottom: 0;
  525. transform: translateX(-50%);
  526. width: 140rpx;
  527. height: 0;
  528. border-bottom: 2px solid $base-color;
  529. }
  530. }
  531. }
  532. }
  533. .address-section {
  534. padding: 30rpx 0;
  535. background: #fff;
  536. position: relative;
  537. border-top: 1px solid $border-color-light;
  538. .order-content {
  539. min-height: 100rpx;
  540. display: flex;
  541. align-items: center;
  542. .addAddress {
  543. text-align: center;
  544. width: 100%;
  545. display: flex;
  546. justify-content: center;
  547. align-items: center;
  548. .iconaddition {
  549. font-size: 55rpx;
  550. line-height: 1;
  551. border-radius: 100rpx;
  552. margin-right: 20rpx;
  553. }
  554. }
  555. }
  556. .iconlocation {
  557. flex-shrink: 0;
  558. display: flex;
  559. align-items: center;
  560. justify-content: center;
  561. width: 90rpx;
  562. color: #888;
  563. font-size: 44rpx;
  564. }
  565. .cen {
  566. display: flex;
  567. flex-direction: column;
  568. flex: 1;
  569. font-size: 28rpx;
  570. color: $font-color-dark;
  571. }
  572. .name {
  573. font-size: 34rpx;
  574. margin-right: 24rpx;
  575. }
  576. .address {
  577. margin-top: 16rpx;
  578. margin-right: 20rpx;
  579. color: $font-color-light;
  580. }
  581. .icon-you {
  582. font-size: 32rpx;
  583. color: $font-color-light;
  584. margin-right: 30rpx;
  585. }
  586. .a-bg {
  587. position: absolute;
  588. left: 0;
  589. bottom: 0;
  590. display: block;
  591. width: 100%;
  592. height: 5rpx;
  593. }
  594. }
  595. .goods-section {
  596. margin-top: 16rpx;
  597. background: #fff;
  598. padding-bottom: 1px;
  599. .g-header {
  600. display: flex;
  601. align-items: center;
  602. height: 84rpx;
  603. padding: 0 30rpx;
  604. position: relative;
  605. }
  606. .logo {
  607. display: block;
  608. width: 50rpx;
  609. height: 50rpx;
  610. border-radius: 100px;
  611. }
  612. .name {
  613. font-size: 30rpx;
  614. color: $font-color-base;
  615. margin-left: 24rpx;
  616. }
  617. .g-item {
  618. display: flex;
  619. margin: 20rpx 30rpx;
  620. image {
  621. flex-shrink: 0;
  622. display: block;
  623. width: 140rpx;
  624. height: 140rpx;
  625. border-radius: 4rpx;
  626. }
  627. .right {
  628. flex: 1;
  629. padding-left: 24rpx;
  630. overflow: hidden;
  631. }
  632. .title {
  633. font-size: 30rpx;
  634. color: $font-color-dark;
  635. }
  636. .spec {
  637. font-size: 26rpx;
  638. color: $font-color-light;
  639. }
  640. .price-box {
  641. display: flex;
  642. align-items: center;
  643. font-size: 32rpx;
  644. color: $font-color-dark;
  645. padding-top: 10rpx;
  646. .price {
  647. margin-bottom: 4rpx;
  648. color: $color-red;
  649. }
  650. .number {
  651. font-size: 26rpx;
  652. color: $font-color-base;
  653. margin-left: 20rpx;
  654. }
  655. }
  656. .step-box {
  657. position: relative;
  658. }
  659. }
  660. }
  661. .yt-list {
  662. margin-top: 16rpx;
  663. background: #fff;
  664. }
  665. .yt-list-cell {
  666. display: flex;
  667. align-items: center;
  668. padding: 10rpx 30rpx 10rpx 40rpx;
  669. line-height: 70rpx;
  670. position: relative;
  671. &.cell-hover {
  672. background: #fafafa;
  673. }
  674. &.b-b:after {
  675. left: 30rpx;
  676. }
  677. .cell-icon {
  678. height: 32rpx;
  679. width: 32rpx;
  680. font-size: 22rpx;
  681. color: #fff;
  682. text-align: center;
  683. line-height: 32rpx;
  684. background: #f85e52;
  685. border-radius: 4rpx;
  686. margin-right: 12rpx;
  687. &.hb {
  688. background: #ffaa0e;
  689. }
  690. &.lpk {
  691. background: #3ab54a;
  692. }
  693. }
  694. .cell-more {
  695. align-self: center;
  696. font-size: 24rpx;
  697. color: $font-color-light;
  698. margin-left: 8rpx;
  699. margin-right: -10rpx;
  700. }
  701. .cell-tit {
  702. flex: 1;
  703. font-size: 26rpx;
  704. color: $font-color-light;
  705. margin-right: 10rpx;
  706. }
  707. .cell-tip {
  708. font-size: 26rpx;
  709. color: $font-color-dark;
  710. &.disabled {
  711. color: $font-color-light;
  712. }
  713. &.active {
  714. color: $base-color;
  715. }
  716. &.red {
  717. color: $base-color;
  718. }
  719. }
  720. &.desc-cell {
  721. .cell-tit {
  722. max-width: 90rpx;
  723. }
  724. }
  725. .desc {
  726. flex: 1;
  727. text-align: right;
  728. font-size: $font-base;
  729. color: $font-color-dark;
  730. }
  731. }
  732. /* 支付列表 */
  733. .pay-list {
  734. padding-left: 40rpx;
  735. margin-top: 16rpx;
  736. background: #fff;
  737. .pay-item {
  738. display: flex;
  739. align-items: center;
  740. padding-right: 20rpx;
  741. line-height: 1;
  742. height: 110rpx;
  743. position: relative;
  744. }
  745. .icon-weixinzhifu {
  746. width: 80rpx;
  747. font-size: 40rpx;
  748. color: #6bcc03;
  749. }
  750. .icon-alipay {
  751. width: 80rpx;
  752. font-size: 40rpx;
  753. color: #06b4fd;
  754. }
  755. .icon-xuanzhong2 {
  756. display: flex;
  757. align-items: center;
  758. justify-content: center;
  759. width: 60rpx;
  760. height: 60rpx;
  761. font-size: 40rpx;
  762. color: $base-color;
  763. }
  764. .tit {
  765. font-size: 32rpx;
  766. color: $font-color-dark;
  767. flex: 1;
  768. }
  769. }
  770. .footer {
  771. position: fixed;
  772. left: 0;
  773. bottom: 0;
  774. z-index: 995;
  775. display: flex;
  776. align-items: center;
  777. width: 100%;
  778. height: 90rpx;
  779. justify-content: space-between;
  780. font-size: 30rpx;
  781. background-color: #fff;
  782. z-index: 998;
  783. color: $font-color-base;
  784. box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
  785. .price-content {
  786. padding-left: 30rpx;
  787. }
  788. .price-tip {
  789. color: $font-color-base;
  790. margin-left: 8rpx;
  791. }
  792. .price {
  793. font-size: 36rpx;
  794. color: $font-color-base;
  795. }
  796. .submit {
  797. display: flex;
  798. align-items: center;
  799. justify-content: center;
  800. width: 280rpx;
  801. height: 100%;
  802. color: #fff;
  803. font-size: 32rpx;
  804. background-color: $base-color;
  805. &.submitNo {
  806. background-color: $font-color-disabled;
  807. }
  808. }
  809. }
  810. /* 优惠券面板 */
  811. .mask {
  812. display: flex;
  813. align-items: flex-end;
  814. position: fixed;
  815. left: 0;
  816. top: var(--window-top);
  817. bottom: 0;
  818. width: 100%;
  819. background: rgba(0, 0, 0, 0);
  820. z-index: 9995;
  821. transition: 0.3s;
  822. .mask-content {
  823. width: 100%;
  824. max-height: 70vh;
  825. background: #f3f3f3;
  826. transform: translateY(100%);
  827. transition: 0.3s;
  828. overflow-y: scroll;
  829. }
  830. &.none {
  831. display: none;
  832. }
  833. &.show {
  834. background: rgba(0, 0, 0, 0.4);
  835. .mask-content {
  836. transform: translateY(0);
  837. }
  838. }
  839. }
  840. /* 优惠券列表 */
  841. .coupon-item {
  842. display: flex;
  843. flex-direction: column;
  844. margin: 20rpx 24rpx;
  845. background: #fff;
  846. .con {
  847. display: flex;
  848. align-items: center;
  849. position: relative;
  850. height: 120rpx;
  851. padding: 0 30rpx;
  852. &:after {
  853. position: absolute;
  854. left: 0;
  855. bottom: 0;
  856. content: '';
  857. width: 100%;
  858. height: 0;
  859. border-bottom: 1px dashed #f3f3f3;
  860. transform: scaleY(50%);
  861. }
  862. }
  863. .left {
  864. display: flex;
  865. flex-direction: column;
  866. justify-content: center;
  867. flex: 1;
  868. overflow: hidden;
  869. height: 100rpx;
  870. }
  871. .title {
  872. font-size: 32rpx;
  873. color: $font-color-dark;
  874. margin-bottom: 10rpx;
  875. }
  876. .time {
  877. font-size: 24rpx;
  878. color: $font-color-light;
  879. }
  880. .right {
  881. display: flex;
  882. flex-direction: column;
  883. justify-content: center;
  884. align-items: center;
  885. font-size: 26rpx;
  886. color: $font-color-base;
  887. height: 100rpx;
  888. }
  889. .price {
  890. font-size: 44rpx;
  891. color: $base-color;
  892. &:before {
  893. content: '¥';
  894. font-size: 34rpx;
  895. }
  896. }
  897. .tips {
  898. font-size: 24rpx;
  899. color: $font-color-light;
  900. line-height: 60rpx;
  901. padding-left: 30rpx;
  902. }
  903. .circle {
  904. position: absolute;
  905. left: -6rpx;
  906. bottom: -10rpx;
  907. z-index: 10;
  908. width: 20rpx;
  909. height: 20rpx;
  910. background: #f3f3f3;
  911. border-radius: 100px;
  912. &.r {
  913. left: auto;
  914. right: -6rpx;
  915. }
  916. }
  917. }
  918. .personal {
  919. margin-top: 15rpx;
  920. display: flex;
  921. flex-direction: column;
  922. background-color: #ffffff;
  923. .box-right {
  924. width: 100%;
  925. font-size: 30rpx;
  926. text-align: right;
  927. padding-right: 25rpx;
  928. }
  929. .info {
  930. padding: 10rpx 25rpx;
  931. display: flex;
  932. align-items: center;
  933. font-size: 30rpx;
  934. justify-content: space-between;
  935. .name {
  936. width: 120rpx;
  937. flex-shrink: 0;
  938. }
  939. input {
  940. margin-left: 12rpx;
  941. width: 100%;
  942. // background-color: pink;
  943. display: block;
  944. color: #999999;
  945. }
  946. }
  947. }
  948. #list-box {
  949. .chose {
  950. margin-top: 25rpx;
  951. background-color: #ffffff;
  952. display: flex;
  953. justify-content: space-between;
  954. padding: 32rpx 24rpx;
  955. font-size: 30rpx;
  956. .title {
  957. color: #333;
  958. }
  959. .chose-name {
  960. display: flex;
  961. align-items: center;
  962. color: #ff4e4a;
  963. .img {
  964. width: 30rpx;
  965. height: 24rpx;
  966. image {
  967. width: 30rpx;
  968. height: 24rpx;
  969. display: inline;
  970. }
  971. }
  972. }
  973. }
  974. .personal {
  975. margin-top: 15rpx;
  976. display: flex;
  977. flex-direction: column;
  978. background-color: #ffffff;
  979. .box-right {
  980. width: 100%;
  981. font-size: 30rpx;
  982. text-align: right;
  983. padding-right: 25rpx;
  984. }
  985. .info {
  986. padding: 10rpx 25rpx;
  987. display: flex;
  988. align-items: center;
  989. font-size: 30rpx;
  990. justify-content: space-between;
  991. .name {
  992. width: 120rpx;
  993. }
  994. input {
  995. margin-left: 12rpx;
  996. width: 100%;
  997. // background-color: pink;
  998. display: block;
  999. color: #999999;
  1000. }
  1001. }
  1002. }
  1003. }
  1004. .stores-wrapper {
  1005. padding-top: 20rpx;
  1006. height: 100%;
  1007. }
  1008. .store {
  1009. width: 710rpx;
  1010. // height: 231rpx;
  1011. background: #ffffff;
  1012. box-shadow: 0px 0px 20rpx 0rpx rgba(50, 50, 52, 0.06);
  1013. border-radius: 10rpx;
  1014. // margin-bottom: 15rpx;
  1015. margin: 0 auto 15rpx;
  1016. position: relative;
  1017. padding: 25rpx 0 20rpx 20rpx;
  1018. .store-logo {
  1019. height: 65rpx;
  1020. font-size: 32rpx;
  1021. font-weight: bold;
  1022. color: #333333;
  1023. line-height: 65rpx;
  1024. // margin-bottom: 20rpx;
  1025. position: relative;
  1026. image {
  1027. width: 65rpx;
  1028. height: 65rpx;
  1029. border-radius: 50%;
  1030. }
  1031. .store-name {
  1032. max-width: 500rpx;
  1033. display: inline-block;
  1034. padding-left: 12rpx;
  1035. position: absolute;
  1036. top: 0;
  1037. }
  1038. }
  1039. .store-base {
  1040. height: 37rpx;
  1041. line-height: 37rpx;
  1042. font-size: 24rpx;
  1043. font-weight: bold;
  1044. color: #333333;
  1045. text {
  1046. font-weight: normal;
  1047. }
  1048. }
  1049. .store-lv {
  1050. display: inline-block;
  1051. // width: 60rpx;
  1052. padding: 0 10rpx;
  1053. height: 40rpx;
  1054. background: linear-gradient(-90deg, #dcb876 0%, #eecd92 100%);
  1055. border-radius: 5rpx;
  1056. text-align: center;
  1057. line-height: 40rpx;
  1058. color: #fff;
  1059. font-size: 23rpx;
  1060. position: absolute;
  1061. right: 20rpx;
  1062. top: 38rpx;
  1063. }
  1064. .store-can {
  1065. width: 113rpx;
  1066. height: 44rpx;
  1067. border: 2px solid #901b21;
  1068. border-radius: 5rpx;
  1069. font-size: 23rpx;
  1070. text-align: center;
  1071. line-height: 44rpx;
  1072. font-weight: 500;
  1073. color: #901b21;
  1074. position: absolute;
  1075. right: 20rpx;
  1076. bottom: 25rpx;
  1077. }
  1078. }
  1079. .store-list {
  1080. width: 750rpx;
  1081. max-height: 500rpx;
  1082. background-color: #fff;
  1083. z-index: 999;
  1084. }
  1085. </style>