createOrder.vue 23 KB

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