createOrder.vue 27 KB

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