confirm.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. <template>
  2. <view class="page">
  3. <view class="pro-sec flex-row justify-between section_3">
  4. <view class="flex-row">
  5. <image src="/static/temp/pro.png" class="image_5" mode="aspectFill" />
  6. <view class="flex-col group_7">
  7. <view class="flex-col items-start">
  8. <text class="text_2 clamp">幸福西饼Rice盲盒</text>
  9. <view class="stars align-center"><image src="/static/mang_star.png" class="image_6" v-for="(item, idx) in 3" :key="idx" /></view>
  10. </view>
  11. <view class="group_9">
  12. <text class="text_3">¥</text>
  13. <text class="text_4">149.00</text>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="flex-col items-end group_10">
  18. <text class="text_7">随机搭配</text>
  19. <!-- <text class="text_8">*1</text> -->
  20. <uni-number-box
  21. class="step"
  22. :min="1"
  23. :max="stock"
  24. :disabled="number >= stock"
  25. :value="number"
  26. :isMax="number >= stock ? true : false"
  27. :isMin="number === 1"
  28. @eventChange="numberChange"
  29. ></uni-number-box>
  30. </view>
  31. </view>
  32. <view class="loc-sec flex-col">
  33. <view class="flex-row section_5">
  34. <view class="flex-col items-start group_11">
  35. <text class="text_9 clamp">幸福西饼万达店</text>
  36. <text class="text_11 clamp2">长安路与香港路交汇处万达广场3楼1104</text>
  37. </view>
  38. <view class="align-center group_12">
  39. <view class="section_6"></view>
  40. <image
  41. src="/static/confirm-phone.png"
  42. class="image_7"
  43. />
  44. </view>
  45. </view>
  46. <view class="flex-row justify-between group_13">
  47. <text class="text_12">自提时间</text>
  48. <view class="flex-row" @tap="openTime">
  49. <text class="text_14" :class="{active: show_time}">{{show_time? show_time : '请选择'}}</text>
  50. <image
  51. src="/static/confirm-rarrow.png"
  52. class="image_8"
  53. />
  54. </view>
  55. </view>
  56. </view>
  57. <view class="price-sec flex-col">
  58. <view class="flex-row justify-between group_15">
  59. <text class="text_16">商品总额</text>
  60. <text class="text_17">¥149.00</text>
  61. </view>
  62. <view class="flex-row justify-between group_13">
  63. <text class="text_12">优惠券</text>
  64. <view class="flex-row group_16" @tap="showCoupons">
  65. <text class="text_14">请选择</text>
  66. <image
  67. src="/static/confirm-rarrow.png"
  68. class="image_8"
  69. />
  70. </view>
  71. </view>
  72. </view>
  73. <view class="note-sec flex-col">
  74. <text class="text_20">订单备注</text>
  75. <view class="flex-col items-start text-wrapper">
  76. <textarea class="area" placeholder="请输入备注信息"></textarea>
  77. </view>
  78. </view>
  79. <safeArea height="128rpx">
  80. <template v-slot:btn>
  81. <view class="btn-wrap justify-between">
  82. <view class="align-center group_17">
  83. <text class="text_22">待支付</text>
  84. <view class="group_18 align-center">
  85. <text class="text_23">¥</text>
  86. <text class="text_24 clamp">151.00</text>
  87. </view>
  88. </view>
  89. <view class="flex-col items-center text-wrapper_1"><text class="text_25">立即支付</text></view>
  90. </view>
  91. </template>
  92. </safeArea>
  93. <datetime @rundata="getTime" ref="timeRef" :end='enddate' :start='startdate' default='start'></datetime>
  94. <popup ref="couponRef" type="bottom">
  95. <view class="coupon-panel">
  96. <view class="cancel-wrap align-center justify-center">
  97. <text class="zicon zicon-quxiao ic" @tap="hideCoupons"></text>
  98. </view>
  99. <view class="title-wrap">
  100. 选择优惠券
  101. </view>
  102. <view class="content-wrap">
  103. <scroll-view scroll-y="true" class="scroll">
  104. <view class="item flex-col justify-center" v-for="(item,idx) in 10" :key="idx">
  105. <view class="name clamp">店铺优惠1</view>
  106. <view class="tips">
  107. <text class="stxt">消费金额</text>
  108. <text class="mtxt">满30减5</text>
  109. </view>
  110. </view>
  111. </scroll-view>
  112. </view>
  113. </view>
  114. </popup>
  115. </view>
  116. </template>
  117. <script>
  118. import uniNumberBox from './components/uni-number-box.vue';
  119. import datetime from './components/datetime.vue';
  120. export default {
  121. components: {
  122. uniNumberBox,
  123. datetime
  124. },
  125. data() {
  126. return {
  127. stock: 10000,
  128. number: 1,
  129. show_time:'', //自提时间
  130. couponList: [], //优惠券列表
  131. useCouponIndex: -1,
  132. coupon_price: 0.0, //优惠券金额
  133. price: 0.0, //商品金额
  134. total: 0.0 ,//实付金额
  135. startdate: '',
  136. enddate: '2042-05-30 23:59',
  137. };
  138. },
  139. onLoad() {
  140. let date = new Date();
  141. this.startdate = this.handleDatetime(date);
  142. },
  143. methods: {
  144. //数量
  145. async numberChange(data) {
  146. //number,index
  147. this.number = data.number;
  148. this.calcTotal();
  149. },
  150. // 计算价格
  151. calcTotal() {
  152. let price = 0;
  153. let number = 0; // 产品数量
  154. //计算出当前产品price,number
  155. this.price = price.toFixed(2);
  156. let total = price;
  157. // 检查当前优惠券是否满足使用条件
  158. this.coupon_price = 0.0;
  159. if (this.useCouponIndex != -1 && this.couponList && this.couponList[this.useCouponIndex]) {
  160. this.coupon_price = this.couponList[this.useCouponIndex].value;
  161. if (this.price >= this.couponList[this.useCouponIndex].least) {
  162. total = total - this.coupon_price;
  163. } else {
  164. this.$tools.msg('选中的优惠券不满足使用条件', 2000);
  165. this.useCouponIndex = -1; //取消选中的优惠券
  166. this.coupon_price = 0; //设置优惠金额为0
  167. total = total - this.coupon_price;
  168. }
  169. }
  170. },
  171. //时间
  172. handleStrLength(num){
  173. return String(num).length < 2 ? '0' + num : num;
  174. },
  175. handleDatetime(date){
  176. let m = this.handleStrLength(date.getMonth() + 1);
  177. let d = this.handleStrLength(date.getDate());
  178. let h = this.handleStrLength(date.getHours());
  179. let mm = this.handleStrLength(date.getMinutes());
  180. let dateStr = date.getFullYear() + "-" + m + "-" + d + " " + h + ":" + mm;
  181. return dateStr;
  182. },
  183. getTime(e){
  184. this.show_time=e;
  185. // var date= new Date(e.replace(/-/g, "/"));
  186. },
  187. openTime(){
  188. this.$refs.timeRef.open();
  189. },
  190. showCoupons(){
  191. this.$refs.couponRef.show();
  192. },
  193. hideCoupons(){
  194. this.$refs.couponRef.hide();
  195. },
  196. }
  197. };
  198. </script>
  199. <style lang="scss">
  200. page {
  201. background-color: #f8f8f8;
  202. }
  203. .page {
  204. padding: 20rpx 30rpx;
  205. }
  206. .pro-sec {
  207. padding: 22rpx 17rpx 24rpx 20rpx;
  208. background-color: #ffffff;
  209. box-shadow: 0px 6rpx 10rpx #2a2a2a14;
  210. border-radius: 20rpx;
  211. margin-bottom: 20rpx;
  212. position: relative;
  213. .image_5 {
  214. width: 154rpx;
  215. height: 154rpx;
  216. }
  217. .group_7 {
  218. margin-left: 15rpx;
  219. margin-bottom: 10rpx;
  220. }
  221. .text_2 {
  222. color: #333333;
  223. font-size: 30rpx;
  224. font-family: PingFang;
  225. max-width: 370rpx;
  226. }
  227. .image_6 {
  228. margin-top: 10rpx;
  229. width: 28rpx;
  230. height: 28rpx;
  231. margin-right: 4rpx;
  232. }
  233. .group_9 {
  234. margin-top: 51rpx;
  235. align-self: flex-start;
  236. line-height: 28rpx;
  237. }
  238. .text_3 {
  239. color: #fc4d37;
  240. font-size: 30rpx;
  241. font-family: PingFang;
  242. letter-spacing: 1.2rpx;
  243. }
  244. .text_4 {
  245. color: #fc4d37;
  246. font-size: 36rpx;
  247. font-family: PingFang;
  248. letter-spacing: 1.44rpx;
  249. }
  250. .group_10 {
  251. margin: 4rpx 0 5rpx;
  252. }
  253. .text_7 {
  254. color: #999999;
  255. font-size: 24rpx;
  256. font-family: PingFang;
  257. }
  258. .text_8 {
  259. margin-top: 106rpx;
  260. color: #999999;
  261. font-size: 24rpx;
  262. font-family: PingFang;
  263. line-height: 18rpx;
  264. }
  265. .step {
  266. margin-top: 86rpx;
  267. }
  268. }
  269. .loc-sec{
  270. margin-top: 24rpx;
  271. padding: 30rpx 20rpx 0 24rpx;
  272. background-color: #ffffff;
  273. box-shadow: 0px 6rpx 10rpx #2a2a2a14;
  274. border-radius: 20rpx;
  275. .section_5 {
  276. padding: 27rpx 20rpx 24rpx;
  277. background-color: #f7f7f7;
  278. border-radius: 10rpx;
  279. }
  280. .group_11 {
  281. margin-bottom: 6rpx;
  282. flex: 1 1 auto;
  283. }
  284. .text_9 {
  285. color: #333333;
  286. font-size: 30rpx;
  287. font-family: PingFang;
  288. max-width: 500rpx;
  289. }
  290. .text_11 {
  291. margin-top: 20rpx;
  292. color: #666666;
  293. font-size: 24rpx;
  294. font-family: PingFang;
  295. line-height: 36rpx;
  296. max-width: 500rpx;
  297. }
  298. .group_12 {
  299. margin-left: 40rpx;
  300. margin-right: 10rpx;
  301. flex-shrink: 0;
  302. }
  303. .section_6 {
  304. background-color: #0000001a;
  305. width: 1rpx;
  306. height: 80rpx;
  307. }
  308. .image_7 {
  309. margin-left: 30rpx;
  310. align-self: center;
  311. width: 48rpx;
  312. height: 48rpx;
  313. }
  314. .group_13 {
  315. padding: 40rpx 0;
  316. }
  317. .text_12 {
  318. color: #333333;
  319. font-size: 30rpx;
  320. font-family: PingFang;
  321. line-height: 28rpx;
  322. letter-spacing: 1.2rpx;
  323. }
  324. .text_14 {
  325. color: #999999;
  326. font-size: 28rpx;
  327. font-family: PingFang;
  328. &.active{
  329. color: #333;
  330. }
  331. }
  332. .image_8 {
  333. margin: 4rpx 0 4rpx 11rpx;
  334. flex-shrink: 0;
  335. width: 10rpx;
  336. height: 18rpx;
  337. }
  338. }
  339. .price-sec{
  340. margin-top: 24rpx;
  341. padding-left: 21rpx;
  342. padding-right: 12rpx;
  343. background-color: #ffffff;
  344. box-shadow: 0px 6rpx 10rpx #2a2a2a14;
  345. border-radius: 20rpx;
  346. .group_15 {
  347. padding: 40rpx 0;
  348. border-bottom: solid 2rpx #0000001a;
  349. }
  350. .text_16 {
  351. color: #333333;
  352. font-size: 30rpx;
  353. font-family: PingFang;
  354. letter-spacing: 1.2rpx;
  355. }
  356. .text_17 {
  357. margin-bottom: 3rpx;
  358. color: #333333;
  359. font-size: 30rpx;
  360. font-family: PingFang;
  361. }
  362. .group_13 {
  363. padding: 40rpx 0;
  364. }
  365. .text_12 {
  366. color: #333333;
  367. font-size: 30rpx;
  368. font-family: PingFang;
  369. line-height: 28rpx;
  370. letter-spacing: 1.2rpx;
  371. }
  372. .group_16 {
  373. margin-right: 8rpx;
  374. }
  375. .text_14 {
  376. color: #999999;
  377. font-size: 28rpx;
  378. font-family: PingFang;
  379. line-height: 26rpx;
  380. }
  381. .image_8 {
  382. margin: 4rpx 0 4rpx 11rpx;
  383. flex-shrink: 0;
  384. width: 10rpx;
  385. height: 18rpx;
  386. }
  387. }
  388. .note-sec{
  389. margin-top: 24rpx;
  390. padding: 40rpx 20rpx 40rpx 21rpx;
  391. background-color: #ffffff;
  392. box-shadow: 0px 6rpx 10rpx #2a2a2a14;
  393. border-radius: 20rpx;
  394. .text_20 {
  395. align-self: flex-start;
  396. color: #333333;
  397. font-size: 30rpx;
  398. font-family: PingFang;
  399. letter-spacing: 1.2rpx;
  400. }
  401. .text-wrapper {
  402. margin-left: 3rpx;
  403. margin-top: 30rpx;
  404. background-color: #f7f7f7;
  405. border-radius: 10rpx;
  406. .area{
  407. padding: 18rpx;
  408. font-size: 24rpx;
  409. color: #333;
  410. line-height: 36rpx;
  411. width: 646rpx;
  412. height: 147rpx;
  413. }
  414. }
  415. }
  416. .btn-wrap{
  417. padding: 32rpx 20rpx 20rpx 29rpx;
  418. background-color: #ffffff;
  419. box-shadow: 0px 0px 14rpx #0000001a;
  420. height: 128rpx;
  421. .group_17 {
  422. align-self: center;
  423. }
  424. .text_22 {
  425. color: #999999;
  426. font-size: 28rpx;
  427. font-family: PingFang;
  428. }
  429. .group_18 {
  430. margin-left: 11rpx;
  431. line-height: 28rpx;
  432. height: 29rpx;
  433. }
  434. .text_23 {
  435. color: #ff342e;
  436. font-size: 28rpx;
  437. font-family: PingFang;
  438. }
  439. .text_24 {
  440. color: #ff342e;
  441. font-size: 36rpx;
  442. font-family: PingFang;
  443. max-width: 320rpx;
  444. }
  445. .text-wrapper_1 {
  446. padding: 24rpx 0 23rpx;
  447. background-color: #92b99c;
  448. border-radius: 38rpx;
  449. width: 228rpx;
  450. height: 76rpx;
  451. }
  452. .text_25 {
  453. color: #ffffff;
  454. font-size: 30rpx;
  455. font-family: PingFang;
  456. }
  457. }
  458. .coupon-panel{
  459. width: 750rpx;
  460. // height: 441rpx;
  461. background: #FFFFFF;
  462. border-radius: 20rpx 20rpx 0rpx 0rpx;
  463. position: relative;
  464. .cancel-wrap{
  465. width: 68rpx;
  466. height: 68rpx;
  467. position: absolute;
  468. right: 0;
  469. top: 0;
  470. z-index: 2;
  471. .ic{
  472. font-size: 24rpx;
  473. color: #999;
  474. }
  475. }
  476. .title-wrap{
  477. height: 92rpx;
  478. line-height: 92rpx;
  479. text-align: center;
  480. font-size: 34rpx;
  481. font-family: PingFang SC;
  482. font-weight: bold;
  483. color: #333333;
  484. }
  485. .content-wrap{
  486. padding: 30rpx;
  487. // padding-bottom: 30rpx + calc( var(--safe-area-inset-bottom) / 2);
  488. .scroll{
  489. min-height: 350rpx;
  490. max-height: 600rpx;
  491. }
  492. .item{
  493. width: 690rpx;
  494. height: 133rpx;
  495. background: #F5F5F5;
  496. border-radius: 10rpx;
  497. margin-bottom: 20rpx;
  498. padding: 0 30rpx;
  499. }
  500. .name{
  501. font-size: 32rpx;
  502. font-family: PingFang SC;
  503. font-weight: bold;
  504. color: #333333;
  505. }
  506. .tips{
  507. margin-top: 24rpx;
  508. font-size: 26rpx;
  509. font-family: PingFang SC;
  510. font-weight: 500;
  511. color: #666666;
  512. .mtxt{
  513. color:$base-color;
  514. }
  515. }
  516. }
  517. }
  518. </style>