createOrder.vue 29 KB

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