confirmOrder.vue 11 KB

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