confirmOrder.vue 12 KB

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