createOrder.vue 24 KB

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