createOrder.vue 29 KB

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