confirmOrder.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. <template>
  2. <view>
  3. <view class="inner-box">
  4. <!-- 商品列表 -->
  5. <view class="goods-list">
  6. <view v-for="(item,index) in carts" :key="index" class="item" @click="showDetail(item)">
  7. <view class="img-box">
  8. <image :src="item.productImage" mode="aspectFill"></image>
  9. </view>
  10. <view class="info-box">
  11. <view>
  12. <view class="name-box ellipsis2">
  13. <view class="tag">{{utils.getDictLabelName("storeProductType",item.productType)}}</view>{{item.productName}}
  14. </view>
  15. <view class="spec ellipsis2">{{item.productAttrName}}</view>
  16. </view>
  17. <view class="price-num">
  18. <view class="price">
  19. <text class="unit">¥</text>
  20. <text class="num">{{item.price.toFixed(2)}}</text>
  21. </view>
  22. <view class="num">x{{item.cartNum}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <!-- 小计 -->
  27. <view class="sub-total">
  28. <text class="label">订单金额:</text>
  29. <view class="price">
  30. <text class="unit">¥</text>
  31. <text class="num">{{price.totalPrice.toFixed(2)}}</text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <!-- 底部按钮 -->
  37. <view class="btn-foot">
  38. <view class="right">
  39. <view class="total">
  40. <text class="label">实付金额:</text>
  41. <view class="price">
  42. <text class="unit">¥</text>
  43. <text class="num">{{price.payPrice.toFixed(2)}}</text>
  44. </view>
  45. </view>
  46. <view class="btn" @click="submitOrder">支付{{price.payPrice.toFixed(2)}}</view>
  47. </view>
  48. </view>
  49. <view class="message-box" v-if="messageShow">
  50. <view class="left">
  51. <image src="/static/images/close24.png" mode="" @click="closeOrder()" ></image>
  52. <view class="text ellipsis">您有{{count0}}个待支付订单</view>
  53. </view>
  54. <view class="btn" @click="showOrder()">查看</view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. import {getOrderCount} from '@/api/storeOrder'
  60. import {getSalesOrder,addUserCart} from '@/api/companyOrder.js'
  61. export default {
  62. data() {
  63. return {
  64. count0:0,
  65. messageShow:false,
  66. orderKey:null,
  67. price:{
  68. totalPrice:0.00,
  69. payPrice:0.00,
  70. },
  71. carts:[],
  72. }
  73. },
  74. onLoad(option) {
  75. if(this.utils.isLogin()){
  76. this.getOrderCount();
  77. }
  78. console.log("qxj option:"+JSON.stringify(option));
  79. this.orderKey=option.orderKey;
  80. this.getSalesOrder();
  81. },
  82. methods: {
  83. showOrder(){
  84. this.utils.isLogin().then(res => {
  85. if(res){
  86. uni.navigateTo({
  87. url: '/pages_user/user/storeOrder?status=0'
  88. })
  89. }
  90. })
  91. },
  92. closeOrder(){
  93. this.messageShow=false;
  94. },
  95. getOrderCount(){
  96. getOrderCount().then(
  97. res => {
  98. if(res.code==200){
  99. this.count0=res.count0;
  100. if(this.count0>0){
  101. this.messageShow=true;
  102. }
  103. }
  104. },
  105. rej => {}
  106. );
  107. },
  108. showDetail(item) {
  109. uni.navigateTo({
  110. url: './productShowDetails?productId='+item.productId
  111. })
  112. },
  113. getSalesOrder(item){
  114. var that=this;
  115. var data={createOrderKey:this.orderKey}
  116. getSalesOrder(data).then(
  117. res => {
  118. if(res.code==200){
  119. this.carts=res.carts;
  120. this.carts.forEach(function(element) {
  121. that.price.totalPrice+=element.price*element.cartNum;
  122. });
  123. that.price.payPrice=res.totalMoney
  124. }else{
  125. uni.showToast({
  126. icon:'none',
  127. title: res.msg,
  128. });
  129. }
  130. },
  131. rej => {}
  132. );
  133. },
  134. // 提交订单
  135. submitOrder() {
  136. this.utils.isLogin().then(res => {
  137. if(res){
  138. var data={createOrderKey:this.orderKey}
  139. addUserCart(data).then(
  140. res => {
  141. if(res.code==200){
  142. uni.navigateTo({
  143. url: '/pages_shopping/shopping/confirmCreateOrder?type=buy&cartIds='+res.cartIds.toString()+"&companyId="+res.companyId+"&companyUserId="+res.companyUserId+"&createOrderKey="+this.orderKey
  144. })
  145. }else{
  146. uni.showToast({
  147. icon:'none',
  148. title: res.msg,
  149. });
  150. }
  151. },
  152. rej => {}
  153. );
  154. //将购物车产品更新为自己的购物车
  155. }
  156. })
  157. },
  158. }
  159. }
  160. </script>
  161. <style lang="scss">
  162. .inner-box{
  163. padding: 20upx 20upx 140upx;
  164. .goods-list{
  165. margin-top: 20upx;
  166. padding: 0 30upx;
  167. background-color: #FFFFFF;
  168. border-radius: 16upx;
  169. .item{
  170. padding: 30upx 0;
  171. border-bottom: 1px solid #EDEEEF;
  172. display: flex;
  173. align-items: center;
  174. .img-box{
  175. width: 160upx;
  176. height: 160upx;
  177. margin-right: 30upx;
  178. image{
  179. width: 100%;
  180. height: 100%;
  181. }
  182. }
  183. .info-box{
  184. width: calc(100% - 190upx);
  185. height: 160upx;
  186. display: flex;
  187. flex-direction: column;
  188. justify-content: space-between;
  189. .name-box{
  190. font-size: 28upx;
  191. font-family: PingFang SC;
  192. font-weight: 500;
  193. color: #111111;
  194. line-height: 40upx;
  195. .tag{
  196. display: inline-block;
  197. padding: 0 6upx;
  198. height: 30upx;
  199. background: linear-gradient(90deg, #66b2ef 0%,#018C39 100%);
  200. border-radius: 4upx;
  201. margin-right: 10upx;
  202. font-size: 22upx;
  203. font-family: PingFang SC;
  204. font-weight: bold;
  205. color: #FFFFFF;
  206. line-height: 30upx;
  207. float: left;
  208. margin-top: 7upx;
  209. }
  210. }
  211. .spec{
  212. margin-top: 10upx;
  213. font-size: 24upx;
  214. font-family: PingFang SC;
  215. font-weight: 500;
  216. color: #999999;
  217. line-height: 1;
  218. }
  219. .price-num{
  220. display: flex;
  221. align-items: center;
  222. justify-content: space-between;
  223. .price{
  224. display: flex;
  225. align-items: flex-end;
  226. .unit{
  227. font-size: 24upx;
  228. font-family: PingFang SC;
  229. font-weight: 500;
  230. color: #111111;
  231. line-height: 1.2;
  232. margin-right: 4upx;
  233. }
  234. .num{
  235. font-size: 32upx;
  236. font-family: PingFang SC;
  237. font-weight: 500;
  238. color: #111111;
  239. line-height: 1;
  240. }
  241. }
  242. .num{
  243. font-size: 24upx;
  244. font-family: PingFang SC;
  245. font-weight: 500;
  246. color: #999999;
  247. line-height: 1;
  248. }
  249. }
  250. }
  251. }
  252. .sub-total{
  253. height: 88upx;
  254. display: flex;
  255. align-items: center;
  256. justify-content: flex-end;
  257. .label{
  258. font-size: 24upx;
  259. font-family: PingFang SC;
  260. font-weight: 500;
  261. color: #999999;
  262. }
  263. .price{
  264. display: flex;
  265. align-items: flex-end;
  266. .unit{
  267. font-size: 24upx;
  268. font-family: PingFang SC;
  269. font-weight: 500;
  270. color: #FF6633;
  271. line-height: 1.2;
  272. margin-right: 4upx;
  273. }
  274. .num{
  275. font-size: 32upx;
  276. font-family: PingFang SC;
  277. font-weight: bold;
  278. color: #FF6633;
  279. line-height: 1;
  280. }
  281. }
  282. }
  283. }
  284. .points{
  285. height: 88upx;
  286. padding: 0 30upx;
  287. background: #FFFFFF;
  288. border-radius: 16upx;
  289. display: flex;
  290. align-items: center;
  291. justify-content: space-between;
  292. .left{
  293. display: flex;
  294. align-items: center;
  295. image{
  296. width: 28upx;
  297. height: 28upx;
  298. margin-right: 20upx;
  299. }
  300. .text{
  301. font-size: 28upx;
  302. font-family: PingFang SC;
  303. font-weight: 500;
  304. color: #666666;
  305. }
  306. }
  307. .right{
  308. display: flex;
  309. align-items: center;
  310. .text{
  311. font-size: 28upx;
  312. font-family: PingFang SC;
  313. font-weight: 500;
  314. color: #111111;
  315. }
  316. image{
  317. margin-left: 15upx;
  318. width: 14upx;
  319. height: 24upx;
  320. }
  321. }
  322. }
  323. .remarks{
  324. height: 88upx;
  325. padding: 0 30upx;
  326. background: #FFFFFF;
  327. border-radius: 16upx;
  328. margin-top: 20upx;
  329. display: flex;
  330. align-items: center;
  331. input{
  332. width: 100%;
  333. font-size: 28upx;
  334. font-family: PingFang SC;
  335. font-weight: 500;
  336. color: #000000;
  337. }
  338. .input{
  339. font-size: 28upx;
  340. font-family: PingFang SC;
  341. font-weight: 500;
  342. color: #999999;
  343. }
  344. }
  345. }
  346. .btn-foot{
  347. box-sizing: border-box;
  348. width: 100%;
  349. height: 121upx;
  350. background: #FFFFFF;
  351. display: flex;
  352. align-items: center;
  353. justify-content: flex-end;
  354. position: fixed;
  355. left: 0;
  356. bottom: 0;
  357. z-index: 99;
  358. .right{
  359. display: flex;
  360. align-items: center;
  361. .total{
  362. display: flex;
  363. align-items: flex-end;
  364. margin-right: 15upx;
  365. .label{
  366. font-size: 26upx;
  367. font-family: PingFang SC;
  368. font-weight: 500;
  369. color: #999999;
  370. line-height: 1.5;
  371. }
  372. .price{
  373. display: flex;
  374. align-items: flex-end;
  375. .unit{
  376. font-size: 26upx;
  377. font-family: PingFang SC;
  378. font-weight: bold;
  379. color: #FF6633;
  380. line-height: 1.2;
  381. margin-right: 10upx;
  382. }
  383. .num{
  384. font-size: 32upx;
  385. font-family: PingFang SC;
  386. font-weight: bold;
  387. color: #FF6633;
  388. line-height: 1;
  389. }
  390. }
  391. }
  392. .btn{
  393. margin-right: 15upx;
  394. padding: 20rpx 30rpx;
  395. text-align: center;
  396. font-size: 30upx;
  397. font-family: PingFang SC;
  398. font-weight: bold;
  399. color: #FFFFFF;
  400. background:#018C39;
  401. border-radius: 44upx;
  402. }
  403. }
  404. }
  405. </style>
  406. <style lang="less" scoped>
  407. .coupon {
  408. height: 100%;
  409. }
  410. /*优惠券列表公共*/
  411. .coupon-list {
  412. }
  413. .coupon-list .item {
  414. display: flex;
  415. flex-direction: column;
  416. justify-content: center;
  417. align-items: center;
  418. width: 100%;
  419. height: 1.7 * 100rpx;
  420. margin-bottom: 0.16 * 100rpx;
  421. }
  422. .coupon-list .item .money {
  423. background-size: 100% 100%;
  424. width: 2.4 * 100rpx;
  425. height: 100%;
  426. color: #fff;
  427. font-size: 0.36 * 100rpx;
  428. font-weight: bold;
  429. text-align: center;
  430. display: flex;
  431. flex-direction: column;
  432. align-items: center;
  433. justify-content: center;
  434. position: relative;
  435. }
  436. .coupon-list .item .money .img{
  437. position: absolute;
  438. width: 2.4 * 100rpx;
  439. height: 100%;
  440. color: #fff;
  441. }
  442. .coupon-list .item .money .num {
  443. font-size: 0.6 * 100rpx;
  444. }
  445. .coupon-list .item .money .pic-num {
  446. font-size: 20rpx;
  447. z-index: 99;
  448. }
  449. .coupon-list .item .text {
  450. width: 4.5 * 100rpx;
  451. padding: 0 0.17 * 100rpx 0 0.24 * 100rpx;
  452. background-color: #fff;
  453. box-sizing: border-box;
  454. }
  455. .coupon-list .item .text .condition {
  456. font-size: 0.3 * 100rpx;
  457. color: #282828;
  458. height: 0.93 * 100rpx;
  459. line-height: 0.93 * 100rpx;
  460. border-bottom: 1px solid #f0f0f0;
  461. }
  462. .coupon-list .item .text .data {
  463. font-size: 0.2 * 100rpx;
  464. color: #999;
  465. height: 0.76 * 100rpx;
  466. }
  467. .coupon-list .item .text .data .bnt {
  468. width: 1.36 * 100rpx;
  469. height: 0.44 * 100rpx;
  470. border-radius: 0.22 * 100rpx;
  471. font-size: 0.22 * 100rpx;
  472. color: #fff;
  473. text-align: center;
  474. line-height: 0.44 * 100rpx;
  475. background-color: red;
  476. }
  477. .coupon-list .item .text .data .bnt.gray {
  478. background-color: #ccc;
  479. }
  480. .message-box{
  481. box-sizing: border-box;
  482. width: 693upx;
  483. height: 84upx;
  484. background: #F3FFFD;
  485. border: 1px solid #C7E9E5;
  486. box-shadow: 0px 4upx 12upx 0px rgba(90, 203, 138, 0.16);
  487. border-radius: 16upx;
  488. position: fixed;
  489. left: 50%;
  490. transform: translateX(-50%);
  491. bottom: 128upx;
  492. z-index: 99;
  493. display: flex;
  494. align-items: center;
  495. justify-content: space-between;
  496. padding: 0 20upx 0 30upx;
  497. .left{
  498. width: 80%;
  499. display: flex;
  500. align-items: center;
  501. image{
  502. width: 24upx;
  503. height: 24upx;
  504. margin-right: 18upx;
  505. }
  506. .text{
  507. width: 90%;
  508. font-size: 28upx;
  509. font-family: PingFang SC;
  510. font-weight: 500;
  511. color:#018C39;
  512. }
  513. }
  514. .btn{
  515. width: 100upx;
  516. height: 48upx;
  517. line-height: 48upx;
  518. text-align: center;
  519. font-size: 24upx;
  520. font-family: PingFang SC;
  521. font-weight: 500;
  522. color: #FFFFFF;
  523. border: 1px solid #D2E6FF;
  524. background: linear-gradient(135deg, #66b2ef 0%,#018C39 100%);
  525. border-radius: 24upx;
  526. margin-left: 30upx;
  527. }
  528. }
  529. </style>