createOrder.vue 29 KB

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