confirmOrder.vue 12 KB

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