createOrder.vue 29 KB

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