createOrder.vue 30 KB

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