confirmOrder.vue 12 KB

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