confirmOrder.vue 12 KB

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