uptickOrder.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. <template>
  2. <view class="container">
  3. <view class="content-box">
  4. <!-- <view class="message-box">
  5. <view class="message-item">
  6. <view class="item-left"> 订购人电话 </view>
  7. <view class="item-right">
  8. <u--input border='none' type='number' maxlength='11' fontSize='14' placeholder="请输入您的订购电话"
  9. v-model="phoneNumber"></u--input>
  10. </view>
  11. </view>
  12. <u-line margin='20rpx 0'></u-line>
  13. <view class="message-item">
  14. <view class="item-left"> 备注 </view>
  15. <view class="item-right">
  16. <u--textarea v-model="goodsRemark" placeholder="请输入备注内容" autoHeight></u--textarea>
  17. </view>
  18. </view>
  19. </view> -->
  20. <view class="message-box">
  21. <view class="message-item">
  22. <view class="item-left"> 支付方式 </view>
  23. <view class="item-right flex-end">
  24. <span>在线支付</span>
  25. <image class="right-img" src="@/static/order/ic_order_weixin.png"></image>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="message-box">
  30. <view class="goods-title"> {{ init_list.merchantDTO.name }} </view>
  31. <u-line margin='20rpx 0'></u-line>
  32. <view class="goods-item" v-for="(item,index) of init_list.cartItems" :key='item.goodsId'>
  33. <view class="item-left">
  34. <image class="left-img" src="@/static/QR57a.jpg"></image>
  35. <view class="left-text">
  36. <view class="text-name">{{ item.goodsName }}</view>
  37. <view class="text-number">×{{ item.quantity }}</view>
  38. <view class="price-box">
  39. <p class="price red-color"> <span style="font-size: 24rpx;">¥</span>{{ item.price }}</p><span
  40. class="false-price">¥{{ item.originalPrice ? item.originalPrice : 0}}</span>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="item-right">
  45. <u-number-box v-model="item.quantity"></u-number-box>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="message-box">
  50. <view class="couon-box">
  51. <view class="coupon-left">
  52. <image class="img" src='@/static/images/coupon.png'></image>
  53. <view>通用优惠</view>
  54. </view>
  55. <view class="coupon-right red-color"> -0.1 </view>
  56. </view>
  57. <u-line margin='20rpx 0'></u-line>
  58. <view class="couon-box" @click="openCouponshow">
  59. <view class="coupon-left">
  60. <image class="img" src='@/static/images/coupon.png'></image>
  61. <span>商家优惠券</span>
  62. </view>
  63. <view class="coupon-right" >
  64. <view class="">暂无可用</view>
  65. <u-icon name="arrow-right" size='13'></u-icon>
  66. </view>
  67. </view>
  68. </view>
  69. <view class="message-box">
  70. <view class="message-item">
  71. <view class="item-left"> 订单总价 </view>
  72. <view class=" flex-end red-color" style="align-items: center;">
  73. <p style="margin-right: 20rpx; font-size: 36rpx; font-weight: bold;">¥{{ orderParams.price.toFixed(2) }}</p>
  74. <p>( 已优惠¥{{ orderParams.allPrice.toFixed(2) }} )</p>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="message-box">
  79. <view class="message-name"> 购买须知 </view>
  80. <view class="message-text" style="text-indent:32.4px;">
  81. 洗车机常见的类型有高压洗车机和无水洗车机两种,高压洗车机可以配有不同的喷嘴,可实现不同场景下的清洗需求。
  82. 无水洗车机则是一种更为环保的洗车方式,它可以用高科技的化学技术在不用水的情况下清洗车辆。因此,
  83. 在购买洗车机时需要根据自己的实际需求进行选择
  84. </view>
  85. </view>
  86. </view>
  87. <u-popup :show="coupon_show" @close="close" mode='bottom' round='20' bgColor='#F4F4F4'>
  88. <view class="pop-box">
  89. <view class="pop-title"> 商家优惠券 </view>
  90. <u-line margin='20rpx 0'></u-line>
  91. <view class="pop-coupon-box">
  92. <view class="pop-item" v-for="(item,index) of coupon_list" @click="handlerSelectCoupon(item,index)">
  93. <view class="item-box">
  94. <view class="item-left">
  95. <view class="img-box">
  96. <image class="left-img" :src="item.img"></image>
  97. </view>
  98. <view class="left-text">
  99. <view class="text-title"> {{ item.name }} </view>
  100. <view class="text"> {{ item.time_text }} </view>
  101. </view>
  102. </view>
  103. <view class="item-right">
  104. <view class="price red-color">
  105. <span class="price-symbol">¥</span> {{ item.price }}
  106. </view>
  107. <view class="text"> {{ item.deduce_text }} </view>
  108. </view>
  109. </view>
  110. <view class="item-bottom">
  111. <span>{{ item.discript }}</span>
  112. </view>
  113. </view>
  114. </view>
  115. <view class="pop-bottom">
  116. <button class='coupon-btn' @click="handlerSelectCoupon">确定</button>
  117. </view>
  118. </view>
  119. </u-popup>
  120. <view class="btn-box">
  121. <view class="btn" @click="handlerSettleBtn">
  122. 结算
  123. </view>
  124. </view>
  125. </view>
  126. </template>
  127. <script>
  128. import { generateOrder ,getCartList , generateConfirmOrder} from "@/api/client/business.js"
  129. import { maintainCouponPaging } from "@/api/client/mine.js"
  130. export default {
  131. data() {
  132. return {
  133. coupon_show: false,
  134. coupon_list:[
  135. {
  136. id:1,
  137. img:'../../../static/images/honglei.png',
  138. name:'无反不做(无饭不做美工饭)',
  139. time_text:'有效期至2024.02.32',
  140. price:34,
  141. deduce_text:'满23可用',
  142. discript:'可以与其他活动共享,在线支付指定门店使用'
  143. },
  144. {
  145. id:3,
  146. img:'../../../static/images/honglei.png',
  147. name:'我不知道叫啥名儿嗷',
  148. time_text:'有效期至2024.03.01',
  149. price:2,
  150. deduce_text:'满5可用',
  151. discript:'可以与其他活动共享,在线支付指定门店使用'
  152. },
  153. {
  154. id:5,
  155. img:'../../../static/images/honglei.png',
  156. name:'红雷卖瓜',
  157. time_text:'有效期至2024.03.01',
  158. price:1,
  159. deduce_text:'满65可用',
  160. discript:'可以与其他活动共享,在线支付指定门店使用'
  161. }
  162. ],
  163. init_list:[],
  164. phoneNumber:null ,// 订购电话
  165. goodsRemark:'' ,// 备注
  166. merchantId:null
  167. }
  168. },
  169. mounted(){
  170. this.handlerInitList()
  171. },
  172. onLoad(option){
  173. this.merchantId = option.ids
  174. },
  175. computed: {
  176. orderParams(){
  177. let price = 0
  178. let discountPrice = 0
  179. let allPrice = 0
  180. this.init_list.cartItems.map(rs=>{
  181. price += Number( rs.price * rs.quantity )
  182. discountPrice += Number( rs.originalPrice * rs.quantity )
  183. })
  184. allPrice = discountPrice - price
  185. return { allPrice , price }
  186. }
  187. },
  188. methods:{
  189. // 初始化列表接口
  190. handlerInitList(){
  191. getCartList(this.merchantId).then(res=>{
  192. this.init_list = res.data
  193. this.handlerInitCouponList(res.data.cartItems)
  194. })
  195. },
  196. // 初始化优惠券列表
  197. handlerInitCouponList(cartItems){
  198. let params = {
  199. cartIds:[],
  200. merchantId:this.merchantId
  201. }
  202. cartItems.map(rs=>{
  203. params.cartIds.push(rs.id)
  204. })
  205. // 订单接口 - 根据购物车信息生成确认单信息
  206. generateConfirmOrder(params).then(res=>{
  207. console.log("@@@@res",res);
  208. })
  209. // maintainCouponPaging( params ).then(res=>{
  210. // console.log('@@@@res',res)
  211. // })
  212. },
  213. // 结算按钮
  214. handlerSettleBtn(){
  215. let params = {
  216. payType:'2',
  217. cartIds:[],
  218. merchantId:this.init_list.merchantDTO.id
  219. }
  220. this.init_list.cartItems.map(rs=>{
  221. params.cartIds.push(rs.goodsId)
  222. })
  223. generateOrder(params).then(res=>{
  224. if(res.code == 200){
  225. uni.navigateTo({
  226. url:'/pages/client/clientPackage/settleStatusPage'
  227. })
  228. }else{
  229. uni.showToast({
  230. title:res.msg,
  231. })
  232. return
  233. }
  234. })
  235. },
  236. // 选择优惠券
  237. handlerSelectCoupon(){
  238. },
  239. close(){
  240. this.coupon_show = false
  241. },
  242. // 点击展示优惠券pop
  243. openCouponshow(){
  244. console.log('@@@@')
  245. this.coupon_show = true
  246. },
  247. // 选择优惠券 点击确定按钮
  248. handlerSelectCoupon(){
  249. this.coupon_show = false
  250. }
  251. }
  252. }
  253. </script>
  254. <style lang="scss" scoped>
  255. .container {
  256. min-height: calc(100vh - 40rpx);
  257. background: linear-gradient(to bottom, #bacff5, #F2F4FA, #fff);
  258. padding: 20rpx;
  259. .content-box {
  260. padding: 20rpx 20rpx 120rpx;
  261. max-height: calc(100vh - 180rpx);
  262. overflow-y: auto;
  263. .message-box {
  264. padding: 20rpx;
  265. border-radius: 20rpx;
  266. background-color: #fff;
  267. margin-bottom: 20rpx;
  268. box-shadow: 5px 5px 5px rgb(0, 0, 0, 0.1);
  269. .message-item {
  270. display: flex;
  271. justify-content: space-between;
  272. align-items: center;
  273. .item-left {
  274. font-size: 32rpx;
  275. font-weight: bold;
  276. }
  277. .item-right {
  278. width: 60%;
  279. align-items: center;
  280. .right-img {
  281. width: 50rpx;
  282. height: 50rpx;
  283. margin-left: 20rpx;
  284. }
  285. }
  286. }
  287. .couon-box {
  288. display: flex;
  289. justify-content: space-between;
  290. align-items: center;
  291. .coupon-left {
  292. display: flex;
  293. align-items: center;
  294. font-size: 30rpx;
  295. .img {
  296. width: 50rpx;
  297. height: 50rpx;
  298. margin-right: 20rpx;
  299. }
  300. }
  301. .coupon-right {
  302. display: flex;
  303. align-items: center;
  304. }
  305. }
  306. .goods-title {
  307. font-size: 32rpx;
  308. }
  309. .goods-item {
  310. margin-bottom: 30rpx;
  311. display: flex;
  312. justify-content: space-between;
  313. align-items: center;
  314. .item-left {
  315. display: flex;
  316. .left-img {
  317. width: 130rpx;
  318. height: 130rpx;
  319. border-radius: 10rpx;
  320. }
  321. .left-text {
  322. display: flex;
  323. flex-direction: column;
  324. justify-content: space-around;
  325. margin-left: 20rpx;
  326. .text-name {
  327. font-weight: bold;
  328. font-size: 30rpx;
  329. width: 260rpx;
  330. white-space: nowrap;
  331. overflow: hidden;
  332. text-overflow: ellipsis;
  333. }
  334. .price-box {
  335. display: flex;
  336. font-style: italic;
  337. align-items: center;
  338. .price {
  339. font-size: 34rpx;
  340. font-weight: bold;
  341. margin-right: 20rpx;
  342. }
  343. .false-price {
  344. color: #CACDD4;
  345. text-decoration: line-through;
  346. }
  347. }
  348. }
  349. }
  350. }
  351. .message-name {
  352. font-size: 32rpx;
  353. font-weight: bold;
  354. }
  355. .message-text {
  356. margin-top: 20rpx;
  357. color: #bcbfc3;
  358. }
  359. }
  360. }
  361. }
  362. .flex-end {
  363. display: flex;
  364. justify-content: flex-end;
  365. }
  366. .red-color {
  367. color: #FF4B10;
  368. }
  369. ::v-deep .u-border {
  370. border-style: none !important;
  371. }
  372. .pop-box {
  373. height: 850rpx;
  374. background-color: #F4F4F4;
  375. position: relative;
  376. .pop-title {
  377. font-weight: bold;
  378. font-size: 36rpx;
  379. text-align: center;
  380. padding: 20rpx;
  381. background: linear-gradient(to bottom, #fff,#fff, #F4F4F4);
  382. }
  383. .pop-coupon-box{
  384. max-height: 650rpx;
  385. overflow-y: scroll;
  386. }
  387. .pop-item {
  388. padding: 20rpx;
  389. margin-bottom:10rpx;
  390. .item-box {
  391. padding: 20rpx;
  392. border-radius: 20rpx 20rpx 0 0;
  393. background-color: #fff;
  394. display: flex;
  395. align-items: center;
  396. box-shadow: 0rpx 7rpx 20rpx 10rpx rgba(0,0,0,0.1);
  397. background-image: radial-gradient(circle at left bottom, #F4F4F4, #F4F4F4 40rpx, transparent 16rpx), radial-gradient(circle at right bottom, #F4F4F4, #F4F4F4 55rpx, transparent 16rpx),radial-gradient(circle at right top, #F4F4F4, #F4F4F4 35rpx, transparent 16rpx);
  398. .item-left {
  399. display: flex;
  400. width: 70%;
  401. .img-box,
  402. .left-img {
  403. width: 160rpx;
  404. height: 160rpx;
  405. border-radius: 20rpx;
  406. }
  407. .left-text {
  408. margin-left: 20rpx;
  409. .text-title {
  410. font-size: 34rpx;
  411. width: 350rpx;
  412. white-space: nowrap;
  413. overflow: hidden;
  414. text-overflow: ellipsis;
  415. color: #000;
  416. }
  417. .text {
  418. font-size: 26rpx;
  419. color: #666666;
  420. margin-top: 10rpx;
  421. }
  422. }
  423. }
  424. .item-right {
  425. text-align: center;
  426. width: 30%;
  427. .price {
  428. font-size: 56rpx;
  429. .price-symbol {
  430. font-size: 24rpx;
  431. }
  432. }
  433. .text {
  434. color: #656565;
  435. margin-top: 20rpx;
  436. }
  437. }
  438. }
  439. .item-bottom{
  440. padding: 20rpx 50rpx 20rpx 30rpx;
  441. background-color: #fff;
  442. border-radius: 0 0 20rpx 20rpx;
  443. box-shadow: 0rpx 10rpx 15rpx 0rpx rgba(0,0,0,0.1);
  444. background-image: radial-gradient(circle at left top, #F4F4F4, #F4F4F4 40rpx, transparent 16rpx), radial-gradient(circle at right top, #F4F4F4, #F4F4F4 55rpx, transparent 16rpx);
  445. border-top: 1px dashed #F4F4F4;
  446. color: #b1b4b9;
  447. font-size:26rpx;
  448. font-style:oblique;
  449. text-indent:32.4px;
  450. }
  451. }
  452. .pop-bottom{
  453. position: absolute;
  454. bottom: 0;
  455. width: 100%;
  456. display: flex;
  457. justify-content: center;
  458. .coupon-btn{
  459. width: 100%;
  460. background-color: #FFDE21 !important;
  461. color: #000;
  462. font-size:28rpx;
  463. // height:80rpx;
  464. // line-height: 80rpx;
  465. border-radius: 20rpx;
  466. }
  467. }
  468. }
  469. .btn-box{
  470. width: 100%;
  471. position: fixed;
  472. bottom: 5%;
  473. .btn{
  474. width: 90%;
  475. background: linear-gradient(to right, #1d4350, #a43931);
  476. color: #fff;
  477. border-radius: 40rpx;
  478. text-align: center;
  479. font-size: 32rpx;
  480. padding: 20rpx;
  481. }
  482. }
  483. </style>