confirmOrder.vue 11 KB

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