createOrder.vue 29 KB

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