createOrder.vue 28 KB

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