createOrder.vue 29 KB

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