createOrder.vue 29 KB

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