createOrder.vue 29 KB

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