createOrder.vue 30 KB

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