confirmOrder.vue 13 KB

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