createOrder.vue 24 KB

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