createOrder.vue 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186
  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. </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+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Rjk3RjkzMjM2NzMxMTFFOUI4RkU4OEZGMDcxQzgzOEYiIHhtcE1NOkRvY3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aS1WXzPHvjihzYS/lgshbeJ75WySHm7wNXXk8SbK/xutOX4ntHtYRxE0eJn6uARaGf6ie++7GPNxVkf/78AAwCn1+RYqusbZQAAAABJRU5ErkJggg==',
  223. // 当前选中的支付方式
  224. tabCurrentIndex: 0,
  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. is_pack: 0,
  272. is_zero: 0,
  273. affiliation_uid: 0,
  274. };
  275. },
  276. onLoad(option) {
  277. if(option.is_pack) {
  278. this.is_pack = option.is_pack
  279. }
  280. if(option.is_zero) {
  281. this.is_zero = option.is_zero
  282. }
  283. if(option.affiliation_uid) {
  284. this.affiliation_uid = option.affiliation_uid
  285. }
  286. // 判断是否为拼团商品
  287. if (option.type == 'pink') {
  288. this.pinkid = option.pinkId;
  289. this.cartAdd(option);
  290. } else {
  291. // 保存当前商品在购物车中的id
  292. this.cartId = option.id;
  293. this.loadData();
  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. if(this.is_zero) {
  465. url += '&is_zero=' + this.is_zero
  466. }
  467. if(this.is_pack) {
  468. url += '&is_pack=' + this.is_pack
  469. }
  470. uni.navigateTo({
  471. url
  472. });
  473. },
  474. selectPoint() {
  475. this.$refs.popupstore.open()
  476. },
  477. popchange(e) {
  478. this.showbtn = !e.show
  479. },
  480. chooseStore(item) {
  481. this.checkedPoint = item
  482. this.$refs.popupstore.close()
  483. }
  484. }
  485. };
  486. </script>
  487. <style lang="scss">
  488. page {
  489. background: $page-color-base;
  490. padding-bottom: 100rpx;
  491. }
  492. .navbar {
  493. display: flex;
  494. height: 80rpx;
  495. padding: 0 5px;
  496. background: #fff;
  497. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.06);
  498. position: relative;
  499. z-index: 10;
  500. .nav-item {
  501. flex: 1;
  502. display: flex;
  503. justify-content: center;
  504. align-items: center;
  505. height: 100%;
  506. font-size: $font-lg + 4rpx;
  507. color: $font-color-dark;
  508. position: relative;
  509. &.current {
  510. color: $base-color;
  511. &:after {
  512. content: '';
  513. position: absolute;
  514. left: 50%;
  515. bottom: 0;
  516. transform: translateX(-50%);
  517. width: 140rpx;
  518. height: 0;
  519. border-bottom: 2px solid $base-color;
  520. }
  521. }
  522. }
  523. }
  524. .address-section {
  525. padding: 30rpx 0;
  526. background: #fff;
  527. position: relative;
  528. border-top: 1px solid $border-color-light;
  529. .order-content {
  530. min-height: 100rpx;
  531. display: flex;
  532. align-items: center;
  533. .addAddress {
  534. text-align: center;
  535. width: 100%;
  536. display: flex;
  537. justify-content: center;
  538. align-items: center;
  539. .iconaddition {
  540. font-size: 55rpx;
  541. line-height: 1;
  542. border-radius: 100rpx;
  543. margin-right: 20rpx;
  544. }
  545. }
  546. }
  547. .iconlocation {
  548. flex-shrink: 0;
  549. display: flex;
  550. align-items: center;
  551. justify-content: center;
  552. width: 90rpx;
  553. color: #888;
  554. font-size: 44rpx;
  555. }
  556. .cen {
  557. display: flex;
  558. flex-direction: column;
  559. flex: 1;
  560. font-size: 28rpx;
  561. color: $font-color-dark;
  562. }
  563. .name {
  564. font-size: 34rpx;
  565. margin-right: 24rpx;
  566. }
  567. .address {
  568. margin-top: 16rpx;
  569. margin-right: 20rpx;
  570. color: $font-color-light;
  571. }
  572. .icon-you {
  573. font-size: 32rpx;
  574. color: $font-color-light;
  575. margin-right: 30rpx;
  576. }
  577. .a-bg {
  578. position: absolute;
  579. left: 0;
  580. bottom: 0;
  581. display: block;
  582. width: 100%;
  583. height: 5rpx;
  584. }
  585. }
  586. .goods-section {
  587. margin-top: 16rpx;
  588. background: #fff;
  589. padding-bottom: 1px;
  590. .g-header {
  591. display: flex;
  592. align-items: center;
  593. height: 84rpx;
  594. padding: 0 30rpx;
  595. position: relative;
  596. }
  597. .logo {
  598. display: block;
  599. width: 50rpx;
  600. height: 50rpx;
  601. border-radius: 100px;
  602. }
  603. .name {
  604. font-size: 30rpx;
  605. color: $font-color-base;
  606. margin-left: 24rpx;
  607. }
  608. .g-item {
  609. display: flex;
  610. margin: 20rpx 30rpx;
  611. image {
  612. flex-shrink: 0;
  613. display: block;
  614. width: 140rpx;
  615. height: 140rpx;
  616. border-radius: 4rpx;
  617. }
  618. .right {
  619. flex: 1;
  620. padding-left: 24rpx;
  621. overflow: hidden;
  622. }
  623. .title {
  624. font-size: 30rpx;
  625. color: $font-color-dark;
  626. }
  627. .spec {
  628. font-size: 26rpx;
  629. color: $font-color-light;
  630. }
  631. .price-box {
  632. display: flex;
  633. align-items: center;
  634. font-size: 32rpx;
  635. color: $font-color-dark;
  636. padding-top: 10rpx;
  637. .price {
  638. margin-bottom: 4rpx;
  639. color: $color-red;
  640. }
  641. .number {
  642. font-size: 26rpx;
  643. color: $font-color-base;
  644. margin-left: 20rpx;
  645. }
  646. }
  647. .step-box {
  648. position: relative;
  649. }
  650. }
  651. }
  652. .yt-list {
  653. margin-top: 16rpx;
  654. background: #fff;
  655. }
  656. .yt-list-cell {
  657. display: flex;
  658. align-items: center;
  659. padding: 10rpx 30rpx 10rpx 40rpx;
  660. line-height: 70rpx;
  661. position: relative;
  662. &.cell-hover {
  663. background: #fafafa;
  664. }
  665. &.b-b:after {
  666. left: 30rpx;
  667. }
  668. .cell-icon {
  669. height: 32rpx;
  670. width: 32rpx;
  671. font-size: 22rpx;
  672. color: #fff;
  673. text-align: center;
  674. line-height: 32rpx;
  675. background: #f85e52;
  676. border-radius: 4rpx;
  677. margin-right: 12rpx;
  678. &.hb {
  679. background: #ffaa0e;
  680. }
  681. &.lpk {
  682. background: #3ab54a;
  683. }
  684. }
  685. .cell-more {
  686. align-self: center;
  687. font-size: 24rpx;
  688. color: $font-color-light;
  689. margin-left: 8rpx;
  690. margin-right: -10rpx;
  691. }
  692. .cell-tit {
  693. flex: 1;
  694. font-size: 26rpx;
  695. color: $font-color-light;
  696. margin-right: 10rpx;
  697. }
  698. .cell-tip {
  699. font-size: 26rpx;
  700. color: $font-color-dark;
  701. &.disabled {
  702. color: $font-color-light;
  703. }
  704. &.active {
  705. color: $base-color;
  706. }
  707. &.red {
  708. color: $base-color;
  709. }
  710. }
  711. &.desc-cell {
  712. .cell-tit {
  713. max-width: 90rpx;
  714. }
  715. }
  716. .desc {
  717. flex: 1;
  718. text-align: right;
  719. font-size: $font-base;
  720. color: $font-color-dark;
  721. }
  722. }
  723. /* 支付列表 */
  724. .pay-list {
  725. padding-left: 40rpx;
  726. margin-top: 16rpx;
  727. background: #fff;
  728. .pay-item {
  729. display: flex;
  730. align-items: center;
  731. padding-right: 20rpx;
  732. line-height: 1;
  733. height: 110rpx;
  734. position: relative;
  735. }
  736. .icon-weixinzhifu {
  737. width: 80rpx;
  738. font-size: 40rpx;
  739. color: #6bcc03;
  740. }
  741. .icon-alipay {
  742. width: 80rpx;
  743. font-size: 40rpx;
  744. color: #06b4fd;
  745. }
  746. .icon-xuanzhong2 {
  747. display: flex;
  748. align-items: center;
  749. justify-content: center;
  750. width: 60rpx;
  751. height: 60rpx;
  752. font-size: 40rpx;
  753. color: $base-color;
  754. }
  755. .tit {
  756. font-size: 32rpx;
  757. color: $font-color-dark;
  758. flex: 1;
  759. }
  760. }
  761. .footer {
  762. position: fixed;
  763. left: 0;
  764. bottom: 0;
  765. z-index: 995;
  766. display: flex;
  767. align-items: center;
  768. width: 100%;
  769. height: 90rpx;
  770. justify-content: space-between;
  771. font-size: 30rpx;
  772. background-color: #fff;
  773. z-index: 998;
  774. color: $font-color-base;
  775. box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
  776. .price-content {
  777. padding-left: 30rpx;
  778. }
  779. .price-tip {
  780. color: $font-color-base;
  781. margin-left: 8rpx;
  782. }
  783. .price {
  784. font-size: 36rpx;
  785. color: $font-color-base;
  786. }
  787. .submit {
  788. display: flex;
  789. align-items: center;
  790. justify-content: center;
  791. width: 280rpx;
  792. height: 100%;
  793. color: #fff;
  794. font-size: 32rpx;
  795. background-color: $base-color;
  796. &.submitNo {
  797. background-color: $font-color-disabled;
  798. }
  799. }
  800. }
  801. /* 优惠券面板 */
  802. .mask {
  803. display: flex;
  804. align-items: flex-end;
  805. position: fixed;
  806. left: 0;
  807. top: var(--window-top);
  808. bottom: 0;
  809. width: 100%;
  810. background: rgba(0, 0, 0, 0);
  811. z-index: 9995;
  812. transition: 0.3s;
  813. .mask-content {
  814. width: 100%;
  815. max-height: 70vh;
  816. background: #f3f3f3;
  817. transform: translateY(100%);
  818. transition: 0.3s;
  819. overflow-y: scroll;
  820. }
  821. &.none {
  822. display: none;
  823. }
  824. &.show {
  825. background: rgba(0, 0, 0, 0.4);
  826. .mask-content {
  827. transform: translateY(0);
  828. }
  829. }
  830. }
  831. /* 优惠券列表 */
  832. .coupon-item {
  833. display: flex;
  834. flex-direction: column;
  835. margin: 20rpx 24rpx;
  836. background: #fff;
  837. .con {
  838. display: flex;
  839. align-items: center;
  840. position: relative;
  841. height: 120rpx;
  842. padding: 0 30rpx;
  843. &:after {
  844. position: absolute;
  845. left: 0;
  846. bottom: 0;
  847. content: '';
  848. width: 100%;
  849. height: 0;
  850. border-bottom: 1px dashed #f3f3f3;
  851. transform: scaleY(50%);
  852. }
  853. }
  854. .left {
  855. display: flex;
  856. flex-direction: column;
  857. justify-content: center;
  858. flex: 1;
  859. overflow: hidden;
  860. height: 100rpx;
  861. }
  862. .title {
  863. font-size: 32rpx;
  864. color: $font-color-dark;
  865. margin-bottom: 10rpx;
  866. }
  867. .time {
  868. font-size: 24rpx;
  869. color: $font-color-light;
  870. }
  871. .right {
  872. display: flex;
  873. flex-direction: column;
  874. justify-content: center;
  875. align-items: center;
  876. font-size: 26rpx;
  877. color: $font-color-base;
  878. height: 100rpx;
  879. }
  880. .price {
  881. font-size: 44rpx;
  882. color: $base-color;
  883. &:before {
  884. content: '¥';
  885. font-size: 34rpx;
  886. }
  887. }
  888. .tips {
  889. font-size: 24rpx;
  890. color: $font-color-light;
  891. line-height: 60rpx;
  892. padding-left: 30rpx;
  893. }
  894. .circle {
  895. position: absolute;
  896. left: -6rpx;
  897. bottom: -10rpx;
  898. z-index: 10;
  899. width: 20rpx;
  900. height: 20rpx;
  901. background: #f3f3f3;
  902. border-radius: 100px;
  903. &.r {
  904. left: auto;
  905. right: -6rpx;
  906. }
  907. }
  908. }
  909. .personal {
  910. margin-top: 15rpx;
  911. display: flex;
  912. flex-direction: column;
  913. background-color: #ffffff;
  914. .box-right {
  915. width: 100%;
  916. font-size: 30rpx;
  917. text-align: right;
  918. padding-right: 25rpx;
  919. }
  920. .info {
  921. padding: 10rpx 25rpx;
  922. display: flex;
  923. align-items: center;
  924. font-size: 30rpx;
  925. justify-content: space-between;
  926. .name {
  927. width: 120rpx;
  928. flex-shrink: 0;
  929. }
  930. input {
  931. margin-left: 12rpx;
  932. width: 100%;
  933. // background-color: pink;
  934. display: block;
  935. color: #999999;
  936. }
  937. }
  938. }
  939. #list-box {
  940. .chose {
  941. margin-top: 25rpx;
  942. background-color: #ffffff;
  943. display: flex;
  944. justify-content: space-between;
  945. padding: 32rpx 24rpx;
  946. font-size: 30rpx;
  947. .title {
  948. color: #333;
  949. }
  950. .chose-name {
  951. display: flex;
  952. align-items: center;
  953. color: #ff4e4a;
  954. .img {
  955. width: 30rpx;
  956. height: 24rpx;
  957. image {
  958. width: 30rpx;
  959. height: 24rpx;
  960. display: inline;
  961. }
  962. }
  963. }
  964. }
  965. .personal {
  966. margin-top: 15rpx;
  967. display: flex;
  968. flex-direction: column;
  969. background-color: #ffffff;
  970. .box-right {
  971. width: 100%;
  972. font-size: 30rpx;
  973. text-align: right;
  974. padding-right: 25rpx;
  975. }
  976. .info {
  977. padding: 10rpx 25rpx;
  978. display: flex;
  979. align-items: center;
  980. font-size: 30rpx;
  981. justify-content: space-between;
  982. .name {
  983. width: 120rpx;
  984. }
  985. input {
  986. margin-left: 12rpx;
  987. width: 100%;
  988. // background-color: pink;
  989. display: block;
  990. color: #999999;
  991. }
  992. }
  993. }
  994. }
  995. .stores-wrapper {
  996. padding-top: 20rpx;
  997. height: 100%;
  998. }
  999. .store {
  1000. width: 710rpx;
  1001. // height: 231rpx;
  1002. background: #ffffff;
  1003. box-shadow: 0px 0px 20rpx 0rpx rgba(50, 50, 52, 0.06);
  1004. border-radius: 10rpx;
  1005. // margin-bottom: 15rpx;
  1006. margin: 0 auto 15rpx;
  1007. position: relative;
  1008. padding: 25rpx 0 20rpx 20rpx;
  1009. .store-logo {
  1010. height: 65rpx;
  1011. font-size: 32rpx;
  1012. font-weight: bold;
  1013. color: #333333;
  1014. line-height: 65rpx;
  1015. // margin-bottom: 20rpx;
  1016. position: relative;
  1017. image {
  1018. width: 65rpx;
  1019. height: 65rpx;
  1020. border-radius: 50%;
  1021. }
  1022. .store-name {
  1023. max-width: 500rpx;
  1024. display: inline-block;
  1025. padding-left: 12rpx;
  1026. position: absolute;
  1027. top: 0;
  1028. }
  1029. }
  1030. .store-base {
  1031. height: 37rpx;
  1032. line-height: 37rpx;
  1033. font-size: 24rpx;
  1034. font-weight: bold;
  1035. color: #333333;
  1036. text {
  1037. font-weight: normal;
  1038. }
  1039. }
  1040. .store-lv {
  1041. display: inline-block;
  1042. // width: 60rpx;
  1043. padding: 0 10rpx;
  1044. height: 40rpx;
  1045. background: linear-gradient(-90deg, #dcb876 0%, #eecd92 100%);
  1046. border-radius: 5rpx;
  1047. text-align: center;
  1048. line-height: 40rpx;
  1049. color: #fff;
  1050. font-size: 23rpx;
  1051. position: absolute;
  1052. right: 20rpx;
  1053. top: 38rpx;
  1054. }
  1055. .store-can {
  1056. width: 113rpx;
  1057. height: 44rpx;
  1058. border: 2px solid #901b21;
  1059. border-radius: 5rpx;
  1060. font-size: 23rpx;
  1061. text-align: center;
  1062. line-height: 44rpx;
  1063. font-weight: 500;
  1064. color: #901b21;
  1065. position: absolute;
  1066. right: 20rpx;
  1067. bottom: 25rpx;
  1068. }
  1069. }
  1070. .store-list {
  1071. width: 750rpx;
  1072. max-height: 500rpx;
  1073. background-color: #fff;
  1074. z-index: 999;
  1075. }
  1076. </style>