createOrder.vue 29 KB

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